-
-
- {{ t('order.summary.basket') }} #{{ entity?.id }} -
- {{ entity?.client?.name }} ({{ entity?.clientFk }})
-
-
-
- {{ t('order.summary.confirmLines') }}
-
-
-
-
-
-
-
-
-
-
-
-
- {{ dashIfEmpty(entity?.address?.nickname) }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ dashIfEmpty(entity?.address?.phone) }}
-
-
-
-
-
-
-
-
-
-
-
- {{ entity?.note }}
-
-
-
-
-
-
- {{ t('globals.subtotal') }}
-
-
- {{
- toCurrency(entity?.subTotal)
- }}
-
-
-
-
- {{ t('globals.vat') }}
-
-
- {{ toCurrency(entity?.VAT) }}
-
-
-
-
- {{ t('order.summary.total') }}
-
-
- {{ toCurrency(entity?.total) }}
-
-
-
-
-
-
-
-
- {{ t('globals.item') }}
- {{ t('globals.description') }}
- {{ t('globals.quantity') }}
- {{ t('globals.price') }}
- {{ t('order.summary.amount') }}
-
-
-
-
-
-
- {{ props.row.item?.id }}
-
-
-
-
-
-
- {{ props.row.item.name }}
-
- {{ props.row.item.subName }}
-
-
+
+
+ {{ t('order.summary.basket') }} #{{ entity?.id }} -
+ {{ entity?.client?.name }} ({{ entity?.clientFk }})
+
+
+
+ {{ t('order.summary.confirmLines') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ dashIfEmpty(entity?.address?.nickname) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ dashIfEmpty(entity?.address?.phone) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ entity?.note }}
+
+
+
+
+
+
+ {{ t('globals.subtotal') }}
+
+
+ {{ toCurrency(entity?.subTotal) }}
+
+
+
+
+ {{ t('globals.vat') }}
+
+
+ {{ toCurrency(entity?.VAT) }}
+
+
+
+
+ {{ t('order.summary.total') }}
+
+
+ {{ toCurrency(entity?.total) }}
+
+
+
+
+
+
+
+
+ {{ t('globals.item') }}
+ {{ t('globals.description') }}
+ {{ t('globals.quantity') }}
+ {{ t('globals.price') }}
+ {{ t('order.summary.amount') }}
+
+
+
+
+
+
+ {{ props.row.item?.id }}
+
+
+
+
+
+
+ {{ props.row.item.name }}
+
+ {{ props.row.item.subName }}
+
-
-
-
- {{ props.row.quantity }}
-
-
- {{ toCurrency(props.row.price) }}
-
-
- {{
- toCurrency(props.row?.quantity * props.row?.price)
- }}
-
-
-
-
-
-
-
-
+
+
+
+
+ {{ props.row.quantity }}
+
+
+ {{ toCurrency(props.row.price) }}
+
+
+ {{ toCurrency(props.row?.quantity * props.row?.price) }}
+
+
+
+
+
+
+
-
-
-es:
- Click to allow the user to be disabled: Marcar para deshabilitar
- Click to exclude the user from getting disabled: Marcar para no deshabilitar
-
diff --git a/src/pages/Worker/Card/WorkerDescriptorMenu.vue b/src/pages/Worker/Card/WorkerDescriptorMenu.vue
index 0dcb4fd71..3b6b144d6 100644
--- a/src/pages/Worker/Card/WorkerDescriptorMenu.vue
+++ b/src/pages/Worker/Card/WorkerDescriptorMenu.vue
@@ -63,3 +63,8 @@ const showChangePasswordDialog = () => {
+
+ es:
+ Click to allow the user to be disabled: Marcar para deshabilitar
+ Click to exclude the user from getting disabled: Marcar para no deshabilitar
+
diff --git a/src/pages/Worker/Card/WorkerPda.vue b/src/pages/Worker/Card/WorkerPda.vue
index d32941494..590cbc2b2 100644
--- a/src/pages/Worker/Card/WorkerPda.vue
+++ b/src/pages/Worker/Card/WorkerPda.vue
@@ -5,24 +5,25 @@ import { ref, computed } from 'vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify.js';
+import { useVnConfirm } from 'composables/useVnConfirm';
+import { useArrayData } from 'src/composables/useArrayData';
+import { downloadDocuware } from 'src/composables/downloadFile';
+
import FetchData from 'components/FetchData.vue';
import FormModelPopup from 'src/components/FormModelPopup.vue';
-import { useVnConfirm } from 'composables/useVnConfirm';
-
-import VnPaginate from 'src/components/ui/VnPaginate.vue';
import VnRow from 'components/ui/VnRow.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
-import VnInput from 'src/components/common/VnInput.vue';
+import VnTable from 'src/components/VnTable/VnTable.vue';
const { t } = useI18n();
const { notify } = useNotify();
-
-const paginate = ref();
+const loadingDocuware = ref(true);
+const tableRef = ref();
const dialog = ref();
const route = useRoute();
const { openConfirmationModal } = useVnConfirm();
const routeId = computed(() => route.params.id);
-
+const worker = computed(() => useArrayData('Worker').store.data);
const initialData = computed(() => {
return {
userFk: routeId.value,
@@ -31,154 +32,268 @@ const initialData = computed(() => {
};
});
-const deallocatePDA = async (deviceProductionFk) => {
- await axios.post(`Workers/${route.params.id}/deallocatePDA`, {
- pda: deviceProductionFk,
- });
- notify(t('PDA deallocated'), 'positive');
-
- paginate.value.fetch();
-};
+const columns = computed(() => [
+ {
+ align: 'center',
+ label: t('globals.state'),
+ name: 'state',
+ format: (row) => row?.docuware?.state,
+ columnFilter: false,
+ chip: {
+ condition: (_, row) => !!row.docuware,
+ color: (row) => (isSigned(row) ? 'bg-positive' : 'bg-warning'),
+ },
+ visible: false,
+ },
+ {
+ align: 'right',
+ label: t('worker.pda.currentPDA'),
+ name: 'deviceProductionFk',
+ columnClass: 'shrink',
+ cardVisible: true,
+ },
+ {
+ align: 'left',
+ label: t('Model'),
+ name: 'modelFk',
+ format: ({ deviceProduction }) => deviceProduction.modelFk,
+ cardVisible: true,
+ },
+ {
+ align: 'right',
+ label: t('Serial number'),
+ name: 'serialNumber',
+ format: ({ deviceProduction }) => deviceProduction.serialNumber,
+ cardVisible: true,
+ },
+ {
+ align: 'left',
+ label: t('Current SIM'),
+ name: 'simFk',
+ cardVisible: true,
+ },
+ {
+ align: 'right',
+ name: 'actions',
+ columnFilter: false,
+ cardVisible: true,
+ },
+]);
function reloadData() {
initialData.value.deviceProductionFk = null;
initialData.value.simFk = null;
- paginate.value.fetch();
+ tableRef.value.reload();
+}
+
+async function fetchDocuware() {
+ loadingDocuware.value = true;
+
+ const id = `${worker.value?.lastName} ${worker.value?.firstName}`;
+ const rows = tableRef.value.CrudModelRef.formData;
+
+ const promises = rows.map(async (row) => {
+ const { data } = await axios.post(`Docuwares/${id}/checkFile`, {
+ fileCabinet: 'hr',
+ signed: false,
+ mergeFilter: [
+ {
+ DBName: 'TIPO_DOCUMENTO',
+ Value: ['PDA'],
+ },
+ {
+ DBName: 'OBSERVACIONES',
+ Value: [row.deviceProductionFk],
+ },
+ ],
+ });
+ row.docuware = data;
+ });
+
+ await Promise.allSettled(promises);
+ loadingDocuware.value = false;
+}
+
+async function sendToTablet(rows) {
+ const promises = rows.map(async (row) => {
+ await axios.post(`Docuwares/upload-pda-pdf`, {
+ ids: [row.deviceProductionFk],
+ });
+ row.docuware = true;
+ });
+ await Promise.allSettled(promises);
+ notify(t('PDF sended to signed'), 'positive');
+ tableRef.value.reload();
+}
+
+async function deallocatePDA(deviceProductionFk) {
+ await axios.post(`Workers/${route.params.id}/deallocatePDA`, {
+ pda: deviceProductionFk,
+ });
+ const index = tableRef.value.CrudModelRef.formData.findIndex(
+ (data) => data?.deviceProductionFk == deviceProductionFk,
+ );
+ delete tableRef.value.CrudModelRef.formData[index];
+ notify(t('PDA deallocated'), 'positive');
+}
+
+function isSigned(row) {
+ return row.docuware?.state === 'Firmado';
}
-
- (deviceProductions = data)"
- auto-load
- />
-
-
-
-
-
-
-
-
- deallocatePDA(row.deviceProductionFk),
- )
- "
- >
-
- {{ t('worker.pda.removePDA') }}
-
-
-
-
-
-
-
+ (deviceProductions = data)"
+ auto-load
+ />
+
+
+
+
+
+ deallocatePDA(row.deviceProductionFk),
+ )
+ "
+ data-cy="workerPda-remove"
>
-
-
-
-
-
-
-
-
- ID: {{ scope.opt?.id }}
-
- {{ scope.opt?.modelFk }},
- {{ scope.opt?.serialNumber }}
-
-
-
-
-
-
-
-
-
-
+
+ {{ t('worker.pda.removePDA') }}
+
-
- {{ t('globals.new') }}
-
-
-
+ sendToTablet([row]),
+ )
+ "
+ data-cy="workerPda-send"
+ >
+
+ {{ t('worker.pda.sendToTablet') }}
+
+
+
+
+ {{ t('globals.downloadPdf') }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ID: {{ scope.opt?.id }}
+
+ {{ scope.opt?.modelFk }},
+ {{ scope.opt?.serialNumber }}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ t('globals.new') }}
+
+
-
es:
Model: Modelo
@@ -190,4 +305,7 @@ es:
Do you want to remove this PDA?: ¿Desea eliminar este PDA?
You can only have one PDA: Solo puedes tener un PDA si no eres autonomo
This PDA is already assigned to another user: Este PDA ya está asignado a otro usuario
+ Are you sure you want to send it?: ¿Seguro que quieres enviarlo?
+ Sign PDA: Firmar PDA
+ PDF sended to signed: PDF enviado para firmar
diff --git a/src/pages/Worker/Card/WorkerSummary.vue b/src/pages/Worker/Card/WorkerSummary.vue
index ad78a3fb9..96d5220f5 100644
--- a/src/pages/Worker/Card/WorkerSummary.vue
+++ b/src/pages/Worker/Card/WorkerSummary.vue
@@ -48,82 +48,91 @@ onBeforeMount(async () => {
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
-
-
-
-
- {{ t('worker.summary.phoneExtension') }}
-
-
-
-
-
- {{ t('worker.summary.entPhone') }}
-
-
-
-
-
- {{ t('worker.summary.personalPhone') }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+