diff --git a/src/components/FormModel.vue b/src/components/FormModel.vue index 2bc72f96d..b18312896 100644 --- a/src/components/FormModel.vue +++ b/src/components/FormModel.vue @@ -109,14 +109,18 @@ function tMobile(...args) { } async function fetch() { - const { data } = await axios.get($props.url, { - params: { filter: JSON.stringify($props.filter) }, - }); + try { + const { data } = await axios.get($props.url, { + params: { filter: JSON.stringify($props.filter) }, + }); + state.set($props.model, data); + originalData.value = data && JSON.parse(JSON.stringify(data)); - state.set($props.model, data); - originalData.value = data && JSON.parse(JSON.stringify(data)); - - emit('onFetch', state.get($props.model)); + emit('onFetch', state.get($props.model)); + } catch (error) { + state.set($props.model, {}); + originalData.value = {}; + } } async function save() { diff --git a/src/pages/Customer/Card/CustomerBalance.vue b/src/pages/Customer/Card/CustomerBalance.vue index e74933477..c8109eb7d 100644 --- a/src/pages/Customer/Card/CustomerBalance.vue +++ b/src/pages/Customer/Card/CustomerBalance.vue @@ -37,7 +37,7 @@ const params = { }; const filter = { include: { relation: 'company', scope: { fields: ['code'] } }, - where: { clientFk: `${route.params.id}`, companyFk: user.value.companyFk }, + where: { clientFk: route.params.id, companyFk: user.value.companyFk }, }; const tableColumnComponents = { diff --git a/src/pages/Customer/Card/CustomerCreditOpinion.vue b/src/pages/Customer/Card/CustomerCreditOpinion.vue index 74d61b7c1..8a532a4e3 100644 --- a/src/pages/Customer/Card/CustomerCreditOpinion.vue +++ b/src/pages/Customer/Card/CustomerCreditOpinion.vue @@ -23,7 +23,7 @@ const filter = { }, }, ], - where: { clientFk: `${route.params.id}` }, + where: { clientFk: route.params.id }, order: ['created DESC'], limit: 20, }; diff --git a/src/pages/Customer/Card/CustomerCredits.vue b/src/pages/Customer/Card/CustomerCredits.vue index 6852b42eb..f5e820aac 100644 --- a/src/pages/Customer/Card/CustomerCredits.vue +++ b/src/pages/Customer/Card/CustomerCredits.vue @@ -1,5 +1,5 @@ + - Customer file management + (rows = data)" + auto-load + url="ClientDms" + /> + + + + + + + + + {{ props.value }} + + + + + + + + + + {{ t('globals.noResults') }} + + + + + + + {{ t('Upload file') }} + + + + + + +es: + Id: Id + Type: Tipo + Order: Orden + Reference: Referencia + Description: Descripción + Original: Original + File: Fichero + Employee: Empleado + Created: Fecha creación + Upload file: Subir fichero + diff --git a/src/pages/Customer/Card/CustomerRecoveries.vue b/src/pages/Customer/Card/CustomerRecoveries.vue index e747b3d79..c4ae47a64 100644 --- a/src/pages/Customer/Card/CustomerRecoveries.vue +++ b/src/pages/Customer/Card/CustomerRecoveries.vue @@ -15,7 +15,7 @@ const router = useRouter(); const rows = ref([]); const filter = { - where: { clientFk: `${route.params.id}` }, + where: { clientFk: route.params.id }, order: ['started DESC'], limit: 20, }; diff --git a/src/pages/Customer/Card/CustomerSamples.vue b/src/pages/Customer/Card/CustomerSamples.vue index c0d84eff6..499db87fb 100644 --- a/src/pages/Customer/Card/CustomerSamples.vue +++ b/src/pages/Customer/Card/CustomerSamples.vue @@ -71,7 +71,7 @@ const columns = computed(() => [ }, { align: 'left', - field: (value) => value.company.code, + field: (value) => value.company?.code, label: t('Company'), name: 'company', }, diff --git a/src/pages/Customer/Card/CustomerUnpaid.vue b/src/pages/Customer/Card/CustomerUnpaid.vue index 66f771aba..54b4851db 100644 --- a/src/pages/Customer/Card/CustomerUnpaid.vue +++ b/src/pages/Customer/Card/CustomerUnpaid.vue @@ -1,3 +1,57 @@ + + - Customer unpaid + + + + + + + + + + + + + + + + + + + + +es: + Unpaid client: Cliente impagado + Date: Fecha + Amount: Importe + diff --git a/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue b/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue index b150f4d8b..cb24548a3 100644 --- a/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue +++ b/src/pages/Customer/Defaulter/CustomerDefaulterAddObservation.vue @@ -3,7 +3,7 @@ import { ref } from 'vue'; import { useI18n } from 'vue-i18n'; import axios from 'axios'; -import { useQuasar } from 'quasar'; +import { useDialogPluginComponent, useQuasar } from 'quasar'; import VnRow from 'components/ui/VnRow.vue'; @@ -18,6 +18,7 @@ const $props = defineProps({ }, }); +const { dialogRef } = useDialogPluginComponent(); const { t } = useI18n(); const quasar = useQuasar(); diff --git a/src/pages/Customer/components/CustomerFileManagementActions.vue b/src/pages/Customer/components/CustomerFileManagementActions.vue new file mode 100644 index 000000000..105c12cf7 --- /dev/null +++ b/src/pages/Customer/components/CustomerFileManagementActions.vue @@ -0,0 +1,96 @@ + + + + + + + {{ t('Download file') }} + + + + + {{ t('Edit file') }} + + + + + {{ t('Remove file') }} + + + + + + +es: + Download file: Descargar fichero + Edit file: Editar fichero + Remove file: Eliminar fichero + diff --git a/src/pages/Customer/components/CustomerFileManagementCreate.vue b/src/pages/Customer/components/CustomerFileManagementCreate.vue new file mode 100644 index 000000000..9e15758f8 --- /dev/null +++ b/src/pages/Customer/components/CustomerFileManagementCreate.vue @@ -0,0 +1,247 @@ + + + + (client = data)" + auto-load + :url="`Clients/${route.params.id}/getCard`" + /> + (findOne = data)" + auto-load + url="DmsTypes/findOne" + /> + (allowedContentTypes = data)" + auto-load + url="DmsContainers/allowedContentTypes" + /> + (optionsCompanies = data)" + auto-load + url="Companies" + /> + (optionsWarehouses = data)" + auto-load + url="Warehouses" + /> + (optionsDmsTypes = data)" + auto-load + url="DmsTypes" + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ t('Select a file') }} + + + + + {{ + `${t( + 'Allowed content types' + )}: ${allowedContentTypes.join(', ')}` + }} + + + + + + + + + + + + + + + + + + + +en: + clientFileDescription: '{dmsTypeName} FROM CLIENT {clientName} ID {clientId}' +es: + Reference: Referencia + Company: Empresa + Warehouse: Almacén + Type: Tipo + Description: Descripción + clientFileDescription: '{dmsTypeName} DEL CLIENTE {clientName} ID {clientId}' + File: Fichero + Select a file: Selecciona un fichero + Allowed content types: Tipos de archivo permitidos + Generate identifier for original file: Generar identificador para archivo original + diff --git a/src/pages/Customer/components/CustomerFileManagementDelete.vue b/src/pages/Customer/components/CustomerFileManagementDelete.vue new file mode 100644 index 000000000..c4e80d492 --- /dev/null +++ b/src/pages/Customer/components/CustomerFileManagementDelete.vue @@ -0,0 +1,81 @@ + + + + + + + + + + + {{ t('This file will be deleted') }} + {{ t('Are you sure you want to continue?') }} + + + + + + + + + + + +es: + This file will be deleted: Este fichero va a ser borrado + Are you sure you want to continue?: ¿Seguro que quieres continuar? + diff --git a/src/pages/Customer/components/CustomerFileManagementEdit.vue b/src/pages/Customer/components/CustomerFileManagementEdit.vue new file mode 100644 index 000000000..5b6cb0981 --- /dev/null +++ b/src/pages/Customer/components/CustomerFileManagementEdit.vue @@ -0,0 +1,225 @@ + + + + + (allowedContentTypes = data)" + auto-load + url="DmsContainers/allowedContentTypes" + /> + (optionsCompanies = data)" + auto-load + url="Companies" + /> + (optionsWarehouses = data)" + auto-load + url="Warehouses" + /> + (optionsDmsTypes = data)" + auto-load + url="DmsTypes" + /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ t('Select a file') }} + + + + + {{ + `${t( + 'Allowed content types' + )}: ${allowedContentTypes.join(', ')}` + }} + + + + + + + + + + + + + + + + + + + +en: + clientFileDescription: '{dmsTypeName} FROM CLIENT {clientName} ID {clientId}' +es: + Reference: Referencia + Company: Empresa + Warehouse: Almacén + Type: Tipo + Description: Descripción + clientFileDescription: '{dmsTypeName} DEL CLIENTE {clientName} ID {clientId}' + File: Fichero + Select a file: Selecciona un fichero + Allowed content types: Tipos de archivo permitidos + Generate identifier for original file: Generar identificador para archivo original + diff --git a/src/router/modules/customer.js b/src/router/modules/customer.js index 46202128c..88faec2a5 100644 --- a/src/router/modules/customer.js +++ b/src/router/modules/customer.js @@ -356,12 +356,12 @@ export default { { name: 'CustomerCreditContracts', title: 'creditContracts', - icon: 'paid', + icon: 'vn:solunion', }, { name: 'CustomerCreditOpinion', title: 'creditOpinion', - icon: 'paid', + icon: 'vn:linesprepaired', }, ], }, @@ -371,7 +371,6 @@ export default { name: 'CustomerCreditContracts', meta: { title: 'creditContracts', - icon: 'paid', }, component: () => import( @@ -388,7 +387,6 @@ export default { name: 'CustomerCreditContracts', meta: { title: 'creditContracts', - icon: 'paid', }, component: () => import( @@ -418,7 +416,6 @@ export default { name: 'CustomerCreditOpinion', meta: { title: 'creditOpinion', - icon: 'paid', }, component: () => import( @@ -437,37 +434,37 @@ export default { { name: 'CustomerSamples', title: 'samples', - icon: 'pending', + icon: 'vn:notes', }, { name: 'CustomerConsumption', title: 'consumption', - icon: 'pending', + icon: 'vn:lines', }, { name: 'CustomerMandates', title: 'mandates', - icon: 'pending', + icon: 'vn:mandatory', }, { name: 'CustomerContacts', title: 'contacts', - icon: 'pending', + icon: 'contact_phone', }, { name: 'CustomerWebPayment', title: 'webPayment', - icon: 'pending', + icon: 'vn:onlinepayment', }, { name: 'CustomerFileManagement', title: 'fileManagement', - icon: 'pending', + icon: 'Upload', }, { name: 'CustomerUnpaid', title: 'unpaid', - icon: 'pending', + icon: 'vn:supplierfalse', }, ], }, @@ -477,7 +474,6 @@ export default { name: 'CustomerSamples', meta: { title: 'samples', - icon: 'paid', }, component: () => import('src/pages/Customer/Card/CustomerSamples.vue'), @@ -492,7 +488,6 @@ export default { name: 'CustomerSamples', meta: { title: 'samples', - icon: 'paid', }, component: () => import( @@ -514,7 +509,6 @@ export default { name: 'CustomerConsumption', meta: { title: 'consumption', - icon: 'paid', }, component: () => import('src/pages/Customer/Card/CustomerConsumption.vue'), @@ -524,7 +518,6 @@ export default { name: 'CustomerMandates', meta: { title: 'mandates', - icon: 'paid', }, component: () => import('src/pages/Customer/Card/CustomerMandates.vue'), @@ -534,7 +527,6 @@ export default { name: 'CustomerContacts', meta: { title: 'contacts', - icon: 'paid', }, component: () => import('src/pages/Customer/Card/CustomerContacts.vue'), @@ -544,7 +536,6 @@ export default { name: 'CustomerWebPayment', meta: { title: 'webPayment', - icon: 'paid', }, component: () => import('src/pages/Customer/Card/CustomerWebPayment.vue'), @@ -554,7 +545,6 @@ export default { name: 'CustomerFileManagement', meta: { title: 'fileManagement', - icon: 'paid', }, component: () => import( @@ -571,7 +561,6 @@ export default { name: 'CustomerFileManagement', meta: { title: 'fileManagement', - icon: 'paid', }, component: () => import( @@ -586,6 +575,14 @@ export default { 'src/pages/Customer/components/CustomerFileManagementCreate.vue' ), }, + { + path: ':dmsId/edit', + name: 'CustomerFileManagementEdit', + component: () => + import( + 'src/pages/Customer/components/CustomerFileManagementEdit.vue' + ), + }, ], }, { @@ -593,7 +590,6 @@ export default { name: 'CustomerUnpaid', meta: { title: 'unpaid', - icon: 'paid', }, component: () => import('src/pages/Customer/Card/CustomerUnpaid.vue'),