feat(FE-208,212): simplify PurchaseOrder forms by removing unused fields and updating user names

This commit is contained in:
rstubryan
2025-11-12 10:51:57 +07:00
parent 45f12cad4f
commit bc53b9073c
2 changed files with 9 additions and 92 deletions
@@ -5,7 +5,6 @@ import { useFormik } from 'formik';
import { Icon } from '@iconify/react'; import { Icon } from '@iconify/react';
import { toast } from 'react-hot-toast'; import { toast } from 'react-hot-toast';
import { useSearchParams } from 'next/navigation'; import { useSearchParams } from 'next/navigation';
import Link from 'next/link';
import Button from '@/components/Button'; import Button from '@/components/Button';
import TextInput from '@/components/input/TextInput'; import TextInput from '@/components/input/TextInput';
import NumberInput from '@/components/input/NumberInput'; import NumberInput from '@/components/input/NumberInput';
@@ -406,11 +405,6 @@ const PurchaseOrderAcceptApprovalForm = ({
Item Item
<span className='text-error'>*</span> <span className='text-error'>*</span>
</th> </th>
<th>Gudang</th>
<th>Produk</th>
<th>Jenis Produk</th>
<th>Jumlah</th>
<th>Satuan</th>
<th> <th>
Tanggal Diterima Tanggal Diterima
<span className='text-error'>*</span> <span className='text-error'>*</span>
@@ -477,83 +471,6 @@ const PurchaseOrderAcceptApprovalForm = ({
}} }}
/> />
</td> </td>
<td>
<TextInput
name={`items.${idx}.warehouse`}
type='text'
value={selectedPurchaseItem?.warehouse?.name || ''}
readOnly={true}
placeholder='Pilih item terlebih dahulu'
className={{
wrapper: 'min-w-32',
}}
disabled={true}
/>
</td>
<td>
<TextInput
name={`items.${idx}.product_name`}
type='text'
value={selectedPurchaseItem?.product?.name || ''}
readOnly={true}
placeholder='Pilih item terlebih dahulu'
className={{
wrapper: 'min-w-48',
}}
disabled={true}
/>
</td>
<td>
<TextInput
name={`items.${idx}.product_category`}
type='text'
value={
typeof selectedPurchaseItem?.product
?.product_category === 'string'
? selectedPurchaseItem.product.product_category
: selectedPurchaseItem?.product?.product_category
?.name || ''
}
readOnly={true}
placeholder='Pilih item terlebih dahulu'
className={{
wrapper: 'min-w-32',
}}
disabled={true}
/>
</td>
<td>
<TextInput
name={`items.${idx}.quantity`}
type='text'
value={
selectedPurchaseItem?.quantity
? selectedPurchaseItem.quantity.toLocaleString(
'id-ID'
)
: ''
}
readOnly={true}
placeholder='Pilih item terlebih dahulu'
className={{
wrapper: 'min-w-24',
}}
disabled={true}
/>
</td>
<td>
<TextInput
name={`items.${idx}.uom`}
type='text'
value={selectedPurchaseItem?.product?.uom?.name || ''}
readOnly={true}
placeholder='Pilih item terlebih dahulu'
className={{
wrapper: 'min-w-24',
}}
disabled={true}
/>
</td>
<td> <td>
<TextInput <TextInput
required required
@@ -10,7 +10,7 @@ import { BaseGroupedApproval } from '@/types/api/api-general';
import { PURCHASE_ORDER_APPROVAL_LINE } from '@/config/approval-line'; import { PURCHASE_ORDER_APPROVAL_LINE } from '@/config/approval-line';
interface PurchaseOrderDetailProps { interface PurchaseOrderDetailProps {
type?: 'detail' | 'edit' | 'approval-purchasing' | 'approval-manager'; type?: 'detail' | 'edit';
} }
const dummyGroupedApprovals: BaseGroupedApproval[] = [ const dummyGroupedApprovals: BaseGroupedApproval[] = [
@@ -26,8 +26,8 @@ const dummyGroupedApprovals: BaseGroupedApproval[] = [
action_by: { action_by: {
id: 1, id: 1,
id_user: 1, id_user: 1,
email: 'staff@company.com', email: 'user@company.com',
name: 'Staff Pengajuan', name: 'User Pengajuan',
}, },
action_at: '2025-01-10T08:00:00Z', action_at: '2025-01-10T08:00:00Z',
}, },
@@ -46,7 +46,7 @@ const dummyGroupedApprovals: BaseGroupedApproval[] = [
id: 2, id: 2,
id_user: 2, id_user: 2,
email: 'purchasing@company.com', email: 'purchasing@company.com',
name: 'Ahmad Purchasing', name: 'Staff Purchasing',
}, },
action_at: '2025-01-10T10:30:00Z', action_at: '2025-01-10T10:30:00Z',
}, },
@@ -65,7 +65,7 @@ const dummyGroupedApprovals: BaseGroupedApproval[] = [
id: 3, id: 3,
id_user: 3, id_user: 3,
email: 'manager.purchasing@company.com', email: 'manager.purchasing@company.com',
name: 'Budi Manager Purchasing', name: 'Manager Purchasing',
}, },
action_at: '2025-01-10T14:15:00Z', action_at: '2025-01-10T14:15:00Z',
}, },
@@ -83,8 +83,8 @@ const dummyGroupedApprovals: BaseGroupedApproval[] = [
action_by: { action_by: {
id: 4, id: 4,
id_user: 4, id_user: 4,
email: 'warehouse@company.com', email: 'user@company.com',
name: 'Candra Warehouse', name: 'User Pengajuan',
}, },
action_at: '2025-01-12T09:00:00Z', action_at: '2025-01-12T09:00:00Z',
}, },
@@ -102,8 +102,8 @@ const dummyGroupedApprovals: BaseGroupedApproval[] = [
action_by: { action_by: {
id: 5, id: 5,
id_user: 5, id_user: 5,
email: 'finance@company.com', email: 'user@company.com',
name: 'Diana Finance', name: 'User Pengajuan',
}, },
action_at: '2025-01-12T16:00:00Z', action_at: '2025-01-12T16:00:00Z',
}, },