add: view carriers
This commit is contained in:
@@ -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 '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -72,7 +97,7 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2 class="title mt-2 mb-3">Editar Empresa</h2>
|
||||
<button type="button" class="close bg-white" data-dismiss="modal" aria-label="Close">
|
||||
<button id="btnCloseEditCompany" type="button" class="close bg-white" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user