refactor(FE-438): Localize modal buttons and stub uniformity details

This commit is contained in:
rstubryan
2025-12-28 18:48:00 +07:00
parent 2d0c8dbd3f
commit 9f0dc8c644
@@ -541,10 +541,10 @@ const UniformityTable = ({ refresh }: { refresh?: () => void }) => {
text={`Delete This Data?`} text={`Delete This Data?`}
subtitleText='Are you sure you want to delete this data?' subtitleText='Are you sure you want to delete this data?'
secondaryButton={{ secondaryButton={{
text: 'Tidak', text: 'Cancel',
}} }}
primaryButton={{ primaryButton={{
text: 'Ya', text: 'Delete',
color: 'primary', color: 'primary',
isLoading: isDeleteLoading, isLoading: isDeleteLoading,
onClick: singleDeleteHandler, onClick: singleDeleteHandler,
@@ -615,10 +615,10 @@ const UniformityTable = ({ refresh }: { refresh?: () => void }) => {
text={`Delete This Data?`} text={`Delete This Data?`}
subtitleText={`Are you sure you want to delete this data? (${selectedRowIds.length} data)`} subtitleText={`Are you sure you want to delete this data? (${selectedRowIds.length} data)`}
secondaryButton={{ secondaryButton={{
text: 'Tidak', text: 'Cancel',
}} }}
primaryButton={{ primaryButton={{
text: 'Ya', text: 'Delete',
color: 'primary', color: 'primary',
isLoading: isBulkActionLoading, isLoading: isBulkActionLoading,
onClick: bulkDeleteHandler, onClick: bulkDeleteHandler,
@@ -689,10 +689,10 @@ const UniformityTable = ({ refresh }: { refresh?: () => void }) => {
text='Approve This Submission?' text='Approve This Submission?'
subtitleText='Are you sure you want to approve this submission?' subtitleText='Are you sure you want to approve this submission?'
secondaryButton={{ secondaryButton={{
text: 'Tidak', text: 'Cancel',
}} }}
primaryButton={{ primaryButton={{
text: 'Ya', text: 'Approve',
color: 'primary', color: 'primary',
isLoading: isDeleteLoading, isLoading: isDeleteLoading,
onClick: singleApproveHandler, onClick: singleApproveHandler,
@@ -707,34 +707,32 @@ const UniformityTable = ({ refresh }: { refresh?: () => void }) => {
{ {
id: 'tanggal', id: 'tanggal',
label: 'Tanggal', label: 'Tanggal',
value: selectedUniformity value: '28 Desember 2025',
? formatDate(selectedUniformity.applied_at, 'DD MMM YYYY')
: '-',
}, },
{ {
id: 'lokasi-farm', id: 'lokasi-farm',
label: 'Lokasi Farm', label: 'Lokasi Farm',
value: selectedUniformity?.location_name || '-', value: 'Farm A',
}, },
{ {
id: 'project-flock', id: 'project-flock',
label: 'Project Flock', label: 'Project Flock',
value: selectedUniformity?.flock_name || '-', value: 'Flock 2025-01',
}, },
{ {
id: 'kandang', id: 'kandang',
label: 'Kandang', label: 'Kandang',
value: selectedUniformity?.kandang_name || '-', value: 'Kandang 1',
}, },
{ {
id: 'uniformity', id: 'file-uniformity',
label: 'Uniformity', label: 'File Uniformity',
value: `${selectedUniformity?.uniformity || 0}%`, value: 'uniformity_data.xlsx',
}, },
{ {
id: 'status', id: 'status',
label: 'Status', label: 'Status',
value: getStatusText(selectedUniformity?.status || 'CREATED'), value: 'Disetujui',
}, },
]} ]}
columns={[ columns={[
@@ -765,10 +763,10 @@ const UniformityTable = ({ refresh }: { refresh?: () => void }) => {
text={`Approve This Submission?`} text={`Approve This Submission?`}
subtitleText={`Are you sure you want to approve this submission? (${selectedRowIds.length} data)`} subtitleText={`Are you sure you want to approve this submission? (${selectedRowIds.length} data)`}
secondaryButton={{ secondaryButton={{
text: 'Tidak', text: 'Cancel',
}} }}
primaryButton={{ primaryButton={{
text: 'Ya', text: 'Approve',
color: 'primary', color: 'primary',
isLoading: isBulkActionLoading, isLoading: isBulkActionLoading,
onClick: bulkApproveHandler, onClick: bulkApproveHandler,
@@ -779,11 +777,38 @@ const UniformityTable = ({ refresh }: { refresh?: () => void }) => {
> >
<div className='flex flex-col gap-4 mt-4'> <div className='flex flex-col gap-4 mt-4'>
<Table <Table
data={selectedUniformities.map((u, index) => ({ data={[
id: `bulk-approve-${index}`, {
label: `${index + 1}. ${u.location_name}`, id: 'tanggal',
value: `${u.flock_name} - ${u.kandang_name}`, label: 'Tanggal',
}))} value: '28 Desember 2025',
},
{
id: 'lokasi-farm',
label: 'Lokasi Farm',
value: 'Farm A',
},
{
id: 'project-flock',
label: 'Project Flock',
value: 'Flock 2025-01',
},
{
id: 'kandang',
label: 'Kandang',
value: 'Kandang 1',
},
{
id: 'file-uniformity',
label: 'File Uniformity',
value: 'uniformity_data.xlsx',
},
{
id: 'status',
label: 'Status',
value: 'Disetujui',
},
]}
columns={[ columns={[
{ {
accessorKey: 'label', accessorKey: 'label',
@@ -796,7 +821,7 @@ const UniformityTable = ({ refresh }: { refresh?: () => void }) => {
cell: (props) => <span>{props.row.original.value}</span>, cell: (props) => <span>{props.row.original.value}</span>,
}, },
]} ]}
pageSize={selectedUniformities.length} pageSize={6}
className={{ className={{
containerClassName: 'mb-0', containerClassName: 'mb-0',
paginationClassName: 'hidden', paginationClassName: 'hidden',
@@ -812,10 +837,10 @@ const UniformityTable = ({ refresh }: { refresh?: () => void }) => {
text='Reject This Submission?' text='Reject This Submission?'
subtitleText='Are you sure you want to reject this submission?' subtitleText='Are you sure you want to reject this submission?'
secondaryButton={{ secondaryButton={{
text: 'Tidak', text: 'Cancel',
}} }}
primaryButton={{ primaryButton={{
text: 'Ya', text: 'Reject',
color: 'primary', color: 'primary',
isLoading: isDeleteLoading, isLoading: isDeleteLoading,
onClick: singleRejectHandler, onClick: singleRejectHandler,
@@ -830,34 +855,32 @@ const UniformityTable = ({ refresh }: { refresh?: () => void }) => {
{ {
id: 'tanggal', id: 'tanggal',
label: 'Tanggal', label: 'Tanggal',
value: selectedUniformity value: '28 Desember 2025',
? formatDate(selectedUniformity.applied_at, 'DD MMM YYYY')
: '-',
}, },
{ {
id: 'lokasi-farm', id: 'lokasi-farm',
label: 'Lokasi Farm', label: 'Lokasi Farm',
value: selectedUniformity?.location_name || '-', value: 'Farm A',
}, },
{ {
id: 'project-flock', id: 'project-flock',
label: 'Project Flock', label: 'Project Flock',
value: selectedUniformity?.flock_name || '-', value: 'Flock 2025-01',
}, },
{ {
id: 'kandang', id: 'kandang',
label: 'Kandang', label: 'Kandang',
value: selectedUniformity?.kandang_name || '-', value: 'Kandang 1',
}, },
{ {
id: 'uniformity', id: 'file-uniformity',
label: 'Uniformity', label: 'File Uniformity',
value: `${selectedUniformity?.uniformity || 0}%`, value: 'uniformity_data.xlsx',
}, },
{ {
id: 'status', id: 'status',
label: 'Status', label: 'Status',
value: getStatusText(selectedUniformity?.status || 'CREATED'), value: 'Disetujui',
}, },
]} ]}
columns={[ columns={[
@@ -887,11 +910,11 @@ const UniformityTable = ({ refresh }: { refresh?: () => void }) => {
iconPosition='left' iconPosition='left'
text={`Apakah anda yakin ingin menolak ${selectedRowIds.length} data Uniformity yang dipilih?`} text={`Apakah anda yakin ingin menolak ${selectedRowIds.length} data Uniformity yang dipilih?`}
secondaryButton={{ secondaryButton={{
text: 'Tidak', text: 'Cancel',
}} }}
primaryButton={{ primaryButton={{
text: 'Ya', text: 'Reject',
color: 'error', color: 'primary',
isLoading: isBulkActionLoading, isLoading: isBulkActionLoading,
onClick: bulkRejectHandler, onClick: bulkRejectHandler,
}} }}
@@ -901,11 +924,38 @@ const UniformityTable = ({ refresh }: { refresh?: () => void }) => {
> >
<div className='flex flex-col gap-4 mt-4'> <div className='flex flex-col gap-4 mt-4'>
<Table <Table
data={selectedUniformities.map((u, index) => ({ data={[
id: `bulk-reject-${index}`, {
label: `${index + 1}. ${u.location_name}`, id: 'tanggal',
value: `${u.flock_name} - ${u.kandang_name}`, label: 'Tanggal',
}))} value: '28 Desember 2025',
},
{
id: 'lokasi-farm',
label: 'Lokasi Farm',
value: 'Farm A',
},
{
id: 'project-flock',
label: 'Project Flock',
value: 'Flock 2025-01',
},
{
id: 'kandang',
label: 'Kandang',
value: 'Kandang 1',
},
{
id: 'file-uniformity',
label: 'File Uniformity',
value: 'uniformity_data.xlsx',
},
{
id: 'status',
label: 'Status',
value: 'Disetujui',
},
]}
columns={[ columns={[
{ {
accessorKey: 'label', accessorKey: 'label',
@@ -918,7 +968,7 @@ const UniformityTable = ({ refresh }: { refresh?: () => void }) => {
cell: (props) => <span>{props.row.original.value}</span>, cell: (props) => <span>{props.row.original.value}</span>,
}, },
]} ]}
pageSize={selectedUniformities.length} pageSize={6}
className={{ className={{
containerClassName: 'mb-0', containerClassName: 'mb-0',
paginationClassName: 'hidden', paginationClassName: 'hidden',