Merge branch 'refactor/inventory_stock' of https://gitea.quo.ar/tbianchini/shopit-back into refactor/inventory_stock
This commit is contained in:
@@ -20,8 +20,7 @@ class UpsertFoodVariantsRequest extends FormRequest
|
||||
|
||||
return [
|
||||
'variants' => ['required', 'array', 'min:1', 'max:500'],
|
||||
'stock_adjustment_id' => ['nullable', 'uuid'],
|
||||
'variants.*' => ['required', 'array:id,event_date_id,schedule,service,description,stock,stock_difference,price'],
|
||||
'variants.*' => ['required', 'array:id,event_date_id,schedule,service,description,stock,price'],
|
||||
'variants.*.id' => ['sometimes', 'nullable', 'integer', 'distinct'],
|
||||
'variants.*.event_date_id' => [
|
||||
'required',
|
||||
@@ -33,8 +32,7 @@ class UpsertFoodVariantsRequest extends FormRequest
|
||||
'variants.*.schedule' => ['required', 'string', 'max:255'],
|
||||
'variants.*.service' => ['required', 'string', 'max:255'],
|
||||
'variants.*.description' => ['sometimes', 'nullable', 'string'],
|
||||
'variants.*.stock' => ['sometimes', 'integer', 'min:0'],
|
||||
'variants.*.stock_difference' => ['sometimes', 'integer'],
|
||||
'variants.*.stock' => ['required', 'integer', 'min:0'],
|
||||
'variants.*.price' => ['required', 'numeric', 'min:0', 'max:99999999.99'],
|
||||
];
|
||||
}
|
||||
@@ -51,20 +49,6 @@ class UpsertFoodVariantsRequest extends FormRequest
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($variant['id']) && ! array_key_exists('stock_difference', $variant)) {
|
||||
$validator->errors()->add(
|
||||
"variants.{$index}.stock_difference",
|
||||
'La diferencia de stock es obligatoria al actualizar una variante.',
|
||||
);
|
||||
}
|
||||
|
||||
if (! isset($variant['id']) && ! array_key_exists('stock', $variant)) {
|
||||
$validator->errors()->add(
|
||||
"variants.{$index}.stock",
|
||||
'El stock inicial es obligatorio al crear una variante.',
|
||||
);
|
||||
}
|
||||
|
||||
$key = implode('|', [
|
||||
$variant['event_date_id'] ?? '',
|
||||
mb_strtolower(trim((string) ($variant['schedule'] ?? ''))),
|
||||
|
||||
Reference in New Issue
Block a user