add: contacts module & actions to private list
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
import { RouterLink } from 'vue-router';
|
||||
import { getDateMonthDay } from '../../../helpers/date_formats';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import Swal from 'sweetalert2';
|
||||
import { ref } from 'vue';
|
||||
import { useAuthStore } from '../../../stores/auth';
|
||||
|
||||
defineProps({
|
||||
company: {
|
||||
@@ -10,6 +13,53 @@
|
||||
}
|
||||
});
|
||||
|
||||
const authStore = useAuthStore();
|
||||
let existInPrivateList = ref(false);
|
||||
|
||||
const handleAddPrivateList = async() => {
|
||||
Swal.fire({
|
||||
title: 'Lista privadad',
|
||||
text: '¿Estas seguro de añadir a este transportista de la lista privada?',
|
||||
icon: 'info',
|
||||
showCancelButton: true,
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: t('buttons.yes'),
|
||||
cancelButtonText: t('buttons.no'),
|
||||
}).then(async(result) => {
|
||||
if(result.isConfirmed) {
|
||||
Swal.fire({
|
||||
title: t('messages.loading'),
|
||||
allowOutsideClick: false,
|
||||
didOpen: () => {
|
||||
Swal.showLoading()
|
||||
},
|
||||
});
|
||||
let resp = null;
|
||||
setTimeout(() => {
|
||||
resp = true
|
||||
Swal.close();
|
||||
if(resp != null) {
|
||||
// contactsStore.removeContact(id);
|
||||
existInPrivateList.value = true;
|
||||
Swal.fire({
|
||||
title: 'Transportista añadido',
|
||||
text: 'Se ha añadido este transportista a la lista privada',
|
||||
icon: "success"
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: t('errors.msgTitleNotDel'),
|
||||
text: 'No se pudo completar la añadir este transportista a la lista privada',
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
const { t } = useI18n()
|
||||
</script>
|
||||
|
||||
@@ -30,9 +80,18 @@
|
||||
<p><span>{{ t('labels.infoCompany') }}: </span>{{company.company_description}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-end">
|
||||
<div
|
||||
class="d-flex justify-content-end gap-2"
|
||||
v-if="authStore.user?.permissions === 'role_shipper'">
|
||||
<button
|
||||
v-if="!existInPrivateList"
|
||||
class="btn-primary-sm bg-dark radius-sm"
|
||||
@click="handleAddPrivateList"
|
||||
>
|
||||
Añadir a lista privada
|
||||
</button>
|
||||
<RouterLink
|
||||
class="btn-primary-sm"
|
||||
class="btn-primary-sm radius-sm"
|
||||
:to="{name: 'public-users', params: {id: company._id}}"
|
||||
>{{ t('buttons.profile') }}</RouterLink>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user