forked from verdnatura/salix-front
remove unnecesary files
This commit is contained in:
parent
05b7df9168
commit
4bd78922af
|
@ -1257,7 +1257,6 @@ monitor:
|
|||
pageTitles:
|
||||
monitors: Monitores
|
||||
list: Listado
|
||||
|
||||
components:
|
||||
topbar: {}
|
||||
itemsFilterPanel:
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const accountFilter = {
|
||||
where: { id: route.params.id },
|
||||
fields: ['id', 'email', 'nickname', 'name', 'accountStateFk', 'packages', 'pickup'],
|
||||
include: [],
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<FormModel
|
||||
:url="`VnUsers/preview`"
|
||||
:url-update="`VnUsers/${route.params.id}/update-user`"
|
||||
:filter="accountFilter"
|
||||
model="Accounts"
|
||||
auto-load
|
||||
>
|
||||
<template #form="{ data }">
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnInput v-model="data.name" :label="t('account.card.nickname')" />
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnInput v-model="data.nickname" :label="t('account.card.alias')" />
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnInput v-model="data.email" :label="t('account.card.email')" />
|
||||
</div>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md">
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
v-model="data.lang"
|
||||
:options="['es', 'en']"
|
||||
:label="t('account.card.lang')"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModel>
|
||||
</template>
|
|
@ -1,15 +0,0 @@
|
|||
<script setup>
|
||||
import VnCard from 'components/common/VnCard.vue';
|
||||
import AccountDescriptor from './AccountDescriptor.vue';
|
||||
</script>
|
||||
<template>
|
||||
<VnCard
|
||||
data-key="Account"
|
||||
base-url="Accounts"
|
||||
:descriptor="AccountDescriptor"
|
||||
searchbar-data-key="AccountList"
|
||||
searchbar-url="Accounts/filter"
|
||||
searchbar-label="Search account"
|
||||
searchbar-info="You can search by account id or customer name"
|
||||
/>
|
||||
</template>
|
|
@ -1,121 +0,0 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toDate, toPercentage } from 'src/filters';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import AccountDescriptorMenu from './AccountDescriptorMenu.vue';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const state = useState();
|
||||
const { t } = useI18n();
|
||||
const salixUrl = ref();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
const entityId = computed(() => {
|
||||
return $props.id || route.params.id;
|
||||
});
|
||||
const data = ref(useCardDescription());
|
||||
const setData = (entity) => (data.value = useCardDescription(entity.nickname, entity.id));
|
||||
|
||||
const filter = {
|
||||
where: { id: entityId },
|
||||
fields: ['id', 'nickname', 'name', 'role'],
|
||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
||||
};
|
||||
function getAccountAvatar() {
|
||||
const token = getTokenMultimedia();
|
||||
return `/api/Images/user/160x160/${entityId.value}/download?access_token=${token}`;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardDescriptor
|
||||
ref="descriptor"
|
||||
:url="`VnUsers/preview`"
|
||||
:filter="filter"
|
||||
module="Account"
|
||||
@on-fetch="setData"
|
||||
data-key="accountData"
|
||||
:title="data.title"
|
||||
:subtitle="data.subtitle"
|
||||
>
|
||||
<template #header-extra-action>
|
||||
<QBtn
|
||||
round
|
||||
flat
|
||||
size="md"
|
||||
color="white"
|
||||
icon="face"
|
||||
:to="{ name: 'AccountList' }"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Go to module index') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
<template #menu="{ entity }">
|
||||
<AccountDescriptorMenu :account="entity" />
|
||||
</template>
|
||||
<template #before>
|
||||
<QImg :src="getAccountAvatar()" class="photo">
|
||||
<template #error>
|
||||
<div
|
||||
class="absolute-full picture text-center q-pa-md flex flex-center"
|
||||
>
|
||||
<div>
|
||||
<div class="text-grey-5" style="opacity: 0.4; font-size: 5vh">
|
||||
<QIcon name="vn:claims" />
|
||||
</div>
|
||||
<div class="text-grey-5" style="opacity: 0.4">
|
||||
{{ t('account.imageNotFound') }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</QImg>
|
||||
</template>
|
||||
<template #body="{ entity }">
|
||||
<VnLv :label="t('account.card.nickname')" :value="entity.nickname" />
|
||||
<VnLv :label="t('account.card.role')" :value="entity.role.name" />
|
||||
</template>
|
||||
<template #actions="{ entity }">
|
||||
<QCardActions>
|
||||
<QBtn
|
||||
round
|
||||
flat
|
||||
size="md"
|
||||
color="primary"
|
||||
class="fill-icon"
|
||||
icon="contact_mail"
|
||||
:href="salixUrl + 'ticket/' + entity.ticketFk + '/tracking/index'"
|
||||
>
|
||||
<QTooltip>{{ t('account.card.ticketTracking') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</template>
|
||||
</CardDescriptor>
|
||||
</template>
|
||||
<style scoped>
|
||||
.q-item__label {
|
||||
margin-top: 0;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
en:
|
||||
accountRate: Claming rate
|
||||
es:
|
||||
accountRate: Ratio de reclamación
|
||||
</i18n>
|
|
@ -1,115 +0,0 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { ref } from 'vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { usePrintService } from 'composables/usePrintService';
|
||||
|
||||
const $props = defineProps({
|
||||
account: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { openReport } = usePrintService();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
|
||||
const account = ref($props.account);
|
||||
</script>
|
||||
<template>
|
||||
<QItem
|
||||
v-ripple
|
||||
clickable
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('Confirm deletion'),
|
||||
t('Are you sure...TODO'),
|
||||
setPassword
|
||||
)
|
||||
"
|
||||
>
|
||||
<QItemSection>{{ t('account.card.actions.setPassword') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-ripple
|
||||
clickable
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('account.card.actions.disableAccount.title'),
|
||||
t('account.card.actions.disableAccount.subtitle'),
|
||||
disableAccount
|
||||
)
|
||||
"
|
||||
>
|
||||
<QItemSection>{{ t('account.card.actions.disableAccount.name') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-ripple
|
||||
clickable
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('account.card.actions.disableUser.title'),
|
||||
t('account.card.actions.disableUser.title'),
|
||||
actiondisableUser
|
||||
)
|
||||
"
|
||||
>
|
||||
<QItemSection>{{ t('account.card.actions.disableUser.name') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-ripple
|
||||
clickable
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('account.card.actions.sync.title'),
|
||||
t('account.card.actions.sync.subtitle'),
|
||||
sync
|
||||
)
|
||||
"
|
||||
>
|
||||
<QItemSection>{{ t('account.card.actions.sync.name') }}</QItemSection>
|
||||
</QItem>
|
||||
|
||||
<QSeparator />
|
||||
<QItem
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('account.card.actions.delete.title'),
|
||||
t('account.card.actions.delete.subTitle'),
|
||||
removeAccount
|
||||
)
|
||||
"
|
||||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="delete" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('account.card.actions.delete.name') }}</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
{
|
||||
"en": {
|
||||
"pickupOrder": "Pickup order",
|
||||
"openPickupOrder": "Open pickup order",
|
||||
"sendPickupOrder": "Send pickup order",
|
||||
"deleteAccount": "Delete account",
|
||||
"confirmDeletion": "Confirm deletion",
|
||||
"confirmDeletionMessage": "Are you sure you want to delete this account?"
|
||||
},
|
||||
"es": {
|
||||
"pickupOrder": "Orden de recogida",
|
||||
"openPickupOrder": "Abrir orden de recogida",
|
||||
"sendPickupOrder": "Enviar orden de recogida",
|
||||
"deleteAccount": "Eliminar reclamación",
|
||||
"confirmDeletion": "Confirmar eliminación",
|
||||
"confirmDeletionMessage": "Seguro que quieres eliminar esta reclamación?"
|
||||
}
|
||||
}
|
||||
</i18n>
|
|
@ -1,6 +0,0 @@
|
|||
<script setup>
|
||||
import VnLog from 'src/components/common/VnLog.vue';
|
||||
</script>
|
||||
<template>
|
||||
<VnLog model="VnUser"></VnLog>
|
||||
</template>
|
|
@ -1,256 +0,0 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import CrudModel from 'components/CrudModel.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import { tMobile } from 'composables/tMobile';
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const accountDevelopmentForm = ref();
|
||||
const accountReasons = ref([]);
|
||||
const accountResults = ref([]);
|
||||
const accountResponsibles = ref([]);
|
||||
const accountRedeliveries = ref([]);
|
||||
const workers = ref([]);
|
||||
const selected = ref([]);
|
||||
const saveButtonRef = ref();
|
||||
|
||||
const developmentsFilter = {
|
||||
fields: [
|
||||
'id',
|
||||
'accountFk',
|
||||
'accountReasonFk',
|
||||
'accountResultFk',
|
||||
'accountResponsibleFk',
|
||||
'workerFk',
|
||||
'accountRedeliveryFk',
|
||||
],
|
||||
where: {
|
||||
accountFk: route.params.id,
|
||||
},
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'accountReason',
|
||||
label: t('Reason'),
|
||||
field: (row) => row.accountReasonFk,
|
||||
sortable: true,
|
||||
options: accountReasons.value,
|
||||
required: true,
|
||||
model: 'accountReasonFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
tabIndex: 1,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'accountResult',
|
||||
label: t('Result'),
|
||||
field: (row) => row.accountResultFk,
|
||||
sortable: true,
|
||||
options: accountResults.value,
|
||||
required: true,
|
||||
model: 'accountResultFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
tabIndex: 2,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'accountResponsible',
|
||||
label: t('Responsible'),
|
||||
field: (row) => row.accountResponsibleFk,
|
||||
sortable: true,
|
||||
options: accountResponsibles.value,
|
||||
required: true,
|
||||
model: 'accountResponsibleFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
tabIndex: 3,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'worker',
|
||||
label: t('Worker'),
|
||||
field: (row) => row.workerFk,
|
||||
sortable: true,
|
||||
options: workers.value,
|
||||
model: 'workerFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'nickname',
|
||||
tabIndex: 4,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'accountRedelivery',
|
||||
label: t('Redelivery'),
|
||||
field: (row) => row.accountRedeliveryFk,
|
||||
sortable: true,
|
||||
options: accountRedeliveries.value,
|
||||
required: true,
|
||||
model: 'accountRedeliveryFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
tabIndex: 5,
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="AccountReasons"
|
||||
order="description"
|
||||
@on-fetch="(data) => (accountReasons = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="AccountResults"
|
||||
order="description"
|
||||
@on-fetch="(data) => (accountResults = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="AccountResponsibles"
|
||||
order="description"
|
||||
@on-fetch="(data) => (accountResponsibles = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="AccountRedeliveries"
|
||||
order="description"
|
||||
@on-fetch="(data) => (accountRedeliveries = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Workers/search"
|
||||
:where="{ active: 1 }"
|
||||
order="name ASC"
|
||||
@on-fetch="(data) => (workers = data)"
|
||||
auto-load
|
||||
/>
|
||||
<CrudModel
|
||||
data-key="AccountDevelopments"
|
||||
url="AccountDevelopments"
|
||||
model="accountDevelopment"
|
||||
:filter="developmentsFilter"
|
||||
ref="accountDevelopmentForm"
|
||||
:data-required="{ accountFk: route.params.id }"
|
||||
v-model:selected="selected"
|
||||
auto-load
|
||||
@save-changes="$router.push(`/account/${route.params.id}/action`)"
|
||||
:default-save="false"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="$index"
|
||||
selection="multiple"
|
||||
v-model:selected="selected"
|
||||
:grid="$q.screen.lt.md"
|
||||
table-header-class="text-left"
|
||||
>
|
||||
<template #body-cell="{ row, col }">
|
||||
<QTd
|
||||
auto-width
|
||||
@keyup.ctrl.enter.stop="accountDevelopmentForm.saveChanges()"
|
||||
>
|
||||
<VnSelect
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:autofocus="col.tabIndex == 1"
|
||||
input-debounce="0"
|
||||
hide-selected
|
||||
>
|
||||
<template #option="scope" v-if="col.name == 'worker'">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ scope.opt?.nickname }}
|
||||
{{ scope.opt?.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #item="props">
|
||||
<div class="q-pa-xs col-xs-12 col-sm-6 grid-style-transition">
|
||||
<QCard
|
||||
bordered
|
||||
flat
|
||||
@keyup.ctrl.enter.stop="accountDevelopmentForm?.saveChanges()"
|
||||
>
|
||||
<QCardSection>
|
||||
<QCheckbox v-model="props.selected" dense />
|
||||
</QCardSection>
|
||||
<QSeparator />
|
||||
<QList dense>
|
||||
<QItem v-for="col in props.cols" :key="col.name">
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="col.label"
|
||||
v-model="props.row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
dense
|
||||
input-debounce="0"
|
||||
:autofocus="col.tabIndex == 1"
|
||||
hide-selected
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QCard>
|
||||
</div>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
<template #moreAfterActions>
|
||||
<QBtn
|
||||
:label="tMobile('globals.save')"
|
||||
ref="saveButtonRef"
|
||||
color="primary"
|
||||
icon="save"
|
||||
:disable="!accountDevelopmentForm?.hasChanges"
|
||||
@click="accountDevelopmentForm?.onSubmit"
|
||||
:title="t('globals.save')"
|
||||
/>
|
||||
</template>
|
||||
</CrudModel>
|
||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||
<QBtn
|
||||
fab
|
||||
color="primary"
|
||||
icon="add"
|
||||
@keydown.tab.prevent="saveButtonRef.$el.focus()"
|
||||
@click="accountDevelopmentForm.insert()"
|
||||
/>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.grid-style-transition {
|
||||
transition: transform 0.28s, background-color 0.28s;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Reason: Motivo
|
||||
Result: Consecuencia
|
||||
Responsible: Responsable
|
||||
Worker: Trabajador
|
||||
Redelivery: Devolución
|
||||
</i18n>
|
|
@ -1,256 +0,0 @@
|
|||
<script setup>
|
||||
import { ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import CrudModel from 'components/CrudModel.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import { tMobile } from 'composables/tMobile';
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const accountDevelopmentForm = ref();
|
||||
const accountReasons = ref([]);
|
||||
const accountResults = ref([]);
|
||||
const accountResponsibles = ref([]);
|
||||
const accountRedeliveries = ref([]);
|
||||
const workers = ref([]);
|
||||
const selected = ref([]);
|
||||
const saveButtonRef = ref();
|
||||
|
||||
const developmentsFilter = {
|
||||
fields: [
|
||||
'id',
|
||||
'accountFk',
|
||||
'accountReasonFk',
|
||||
'accountResultFk',
|
||||
'accountResponsibleFk',
|
||||
'workerFk',
|
||||
'accountRedeliveryFk',
|
||||
],
|
||||
where: {
|
||||
accountFk: route.params.id,
|
||||
},
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'accountReason',
|
||||
label: t('Reason'),
|
||||
field: (row) => row.accountReasonFk,
|
||||
sortable: true,
|
||||
options: accountReasons.value,
|
||||
required: true,
|
||||
model: 'accountReasonFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
tabIndex: 1,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'accountResult',
|
||||
label: t('Result'),
|
||||
field: (row) => row.accountResultFk,
|
||||
sortable: true,
|
||||
options: accountResults.value,
|
||||
required: true,
|
||||
model: 'accountResultFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
tabIndex: 2,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'accountResponsible',
|
||||
label: t('Responsible'),
|
||||
field: (row) => row.accountResponsibleFk,
|
||||
sortable: true,
|
||||
options: accountResponsibles.value,
|
||||
required: true,
|
||||
model: 'accountResponsibleFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
tabIndex: 3,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'worker',
|
||||
label: t('Worker'),
|
||||
field: (row) => row.workerFk,
|
||||
sortable: true,
|
||||
options: workers.value,
|
||||
model: 'workerFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'nickname',
|
||||
tabIndex: 4,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
name: 'accountRedelivery',
|
||||
label: t('Redelivery'),
|
||||
field: (row) => row.accountRedeliveryFk,
|
||||
sortable: true,
|
||||
options: accountRedeliveries.value,
|
||||
required: true,
|
||||
model: 'accountRedeliveryFk',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'description',
|
||||
tabIndex: 5,
|
||||
align: 'left',
|
||||
},
|
||||
]);
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="AccountReasons"
|
||||
order="description"
|
||||
@on-fetch="(data) => (accountReasons = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="AccountResults"
|
||||
order="description"
|
||||
@on-fetch="(data) => (accountResults = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="AccountResponsibles"
|
||||
order="description"
|
||||
@on-fetch="(data) => (accountResponsibles = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="AccountRedeliveries"
|
||||
order="description"
|
||||
@on-fetch="(data) => (accountRedeliveries = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Workers/search"
|
||||
:where="{ active: 1 }"
|
||||
order="name ASC"
|
||||
@on-fetch="(data) => (workers = data)"
|
||||
auto-load
|
||||
/>
|
||||
<CrudModel
|
||||
data-key="AccountDevelopments"
|
||||
url="AccountDevelopments"
|
||||
model="accountDevelopment"
|
||||
:filter="developmentsFilter"
|
||||
ref="accountDevelopmentForm"
|
||||
:data-required="{ accountFk: route.params.id }"
|
||||
v-model:selected="selected"
|
||||
auto-load
|
||||
@save-changes="$router.push(`/account/${route.params.id}/action`)"
|
||||
:default-save="false"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
row-key="$index"
|
||||
selection="multiple"
|
||||
v-model:selected="selected"
|
||||
:grid="$q.screen.lt.md"
|
||||
table-header-class="text-left"
|
||||
>
|
||||
<template #body-cell="{ row, col }">
|
||||
<QTd
|
||||
auto-width
|
||||
@keyup.ctrl.enter.stop="accountDevelopmentForm.saveChanges()"
|
||||
>
|
||||
<VnSelect
|
||||
v-model="row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
:autofocus="col.tabIndex == 1"
|
||||
input-debounce="0"
|
||||
hide-selected
|
||||
>
|
||||
<template #option="scope" v-if="col.name == 'worker'">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>
|
||||
{{ scope.opt?.nickname }}
|
||||
{{ scope.opt?.code }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #item="props">
|
||||
<div class="q-pa-xs col-xs-12 col-sm-6 grid-style-transition">
|
||||
<QCard
|
||||
bordered
|
||||
flat
|
||||
@keyup.ctrl.enter.stop="accountDevelopmentForm?.saveChanges()"
|
||||
>
|
||||
<QCardSection>
|
||||
<QCheckbox v-model="props.selected" dense />
|
||||
</QCardSection>
|
||||
<QSeparator />
|
||||
<QList dense>
|
||||
<QItem v-for="col in props.cols" :key="col.name">
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
:label="col.label"
|
||||
v-model="props.row[col.model]"
|
||||
:options="col.options"
|
||||
:option-value="col.optionValue"
|
||||
:option-label="col.optionLabel"
|
||||
dense
|
||||
input-debounce="0"
|
||||
:autofocus="col.tabIndex == 1"
|
||||
hide-selected
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QCard>
|
||||
</div>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
<template #moreAfterActions>
|
||||
<QBtn
|
||||
:label="tMobile('globals.save')"
|
||||
ref="saveButtonRef"
|
||||
color="primary"
|
||||
icon="save"
|
||||
:disable="!accountDevelopmentForm?.hasChanges"
|
||||
@click="accountDevelopmentForm?.onSubmit"
|
||||
:title="t('globals.save')"
|
||||
/>
|
||||
</template>
|
||||
</CrudModel>
|
||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||
<QBtn
|
||||
fab
|
||||
color="primary"
|
||||
icon="add"
|
||||
@keydown.tab.prevent="saveButtonRef.$el.focus()"
|
||||
@click="accountDevelopmentForm.insert()"
|
||||
/>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.grid-style-transition {
|
||||
transition: transform 0.28s, background-color 0.28s;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Reason: Motivo
|
||||
Result: Consecuencia
|
||||
Responsible: Responsable
|
||||
Worker: Trabajador
|
||||
Redelivery: Devolución
|
||||
</i18n>
|
|
@ -1,338 +0,0 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { ref, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { toDate, toCurrency, toPercentage } from 'filters/index';
|
||||
import CrudModel from 'components/CrudModel.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnDiscount from 'components/common/vnDiscount.vue';
|
||||
|
||||
const quasar = useQuasar();
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
||||
const stateStore = useStateStore();
|
||||
const arrayData = useArrayData('AccountLines');
|
||||
const store = arrayData.store;
|
||||
|
||||
const accountFilter = {
|
||||
fields: ['ticketFk'],
|
||||
};
|
||||
const linesFilter = {
|
||||
include: {
|
||||
relation: 'sale',
|
||||
scope: {
|
||||
fields: ['concept', 'ticketFk', 'price', 'quantity', 'discount', 'itemFk'],
|
||||
include: {
|
||||
relation: 'ticket',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const accountLinesForm = ref();
|
||||
const account = ref(null);
|
||||
async function onFetchAccount(data) {
|
||||
account.value = data;
|
||||
fetchMana();
|
||||
}
|
||||
|
||||
const amount = ref();
|
||||
const amountAccounted = ref();
|
||||
async function onFetch(rows, newRows) {
|
||||
if (newRows) rows = newRows;
|
||||
amount.value = 0;
|
||||
amountAccounted.value = 0;
|
||||
if (!rows || !rows.length) return;
|
||||
|
||||
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;
|
||||
amountAccounted.value = amountAccounted.value + (price - discount);
|
||||
}
|
||||
}
|
||||
|
||||
function totalRow({ price, quantity, discount }) {
|
||||
const amount = price * quantity;
|
||||
const appliedDiscount = (discount * amount) / 100;
|
||||
return amount - appliedDiscount;
|
||||
}
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'dated',
|
||||
label: t('Delivered'),
|
||||
field: ({ sale: { ticket } }) => toDate(ticket.landed),
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'quantity',
|
||||
label: t('Quantity'),
|
||||
field: ({ sale }) => sale.quantity,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'accounted',
|
||||
label: t('Accounted'),
|
||||
field: (row) => row.quantity,
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
label: t('Description'),
|
||||
field: ({ sale }) => sale.concept,
|
||||
},
|
||||
{
|
||||
name: 'price',
|
||||
label: t('Price'),
|
||||
field: ({ sale }) => sale.price,
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'discount',
|
||||
label: t('Discount'),
|
||||
field: ({ sale }) => sale.discount,
|
||||
format: (value) => toPercentage(value / 100),
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'total',
|
||||
label: t('Total'),
|
||||
field: ({ sale }) => totalRow(sale),
|
||||
format: (value) => toCurrency(value),
|
||||
sortable: true,
|
||||
},
|
||||
]);
|
||||
|
||||
const selected = ref([]);
|
||||
const mana = ref(0);
|
||||
async function fetchMana() {
|
||||
const ticketId = account.value.ticketFk;
|
||||
const response = await axios.get(`Tickets/${ticketId}/getSalesPersonMana`);
|
||||
mana.value = response.data;
|
||||
}
|
||||
|
||||
async function updateDiscount({ saleFk, discount, canceller }) {
|
||||
const body = { salesIds: [saleFk], newDiscount: discount };
|
||||
const accountId = account.value.ticketFk;
|
||||
const query = `Tickets/${accountId}/updateDiscount`;
|
||||
|
||||
await axios.post(query, body, {
|
||||
signal: canceller.signal,
|
||||
});
|
||||
await accountLinesForm.value.reload();
|
||||
}
|
||||
|
||||
function onUpdateDiscount(response) {
|
||||
const row = store.data[response.rowIndex];
|
||||
row.sale.discount = response.discount;
|
||||
quasar.notify({
|
||||
message: t('Discount updated'),
|
||||
type: 'positive',
|
||||
});
|
||||
}
|
||||
|
||||
async function saveWhenHasChanges() {
|
||||
if (accountLinesForm.value.getChanges().updates) {
|
||||
await accountLinesForm.value.onSubmit();
|
||||
await accountLinesForm.value.reload();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()">
|
||||
<div class="row q-gutter-md">
|
||||
<div>
|
||||
{{ t('Amount') }}
|
||||
<QChip :dense="$q.screen.lt.sm" text-color="white">
|
||||
{{ toCurrency(amount) }}
|
||||
</QChip>
|
||||
</div>
|
||||
<QSeparator dark vertical />
|
||||
<div>
|
||||
{{ t('Amount Accounted') }}
|
||||
<QChip color="positive" :dense="$q.screen.lt.sm">
|
||||
{{ toCurrency(amountAccounted) }}
|
||||
</QChip>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
|
||||
<FetchData
|
||||
:url="`Accounts/${route.params.id}`"
|
||||
:filter="accountFilter"
|
||||
@on-fetch="onFetchAccount"
|
||||
auto-load
|
||||
/>
|
||||
<div class="q-pa-md">
|
||||
<CrudModel
|
||||
data-key="AccountLines"
|
||||
ref="accountLinesForm"
|
||||
:url="`Accounts/${route.params.id}/lines`"
|
||||
save-url="AccountBeginnings/crud"
|
||||
:filter="linesFilter"
|
||||
@on-fetch="onFetch"
|
||||
v-model:selected="selected"
|
||||
:default-save="false"
|
||||
:default-reset="false"
|
||||
auto-load
|
||||
:limit="0"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
:columns="columns"
|
||||
:rows="rows"
|
||||
:dense="$q.screen.lt.md"
|
||||
row-key="id"
|
||||
selection="multiple"
|
||||
v-model:selected="selected"
|
||||
:grid="$q.screen.lt.md"
|
||||
>
|
||||
<template #body-cell-accounted="{ row }">
|
||||
<QTd auto-width align="right" class="text-primary">
|
||||
<QInput
|
||||
v-model="row.quantity"
|
||||
type="number"
|
||||
dense
|
||||
@keyup.enter="saveWhenHasChanges()"
|
||||
@blur="saveWhenHasChanges()"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-description="{ row, value }">
|
||||
<QTd auto-width align="right" class="text-primary">
|
||||
{{ value }} {{ row }}
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-discount="{ row, value, rowIndex }">
|
||||
<QTd auto-width align="right" class="text-primary">
|
||||
{{ value }}
|
||||
<VnDiscount
|
||||
:quantity="row.quantity"
|
||||
:price="row.sale.price"
|
||||
:discount="row.sale.discount"
|
||||
:mana="mana"
|
||||
:promise="updateDiscount"
|
||||
:data="{ saleFk: row.sale.id, rowIndex: rowIndex }"
|
||||
@on-update="onUpdateDiscount"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<!-- View for grid mode -->
|
||||
<template #item="props">
|
||||
<div
|
||||
class="q-mb-md col-12 grid-style-transition"
|
||||
:style="props.selected ? 'transform: scale(0.95);' : ''"
|
||||
>
|
||||
<QCard>
|
||||
<QCardSection>
|
||||
<QCheckbox v-model="props.selected" />
|
||||
</QCardSection>
|
||||
<QSeparator inset />
|
||||
<QList dense>
|
||||
<QItem
|
||||
v-for="column of props.cols"
|
||||
:key="column.name"
|
||||
>
|
||||
<QItemSection>
|
||||
<QItemLabel caption>
|
||||
{{ column.label }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
<QItemSection side>
|
||||
<template v-if="column.name === 'accounted'">
|
||||
<QItemLabel class="text-primary">
|
||||
<QInput
|
||||
v-model="props.row.quantity"
|
||||
type="number"
|
||||
dense
|
||||
autofocus
|
||||
@keyup.enter="
|
||||
saveWhenHasChanges()
|
||||
"
|
||||
@blur="saveWhenHasChanges()"
|
||||
/>
|
||||
</QItemLabel>
|
||||
</template>
|
||||
<template
|
||||
v-else-if="column.name === 'discount'"
|
||||
>
|
||||
<QItemLabel class="text-primary">
|
||||
{{ column.value }}
|
||||
<VnDiscount
|
||||
:quantity="props.row.quantity"
|
||||
:price="props.row.sale.price"
|
||||
:discount="
|
||||
props.row.sale.discount
|
||||
"
|
||||
:mana="mana"
|
||||
:promise="updateDiscount"
|
||||
:data="{
|
||||
saleFk: props.row.sale.id,
|
||||
rowIndex: props.rowIndex,
|
||||
}"
|
||||
@on-update="onUpdateDiscount"
|
||||
/>
|
||||
</QItemLabel>
|
||||
</template>
|
||||
<template v-else>
|
||||
<QItemLabel>
|
||||
{{ column.value }}
|
||||
</QItemLabel>
|
||||
</template>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QCard>
|
||||
</div>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
</CrudModel>
|
||||
</div>
|
||||
|
||||
<QPageSticky position="bottom-right" :offset="[25, 25]">
|
||||
<QBtn fab color="primary" icon="add" @click="showImportDialog()" />
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.list {
|
||||
padding-top: 50px;
|
||||
max-width: 900px;
|
||||
width: 100%;
|
||||
}
|
||||
.grid-style-transition {
|
||||
transition: transform 0.28s, background-color 0.28s;
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
You are about to remove {count} rows: '
|
||||
You are about to remove <strong>{count}</strong> row |
|
||||
You are about to remove <strong>{count}</strong> rows'
|
||||
es:
|
||||
Delivered: Entregado
|
||||
Quantity: Cantidad
|
||||
Accounted: Reclamada
|
||||
Description: Descripción
|
||||
Price: Precio
|
||||
Discount: Descuento
|
||||
Actions: Acciones
|
||||
Amount: Total
|
||||
Amount Accounted: Cantidad reclamada
|
||||
Delete accounted sales: Eliminar ventas reclamadas
|
||||
Discount updated: Descuento actualizado
|
||||
Accounted quantity: Cantidad reclamada
|
||||
You are about to remove {count} rows: '
|
||||
Vas a eliminar <strong>{count}</strong> línea |
|
||||
Vas a eliminar <strong>{count}</strong> líneas'
|
||||
</i18n>
|
|
@ -1,108 +0,0 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toDate, toCurrency } from 'src/filters';
|
||||
import CardSummary from 'components/ui/CardSummary.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import { getUrl } from 'src/composables/getUrl';
|
||||
import { useSession } from 'src/composables/useSession';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||
import axios from 'axios';
|
||||
import dashIfEmpty from 'src/filters/dashIfEmpty';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { getTokenMultimedia } = useSession();
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
const { store } = useArrayData('Account');
|
||||
const account = ref(store.data);
|
||||
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
const filter = {
|
||||
where: { id: entityId },
|
||||
fields: ['id', 'nickname', 'name', 'role'],
|
||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<CardSummary
|
||||
ref="AccountSummary"
|
||||
:url="`VnUsers/preview`"
|
||||
:filter="filter"
|
||||
@on-fetch="(data) => (account = data)"
|
||||
>
|
||||
<template #header>{{ account.id }} - {{ account.nickname }}</template>
|
||||
<template #body>
|
||||
<QCard class="vn-one">
|
||||
<QCardSection class="q-pa-none">
|
||||
<a
|
||||
class="header header-link"
|
||||
:href="`#/VnUser/${entityId}/basic-data`"
|
||||
>
|
||||
{{ t('globals.pageTitles.basicData') }}
|
||||
<QIcon name="open_in_new" />
|
||||
</a>
|
||||
</QCardSection>
|
||||
<VnLv :label="t('account.card.nickname')" :value="account.nickname" />
|
||||
<VnLv :label="t('account.card.role')" :value="account.role.name" />
|
||||
</QCard>
|
||||
</template>
|
||||
</CardSummary>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.q-dialog__inner--minimized > div {
|
||||
max-width: 80%;
|
||||
}
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: 15px;
|
||||
}
|
||||
.multimedia-container {
|
||||
flex: 1 0 21%;
|
||||
}
|
||||
.multimedia {
|
||||
transition: all 0.5s;
|
||||
opacity: 1;
|
||||
height: 250px;
|
||||
|
||||
.q-img {
|
||||
object-fit: cover;
|
||||
background-color: black;
|
||||
}
|
||||
video {
|
||||
object-fit: cover;
|
||||
background-color: black;
|
||||
}
|
||||
}
|
||||
|
||||
.multimedia:hover {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
top: 1%;
|
||||
right: 10%;
|
||||
}
|
||||
|
||||
.zindex {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.change-state {
|
||||
width: 10%;
|
||||
}
|
||||
</style>
|
|
@ -50,49 +50,3 @@ const filter = {
|
|||
</template>
|
||||
</CardSummary>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.q-dialog__inner--minimized > div {
|
||||
max-width: 80%;
|
||||
}
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: 15px;
|
||||
}
|
||||
.multimedia-container {
|
||||
flex: 1 0 21%;
|
||||
}
|
||||
.multimedia {
|
||||
transition: all 0.5s;
|
||||
opacity: 1;
|
||||
height: 250px;
|
||||
|
||||
.q-img {
|
||||
object-fit: cover;
|
||||
background-color: black;
|
||||
}
|
||||
video {
|
||||
object-fit: cover;
|
||||
background-color: black;
|
||||
}
|
||||
}
|
||||
|
||||
.multimedia:hover {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.close-button {
|
||||
top: 1%;
|
||||
right: 10%;
|
||||
}
|
||||
|
||||
.zindex {
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.change-state {
|
||||
width: 10%;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue