Solucion a comentarios 13
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
carlosfonseca 2024-02-19 05:24:26 -05:00
parent d0cf13d0af
commit bb10714824
4 changed files with 28 additions and 27 deletions

View File

@ -231,7 +231,7 @@ export default {
businessType: 'Tipo de negocio',
contact: 'Contacto',
youCanSaveMultipleEmails:
'Puedeguardar varios correos electrónicos encadenandolos mediante comas sin espacios, ejemplo: user@dominio.com,user2@dominio.com siendo el primer correo electrónico el principal',
'Puede guardar varios correos electrónicos encadenandolos mediante comas sin espacios, ejemplo: user@dominio.com,user2@dominio.com siendo el primer correo electrónico el principal',
email: 'Email',
phone: 'Teléfono',
mobile: 'Móvil',

View File

@ -1,5 +1,5 @@
<script setup>
import { onBeforeMount, reactive, ref } from 'vue';
import { onBeforeMount, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
@ -14,10 +14,9 @@ const { t } = useI18n();
const route = useRoute();
const { notify } = useNotify();
let notes = reactive([]);
let deletes = reactive([]);
const isLoading = ref(false);
let notes = ref([]);
let deletes = ref([]);
onBeforeMount(() => {
getData();
@ -31,7 +30,7 @@ const getData = async () => {
const { data } = await axios.get('ClientContacts', {
params: { filter: JSON.stringify(filter) },
});
notes.length = 0;
notes.value.length = 0;
data.forEach((element) => {
element.isNew = false;
addNote(element);
@ -39,33 +38,36 @@ const getData = async () => {
};
const addNote = ({ id, name, phone, isNew }) => {
if (!notes.some((note) => note.id === id)) {
notes.push({
id,
$isNew: isNew,
name,
phone,
$oldData: null,
$orgIndex: null,
clientFk: route.params.id,
});
}
notes.value.push({
id,
$isNew: isNew,
name,
phone,
$oldData: null,
$orgIndex: null,
clientFk: Number(route.params.id),
});
};
const deleteNote = (note, index) => {
deletes.push(note.id);
notes.splice(index, 1);
deletes.value.push(note.id);
notes.value.splice(index, 1);
};
const onSubmit = async () => {
isLoading.value = true;
const payload = {
creates: notes.filter((element) => element.$isNew) || null,
deletes: deletes || null,
};
let payload = {};
const creates = notes.value.filter((element) => element.$isNew);
if (creates.length) {
payload.creates = creates;
}
if (deletes.value.length) {
payload.deletes = deletes.value;
}
try {
await axios.post('ClientContacts/crud', payload);
notes = [];
notes.value = [];
deletes.value = [];
notify('globals.dataCreated', 'positive');
await getData();
} catch (error) {

View File

@ -115,7 +115,7 @@ const refreshData = () => {
>
<template #body-cell="props">
<QTd :props="props">
<QTr :props="props" class="cursor-pointer">
<QTr :props="props">
<component
:is="tableColumnComponents[props.col.name].component"
@click="tableColumnComponents[props.col.name].event(props)"

View File

@ -31,7 +31,6 @@ const setClientsConfirmTransaction = async () => {
<div v-if="!$props?.transaction?.isConfirmed">
<QIcon
@click.stop="setClientsConfirmTransaction"
class="cursor-pointer"
color="primary"
name="check"
size="sm"
@ -43,5 +42,5 @@ const setClientsConfirmTransaction = async () => {
<i18n>
es:
Confirm transaction: Transacción confirmada
Confirm transaction: Confirmar transacción
</i18n>