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