Solucion a comentarios 23
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
gitea/salix-front/pipeline/pr-dev There was a failure building this commit
Details
This commit is contained in:
parent
efb676e4a4
commit
7eca27b8af
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { onBeforeMount, ref } from 'vue';
|
||||
import { computed, onBeforeMount, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
|
@ -14,25 +14,47 @@ const { t } = useI18n();
|
|||
const route = useRoute();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const initialDated = '2001-01-01T11:00:00.000Z';
|
||||
const unpaidClient = ref(false);
|
||||
const isLoading = ref(false);
|
||||
const amount = ref(null);
|
||||
const dated = ref(null);
|
||||
const dated = ref(initialDated);
|
||||
|
||||
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 {
|
||||
const { data } = await axios.get(`ClientUnpaids/${route.params.id}`);
|
||||
const { data } = await axios.get(`ClientUnpaids/${id}`);
|
||||
unpaidClient.value = true;
|
||||
amount.value = data.amount;
|
||||
dated.value = data.dated;
|
||||
initialData.value = data;
|
||||
} catch (error) {
|
||||
unpaidClient.value = false;
|
||||
initialData.value.amount = null;
|
||||
setInitialData();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const setInitialData = () => {
|
||||
amount.value = initialData.value.amount;
|
||||
|
@ -63,7 +85,7 @@ const onSubmit = async () => {
|
|||
<Teleport to="#st-actions">
|
||||
<QBtnGroup push class="q-gutter-x-sm">
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:disabled="!hasChanged"
|
||||
:label="t('globals.reset')"
|
||||
:loading="isLoading"
|
||||
@click="setInitialData"
|
||||
|
@ -73,7 +95,7 @@ const onSubmit = async () => {
|
|||
type="reset"
|
||||
/>
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:disabled="!hasChanged"
|
||||
:label="t('globals.save')"
|
||||
:loading="isLoading"
|
||||
@click="onSubmit"
|
||||
|
|
|
@ -182,9 +182,6 @@ const toCustomerAddress = () => {
|
|||
</template>
|
||||
</VnSelectFilter>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('Province')"
|
||||
|
@ -206,6 +203,9 @@ const toCustomerAddress = () => {
|
|||
</template>
|
||||
</VnSelectFilter>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('Agency')"
|
||||
|
@ -217,9 +217,6 @@ const toCustomerAddress = () => {
|
|||
v-model="data.agencyModeFk"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnInput :label="t('Phone')" clearable v-model="data.phone" />
|
||||
</div>
|
||||
|
|
|
@ -193,11 +193,7 @@ const toCustomerAddress = () => {
|
|||
<VnInput :label="t('Consignee')" clearable v-model="data.nickname" />
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('Street address')"
|
||||
clearable
|
||||
v-model="data.street"
|
||||
/>
|
||||
<VnInput :label="t('Street')" clearable v-model="data.street" />
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
|
@ -234,7 +230,6 @@ const toCustomerAddress = () => {
|
|||
</VnSelectDialog>
|
||||
</div>
|
||||
<div class="col">
|
||||
<!-- ciudades -->
|
||||
<VnSelectFilter
|
||||
:label="t('City')"
|
||||
:options="citiesLocationOptions"
|
||||
|
@ -258,9 +253,6 @@ const toCustomerAddress = () => {
|
|||
</template>
|
||||
</VnSelectFilter>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('Province')"
|
||||
|
@ -282,6 +274,9 @@ const toCustomerAddress = () => {
|
|||
</template>
|
||||
</VnSelectFilter>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelectFilter
|
||||
:label="t('Agency')"
|
||||
|
@ -293,9 +288,6 @@ const toCustomerAddress = () => {
|
|||
v-model="data.agencyModeFk"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnInput :label="t('Phone')" clearable v-model="data.phone" />
|
||||
</div>
|
||||
|
@ -397,7 +389,7 @@ es:
|
|||
Is equalizated: Recargo de equivalencia
|
||||
Is Loginflora allowed: Compra directa en Holanda
|
||||
Consignee: Consignatario
|
||||
Street address: Dirección postal
|
||||
Street: Dirección fiscal
|
||||
Postcode: Código postal
|
||||
City: Población
|
||||
Province: Provincia
|
||||
|
|
Loading…
Reference in New Issue