mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 05:22:02 +00:00
refactor(FE): Allow supplier to be optional in movement form
This commit is contained in:
@@ -37,7 +37,7 @@ type MovementFormSchemaType = {
|
||||
value: number;
|
||||
label: string;
|
||||
} | null;
|
||||
supplier_id: number;
|
||||
supplier_id?: number | null;
|
||||
products: {
|
||||
product?: {
|
||||
value: number;
|
||||
@@ -69,7 +69,7 @@ export type DeliverySchema = {
|
||||
value: number;
|
||||
label: string;
|
||||
} | null;
|
||||
supplier_id: number;
|
||||
supplier_id?: number | null;
|
||||
products: {
|
||||
product?: {
|
||||
value: number;
|
||||
@@ -151,9 +151,10 @@ const DeliveryObjectSchema: Yup.ObjectSchema<DeliverySchema> = Yup.object({
|
||||
label: Yup.string().required(),
|
||||
}).nullable(),
|
||||
supplier_id: Yup.number()
|
||||
.required('Supplier wajib diisi!')
|
||||
.optional()
|
||||
.nullable()
|
||||
.min(1, 'Supplier wajib diisi!')
|
||||
.typeError('Supplier wajib diisi!'),
|
||||
.typeError('Supplier harus berupa angka!'),
|
||||
products: Yup.array()
|
||||
.of(DeliveryProductObjectSchema)
|
||||
.min(1, 'Minimal harus ada 1 produk!')
|
||||
|
||||
@@ -1665,15 +1665,7 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
|
||||
<span className='text-error'>*</span>
|
||||
</span>
|
||||
</th>
|
||||
<th>
|
||||
Supplier
|
||||
<span
|
||||
className='tooltip tooltip-error tooltip-bottom z-9999'
|
||||
data-tip='required'
|
||||
>
|
||||
<span className='text-error'>*</span>
|
||||
</span>
|
||||
</th>
|
||||
<th>Supplier</th>
|
||||
<th>
|
||||
Plat Nomor
|
||||
<span
|
||||
@@ -1787,7 +1779,6 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
|
||||
</td>
|
||||
<td>
|
||||
<SelectInput
|
||||
required
|
||||
placeholder='Pilih supplier...'
|
||||
value={delivery.supplier}
|
||||
onChange={(val) =>
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ export type CreateMovementPayloadData = {
|
||||
document_index?: number;
|
||||
driver_name: string;
|
||||
vehicle_plate: string;
|
||||
supplier_id: number;
|
||||
supplier_id?: number | null;
|
||||
products: {
|
||||
product_id: number;
|
||||
product_qty: number;
|
||||
|
||||
Reference in New Issue
Block a user