0
0
Fork 0

Use dialog plugin

This commit is contained in:
Joan Sanchez 2022-12-13 12:45:39 +01:00
parent e35c11d714
commit c949adfd83
4 changed files with 56 additions and 15 deletions

View File

@ -19,3 +19,11 @@ const { dialogRef, onDialogHide } = useDialogPluginComponent();
<claim-summary v-if="$props.id" :id="$props.id" /> <claim-summary v-if="$props.id" :id="$props.id" />
</q-dialog> </q-dialog>
</template> </template>
<style lang="scss">
.q-dialog .summary .header {
position: sticky;
z-index: $z-max;
top: 0;
}
</style>

View File

@ -19,3 +19,11 @@ const { dialogRef, onDialogHide } = useDialogPluginComponent();
<customer-summary v-if="$props.id" :id="$props.id" /> <customer-summary v-if="$props.id" :id="$props.id" />
</q-dialog> </q-dialog>
</template> </template>
<style lang="scss">
.q-dialog .summary .header {
position: sticky;
z-index: $z-max;
top: 0;
}
</style>

View File

@ -0,0 +1,29 @@
<script setup>
import { useDialogPluginComponent } from 'quasar';
import TicketSummary from './TicketSummary.vue';
const $props = defineProps({
id: {
type: Number,
required: true,
},
});
defineEmits([...useDialogPluginComponent.emits]);
const { dialogRef, onDialogHide } = useDialogPluginComponent();
</script>
<template>
<q-dialog ref="dialogRef" @hide="onDialogHide">
<ticket-summary v-if="$props.id" :id="$props.id" />
</q-dialog>
</template>
<style lang="scss">
.q-dialog .summary .header {
position: sticky;
z-index: $z-max;
top: 0;
}
</style>

View File

@ -1,12 +1,13 @@
<script setup> <script setup>
import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import Paginate from 'components/Paginate.vue'; import Paginate from 'components/Paginate.vue';
import { toDate, toCurrency } from 'src/filters/index'; import { toDate, toCurrency } from 'src/filters/index';
import TicketSummary from './Card/TicketSummary.vue'; import TicketSummaryDialog from './Card/TicketSummaryDialog.vue';
const router = useRouter(); const router = useRouter();
const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
const filter = { const filter = {
@ -48,15 +49,13 @@ function navigate(id) {
router.push({ path: `/ticket/${id}` }); router.push({ path: `/ticket/${id}` });
} }
const preview = ref({ function viewSummary(id) {
shown: false, quasar.dialog({
component: TicketSummaryDialog,
componentProps: {
id,
},
}); });
function showPreview(id) {
preview.value.shown = true;
preview.value.data = {
ticketId: id,
};
} }
</script> </script>
@ -111,7 +110,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-card-actions> </q-card-actions>
@ -120,7 +119,4 @@ function showPreview(id) {
</template> </template>
</paginate> </paginate>
</q-page> </q-page>
<q-dialog v-model="preview.shown">
<ticket-summary :id="preview.data.ticketId" />
</q-dialog>
</template> </template>