Added pre-pro and printed toggles to order

orders
Nisse Lommerde 4 weeks ago
parent 3c98de929e
commit d950955371

@ -41,58 +41,73 @@ class OrderResource extends Resource
return $form->schema([
Section::make([
Section::make([
Select::make('order_type')
->required()
->options(OrderType::class)
->searchable(),
Split::make([
Select::make('customer_id')
Grid::make(1)
->schema([
Select::make('order_type')
->required()
->label('Customer')
->options(Customer::all()->pluck('company_name', 'id'))
->reactive()
->options(OrderType::class)
->searchable(),
Select::make('contact_id')
->label('Contact')
->options(fn ($get): array => Contact::where('customer_id', $get('customer_id') ?? null)
->get()
->pluck('full_name', 'id')
->toArray())
->searchable(),
]),
Split::make([
Select::make('customer_id')
->required()
->label('Customer')
->options(Customer::all()->pluck('company_name', 'id'))
->reactive()
->searchable(),
TextInput::make('customer_po')
->required()
->label('Customer PO'),
Select::make('contact_id')
->label('Contact')
->options(fn ($get): array => Contact::where('customer_id', $get('customer_id') ?? null)
->get()
->pluck('full_name', 'id')
->toArray())
->searchable(),
]),
Split::make([
DatePicker::make('order_date')
->required()
->default(today()),
DatePicker::make('due_date')
TextInput::make('customer_po')
->required()
->default(today()->add('10 days')),
]),
])->columnSpan(1),
->label('Customer PO'),
Split::make([
DatePicker::make('order_date')
->required()
->default(today()),
DatePicker::make('due_date')
->required()
->default(today()->add('10 days')),
]),
Section::make([
ToggleButtons::make('status')
->required()
->options(OrderStatus::class)
->inline(),
Textarea::make('notes')
->rows(3),
])->columnSpan(1),
Grid::make(1)
->schema([
ToggleButtons::make('status')
->required()
->options(OrderStatus::class)
->inline(),
ToggleButtons::make('order_attributes')
->options(OrderAttributes::class)
->multiple()
->inline(),
ToggleButtons::make('order_attributes')
->options(OrderAttributes::class)
->multiple()
->inline(),
Textarea::make('notes')
->rows(3),
ToggleButtons::make('printed')
->boolean()
->inline(),
ToggleButtons::make('pre_production')
->label('Pre-production')
->boolean()
->inline()
->colors([
'true' => 'info',
'false' => 'info',
]),
])->columnSpan(1),
])->columnSpan(1),
])->columns(2),
TableRepeater::make('order_products')
@ -126,7 +141,7 @@ class OrderResource extends Resource
->cloneable(),
Repeater::make('services')
->label('Production Details')
->label('Product Services')
->schema([
Grid::make(19)
->schema([

@ -38,6 +38,8 @@ class Order extends Model
'digitizing',
'garments',
'supplied_file',
'printed',
'pre_production',
];
protected $casts = [

@ -28,6 +28,9 @@ return new class extends Migration
$table->boolean('garments')->default(0);
$table->boolean('supplied_file')->default(0);
$table->boolean('printed')->default(0);
$table->boolean('pre_production')->default(0);
$table->softDeletes();
$table->timestamps();
});

@ -14,7 +14,7 @@ class ContactSeeder extends Seeder
public function run(): void
{
foreach (Customer::all() as $customer) {
if ($customer->company_name == 'Genumark') {
if ($customer->company_name === 'Genumark') {
$customer->contacts()->createMany([
[
'first_name' => 'Tammy',
@ -50,7 +50,7 @@ class ContactSeeder extends Seeder
],
]);
} else {
Contact::factory(rand(1, 4))->for($customer);
Contact::factory(rand(1, 4))->for($customer)->create();
}
}
}

Loading…
Cancel
Save