#92 Implement qoutes feedback
This commit is contained in:
parent
cab2b2c478
commit
6fc753fc19
@ -53,7 +53,8 @@ public static function form(Form $form): Form
|
||||
->columnSpan(2),
|
||||
])
|
||||
->columns(2)
|
||||
->columnSpan(fn (?Quote $record) => $record === null ? 3 : 2),
|
||||
->columnSpan(fn (?Quote $record) => $record === null ? 3 : 2)
|
||||
->extraAttributes(['class' => 'h-full']),
|
||||
|
||||
Section::make()
|
||||
->schema([
|
||||
@ -69,7 +70,8 @@ public static function form(Form $form): Form
|
||||
|
||||
])
|
||||
->columnSpan(1)
|
||||
->hidden(fn (?Quote $record) => $record === null),
|
||||
->hidden(fn (?Quote $record) => $record === null)
|
||||
->extraAttributes(['class' => 'h-full']),
|
||||
]),
|
||||
|
||||
TableRepeater::make('embroideryEntries')
|
||||
@ -115,30 +117,24 @@ public static function form(Form $form): Form
|
||||
TextInput::make('logo')
|
||||
->label('Logo name')
|
||||
->columnSpan(2),
|
||||
TextInput::make('placement'),
|
||||
TextInput::make('quantity')
|
||||
->rules(['numeric']),
|
||||
->rules(['numeric'])
|
||||
->label('Qty'),
|
||||
TextInput::make('width')
|
||||
->rules('numeric'),
|
||||
TextInput::make('height')
|
||||
->rules('numeric'),
|
||||
TextInput::make('setup_amount')
|
||||
->label('Setup qty')
|
||||
->rules('numeric'),
|
||||
TextInput::make('color_amount')
|
||||
->label('Color qty')
|
||||
->rules('numeric'),
|
||||
TextInput::make('color_match')
|
||||
->rules('numeric'),
|
||||
TextInput::make('color_change')
|
||||
->rules('numeric'),
|
||||
Select::make('color_match')
|
||||
->required()
|
||||
->options([
|
||||
true => 'Yes',
|
||||
false => 'No',
|
||||
])
|
||||
->default(false),
|
||||
Select::make('color_change')
|
||||
->required()
|
||||
->options([
|
||||
true => 'Yes',
|
||||
false => 'No',
|
||||
])
|
||||
->default(false),
|
||||
TextInput::make('flash')
|
||||
->rules(['numeric']),
|
||||
TextInput::make('fleece')
|
||||
@ -147,19 +143,33 @@ public static function form(Form $form): Form
|
||||
->rules('numeric'),
|
||||
TextInput::make('run_charge')
|
||||
->rules('numeric'),
|
||||
TextInput::make('other_charges')
|
||||
TextInput::make('artwork_fee')
|
||||
->label('Artwork fee')
|
||||
->rules('numeric'),
|
||||
TextInput::make('repacking_fee')
|
||||
->label('Repack. fee')
|
||||
->rules('numeric'),
|
||||
])
|
||||
->addActionLabel('Add Screen Print Entry')
|
||||
->defaultItems(0)
|
||||
->reorderable()
|
||||
->colStyles([
|
||||
'logo' => 'width: 15%',
|
||||
'logo' => 'width: 11%',
|
||||
'placement' => 'width: 11%',
|
||||
'quantity' => 'width: 5%',
|
||||
'width' => 'width: 6%',
|
||||
'height' => 'width: 6%',
|
||||
'setup_amount' => 'width: 5%',
|
||||
'color_amount' => 'width: 5%',
|
||||
'color_match' => 'width: 6%',
|
||||
'color_change' => 'width: 5%',
|
||||
'flash' => 'width: 6%',
|
||||
'fleece' => 'width: 6%',
|
||||
'poly_ink' => 'width: 6%',
|
||||
'run_charge' => 'width: 6%',
|
||||
'artwork_fee' => 'width: 6%',
|
||||
'repacking_fee' => 'width: 6%',
|
||||
|
||||
]),
|
||||
|
||||
TableRepeater::make('heatTransferEntries')
|
||||
@ -167,6 +177,7 @@ public static function form(Form $form): Form
|
||||
->schema([
|
||||
TextInput::make('logo')
|
||||
->label('Logo name'),
|
||||
TextInput::make('placement'),
|
||||
TextInput::make('quantity')
|
||||
->prefix('#')
|
||||
->rules('numeric'),
|
||||
@ -184,7 +195,8 @@ public static function form(Form $form): Form
|
||||
->defaultItems(0)
|
||||
->reorderable()
|
||||
->colStyles([
|
||||
'logo' => 'width: 20%',
|
||||
'logo' => 'width: 25%',
|
||||
'placement' => 'width: 25%',
|
||||
'quantity' => 'width: 10%',
|
||||
'width' => 'width: 11%',
|
||||
'height' => 'width: 11%',
|
||||
|
@ -12,6 +12,7 @@ class HeatTransferEntry extends Model
|
||||
|
||||
protected $fillable = [
|
||||
'quote_id',
|
||||
'placement',
|
||||
'quantity',
|
||||
'logo',
|
||||
'width',
|
||||
|
@ -30,15 +30,11 @@ public function getTotalAttribute(): float
|
||||
$embDigitizingTotal = $this->embroideryEntries()->sum('digitizing_cost');
|
||||
$embRunChargeTotal = $this->embroideryEntries()->sum('run_charge');
|
||||
|
||||
$scpRunChargeTotal = $this->screenPrintEntries()->sum('run_charge');
|
||||
$scpOtherChargeTotal = $this->screenPrintEntries()->sum('other_charges');
|
||||
$scpFleeceTotal = $this->screenPrintEntries()->sum('fleece');
|
||||
$scpFlashTotal = $this->screenPrintEntries()->sum('flash');
|
||||
$scpPolyInkTotal = $this->screenPrintEntries()->sum('poly_ink');
|
||||
$scpTotal = $this->screenPrintEntries->sum(fn (ScreenPrintEntry $record) => $record->total_price);
|
||||
|
||||
$heatTransferTotal = $this->heatTransferEntries()->sum('price');
|
||||
|
||||
return $embDigitizingTotal + $embRunChargeTotal + $scpRunChargeTotal + $scpOtherChargeTotal + $scpFleeceTotal + $scpFlashTotal + $scpPolyInkTotal + $heatTransferTotal;
|
||||
return $embDigitizingTotal + $embRunChargeTotal + $scpTotal + $heatTransferTotal;
|
||||
}
|
||||
|
||||
public function customer(): BelongsTo
|
||||
|
@ -14,6 +14,7 @@ class ScreenPrintEntry extends Model
|
||||
'quote_id',
|
||||
'quantity',
|
||||
'logo',
|
||||
'placement',
|
||||
'width',
|
||||
'height',
|
||||
'color_amount',
|
||||
@ -24,7 +25,8 @@ class ScreenPrintEntry extends Model
|
||||
'flash',
|
||||
'fleece',
|
||||
'poly_ink',
|
||||
'other_charges',
|
||||
'artwork_fee',
|
||||
'repacking_fee',
|
||||
'notes',
|
||||
];
|
||||
|
||||
@ -34,7 +36,9 @@ class ScreenPrintEntry extends Model
|
||||
|
||||
protected function getTotalPriceAttribute(): float
|
||||
{
|
||||
return $this->flash + $this->fleece + $this->poly_ink + $this->run_charge + $this->other_charges;
|
||||
$perUnitTotals = ($this->flash + $this->fleece + $this->poly_ink + $this->run_charge + $this->repacking_fee) * $this->quantity ?? 0;
|
||||
|
||||
return $perUnitTotals + $this->artwork_fee + $this->color_change + $this->color_match;
|
||||
}
|
||||
|
||||
public function quote(): BelongsTo
|
||||
|
@ -18,6 +18,7 @@ public function definition(): array
|
||||
{
|
||||
return [
|
||||
'quantity' => $this->faker->numberBetween(1, 10),
|
||||
'placement' => $this->faker->words(2, true),
|
||||
'logo' => $this->faker->words(2, true),
|
||||
'width' => $this->faker->randomFloat(2, 1, 5),
|
||||
'height' => $this->faker->randomFloat(2, 1, 5),
|
||||
|
@ -19,17 +19,19 @@ public function definition(): array
|
||||
return [
|
||||
'quantity' => random_int(1, 10),
|
||||
'logo' => $this->faker->words(2, true),
|
||||
'placement' => $this->faker->words(2, true),
|
||||
'width' => $this->faker->randomFloat(2, 1, 5),
|
||||
'height' => $this->faker->randomFloat(2, 1, 5),
|
||||
'color_amount' => random_int(1, 5),
|
||||
'setup_amount' => random_int(1, 5),
|
||||
'run_charge' => $this->faker->randomFloat(2, 1, 10),
|
||||
'color_change' => $this->faker->boolean(),
|
||||
'color_match' => $this->faker->boolean(),
|
||||
'flash' => $this->faker->randomFloat(2, 1, 10),
|
||||
'fleece' => $this->faker->randomFloat(2, 1, 10),
|
||||
'poly_ink' => $this->faker->randomFloat(2, 1, 10),
|
||||
'other_charges' => $this->faker->randomFloat(2, 1, 10),
|
||||
'artwork_fee' => $this->faker->randomFloat(2, 1, 10),
|
||||
'color_change' => $this->faker->randomFLoat(2, 1, 10),
|
||||
'color_match' => $this->faker->randomFLoat(2, 1, 10),
|
||||
'flash' => $this->faker->randomFloat(2, 0, 2),
|
||||
'fleece' => $this->faker->randomFloat(2, 0, 2),
|
||||
'poly_ink' => $this->faker->randomFloat(2, 0, 2),
|
||||
'run_charge' => $this->faker->randomFloat(2, 0, 2),
|
||||
'repacking_fee' => $this->faker->randomFloat(2, 0, 2),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -18,17 +18,19 @@ public function up(): void
|
||||
|
||||
$table->integer('quantity')->nullable();
|
||||
$table->string('logo')->nullable();
|
||||
$table->string('placement')->nullable();
|
||||
$table->decimal('width', 6, 2)->nullable();
|
||||
$table->decimal('height', 6, 2)->nullable();
|
||||
$table->integer('color_amount')->nullable();
|
||||
$table->integer('setup_amount')->nullable();
|
||||
$table->decimal('run_charge', 8, 2)->nullable();
|
||||
$table->boolean('color_change')->default(false);
|
||||
$table->boolean('color_match')->default(false);
|
||||
$table->decimal('flash', 8, 2)->default(false);
|
||||
$table->decimal('fleece', 8, 2)->default(false);
|
||||
$table->decimal('poly_ink', 8, 2)->default(false);
|
||||
$table->decimal('other_charges', 8, 2)->default(false);
|
||||
$table->decimal('color_change', 8, 2)->nullable();
|
||||
$table->decimal('color_match', 8, 2)->nullable();
|
||||
$table->decimal('flash', 8, 2)->nullable();
|
||||
$table->decimal('fleece', 8, 2)->nullable();
|
||||
$table->decimal('poly_ink', 8, 2)->nullable();
|
||||
$table->decimal('artwork_fee', 8, 2)->nullable();
|
||||
$table->decimal('repacking_fee', 8, 2)->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
@ -17,6 +17,7 @@ public function up(): void
|
||||
$table->foreignId('quote_id')->constrained()->cascadeOnDelete();
|
||||
|
||||
$table->integer('quantity')->nullable();
|
||||
$table->string('placement')->nullable();
|
||||
$table->string('logo')->nullable();
|
||||
$table->decimal('width', 6, 2)->nullable();
|
||||
$table->decimal('height', 6, 2)->nullable();
|
||||
|
@ -79,7 +79,7 @@
|
||||
<tr>
|
||||
<td>Screen Printing</td>
|
||||
<td>{{$entry->logo}}</td>
|
||||
<td></td>
|
||||
<td>{{$entry->placement}}</td>
|
||||
<td class="text-end">{{$entry->quantity}}</td>
|
||||
<td class="text-end">${{number_format($entry->total_price, 2)}}</td>
|
||||
</tr>
|
||||
@ -89,7 +89,7 @@
|
||||
<tr>
|
||||
<td>Heat Transfer</td>
|
||||
<td>{{$entry->logo}}</td>
|
||||
<td></td>
|
||||
<td>{{$entry->placement}}</td>
|
||||
<td class="text-end">{{$entry->quantity}}</td>
|
||||
<td class="text-end">${{number_format($entry->price, 2)}}</td>
|
||||
</tr>
|
||||
@ -109,4 +109,3 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user