diff --git a/src/pages/Worker/Card/WorkerPda.vue b/src/pages/Worker/Card/WorkerPda.vue index 57397801c..3d7380fc2 100644 --- a/src/pages/Worker/Card/WorkerPda.vue +++ b/src/pages/Worker/Card/WorkerPda.vue @@ -17,7 +17,7 @@ import VnInput from 'src/components/common/VnInput.vue'; const { t } = useI18n(); const { notify } = useNotify(); - +const loadingDocuware = ref(true); const paginate = ref(); const dialog = ref(); const route = useRoute(); @@ -94,6 +94,27 @@ const handleDownloadDocuware = async (row) => { console.error('Error removing department'); } }; + +async function fetchDocuware(deviceProductions) { + let promises = deviceProductions.map(({ deviceProductionFk }) => + axios.post(`Docuwares/${deviceProductionFk}/checkFile`, { + fileCabinet: 'hr', + signed: true, + }) + ); + promises = await Promise.all(promises); + promises.forEach((promise) => { + const id = +promise.config.url.match(/\d+/)[0]; + const deviceProduction = deviceProductions.find( + ({ deviceProductionFk }) => deviceProductionFk === id + ); + if (!deviceProduction) return; + if (promise.data) deviceProduction.isSigned = promise.data; + deviceProduction.isDocuware = promise.data; + }); + + loadingDocuware.value = false; +}