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 @@
+
+
+
+
+
{{ company.company_name }}
+
+
+
+
RFC: {{ company.rfc }}
+
Tipo de empresa: {{ company.company_type ? company.company_type.join(", ") : 'No definido' }}
+
Código: {{ company.company_code }}
+
Empresa miembro desde: {{getDateMonthDay(company.createdAt)}}
+
Afiliación: {{company.membership}}
+
+
+
Segmento empresa: {{ company._categories }}
+
Locaciones de carga por estado: {{company._company_state}}
+
Locaciones de carga por municipio: {{company._company_city}}
+
Transportes utilizados: {{company._truck_types}}
+
Información general de la empresa: {{company.company_description}}
+
+
+
+
+
+
+
\ 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 @@
diff --git a/src/composables/useDirectory.js b/src/composables/useDirectory.js
new file mode 100644
index 0000000..45fb445
--- /dev/null
+++ b/src/composables/useDirectory.js
@@ -0,0 +1,29 @@
+import { ref } from "vue";
+import { getCompanies } from '../services/public';
+
+export default function useDirecty() {
+ const companies = ref([]);
+ const loading = ref(false);
+
+ const getCompaniesData = async(filterQuery) => {
+ let filterArr = Object.values(filterQuery);
+ let cleanfilterArr = filterArr.filter(n=>n);
+ let filterStr = "";
+
+ if(cleanfilterArr.length >0){
+ filterStr = cleanfilterArr[0] + "?"
+ filterStr += cleanfilterArr.slice(1).join("&");
+ }
+
+ loading.value = true;
+ const resp = await getCompanies(filterStr);
+ companies.value = resp;
+ loading.value = false;
+ }
+
+ return {
+ getCompaniesData,
+ loading,
+ companies
+ }
+}
\ No newline at end of file
diff --git a/src/layouts/AdminLayout.vue b/src/layouts/AdminLayout.vue
index 04d0401..cb0a934 100644
--- a/src/layouts/AdminLayout.vue
+++ b/src/layouts/AdminLayout.vue
@@ -152,7 +152,7 @@
Transporte
+ class="nav-link" :to="{name: 'carriers'}">Transporte
import('../views/VehiclesView.vue'),
},
+ {
+ path: 'embarcadores',
+ name: 'carriers',
+ component: () => import('../views/CarriersView.vue'),
+ },
]
}
]
diff --git a/src/services/company.js b/src/services/company.js
index 268d607..3118544 100644
--- a/src/services/company.js
+++ b/src/services/company.js
@@ -10,4 +10,15 @@ export const getCompany = async(companyId) => {
console.log(error);
return null;
}
+}
+
+export const editCompany = async(companyId, formData) => {
+ try {
+ const endpoint = `/companies/${companyId}`;
+ const {data} = await api.patch(endpoint, formData);
+ return data;
+ } catch (error) {
+ console.log(error);
+ return null;
+ }
}
\ No newline at end of file
diff --git a/src/services/public.js b/src/services/public.js
index 710bb57..baf122a 100644
--- a/src/services/public.js
+++ b/src/services/public.js
@@ -53,6 +53,7 @@ export const getCompanies = async(filter) => {
const endpoint = `/v1/public-companies/${filter}`;
console.log(endpoint);
const {data} = await api.get(endpoint);
+ console.log(data);
return data.data;
} catch (error) {
console.log(error);
diff --git a/src/views/CarriersView.vue b/src/views/CarriersView.vue
new file mode 100644
index 0000000..6ee8d5d
--- /dev/null
+++ b/src/views/CarriersView.vue
@@ -0,0 +1,177 @@
+
+
+
+
+
Directorios de Transportistas
+
+
+
+
+
+
+
+
+
+
+
+

+
No hay registros
+
+
+
+
+
+
+
\ No newline at end of file