#5926 - Worker/PDA docuware #387
|
@ -8,13 +8,17 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { useRole } from 'src/composables/useRole';
|
import { useRole } from 'src/composables/useRole';
|
||||||
|
import { useVnConfirm } from 'src/composables/useVnConfirm';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
const { hasAny } = useRole();
|
const { hasAny } = useRole();
|
||||||
|
|
||||||
|
const downloadDocuware = ref(true);
|
||||||
|
const sendToTablet = ref(true);
|
||||||
const fetchCurrentDeviceRef = ref(null);
|
const fetchCurrentDeviceRef = ref(null);
|
||||||
|
const docuwarePDARef = ref(null);
|
||||||
const deviceProductionsFilter = {
|
const deviceProductionsFilter = {
|
||||||
fields: ['id', 'serialNumber', 'modelFk'],
|
fields: ['id', 'serialNumber', 'modelFk'],
|
||||||
where: { stateFk: 'idle' },
|
where: { stateFk: 'idle' },
|
||||||
|
@ -26,13 +30,18 @@ const currentPDA = ref(null);
|
||||||
|
|
||||||
const isAllowedToEdit = computed(() => hasAny(['hr', 'productionAssi']));
|
const isAllowedToEdit = computed(() => hasAny(['hr', 'productionAssi']));
|
||||||
|
|
||||||
const setCurrentPDA = (data) => {
|
const setCurrentPDA = async (data) => {
|
||||||
currentPDA.value = data;
|
currentPDA.value = data;
|
||||||
currentPDA.value.description = `ID: ${currentPDA.value.deviceProductionFk} ${t(
|
currentPDA.value.description = `ID: ${currentPDA.value.deviceProductionFk} ${t(
|
||||||
'worker.pda.model'
|
'worker.pda.model'
|
||||||
)}: ${currentPDA.value.deviceProduction.modelFk} ${t('worker.pda.serialNumber')}: ${
|
)}: ${currentPDA.value.deviceProduction.modelFk} ${t('worker.pda.serialNumber')}: ${
|
||||||
currentPDA.value.deviceProduction.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) => {
|
const deallocatePDA = async (data) => {
|
||||||
|
@ -48,8 +57,21 @@ const deallocatePDA = async (data) => {
|
||||||
console.error('Error deallocating PDA');
|
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,
|
||||||
|
});
|
||||||
jsegarra marked this conversation as resolved
Outdated
|
|||||||
|
notify(t('PDA Signed'), 'positive');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error removing department');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleDownloadDocuware = async () => {};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -61,6 +83,15 @@ onMounted(async () => await fetchCurrentDeviceRef.value.fetch());
|
||||||
/>
|
/>
|
||||||
<FetchData
|
<FetchData
|
||||||
ref="fetchCurrentDeviceRef"
|
ref="fetchCurrentDeviceRef"
|
||||||
|
@on-fetch="
|
||||||
|
(data) => {
|
||||||
|
downloadDocuware = true;
|
||||||
|
sendToTablet = true;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
<FetchData
|
||||||
|
ref="docuwarePDARef"
|
||||||
url="DeviceProductionUsers"
|
url="DeviceProductionUsers"
|
||||||
:filter="{
|
:filter="{
|
||||||
jsegarra marked this conversation as resolved
Outdated
alexm
commented
console.error('Error removing department'); ?
|
|||||||
where: { userFk: route.params.id },
|
where: { userFk: route.params.id },
|
||||||
|
@ -79,6 +110,15 @@ onMounted(async () => await fetchCurrentDeviceRef.value.fetch());
|
||||||
:default-buttons="{ save: { label: 'globals.assign', color: 'primary' } }"
|
:default-buttons="{ save: { label: 'globals.assign', color: 'primary' } }"
|
||||||
@on-data-saved="(_, data) => setCurrentPDA(data)"
|
@on-data-saved="(_, data) => setCurrentPDA(data)"
|
||||||
>
|
>
|
||||||
|
<!-- <template #moreActions>
|
||||||
|
<QBtn
|
||||||
|
:label="t('Download')"
|
||||||
|
class="q-mt-sm"
|
||||||
|
@click.stop="downloadDocueare()"
|
||||||
|
type="submit"
|
||||||
|
color="primary"
|
||||||
|
/>
|
||||||
|
</template> -->
|
||||||
<template #form="{ data }">
|
<template #form="{ data }">
|
||||||
<QField
|
<QField
|
||||||
v-if="currentPDA && currentPDA.description"
|
v-if="currentPDA && currentPDA.description"
|
||||||
|
@ -95,7 +135,7 @@ onMounted(async () => await fetchCurrentDeviceRef.value.fetch());
|
||||||
<template v-if="isAllowedToEdit" #append>
|
<template v-if="isAllowedToEdit" #append>
|
||||||
<QIcon
|
<QIcon
|
||||||
name="delete"
|
name="delete"
|
||||||
size="sm"
|
size="md"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
color="primary"
|
color="primary"
|
||||||
@click="deallocatePDA(data)"
|
@click="deallocatePDA(data)"
|
||||||
|
@ -104,6 +144,36 @@ onMounted(async () => await fetchCurrentDeviceRef.value.fetch());
|
||||||
{{ t('worker.pda.removePDA') }}
|
{{ t('worker.pda.removePDA') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QIcon>
|
</QIcon>
|
||||||
|
<QIcon
|
||||||
|
v-if="downloadDocuware"
|
||||||
|
name="cloud_download"
|
||||||
|
size="md"
|
||||||
|
class="cursor-pointer"
|
||||||
|
color="primary"
|
||||||
|
@click="handleDownloadDocuware(data)"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('worker.pda.removePDA') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QIcon>
|
||||||
|
<QIcon
|
||||||
|
v-if="sendToTablet"
|
||||||
|
name="vn:client"
|
||||||
|
size="md"
|
||||||
|
class="cursor-pointer"
|
||||||
|
color="primary"
|
||||||
|
@click="
|
||||||
|
openConfirmationModal(
|
||||||
|
t('Are you sure you want to send it?'),
|
||||||
|
t('Sign PDA'),
|
||||||
|
handleSendToTablet
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('worker.pda.removePDA') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QIcon>
|
||||||
</template>
|
</template>
|
||||||
</QField>
|
</QField>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
checkFileDocuware