forked from verdnatura/salix-front
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 FormModelPopup from 'src/components/FormModelPopup.vue';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import { isProduction } from 'composables/useEnv';
|
||||
|
||||
import VnPaginate from 'src/components/ui/VnPaginate.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
|
@ -18,7 +19,6 @@ const { t } = useI18n();
|
|||
const { notify } = useNotify();
|
||||
|
||||
const paginate = ref();
|
||||
const isDocuware = ref(false);
|
||||
const dialog = ref();
|
||||
const route = useRoute();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
|
@ -50,18 +50,50 @@ function reloadData() {
|
|||
paginate.value.fetch();
|
||||
}
|
||||
|
||||
const handleSendToTablet = async (deviceProductionFk) => {
|
||||
const handleSendToTablet = async (row) => {
|
||||
try {
|
||||
await axios.post(`Docuwares/upload`, {
|
||||
fileCabinet: 'hr',
|
||||
ids: [deviceProductionFk],
|
||||
});
|
||||
notify(t('PDA Signed'), 'positive');
|
||||
if (isProduction(false)) {
|
||||
const { deviceProductionFk } = row;
|
||||
await axios.post(`Docuwares/upload`, {
|
||||
fileCabinet: 'hr',
|
||||
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) {
|
||||
console.error('Error removing department');
|
||||
}
|
||||
};
|
||||
const handleDownloadDocuware = async (deviceProductionFk) => {};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -113,6 +145,7 @@ const handleDownloadDocuware = async (deviceProductionFk) => {};
|
|||
:model-value="row?.simSerialNumber"
|
||||
disable
|
||||
/>
|
||||
|
||||
<QBtn
|
||||
flat
|
||||
icon="delete"
|
||||
|
@ -130,6 +163,49 @@ const handleDownloadDocuware = async (deviceProductionFk) => {};
|
|||
{{ t('worker.pda.removePDA') }}
|
||||
</QTooltip>
|
||||
</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>
|
||||
</QCard>
|
||||
</template>
|
||||
|
@ -147,10 +223,10 @@ const handleDownloadDocuware = async (deviceProductionFk) => {};
|
|||
<template #form-inputs="{ data }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<VnSelect
|
||||
:label="t('worker.pda.newPDA')"
|
||||
:label="t('PDA')"
|
||||
v-model="data.deviceProductionFk"
|
||||
:options="deviceProductions"
|
||||
option-label="id"
|
||||
option-label="modelFk"
|
||||
option-value="id"
|
||||
id="deviceProductionFk"
|
||||
hide-selected
|
||||
|
@ -196,6 +272,7 @@ const handleDownloadDocuware = async (deviceProductionFk) => {};
|
|||
es:
|
||||
Model: Modelo
|
||||
Serial number: Número de serie
|
||||
SIM serial number: (SIM) Número de serie
|
||||
Current SIM: SIM actual
|
||||
Add new device: Añadir nuevo dispositivo
|
||||
PDA deallocated: PDA desasignada
|
||||
|
@ -203,4 +280,9 @@ 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?: ¿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>
|
||||
|
|
Loading…
Reference in New Issue