Summaries have now a dialog component
gitea/salix-front/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2022-11-08 14:43:04 +01:00
parent 50486990dd
commit d28b9f187c
6 changed files with 68 additions and 46 deletions

View File

@ -12,13 +12,13 @@ const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const $props = defineProps({ const $props = defineProps({
claimId: { id: {
type: Number, type: Number,
default: 0, default: 0,
}, },
}); });
const entityId = computed(() => $props.claimId || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const claim = ref(null); const claim = ref(null);
const salesClaimed = ref(null); const salesClaimed = ref(null);

View File

@ -0,0 +1,21 @@
<script setup>
import { useDialogPluginComponent } from 'quasar';
import ClaimSummary from './ClaimSummary.vue';
const $props = defineProps({
id: {
type: Number,
required: true,
},
});
defineEmits([...useDialogPluginComponent.emits]);
const { dialogRef, onDialogHide } = useDialogPluginComponent();
</script>
<template>
<q-dialog ref="dialogRef" @hide="onDialogHide">
<claim-summary v-if="$props.id" :id="$props.id" />
</q-dialog>
</template>

View File

@ -1,15 +1,14 @@
<script setup> <script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
// import { useQuasar } from 'quasar'; import { useQuasar } from 'quasar';
import Paginate from 'src/components/Paginate.vue'; import Paginate from 'src/components/Paginate.vue';
import { toDate } from 'src/filters/index'; import { toDate } from 'src/filters/index';
import ClaimSummary from './Card/ClaimSummary.vue'; import ClaimSummaryDialog from './Card/ClaimSummaryDialog.vue';
import CustomerDescriptorPopover from 'src/pages/Customer/Card/CustomerDescriptorPopover.vue'; import CustomerDescriptorPopover from 'src/pages/Customer/Card/CustomerDescriptorPopover.vue';
const router = useRouter(); const router = useRouter();
// const quasar = useQuasar(); const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
const filter = { const filter = {
@ -39,26 +38,14 @@ function navigate(id) {
router.push({ path: `/claim/${id}` }); router.push({ path: `/claim/${id}` });
} }
const preview = ref({ function viewSummary(id) {
shown: false, quasar.dialog({
}); component: ClaimSummaryDialog,
componentProps: {
function showPreview(id) { id,
preview.value.shown = true; },
preview.value.data = { });
claimId: id,
};
} }
// function showPopover($event, customer) {
// $event.preventDefault();
// quasar.dialog({
// component: CustomerDescriptorPopover,
// componentProps: {
// customer: customer,
// },
// });
// }
</script> </script>
<template> <template>
@ -127,7 +114,7 @@ function showPreview(id) {
<q-btn flat round color="orange" icon="arrow_circle_right" @click="navigate(row.id)"> <q-btn flat round color="orange" icon="arrow_circle_right" @click="navigate(row.id)">
<q-tooltip>{{ t('components.smartCard.openCard') }}</q-tooltip> <q-tooltip>{{ t('components.smartCard.openCard') }}</q-tooltip>
</q-btn> </q-btn>
<q-btn flat round color="grey-7" icon="preview" @click="showPreview(row.id)"> <q-btn flat round color="grey-7" icon="preview" @click="viewSummary(row.id)">
<q-tooltip>{{ t('components.smartCard.openSummary') }}</q-tooltip> <q-tooltip>{{ t('components.smartCard.openSummary') }}</q-tooltip>
</q-btn> </q-btn>
<q-btn flat round color="grey-7" icon="vn:client"> <q-btn flat round color="grey-7" icon="vn:client">
@ -142,7 +129,4 @@ function showPreview(id) {
</template> </template>
</paginate> </paginate>
</q-page> </q-page>
<q-dialog v-model="preview.shown">
<claim-summary :claim-id="preview.data.claimId" />
</q-dialog>
</template> </template>

View File

@ -12,13 +12,13 @@ const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
const $props = defineProps({ const $props = defineProps({
customerId: { id: {
type: Number, type: Number,
default: 0, default: 0,
}, },
}); });
const entityId = computed(() => $props.customerId || route.params.id); const entityId = computed(() => $props.id || route.params.id);
const customer = ref(null); const customer = ref(null);
function fetch() { function fetch() {

View File

@ -0,0 +1,21 @@
<script setup>
import { useDialogPluginComponent } from 'quasar';
import CustomerSummary from './CustomerSummary.vue';
const $props = defineProps({
id: {
type: Number,
required: true,
},
});
defineEmits([...useDialogPluginComponent.emits]);
const { dialogRef, onDialogHide } = useDialogPluginComponent();
</script>
<template>
<q-dialog ref="dialogRef" @hide="onDialogHide">
<customer-summary v-if="$props.id" :id="$props.id" />
</q-dialog>
</template>

View File

@ -1,26 +1,25 @@
<script setup> <script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { useQuasar } from 'quasar';
import Paginate from 'src/components/Paginate.vue'; import Paginate from 'src/components/Paginate.vue';
import CustomerSummary from './Card/CustomerSummary.vue'; import CustomerSummaryDialog from './Card/CustomerSummaryDialog.vue';
const router = useRouter(); const router = useRouter();
const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
function navigate(id) { function navigate(id) {
router.push({ path: `/customer/${id}` }); router.push({ path: `/customer/${id}` });
} }
const preview = ref({ function viewSummary(id) {
shown: false, quasar.dialog({
}); component: CustomerSummaryDialog,
componentProps: {
function showPreview(id) { id,
preview.value.shown = true; },
preview.value.data = { });
customerId: id,
};
} }
</script> </script>
@ -73,7 +72,7 @@ function showPreview(id) {
<q-btn flat round color="orange" icon="arrow_circle_right" @click="navigate(row.id)"> <q-btn flat round color="orange" icon="arrow_circle_right" @click="navigate(row.id)">
<q-tooltip>{{ t('components.smartCard.openCard') }}</q-tooltip> <q-tooltip>{{ t('components.smartCard.openCard') }}</q-tooltip>
</q-btn> </q-btn>
<q-btn flat round color="grey-7" icon="preview" @click="showPreview(row.id)"> <q-btn flat round color="grey-7" icon="preview" @click="viewSummary(row.id)">
<q-tooltip>{{ t('components.smartCard.openSummary') }}</q-tooltip> <q-tooltip>{{ t('components.smartCard.openSummary') }}</q-tooltip>
</q-btn> </q-btn>
<!-- <q-btn flat round color="grey-7" icon="vn:ticket"> <!-- <q-btn flat round color="grey-7" icon="vn:ticket">
@ -85,7 +84,4 @@ function showPreview(id) {
</template> </template>
</paginate> </paginate>
</q-page> </q-page>
<q-dialog v-model="preview.shown">
<customer-summary :customer-id="preview.data.customerId" />
</q-dialog>
</template> </template>