mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE): Prefer latest_approval action and add file_name
This commit is contained in:
@@ -56,8 +56,6 @@ const UniformityConfirmationPreview = ({
|
||||
uniformity?: Uniformity;
|
||||
uniformityDetail?: UniformityDetail;
|
||||
}) => {
|
||||
const fileName = uniformityDetail?.info_umum?.file_name || '-';
|
||||
|
||||
const data: DetailOptionType[] = [
|
||||
{
|
||||
id: 'tanggal',
|
||||
@@ -93,7 +91,8 @@ const UniformityConfirmationPreview = ({
|
||||
{
|
||||
id: 'file-uniformity',
|
||||
label: 'File Uniformity',
|
||||
value: fileName,
|
||||
value:
|
||||
uniformity?.file_name || uniformityDetail?.info_umum?.file_name || '-',
|
||||
},
|
||||
{
|
||||
id: 'status',
|
||||
@@ -461,9 +460,15 @@ const UniformityTable = () => {
|
||||
const canApproveReject = useMemo(() => {
|
||||
return (
|
||||
selectedUniformities.length > 0 &&
|
||||
selectedUniformities.every(
|
||||
(u) => u.status === 'CREATED' || u.status === 'Pengajuan'
|
||||
)
|
||||
selectedUniformities.every((u) => {
|
||||
const approvalAction = u.latest_approval?.action;
|
||||
return (
|
||||
approvalAction === 'CREATED' ||
|
||||
approvalAction === 'Pengajuan' ||
|
||||
(!approvalAction &&
|
||||
(u.status === 'CREATED' || u.status === 'Pengajuan'))
|
||||
);
|
||||
})
|
||||
);
|
||||
}, [selectedUniformities]);
|
||||
|
||||
@@ -818,7 +823,9 @@ const UniformityTable = () => {
|
||||
accessorKey: 'status',
|
||||
header: 'Status',
|
||||
cell: (props) => {
|
||||
const status = props.row.original.status;
|
||||
const uniformity = props.row.original;
|
||||
const status =
|
||||
uniformity.latest_approval?.action ?? uniformity.status;
|
||||
return (
|
||||
<div className='w-full'>
|
||||
<Badge
|
||||
|
||||
+1
-3
@@ -1,7 +1,4 @@
|
||||
import { BaseMetadata } from '@/types/api/api-general';
|
||||
import { Location } from '@/types/api/location/location';
|
||||
import { ProjectFlock } from '@/types/api/project-flock/project-flock';
|
||||
import { Kandang } from '@/types/api/kandang/kandang';
|
||||
import { BaseApproval } from '@/types/api/approval/approval';
|
||||
|
||||
// ==================== GET ALL RESPONSE ====================
|
||||
@@ -11,6 +8,7 @@ export type Uniformity = BaseMetadata & {
|
||||
location_name: string;
|
||||
flock_name: string;
|
||||
kandang_name: string;
|
||||
file_name: string;
|
||||
applied_at: string;
|
||||
week: number;
|
||||
status: string;
|
||||
|
||||
Reference in New Issue
Block a user