0
0
Fork 0

refactor: requested changes

This commit is contained in:
Jon Elias 2024-10-10 08:26:16 +02:00
parent 27dca7c35f
commit 2dd3e09928
7 changed files with 111 additions and 52 deletions

View File

@ -0,0 +1,33 @@
<script setup>
import { useRoute } from 'vue-router';
import { defineProps } from 'vue';
const props = defineProps({
routeName: {
type: String,
required: true,
},
entityId: {
type: [String, Number],
required: true,
},
url: {
type: String,
default: null,
},
});
const route = useRoute();
const id = props.entityId;
</script>
<template>
<router-link
v-if="route?.name !== routeName"
:to="{ name: routeName, params: { id: id } }"
class="header link"
:href="url"
>
<QIcon name="open_in_new" color="white" size="sm" />
</router-link>
</template>

View File

@ -0,0 +1,55 @@
<script setup>
import { defineProps, ref } from 'vue';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const props = defineProps({
usesMana: {
type: Boolean,
required: true,
},
manaCode: {
type: String,
required: true,
},
manaVal: {
type: String,
default: 'mana',
},
manaLabel: {
type: String,
default: 'Promotion mana',
},
manaClaimVal: {
type: String,
default: 'manaClaim',
},
claimLabel: {
type: String,
default: 'Claim mana',
},
});
const manaCode = ref(props.manaCode);
</script>
<template>
<div class="column q-gutter-y-sm q-mt-sm">
<QRadio
v-model="manaCode"
dense
:val="manaVal"
:label="t(manaLabel)"
:dark="true"
class="q-mb-sm"
/>
<QRadio
v-model="manaCode"
dense
:val="manaClaimVal"
:label="t(claimLabel)"
:dark="true"
class="q-mb-sm"
/>
</div>
</template>

View File

@ -11,6 +11,7 @@ import { toDate, toCurrency } from 'src/filters';
import { getUrl } from 'src/composables/getUrl'; import { getUrl } from 'src/composables/getUrl';
import axios from 'axios'; import axios from 'axios';
import FetchedTags from 'src/components/ui/FetchedTags.vue'; import FetchedTags from 'src/components/ui/FetchedTags.vue';
import VnToSummary from 'src/components/ui/VnToSummary.vue';
const route = useRoute(); const route = useRoute();
const { t } = useI18n(); const { t } = useI18n();
@ -163,14 +164,12 @@ const fetchEntryBuys = async () => {
data-key="EntrySummary" data-key="EntrySummary"
> >
<template #header-left> <template #header-left>
<router-link <VnToSummary
v-if="route?.name !== 'EntrySummary'" v-if="route?.name !== 'EntrySummary'"
:to="{ name: 'EntrySummary', params: { id: entityId } }" :route-name="'EntrySummary'"
class="header link" :entity-id="entityId"
:href="entryUrl" :url="entryUrl"
> />
<QIcon name="open_in_new" color="white" size="sm" />
</router-link>
</template> </template>
<template #header> <template #header>
<span>{{ entry.id }} - {{ entry.supplier.nickname }}</span> <span>{{ entry.id }} - {{ entry.supplier.nickname }}</span>

View File

@ -6,6 +6,7 @@ import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.v
import CardSummary from 'components/ui/CardSummary.vue'; import CardSummary from 'components/ui/CardSummary.vue';
import VnLv from 'src/components/ui/VnLv.vue'; import VnLv from 'src/components/ui/VnLv.vue';
import VnToSummary from 'src/components/ui/VnToSummary.vue';
onUpdated(() => summaryRef.value.fetch()); onUpdated(() => summaryRef.value.fetch());
@ -55,6 +56,11 @@ async function setItemTypeData(data) {
> >
<QIcon name="open_in_new" color="white" size="sm" /> <QIcon name="open_in_new" color="white" size="sm" />
</router-link> </router-link>
<VnToSummary
v-if="route?.name !== 'ItemTypeSummary'"
:route-name="'ItemTypeSummary'"
:entity-id="entityId"
/>
</template> </template>
<template #header> <template #header>
<span> <span>

View File

@ -1,8 +1,8 @@
<script setup> <script setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { toCurrency } from 'src/filters'; import { toCurrency } from 'src/filters';
import VnUsesMana from 'components/ui/VnUsesMana.vue';
const $props = defineProps({ const $props = defineProps({
mana: { mana: {
@ -57,21 +57,7 @@ const cancel = () => {
</div> </div>
</div> </div>
<div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm"> <div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm">
<QRadio <VnUsesMana :mana-code="manaCode" />
v-model="manaCode"
dense
val="mana"
:label="t('Promotion mana')"
:dark="true"
/>
<QRadio
v-model="manaCode"
dense
val="manaClaim"
:label="t('Claim mana')"
:dark="true"
class="q-mb-sm"
/>
</div> </div>
<div class="row"> <div class="row">
<QBtn <QBtn

View File

@ -22,6 +22,7 @@ import { useVnConfirm } from 'composables/useVnConfirm';
import useNotify from 'src/composables/useNotify.js'; import useNotify from 'src/composables/useNotify.js';
import axios from 'axios'; import axios from 'axios';
import VnTable from 'src/components/VnTable/VnTable.vue'; import VnTable from 'src/components/VnTable/VnTable.vue';
import VnUsesMana from 'src/components/ui/VnUsesMana.vue';
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
@ -771,21 +772,7 @@ watch(
type="number" type="number"
/> />
<div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm"> <div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm">
<QRadio <VnUsesMana :mana-code="manaCode" />
v-model="edit.manaCode"
dense
val="mana"
:label="t('Promotion mana')"
:dark="true"
/>
<QRadio
v-model="edit.manaCode"
dense
val="manaClaim"
:label="t('Claim mana')"
:dark="true"
class="q-mb-sm"
/>
</div> </div>
</TicketEditManaProxy> </TicketEditManaProxy>
</template> </template>

View File

@ -20,6 +20,7 @@ import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue'; import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
import VnSelect from 'src/components/common/VnSelect.vue'; import VnSelect from 'src/components/common/VnSelect.vue';
import TicketDescriptorMenu from './TicketDescriptorMenu.vue'; import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
import VnToSummary from 'src/components/ui/VnToSummary.vue';
const route = useRoute(); const route = useRoute();
const { notify } = useNotify(); const { notify } = useNotify();
@ -105,14 +106,12 @@ function isOnTicketCard() {
data-key="TicketSummary" data-key="TicketSummary"
> >
<template #header-left> <template #header-left>
<router-link <VnToSummary
v-if="route?.name !== 'TicketSummary'" v-if="route?.name !== 'TicketSummary'"
:to="{ name: 'TicketSummary', params: { id: entityId } }" :route-name="'TicketSummary'"
class="header link" :entity-id="entityId"
:href="entryUrl" :url="ticketUrl"
> />
<QIcon name="open_in_new" color="white" size="sm" />
</router-link>
</template> </template>
<template #header="{ entity }"> <template #header="{ entity }">
<div> <div>
@ -150,13 +149,7 @@ function isOnTicketCard() {
color="white" color="white"
> >
<QMenu> <QMenu>
<QList> <TicketDescriptorMenu :ticket="entityId" />
<QItem>
<QItemSection>
<TicketDescriptorMenu :ticket="entityId" />
</QItemSection>
</QItem>
</QList>
</QMenu> </QMenu>
</QBtn> </QBtn>
</div> </div>