YASSIN459
am tired from try and try pls help
thanq you sire this is the code https://github.com/yassin459dz/CAR-WORKSHOP
34 replies
am tired from try and try pls help
Wizard\Step::make('Delivery')
->schema([
TextInput::make('km')->required()->numeric(),
TextInput::make('bl_number')->required(),
TextInput::make('product')->required(),
TextInput::make('price')->numeric(),
]),
Wizard\Step::make('Billing')
->schema([
TextInput::make('qte')
->numeric(),
TextInput::make('total')
->numeric(),
// TextInput::make('remark')
// ->maxLength(255),
]),
])
]);
34 replies
am tired from try and try pls help
TextInput::make('matricule')
->label('Matricule')
->live()
->afterStateUpdated(function ($state, callable $set, $get) {
$clientId = $get('client_id');
$carId = $get('car_id');
if (!$clientId || !$carId) {
$set('matricule_id', null);
return;
}
$set('matricule', $state);
}),
TextInput::make('matricule_id')
->label('Matricule ID'),
]),
34 replies
am tired from try and try pls help
->live()
->afterStateUpdated(function ($state, $set, $get) {
$clientId = $get('client_id');
if ($clientId && $state) {
$matricule = Matricule::where('client_id', $clientId)
->where('car_id', $state)
->first();
if ($matricule) {
$set('matricule_id', $matricule->id);
$set('matricule', $matricule->mat);
} else {
$set('matricule_id', null);
$set('matricule', '');
}
} else {
$set('matricule_id', null);
$set('matricule', '');
}
}),
34 replies
am tired from try and try pls help
Select::make('car_id')
->label('Car')
->searchable()
->options(function ($get) {
return $get('car_options') ?: [];
})
->createOptionForm([
TextInput::make('model')->required(),
])
->createOptionUsing(function ($data, $set, $get) {
$car = Car::create($data);
$clientId = $get('client_id');
if ($clientId) {
$carsRelated = Car::where('client_id', $clientId)->pluck('model', 'id')->toArray();
$otherCars = Car::whereNotIn('id', array_keys($carsRelated))->pluck('model', 'id')->toArray();
$carOptions = [
'Related Cars' => $carsRelated,
'Other Cars' => $otherCars,
];
$set('car_options', $carOptions);
}
return $car->id;
})
34 replies
am tired from try and try pls help
->live()
->afterStateUpdated(function ($state, $set) {
$client = Client::find($state);
if ($client) {
$firstCar = $client->cars()->first();
if ($firstCar) {
$set('car_id', $firstCar->id);
$carsRelated = $client->cars()->pluck('model', 'id')->toArray();
$otherCars = Car::whereNotIn('id', array_keys($carsRelated))->pluck('model', 'id')->toArray();
$carOptions = [
'Related Cars' => $carsRelated,
'Other Cars' => $otherCars,
];
$set('car_options', $carOptions);
$matricule = Matricule::where('client_id', $client->id)
->where('car_id', $firstCar->id)
->first();
if ($matricule) {
$set('matricule_id', $matricule->id);
$set('matricule', $matricule->mat);
} else {
$set('matricule_id', null);
$set('matricule', '');
}
} else {
$set('car_id', null);
$set('car_options', []);
$set('matricule_id', null);
$set('matricule', '');
}
34 replies