0
0
Fork 0

Solucion a comentarios 19

This commit is contained in:
carlosfonseca 2024-02-22 13:49:06 -05:00
parent 9ae0874ccf
commit 2c70a73b8e
5 changed files with 27 additions and 14 deletions

View File

@ -67,7 +67,7 @@ body.body--dark {
}
.card-width {
width: 800px;
width: 770px;
}
.vn-card-list {

View File

@ -6,7 +6,6 @@ import { useRoute, useRouter } from 'vue-router';
import axios from 'axios';
import FetchData from 'components/FetchData.vue';
import VnPaginate from 'src/components/ui/VnPaginate.vue';
const { t } = useI18n();
const route = useRoute();

View File

@ -46,11 +46,11 @@ onMounted(() => {
</div>
<div class="col-1 row justify-center items-center">
<QIcon
name="delete"
size="sm"
@click="customerContactsRef.remove([row])"
class="cursor-pointer"
color="primary"
@click="customerContactsRef.remove([row])"
name="delete"
size="sm"
>
<QTooltip>
{{ t('Remove contact') }}
@ -60,11 +60,11 @@ onMounted(() => {
</VnRow>
<VnRow>
<QIcon
name="add"
size="sm"
@click="customerContactsRef.insert()"
class="cursor-pointer"
color="primary"
@click="customerContactsRef.insert()"
name="add"
size="sm"
>
<QTooltip>
{{ t('Add contact') }}

View File

@ -126,7 +126,7 @@ const columns = computed(() => [
</template>
</FormModel>
<div class="full-width flex justify-center">
<div class="full-width flex justify-center" v-if="rows.length">
<QTable
:columns="columns"
:pagination="{ rowsPerPage: 0 }"
@ -156,6 +156,10 @@ const columns = computed(() => [
</template>
</QTable>
</div>
<h5 class="flex justify-center color-vn-label" v-else>
{{ t('globals.noResults') }}
</h5>
</template>
<i18n>

View File

@ -30,6 +30,7 @@ const incoterms = ref([]);
const customsAgents = ref([]);
const observationTypes = ref([]);
const notes = ref([]);
const deletes = ref([]);
onBeforeMount(() => {
urlUpdate.value = `Clients/${route.params.id}/updateAddress/${route.params.addressId}`;
@ -68,6 +69,7 @@ const getData = async (observations) => {
$orgIndex: null,
addressFk: `${route.params.addressId}`,
description: observation.description,
id: observation.id,
observationTypeFk: type.id,
}
: null;
@ -88,15 +90,23 @@ const addNote = () => {
});
};
const deleteNote = (index) => {
const deleteNote = (id, index) => {
deletes.value.push(id);
notes.value.splice(index, 1);
};
const onDataSaved = async () => {
const payload = {
creates: notes.value,
};
let payload = {};
const creates = notes.value.filter((note) => note.$isNew);
if (creates.length) {
payload.creates = creates;
}
if (deletes.value.length) {
payload.deletes = deletes.value;
}
await axios.post('AddressObservations/crud', payload);
notes.value = [];
deletes.value = [];
toCustomerAddress();
};
@ -347,7 +357,7 @@ const toCustomerAddress = () => {
</div>
<div class="flex items-center">
<QIcon
@click.stop="deleteNote(index)"
@click.stop="deleteNote(note.id, index)"
class="cursor-pointer"
color="primary"
name="delete"