delete user company
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
<script setup>
|
||||
import Swal from 'sweetalert2';
|
||||
import { getDateMonthDay } from '../helpers/date_formats';
|
||||
import Swal from 'sweetalert2';
|
||||
import { getDateMonthDay } from '../helpers/date_formats';
|
||||
import { useCompanyStore } from '../stores/company';
|
||||
|
||||
defineProps({
|
||||
const props = defineProps({
|
||||
user: {
|
||||
type: Object,
|
||||
required: true
|
||||
@@ -17,7 +18,9 @@ import { getDateMonthDay } from '../helpers/date_formats';
|
||||
|
||||
defineEmits(['set-user'])
|
||||
|
||||
const handleDelete = () => {
|
||||
const companyStore = useCompanyStore();
|
||||
|
||||
const handleDelete = async() => {
|
||||
Swal.fire({
|
||||
title: 'Eliminación de usuario!',
|
||||
text: '¿Estás seguro de eliminar este usuario?',
|
||||
@@ -36,25 +39,23 @@ import { getDateMonthDay } from '../helpers/date_formats';
|
||||
Swal.showLoading()
|
||||
},
|
||||
});
|
||||
let resp = 'success';
|
||||
const resp = await companyStore.deleteUserCompany(props.user._id)
|
||||
|
||||
setTimeout(() => {
|
||||
Swal.close()
|
||||
if(resp !== null) {
|
||||
Swal.fire({
|
||||
title: "Usuario eliminado!",
|
||||
text: "El usuario ha sido eliminado exitosamente.",
|
||||
icon: "success"
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: "No eliminado!",
|
||||
text: "El usuario no se pudo eliminar, intente más tarde.",
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
}, 5000)
|
||||
// const resp = await companyStore.deleteBudgetCompany(props.budget._id);
|
||||
Swal.close()
|
||||
|
||||
if(resp === 'success') {
|
||||
Swal.fire({
|
||||
title: "Usuario eliminado!",
|
||||
text: "El usuario ha sido eliminado exitosamente.",
|
||||
icon: "success"
|
||||
});
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: "No eliminado!",
|
||||
text: "El usuario no se pudo eliminar, intente más tarde.",
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
@@ -71,14 +72,24 @@ import { getDateMonthDay } from '../helpers/date_formats';
|
||||
<p><span>Teléfono 2: </span>{{user.phone2}}</p>
|
||||
<p><span>Email: </span>{{user.email}}</p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-sm-12">
|
||||
<p><span>Segmento: </span>{{user._categories}}</p>
|
||||
<div class="col-lg-6 col-sm-12" v-if="readonly">
|
||||
<p><span>Segmento: </span>{{user.categories?.map((e) => e.name).join(', ')}}</p>
|
||||
<p><span>Locaciones de carga por municipio: </span>{{user._user_city}}</p>
|
||||
<p><span>Locaciones de carga por estado: </span>{{user._user_state}}</p>
|
||||
<p v-if="user.company.truck_type"><span>Tipos de transporte que utiliza: </span> {{user._truck_types}}</p>
|
||||
<p v-if="user.company.truck_type"><span>Tipos de transporte que utiliza: </span> {{user._truck_type}}</p>
|
||||
<p ><span>Información adicional del usuario: </span> {{user.user_description}}</p>
|
||||
<p><span>Miembro desde: </span>{{getDateMonthDay(user.createdAt)}}</p>
|
||||
<p ><span>Tipo de afiliación: </span> {{user.company.membership}}</p>
|
||||
<p ><span>Miembro desde: </span>{{getDateMonthDay(user.createdAt)}}</p>
|
||||
<p v-if="readonly" ><span>Tipo de afiliación: </span> {{user.company.membership}}</p>
|
||||
<p><span>Rol del usuario: </span>{{user.job_role}}</p>
|
||||
</div>
|
||||
<div class="col-lg-6 col-sm-12" v-else>
|
||||
<p><span>Segmento: </span>{{user.categories?.map((e) => e.name).join(', ')}}</p>
|
||||
<p><span>Locaciones de carga por municipio: </span>{{user.user_city?.join(', ')}}</p>
|
||||
<p><span>Locaciones de carga por estado: </span>{{user.user_state?.join(', ')}}</p>
|
||||
<p v-if="user.truck_type"><span>Tipos de transporte que utiliza: </span> {{user.truck_type?.join(', ')}}</p>
|
||||
<p ><span>Información adicional del usuario: </span> {{user.user_description}}</p>
|
||||
<p ><span>Miembro desde: </span>{{getDateMonthDay(user.createdAt)}}</p>
|
||||
<p v-if="readonly" ><span>Tipo de afiliación: </span> {{user.company.membership}}</p>
|
||||
<p><span>Rol del usuario: </span>{{user.job_role}}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user