Merge branch 'dev' into 6321_negative_tickets
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
2c59e6acc3
|
@ -421,12 +421,13 @@ setLogTree();
|
|||
>
|
||||
<div class="timeline">
|
||||
<div class="user-avatar">
|
||||
<VnUserLink :worker-id="userLog.user.id">
|
||||
<VnUserLink :worker-id="userLog?.user?.id">
|
||||
<template #link>
|
||||
<VnAvatar
|
||||
:class="{ 'cursor-pointer': userLog.user.id }"
|
||||
:worker-id="userLog.user.id"
|
||||
:title="userLog.user.nickname"
|
||||
:class="{ 'cursor-pointer': userLog?.user?.id }"
|
||||
:worker-id="userLog?.user?.id"
|
||||
:title="userLog?.user?.nickname"
|
||||
:show-letter="!userLog?.user"
|
||||
size="lg"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -95,6 +95,8 @@ const addFilter = async (filter, params) => {
|
|||
};
|
||||
|
||||
async function fetch() {
|
||||
store.filter.skip = 0;
|
||||
store.skip = 0;
|
||||
await arrayData.fetch({ append: false });
|
||||
if (!store.hasMoreData) {
|
||||
isLoading.value = false;
|
||||
|
|
|
@ -10,7 +10,7 @@ import { tMobile } from 'src/composables/tMobile';
|
|||
import CrudModel from 'src/components/CrudModel.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
|
||||
|
@ -37,10 +37,11 @@ const marker_labels = [
|
|||
{ value: DEFAULT_MAX_RESPONSABILITY, label: t('claim.summary.person') },
|
||||
];
|
||||
const multiplicatorValue = ref();
|
||||
const loading = ref(false);
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'Id',
|
||||
name: 'id',
|
||||
label: t('Id item'),
|
||||
field: (row) => row.itemFk,
|
||||
},
|
||||
|
@ -118,7 +119,7 @@ async function updateDestinations(claimDestinationFk) {
|
|||
|
||||
async function updateDestination(claimDestinationFk, row, options = {}) {
|
||||
if (claimDestinationFk) {
|
||||
await axios.post('Claims/updateClaimDestination', {
|
||||
await post('Claims/updateClaimDestination', {
|
||||
claimDestinationFk,
|
||||
rows: Array.isArray(row) ? row : [row],
|
||||
});
|
||||
|
@ -127,7 +128,7 @@ async function updateDestination(claimDestinationFk, row, options = {}) {
|
|||
}
|
||||
|
||||
async function regularizeClaim() {
|
||||
await axios.post(`Claims/${claimId}/regularizeClaim`);
|
||||
await post(`Claims/${claimId}/regularizeClaim`);
|
||||
await claimRef.value.fetch();
|
||||
await arrayData.fetch({ append: false });
|
||||
quasar.notify({
|
||||
|
@ -146,7 +147,7 @@ async function onUpdateGreugeAccept() {
|
|||
const freightPickUpPrice =
|
||||
(await axios.get(`GreugeConfigs/findOne`)).data.freightPickUpPrice *
|
||||
multiplicatorValue.value;
|
||||
await axios.post(`Greuges`, {
|
||||
await post(`Greuges`, {
|
||||
clientFk: claim.value.clientFk,
|
||||
description: `${t('ClaimGreugeDescription')} ${claimId}`.toUpperCase(),
|
||||
amount: freightPickUpPrice,
|
||||
|
@ -165,14 +166,22 @@ async function save(data) {
|
|||
}
|
||||
|
||||
async function importToNewRefundTicket() {
|
||||
const query = `ClaimBeginnings/${claimId}/importToNewRefundTicket`;
|
||||
await axios.post(query);
|
||||
claimActionsForm.value.reload();
|
||||
await post(`ClaimBeginnings/${claimId}/importToNewRefundTicket`);
|
||||
await claimActionsForm.value.reload();
|
||||
quasar.notify({
|
||||
message: t('globals.dataSaved'),
|
||||
type: 'positive',
|
||||
});
|
||||
}
|
||||
|
||||
async function post(query, params) {
|
||||
loading.value = true;
|
||||
try {
|
||||
await axios.post(query, params);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -279,6 +288,7 @@ async function importToNewRefundTicket() {
|
|||
:default-save="false"
|
||||
:default-reset="false"
|
||||
@on-fetch="setData"
|
||||
:limit="0"
|
||||
auto-load
|
||||
>
|
||||
<template #body>
|
||||
|
@ -291,6 +301,14 @@ async function importToNewRefundTicket() {
|
|||
v-model:selected="selectedRows"
|
||||
:grid="$q.screen.lt.md"
|
||||
>
|
||||
<template #body-cell-id="{ value }">
|
||||
<QTd align="center">
|
||||
<span class="link">
|
||||
{{ value }}
|
||||
<ItemDescriptorProxy :id="value" />
|
||||
</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-ticket="{ value }">
|
||||
<QTd align="center">
|
||||
<span class="link">
|
||||
|
@ -382,6 +400,7 @@ async function importToNewRefundTicket() {
|
|||
icon="check"
|
||||
@click="regularizeClaim"
|
||||
:disable="claim.claimStateFk == resolvedStateId"
|
||||
:loading="loading"
|
||||
/>
|
||||
|
||||
<QBtn
|
||||
|
@ -393,6 +412,7 @@ async function importToNewRefundTicket() {
|
|||
:title="t('Change destination')"
|
||||
icon="swap_horiz"
|
||||
@click="dialogDestination = !dialogDestination"
|
||||
:loading="loading"
|
||||
/>
|
||||
<QBtn
|
||||
color="primary"
|
||||
|
@ -403,6 +423,7 @@ async function importToNewRefundTicket() {
|
|||
icon="Upload"
|
||||
@click="importToNewRefundTicket"
|
||||
:disable="claim.claimStateFk == resolvedStateId"
|
||||
:loading="loading"
|
||||
/>
|
||||
</template>
|
||||
</CrudModel>
|
||||
|
|
|
@ -45,20 +45,25 @@ async function onFetchClaim(data) {
|
|||
|
||||
const amount = ref();
|
||||
const amountClaimed = ref();
|
||||
async function onFetch(rows) {
|
||||
async function onFetch(rows, newRows) {
|
||||
if (newRows) rows = newRows;
|
||||
amount.value = 0;
|
||||
amountClaimed.value = 0;
|
||||
if (!rows || !rows.length) return;
|
||||
|
||||
amount.value = rows.reduce(
|
||||
(accumulator, { sale }) => accumulator + sale.price * sale.quantity,
|
||||
0
|
||||
);
|
||||
for (const row of rows) {
|
||||
const { sale } = row;
|
||||
amount.value = amount.value + totalRow(sale);
|
||||
const price = row.quantity * sale.price;
|
||||
const discount = (sale.discount * price) / 100;
|
||||
amountClaimed.value = amountClaimed.value + (price - discount);
|
||||
}
|
||||
}
|
||||
|
||||
amountClaimed.value = rows.reduce(
|
||||
(accumulator, line) => accumulator + line.sale.price * line.quantity,
|
||||
0
|
||||
);
|
||||
function totalRow({ price, quantity, discount }) {
|
||||
const amount = price * quantity;
|
||||
const appliedDiscount = (discount * amount) / 100;
|
||||
return amount - appliedDiscount;
|
||||
}
|
||||
|
||||
const columns = computed(() => [
|
||||
|
@ -102,12 +107,7 @@ const columns = computed(() => [
|
|||
{
|
||||
name: 'total',
|
||||
label: t('Total'),
|
||||
field: ({ sale }) => {
|
||||
const amount = sale.price * sale.quantity;
|
||||
const appliedDiscount = (sale.discount * amount) / 100;
|
||||
|
||||
return amount - appliedDiscount;
|
||||
},
|
||||
field: ({ sale }) => totalRow(sale),
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
},
|
||||
|
@ -129,6 +129,7 @@ async function updateDiscount({ saleFk, discount, canceller }) {
|
|||
await axios.post(query, body, {
|
||||
signal: canceller.signal,
|
||||
});
|
||||
await claimLinesForm.value.reload();
|
||||
}
|
||||
|
||||
function onUpdateDiscount(response) {
|
||||
|
@ -151,8 +152,11 @@ function showImportDialog() {
|
|||
.onOk(() => claimLinesForm.value.reload());
|
||||
}
|
||||
|
||||
function saveWhenHasChanges() {
|
||||
claimLinesForm.value.getChanges().updates && claimLinesForm.value.onSubmit();
|
||||
async function saveWhenHasChanges() {
|
||||
if (claimLinesForm.value.getChanges().updates) {
|
||||
await claimLinesForm.value.onSubmit();
|
||||
await claimLinesForm.value.reload();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
@ -188,7 +192,6 @@ function saveWhenHasChanges() {
|
|||
save-url="ClaimBeginnings/crud"
|
||||
:filter="linesFilter"
|
||||
@on-fetch="onFetch"
|
||||
@save-changes="onFetch"
|
||||
v-model:selected="selected"
|
||||
:default-save="false"
|
||||
:default-reset="false"
|
||||
|
|
Loading…
Reference in New Issue