From 2e19e9baa98f665f160de6ca96cb79c9c6ba7771 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 20 May 2024 22:39:05 +0200 Subject: [PATCH 01/14] refs #5926: Add QIcon --- src/pages/Worker/Card/WorkerPda.vue | 76 +++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 3 deletions(-) diff --git a/src/pages/Worker/Card/WorkerPda.vue b/src/pages/Worker/Card/WorkerPda.vue index 5e7c89326..5fbdc8589 100644 --- a/src/pages/Worker/Card/WorkerPda.vue +++ b/src/pages/Worker/Card/WorkerPda.vue @@ -8,13 +8,17 @@ import VnSelect from 'src/components/common/VnSelect.vue'; import useNotify from 'src/composables/useNotify.js'; import axios from 'axios'; import { useRole } from 'src/composables/useRole'; +import { useVnConfirm } from 'src/composables/useVnConfirm'; const route = useRoute(); const { t } = useI18n(); const { notify } = useNotify(); const { hasAny } = useRole(); +const downloadDocuware = ref(true); +const sendToTablet = ref(true); const fetchCurrentDeviceRef = ref(null); +const docuwarePDARef = ref(null); const deviceProductionsFilter = { fields: ['id', 'serialNumber', 'modelFk'], where: { stateFk: 'idle' }, @@ -26,13 +30,18 @@ const currentPDA = ref(null); const isAllowedToEdit = computed(() => hasAny(['hr', 'productionAssi'])); -const setCurrentPDA = (data) => { +const setCurrentPDA = async (data) => { currentPDA.value = data; currentPDA.value.description = `ID: ${currentPDA.value.deviceProductionFk} ${t( 'worker.pda.model' )}: ${currentPDA.value.deviceProduction.modelFk} ${t('worker.pda.serialNumber')}: ${ currentPDA.value.deviceProduction.serialNumber }`; + await axios.get( + `Workers/${route.params.id}/${currentPDA.value.deviceProductionFk}/isPDASigned` + ); + data.pda = null; + currentPDA.value = null; }; const deallocatePDA = async (data) => { @@ -48,8 +57,21 @@ const deallocatePDA = async (data) => { console.error('Error deallocating PDA'); } }; +const { openConfirmationModal } = useVnConfirm(); -onMounted(async () => await fetchCurrentDeviceRef.value.fetch()); +const handleSendToTablet = async () => { + try { + await axios.post(`Docuwares/upload`, { + fileCabinet: 'hr', + worker: route.params.id, + pda: currentPDA.value.deviceProductionFk, + }); + notify(t('PDA Signed'), 'positive'); + } catch (err) { + console.error('Error removing department'); + } +}; +const handleDownloadDocuware = async () => {};