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