forked from verdnatura/salix-front
fix(orderLines): reload when delete and redirect when confirm
This commit is contained in:
parent
1e4a309a84
commit
3222a7a42c
|
@ -82,7 +82,6 @@ function ticketFilter(order) {
|
|||
ref="getTotalRef"
|
||||
:url="`Orders/${entityId}/getTotal`"
|
||||
@on-fetch="(response) => (total = response)"
|
||||
auto-load
|
||||
/>
|
||||
<CardDescriptor
|
||||
ref="descriptor"
|
||||
|
|
|
@ -1,25 +1,26 @@
|
|||
<script setup>
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { toCurrency, toDate } from 'src/filters';
|
||||
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
import { toCurrency, toDate } from 'src/filters';
|
||||
import axios from 'axios';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import FetchedTags from 'src/components/ui/FetchedTags.vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
||||
const router = useRouter();
|
||||
const stateStore = useStateStore();
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
const descriptorData = useArrayData('orderData');
|
||||
const componentKey = ref(0);
|
||||
const tableLinesRef = ref();
|
||||
const order = ref();
|
||||
|
@ -27,6 +28,8 @@ const orderSummary = ref({
|
|||
total: null,
|
||||
vat: null,
|
||||
});
|
||||
const getTotalRef = ref();
|
||||
const getVATRef = ref();
|
||||
|
||||
const lineFilter = ref({
|
||||
include: [
|
||||
|
@ -195,6 +198,9 @@ async function remove(item) {
|
|||
type: 'positive',
|
||||
});
|
||||
tableLinesRef.value.reload();
|
||||
descriptorData.fetch({});
|
||||
getTotalRef.value.fetch();
|
||||
getVATRef.value.fetch();
|
||||
}
|
||||
|
||||
async function confirmOrder() {
|
||||
|
@ -203,6 +209,12 @@ async function confirmOrder() {
|
|||
message: t('globals.confirm'),
|
||||
type: 'positive',
|
||||
});
|
||||
router.push({
|
||||
name: 'TicketList',
|
||||
query: {
|
||||
table: JSON.stringify({ clientFk: descriptorData.store.data.clientFk }),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
|
@ -223,44 +235,36 @@ watch(
|
|||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
ref="getTotalRef"
|
||||
:key="componentKey"
|
||||
:url="`Orders/${route.params.id}/getTotal`"
|
||||
@on-fetch="(data) => (orderSummary.total = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
ref="getVATRef"
|
||||
:key="componentKey"
|
||||
:url="`Orders/${route.params.id}/getVAT`"
|
||||
@on-fetch="(data) => (orderSummary.vat = data)"
|
||||
auto-load
|
||||
/>
|
||||
<QDrawer side="right" :width="270" v-model="stateStore.rightDrawer">
|
||||
<QCard class="order-lines-summary q-pa-lg">
|
||||
<QCard
|
||||
class="order-lines-summary q-pa-lg"
|
||||
v-if="orderSummary.vat && orderSummary.total"
|
||||
>
|
||||
<p class="header text-right block">
|
||||
{{ t('summary') }}
|
||||
</p>
|
||||
<VnLv
|
||||
v-if="orderSummary.vat && orderSummary.total"
|
||||
:label="t('subtotal') + ': '"
|
||||
:value="toCurrency(orderSummary.total - orderSummary.vat)"
|
||||
/>
|
||||
<VnLv
|
||||
v-if="orderSummary.vat"
|
||||
:label="t('VAT') + ': '"
|
||||
:value="toCurrency(orderSummary?.vat)"
|
||||
/>
|
||||
<VnLv
|
||||
v-if="orderSummary.total"
|
||||
:label="t('total') + ': '"
|
||||
:value="toCurrency(orderSummary?.total)"
|
||||
/>
|
||||
<VnLv :label="t('VAT') + ': '" :value="toCurrency(orderSummary?.vat)" />
|
||||
<VnLv :label="t('total') + ': '" :value="toCurrency(orderSummary?.total)" />
|
||||
</QCard>
|
||||
</QDrawer>
|
||||
<QPage :key="componentKey" class="column items-center">
|
||||
<div class="order-list full-width">
|
||||
<div v-if="!orderSummary.total" class="no-result">
|
||||
{{ t('globals.noResults') }}
|
||||
</div>
|
||||
|
||||
<VnTable
|
||||
ref="tableLinesRef"
|
||||
data-key="OrderLines"
|
||||
|
@ -299,14 +303,12 @@ watch(
|
|||
/>
|
||||
</template>
|
||||
</VnTable>
|
||||
</div>
|
||||
<QPageSticky :offset="[20, 20]" v-if="!order?.isConfirmed" style="z-index: 2">
|
||||
<QBtn fab icon="check" color="primary" @click="confirmOrder()" />
|
||||
<QTooltip>
|
||||
{{ t('confirm') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
Loading…
Reference in New Issue