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