#6696 - mana #1052
36
package.json
36
package.json
|
@ -22,36 +22,36 @@
|
|||
"dependencies": {
|
||||
"@quasar/cli": "^2.3.0",
|
||||
"@quasar/extras": "^1.16.9",
|
||||
"axios": "^1.4.0",
|
||||
"axios": "^1.6.7",
|
||||
"chromium": "^3.0.3",
|
||||
"croppie": "^2.6.5",
|
||||
"pinia": "^2.1.3",
|
||||
"pinia": "^2.1.7",
|
||||
"quasar": "^2.14.5",
|
||||
"validator": "^13.9.0",
|
||||
"vue": "^3.3.4",
|
||||
"vue-i18n": "^9.2.2",
|
||||
"vue-router": "^4.2.1"
|
||||
"validator": "^13.11.0",
|
||||
"vue": "^3.4.19",
|
||||
"vue-i18n": "^9.9.1",
|
||||
"vue-router": "^4.2.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^19.2.1",
|
||||
"@commitlint/config-conventional": "^19.1.0",
|
||||
"@intlify/unplugin-vue-i18n": "^0.8.1",
|
||||
"@pinia/testing": "^0.1.2",
|
||||
"@commitlint/cli": "^19.4.0",
|
||||
"@commitlint/config-conventional": "^19.2.2",
|
||||
"@intlify/unplugin-vue-i18n": "^0.8.2",
|
||||
"@pinia/testing": "^0.1.3",
|
||||
"@quasar/app-vite": "^1.7.3",
|
||||
"@quasar/quasar-app-extension-qcalendar": "4.0.0-beta.15",
|
||||
"@quasar/quasar-app-extension-testing-unit-vitest": "^0.4.0",
|
||||
"@vue/test-utils": "^2.4.4",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"autoprefixer": "^10.4.17",
|
||||
"cypress": "^13.6.6",
|
||||
"cypress-mochawesome-reporter": "^3.8.2",
|
||||
"eslint": "^8.41.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"eslint-plugin-cypress": "^2.13.3",
|
||||
"eslint-plugin-vue": "^9.14.1",
|
||||
"husky": "^8.0.0",
|
||||
"postcss": "^8.4.23",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-prettier": "^8.10.0",
|
||||
"eslint-plugin-cypress": "^2.15.1",
|
||||
"eslint-plugin-vue": "^9.21.1",
|
||||
"husky": "^8.0.3",
|
||||
"postcss": "^8.4.35",
|
||||
"prettier": "^2.8.8",
|
||||
"vitest": "^0.31.1"
|
||||
"vitest": "^0.31.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20 || ^18 || ^16",
|
||||
|
|
495
pnpm-lock.yaml
495
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,55 +0,0 @@
|
|||
<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>
|
|
@ -1,12 +1,11 @@
|
|||
<script setup>
|
||||
import { computed, ref, onMounted } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
|
||||
import { toCurrency, toPercentage, toDate, dashOrCurrency } from 'src/filters';
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import VnLinkPhone from 'src/components/ui/VnLinkPhone.vue';
|
||||
import VnLinkMail from 'src/components/ui/VnLinkMail.vue';
|
||||
|
|
|
@ -1,36 +1,28 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ref, onBeforeMount } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toCurrency } from 'src/filters';
|
||||
import VnUsesMana from 'components/ui/VnUsesMana.vue';
|
||||
import axios from 'axios';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
const route = useRoute();
|
||||
const $props = defineProps({
|
||||
mana: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
newPrice: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
usesMana: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
manaCode: {
|
||||
type: String,
|
||||
default: 'mana',
|
||||
},
|
||||
});
|
||||
|
||||
// calcular usesMana borrar de ticketSale
|
||||
const emit = defineEmits(['save', 'cancel']);
|
||||
|
||||
const { t } = useI18n();
|
||||
const QPopupProxyRef = ref(null);
|
||||
const manaCode = ref($props.manaCode);
|
||||
const componentName = ref();
|
||||
const mana = ref(null);
|
||||
const usesMana = ref(null);
|
||||
|
||||
const save = () => {
|
||||
emit('save');
|
||||
emit('save', componentName.value);
|
||||
QPopupProxyRef.value.hide();
|
||||
};
|
||||
|
||||
|
@ -38,15 +30,55 @@ const cancel = () => {
|
|||
emit('cancel');
|
||||
QPopupProxyRef.value.hide();
|
||||
};
|
||||
|
||||
onBeforeMount(async () => {
|
||||
try {
|
||||
const { data: manaData } = await axios.get(
|
||||
`Tickets/${route.params.id}/getSalesPersonMana`
|
||||
);
|
||||
mana.value = manaData;
|
||||
|
||||
const { data: usesManaData } = await axios.get('Sales/usesMana');
|
||||
usesMana.value = usesManaData;
|
||||
} catch (error) {
|
||||
console.error('Error fetching mana data:', error);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy ref="QPopupProxyRef">
|
||||
<div class="container">
|
||||
<QForm @submit="save">
|
||||
<div>
|
||||
<QSpinner v-if="!mana" color="primary" size="md" />
|
||||
<div v-else>
|
||||
<div class="header">Mana: {{ toCurrency(mana) }}</div>
|
||||
<div class="q-pa-md">
|
||||
<div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm">
|
||||
<div class="column q-gutter-y-sm q-mt-sm">
|
||||
<QRadio
|
||||
v-model="componentName"
|
||||
dense
|
||||
val="mana"
|
||||
:label="t('Mana')"
|
||||
class="q-mb-sm"
|
||||
/>
|
||||
<QRadio
|
||||
v-model="componentName"
|
||||
dense
|
||||
val="debtCollection"
|
||||
:label="t('Greuge')"
|
||||
class="q-mb-sm"
|
||||
/>
|
||||
<QRadio
|
||||
v-model="componentName"
|
||||
dense
|
||||
val="manaClaim"
|
||||
:label="t('Claim')"
|
||||
class="q-mb-sm"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<slot />
|
||||
<div v-if="newPrice" class="column items-center q-mt-lg">
|
||||
<span class="text-primary">{{ t('New price') }}</span>
|
||||
|
@ -56,9 +88,6 @@ const cancel = () => {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm">
|
||||
<VnUsesMana :mana-code="manaCode" />
|
||||
</div>
|
||||
<div class="row">
|
||||
<QBtn
|
||||
color="primary"
|
||||
|
@ -76,20 +105,17 @@ const cancel = () => {
|
|||
style="width: 50%"
|
||||
@click="save()"
|
||||
data-cy="saveManaBtn"
|
||||
type="submit"
|
||||
>
|
||||
{{ t('globals.save') }}
|
||||
</QBtn>
|
||||
</div>
|
||||
</div>
|
||||
</QForm>
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container {
|
||||
background-color: $dark;
|
||||
width: 230px;
|
||||
}
|
||||
|
||||
.header {
|
||||
height: 54px;
|
||||
width: 100%;
|
||||
|
@ -106,4 +132,5 @@ const cancel = () => {
|
|||
<i18n>
|
||||
es:
|
||||
New price: Nuevo precio
|
||||
Claim: Reclamación
|
||||
</i18n>
|
||||
|
|
|
@ -3,7 +3,6 @@ import { onMounted, ref, computed, onUnmounted, watch } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
@ -11,11 +10,9 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
|||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import TicketEditManaProxy from './TicketEditMana.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import TicketSaleMoreActions from './TicketSaleMoreActions.vue';
|
||||
import TicketTransfer from './TicketTransfer.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toCurrency, toPercentage } from 'src/filters';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
|
@ -23,7 +20,6 @@ import { useVnConfirm } from 'composables/useVnConfirm';
|
|||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import VnUsesMana from 'src/components/ui/VnUsesMana.vue';
|
||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||
|
||||
const route = useRoute();
|
||||
|
@ -45,8 +41,7 @@ const isTicketEditable = ref(false);
|
|||
const sales = ref([]);
|
||||
const editableStatesOptions = ref([]);
|
||||
const selectedSales = ref([]);
|
||||
const mana = ref(null);
|
||||
const manaCode = ref('mana');
|
||||
const componentName = ref('mana');
|
||||
const ticketState = computed(() => store.data?.ticketState?.state?.code);
|
||||
const transfer = ref({
|
||||
lastActiveTickets: [],
|
||||
|
@ -154,7 +149,6 @@ const columns = computed(() => [
|
|||
],
|
||||
},
|
||||
]);
|
||||
|
||||
const getConfig = async () => {
|
||||
let filter = {
|
||||
fields: ['daysForWarningClaim'],
|
||||
|
@ -252,18 +246,6 @@ const DEFAULT_EDIT = {
|
|||
oldQuantity: null,
|
||||
};
|
||||
const edit = ref({ ...DEFAULT_EDIT });
|
||||
const usesMana = ref(null);
|
||||
|
||||
const getUsesMana = async () => {
|
||||
const { data } = await axios.get('Sales/usesMana');
|
||||
usesMana.value = data;
|
||||
};
|
||||
|
||||
const getMana = async () => {
|
||||
const { data } = await axios.get(`Tickets/${route.params.id}/getSalesPersonMana`);
|
||||
mana.value = data;
|
||||
await getUsesMana();
|
||||
};
|
||||
|
||||
const selectedValidSales = computed(() => {
|
||||
if (!sales.value) return;
|
||||
|
@ -271,7 +253,6 @@ const selectedValidSales = computed(() => {
|
|||
});
|
||||
|
||||
const onOpenEditPricePopover = async (sale) => {
|
||||
await getMana();
|
||||
edit.value = {
|
||||
sale: JSON.parse(JSON.stringify(sale)),
|
||||
price: sale.price,
|
||||
|
@ -279,7 +260,6 @@ const onOpenEditPricePopover = async (sale) => {
|
|||
};
|
||||
|
||||
const onOpenEditDiscountPopover = async (sale) => {
|
||||
await getMana();
|
||||
if (isLocked.value) return;
|
||||
if (sale) {
|
||||
edit.value = {
|
||||
|
@ -304,15 +284,13 @@ const updatePrice = async (sale) => {
|
|||
edit.value = { ...DEFAULT_EDIT };
|
||||
notify('globals.dataSaved', 'positive');
|
||||
}
|
||||
|
||||
await getMana();
|
||||
};
|
||||
|
||||
const changeDiscount = async (sale) => {
|
||||
canProceed.value = await isSalePrepared(sale);
|
||||
if (!canProceed.value) return;
|
||||
const newDiscount = edit.value.discount;
|
||||
if (newDiscount != null && newDiscount != sale.discount) updateDiscount([sale]);
|
||||
if (newDiscount != null && newDiscount != sale.discount) await updateDiscount([sale]);
|
||||
};
|
||||
|
||||
const updateDiscount = async (sales, newDiscount = null) => {
|
||||
|
@ -325,7 +303,7 @@ const updateDiscount = async (sales, newDiscount = null) => {
|
|||
const params = {
|
||||
salesIds: saleIds,
|
||||
newDiscount: _newDiscount,
|
||||
manaCode: manaCode.value,
|
||||
componentName: componentName.value,
|
||||
};
|
||||
await axios.post(`Tickets/${route.params.id}/updateDiscount`, params);
|
||||
notify('globals.dataSaved', 'positive');
|
||||
|
@ -377,7 +355,6 @@ const changeTicketState = async (val) => {
|
|||
notify('globals.dataSaved', 'positive');
|
||||
await resetChanges();
|
||||
};
|
||||
|
||||
const removeSelectedSales = () => {
|
||||
selectedRows.value.forEach((sale) => {
|
||||
const index = sales.value.indexOf(sale);
|
||||
|
@ -582,9 +559,7 @@ watch(
|
|||
:is-ticket-editable="isTicketEditable"
|
||||
:sales="selectedValidSales"
|
||||
:disable="!hasSelectedRows"
|
||||
:mana="mana"
|
||||
:ticket-config="ticketConfig"
|
||||
@get-mana="getMana()"
|
||||
@update-discounts="updateDiscount"
|
||||
@refresh-table="resetChanges"
|
||||
/>
|
||||
|
@ -797,11 +772,16 @@ watch(
|
|||
<QBtn flat class="link" dense @click="onOpenEditPricePopover(row)">
|
||||
{{ toCurrency(row.price) }}
|
||||
</QBtn>
|
||||
|
||||
<TicketEditManaProxy
|
||||
ref="editPriceProxyRef"
|
||||
:mana="mana"
|
||||
:new-price="getNewPrice"
|
||||
@save="updatePrice(row)"
|
||||
@save="
|
||||
(newManaCode) => {
|
||||
componentName = newManaCode;
|
||||
updatePrice(row);
|
||||
}
|
||||
"
|
||||
>
|
||||
<VnInput
|
||||
v-model.number="edit.price"
|
||||
|
@ -818,20 +798,19 @@ watch(
|
|||
{{ toPercentage(row.discount / 100) }}
|
||||
</QBtn>
|
||||
<TicketEditManaProxy
|
||||
:mana="mana"
|
||||
:new-price="getNewPrice"
|
||||
:uses-mana="usesMana"
|
||||
:mana-code="manaCode"
|
||||
@save="changeDiscount(row)"
|
||||
@save="
|
||||
(newManaCode) => {
|
||||
componentName = newManaCode;
|
||||
changeDiscount(row);
|
||||
}
|
||||
"
|
||||
>
|
||||
<VnInput
|
||||
v-model.number="edit.discount"
|
||||
:label="t('ticketSale.discount')"
|
||||
type="number"
|
||||
/>
|
||||
<div v-if="usesMana" class="column q-gutter-y-sm q-mt-sm">
|
||||
<VnUsesMana :mana-code="manaCode" />
|
||||
</div>
|
||||
</TicketEditManaProxy>
|
||||
</template>
|
||||
<span v-else>{{ toPercentage(row.discount / 100) }}</span>
|
||||
|
|
|
@ -38,6 +38,10 @@ const props = defineProps({
|
|||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
usesMana: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
ticketConfig: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
|
@ -214,7 +218,11 @@ const createRefund = async (withWarehouse) => {
|
|||
<QItemSection>
|
||||
<QItemLabel>{{ t('Update discount') }}</QItemLabel>
|
||||
</QItemSection>
|
||||
<TicketEditManaProxy :mana="props.mana" @save="changeMultipleDiscount()">
|
||||
<TicketEditManaProxy
|
||||
:uses-mana="props.usesMana"
|
||||
:mana="props.mana"
|
||||
@save="changeMultipleDiscount()"
|
||||
>
|
||||
<VnInput
|
||||
v-model.number="newDiscount"
|
||||
:label="t('ticketSale.discount')"
|
||||
|
|
Loading…
Reference in New Issue