feat: updates
This commit is contained in:
parent
f3237adbb9
commit
035a3cd0ae
|
@ -0,0 +1,6 @@
|
||||||
|
export function isProduction(localAsProduction = true) {
|
||||||
|
return (
|
||||||
|
(!process.env.NODE_ENV && localAsProduction) ||
|
||||||
|
process.env.NODE_ENV == 'production'
|
||||||
|
);
|
||||||
|
}
|
|
@ -8,6 +8,7 @@ import useNotify from 'src/composables/useNotify.js';
|
||||||
import FetchData from 'components/FetchData.vue';
|
import FetchData from 'components/FetchData.vue';
|
||||||
import FormModelPopup from 'src/components/FormModelPopup.vue';
|
import FormModelPopup from 'src/components/FormModelPopup.vue';
|
||||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||||
|
import { isProduction } from 'composables/useEnv';
|
||||||
|
|
||||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||||
import VnRow from 'components/ui/VnRow.vue';
|
import VnRow from 'components/ui/VnRow.vue';
|
||||||
|
@ -18,7 +19,6 @@ const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
const paginate = ref();
|
const paginate = ref();
|
||||||
const isDocuware = ref(false);
|
|
||||||
const dialog = ref();
|
const dialog = ref();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { openConfirmationModal } = useVnConfirm();
|
const { openConfirmationModal } = useVnConfirm();
|
||||||
|
@ -50,18 +50,50 @@ function reloadData() {
|
||||||
paginate.value.fetch();
|
paginate.value.fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSendToTablet = async (deviceProductionFk) => {
|
const handleSendToTablet = async (row) => {
|
||||||
try {
|
try {
|
||||||
await axios.post(`Docuwares/upload`, {
|
if (isProduction(false)) {
|
||||||
fileCabinet: 'hr',
|
const { deviceProductionFk } = row;
|
||||||
ids: [deviceProductionFk],
|
await axios.post(`Docuwares/upload`, {
|
||||||
});
|
fileCabinet: 'hr',
|
||||||
notify(t('PDA Signed'), 'positive');
|
ids: [deviceProductionFk],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
notify(t('PDF sended to signed'), 'positive');
|
||||||
|
row.isDocuware = true;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error removing department');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleRefreshDocuware = async (row) => {
|
||||||
|
try {
|
||||||
|
if (isProduction()) {
|
||||||
|
const { deviceProductionFk } = row;
|
||||||
|
await axios.post(`Docuwares/upload`, {
|
||||||
|
fileCabinet: 'hr',
|
||||||
|
ids: [deviceProductionFk],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
notify(t('PDA Signed'), 'positive');
|
||||||
|
row.isSigned = true;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error removing department');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleDownloadDocuware = async (row) => {
|
||||||
|
try {
|
||||||
|
if (isProduction(false)) {
|
||||||
|
const { deviceProductionFk } = row;
|
||||||
|
await axios.post(`Docuwares/upload`, {
|
||||||
|
fileCabinet: 'hr',
|
||||||
|
ids: [deviceProductionFk],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
notify(t('PDF downloaded'), 'positive');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error removing department');
|
console.error('Error removing department');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleDownloadDocuware = async (deviceProductionFk) => {};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -113,6 +145,7 @@ const handleDownloadDocuware = async (deviceProductionFk) => {};
|
||||||
:model-value="row?.simSerialNumber"
|
:model-value="row?.simSerialNumber"
|
||||||
disable
|
disable
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<QBtn
|
<QBtn
|
||||||
flat
|
flat
|
||||||
icon="delete"
|
icon="delete"
|
||||||
|
@ -130,6 +163,49 @@ const handleDownloadDocuware = async (deviceProductionFk) => {};
|
||||||
{{ t('worker.pda.removePDA') }}
|
{{ t('worker.pda.removePDA') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
|
<QBtn
|
||||||
|
v-if="row.isSigned"
|
||||||
|
icon="cloud_download"
|
||||||
|
flat
|
||||||
|
class="btn-delete"
|
||||||
|
color="primary"
|
||||||
|
@click="handleDownloadDocuware(row)"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('worker.pda.download') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
<QBtn
|
||||||
|
v-if="row.isDocuware && !row.isSigned"
|
||||||
|
icon="refresh"
|
||||||
|
flat
|
||||||
|
class="btn-delete"
|
||||||
|
color="primary"
|
||||||
|
@click="handleRefreshDocuware(row)"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('worker.pda.refresh') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QBtn>
|
||||||
|
<QBtn
|
||||||
|
v-if="!row.isDocuware"
|
||||||
|
icon="vn:client"
|
||||||
|
flat
|
||||||
|
class="btn-delete"
|
||||||
|
color="primary"
|
||||||
|
@click="
|
||||||
|
openConfirmationModal(
|
||||||
|
t('Are you sure you want to send it?'),
|
||||||
|
t('Sign PDA'),
|
||||||
|
|
||||||
|
() => handleSendToTablet(row)
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<QTooltip>
|
||||||
|
{{ t('worker.pda.sendToTablet') }}
|
||||||
|
</QTooltip>
|
||||||
|
</QBtn>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
</QCard>
|
</QCard>
|
||||||
</template>
|
</template>
|
||||||
|
@ -147,10 +223,10 @@ const handleDownloadDocuware = async (deviceProductionFk) => {};
|
||||||
<template #form-inputs="{ data }">
|
<template #form-inputs="{ data }">
|
||||||
<VnRow class="row q-gutter-md q-mb-md">
|
<VnRow class="row q-gutter-md q-mb-md">
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('worker.pda.newPDA')"
|
:label="t('PDA')"
|
||||||
v-model="data.deviceProductionFk"
|
v-model="data.deviceProductionFk"
|
||||||
:options="deviceProductions"
|
:options="deviceProductions"
|
||||||
option-label="id"
|
option-label="modelFk"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
id="deviceProductionFk"
|
id="deviceProductionFk"
|
||||||
hide-selected
|
hide-selected
|
||||||
|
@ -196,6 +272,7 @@ const handleDownloadDocuware = async (deviceProductionFk) => {};
|
||||||
es:
|
es:
|
||||||
Model: Modelo
|
Model: Modelo
|
||||||
Serial number: Número de serie
|
Serial number: Número de serie
|
||||||
|
SIM serial number: (SIM) Número de serie
|
||||||
Current SIM: SIM actual
|
Current SIM: SIM actual
|
||||||
Add new device: Añadir nuevo dispositivo
|
Add new device: Añadir nuevo dispositivo
|
||||||
PDA deallocated: PDA desasignada
|
PDA deallocated: PDA desasignada
|
||||||
|
@ -203,4 +280,9 @@ es:
|
||||||
Do you want to remove this PDA?: ¿Desea eliminar este PDA?
|
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
|
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
|
This PDA is already assigned to another user: Este PDA ya está asignado a otro usuario
|
||||||
|
Are you sure you want to send it?: ¿Estás seguro que lo quieres enviar?
|
||||||
|
Sign PDA: Firmar PDA
|
||||||
|
PDF sended to signed: PDF enviado para firmar
|
||||||
|
PDA signed: PDA firmado
|
||||||
|
PDF download: PDF descargado
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
Loading…
Reference in New Issue