add: private load actions & delete contact
This commit is contained in:
@@ -3,6 +3,11 @@ body {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
/*Colors*/
|
||||
.primary-color-eta {
|
||||
color: #FBBA33;
|
||||
}
|
||||
|
||||
.flex-d-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -39,6 +44,18 @@ body {
|
||||
.font-bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.fsize-1 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.fsize-1-5 {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.fsize-2 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
/* *********** */
|
||||
|
||||
.divider {
|
||||
@@ -130,6 +147,12 @@ body {
|
||||
color: #FBBA33;
|
||||
}
|
||||
|
||||
.text-tertiary {
|
||||
font-size: 1rem !important;
|
||||
font-weight: 500 !important;
|
||||
color: rgb(181, 168, 168) !important;
|
||||
}
|
||||
|
||||
.card-info,
|
||||
.card-fixed {
|
||||
width: 100%;
|
||||
|
||||
@@ -121,6 +121,9 @@
|
||||
<template>
|
||||
<div class="card-fixed card-load mt-4">
|
||||
<div class="row">
|
||||
<p v-if="load?.privacy === true && load?.company?._id === authStore?.user?.company._id && !share">
|
||||
<i class="fa-solid fa-lock primary-color-eta fsize-1-5"></i> <span class="text-tertiary fsize-1">Carga privada</span>
|
||||
</p>
|
||||
<div class="col-lg-6 col-sm-12">
|
||||
<p>
|
||||
<span>{{t('loads.origin')}}: </span>
|
||||
|
||||
@@ -54,6 +54,7 @@ export const updateUser = async(user_id, formData) => {
|
||||
export const updateMyUserProfile = async(formData) => {
|
||||
try {
|
||||
const endpoint = `/v1/users/profile`;
|
||||
console.log(formData);
|
||||
const {data} = await api.patch(endpoint, formData);
|
||||
return {
|
||||
msg: "success",
|
||||
|
||||
@@ -23,6 +23,7 @@ export const usePrivacyStore = defineStore('privacy', () => {
|
||||
const response = await getPrivateListService();
|
||||
if(response.msg == 'success') {
|
||||
privateList.value = response.data.allowedCompanies || [];
|
||||
privateListRef.value = privateList.value.map((e) => e._id);
|
||||
return 'success';
|
||||
} else {
|
||||
return response.msg;
|
||||
@@ -45,10 +46,7 @@ export const usePrivacyStore = defineStore('privacy', () => {
|
||||
const deleteCompanyToPrivateList = async (id) => {
|
||||
const response = await deleteCompanyPrivicyListService(id);
|
||||
if(response.msg == 'success') {
|
||||
privateListRef.value = [
|
||||
...privateListRef.value,
|
||||
id
|
||||
]
|
||||
removeContact(id);
|
||||
return 'success';
|
||||
} else {
|
||||
return response.msg;
|
||||
@@ -56,9 +54,9 @@ export const usePrivacyStore = defineStore('privacy', () => {
|
||||
}
|
||||
|
||||
/// State
|
||||
|
||||
const removeContact = (id) => {
|
||||
privateList.value = privateList.value.filter((e) => e.id !== id);
|
||||
privateList.value = privateList.value.filter((e) => e._id !== id);
|
||||
privateListRef.value = privateListRef.value.filter((e) => e !== id);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -27,7 +27,7 @@ import { computed } from 'vue';
|
||||
confirmButtonText: t('buttons.delete'),
|
||||
cancelButtonText: t('buttons.cancel'),
|
||||
}).then(async(result) => {
|
||||
const id = props.contact.id;
|
||||
const id = props.contact._id;
|
||||
if(result.isConfirmed) {
|
||||
Swal.fire({
|
||||
title: t('messages.loading'),
|
||||
@@ -41,7 +41,7 @@ import { computed } from 'vue';
|
||||
resp = true
|
||||
Swal.close();
|
||||
if(resp != null) {
|
||||
contactsStore.removeContact(id);
|
||||
contactsStore.deleteCompanyToPrivateList(id);
|
||||
Swal.fire({
|
||||
title: 'Transportista eliminado',
|
||||
text: 'Se ha eliminado el transportista de la lista privada',
|
||||
@@ -71,6 +71,11 @@ import { computed } from 'vue';
|
||||
: ''
|
||||
)
|
||||
|
||||
const states = computed(() => (props.contact.company_state)
|
||||
? props.contact.company_state.join(', ')
|
||||
: ''
|
||||
)
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -80,7 +85,7 @@ import { computed } from 'vue';
|
||||
<h2 class="flex1">{{ contact.company_name }}</h2>
|
||||
<button
|
||||
v-if="(authStore.user?.job_role === 'owner' || authStore.user?.job_role === 'manager')"
|
||||
class="btn-primary-sm bg-danger"
|
||||
class="btn-primary-sm bg-danger sizeBtn"
|
||||
@click="handleDeleteContact"
|
||||
>
|
||||
<i class="fa-solid fa-trash"></i>
|
||||
@@ -88,7 +93,8 @@ import { computed } from 'vue';
|
||||
</div>
|
||||
<p><span class="font-bold">RFC: </span> {{ contact.rfc}}</p>
|
||||
<p><span class="font-bold">{{ t('global.segments') }}:</span> {{ categories }}</p>
|
||||
<p><span class="font-bold">{{ t('directory.typeTruckNeed') }}: </span> {{ truckTypes }}</p>
|
||||
<p><span class="font-bold">Camiones usados: </span> {{ truckTypes }}</p>
|
||||
<p><span class="font-bold">Estados: </span> {{ states }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -98,4 +104,10 @@ import { computed } from 'vue';
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.sizeBtn {
|
||||
width: 46px;
|
||||
height: 40px;
|
||||
margin-left: 16px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -16,13 +16,15 @@
|
||||
import { computed } from 'vue';
|
||||
import { validateEmail } from '../../../helpers/validations';
|
||||
import AddressPreview from '../../../components/AddressPreview.vue';
|
||||
import CustomSwitch from '../../../components/CustomSwitch.vue';
|
||||
import CustomSwitch from '../../../components/CustomSwitch.vue';
|
||||
import { usePrivacyStore } from '../../../stores/privacy';
|
||||
|
||||
|
||||
const loadStore = useLoadsStore();
|
||||
const notyStore = useNotificationsStore();
|
||||
const auth = useAuthStore();
|
||||
const companyStore = useCompanyStore()
|
||||
const privacyStore = usePrivacyStore()
|
||||
const windowWidth = ref(window.innerWidth);
|
||||
const zoom = ref(6);
|
||||
const heightMap = ref(768);
|
||||
@@ -77,10 +79,12 @@ import CustomSwitch from '../../../components/CustomSwitch.vue';
|
||||
zoom.value = 4;
|
||||
heightMap.value = 420;
|
||||
}
|
||||
isPrivate.value = privacyStore.privacy;
|
||||
getLocations('unloading');
|
||||
getLocations('loading');
|
||||
formLoad.owner = auth.user?.first_name + ' ' + auth.user?.last_name;
|
||||
if(loadStore.currentLoad){
|
||||
isPrivate.value = loadStore.currentLoad.privacy || false
|
||||
const dateStart = loadStore.currentLoad.est_loading_date;
|
||||
const dateEnd = loadStore.currentLoad.est_unloading_date;
|
||||
formLoad.price = loadStore.currentLoad.actual_cost;
|
||||
@@ -258,7 +262,8 @@ import CustomSwitch from '../../../components/CustomSwitch.vue';
|
||||
posted_by_name: formLoad.owner,
|
||||
origin_warehouse: locationLoadSelected.value?._id || null,
|
||||
destination_warehouse: locationDownloadSelected.value?._id || null,
|
||||
alert_list: emails.value.length > 0 ? emails.value : null
|
||||
alert_list: emails.value.length > 0 ? emails.value : null,
|
||||
privacy: isPrivate.value
|
||||
};
|
||||
return loadData;
|
||||
}
|
||||
@@ -608,7 +613,6 @@ import CustomSwitch from '../../../components/CustomSwitch.vue';
|
||||
<div v-else class="btns-footer">
|
||||
<div class="switch-container">
|
||||
<CustomSwitch
|
||||
v-if="loadStore?.currentLoad == null || loadStore.currentLoad?.status === 'Draft'"
|
||||
label='Publicar como privada'
|
||||
v-model="isPrivate"
|
||||
name="contacts"
|
||||
|
||||
Reference in New Issue
Block a user