Finish create manual invoice popup form
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
William Buezas 2024-03-08 15:05:11 -03:00
parent 0e79676f58
commit ed99aea4a3
4 changed files with 42 additions and 11 deletions

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { reactive, ref } from 'vue'; import { reactive, ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@ -19,15 +19,17 @@ const manualInvoiceFormData = reactive({
maxShipped: Date.vnNew(), maxShipped: Date.vnNew(),
}); });
const isInvoicing = ref(false); const formModelPopupRef = ref();
const invoiceOutSerialsOptions = ref([]); const invoiceOutSerialsOptions = ref([]);
const taxAreasOptions = ref([]); const taxAreasOptions = ref([]);
const ticketsOptions = ref([]); const ticketsOptions = ref([]);
const clientsOptions = ref([]); const clientsOptions = ref([]);
const isLoading = computed(() => formModelPopupRef.value?.isLoading);
const onDataSaved = (formData, requestResponse) => { const onDataSaved = async (formData, requestResponse) => {
emit('onDataSaved', formData, requestResponse); emit('onDataSaved', formData, requestResponse);
router.push({ name: 'InvoiceOutSummary', params: { id: requestResponse.id } }); if (requestResponse && requestResponse.id)
router.push({ name: 'InvoiceOutSummary', params: { id: requestResponse.id } });
}; };
</script> </script>
@ -57,6 +59,7 @@ const onDataSaved = (formData, requestResponse) => {
auto-load auto-load
/> />
<FormModelPopup <FormModelPopup
ref="formModelPopupRef"
:title="t('Create manual invoice')" :title="t('Create manual invoice')"
url-create="InvoiceOuts/createManualInvoice" url-create="InvoiceOuts/createManualInvoice"
model="invoiceOut" model="invoiceOut"
@ -64,6 +67,10 @@ const onDataSaved = (formData, requestResponse) => {
@on-data-saved="onDataSaved" @on-data-saved="onDataSaved"
> >
<template #form-inputs="{ data }"> <template #form-inputs="{ data }">
<span v-if="isLoading" class="text-primary invoicing-text">
<QIcon name="warning" class="fill-icon q-mr-sm" size="md" />
{{ t('Invoicing in progress...') }}
</span>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<VnSelectFilter <VnSelectFilter
@ -142,6 +149,17 @@ const onDataSaved = (formData, requestResponse) => {
</FormModelPopup> </FormModelPopup>
</template> </template>
<style lang="scss" scoped>
.invoicing-text {
display: flex;
justify-content: center;
align-items: center;
color: $primary;
font-size: 24px;
margin-bottom: 8px;
}
</style>
<i18n> <i18n>
es: es:
Create manual invoice: Crear factura manual Create manual invoice: Crear factura manual
@ -152,4 +170,5 @@ es:
Area: Area Area: Area
Reference: Referencia Reference: Referencia
Or: O Or: O
Invoicing in progress...: Facturación en progreso...
</i18n> </i18n>

View File

@ -69,10 +69,6 @@ const $props = defineProps({
const emit = defineEmits(['onFetch', 'onDataSaved']); const emit = defineEmits(['onFetch', 'onDataSaved']);
defineExpose({
save,
});
const componentIsRendered = ref(false); const componentIsRendered = ref(false);
onMounted(async () => { onMounted(async () => {
@ -205,6 +201,11 @@ watch(formUrl, async () => {
reset(); reset();
fetch(); fetch();
}); });
defineExpose({
save,
isLoading,
});
</script> </script>
<template> <template>
<div class="column items-center full-width"> <div class="column items-center full-width">

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref, computed } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
@ -39,21 +39,28 @@ const $props = defineProps({
const { t } = useI18n(); const { t } = useI18n();
const formModelRef = ref(null);
const closeButton = ref(null); const closeButton = ref(null);
const isLoading = ref(false);
const onDataSaved = (formData, requestResponse) => { const onDataSaved = (formData, requestResponse) => {
emit('onDataSaved', formData, requestResponse); emit('onDataSaved', formData, requestResponse);
closeForm(); closeForm();
}; };
const closeForm = () => { const isLoading = computed(() => formModelRef.value?.isLoading);
const closeForm = async () => {
if (closeButton.value) closeButton.value.click(); if (closeButton.value) closeButton.value.click();
}; };
defineExpose({
isLoading,
});
</script> </script>
<template> <template>
<FormModel <FormModel
ref="formModelRef"
:form-initial-data="formInitialData" :form-initial-data="formInitialData"
:observe-form-changes="false" :observe-form-changes="false"
:default-actions="false" :default-actions="false"

View File

@ -97,6 +97,10 @@ select:-webkit-autofill {
background-color: var(--vn-light-gray); background-color: var(--vn-light-gray);
} }
.fill-icon {
font-variation-settings: 'FILL' 1;
}
/* Estilo para el asterisco en campos requeridos */ /* Estilo para el asterisco en campos requeridos */
.q-field.required .q-field__label:after { .q-field.required .q-field__label:after {
content: ' *'; content: ' *';