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