show attachments
This commit is contained in:
@@ -53,14 +53,20 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
useEffect(() => {
|
||||
requestServer(`${CONFIRM_PROVINCE_MANAGER_DETAILS}/${rowId}`, 'get')
|
||||
.then((response) => {
|
||||
const allAttachments = [];
|
||||
response.data.data.histories.map((history) => {
|
||||
history.attachments.map((attachment) => {
|
||||
allAttachments.push(attachment);
|
||||
});
|
||||
});
|
||||
setAttachmentsData(allAttachments);
|
||||
setDetailsData(response.data);
|
||||
if (response.data.data.histories.length !== 0) {
|
||||
let latest_attachments = []
|
||||
let attachments = []
|
||||
response.data.data.histories.map((allAttachment) => {
|
||||
if (allAttachment.previous_state_id === 4 || allAttachment.previous_state_id === 5) {
|
||||
if (!latest_attachments.includes(allAttachment.previous_state_id)) {
|
||||
attachments = [...attachments, ...allAttachment.attachments]
|
||||
latest_attachments.push(allAttachment.previous_state_id)
|
||||
}
|
||||
}
|
||||
setDetailsData(response.data);
|
||||
setAttachmentsData(attachments);
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
}).finally(() => {
|
||||
|
||||
@@ -44,14 +44,20 @@ const ConfirmContent = ({rowId, mutate, setOpenConfirmDialog, handleSizeChangeCl
|
||||
useEffect(() => {
|
||||
requestServer(`${GET_TRANSPORTATION_ASSISTANCE_DETAILS}/${rowId}`, 'get')
|
||||
.then((response) => {
|
||||
const allAttachments = [];
|
||||
response.data.data.histories.map((history) => {
|
||||
history.attachments.map((attachment) => {
|
||||
allAttachments.push(attachment);
|
||||
});
|
||||
});
|
||||
setDetailsData(response.data);
|
||||
setAttachmentsData(allAttachments);
|
||||
if (response.data.data.histories.length !== 0) {
|
||||
let latest_attachments = []
|
||||
let attachments = []
|
||||
response.data.data.histories.map((allAttachment) => {
|
||||
if (allAttachment.previous_state_id !== 4)
|
||||
return
|
||||
if (!latest_attachments.includes(allAttachment.previous_state_id)) {
|
||||
attachments = [...attachments, ...allAttachment.attachments]
|
||||
latest_attachments.push(allAttachment.previous_state_id)
|
||||
}
|
||||
})
|
||||
setDetailsData(response.data);
|
||||
setAttachmentsData(attachments);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
}).finally(() => {
|
||||
|
||||
Reference in New Issue
Block a user