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

This commit is contained in:
carlosfonseca 2024-02-26 09:58:38 -05:00
parent efb676e4a4
commit 7eca27b8af
3 changed files with 38 additions and 27 deletions

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { onBeforeMount, ref } from 'vue'; import { computed, onBeforeMount, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@ -14,25 +14,47 @@ const { t } = useI18n();
const route = useRoute(); const route = useRoute();
const { notify } = useNotify(); const { notify } = useNotify();
const initialDated = '2001-01-01T11:00:00.000Z';
const unpaidClient = ref(false); const unpaidClient = ref(false);
const isLoading = ref(false); const isLoading = ref(false);
const amount = ref(null); const amount = ref(null);
const dated = ref(null); const dated = ref(initialDated);
const initialData = ref({ const initialData = ref({
dated: '2001-01-01T11:00:00.000Z', dated: initialDated,
}); });
onBeforeMount(async () => { const hasChanged = computed(() => {
return (
initialData.value.dated !== dated.value ||
initialData.value.amount !== amount.value
);
});
onBeforeMount(() => {
getData(route.params.id);
});
watch(
() => route.params.id,
(newValue) => {
getData(newValue);
}
);
const getData = async (id) => {
try { try {
const { data } = await axios.get(`ClientUnpaids/${route.params.id}`); const { data } = await axios.get(`ClientUnpaids/${id}`);
unpaidClient.value = true;
amount.value = data.amount; amount.value = data.amount;
dated.value = data.dated; dated.value = data.dated;
initialData.value = data; initialData.value = data;
} catch (error) { } catch (error) {
unpaidClient.value = false;
initialData.value.amount = null;
setInitialData(); setInitialData();
} }
}); };
const setInitialData = () => { const setInitialData = () => {
amount.value = initialData.value.amount; amount.value = initialData.value.amount;
@ -63,7 +85,7 @@ const onSubmit = async () => {
<Teleport to="#st-actions"> <Teleport to="#st-actions">
<QBtnGroup push class="q-gutter-x-sm"> <QBtnGroup push class="q-gutter-x-sm">
<QBtn <QBtn
:disabled="isLoading" :disabled="!hasChanged"
:label="t('globals.reset')" :label="t('globals.reset')"
:loading="isLoading" :loading="isLoading"
@click="setInitialData" @click="setInitialData"
@ -73,7 +95,7 @@ const onSubmit = async () => {
type="reset" type="reset"
/> />
<QBtn <QBtn
:disabled="isLoading" :disabled="!hasChanged"
:label="t('globals.save')" :label="t('globals.save')"
:loading="isLoading" :loading="isLoading"
@click="onSubmit" @click="onSubmit"

View File

@ -182,9 +182,6 @@ const toCustomerAddress = () => {
</template> </template>
</VnSelectFilter> </VnSelectFilter>
</div> </div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnSelectFilter <VnSelectFilter
:label="t('Province')" :label="t('Province')"
@ -206,6 +203,9 @@ const toCustomerAddress = () => {
</template> </template>
</VnSelectFilter> </VnSelectFilter>
</div> </div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnSelectFilter <VnSelectFilter
:label="t('Agency')" :label="t('Agency')"
@ -217,9 +217,6 @@ const toCustomerAddress = () => {
v-model="data.agencyModeFk" v-model="data.agencyModeFk"
/> />
</div> </div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnInput :label="t('Phone')" clearable v-model="data.phone" /> <VnInput :label="t('Phone')" clearable v-model="data.phone" />
</div> </div>

View File

@ -193,11 +193,7 @@ const toCustomerAddress = () => {
<VnInput :label="t('Consignee')" clearable v-model="data.nickname" /> <VnInput :label="t('Consignee')" clearable v-model="data.nickname" />
</div> </div>
<div class="col"> <div class="col">
<VnInput <VnInput :label="t('Street')" clearable v-model="data.street" />
:label="t('Street address')"
clearable
v-model="data.street"
/>
</div> </div>
</VnRow> </VnRow>
@ -234,7 +230,6 @@ const toCustomerAddress = () => {
</VnSelectDialog> </VnSelectDialog>
</div> </div>
<div class="col"> <div class="col">
<!-- ciudades -->
<VnSelectFilter <VnSelectFilter
:label="t('City')" :label="t('City')"
:options="citiesLocationOptions" :options="citiesLocationOptions"
@ -258,9 +253,6 @@ const toCustomerAddress = () => {
</template> </template>
</VnSelectFilter> </VnSelectFilter>
</div> </div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnSelectFilter <VnSelectFilter
:label="t('Province')" :label="t('Province')"
@ -282,6 +274,9 @@ const toCustomerAddress = () => {
</template> </template>
</VnSelectFilter> </VnSelectFilter>
</div> </div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnSelectFilter <VnSelectFilter
:label="t('Agency')" :label="t('Agency')"
@ -293,9 +288,6 @@ const toCustomerAddress = () => {
v-model="data.agencyModeFk" v-model="data.agencyModeFk"
/> />
</div> </div>
</VnRow>
<VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnInput :label="t('Phone')" clearable v-model="data.phone" /> <VnInput :label="t('Phone')" clearable v-model="data.phone" />
</div> </div>
@ -397,7 +389,7 @@ es:
Is equalizated: Recargo de equivalencia Is equalizated: Recargo de equivalencia
Is Loginflora allowed: Compra directa en Holanda Is Loginflora allowed: Compra directa en Holanda
Consignee: Consignatario Consignee: Consignatario
Street address: Dirección postal Street: Dirección fiscal
Postcode: Código postal Postcode: Código postal
City: Población City: Población
Province: Provincia Province: Provincia