From 85095bda364df0608cfc4f7cc2f2a49f5bd90961 Mon Sep 17 00:00:00 2001 From: Alexandro Uc Santos Date: Fri, 1 Dec 2023 21:32:13 -0600 Subject: [PATCH] add: view carriers --- src/components/CardCompany.vue | 77 +++++++++++ src/components/ui/EditCompanyModal.vue | 43 ++++-- src/composables/useDirectory.js | 29 ++++ src/layouts/AdminLayout.vue | 2 +- src/router/index.js | 5 + src/services/company.js | 11 ++ src/services/public.js | 1 + src/views/CarriersView.vue | 177 +++++++++++++++++++++++++ 8 files changed, 335 insertions(+), 10 deletions(-) create mode 100644 src/components/CardCompany.vue create mode 100644 src/composables/useDirectory.js create mode 100644 src/views/CarriersView.vue diff --git a/src/components/CardCompany.vue b/src/components/CardCompany.vue new file mode 100644 index 0000000..c16f057 --- /dev/null +++ b/src/components/CardCompany.vue @@ -0,0 +1,77 @@ + + + + + \ No newline at end of file diff --git a/src/components/ui/EditCompanyModal.vue b/src/components/ui/EditCompanyModal.vue index 666cd03..c7237b9 100644 --- a/src/components/ui/EditCompanyModal.vue +++ b/src/components/ui/EditCompanyModal.vue @@ -8,8 +8,10 @@ import TruckTypes from './TruckTypes.vue'; import Custominput from './custominput.vue'; import { useCompanyStore } from '../../stores/company'; + import { useNotificationsStore } from '../../stores/notifications'; const companyStore = useCompanyStore() + const notifications = useNotificationsStore() console.log(companyStore.company?.categories); @@ -45,14 +47,6 @@ } }) const company = reactive({ - typeCompany: '', - // segments: [{ - // createdAt: "2022-08-25T05:14:35.906Z", - // name:"AGRICOLA", - // updatedAt: "2022-08-25T05:16:35.603Z", - // __v: 0, - // _id: "6307053bbf4a7b12a4dca8c9" - // }], segments: companyCategories, states: companyStates, cities: companyCity, @@ -61,7 +55,38 @@ }); const handleSave = () => { + // const resp = editCompany() + const resp = validations(); + if(resp !== '') { + msgError.value = resp; + clearMessages(); + } else { + // $('#editcompanymodal').modal('toggle'); + document.getElementById('btnCloseEditCompany').click(); + notifications.show = true; + notifications.text = 'Empresa actualizada'; + } + } + const clearMessages = () => { + setTimeout(() => { + msgError.value = ''; + }, 3000); + } + + const validations = () => { + if(company.segments.length === 0) { + return 'Agregue al menos un segmento'; + }else if(company.states.length === 0) { + return 'Agregue al menos un estado'; + } else if( company.cities.length === 0) { + msgError.value = 'Agregue al menos una ciudad'; + } else if(company.truckTypes.length === 0){ + msgError.value = 'Agregue al menos un tipo de camión'; + } else { + return ''; + } + } @@ -72,7 +97,7 @@