PR-CUSTOMER #186

Merged
jsegarra merged 105 commits from :PR-CUSTOMER into dev 2024-04-19 15:55:53 +00:00
2 changed files with 99 additions and 37 deletions
Showing only changes of commit 90ee50eab5 - Show all commits

View File

@ -1,57 +1,113 @@
<script setup>
import { reactive, ref } from 'vue';
import { onBeforeMount, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import FormModel from 'components/FormModel.vue';
import axios from 'axios';
import useNotify from 'src/composables/useNotify';
import VnInputDate from 'components/common/VnInputDate.vue';
import VnInput from 'src/components/common/VnInput.vue';
const { t } = useI18n();
const route = useRoute();
const { notify } = useNotify();
const unpaidClient = ref(false);
const initialData = reactive({
const isLoading = ref(false);
jsegarra marked this conversation as resolved Outdated

TODO, revisar si hay otra opción

TODO, revisar si hay otra opción

Modificado

Commit: 998561badd

Modificado Commit: https://gitea.verdnatura.es/verdnatura/salix-front/commit/998561badd40ba7f32a0265c9865a44dae284586
const amount = ref(null);
const dated = ref(null);
const initialData = ref({
dated: '2001-01-01T11:00:00.000Z',
clientFk: 1,
});
const onFetch = () => {
unpaidClient.value = true;
onBeforeMount(async () => {
try {
const { data } = await axios.get(`ClientUnpaids/${route.params.id}`);
amount.value = data.amount;
dated.value = data.dated;
initialData.value = data;
} catch (error) {
setInitialData();
}
});
const setInitialData = () => {
amount.value = initialData.value.amount;
dated.value = initialData.value.dated;
};
const onSubmit = async () => {

salix pone una fecha por defecto, emular comportamiento

salix pone una fecha por defecto, emular comportamiento

Corregido: 90ee50eab5

Corregido: 90ee50eab5

Lo veo OK

Lo veo OK
isLoading.value = true;
const payload = {
amount: amount.value,
clientFk: route.params.id,
dated: dated.value,
};
try {
await axios.patch('ClientUnpaids', payload);
jsegarra marked this conversation as resolved Outdated

Porque haces un find por id, si ya lo has hecho en la query/filter? Te devoilverá el resultado
Si filtras por 1101, te llegará [1101]

Porque haces un find por id, si ya lo has hecho en la query/filter? Te devoilverá el resultado Si filtras por 1101, te llegará [1101]

Corregido: 93015d9f98

Corregido: 93015d9f98
notify('globals.dataSaved', 'positive');
jsegarra marked this conversation as resolved Outdated

Mi propuesta es si data.length>0

Mi propuesta es si data.length>0

Corregido: 93015d9f98

Corregido: 93015d9f98
unpaidClient.value = true;
} catch (error) {
notify('errors.create', 'negative');
} finally {
isLoading.value = false;
}
};
</script>
<template>
<FormModel
:form-initial-data="initialData"
:observe-form-changes="true"
:url="`ClientUnpaids/${route.params.id}`"
@on-fetch="onFetch"
url-create="ClientUnpaids"
auto-load
>
<template #form="{ data }">
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox :label="t('Unpaid client')" v-model="unpaidClient" />
</div>
</VnRow>
<Teleport to="#st-actions">
<QBtnGroup push class="q-gutter-x-sm">
jsegarra marked this conversation as resolved Outdated

No se muestran los botones

No se muestran los botones

Los botones siempre estaban visibles, corregí que cuando habían datos no se estaban mostrando adecuadamente y no recargaba la data al cambiar manualmente la url: 7eca27b8af

Los botones siempre estaban visibles, corregí que cuando habían datos no se estaban mostrando adecuadamente y no recargaba la data al cambiar manualmente la url: 7eca27b8af
<QBtn
:disabled="isLoading"
:label="t('globals.reset')"
:loading="isLoading"
@click="setInitialData"
color="primary"
flat
icon="restart_alt"
type="reset"
/>
<QBtn
:disabled="isLoading"
:label="t('globals.save')"
:loading="isLoading"
@click="onSubmit"
color="primary"
icon="save"
/>
</QBtnGroup>
</Teleport>
<VnRow class="row q-gutter-md q-mb-md" v-if="unpaidClient">
<div class="col">
<VnInputDate :label="t('Date')" v-model="data.dated" />
</div>
<div class="col">
<VnInput
:label="t('Amount')"
clearable
type="number"
v-model="data.amount"
/>
</div>
</VnRow>
</template>
</FormModel>
<div class="full-width flex justify-center">
<QCard class="card-width q-pa-lg">
<QForm>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col">
<QCheckbox :label="t('Unpaid client')" v-model="unpaidClient" />
</div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md" v-if="unpaidClient">
<div class="col">
<VnInputDate :label="t('Date')" v-model="dated" />
</div>
<div class="col">
<VnInput
:label="t('Amount')"
clearable
type="number"
v-model="amount"
/>
</div>
</VnRow>
</QForm>
</QCard>
</div>
</template>
<i18n>

View File

@ -15,8 +15,8 @@ const $props = defineProps({
</script>
<template>
<QDialog ref="dialogRef">
<QCard class="q-pa-lg">
<QDialog ref="dialogRef" full-width>
<QCard class="dialog-width q-pa-lg">
<QCardSection>
<span ref="closeButton" class="row justify-end close-icon" v-close-popup>
<QIcon name="close" size="sm" />
@ -26,3 +26,9 @@ const $props = defineProps({
</QCard>
</QDialog>
</template>
<style lang="scss" scoped>
.dialog-width {
max-width: 900px !important;
}
</style>