diff --git a/src/components/helper/drawer/DrawerHeader.tsx b/src/components/helper/drawer/DrawerHeader.tsx index f9d70a04..8bb635ae 100644 --- a/src/components/helper/drawer/DrawerHeader.tsx +++ b/src/components/helper/drawer/DrawerHeader.tsx @@ -58,6 +58,7 @@ const DrawerHeader = ({ if (leftIconOnClick) { return ( - - - -
- - - - - Export +
+
+
+ + - } - align='end' - > - - - - - + +
+ +
+ + + +
+ + + Export + +
+ + +
+ + } + > + + + +
- -
+
+ +
+
-
- -
- - + data={isResponseSuccess(uniformities) ? uniformities?.data : []} + columns={uniformityColumns} + pageSize={tableFilterState.pageSize} + page={isResponseSuccess(uniformities) ? uniformities?.meta?.page : 0} + totalItems={ + isResponseSuccess(uniformities) + ? uniformities?.meta?.total_results + : 0 + } + onPageChange={setPage} + isLoading={isLoading} + sorting={sorting} + setSorting={setSorting} + rowSelection={rowSelection} + setRowSelection={setRowSelection} className={{ - wrapper: 'my-4 w-full relative', + containerClassName: cn('p-3 pt-0', { + 'mb-20': + isResponseSuccess(uniformities) && + uniformities?.data?.length === 0, + }), + headerColumnClassName: + 'first:pl-3 first:pr-0 xl:first:pl-3 py-3 text-nowrap', + bodyColumnClassName: + 'first:pl-3 first:pr-0 xl:first:pl-3 py-3 text-nowrap', + }} + emptyContent={} + /> + + - - data={isResponseSuccess(uniformities) ? uniformities?.data : []} - columns={uniformityColumns} - pageSize={tableFilterState.pageSize} - page={isResponseSuccess(uniformities) ? uniformities?.meta?.page : 0} - totalItems={ - isResponseSuccess(uniformities) - ? uniformities?.meta?.total_results - : 0 - } - onPageChange={setPage} - isLoading={isLoading} - sorting={sorting} - setSorting={setSorting} - rowSelection={rowSelection} - setRowSelection={setRowSelection} - className={{ - containerClassName: cn({ - 'mb-20': - isResponseSuccess(uniformities) && - uniformities?.data?.length === 0, - }), - tableWrapperClassName: 'overflow-x-auto min-h-full ', - tableClassName: 'font-inter w-full table-auto min-h-full!', - headerRowClassName: 'border-b border-b-gray-200', - headerColumnClassName: - 'px-6 py-3 text-xs font-semibold text-gray-500 last:flex last:flex-row last:justify-end', - bodyRowClassName: 'border-b border-b-gray-200', - bodyColumnClassName: - 'px-6 py-3 last:flex last:flex-row last:justify-end', - }} - emptyContent={} - /> - - -
- {createdUniformity ? ( - - ) : selectedRowIds.length === 1 ? ( - - ) : ( -
- {selectedRowIds.length} data dipilih -
- )} -
-
- - -
- -
-
- - -
- {selectedRowIds.length === 1 ? ( - - ) : ( -
- {selectedRowIds.length} data dipilih -
- )} -
-
- - -
- -
-
- - -
- {selectedRowIds.length === 1 ? ( - - ) : ( -
- {selectedRowIds.length} data dipilih -
- )} -
-
- - -
- {selectedRowIds.length === 1 ? ( - - ) : ( -
- {selectedRowIds.length} data dipilih -
- )} -
-
- - {/* Filter Modal */} - -
- {/* Modal Header */} -
-
- -

Filter Data

-
- +
+ {createdUniformity ? ( + + ) : selectedRowIds.length === 1 ? ( + + ) : ( +
+ {selectedRowIds.length} data dipilih
+ )} +
+ - {/* Error List Alert */} - {formErrorList.length > 0 && ( -
- -
- )} + +
+ +
+
-
-
-
+ +
+ {selectedRowIds.length === 1 ? ( + + ) : ( +
+ {selectedRowIds.length} data dipilih +
+ )} +
+
+ + +
+ +
+
+ + +
+ {selectedRowIds.length === 1 ? ( + + ) : ( +
+ {selectedRowIds.length} data dipilih +
+ )} +
+
+ + +
+ {selectedRowIds.length === 1 ? ( + + ) : ( +
+ {selectedRowIds.length} data dipilih +
+ )} +
+
+ + {/* Filter Modal */} + +
+ {/* Modal Header */} +
+
+ +

Filter Data

+
+ +
+ +
+
+ {/* Rentang Waktu */} +
+ +
-
- -
+
@@ -1299,74 +1366,83 @@ const UniformityTable = () => { className={{ wrapper: 'w-full' }} />
+ + {formErrorList.length > 0 && ( +
+ +
+ )}
{/* Action Buttons */} -
+
-
-
+ +
+ - {/* Floating Actions Button */} - - + permissions: 'lti.production.uniformity.detail', + }, + { + action: 'DELETE', + icon: 'mdi:delete-outline', + label: 'Delete', + hidden: selectedRowIds.length !== 1, + onClick: handleDelete, + permissions: 'lti.production.uniformity.delete', + }, + ]} + approvals={[ + { + action: 'APPROVED', + icon: 'mdi:check-circle-outline', + label: 'Approve', + onClick: handleBulkApprove, + permissions: 'lti.production.uniformity.approve', + disabled: !canApproveReject, + }, + { + action: 'REJECTED', + icon: 'mdi:close-circle-outline', + label: 'Reject', + onClick: handleBulkReject, + permissions: 'lti.production.uniformity.approve', + disabled: !canApproveReject, + }, + ]} + selectedRowIds={selectedRowIds} + onClose={handleCloseFab} + /> ); }; diff --git a/src/components/pages/production/uniformity/detail/UniformityDetail.tsx b/src/components/pages/production/uniformity/detail/UniformityDetail.tsx index e8e5f1b3..11087e44 100644 --- a/src/components/pages/production/uniformity/detail/UniformityDetail.tsx +++ b/src/components/pages/production/uniformity/detail/UniformityDetail.tsx @@ -319,18 +319,19 @@ const UniformityDetail: React.FC = ({ {/* Form Section */} -
-
+
{initialValues ? (
{/* Info Umum */}
-

Informasi Umum

+

+ Informasi Umum +

data={infoUmumTableData} columns={columnsInfoUmum} @@ -345,7 +346,9 @@ const UniformityDetail: React.FC = ({ {/* Sampling and Range */} {initialValues.sampling && (
-

Sampling and Range

+

+ Sampling and Range +

data={samplingTableData} columns={columnsSampling} @@ -361,7 +364,9 @@ const UniformityDetail: React.FC = ({ {/* Result */} {initialValues.result && (
-

Result

+

+ Result +

data={resultTableData} columns={resultColumns} diff --git a/src/components/pages/production/uniformity/detail/UniformityDetailsPreview.tsx b/src/components/pages/production/uniformity/detail/UniformityDetailsPreview.tsx index 05d21535..04c43a02 100644 --- a/src/components/pages/production/uniformity/detail/UniformityDetailsPreview.tsx +++ b/src/components/pages/production/uniformity/detail/UniformityDetailsPreview.tsx @@ -10,11 +10,10 @@ import { UniformityInfoUmum, } from '@/types/api/production/uniformity'; import Table from '@/components/Table'; -import Badge from '@/components/Badge'; +import StatusBadge from '@/components/helper/StatusBadge'; import { - getWeightStatusColor, - getWeightStatusIndicatorColor, getWeightStatusText, + getWeightStatusBadgeColor, } from '@/components/pages/production/uniformity/uniformity-utils'; import { BodyWeightData } from '@/types/api/production/uniformity'; @@ -51,7 +50,7 @@ const UniformityDetailsPreview = ({ () => [ { accessorKey: 'number', - header: 'No', + header: 'Number', cell: (props) => props.row.original.number, }, { @@ -65,30 +64,12 @@ const UniformityDetailsPreview = ({ cell: (props) => { const status = props.row.original.status; return status ? ( -
- - {getWeightStatusText(status)} - -
+ ) : ( - - Unknown - + ); }, }, @@ -102,7 +83,7 @@ const UniformityDetailsPreview = ({ - + <> +
+ + + + )}
diff --git a/src/components/pages/production/uniformity/form/UniformityPreviewForm.tsx b/src/components/pages/production/uniformity/form/UniformityPreviewForm.tsx index 63ba34fd..314eabfd 100644 --- a/src/components/pages/production/uniformity/form/UniformityPreviewForm.tsx +++ b/src/components/pages/production/uniformity/form/UniformityPreviewForm.tsx @@ -50,7 +50,7 @@ const UniformityPreviewForm = () => { () => [ { accessorKey: 'number', - header: 'No', + header: 'Number', cell: (props) => props.row.original.number, }, { @@ -68,19 +68,18 @@ const UniformityPreviewForm = () => { {/* Form Section */} -
-
+
{verifyUniformityResult ? (
diff --git a/src/components/pages/production/uniformity/form/UniformityResultForm.tsx b/src/components/pages/production/uniformity/form/UniformityResultForm.tsx index df144c64..98db02fc 100644 --- a/src/components/pages/production/uniformity/form/UniformityResultForm.tsx +++ b/src/components/pages/production/uniformity/form/UniformityResultForm.tsx @@ -14,12 +14,11 @@ import { useRouter } from 'next/navigation'; import toast from 'react-hot-toast'; import { UniformityApi } from '@/services/api/uniformity'; import { isResponseError } from '@/lib/api-helper'; -import Badge from '@/components/Badge'; +import StatusBadge from '@/components/helper/StatusBadge'; import { formatNumber } from '@/lib/helper'; import { - getWeightStatusColor, - getWeightStatusIndicatorColor, getWeightStatusText, + getWeightStatusBadgeColor, } from '@/components/pages/production/uniformity/uniformity-utils'; import { DetailOptionType } from '@/types/api/production/uniformity'; import { @@ -190,7 +189,7 @@ const UniformityResultForm = () => { () => [ { accessorKey: 'number', - header: 'No', + header: 'Number', cell: (props) => props.row.original.number, }, { @@ -204,30 +203,12 @@ const UniformityResultForm = () => { cell: (props) => { const status = props.row.original.status; return status ? ( -
- - {getWeightStatusText(status)} - -
+ ) : ( - - Unknown - + ); }, }, @@ -241,23 +222,24 @@ const UniformityResultForm = () => { {/* Form Section */} -
-
+
{verifyUniformityResult ? (
-

Sampling and Range

+

+ Sampling and Range +

data={samplingTableData} columns={columnsSampling} @@ -270,7 +252,9 @@ const UniformityResultForm = () => {
-

Result

+

+ Result +

data={resultTableData} columns={resultColumns} diff --git a/src/components/pages/production/uniformity/skeleton/UniformityBarChartSkeleton.tsx b/src/components/pages/production/uniformity/skeleton/UniformityBarChartSkeleton.tsx index 123a456a..3ce40a3a 100644 --- a/src/components/pages/production/uniformity/skeleton/UniformityBarChartSkeleton.tsx +++ b/src/components/pages/production/uniformity/skeleton/UniformityBarChartSkeleton.tsx @@ -1,4 +1,3 @@ -import Button from '@/components/Button'; import { Icon } from '@iconify/react'; const LeftLegend = () => { @@ -45,11 +44,11 @@ const ChartArea = () => { ))}
-
+
{ranges.map((range) => (
))}
@@ -65,28 +64,38 @@ const ChartArea = () => { const EmptyState = () => { return ( - <> -
-
- +
+
+ {/* Filter icon */} +
+
+
+ +
+
- + + {/* Empty state text */} +

No Filters Selected - - +

+

Please choose filters to narrow down your results and make your search easier. - +

- +
); }; const UniformityBarChartSkeleton = () => { return ( -
+
diff --git a/src/components/pages/production/uniformity/skeleton/UniformityGaugeChartSkeleton.tsx b/src/components/pages/production/uniformity/skeleton/UniformityGaugeChartSkeleton.tsx index 17ed7ee9..2ff7155b 100644 --- a/src/components/pages/production/uniformity/skeleton/UniformityGaugeChartSkeleton.tsx +++ b/src/components/pages/production/uniformity/skeleton/UniformityGaugeChartSkeleton.tsx @@ -1,4 +1,3 @@ -import Button from '@/components/Button'; import { Icon } from '@iconify/react'; import React from 'react'; import { Cell, Pie, PieChart, ResponsiveContainer } from 'recharts'; @@ -55,22 +54,29 @@ const UniformityGaugeChartSkeleton: React.FC< -
-
- +
+ {/* Filter icon */} +
+
+
+ +
+
- + + {/* Empty state text */} +

No Filters Selected - - +

+

Please choose filters to narrow down your results and make your search easier. - +

diff --git a/src/components/pages/production/uniformity/skeleton/UniformityTableSkeleton.tsx b/src/components/pages/production/uniformity/skeleton/UniformityTableSkeleton.tsx index b90048a1..e1bbd4a9 100644 --- a/src/components/pages/production/uniformity/skeleton/UniformityTableSkeleton.tsx +++ b/src/components/pages/production/uniformity/skeleton/UniformityTableSkeleton.tsx @@ -1,24 +1,30 @@ -import Button from '@/components/Button'; import { Icon } from '@iconify/react'; const UniformityTableSkeleton = () => { return ( -
-
- +
+ {/* Document icon */} +
+
+
+ +
+
- + + {/* Empty state text */} +

No Data Available - - +

+

There is no uniformity data displayed. Enter uniformity check data to get started. - +

); }; diff --git a/src/components/pages/production/uniformity/uniformity-utils.ts b/src/components/pages/production/uniformity/uniformity-utils.ts index 340bb555..1b513de4 100644 --- a/src/components/pages/production/uniformity/uniformity-utils.ts +++ b/src/components/pages/production/uniformity/uniformity-utils.ts @@ -25,6 +25,20 @@ export const getWeightStatusText = (status: string): string => { return weightStatusTextMap[status] || status; }; +export const weightStatusBadgeColorMap: Record< + string, + 'success' | 'error' | 'neutral' | 'info' +> = { + ideal: 'success', + outside: 'error', +}; + +export const getWeightStatusBadgeColor = ( + status: string +): 'success' | 'error' | 'neutral' | 'info' => { + return weightStatusBadgeColorMap[status] || 'neutral'; +}; + export const statusColorMap: Record = { APPROVED: 'bg-[#00D39033]', Disetujui: 'bg-[#00D39033]', @@ -63,3 +77,29 @@ export const getStatusIndicatorColor = (status: string): string => { export const getStatusText = (status: string): string => { return statusTextMap[status] || status; }; + +export const statusBadgeColorMap: Record< + string, + 'success' | 'error' | 'neutral' | 'info' +> = { + APPROVED: 'success', + Disetujui: 'success', + approved: 'success', + disetujui: 'success', + REJECTED: 'error', + Ditolak: 'error', + rejected: 'error', + ditolak: 'error', + CREATED: 'neutral', + Pengajuan: 'neutral', + created: 'neutral', + pengajuan: 'neutral', + PENDING: 'neutral', + pending: 'neutral', +}; + +export const getStatusBadgeColor = ( + status: string +): 'success' | 'error' | 'neutral' | 'info' => { + return statusBadgeColorMap[status] || 'neutral'; +};