Merge branch 'test' into Warmfix-SearchbarStyle
gitea/salix-front/pipeline/pr-test This commit looks good
Details
gitea/salix-front/pipeline/pr-test This commit looks good
Details
This commit is contained in:
commit
d5289c1405
|
@ -1,12 +1,13 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, useAttrs, nextTick } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { useState } from 'src/composables/useState';
|
||||||
|
|
||||||
import FormModel from 'components/FormModel.vue';
|
import FormModel from 'components/FormModel.vue';
|
||||||
|
|
||||||
const emit = defineEmits(['onDataSaved', 'onDataCanceled']);
|
const emit = defineEmits(['onDataSaved', 'onDataCanceled']);
|
||||||
|
|
||||||
defineProps({
|
const props = defineProps({
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
|
@ -22,12 +23,21 @@ defineProps({
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
const attrs = useAttrs();
|
||||||
|
const state = useState();
|
||||||
const formModelRef = ref(null);
|
const formModelRef = ref(null);
|
||||||
const closeButton = ref(null);
|
const closeButton = ref(null);
|
||||||
const isSaveAndContinue = ref(false);
|
const isSaveAndContinue = ref(props.showSaveAndContinueBtn);
|
||||||
const onDataSaved = (formData, requestResponse) => {
|
const isLoading = computed(() => formModelRef.value?.isLoading);
|
||||||
if (closeButton.value && !isSaveAndContinue.value) closeButton.value.click();
|
const reset = computed(() => formModelRef.value?.reset);
|
||||||
|
|
||||||
|
const onDataSaved = async (formData, requestResponse) => {
|
||||||
|
if (!isSaveAndContinue.value) closeButton.value?.click();
|
||||||
|
if (isSaveAndContinue.value) {
|
||||||
|
await nextTick();
|
||||||
|
state.set(attrs.model, attrs.formInitialData);
|
||||||
|
}
|
||||||
|
isSaveAndContinue.value = props.showSaveAndContinueBtn;
|
||||||
emit('onDataSaved', formData, requestResponse);
|
emit('onDataSaved', formData, requestResponse);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,9 +46,6 @@ const onClick = async (saveAndContinue) => {
|
||||||
await formModelRef.value.save();
|
await formModelRef.value.save();
|
||||||
};
|
};
|
||||||
|
|
||||||
const isLoading = computed(() => formModelRef.value?.isLoading);
|
|
||||||
const reset = computed(() => formModelRef.value?.reset);
|
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
isLoading,
|
isLoading,
|
||||||
onDataSaved,
|
onDataSaved,
|
||||||
|
@ -74,10 +81,7 @@ defineExpose({
|
||||||
data-cy="FormModelPopup_cancel"
|
data-cy="FormModelPopup_cancel"
|
||||||
v-close-popup
|
v-close-popup
|
||||||
z-max
|
z-max
|
||||||
@click="
|
@click="emit('onDataCanceled')"
|
||||||
isSaveAndContinue = false;
|
|
||||||
emit('onDataCanceled');
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
<QBtn
|
<QBtn
|
||||||
:flat="showSaveAndContinueBtn"
|
:flat="showSaveAndContinueBtn"
|
||||||
|
|
|
@ -961,14 +961,6 @@ function cardClick(_, row) {
|
||||||
transition-show="scale"
|
transition-show="scale"
|
||||||
transition-hide="scale"
|
transition-hide="scale"
|
||||||
:full-width="createComplement?.isFullWidth ?? false"
|
:full-width="createComplement?.isFullWidth ?? false"
|
||||||
@before-hide="
|
|
||||||
() => {
|
|
||||||
if (createRef.isSaveAndContinue) {
|
|
||||||
showForm = true;
|
|
||||||
createForm.formInitialData = { ...create.formInitialData };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"
|
|
||||||
data-cy="vn-table-create-dialog"
|
data-cy="vn-table-create-dialog"
|
||||||
>
|
>
|
||||||
<FormModelPopup
|
<FormModelPopup
|
||||||
|
|
|
@ -18,6 +18,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import CustomerSamplesPreview from 'src/pages/Customer/components/CustomerSamplesPreview.vue';
|
import CustomerSamplesPreview from 'src/pages/Customer/components/CustomerSamplesPreview.vue';
|
||||||
import FormPopup from 'src/components/FormPopup.vue';
|
import FormPopup from 'src/components/FormPopup.vue';
|
||||||
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
|
||||||
const { dialogRef, onDialogOK } = useDialogPluginComponent();
|
const { dialogRef, onDialogOK } = useDialogPluginComponent();
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ const optionsSamplesVisible = ref([]);
|
||||||
const sampleType = ref({ hasPreview: false });
|
const sampleType = ref({ hasPreview: false });
|
||||||
const initialData = reactive({});
|
const initialData = reactive({});
|
||||||
const entityId = computed(() => route.params.id);
|
const entityId = computed(() => route.params.id);
|
||||||
const customer = computed(() => state.get('Customer'));
|
const customer = computed(() => useArrayData('Customer').store?.data);
|
||||||
const filterEmailUsers = { where: { userFk: user.value.id } };
|
const filterEmailUsers = { where: { userFk: user.value.id } };
|
||||||
const filterClientsAddresses = {
|
const filterClientsAddresses = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -65,9 +66,9 @@ const filterSamplesVisible = {
|
||||||
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
defineEmits(['confirm', ...useDialogPluginComponent.emits]);
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
initialData.clientFk = customer.value.id;
|
initialData.clientFk = customer.value?.id;
|
||||||
initialData.recipient = customer.value.email;
|
initialData.recipient = customer.value?.email;
|
||||||
initialData.recipientId = customer.value.id;
|
initialData.recipientId = customer.value?.id;
|
||||||
});
|
});
|
||||||
|
|
||||||
const setEmailUser = (data) => {
|
const setEmailUser = (data) => {
|
||||||
|
|
Loading…
Reference in New Issue