forked from verdnatura/salix-front
Merge pull request '8093-devToTest_2442_3' (!831) from 8093-devToTest_2442_3 into test
Reviewed-on: verdnatura/salix-front#831 Reviewed-by: Carlos Satorres <carlossa@verdnatura.es>
This commit is contained in:
commit
a33dde3dcf
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "24.40.0",
|
||||
"version": "24.42.0",
|
||||
"description": "Salix frontend",
|
||||
"productName": "Salix",
|
||||
"author": "Verdnatura",
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
import { QInput } from 'quasar';
|
||||
import setDefault from './setDefault';
|
||||
|
||||
setDefault(QInput, 'dense', true);
|
|
@ -0,0 +1,4 @@
|
|||
import { QSelect } from 'quasar';
|
||||
import setDefault from './setDefault';
|
||||
|
||||
setDefault(QSelect, 'dense', true);
|
|
@ -1 +1,3 @@
|
|||
export * from './defaults/qTable';
|
||||
export * from './defaults/qInput';
|
||||
export * from './defaults/qSelect';
|
||||
|
|
|
@ -1,35 +1,42 @@
|
|||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelectProvince from 'components/VnSelectProvince.vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
import FormModelPopup from './FormModelPopup.vue';
|
||||
|
||||
const emit = defineEmits(['onDataSaved']);
|
||||
|
||||
const $props = defineProps({
|
||||
countryFk: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
provinceSelected: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
provinces: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const { t } = useI18n();
|
||||
|
||||
const cityFormData = reactive({
|
||||
const cityFormData = ref({
|
||||
name: null,
|
||||
provinceFk: null,
|
||||
});
|
||||
|
||||
const provincesOptions = ref([]);
|
||||
|
||||
onMounted(() => {
|
||||
cityFormData.value.provinceFk = $props.provinceSelected;
|
||||
});
|
||||
const onDataSaved = (...args) => {
|
||||
emit('onDataSaved', ...args);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (provincesOptions = data)"
|
||||
auto-load
|
||||
url="Provinces"
|
||||
/>
|
||||
<FormModelPopup
|
||||
:title="t('New city')"
|
||||
:subtitle="t('Please, ensure you put the correct data!')"
|
||||
|
@ -41,11 +48,16 @@ const onDataSaved = (...args) => {
|
|||
<template #form-inputs="{ data, validate }">
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('Name')"
|
||||
:label="t('Names')"
|
||||
v-model="data.name"
|
||||
:rules="validate('city.name')"
|
||||
/>
|
||||
<VnSelectProvince v-model="data.provinceFk" />
|
||||
<VnSelectProvince
|
||||
:province-selected="$props.provinceSelected"
|
||||
:country-fk="$props.countryFk"
|
||||
v-model="data.provinceFk"
|
||||
:provinces="$props.provinces"
|
||||
/>
|
||||
</VnRow>
|
||||
</template>
|
||||
</FormModelPopup>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -22,9 +22,11 @@ const postcodeFormData = reactive({
|
|||
townFk: null,
|
||||
});
|
||||
|
||||
const townsFetchDataRef = ref(null);
|
||||
const provincesFetchDataRef = ref(null);
|
||||
const countriesOptions = ref([]);
|
||||
const provincesOptions = ref([]);
|
||||
const townsOptions = ref([]);
|
||||
const town = ref({});
|
||||
|
||||
function onDataSaved(formData) {
|
||||
|
@ -61,26 +63,78 @@ function setTown(newTown, data) {
|
|||
}
|
||||
|
||||
async function setProvince(id, data) {
|
||||
await provincesFetchDataRef.value.fetch();
|
||||
const newProvince = provincesOptions.value.find((province) => province.id == id);
|
||||
if (!newProvince) return;
|
||||
|
||||
data.countryFk = newProvince.countryFk;
|
||||
}
|
||||
|
||||
async function onProvinceCreated(data) {
|
||||
await provincesFetchDataRef.value.fetch({
|
||||
where: { countryFk: postcodeFormData.countryFk },
|
||||
});
|
||||
postcodeFormData.provinceFk.value = data.id;
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [postcodeFormData.countryFk],
|
||||
async (newCountryFk, oldValueFk) => {
|
||||
if (!!oldValueFk[0] && newCountryFk[0] !== oldValueFk[0]) {
|
||||
postcodeFormData.provinceFk = null;
|
||||
postcodeFormData.townFk = null;
|
||||
}
|
||||
if ((newCountryFk, newCountryFk !== postcodeFormData.countryFk)) {
|
||||
await provincesFetchDataRef.value.fetch({
|
||||
where: {
|
||||
countryFk: newCountryFk[0],
|
||||
},
|
||||
});
|
||||
await townsFetchDataRef.value.fetch({
|
||||
where: {
|
||||
provinceFk: {
|
||||
inq: provincesOptions.value.map(({ id }) => id),
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
watch(
|
||||
() => postcodeFormData.provinceFk,
|
||||
async (newProvinceFk) => {
|
||||
if (newProvinceFk[0] && newProvinceFk[0] !== postcodeFormData.provinceFk) {
|
||||
await townsFetchDataRef.value.fetch({
|
||||
where: { provinceFk: newProvinceFk[0] },
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
async function handleProvinces(data) {
|
||||
provincesOptions.value = data;
|
||||
}
|
||||
async function handleTowns(data) {
|
||||
townsOptions.value = data;
|
||||
}
|
||||
async function handleCountries(data) {
|
||||
countriesOptions.value = data;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="provincesFetchDataRef"
|
||||
@on-fetch="(data) => (provincesOptions = data)"
|
||||
@on-fetch="handleProvinces"
|
||||
auto-load
|
||||
url="Provinces/location"
|
||||
/>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (countriesOptions = data)"
|
||||
ref="townsFetchDataRef"
|
||||
@on-fetch="handleTowns"
|
||||
auto-load
|
||||
url="Countries"
|
||||
url="Towns/location"
|
||||
/>
|
||||
<FetchData @on-fetch="handleCountries" auto-load url="Countries" />
|
||||
<FormModelPopup
|
||||
url-create="postcodes"
|
||||
model="postcode"
|
||||
|
@ -96,18 +150,20 @@ async function setProvince(id, data) {
|
|||
:label="t('Postcode')"
|
||||
v-model="data.code"
|
||||
:rules="validate('postcode.code')"
|
||||
clearable
|
||||
/>
|
||||
<VnSelectDialog
|
||||
:label="t('City')"
|
||||
url="Towns/location"
|
||||
@update:model-value="(value) => setTown(value, data)"
|
||||
:tooltip="t('Create city')"
|
||||
v-model="data.townFk"
|
||||
:options="townsOptions"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
:rules="validate('postcode.city')"
|
||||
:acls="[{ model: 'Town', props: '*', accessType: 'WRITE' }]"
|
||||
:emit-value="false"
|
||||
clearable
|
||||
:clearable="true"
|
||||
>
|
||||
<template #option="{ itemProps, opt }">
|
||||
<QItem v-bind="itemProps">
|
||||
|
@ -122,6 +178,9 @@ async function setProvince(id, data) {
|
|||
</template>
|
||||
<template #form>
|
||||
<CreateNewCityForm
|
||||
:country-fk="data.countryFk"
|
||||
:province-selected="data.provinceFk"
|
||||
:provinces="provincesOptions"
|
||||
@on-data-saved="
|
||||
(_, requestResponse) =>
|
||||
onCityCreated(requestResponse, data)
|
||||
|
@ -132,8 +191,13 @@ async function setProvince(id, data) {
|
|||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelectProvince
|
||||
:country-fk="data.countryFk"
|
||||
:province-selected="data.provinceFk"
|
||||
@update:model-value="(value) => setProvince(value, data)"
|
||||
v-model="data.provinceFk"
|
||||
:clearable="true"
|
||||
:provinces="provincesOptions"
|
||||
@on-province-created="onProvinceCreated"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('Country')"
|
||||
|
@ -152,6 +216,7 @@ async function setProvince(id, data) {
|
|||
<i18n>
|
||||
es:
|
||||
New postcode: Nuevo código postal
|
||||
Create city: Crear población
|
||||
Please, ensure you put the correct data!: ¡Por favor, asegúrese de poner los datos correctos!
|
||||
City: Población
|
||||
Province: Provincia
|
||||
|
|
|
@ -16,7 +16,16 @@ const provinceFormData = reactive({
|
|||
name: null,
|
||||
autonomyFk: null,
|
||||
});
|
||||
|
||||
const $props = defineProps({
|
||||
countryFk: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
provinces: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const autonomiesOptions = ref([]);
|
||||
|
||||
const onDataSaved = (dataSaved, requestResponse) => {
|
||||
|
@ -31,6 +40,11 @@ const onDataSaved = (dataSaved, requestResponse) => {
|
|||
<FetchData
|
||||
@on-fetch="(data) => (autonomiesOptions = data)"
|
||||
auto-load
|
||||
:filter="{
|
||||
where: {
|
||||
countryFk: $props.countryFk,
|
||||
},
|
||||
}"
|
||||
url="Autonomies/location"
|
||||
/>
|
||||
<FormModelPopup
|
||||
|
|
|
@ -50,7 +50,7 @@ const onDataSaved = (dataSaved) => {
|
|||
model="thermograph"
|
||||
:title="t('New thermograph')"
|
||||
:form-initial-data="thermographFormData"
|
||||
@on-data-saved="onDataSaved($event)"
|
||||
@on-data-saved="(_, response) => onDataSaved(response)"
|
||||
>
|
||||
<template #form-inputs="{ data, validate }">
|
||||
<VnRow>
|
||||
|
|
|
@ -234,6 +234,8 @@ async function remove(data) {
|
|||
newData = newData.filter((form) => !ids.some((id) => id == form[pk]));
|
||||
fetch(newData);
|
||||
});
|
||||
} else {
|
||||
reset();
|
||||
}
|
||||
emit('update:selected', []);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ const itemComputed = computed(() => {
|
|||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.q-item {
|
||||
min-height: 5vh;
|
||||
|
|
|
@ -13,12 +13,14 @@ import FetchData from 'components/FetchData.vue';
|
|||
import { useClipboard } from 'src/composables/useClipboard';
|
||||
import { useRole } from 'src/composables/useRole';
|
||||
import VnAvatar from './ui/VnAvatar.vue';
|
||||
import useNotify from 'src/composables/useNotify';
|
||||
|
||||
const state = useState();
|
||||
const session = useSession();
|
||||
const router = useRouter();
|
||||
const { t, locale } = useI18n();
|
||||
const { copyText } = useClipboard();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const userLocale = computed({
|
||||
get() {
|
||||
|
@ -53,6 +55,7 @@ const user = state.getUser();
|
|||
const warehousesData = ref();
|
||||
const companiesData = ref();
|
||||
const accountBankData = ref();
|
||||
const isEmployee = computed(() => useRole().isEmployee());
|
||||
|
||||
onMounted(async () => {
|
||||
updatePreferences();
|
||||
|
@ -70,18 +73,28 @@ function updatePreferences() {
|
|||
|
||||
async function saveDarkMode(value) {
|
||||
const query = `/UserConfigs/${user.value.id}`;
|
||||
try {
|
||||
await axios.patch(query, {
|
||||
darkMode: value,
|
||||
});
|
||||
user.value.darkMode = value;
|
||||
onDataSaved();
|
||||
} catch (error) {
|
||||
onDataError();
|
||||
}
|
||||
}
|
||||
|
||||
async function saveLanguage(value) {
|
||||
const query = `/VnUsers/${user.value.id}`;
|
||||
try {
|
||||
await axios.patch(query, {
|
||||
lang: value,
|
||||
});
|
||||
user.value.lang = value;
|
||||
onDataSaved();
|
||||
} catch (error) {
|
||||
onDataError();
|
||||
}
|
||||
}
|
||||
|
||||
function logout() {
|
||||
|
@ -97,11 +110,23 @@ function localUserData() {
|
|||
state.setUser(user.value);
|
||||
}
|
||||
|
||||
function saveUserData(param, value) {
|
||||
axios.post('UserConfigs/setUserConfig', { [param]: value });
|
||||
async function saveUserData(param, value) {
|
||||
try {
|
||||
await axios.post('UserConfigs/setUserConfig', { [param]: value });
|
||||
localUserData();
|
||||
onDataSaved();
|
||||
} catch (error) {
|
||||
onDataError();
|
||||
}
|
||||
}
|
||||
const isEmployee = computed(() => useRole().isEmployee());
|
||||
|
||||
const onDataSaved = () => {
|
||||
notify('globals.dataSaved', 'positive');
|
||||
};
|
||||
|
||||
const onDataError = () => {
|
||||
notify('errors.updateUserConfig', 'negative');
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -8,33 +8,55 @@ import FetchData from 'components/FetchData.vue';
|
|||
import CreateNewProvinceForm from './CreateNewProvinceForm.vue';
|
||||
|
||||
const emit = defineEmits(['onProvinceCreated']);
|
||||
const provinceFk = defineModel({ type: Number });
|
||||
watch(provinceFk, async () => await provincesFetchDataRef.value.fetch());
|
||||
const $props = defineProps({
|
||||
countryFk: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
provinceSelected: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
provinces: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
});
|
||||
const provinceFk = defineModel({ type: Number, default: null });
|
||||
|
||||
const { validate } = useValidator();
|
||||
const { t } = useI18n();
|
||||
|
||||
const provincesOptions = ref();
|
||||
const provincesOptions = ref($props.provinces);
|
||||
provinceFk.value = $props.provinceSelected;
|
||||
const provincesFetchDataRef = ref();
|
||||
|
||||
async function onProvinceCreated(_, data) {
|
||||
await provincesFetchDataRef.value.fetch();
|
||||
await provincesFetchDataRef.value.fetch({ where: { countryFk: $props.countryFk } });
|
||||
provinceFk.value = data.id;
|
||||
emit('onProvinceCreated', data);
|
||||
}
|
||||
async function handleProvinces(data) {
|
||||
provincesOptions.value = data;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
ref="provincesFetchDataRef"
|
||||
:filter="{ include: { relation: 'country' } }"
|
||||
@on-fetch="(data) => (provincesOptions = data)"
|
||||
auto-load
|
||||
:filter="{
|
||||
include: { relation: 'country' },
|
||||
where: {
|
||||
countryFk: $props.countryFk,
|
||||
},
|
||||
}"
|
||||
@on-fetch="handleProvinces"
|
||||
url="Provinces"
|
||||
/>
|
||||
<VnSelectDialog
|
||||
:label="t('Province')"
|
||||
:options="provincesOptions"
|
||||
:options="$props.provinces"
|
||||
:tooltip="t('Create province')"
|
||||
hide-selected
|
||||
v-model="provinceFk"
|
||||
:rules="validate && validate('postcode.provinceFk')"
|
||||
|
@ -49,11 +71,15 @@ async function onProvinceCreated(_, data) {
|
|||
</QItem>
|
||||
</template>
|
||||
<template #form>
|
||||
<CreateNewProvinceForm @on-data-saved="onProvinceCreated" />
|
||||
<CreateNewProvinceForm
|
||||
:country-fk="$props.countryFk"
|
||||
@on-data-saved="onProvinceCreated"
|
||||
/>
|
||||
</template>
|
||||
</VnSelectDialog>
|
||||
</template>
|
||||
<i18n>
|
||||
es:
|
||||
Province: Provincia
|
||||
Create province: Crear provincia
|
||||
</i18n>
|
||||
|
|
|
@ -10,7 +10,7 @@ import FormModelPopup from 'components/FormModelPopup.vue';
|
|||
|
||||
import VnFilterPanel from 'components/ui/VnFilterPanel.vue';
|
||||
import VnTableColumn from 'components/VnTable/VnColumn.vue';
|
||||
import VnTableFilter from 'components/VnTable/VnFilter.vue';
|
||||
import VnFilter from 'components/VnTable/VnFilter.vue';
|
||||
import VnTableChip from 'components/VnTable/VnChip.vue';
|
||||
import VnVisibleColumn from 'src/components/VnTable/VnVisibleColumn.vue';
|
||||
import VnLv from 'components/ui/VnLv.vue';
|
||||
|
@ -53,6 +53,10 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
bottom: {
|
||||
type: Object,
|
||||
default: null,
|
||||
},
|
||||
cardClass: {
|
||||
type: String,
|
||||
default: 'flex-one',
|
||||
|
@ -69,7 +73,6 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
|
||||
hasSubToolbar: {
|
||||
type: Boolean,
|
||||
default: null,
|
||||
|
@ -106,6 +109,10 @@ const $props = defineProps({
|
|||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
disabledAttr: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
const { t } = useI18n();
|
||||
const stateStore = useStateStore();
|
||||
|
@ -347,7 +354,7 @@ function handleOnDataSaved(_) {
|
|||
)"
|
||||
:key="col.id"
|
||||
>
|
||||
<VnTableFilter
|
||||
<VnFilter
|
||||
ref="tableFilterRef"
|
||||
:column="col"
|
||||
:data-key="$attrs['data-key']"
|
||||
|
@ -460,7 +467,7 @@ function handleOnDataSaved(_) {
|
|||
:search-url="searchUrl"
|
||||
/>
|
||||
</div>
|
||||
<VnTableFilter
|
||||
<VnFilter
|
||||
v-if="$props.columnSearch"
|
||||
:column="col"
|
||||
:show-title="true"
|
||||
|
@ -490,6 +497,7 @@ function handleOnDataSaved(_) {
|
|||
auto-width
|
||||
class="no-margin q-px-xs"
|
||||
:class="[getColAlign(col), col.columnClass]"
|
||||
:style="col.style"
|
||||
v-if="col.visible ?? true"
|
||||
@click.ctrl="
|
||||
($event) =>
|
||||
|
@ -518,6 +526,7 @@ function handleOnDataSaved(_) {
|
|||
:class="getColAlign(col)"
|
||||
class="sticky no-padding"
|
||||
@click="stopEventPropagation($event)"
|
||||
:style="col.style"
|
||||
>
|
||||
<QBtn
|
||||
v-for="(btn, index) of col.actions"
|
||||
|
@ -538,6 +547,29 @@ function handleOnDataSaved(_) {
|
|||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #bottom v-if="bottom">
|
||||
<slot name="bottom-table">
|
||||
<QBtn
|
||||
@click="
|
||||
() =>
|
||||
createAsDialog
|
||||
? (showForm = !showForm)
|
||||
: handleOnDataSaved(create)
|
||||
"
|
||||
class="cursor-pointer fill-icon"
|
||||
color="primary"
|
||||
icon="add_circle"
|
||||
size="md"
|
||||
round
|
||||
flat
|
||||
shortcut="+"
|
||||
:disabled="!disabledAttr"
|
||||
/>
|
||||
<QTooltip>
|
||||
{{ createForm.title }}
|
||||
</QTooltip>
|
||||
</slot>
|
||||
</template>
|
||||
<template #item="{ row, colsMap }">
|
||||
<component
|
||||
:is="$props.redirect ? 'router-link' : 'span'"
|
||||
|
@ -654,17 +686,15 @@ function handleOnDataSaved(_) {
|
|||
</QCard>
|
||||
</component>
|
||||
</template>
|
||||
<template #bottom-row="{ cols }" v-if="footer">
|
||||
<QTr v-if="rows.length" class="bg-header" style="height: 30px">
|
||||
<template #bottom-row="{ cols }" v-if="$props.footer">
|
||||
<QTr v-if="rows.length" style="height: 30px">
|
||||
<QTh
|
||||
v-for="col of cols.filter((cols) => cols.visible ?? true)"
|
||||
:key="col?.id"
|
||||
class="text-center"
|
||||
>
|
||||
<slot
|
||||
:name="`column-footer-${col.name}`"
|
||||
:class="getColAlign(col)"
|
||||
/>
|
||||
>
|
||||
<slot :name="`column-footer-${col.name}`" />
|
||||
</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
|
@ -682,7 +712,7 @@ function handleOnDataSaved(_) {
|
|||
icon="add"
|
||||
shortcut="+"
|
||||
/>
|
||||
<QTooltip>
|
||||
<QTooltip self="top right">
|
||||
{{ createForm?.title }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
|
@ -743,16 +773,6 @@ es:
|
|||
color: var(--vn-text-color);
|
||||
}
|
||||
|
||||
.q-table--dark .q-table__bottom,
|
||||
.q-table--dark thead,
|
||||
.q-table--dark tr {
|
||||
border-color: var(--vn-section-color);
|
||||
}
|
||||
|
||||
.q-table__container > div:first-child {
|
||||
background-color: var(--vn-page-color);
|
||||
}
|
||||
|
||||
.grid-three {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(400px, max-content));
|
||||
|
@ -826,6 +846,15 @@ es:
|
|||
background-color: var(--vn-section-color);
|
||||
z-index: 1;
|
||||
}
|
||||
table tbody th {
|
||||
position: relative;
|
||||
}
|
||||
tbody:nth-last-child(1) {
|
||||
@extend .bg-header;
|
||||
position: sticky;
|
||||
z-index: 2;
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.vn-label-value {
|
||||
|
@ -871,4 +900,12 @@ es:
|
|||
cursor: text;
|
||||
user-select: all;
|
||||
}
|
||||
|
||||
.q-table__container {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.q-table__middle.q-virtual-scroll.q-virtual-scroll--vertical.scroll {
|
||||
background-color: var(--vn-section-color);
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnRow from '../ui/VnRow.vue';
|
||||
import VnInput from './VnInput.vue';
|
||||
import FetchData from '../FetchData.vue';
|
||||
import useNotify from 'src/composables/useNotify';
|
||||
|
||||
const props = defineProps({
|
||||
submitFn: { type: Function, default: () => {} },
|
||||
askOldPass: { type: Boolean, default: false },
|
||||
});
|
||||
const emit = defineEmits(['onSubmit']);
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const form = ref();
|
||||
const changePassDialog = ref();
|
||||
const passwords = ref({ newPassword: null, repeatPassword: null });
|
||||
const requirements = ref([]);
|
||||
const isLoading = ref(false);
|
||||
|
||||
const validate = async () => {
|
||||
const { newPassword, repeatPassword, oldPassword } = passwords.value;
|
||||
|
||||
if (!newPassword) {
|
||||
notify(t('You must enter a new password'), 'negative');
|
||||
return;
|
||||
}
|
||||
if (newPassword !== repeatPassword) {
|
||||
notify(t("Passwords don't match"), 'negative');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
isLoading.value = true;
|
||||
await props.submitFn(newPassword, oldPassword);
|
||||
emit('onSubmit');
|
||||
} catch (e) {
|
||||
notify('errors.writeRequest', 'negative');
|
||||
} finally {
|
||||
changePassDialog.value.hide();
|
||||
isLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
defineExpose({ show: () => changePassDialog.value.show() });
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="UserPasswords/findOne"
|
||||
auto-load
|
||||
@on-fetch="(data) => (requirements = data)"
|
||||
/>
|
||||
<QDialog ref="changePassDialog">
|
||||
<QCard style="width: 350px">
|
||||
<QCardSection>
|
||||
<slot name="header">
|
||||
<VnRow class="items-center" style="flex-direction: row">
|
||||
<span class="text-h6" v-text="t('globals.changePass')" />
|
||||
<QIcon
|
||||
class="cursor-pointer"
|
||||
name="close"
|
||||
size="xs"
|
||||
style="flex: 0"
|
||||
v-close-popup
|
||||
/>
|
||||
</VnRow>
|
||||
</slot>
|
||||
</QCardSection>
|
||||
<QForm ref="form">
|
||||
<QCardSection>
|
||||
<VnInput
|
||||
v-if="props.askOldPass"
|
||||
:label="t('Old password')"
|
||||
v-model="passwords.oldPassword"
|
||||
type="password"
|
||||
:required="true"
|
||||
autofocus
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('New password')"
|
||||
v-model="passwords.newPassword"
|
||||
type="password"
|
||||
:required="true"
|
||||
:info="
|
||||
t('passwordRequirements', {
|
||||
length: requirements.length,
|
||||
nAlpha: requirements.nAlpha,
|
||||
nUpper: requirements.nUpper,
|
||||
nDigits: requirements.nDigits,
|
||||
nPunct: requirements.nPunct,
|
||||
})
|
||||
"
|
||||
autofocus
|
||||
/>
|
||||
|
||||
<VnInput
|
||||
:label="t('Repeat password')"
|
||||
v-model="passwords.repeatPassword"
|
||||
type="password"
|
||||
/>
|
||||
</QCardSection>
|
||||
</QForm>
|
||||
<QCardActions>
|
||||
<slot name="actions">
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
:label="t('globals.cancel')"
|
||||
class="q-ml-sm"
|
||||
color="primary"
|
||||
flat
|
||||
type="reset"
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:loading="isLoading"
|
||||
:label="t('globals.confirm')"
|
||||
color="primary"
|
||||
@click="validate"
|
||||
/>
|
||||
</slot>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
New password: Nueva contraseña
|
||||
Repeat password: Repetir contraseña
|
||||
You must enter a new password: Debes introducir la nueva contraseña
|
||||
Passwords don't match: Las contraseñas no coinciden
|
||||
</i18n>
|
|
@ -0,0 +1,29 @@
|
|||
<script setup>
|
||||
const model = defineModel({ type: [String, Number], required: true });
|
||||
</script>
|
||||
<template>
|
||||
<QDate v-model="model" :today-btn="true" :options="$attrs.options" />
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.q-date {
|
||||
width: 245px;
|
||||
min-width: unset;
|
||||
|
||||
:deep(.q-date__calendar) {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
:deep(.q-date__view) {
|
||||
min-height: 245px;
|
||||
padding: 8px;
|
||||
}
|
||||
:deep(.q-date__calendar-days-container) {
|
||||
min-height: 160px;
|
||||
height: unset;
|
||||
}
|
||||
|
||||
:deep(.q-date__header) {
|
||||
padding: 2px 2px 5px 12px;
|
||||
height: 60px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -103,6 +103,7 @@ const mixinRules = [
|
|||
@click="
|
||||
() => {
|
||||
value = null;
|
||||
vnInputRef.focus();
|
||||
emit('remove');
|
||||
}
|
||||
"
|
||||
|
|
|
@ -3,6 +3,7 @@ import { onMounted, watch, computed, ref } from 'vue';
|
|||
import { date } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useAttrs } from 'vue';
|
||||
import VnDate from './VnDate.vue';
|
||||
|
||||
const model = defineModel({ type: [String, Date] });
|
||||
const $props = defineProps({
|
||||
|
@ -20,6 +21,7 @@ const { validations } = useValidator();
|
|||
|
||||
const { t } = useI18n();
|
||||
const requiredFieldRule = (val) => validations().required($attrs.required, val);
|
||||
const vnInputDateRef = ref(null);
|
||||
|
||||
const dateFormat = 'DD/MM/YYYY';
|
||||
const isPopupOpen = ref();
|
||||
|
@ -86,11 +88,17 @@ const styleAttrs = computed(() => {
|
|||
}
|
||||
: {};
|
||||
});
|
||||
|
||||
const manageDate = (date) => {
|
||||
formattedDate.value = date;
|
||||
isPopupOpen.value = false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div @mouseover="hover = true" @mouseleave="hover = false">
|
||||
<QInput
|
||||
ref="vnInputDateRef"
|
||||
v-model="formattedDate"
|
||||
class="vn-input-date"
|
||||
:mask="mask"
|
||||
|
@ -113,6 +121,7 @@ const styleAttrs = computed(() => {
|
|||
!$attrs.disable
|
||||
"
|
||||
@click="
|
||||
vnInputDateRef.focus();
|
||||
model = null;
|
||||
isPopupOpen = false;
|
||||
"
|
||||
|
@ -126,6 +135,7 @@ const styleAttrs = computed(() => {
|
|||
/>
|
||||
</template>
|
||||
<QMenu
|
||||
v-if="$q.screen.gt.xs"
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
v-model="isPopupOpen"
|
||||
|
@ -134,19 +144,11 @@ const styleAttrs = computed(() => {
|
|||
:no-focus="true"
|
||||
:no-parent-event="true"
|
||||
>
|
||||
<QDate
|
||||
v-model="popupDate"
|
||||
:landscape="true"
|
||||
:today-btn="true"
|
||||
:options="$attrs.options"
|
||||
@update:model-value="
|
||||
(date) => {
|
||||
formattedDate = date;
|
||||
isPopupOpen = false;
|
||||
}
|
||||
"
|
||||
/>
|
||||
<VnDate v-model="popupDate" @update:model-value="manageDate" />
|
||||
</QMenu>
|
||||
<QDialog v-else v-model="isPopupOpen">
|
||||
<VnDate v-model="popupDate" @update:model-value="manageDate" />
|
||||
</QDialog>
|
||||
</QInput>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -3,6 +3,8 @@ import { computed, ref, useAttrs } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { date } from 'quasar';
|
||||
import { useValidator } from 'src/composables/useValidator';
|
||||
import VnTime from './VnTime.vue';
|
||||
|
||||
const { validations } = useValidator();
|
||||
const $attrs = useAttrs();
|
||||
const model = defineModel({ type: String });
|
||||
|
@ -16,6 +18,7 @@ const props = defineProps({
|
|||
default: false,
|
||||
},
|
||||
});
|
||||
const vnInputTimeRef = ref(null);
|
||||
const initialDate = ref(model.value ?? Date.vnNew());
|
||||
const { t } = useI18n();
|
||||
const requiredFieldRule = (val) => validations().required($attrs.required, val);
|
||||
|
@ -69,6 +72,7 @@ function dateToTime(newDate) {
|
|||
<template>
|
||||
<div @mouseover="hover = true" @mouseleave="hover = false">
|
||||
<QInput
|
||||
ref="vnInputTimeRef"
|
||||
class="vn-input-time"
|
||||
mask="##:##"
|
||||
placeholder="--:--"
|
||||
|
@ -92,6 +96,7 @@ function dateToTime(newDate) {
|
|||
!$attrs.disable
|
||||
"
|
||||
@click="
|
||||
vnInputTimeRef.focus();
|
||||
model = null;
|
||||
isPopupOpen = false;
|
||||
"
|
||||
|
@ -104,6 +109,7 @@ function dateToTime(newDate) {
|
|||
/>
|
||||
</template>
|
||||
<QMenu
|
||||
v-if="$q.screen.gt.xs"
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
v-model="isPopupOpen"
|
||||
|
@ -112,8 +118,11 @@ function dateToTime(newDate) {
|
|||
:no-focus="true"
|
||||
:no-parent-event="true"
|
||||
>
|
||||
<QTime v-model="formattedTime" mask="HH:mm" landscape now-btn />
|
||||
<VnTime v-model="formattedTime" />
|
||||
</QMenu>
|
||||
<QDialog v-else v-model="isPopupOpen">
|
||||
<VnTime v-model="formattedTime" />
|
||||
</QDialog>
|
||||
</QInput>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -12,6 +12,16 @@ const props = defineProps({
|
|||
default: null,
|
||||
},
|
||||
});
|
||||
|
||||
const locationProperties = [
|
||||
'postcode',
|
||||
(obj) =>
|
||||
obj.city
|
||||
? `${obj.city}${obj.province?.name ? `(${obj.province.name})` : ''}`
|
||||
: null,
|
||||
(obj) => obj.country?.name,
|
||||
];
|
||||
|
||||
const formatLocation = (obj, properties) => {
|
||||
const parts = properties.map((prop) => {
|
||||
if (typeof prop === 'string') {
|
||||
|
@ -29,23 +39,10 @@ const formatLocation = (obj, properties) => {
|
|||
return filteredParts.join(', ');
|
||||
};
|
||||
|
||||
const locationProperties = [
|
||||
'postcode',
|
||||
(obj) =>
|
||||
obj.city
|
||||
? `${obj.city}${obj.province?.name ? `(${obj.province.name})` : ''}`
|
||||
: null,
|
||||
(obj) => obj.country?.name,
|
||||
];
|
||||
|
||||
const modelValue = ref(
|
||||
props.location ? formatLocation(props.location, locationProperties) : null
|
||||
);
|
||||
|
||||
const handleModelValue = (data) => {
|
||||
emit('update:model-value', data);
|
||||
};
|
||||
|
||||
function showLabel(data) {
|
||||
const dataProperties = [
|
||||
'code',
|
||||
|
@ -54,6 +51,10 @@ function showLabel(data) {
|
|||
];
|
||||
return formatLocation(data, dataProperties);
|
||||
}
|
||||
|
||||
const handleModelValue = (data) => {
|
||||
emit('update:model-value', data);
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
<VnSelectDialog
|
||||
|
@ -72,6 +73,7 @@ function showLabel(data) {
|
|||
v-bind="$attrs"
|
||||
clearable
|
||||
:emit-value="false"
|
||||
:tooltip="t('Create new location')"
|
||||
>
|
||||
<template #form>
|
||||
<CreateNewPostcode
|
||||
|
@ -104,7 +106,9 @@ function showLabel(data) {
|
|||
<i18n>
|
||||
en:
|
||||
search_by_postalcode: Search by postalcode, town, province or country
|
||||
Create new location: Create new location
|
||||
es:
|
||||
Location: Ubicación
|
||||
Create new location: Crear nueva ubicación
|
||||
search_by_postalcode: Buscar por código postal, ciudad o país
|
||||
</i18n>
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<script setup>
|
||||
const model = defineModel({ type: [String, Number], required: true });
|
||||
</script>
|
||||
<template>
|
||||
<QTime v-model="model" now-btn mask="HH:mm" />
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.q-time {
|
||||
width: 230px;
|
||||
min-width: unset;
|
||||
:deep(.q-time__header) {
|
||||
min-height: unset;
|
||||
height: 50px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -47,6 +47,7 @@ let store;
|
|||
let entity;
|
||||
const isLoading = ref(false);
|
||||
const isSameDataKey = computed(() => $props.dataKey === route.meta.moduleName);
|
||||
const menuRef = ref();
|
||||
defineExpose({ getData });
|
||||
|
||||
onBeforeMount(async () => {
|
||||
|
@ -170,7 +171,7 @@ const toModule = computed(() =>
|
|||
<QTooltip>
|
||||
{{ t('components.cardDescriptor.moreOptions') }}
|
||||
</QTooltip>
|
||||
<QMenu ref="menuRef">
|
||||
<QMenu :ref="menuRef">
|
||||
<QList>
|
||||
<slot name="menu" :entity="entity" :menu-ref="menuRef" />
|
||||
</QList>
|
||||
|
|
|
@ -3,7 +3,6 @@ import { onMounted, ref, computed, watch } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { date } from 'quasar';
|
||||
import toDate from 'filters/toDate';
|
||||
import VnFilterPanelChip from 'components/ui/VnFilterPanelChip.vue';
|
||||
|
||||
|
@ -59,7 +58,6 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
defineExpose({ search, sanitizer });
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:modelValue',
|
||||
'refresh',
|
||||
|
@ -114,9 +112,9 @@ watch(
|
|||
);
|
||||
|
||||
const isLoading = ref(false);
|
||||
async function search() {
|
||||
async function search(evt) {
|
||||
try {
|
||||
if ($props.disableSubmitEvent) return;
|
||||
if (evt && $props.disableSubmitEvent) return;
|
||||
|
||||
store.filter.where = {};
|
||||
isLoading.value = true;
|
||||
|
@ -167,7 +165,7 @@ const tagsList = computed(() => {
|
|||
for (const key of Object.keys(userParams.value)) {
|
||||
const value = userParams.value[key];
|
||||
if (value == null || ($props.hiddenTags || []).includes(key)) continue;
|
||||
tagList.push({ label: aliasField(key), value });
|
||||
tagList.push({ label: key, value });
|
||||
}
|
||||
return tagList;
|
||||
});
|
||||
|
@ -187,7 +185,6 @@ async function remove(key) {
|
|||
}
|
||||
|
||||
function formatValue(value) {
|
||||
if (value instanceof Date) return date.formatDate(value, 'DD/MM/YYYY');
|
||||
if (typeof value === 'boolean') return value ? t('Yes') : t('No');
|
||||
if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
|
||||
|
||||
|
@ -203,11 +200,6 @@ function sanitizer(params) {
|
|||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
function aliasField(field) {
|
||||
const split = field.split('.');
|
||||
return split[1] ?? split[0];
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -219,7 +211,7 @@ function aliasField(field) {
|
|||
icon="search"
|
||||
@click="search()"
|
||||
></QBtn>
|
||||
<QForm @submit="search" id="filterPanelForm">
|
||||
<QForm @submit="search" id="filterPanelForm" @keyup.enter="search()">
|
||||
<QList dense>
|
||||
<QItem class="q-mt-xs">
|
||||
<QItemSection top>
|
||||
|
|
|
@ -58,7 +58,7 @@ defineExpose({
|
|||
:class="{ zoomIn: zoom }"
|
||||
:src="getUrl()"
|
||||
v-bind="$attrs"
|
||||
@click.stop="show = $props.zoom ? true : false"
|
||||
@click.stop="show = $props.zoom"
|
||||
spinner-color="primary"
|
||||
/>
|
||||
<QDialog v-if="$props.zoom" v-model="show">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { ref } from 'vue';
|
||||
import { ref, reactive } from 'vue';
|
||||
import { onBeforeRouteLeave } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
@ -12,36 +12,40 @@ import VnPaginate from 'components/ui/VnPaginate.vue';
|
|||
import VnUserLink from 'components/ui/VnUserLink.vue';
|
||||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
import VnAvatar from 'components/ui/VnAvatar.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInput from 'components/common/VnInput.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
url: { type: String, default: null },
|
||||
filter: { type: Object, default: () => {} },
|
||||
body: { type: Object, default: () => {} },
|
||||
addNote: { type: Boolean, default: false },
|
||||
selectType: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const state = useState();
|
||||
const quasar = useQuasar();
|
||||
const currentUser = ref(state.getUser());
|
||||
const newNote = ref('');
|
||||
const newNote = reactive({ text: null, observationTypeFk: null });
|
||||
const observationTypes = ref([]);
|
||||
const vnPaginateRef = ref();
|
||||
function handleKeyUp(event) {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
if (!event.shiftKey) insert();
|
||||
}
|
||||
}
|
||||
|
||||
async function insert() {
|
||||
if (!newNote.text || ($props.selectType && !newNote.observationTypeFk)) return;
|
||||
|
||||
const body = $props.body;
|
||||
const newBody = { ...body, ...{ text: newNote.value } };
|
||||
const newBody = {
|
||||
...body,
|
||||
...{ text: newNote.text, observationTypeFk: newNote.observationTypeFk },
|
||||
};
|
||||
await axios.post($props.url, newBody);
|
||||
await vnPaginateRef.value.fetch();
|
||||
newNote.value = '';
|
||||
}
|
||||
|
||||
onBeforeRouteLeave((to, from, next) => {
|
||||
if (newNote.value)
|
||||
if (newNote.text)
|
||||
quasar.dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
|
@ -54,6 +58,13 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
});
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
v-if="selectType"
|
||||
url="ObservationTypes"
|
||||
:filter="{ fields: ['id', 'description'] }"
|
||||
auto-load
|
||||
@on-fetch="(data) => (observationTypes = data)"
|
||||
/>
|
||||
<QCard class="q-pa-xs q-mb-xl full-width" v-if="$props.addNote">
|
||||
<QCardSection horizontal>
|
||||
<VnAvatar :worker-id="currentUser.id" size="md" />
|
||||
|
@ -62,18 +73,28 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
{{ t('globals.now') }}
|
||||
</div>
|
||||
</QCardSection>
|
||||
<QCardSection class="q-pa-xs q-my-none q-py-none" horizontal>
|
||||
<QInput
|
||||
v-model="newNote"
|
||||
class="full-width"
|
||||
<QCardSection class="q-px-xs q-my-none q-py-none">
|
||||
<VnRow class="full-width">
|
||||
<VnSelect
|
||||
:label="t('Observation type')"
|
||||
v-if="selectType"
|
||||
url="ObservationTypes"
|
||||
v-model="newNote.observationTypeFk"
|
||||
option-label="description"
|
||||
style="flex: 0.15"
|
||||
:required="true"
|
||||
@keyup.enter.stop="insert"
|
||||
/>
|
||||
<VnInput
|
||||
v-model.trim="newNote.text"
|
||||
type="textarea"
|
||||
:label="t('Add note here...')"
|
||||
filled
|
||||
size="lg"
|
||||
autogrow
|
||||
autofocus
|
||||
@keyup="handleKeyUp"
|
||||
@keyup.enter.stop="insert"
|
||||
clearable
|
||||
:required="true"
|
||||
>
|
||||
<template #append>
|
||||
<QBtn
|
||||
|
@ -82,9 +103,12 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
color="primary"
|
||||
flat
|
||||
@click="insert"
|
||||
class="q-mb-xs"
|
||||
dense
|
||||
/>
|
||||
</template>
|
||||
</QInput>
|
||||
</VnInput>
|
||||
</VnRow>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<VnPaginate
|
||||
|
@ -98,6 +122,10 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
class="show"
|
||||
v-bind="$attrs"
|
||||
search-url="notes"
|
||||
@on-fetch="
|
||||
newNote.text = '';
|
||||
newNote.observationTypeFk = null;
|
||||
"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<TransitionGroup name="list" tag="div" class="column items-center full-width">
|
||||
|
@ -111,13 +139,28 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
:descriptor="false"
|
||||
:worker-id="note.workerFk"
|
||||
size="md"
|
||||
:title="note.worker?.user.nickname"
|
||||
/>
|
||||
<div class="full-width row justify-between q-pa-xs">
|
||||
<div>
|
||||
<VnUserLink
|
||||
:name="`${note.worker.user.nickname}`"
|
||||
:worker-id="note.worker.id"
|
||||
/>
|
||||
{{ toDateHourMin(note.created) }}
|
||||
<QBadge
|
||||
class="q-ml-xs"
|
||||
outline
|
||||
color="grey"
|
||||
v-if="selectType && note.observationTypeFk"
|
||||
>
|
||||
{{
|
||||
observationTypes.find(
|
||||
(ot) => ot.id === note.observationTypeFk
|
||||
)?.description
|
||||
}}
|
||||
</QBadge>
|
||||
</div>
|
||||
<span v-text="toDateHourMin(note.created)" />
|
||||
</div>
|
||||
</QCardSection>
|
||||
<QCardSection class="q-pa-xs q-my-none q-py-none">
|
||||
|
@ -131,12 +174,6 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
<style lang="scss" scoped>
|
||||
.q-card {
|
||||
width: 90%;
|
||||
@media (max-width: $breakpoint-sm) {
|
||||
width: 100%;
|
||||
}
|
||||
&__section {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
}
|
||||
.q-dialog .q-card {
|
||||
width: 400px;
|
||||
|
@ -150,11 +187,28 @@ onBeforeRouteLeave((to, from, next) => {
|
|||
opacity: 0;
|
||||
background-color: $primary;
|
||||
}
|
||||
|
||||
.vn-row > :nth-child(2) {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
@media (max-width: $breakpoint-xs) {
|
||||
.vn-row > :deep(*) {
|
||||
margin-left: 0;
|
||||
}
|
||||
.q-card {
|
||||
width: 100%;
|
||||
|
||||
&__section {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Add note here...: Añadir nota aquí...
|
||||
New note: Nueva nota
|
||||
Save (Enter): Guardar (Intro)
|
||||
|
||||
Observation type: Tipo de observación
|
||||
</i18n>
|
||||
|
|
|
@ -108,6 +108,7 @@ async function search() {
|
|||
...Object.fromEntries(staticParams),
|
||||
search: searchText.value,
|
||||
},
|
||||
...{ filter: props.filter },
|
||||
};
|
||||
|
||||
if (props.whereFilter) {
|
||||
|
|
|
@ -114,7 +114,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
|
|||
for (const row of response.data) store.data.push(row);
|
||||
} else {
|
||||
store.data = response.data;
|
||||
if (!document.querySelectorAll('[role="dialog"]').length)
|
||||
if (!document.querySelectorAll('[role="dialog"][aria-modal="true"]').length)
|
||||
updateRouter && updateStateParams();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ export default function toHour(date) {
|
|||
if (!isValidDate(date)) {
|
||||
return '--:--';
|
||||
}
|
||||
return (new Date(date || '')).toLocaleTimeString([], {
|
||||
return new Date(date || '').toLocaleTimeString([], {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
});
|
||||
|
|
|
@ -50,6 +50,7 @@ globals:
|
|||
summary:
|
||||
basicData: Basic data
|
||||
daysOnward: Days onward
|
||||
daysAgo: Days ago
|
||||
today: Today
|
||||
yesterday: Yesterday
|
||||
dateFormat: en-GB
|
||||
|
@ -104,6 +105,7 @@ globals:
|
|||
campaign: Campaign
|
||||
weight: Weight
|
||||
error: Ups! Something went wrong
|
||||
recalc: Recalculate
|
||||
pageTitles:
|
||||
logIn: Login
|
||||
addressEdit: Update address
|
||||
|
@ -111,7 +113,7 @@ globals:
|
|||
basicData: Basic data
|
||||
log: Logs
|
||||
parkingList: Parkings list
|
||||
agencyList: Agencies list
|
||||
agencyList: Agencies
|
||||
agency: Agency
|
||||
workCenters: Work centers
|
||||
modes: Modes
|
||||
|
@ -135,7 +137,7 @@ globals:
|
|||
fiscalData: Fiscal data
|
||||
billingData: Billing data
|
||||
consignees: Consignees
|
||||
'address-create': New address
|
||||
address-create: New address
|
||||
notes: Notes
|
||||
credits: Credits
|
||||
greuges: Greuges
|
||||
|
@ -207,7 +209,7 @@ globals:
|
|||
roadmap: Roadmap
|
||||
stops: Stops
|
||||
routes: Routes
|
||||
cmrsList: CMRs list
|
||||
cmrsList: CMRs
|
||||
RouteList: List
|
||||
routeCreate: New route
|
||||
RouteRoadmap: Roadmaps
|
||||
|
@ -273,6 +275,8 @@ globals:
|
|||
clientsActionsMonitor: Clients and actions
|
||||
serial: Serial
|
||||
medical: Mutual
|
||||
RouteExtendedList: Router
|
||||
wasteRecalc: Waste recaclulate
|
||||
supplier: Supplier
|
||||
created: Created
|
||||
worker: Worker
|
||||
|
@ -288,7 +292,10 @@ globals:
|
|||
createInvoiceIn: Create invoice in
|
||||
myAccount: My account
|
||||
noOne: No one
|
||||
maxTemperature: Max
|
||||
minTemperature: Min
|
||||
params:
|
||||
id: ID
|
||||
clientFk: Client id
|
||||
salesPersonFk: Sales person
|
||||
warehouseFk: Warehouse
|
||||
|
@ -296,12 +303,19 @@ globals:
|
|||
from: From
|
||||
To: To
|
||||
stateFk: State
|
||||
departmentFk: Department
|
||||
email: Email
|
||||
SSN: SSN
|
||||
fi: FI
|
||||
changePass: Change password
|
||||
deleteConfirmTitle: Delete selected elements
|
||||
errors:
|
||||
statusUnauthorized: Access denied
|
||||
statusInternalServerError: An internal server error has ocurred
|
||||
statusBadGateway: It seems that the server has fall down
|
||||
statusGatewayTimeout: Could not contact the server
|
||||
userConfig: Error fetching user config
|
||||
updateUserConfig: Error updating user config
|
||||
tokenConfig: Error fetching token config
|
||||
writeRequest: The requested operation could not be completed
|
||||
login:
|
||||
|
@ -495,6 +509,8 @@ ticket:
|
|||
warehouse: Warehouse
|
||||
customerCard: Customer card
|
||||
alias: Alias
|
||||
ticketList: Ticket List
|
||||
newOrder: New Order
|
||||
boxing:
|
||||
expedition: Expedition
|
||||
item: Item
|
||||
|
@ -516,6 +532,7 @@ ticket:
|
|||
landed: Landed
|
||||
consigneePhone: Consignee phone
|
||||
consigneeMobile: Consignee mobile
|
||||
consigneeAddress: Consignee address
|
||||
clientPhone: Client phone
|
||||
clientMobile: Client mobile
|
||||
consignee: Consignee
|
||||
|
@ -545,6 +562,11 @@ ticket:
|
|||
weight: Weight
|
||||
goTo: Go to
|
||||
summaryAmount: Summary
|
||||
purchaseRequest: Purchase request
|
||||
service: Service
|
||||
description: Description
|
||||
attender: Attender
|
||||
ok: Ok
|
||||
create:
|
||||
client: Client
|
||||
address: Address
|
||||
|
@ -568,7 +590,6 @@ invoiceOut:
|
|||
client: Client
|
||||
company: Company
|
||||
customerCard: Customer card
|
||||
ticketList: Ticket List
|
||||
summary:
|
||||
issued: Issued
|
||||
created: Created
|
||||
|
@ -794,14 +815,14 @@ worker:
|
|||
bankEntity: Swift / BIC
|
||||
formation:
|
||||
tableVisibleColumns:
|
||||
course: Curso
|
||||
startDate: Fecha Inicio
|
||||
endDate: Fecha Fin
|
||||
center: Centro Formación
|
||||
invoice: Factura
|
||||
amount: Importe
|
||||
remark: Bonficado
|
||||
hasDiploma: Diploma
|
||||
course: Course
|
||||
startDate: Start date
|
||||
endDate: End date
|
||||
center: Training center
|
||||
invoice: Invoice
|
||||
amount: Amount
|
||||
remark: Remark
|
||||
hasDiploma: Has diploma
|
||||
medical:
|
||||
tableVisibleColumns:
|
||||
date: Date
|
||||
|
@ -858,34 +879,7 @@ wagon:
|
|||
minHeightBetweenTrays: 'The minimum height between trays is '
|
||||
maxWagonHeight: 'The maximum height of the wagon is '
|
||||
uncompleteTrays: There are incomplete trays
|
||||
route:
|
||||
pageTitles:
|
||||
agency: Agency List
|
||||
routes: Routes
|
||||
cmrsList: CMRs list
|
||||
RouteList: List
|
||||
routeCreate: New route
|
||||
basicData: Basic Data
|
||||
summary: Summary
|
||||
RouteRoadmap: Roadmaps
|
||||
RouteRoadmapCreate: Create roadmap
|
||||
tickets: Tickets
|
||||
log: Log
|
||||
autonomous: Autonomous
|
||||
cmr:
|
||||
list:
|
||||
results: results
|
||||
cmrFk: CMR id
|
||||
hasCmrDms: Attached in gestdoc
|
||||
'true': 'Yes'
|
||||
'false': 'No'
|
||||
ticketFk: Ticketd id
|
||||
routeFk: Route id
|
||||
country: Country
|
||||
clientFk: Client id
|
||||
shipped: Preparation date
|
||||
viewCmr: View CMR
|
||||
downloadCmrs: Download CMRs
|
||||
|
||||
supplier:
|
||||
list:
|
||||
payMethod: Pay method
|
||||
|
|
|
@ -49,6 +49,7 @@ globals:
|
|||
summary:
|
||||
basicData: Datos básicos
|
||||
daysOnward: Días adelante
|
||||
daysAgo: Días atras
|
||||
today: Hoy
|
||||
yesterday: Ayer
|
||||
dateFormat: es-ES
|
||||
|
@ -63,7 +64,7 @@ globals:
|
|||
shipped: F. envío
|
||||
totalEntries: Ent. totales
|
||||
amount: Importe
|
||||
packages: Bultos
|
||||
packages: Embalajes
|
||||
download: Descargar
|
||||
downloadPdf: Descargar PDF
|
||||
selectRows: 'Seleccionar las { numberRows } filas(s)'
|
||||
|
@ -106,6 +107,7 @@ globals:
|
|||
campaign: Campaña
|
||||
weight: Peso
|
||||
error: ¡Ups! Algo salió mal
|
||||
recalc: Recalcular
|
||||
pageTitles:
|
||||
logIn: Inicio de sesión
|
||||
addressEdit: Modificar consignatario
|
||||
|
@ -113,7 +115,7 @@ globals:
|
|||
basicData: Datos básicos
|
||||
log: Historial
|
||||
parkingList: Listado de parkings
|
||||
agencyList: Listado de agencias
|
||||
agencyList: Agencias
|
||||
agency: Agencia
|
||||
workCenters: Centros de trabajo
|
||||
modes: Modos
|
||||
|
@ -211,12 +213,13 @@ globals:
|
|||
roadmap: Troncales
|
||||
stops: Paradas
|
||||
routes: Rutas
|
||||
cmrsList: Listado de CMRs
|
||||
cmrsList: CMRs
|
||||
RouteList: Listado
|
||||
routeCreate: Nueva ruta
|
||||
RouteRoadmap: Troncales
|
||||
RouteRoadmapCreate: Crear troncal
|
||||
autonomous: Autónomos
|
||||
RouteExtendedList: Enrutador
|
||||
suppliers: Proveedores
|
||||
supplier: Proveedor
|
||||
supplierCreate: Nuevo proveedor
|
||||
|
@ -267,7 +270,7 @@ globals:
|
|||
tracking: Estados
|
||||
components: Componentes
|
||||
pictures: Fotos
|
||||
packages: Bultos
|
||||
packages: Embalajes
|
||||
ldap: LDAP
|
||||
samba: Samba
|
||||
twoFactor: Doble factor
|
||||
|
@ -277,6 +280,7 @@ globals:
|
|||
clientsActionsMonitor: Clientes y acciones
|
||||
serial: Facturas por serie
|
||||
medical: Mutua
|
||||
wasteRecalc: Recalcular mermas
|
||||
supplier: Proveedor
|
||||
created: Fecha creación
|
||||
worker: Trabajador
|
||||
|
@ -292,7 +296,10 @@ globals:
|
|||
createInvoiceIn: Crear factura recibida
|
||||
myAccount: Mi cuenta
|
||||
noOne: Nadie
|
||||
maxTemperature: Máx
|
||||
minTemperature: Mín
|
||||
params:
|
||||
id: Id
|
||||
clientFk: Id cliente
|
||||
salesPersonFk: Comercial
|
||||
warehouseFk: Almacén
|
||||
|
@ -300,12 +307,19 @@ globals:
|
|||
from: Desde
|
||||
To: Hasta
|
||||
stateFk: Estado
|
||||
departmentFk: Departamento
|
||||
email: Correo
|
||||
SSN: NSS
|
||||
fi: NIF
|
||||
changePass: Cambiar contraseña
|
||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||
errors:
|
||||
statusUnauthorized: Acceso denegado
|
||||
statusInternalServerError: Ha ocurrido un error interno del servidor
|
||||
statusBadGateway: Parece ser que el servidor ha caído
|
||||
statusGatewayTimeout: No se ha podido contactar con el servidor
|
||||
userConfig: Error al obtener configuración de usuario
|
||||
updateUserConfig: Error al actualizar la configuración de usuario
|
||||
tokenConfig: Error al obtener configuración de token
|
||||
writeRequest: No se pudo completar la operación solicitada
|
||||
login:
|
||||
|
@ -486,7 +500,7 @@ ticket:
|
|||
tracking: Estados
|
||||
components: Componentes
|
||||
pictures: Fotos
|
||||
packages: Bultos
|
||||
packages: Embalajes
|
||||
list:
|
||||
nickname: Alias
|
||||
state: Estado
|
||||
|
@ -504,6 +518,8 @@ ticket:
|
|||
warehouse: Almacén
|
||||
customerCard: Ficha del cliente
|
||||
alias: Alias
|
||||
ticketList: Listado de tickets
|
||||
newOrder: Nuevo pedido
|
||||
boxing:
|
||||
expedition: Expedición
|
||||
item: Artículo
|
||||
|
@ -525,6 +541,7 @@ ticket:
|
|||
landed: Entregado
|
||||
consigneePhone: Tel. consignatario
|
||||
consigneeMobile: Móv. consignatario
|
||||
consigneeAddress: Dir. consignatario
|
||||
clientPhone: Tel. cliente
|
||||
clientMobile: Móv. cliente
|
||||
consignee: Consignatario
|
||||
|
@ -554,6 +571,10 @@ ticket:
|
|||
weight: Peso
|
||||
goTo: Ir a
|
||||
summaryAmount: Resumen
|
||||
purchaseRequest: Petición de compra
|
||||
service: Servicio
|
||||
description: Descripción
|
||||
attender: Consignatario
|
||||
create:
|
||||
client: Cliente
|
||||
address: Dirección
|
||||
|
@ -856,21 +877,6 @@ wagon:
|
|||
minHeightBetweenTrays: 'La distancia mínima entre bandejas es '
|
||||
maxWagonHeight: 'La altura máxima del vagón es '
|
||||
uncompleteTrays: Hay bandejas sin completar
|
||||
route:
|
||||
cmr:
|
||||
list:
|
||||
results: resultados
|
||||
cmrFk: Id CMR
|
||||
hasCmrDms: Gestdoc
|
||||
'true': Sí
|
||||
'false': 'No'
|
||||
ticketFk: Id ticket
|
||||
routeFk: Id ruta
|
||||
country: País
|
||||
clientFk: Id cliente
|
||||
shipped: Fecha preparación
|
||||
viewCmr: Ver CMR
|
||||
downloadCmrs: Descargar CMRs
|
||||
supplier:
|
||||
list:
|
||||
payMethod: Método de pago
|
||||
|
|
|
@ -10,7 +10,9 @@ import RightMenu from 'src/components/common/RightMenu.vue';
|
|||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const tableRef = ref();
|
||||
|
||||
const filter = {
|
||||
include: { relation: 'role', scope: { fields: ['id', 'name'] } },
|
||||
};
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -22,7 +24,22 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'username',
|
||||
name: 'roleFk',
|
||||
label: t('role'),
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
name: 'roleFk',
|
||||
attrs: {
|
||||
url: 'VnRoles',
|
||||
optionValue: 'id',
|
||||
optionLabel: 'name',
|
||||
},
|
||||
},
|
||||
format: ({ role }, dashIfEmpty) => dashIfEmpty(role?.name),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'nickname',
|
||||
label: t('Nickname'),
|
||||
isTitle: true,
|
||||
component: 'input',
|
||||
|
@ -91,6 +108,7 @@ const exprBuilder = (param, value) => {
|
|||
:expr-builder="exprBuilder"
|
||||
:label="t('account.search')"
|
||||
:info="t('account.searchInfo')"
|
||||
:filter="filter"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
|
@ -101,6 +119,7 @@ const exprBuilder = (param, value) => {
|
|||
ref="tableRef"
|
||||
data-key="AccountUsers"
|
||||
url="VnUsers/preview"
|
||||
:filter="filter"
|
||||
order="id DESC"
|
||||
:columns="columns"
|
||||
default-mode="table"
|
||||
|
|
|
@ -4,9 +4,12 @@ import { computed, ref, toRefs } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useAcl } from 'src/composables/useAcl';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
|
||||
const $props = defineProps({
|
||||
hasAccount: {
|
||||
type: Boolean,
|
||||
|
@ -62,6 +65,19 @@ async function sync() {
|
|||
}
|
||||
</script>
|
||||
<template>
|
||||
<VnChangePassword
|
||||
ref="changePassRef"
|
||||
:ask-old-pass="true"
|
||||
:submit-fn="
|
||||
async (newPassword, oldPassword) => {
|
||||
await axios.patch(`Accounts/change-password`, {
|
||||
userId: entityId,
|
||||
newPassword,
|
||||
oldPassword,
|
||||
});
|
||||
}
|
||||
"
|
||||
/>
|
||||
<VnConfirm
|
||||
v-model="showSyncDialog"
|
||||
:message="t('account.card.actions.sync.message')"
|
||||
|
@ -92,6 +108,17 @@ async function sync() {
|
|||
/>
|
||||
</template>
|
||||
</VnConfirm>
|
||||
<QItem
|
||||
v-if="
|
||||
entityId == account.id &&
|
||||
useAcl().hasAny([{ model: 'Account', props: '*', accessType: 'WRITE' }])
|
||||
"
|
||||
v-ripple
|
||||
clickable
|
||||
@click="$refs.changePassRef.show()"
|
||||
>
|
||||
<QItemSection>{{ t('globals.changePass') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="account.hasAccount"
|
||||
v-ripple
|
||||
|
@ -138,6 +165,5 @@ async function sync() {
|
|||
<QItem v-ripple clickable @click="showSyncDialog = true">
|
||||
<QItemSection>{{ t('account.card.actions.sync.name') }}</QItemSection>
|
||||
</QItem>
|
||||
|
||||
<QSeparator />
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,177 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import { QItem } from 'quasar';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import { QItemSection } from 'quasar';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
|
||||
const { t } = useI18n();
|
||||
defineProps({ dataKey: { type: String, required: true } });
|
||||
</script>
|
||||
<template>
|
||||
<VnFilterPanel :data-key="dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
:label="t('params.item')"
|
||||
v-model="params.itemId"
|
||||
is-outlined
|
||||
lazy-rules
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
v-model="params.buyerId"
|
||||
url="TicketRequests/getItemTypeWorker"
|
||||
:fields="['id', 'nickname']"
|
||||
sort-by="nickname ASC"
|
||||
:label="t('params.buyer')"
|
||||
option-value="id"
|
||||
option-label="nickname"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
v-model="params.typeId"
|
||||
url="ItemTypes"
|
||||
:include="['category']"
|
||||
:fields="['id', 'name', 'categoryFk']"
|
||||
sort-by="name ASC"
|
||||
:label="t('params.typeId')"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel caption>{{
|
||||
scope.opt?.category?.name
|
||||
}}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
v-model="params.categoryId"
|
||||
url="ItemCategories"
|
||||
:fields="['id', 'name']"
|
||||
sort-by="name ASC"
|
||||
:label="t('params.categoryId')"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnSelect
|
||||
v-model="params.campaignId"
|
||||
url="Campaigns/latest"
|
||||
sort-by="dated DESC"
|
||||
:label="t('params.campaignId')"
|
||||
option-label="code"
|
||||
option-value="id"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>{{
|
||||
t(`params.${scope.opt?.code}`)
|
||||
}}</QItemLabel>
|
||||
<QItemLabel caption>{{
|
||||
toDate(scope.opt.dated)
|
||||
}}</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('params.from')"
|
||||
v-model="params.from"
|
||||
@update:model-value="searchFn()"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
:label="t('params.to')"
|
||||
v-model="params.to"
|
||||
@update:model-value="searchFn()"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
item: Item id
|
||||
buyer: Buyer
|
||||
type: Type
|
||||
category: Category
|
||||
itemId: Item id
|
||||
buyerId: Buyer
|
||||
typeId: Type
|
||||
categoryId: Category
|
||||
from: From
|
||||
to: To
|
||||
campaignId: Campaña
|
||||
valentinesDay: Valentine's Day
|
||||
mothersDay: Mother's Day
|
||||
allSaints: All Saints' Day
|
||||
es:
|
||||
params:
|
||||
item: Id artículo
|
||||
buyer: Comprador
|
||||
type: Tipo
|
||||
category: Categoría
|
||||
itemId: Id Artículo
|
||||
buyerId: Comprador
|
||||
typeId: Tipo
|
||||
categoryId: Reino
|
||||
from: Desde
|
||||
to: Hasta
|
||||
campaignId: Campaña
|
||||
valentinesDay: Día de San Valentín
|
||||
mothersDay: Día de la Madre
|
||||
allSaints: Día de Todos los Santos
|
||||
</i18n>
|
|
@ -22,5 +22,6 @@ const noteFilter = computed(() => {
|
|||
:filter="noteFilter"
|
||||
:body="{ clientFk: route.params.id }"
|
||||
style="overflow-y: auto"
|
||||
:select-type="true"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
@ -92,7 +92,7 @@ const onSubmit = async () => {
|
|||
notify('globals.dataSaved', 'positive');
|
||||
unpaidClient.value = true;
|
||||
} catch (error) {
|
||||
notify('errors.create', 'negative');
|
||||
notify('errors.writeRequest', 'negative');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
|
|
@ -3,14 +3,11 @@ import { computed, ref } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import CustomerChangePassword from 'src/pages/Customer/components/CustomerChangePassword.vue';
|
||||
import FormModel from 'components/FormModel.vue';
|
||||
import VnChangePassword from 'src/components/common/VnChangePassword.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
const route = useRoute();
|
||||
const canChangePassword = ref(0);
|
||||
|
||||
|
@ -21,21 +18,11 @@ const filter = computed(() => {
|
|||
};
|
||||
});
|
||||
|
||||
const showChangePasswordDialog = () => {
|
||||
quasar.dialog({
|
||||
component: CustomerChangePassword,
|
||||
componentProps: {
|
||||
id: route.params.id,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
async function hasCustomerRole() {
|
||||
const { data } = await axios(`Clients/${route.params.id}/hasCustomerRole`);
|
||||
canChangePassword.value = data;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormModel
|
||||
url="VnUsers/preview"
|
||||
|
@ -69,21 +56,29 @@ async function hasCustomerRole() {
|
|||
</template>
|
||||
<template #moreActions>
|
||||
<QBtn
|
||||
:label="t('Change password')"
|
||||
:label="t('globals.changePass')"
|
||||
color="primary"
|
||||
icon="edit"
|
||||
:disable="!canChangePassword"
|
||||
@click="showChangePasswordDialog()"
|
||||
@click="$refs.changePassRef.show"
|
||||
/>
|
||||
</template>
|
||||
</FormModel>
|
||||
<VnChangePassword
|
||||
ref="changePassRef"
|
||||
:submit-fn="
|
||||
async (newPass) => {
|
||||
await axios.patch(`Clients/${$route.params.id}/setPassword`, {
|
||||
newPassword: newPass,
|
||||
});
|
||||
}
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Enable web access: Habilitar acceso web
|
||||
User: Usuario
|
||||
Recovery email: Correo de recuperacion
|
||||
This email is used for user to regain access their account: Este correo electrónico se usa para que el usuario recupere el acceso a su cuenta
|
||||
Change password: Cambiar contraseña
|
||||
</i18n>
|
||||
|
|
|
@ -25,19 +25,31 @@ const { notify } = useNotify();
|
|||
const { t } = useI18n();
|
||||
|
||||
const newObservation = ref(null);
|
||||
const obsId = ref(null);
|
||||
|
||||
const onSubmit = async () => {
|
||||
try {
|
||||
const data = $props.clients.map((item) => {
|
||||
return { clientFk: item.clientFk, text: newObservation.value };
|
||||
});
|
||||
await axios.post('ClientObservations', data);
|
||||
if (!obsId.value)
|
||||
obsId.value = (
|
||||
await axios.get('ObservationTypes/findOne', {
|
||||
params: { filter: { where: { description: 'Finance' } } },
|
||||
})
|
||||
).data?.id;
|
||||
|
||||
const payload = {
|
||||
const bodyObs = $props.clients.map((item) => {
|
||||
return {
|
||||
clientFk: item.clientFk,
|
||||
text: newObservation.value,
|
||||
observationTypeFk: obsId.value,
|
||||
};
|
||||
});
|
||||
await axios.post('ClientObservations', bodyObs);
|
||||
|
||||
const bodyObsMail = {
|
||||
defaulters: $props.clients,
|
||||
observation: newObservation.value,
|
||||
};
|
||||
await axios.post('Defaulters/observationEmail', payload);
|
||||
await axios.post('Defaulters/observationEmail', bodyObsMail);
|
||||
|
||||
await $props.promise();
|
||||
|
||||
|
|
|
@ -240,7 +240,6 @@ function handleLocation(data, location) {
|
|||
class="row q-gutter-md q-mb-md"
|
||||
v-for="(note, index) in notes"
|
||||
>
|
||||
<div class="col">
|
||||
<VnSelect
|
||||
:label="t('Observation type')"
|
||||
:options="observationTypes"
|
||||
|
@ -249,17 +248,14 @@ function handleLocation(data, location) {
|
|||
option-value="id"
|
||||
v-model="note.observationTypeFk"
|
||||
/>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('Description')"
|
||||
:rules="validate('route.description')"
|
||||
clearable
|
||||
v-model="note.description"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<QIcon
|
||||
:style="{ flex: 0, 'align-self': $q.screen.gt.xs ? 'end' : 'center' }"
|
||||
@click.stop="deleteNote(note.id, index)"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
|
@ -270,9 +266,7 @@ function handleLocation(data, location) {
|
|||
{{ t('Remove note') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<QBtn
|
||||
@click.stop="addNote()"
|
||||
class="cursor-pointer add-icon q-mt-md"
|
||||
|
|
|
@ -1,138 +0,0 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import axios from 'axios';
|
||||
import { useDialogPluginComponent } from 'quasar';
|
||||
|
||||
import useNotify from 'src/composables/useNotify';
|
||||
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
|
||||
const { dialogRef } = useDialogPluginComponent();
|
||||
const { notify } = useNotify();
|
||||
const { t } = useI18n();
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
promise: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const userPasswords = ref({});
|
||||
|
||||
const closeButton = ref(null);
|
||||
const isLoading = ref(false);
|
||||
const newPassword = ref('');
|
||||
const requestPassword = ref('');
|
||||
|
||||
const onSubmit = async () => {
|
||||
isLoading.value = true;
|
||||
|
||||
if (newPassword.value !== requestPassword.value) {
|
||||
notify(t("Passwords don't match"), 'negative');
|
||||
isLoading.value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = {
|
||||
newPassword: newPassword.value,
|
||||
};
|
||||
try {
|
||||
await axios.patch(`Clients/${$props.id}/setPassword`, payload);
|
||||
} catch (error) {
|
||||
notify('errors.create', 'negative');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
if (closeButton.value) closeButton.value.click();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QDialog ref="dialogRef">
|
||||
<FetchData
|
||||
@on-fetch="(data) => (userPasswords = data[0])"
|
||||
auto-load
|
||||
url="UserPasswords"
|
||||
/>
|
||||
<QCard class="q-pa-lg">
|
||||
<QCardSection>
|
||||
<QForm @submit.prevent="onSubmit">
|
||||
<span
|
||||
ref="closeButton"
|
||||
class="row justify-end close-icon"
|
||||
v-close-popup
|
||||
>
|
||||
<QIcon name="close" size="sm" />
|
||||
</span>
|
||||
|
||||
<VnRow class="row q-gutter-md q-mb-md" style="flex-direction: column">
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('New password')"
|
||||
clearable
|
||||
v-model="newPassword"
|
||||
type="password"
|
||||
>
|
||||
<template #append>
|
||||
<QIcon name="info" class="cursor-info">
|
||||
<QTooltip>
|
||||
{{
|
||||
t('customer.card.passwordRequirements', {
|
||||
...userPasswords,
|
||||
})
|
||||
}}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
</VnInput>
|
||||
</div>
|
||||
<div class="col">
|
||||
<VnInput
|
||||
:label="t('Request password')"
|
||||
clearable
|
||||
v-model="requestPassword"
|
||||
type="password"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
|
||||
<div class="q-mt-lg row justify-end">
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:label="t('globals.cancel')"
|
||||
:loading="isLoading"
|
||||
class="q-ml-sm"
|
||||
color="primary"
|
||||
flat
|
||||
type="reset"
|
||||
v-close-popup
|
||||
/>
|
||||
<QBtn
|
||||
:disabled="isLoading"
|
||||
:label="t('Change password')"
|
||||
:loading="isLoading"
|
||||
color="primary"
|
||||
type="submit"
|
||||
/>
|
||||
</div>
|
||||
</QForm>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
New password: Nueva contraseña
|
||||
Request password: Repetir contraseña
|
||||
Change password: Cambiar contraseña
|
||||
Passwords don't match: Las contraseñas no coinciden
|
||||
</i18n>
|
|
@ -138,7 +138,7 @@ const onSubmit = async () => {
|
|||
notify('globals.dataSaved', 'positive');
|
||||
onDataSaved(data);
|
||||
} catch (error) {
|
||||
notify('errors.create', 'negative');
|
||||
notify('errors.writeRequest', 'negative');
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,301 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useState } from 'src/composables/useState';
|
||||
import { useQuasar } from 'quasar';
|
||||
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import FormModelPopup from 'components/FormModelPopup.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnRow from 'components/ui/VnRow.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import EntryStockBoughtFilter from './EntryStockBoughtFilter.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import EntryStockBoughtDetail from 'src/pages/Entry/EntryStockBoughtDetail.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
const state = useState();
|
||||
const user = state.getUser();
|
||||
const columns = [
|
||||
{
|
||||
align: 'left',
|
||||
label: 'Id',
|
||||
name: 'id',
|
||||
isId: true,
|
||||
columnFilter: false,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'workerFk',
|
||||
label: t('Buyer'),
|
||||
isTitle: true,
|
||||
component: 'select',
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
where: { role: 'buyer' },
|
||||
optionFilter: 'firstName',
|
||||
optionLabel: 'name',
|
||||
optionValue: 'id',
|
||||
useLike: false,
|
||||
},
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
label: t('Reserve'),
|
||||
name: 'reserve',
|
||||
columnFilter: false,
|
||||
create: true,
|
||||
component: 'number',
|
||||
summation: true,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
label: t('Bought'),
|
||||
name: 'bought',
|
||||
summation: true,
|
||||
cardVisible: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('Date'),
|
||||
name: 'dated',
|
||||
component: 'date',
|
||||
visible: false,
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('View more details'),
|
||||
icon: 'search',
|
||||
isPrimary: true,
|
||||
action: (row) => {
|
||||
quasar.dialog({
|
||||
component: EntryStockBoughtDetail,
|
||||
componentProps: {
|
||||
workerFk: row.workerFk,
|
||||
dated: userParams.value.dated,
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const fetchDataRef = ref();
|
||||
const travelDialogRef = ref(false);
|
||||
const tableRef = ref();
|
||||
const travel = ref(null);
|
||||
const userParams = ref({
|
||||
dated: Date.vnNew(),
|
||||
});
|
||||
|
||||
const filter = ref({
|
||||
fields: ['id', 'm3', 'warehouseInFk'],
|
||||
include: [
|
||||
{
|
||||
relation: 'warehouseIn',
|
||||
scope: {
|
||||
fields: ['code'],
|
||||
},
|
||||
},
|
||||
],
|
||||
where: {
|
||||
shipped: (userParams.value.dated
|
||||
? new Date(userParams.value.dated)
|
||||
: Date.vnNew()
|
||||
).setHours(0, 0, 0, 0),
|
||||
m3: { neq: null },
|
||||
},
|
||||
});
|
||||
|
||||
const setUserParams = async ({ dated }) => {
|
||||
const shipped = (dated ? new Date(dated) : Date.vnNew()).setHours(0, 0, 0, 0);
|
||||
filter.value.where.shipped = shipped;
|
||||
fetchDataRef.value?.fetch();
|
||||
};
|
||||
|
||||
function openDialog() {
|
||||
travelDialogRef.value = true;
|
||||
}
|
||||
|
||||
function setFooter(data) {
|
||||
const footer = {
|
||||
bought: 0,
|
||||
reserve: 0,
|
||||
};
|
||||
data.forEach((row) => {
|
||||
footer.bought += row?.bought;
|
||||
footer.reserve += row?.reserve;
|
||||
});
|
||||
tableRef.value.footer = footer;
|
||||
}
|
||||
|
||||
function round(value) {
|
||||
return Math.round(value * 100) / 100;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<VnSubToolbar>
|
||||
<template #st-data>
|
||||
<FetchData
|
||||
ref="fetchDataRef"
|
||||
url="Travels"
|
||||
auto-load
|
||||
:filter="filter"
|
||||
@on-fetch="
|
||||
(data) => {
|
||||
travel = data.find(
|
||||
(data) => data.warehouseIn?.code.toLowerCase() === 'vnh'
|
||||
);
|
||||
}
|
||||
"
|
||||
/>
|
||||
<VnRow class="travel">
|
||||
<div v-if="travel">
|
||||
<span style="color: var(--vn-label-color)">
|
||||
{{ t('Purchase Spaces') }}:
|
||||
</span>
|
||||
<span>
|
||||
{{ travel?.m3 }}
|
||||
</span>
|
||||
<QBtn
|
||||
v-if="travel?.m3"
|
||||
style="max-width: 20%"
|
||||
flat
|
||||
icon="edit"
|
||||
@click="openDialog()"
|
||||
:title="t('Edit travel')"
|
||||
color="primary"
|
||||
/>
|
||||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<QDialog v-model="travelDialogRef" :maximized="true" :class="['vn-row', 'wrap']">
|
||||
<FormModelPopup
|
||||
:url-update="`Travels/${travel?.id}`"
|
||||
model="travel"
|
||||
:title="t('Travel m3')"
|
||||
:form-initial-data="{ id: travel?.id, m3: travel?.m3 }"
|
||||
@on-data-saved="fetchDataRef.fetch()"
|
||||
>
|
||||
<template #form-inputs="{ data }">
|
||||
<VnInput
|
||||
v-model="data.id"
|
||||
:label="t('id')"
|
||||
type="number"
|
||||
disable
|
||||
readonly
|
||||
/>
|
||||
<VnInput v-model="data.m3" :label="t('m3')" type="number" />
|
||||
</template>
|
||||
</FormModelPopup>
|
||||
</QDialog>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<EntryStockBoughtFilter
|
||||
data-key="StockBoughts"
|
||||
@set-user-params="setUserParams"
|
||||
/>
|
||||
</template>
|
||||
</RightMenu>
|
||||
<div class="table-container">
|
||||
<div class="column items-center">
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="StockBoughts"
|
||||
url="StockBoughts/getStockBought"
|
||||
save-url="StockBoughts/crud"
|
||||
order="reserve DESC"
|
||||
:right-search="false"
|
||||
:is-editable="true"
|
||||
@on-fetch="(data) => setFooter(data)"
|
||||
:create="{
|
||||
urlCreate: 'StockBoughts',
|
||||
title: t('Reserve some space'),
|
||||
onDataSaved: () => tableRef.reload(),
|
||||
formInitialData: {
|
||||
workerFk: user.id,
|
||||
dated: Date.vnNow(),
|
||||
},
|
||||
}"
|
||||
:columns="columns"
|
||||
:user-params="userParams"
|
||||
:footer="true"
|
||||
table-height="80vh"
|
||||
auto-load
|
||||
:column-search="false"
|
||||
>
|
||||
<template #column-workerFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row?.worker?.user?.name }}
|
||||
<WorkerDescriptorProxy :id="row?.workerFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-bought="{ row }">
|
||||
<span :class="{ 'text-negative': row.reserve < row.bought }">
|
||||
{{ row?.bought }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-footer-reserve>
|
||||
<span>
|
||||
{{ round(tableRef.footer.reserve) }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-footer-bought>
|
||||
<span
|
||||
:class="{
|
||||
'text-negative':
|
||||
tableRef.footer.reserve < tableRef.footer.bought,
|
||||
}"
|
||||
>
|
||||
{{ round(tableRef.footer.bought) }}
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.travel {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
.table-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
.text-negative {
|
||||
color: $negative !important;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Edit travel: Editar envío
|
||||
Travel: Envíos
|
||||
Purchase Spaces: Espacios de compra
|
||||
Buyer: Comprador
|
||||
Reserve: Reservado
|
||||
Bought: Comprado
|
||||
Date: Fecha
|
||||
View more details: Ver más detalles
|
||||
Reserve some space: Reservar espacio
|
||||
This buyer has already made a reservation for this date: Este comprador ya ha hecho una reserva para esta fecha
|
||||
</i18n>
|
|
@ -0,0 +1,126 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import EntryDescriptorProxy from 'src/pages/Entry/Card/EntryDescriptorProxy.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
const $props = defineProps({
|
||||
workerFk: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
dated: {
|
||||
type: Date,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const customUrl = `StockBoughts/getStockBoughtDetail?workerFk=${$props.workerFk}&date=${$props.dated}`;
|
||||
const columns = [
|
||||
{
|
||||
align: 'left',
|
||||
label: t('Entry'),
|
||||
name: 'entryFk',
|
||||
isTitle: true,
|
||||
isId: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'itemFk',
|
||||
label: t('Item'),
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('Name'),
|
||||
name: 'itemName',
|
||||
create: true,
|
||||
columnClass: 'expand',
|
||||
columnFilter: false,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'volume',
|
||||
label: t('Volume'),
|
||||
columnFilter: false,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('Packaging'),
|
||||
name: 'packagingFk',
|
||||
columnFilter: false,
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: 'Packing',
|
||||
name: 'packing',
|
||||
columnFilter: false,
|
||||
cardVisible: true,
|
||||
},
|
||||
];
|
||||
</script>
|
||||
<template>
|
||||
<QDialog>
|
||||
<div class="container">
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="StockBoughtsDetail"
|
||||
:url="customUrl"
|
||||
order="itemName DESC"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:disable-infinite-scroll="true"
|
||||
:disable-option="{ card: true }"
|
||||
:limit="0"
|
||||
auto-load
|
||||
>
|
||||
<template #column-entryFk="{ row }">
|
||||
<span class="link">
|
||||
{{ row?.entryFk }}
|
||||
<EntryDescriptorProxy :id="row.entryFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-itemName="{ row }">
|
||||
<span class="link">
|
||||
{{ row?.itemName }}
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</div>
|
||||
</QDialog>
|
||||
</template>
|
||||
<style lang="css" scoped>
|
||||
.container {
|
||||
max-width: 50vw;
|
||||
overflow: auto;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: auto;
|
||||
background-color: var(--vn-section-color);
|
||||
padding: 4px;
|
||||
}
|
||||
.container > div > div > .q-table__top.relative-position.row.items-center {
|
||||
background-color: red !important;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
Buyer: Comprador
|
||||
Reserve: Reservado
|
||||
Bought: Comprado
|
||||
More: Más
|
||||
Date: Fecha
|
||||
Entry: Entrada
|
||||
Item: Artículo
|
||||
Name: Nombre
|
||||
Volume: Volumen
|
||||
Packaging: Embalage
|
||||
</i18n>
|
|
@ -0,0 +1,63 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { onMounted } from 'vue';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const stateStore = useStateStore();
|
||||
const emit = defineEmits(['set-user-params']);
|
||||
const setUserParams = (params) => {
|
||||
emit('set-user-params', params);
|
||||
};
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<VnFilterPanel
|
||||
:data-key="props.dataKey"
|
||||
:search-button="true"
|
||||
search-url="table"
|
||||
@set-user-params="setUserParams"
|
||||
>
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params }">
|
||||
<QItem class="q-my-sm">
|
||||
<QItemSection>
|
||||
<VnInputDate
|
||||
id="date"
|
||||
v-model="params.dated"
|
||||
:label="t('Date')"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
<i18n>
|
||||
en:
|
||||
params:
|
||||
dated: Date
|
||||
workerFk: Worker
|
||||
es:
|
||||
Date: Fecha
|
||||
params:
|
||||
dated: Date
|
||||
workerFk: Trabajador
|
||||
</i18n>
|
|
@ -0,0 +1,72 @@
|
|||
<script setup>
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
|
||||
const isLoading = ref(false);
|
||||
const dateFrom = ref();
|
||||
const dateTo = ref();
|
||||
|
||||
const optionsTo = computed(() => (date) => {
|
||||
if (!dateFrom.value) return true;
|
||||
return new Date(date) >= new Date(dateFrom.value);
|
||||
});
|
||||
|
||||
watch(dateFrom, (newDateFrom) => {
|
||||
if (dateTo.value && new Date(dateTo.value) < new Date(newDateFrom))
|
||||
dateTo.value = newDateFrom;
|
||||
});
|
||||
|
||||
const recalc = async () => {
|
||||
const { notify } = useNotify();
|
||||
|
||||
const params = {
|
||||
schema: 'bs',
|
||||
params: [new Date(dateFrom.value), new Date(dateTo.value)],
|
||||
};
|
||||
|
||||
try {
|
||||
isLoading.value = true;
|
||||
await axios.post('Applications/waste_addSales/execute-proc', params);
|
||||
notify('wasteRecalc.recalcOk', 'positive');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="q-pa-lg row justify-center">
|
||||
<QCard class="bg-light" style="width: 300px">
|
||||
<QCardSection>
|
||||
<VnInputDate
|
||||
class="q-mb-lg"
|
||||
v-model="dateFrom"
|
||||
:label="$t('globals.from')"
|
||||
rounded
|
||||
dense
|
||||
/>
|
||||
<VnInputDate
|
||||
class="q-mb-lg"
|
||||
v-model="dateTo"
|
||||
:options="optionsTo"
|
||||
:label="$t('globals.to')"
|
||||
:disable="!dateFrom"
|
||||
rounded
|
||||
dense
|
||||
/>
|
||||
<QBtn
|
||||
color="primary"
|
||||
text-color="white"
|
||||
:label="$t('globals.recalc')"
|
||||
:loading="isLoading"
|
||||
:disable="isLoading || !(dateFrom && dateTo)"
|
||||
@click="recalc()"
|
||||
/>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</div>
|
||||
</template>
|
|
@ -9,22 +9,27 @@ import VnTable from 'components/VnTable/VnTable.vue';
|
|||
|
||||
const { t } = useI18n();
|
||||
const quasar = useQuasar();
|
||||
const params = {
|
||||
daysOnward: 7,
|
||||
daysAgo: 3,
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
name: 'id',
|
||||
label: t('customer.extendedList.tableVisibleColumns.id'),
|
||||
label: t('myEntries.id'),
|
||||
columnFilter: false,
|
||||
isTitle: true,
|
||||
},
|
||||
{
|
||||
visible: false,
|
||||
align: 'right',
|
||||
label: t('shipped'),
|
||||
label: t('myEntries.shipped'),
|
||||
name: 'shipped',
|
||||
columnFilter: {
|
||||
name: 'fromShipped',
|
||||
label: t('fromShipped'),
|
||||
label: t('myEntries.fromShipped'),
|
||||
component: 'date',
|
||||
},
|
||||
format: ({ shipped }) => toDate(shipped),
|
||||
|
@ -32,11 +37,11 @@ const columns = computed(() => [
|
|||
{
|
||||
visible: false,
|
||||
align: 'left',
|
||||
label: t('shipped'),
|
||||
label: t('myEntries.shipped'),
|
||||
name: 'shipped',
|
||||
columnFilter: {
|
||||
name: 'toShipped',
|
||||
label: t('toShipped'),
|
||||
label: t('myEntries.toShipped'),
|
||||
component: 'date',
|
||||
},
|
||||
format: ({ shipped }) => toDate(shipped),
|
||||
|
@ -44,14 +49,14 @@ const columns = computed(() => [
|
|||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: t('shipped'),
|
||||
label: t('myEntries.shipped'),
|
||||
name: 'shipped',
|
||||
columnFilter: false,
|
||||
format: ({ shipped }) => toDate(shipped),
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: t('landed'),
|
||||
label: t('myEntries.landed'),
|
||||
name: 'landed',
|
||||
columnFilter: false,
|
||||
format: ({ landed }) => toDate(landed),
|
||||
|
@ -59,26 +64,36 @@ const columns = computed(() => [
|
|||
|
||||
{
|
||||
align: 'right',
|
||||
label: t('globals.wareHouseIn'),
|
||||
label: t('myEntries.wareHouseIn'),
|
||||
name: 'warehouseInFk',
|
||||
format: (row) => row.warehouseInName,
|
||||
format: (row) => {
|
||||
row.warehouseInName;
|
||||
},
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
name: 'warehouseInFk',
|
||||
label: t('myEntries.warehouseInFk'),
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'warehouses',
|
||||
fields: ['id', 'name'],
|
||||
optionLabel: 'name',
|
||||
optionValue: 'id',
|
||||
},
|
||||
alias: 't',
|
||||
},
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('globals.daysOnward'),
|
||||
name: 'days',
|
||||
label: t('myEntries.daysOnward'),
|
||||
name: 'daysOnward',
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('myEntries.daysAgo'),
|
||||
name: 'daysAgo',
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
|
@ -88,6 +103,7 @@ const columns = computed(() => [
|
|||
{
|
||||
title: t('printLabels'),
|
||||
icon: 'print',
|
||||
isPrimary: true,
|
||||
action: (row) => printBuys(row.id),
|
||||
},
|
||||
],
|
||||
|
@ -114,9 +130,11 @@ const printBuys = (rowId) => {
|
|||
data-key="myEntriesList"
|
||||
url="Entries/filter"
|
||||
:columns="columns"
|
||||
:user-params="params"
|
||||
default-mode="card"
|
||||
order="shipped DESC"
|
||||
auto-load
|
||||
chip-locale="myEntries"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -6,9 +6,17 @@ entryFilter:
|
|||
filter:
|
||||
search: General search
|
||||
reference: Reference
|
||||
landed: Landed
|
||||
shipped: Shipped
|
||||
fromShipped: Shipped(from)
|
||||
toShipped: Shipped(to)
|
||||
printLabels: Print stickers
|
||||
viewLabel: View sticker
|
||||
myEntries:
|
||||
id: ID
|
||||
landed: Landed
|
||||
shipped: Shipped
|
||||
fromShipped: Shipped(from)
|
||||
toShipped: Shipped(to)
|
||||
printLabels: Print stickers
|
||||
viewLabel: View sticker
|
||||
wareHouseIn: Warehouse in
|
||||
warehouseInFk: Warehouse in
|
||||
daysOnward: Days onward
|
||||
daysAgo: Days ago
|
||||
wasteRecalc:
|
||||
recalcOk: The wastes were successfully recalculated
|
||||
|
|
|
@ -9,10 +9,17 @@ entryFilter:
|
|||
filter:
|
||||
search: Búsqueda general
|
||||
reference: Referencia
|
||||
|
||||
landed: F. llegada
|
||||
shipped: F. salida
|
||||
fromShipped: F. salida(desde)
|
||||
toShipped: F. salida(hasta)
|
||||
printLabels: Imprimir etiquetas
|
||||
viewLabel: Ver etiqueta
|
||||
myEntries:
|
||||
id: ID
|
||||
landed: F. llegada
|
||||
shipped: F. salida
|
||||
fromShipped: F. salida(desde)
|
||||
toShipped: F. salida(hasta)
|
||||
printLabels: Imprimir etiquetas
|
||||
viewLabel: Ver etiqueta
|
||||
wareHouseIn: Alm. entrada
|
||||
warehouseInFk: Alm. entrada
|
||||
daysOnward: Días adelante
|
||||
daysAgo: Días atras
|
||||
wasteRecalc:
|
||||
recalcOk: Se han recalculado las mermas correctamente
|
||||
|
|
|
@ -274,10 +274,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
|||
:label="t('invoiceIn.summary.company')"
|
||||
:value="entity.company?.code"
|
||||
/>
|
||||
<VnLv
|
||||
:label="t('invoiceIn.summary.booked')"
|
||||
:value="invoiceIn?.isBooked"
|
||||
/>
|
||||
<VnLv :label="t('invoiceIn.isBooked')" :value="invoiceIn?.isBooked" />
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<QCardSection class="q-pa-none">
|
||||
|
|
|
@ -116,7 +116,7 @@ const activities = ref([]);
|
|||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
:label="t('params.isBooked')"
|
||||
:label="t('invoiceIn.isBooked')"
|
||||
v-model="params.isBooked"
|
||||
@update:model-value="searchFn()"
|
||||
toggle-indeterminate
|
||||
|
@ -170,7 +170,7 @@ es:
|
|||
awb: AWB
|
||||
amount: Importe
|
||||
issued: Emitida
|
||||
isBooked: Conciliada
|
||||
isBooked: Contabilizada
|
||||
account: Cuenta contable
|
||||
created: Creada
|
||||
dued: Vencida
|
||||
|
|
|
@ -65,7 +65,7 @@ const cols = computed(() => [
|
|||
{
|
||||
align: 'left',
|
||||
name: 'isBooked',
|
||||
label: t('invoiceIn.list.isBooked'),
|
||||
label: t('invoiceIn.isBooked'),
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
invoiceIn:
|
||||
serial: Serial
|
||||
isBooked: Is booked
|
||||
list:
|
||||
ref: Reference
|
||||
supplier: Supplier
|
||||
|
@ -7,7 +8,6 @@ invoiceIn:
|
|||
serial: Serial
|
||||
file: File
|
||||
issued: Issued
|
||||
isBooked: Is booked
|
||||
awb: AWB
|
||||
amount: Amount
|
||||
card:
|
||||
|
@ -31,7 +31,6 @@ invoiceIn:
|
|||
sage: Sage withholding
|
||||
vat: Undeductible VAT
|
||||
company: Company
|
||||
booked: Booked
|
||||
expense: Expense
|
||||
taxableBase: Taxable base
|
||||
rate: Rate
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
invoiceIn:
|
||||
serial: Serie
|
||||
isBooked: Contabilizada
|
||||
list:
|
||||
ref: Referencia
|
||||
supplier: Proveedor
|
||||
|
@ -7,7 +8,6 @@ invoiceIn:
|
|||
shortIssued: F. emisión
|
||||
file: Fichero
|
||||
issued: Fecha emisión
|
||||
isBooked: Conciliada
|
||||
awb: AWB
|
||||
amount: Importe
|
||||
card:
|
||||
|
@ -31,7 +31,6 @@ invoiceIn:
|
|||
sage: Retención sage
|
||||
vat: Iva no deducible
|
||||
company: Empresa
|
||||
booked: Contabilizada
|
||||
expense: Gasto
|
||||
taxableBase: Base imp.
|
||||
rate: Tasa
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script setup>
|
||||
import InvoiceOutDescriptor from './InvoiceOutDescriptor.vue';
|
||||
import InvoiceOutSummary from './InvoiceOutSummary.vue';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -10,6 +11,10 @@ const $props = defineProps({
|
|||
</script>
|
||||
<template>
|
||||
<QPopupProxy>
|
||||
<InvoiceOutDescriptor v-if="$props.id" :id="$props.id" />
|
||||
<InvoiceOutDescriptor
|
||||
v-if="$props.id"
|
||||
:id="$props.id"
|
||||
:summary="InvoiceOutSummary"
|
||||
/>
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
|
|
@ -29,13 +29,16 @@ const { openReport } = usePrintService();
|
|||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
name: 'id',
|
||||
label: t('invoiceOutList.tableVisibleColumns.id'),
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
columnFilter: {
|
||||
name: 'search',
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
|
|
@ -9,6 +9,7 @@ import { useArrayData } from 'src/composables/useArrayData';
|
|||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import TicketDescriptorProxy from '../Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const tableRef = ref();
|
||||
|
@ -64,7 +65,8 @@ const columns = computed(() => [
|
|||
cardVisible: true,
|
||||
attrs: {
|
||||
url: 'Clients',
|
||||
fields: ['id', 'name'],
|
||||
optionLabel: 'socialName',
|
||||
optionValue: 'socialName',
|
||||
},
|
||||
columnField: {
|
||||
component: null,
|
||||
|
@ -191,10 +193,33 @@ const downloadCSV = async () => {
|
|||
<WorkerDescriptorProxy :id="row.comercialId" />
|
||||
</span>
|
||||
</template>
|
||||
<template #moreFilterPanel="{ params }">
|
||||
<VnInputDate
|
||||
:label="t('params.from')"
|
||||
v-model="params.from"
|
||||
class="q-px-xs q-pr-lg"
|
||||
filled
|
||||
dense
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('params.to')"
|
||||
v-model="params.to"
|
||||
class="q-px-xs q-pr-lg"
|
||||
filled
|
||||
dense
|
||||
/>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Download as CSV: Descargar como CSV
|
||||
params:
|
||||
from: Desde
|
||||
to: Hasta
|
||||
en:
|
||||
params:
|
||||
from: From
|
||||
to: To
|
||||
</i18n>
|
||||
|
|
|
@ -514,7 +514,7 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
</template>
|
||||
<template #column-minPrice="props">
|
||||
<QTd class="col">
|
||||
<div class="row">
|
||||
<div class="row" style="align-items: center">
|
||||
<QCheckbox
|
||||
:model-value="props.row.hasMinPrice"
|
||||
@update:model-value="updateMinPrice($event, props)"
|
||||
|
@ -600,11 +600,14 @@ function handleOnDataSave({ CrudModelRef }) {
|
|||
.q-table th,
|
||||
.q-table td {
|
||||
padding-inline: 5px !important;
|
||||
// text-align: -webkit-right;
|
||||
}
|
||||
.q-table tr td {
|
||||
font-size: 10pt;
|
||||
border-top: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.q-table tbody td {
|
||||
max-width: none;
|
||||
|
||||
.q-td.col {
|
||||
& .vnInputDate {
|
||||
min-width: 90px;
|
||||
|
|
|
@ -139,6 +139,7 @@ const openTab = (id) =>
|
|||
:disable-option="{ card: true }"
|
||||
>
|
||||
<template #top-left>
|
||||
<div class="q-mt-sm">
|
||||
<QBtn
|
||||
icon="refresh"
|
||||
size="md"
|
||||
|
@ -158,7 +159,7 @@ const openTab = (id) =>
|
|||
color="primary"
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
$t('salesOrdersTable.deleteConfirmTitle'),
|
||||
$t('globals.deleteConfirmTitle'),
|
||||
$t('salesOrdersTable.deleteConfirmMessage'),
|
||||
removeOrders
|
||||
)
|
||||
|
@ -166,6 +167,7 @@ const openTab = (id) =>
|
|||
>
|
||||
<QTooltip>{{ t('salesOrdersTable.delete') }}</QTooltip>
|
||||
</QBtn>
|
||||
</div>
|
||||
</template>
|
||||
<template #column-dateSend="{ row }">
|
||||
<QTd>
|
||||
|
|
|
@ -15,7 +15,6 @@ salesOrdersTable:
|
|||
dateMake: Make date
|
||||
client: Client
|
||||
salesPerson: Salesperson
|
||||
deleteConfirmTitle: Delete selected elements
|
||||
deleteConfirmMessage: All the selected elements will be deleted. Are you sure you want to continue?
|
||||
agency: Agency
|
||||
import: Import
|
||||
|
|
|
@ -15,7 +15,6 @@ salesOrdersTable:
|
|||
dateMake: Fecha de realización
|
||||
client: Cliente
|
||||
salesPerson: Comercial
|
||||
deleteConfirmTitle: Eliminar los elementos seleccionados
|
||||
deleteConfirmMessage: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar?
|
||||
agency: Agencia
|
||||
import: Importe
|
||||
|
|
|
@ -249,7 +249,7 @@ watch(
|
|||
@on-fetch="(data) => (orderSummary.vat = data)"
|
||||
auto-load
|
||||
/>
|
||||
<QDrawer side="right" :width="270" v-model="stateStore.rightDrawer">
|
||||
<QDrawer side="right" :width="265" v-model="stateStore.rightDrawer">
|
||||
<QCard
|
||||
class="order-lines-summary q-pa-lg"
|
||||
v-if="orderSummary.vat && orderSummary.total"
|
||||
|
|
|
@ -14,14 +14,15 @@ import OrderFilter from './Card/OrderFilter.vue';
|
|||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import WorkerDescriptorProxy from '../Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import { toDateTimeFormat } from 'src/filters/date';
|
||||
import { onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const tableRef = ref();
|
||||
const agencyList = ref([]);
|
||||
const addressesList = ref([]);
|
||||
const clientId = ref();
|
||||
|
||||
const route = useRoute();
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -169,6 +170,13 @@ const getDateColor = (date) => {
|
|||
if (comparation == 0) return 'bg-warning';
|
||||
if (comparation < 0) return 'bg-success';
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (!route.query.createForm) return;
|
||||
const clientId = route.query.createForm;
|
||||
const id = JSON.parse(clientId);
|
||||
fetchClientAddress(id.clientFk, id);
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<OrderSearchbar />
|
||||
|
@ -184,13 +192,14 @@ const getDateColor = (date) => {
|
|||
:order="['landed DESC', 'clientFk ASC', 'id DESC']"
|
||||
:create="{
|
||||
urlCreate: 'Orders/new',
|
||||
title: 'Create Order',
|
||||
title: t('module.cerateOrder'),
|
||||
onDataSaved: (url) => {
|
||||
tableRef.redirect(url);
|
||||
},
|
||||
formInitialData: {
|
||||
active: true,
|
||||
addressId: null,
|
||||
clientFk: null,
|
||||
},
|
||||
}"
|
||||
:user-params="{ showEmpty: false }"
|
||||
|
@ -221,7 +230,7 @@ const getDateColor = (date) => {
|
|||
<VnSelect
|
||||
url="Clients"
|
||||
:include="{ relation: 'addresses' }"
|
||||
v-model="clientId"
|
||||
v-model="data.clientFk"
|
||||
:label="t('module.customer')"
|
||||
@update:model-value="(id) => fetchClientAddress(id, data)"
|
||||
/>
|
||||
|
|
|
@ -10,6 +10,7 @@ module:
|
|||
total: Total
|
||||
salesPerson: Sales Person
|
||||
address: Address
|
||||
cerateOrder: Create order
|
||||
lines:
|
||||
item: Item
|
||||
warehouse: Warehouse
|
||||
|
|
|
@ -10,6 +10,7 @@ module:
|
|||
total: Total
|
||||
salesPerson: Comercial
|
||||
address: Dirección
|
||||
cerateOrder: Crear cesta
|
||||
lines:
|
||||
item: Artículo
|
||||
warehouse: Almacén
|
||||
|
|
|
@ -27,12 +27,15 @@ const columns = computed(() => [
|
|||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('globals.name'),
|
||||
name: 'name',
|
||||
isTitle: true,
|
||||
columnFilter: false,
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -70,8 +73,9 @@ const columns = computed(() => [
|
|||
data-key="AgencyList"
|
||||
:expr-builder="exprBuilder"
|
||||
/>
|
||||
<div class="list-container">
|
||||
<div class="list">
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="AgencyList"
|
||||
url="Agencies"
|
||||
order="name"
|
||||
|
@ -81,7 +85,21 @@ const columns = computed(() => [
|
|||
redirect="agency"
|
||||
default-mode="card"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 55%;
|
||||
}
|
||||
.list-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
es:
|
||||
isOwn: Tiene propietario
|
||||
|
|
|
@ -46,13 +46,13 @@ async function deleteWorCenter(id) {
|
|||
}
|
||||
</script>
|
||||
<template>
|
||||
<div class="centerCard">
|
||||
<FetchData
|
||||
url="workCenters"
|
||||
sort-by="name"
|
||||
@on-fetch="(data) => (warehouses = data)"
|
||||
auto-load
|
||||
/>
|
||||
<div class="centerCard">
|
||||
<VnPaginate
|
||||
ref="paginate"
|
||||
data-key="AgencyWorkCenters"
|
||||
|
|
|
@ -167,8 +167,8 @@ const setTicketsRoute = async () => {
|
|||
<QTd :props="props">
|
||||
<span class="link">
|
||||
{{ props.value }}
|
||||
<TicketDescriptorProxy :id="props?.row?.id" />
|
||||
</span>
|
||||
<TicketDescriptorProxy :id="props?.row?.id" />
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-client="props">
|
||||
|
|
|
@ -0,0 +1,360 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { toDate } from 'src/filters';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { usePrintService } from 'src/composables/usePrintService';
|
||||
|
||||
import axios from 'axios';
|
||||
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
|
||||
import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue';
|
||||
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
|
||||
const { openReport } = usePrintService();
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const quasar = useQuasar();
|
||||
const selectedRows = ref([]);
|
||||
const tableRef = ref([]);
|
||||
const confirmationDialog = ref(false);
|
||||
const startingDate = ref(null);
|
||||
const router = useRouter();
|
||||
const routeFilter = {
|
||||
include: [
|
||||
{
|
||||
relation: 'workers',
|
||||
scope: {
|
||||
fields: ['id', 'firstName'],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
name: 'id',
|
||||
label: 'Id',
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'workerFk',
|
||||
label: t('route.Worker'),
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
useLike: false,
|
||||
optionFilter: 'firstName',
|
||||
find: {
|
||||
value: 'workerFk',
|
||||
label: 'workerUserName',
|
||||
},
|
||||
},
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
useLike: false,
|
||||
cardVisible: true,
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'agencyModeFk',
|
||||
label: t('route.Agency'),
|
||||
isTitle: true,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'agencyModes',
|
||||
fields: ['id', 'name'],
|
||||
find: {
|
||||
value: 'agencyModeFk',
|
||||
label: 'agencyName',
|
||||
},
|
||||
},
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'vehicleFk',
|
||||
label: t('route.Vehicle'),
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'vehicles',
|
||||
fields: ['id', 'numberPlate'],
|
||||
optionLabel: 'numberPlate',
|
||||
optionFilterValue: 'numberPlate',
|
||||
find: {
|
||||
value: 'vehicleFk',
|
||||
label: 'vehiclePlateNumber',
|
||||
},
|
||||
},
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'created',
|
||||
label: t('route.Date'),
|
||||
columnFilter: false,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'from',
|
||||
label: t('route.From'),
|
||||
visible: false,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'to',
|
||||
label: t('route.To'),
|
||||
visible: false,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'm3',
|
||||
label: 'm3',
|
||||
cardVisible: true,
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'started',
|
||||
label: t('route.hourStarted'),
|
||||
component: 'time',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'finished',
|
||||
label: t('route.hourFinished'),
|
||||
component: 'time',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'kmStart',
|
||||
label: t('route.KmStart'),
|
||||
columnClass: 'shrink',
|
||||
create: true,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'kmEnd',
|
||||
label: t('route.KmEnd'),
|
||||
columnClass: 'shrink',
|
||||
create: true,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'description',
|
||||
label: t('route.Description'),
|
||||
isTitle: true,
|
||||
create: true,
|
||||
component: 'input',
|
||||
field: 'description',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'isOk',
|
||||
label: t('route.Served'),
|
||||
component: 'checkbox',
|
||||
columnFilter: false,
|
||||
columnClass: 'shrink',
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('route.Add tickets'),
|
||||
icon: 'vn:ticketAdd',
|
||||
action: (row) => openTicketsDialog(row?.id),
|
||||
isPrimary: true,
|
||||
},
|
||||
{
|
||||
title: t('route.components.smartCard.viewSummary'),
|
||||
icon: 'preview',
|
||||
action: (row) => viewSummary(row?.id, RouteSummary),
|
||||
isPrimary: true,
|
||||
},
|
||||
{
|
||||
title: t('route.Route summary'),
|
||||
icon: 'arrow_forward',
|
||||
action: (row) => navigate(row?.id),
|
||||
isPrimary: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
function navigate(id) {
|
||||
router.push({ path: `/route/${id}` });
|
||||
}
|
||||
|
||||
const cloneRoutes = () => {
|
||||
if (!selectedRows.value.length || !startingDate.value) return;
|
||||
axios.post('Routes/clone', {
|
||||
created: startingDate.value,
|
||||
ids: selectedRows.value.map((row) => row?.id),
|
||||
});
|
||||
startingDate.value = null;
|
||||
tableRef.value.reload();
|
||||
};
|
||||
|
||||
const showRouteReport = () => {
|
||||
const ids = selectedRows.value.map((row) => row?.id);
|
||||
const idString = ids.join(',');
|
||||
let url = `Routes/${idString}/driver-route-pdf`;
|
||||
let params = {};
|
||||
if (selectedRows.value.length >= 1) {
|
||||
params = {
|
||||
id: idString,
|
||||
};
|
||||
url = `Routes/downloadZip`;
|
||||
}
|
||||
openReport(url, params, '_blank');
|
||||
};
|
||||
|
||||
function markAsServed() {
|
||||
selectedRows.value.forEach(async (row) => {
|
||||
await axios.patch(`Routes/${row?.id}`, { isOk: true });
|
||||
});
|
||||
tableRef.value.reload();
|
||||
startingDate.value = null;
|
||||
}
|
||||
|
||||
const openTicketsDialog = (id) => {
|
||||
quasar
|
||||
.dialog({
|
||||
component: RouteListTicketsDialog,
|
||||
componentProps: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
.onOk(() => tableRef.value.reload());
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RouteSearchbar />
|
||||
<QDialog v-model="confirmationDialog">
|
||||
<QCard style="min-width: 350px">
|
||||
<QCardSection>
|
||||
<p class="text-h6 q-ma-none">{{ t('route.Select the starting date') }}</p>
|
||||
</QCardSection>
|
||||
|
||||
<QCardSection class="q-pt-none">
|
||||
<VnInputDate
|
||||
:label="t('route.Stating date')"
|
||||
v-model="startingDate"
|
||||
autofocus
|
||||
/>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn
|
||||
flat
|
||||
:label="t('route.Cancel')"
|
||||
v-close-popup
|
||||
class="text-primary"
|
||||
/>
|
||||
<QBtn color="primary" v-close-popup @click="cloneRoutes">
|
||||
{{ t('globals.clone') }}
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
<VnSubToolbar />
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<RouteFilter data-key="RouteList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
class="route-list"
|
||||
ref="tableRef"
|
||||
data-key="RouteList"
|
||||
url="Routes/filter"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:is-editable="true"
|
||||
:filter="routeFilter"
|
||||
redirect="route"
|
||||
:row-click="false"
|
||||
:create="{
|
||||
urlCreate: 'Routes',
|
||||
title: t('route.createRoute'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: {},
|
||||
}"
|
||||
save-url="Routes/crud"
|
||||
:disable-option="{ card: true }"
|
||||
table-height="85vh"
|
||||
v-model:selected="selectedRows"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
>
|
||||
<template #moreBeforeActions>
|
||||
<QBtn
|
||||
icon="vn:clone"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="confirmationDialog = true"
|
||||
>
|
||||
<QTooltip>{{ t('route.Clone Selected Routes') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="cloud_download"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="showRouteReport"
|
||||
>
|
||||
<QTooltip>{{ t('route.Download selected routes as PDF') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="check"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="markAsServed()"
|
||||
>
|
||||
<QTooltip>{{ t('route.Mark as served') }}</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
|
@ -1,34 +1,19 @@
|
|||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useSession } from 'composables/useSession';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { toDate } from 'src/filters';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { toHour } from 'src/filters';
|
||||
|
||||
import axios from 'axios';
|
||||
import RouteSearchbar from 'pages/Route/Card/RouteSearchbar.vue';
|
||||
import RouteListTicketsDialog from 'pages/Route/Card/RouteListTicketsDialog.vue';
|
||||
import RouteSummary from 'pages/Route/Card/RouteSummary.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import RouteFilter from 'pages/Route/Card/RouteFilter.vue';
|
||||
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import { usePrintService } from 'src/composables/usePrintService';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
|
||||
const { openReport } = usePrintService();
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const quasar = useQuasar();
|
||||
const session = useSession();
|
||||
const selectedRows = ref([]);
|
||||
const tableRef = ref([]);
|
||||
const confirmationDialog = ref(false);
|
||||
const startingDate = ref(null);
|
||||
const router = useRouter();
|
||||
const routeFilter = {
|
||||
include: [
|
||||
{
|
||||
|
@ -42,156 +27,70 @@ const routeFilter = {
|
|||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
isId: true,
|
||||
name: 'id',
|
||||
label: 'Id',
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'workerFk',
|
||||
label: t('Worker'),
|
||||
label: t('route.Worker'),
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Workers/activeWithInheritedRole',
|
||||
fields: ['id', 'name'],
|
||||
useLike: false,
|
||||
optionFilter: 'firstName',
|
||||
find: {
|
||||
value: 'workerFk',
|
||||
label: 'workerUserName',
|
||||
},
|
||||
},
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
useLike: false,
|
||||
cardVisible: true,
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.travelRef),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'agencyModeFk',
|
||||
label: t('Agency'),
|
||||
isTitle: true,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'agencyModes',
|
||||
fields: ['id', 'name'],
|
||||
find: {
|
||||
value: 'agencyModeFk',
|
||||
label: 'agencyName',
|
||||
},
|
||||
},
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'vehicleFk',
|
||||
label: t('Vehicle'),
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'vehicles',
|
||||
fields: ['id', 'numberPlate'],
|
||||
optionLabel: 'numberPlate',
|
||||
optionFilterValue: 'numberPlate',
|
||||
find: {
|
||||
value: 'vehicleFk',
|
||||
label: 'vehiclePlateNumber',
|
||||
},
|
||||
},
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'created',
|
||||
label: t('Date'),
|
||||
columnFilter: false,
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'from',
|
||||
label: t('From'),
|
||||
visible: false,
|
||||
name: 'agencyName',
|
||||
label: t('route.Agency'),
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
columnClass: 'expand',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'to',
|
||||
label: t('To'),
|
||||
visible: false,
|
||||
name: 'vehiclePlateNumber',
|
||||
label: t('route.Vehicle'),
|
||||
cardVisible: true,
|
||||
create: true,
|
||||
component: 'date',
|
||||
format: ({ date }) => toDate(date),
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'm3',
|
||||
label: t('Volume'),
|
||||
cardVisible: true,
|
||||
columnClass: 'shrink',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'started',
|
||||
label: t('hourStarted'),
|
||||
component: 'time',
|
||||
label: t('route.hourStarted'),
|
||||
cardVisible: true,
|
||||
columnFilter: false,
|
||||
format: (row) => toHour(row.started),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'finished',
|
||||
label: t('hourFinished'),
|
||||
component: 'time',
|
||||
label: t('route.hourFinished'),
|
||||
cardVisible: true,
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'kmStart',
|
||||
label: t('KmStart'),
|
||||
columnClass: 'shrink',
|
||||
create: true,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'kmEnd',
|
||||
label: t('KmEnd'),
|
||||
columnClass: 'shrink',
|
||||
create: true,
|
||||
visible: false,
|
||||
format: (row) => toHour(row.started),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'description',
|
||||
label: t('Description'),
|
||||
label: t('route.Description'),
|
||||
cardVisible: true,
|
||||
isTitle: true,
|
||||
create: true,
|
||||
component: 'input',
|
||||
field: 'description',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'isOk',
|
||||
label: t('Served'),
|
||||
label: t('route.Served'),
|
||||
component: 'checkbox',
|
||||
columnFilter: false,
|
||||
columnClass: 'shrink',
|
||||
|
@ -200,212 +99,43 @@ const columns = computed(() => [
|
|||
align: 'right',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('Add tickets'),
|
||||
icon: 'vn:ticketAdd',
|
||||
action: (row) => openTicketsDialog(row?.id),
|
||||
},
|
||||
{
|
||||
title: t('components.smartCard.viewSummary'),
|
||||
icon: 'preview',
|
||||
action: (row) => viewSummary(row?.id, RouteSummary),
|
||||
},
|
||||
{
|
||||
title: t('Route summary'),
|
||||
icon: 'arrow_forward',
|
||||
isPrimary: true,
|
||||
action: (row) => navigate(row?.id),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
function navigate(id) {
|
||||
router.push({ path: `/route/${id}` });
|
||||
}
|
||||
|
||||
const cloneRoutes = () => {
|
||||
if (!selectedRows.value.length || !startingDate.value) return;
|
||||
axios.post('Routes/clone', {
|
||||
created: startingDate.value,
|
||||
ids: selectedRows.value.map((row) => row?.id),
|
||||
});
|
||||
startingDate.value = null;
|
||||
tableRef.value.reload();
|
||||
};
|
||||
|
||||
const showRouteReport = () => {
|
||||
const ids = selectedRows.value.map((row) => row?.id);
|
||||
const idString = ids.join(',');
|
||||
let url = `Routes/${idString}/driver-route-pdf`;
|
||||
let params = {};
|
||||
if (selectedRows.value.length >= 1) {
|
||||
params = {
|
||||
id: idString,
|
||||
};
|
||||
url = `Routes/downloadZip`;
|
||||
}
|
||||
openReport(url, params, '_blank');
|
||||
};
|
||||
|
||||
function markAsServed() {
|
||||
selectedRows.value.forEach(async (row) => {
|
||||
await axios.patch(`Routes/${row?.id}`, { isOk: true });
|
||||
});
|
||||
tableRef.value.reload();
|
||||
startingDate.value = null;
|
||||
}
|
||||
|
||||
const openTicketsDialog = (id) => {
|
||||
quasar
|
||||
.dialog({
|
||||
component: RouteListTicketsDialog,
|
||||
componentProps: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
.onOk(() => tableRef.value.reload());
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RouteSearchbar />
|
||||
<QDialog v-model="confirmationDialog">
|
||||
<QCard style="min-width: 350px">
|
||||
<QCardSection>
|
||||
<p class="text-h6 q-ma-none">{{ t('Select the starting date') }}</p>
|
||||
</QCardSection>
|
||||
|
||||
<QCardSection class="q-pt-none">
|
||||
<VnInputDate
|
||||
:label="t('Stating date')"
|
||||
v-model="startingDate"
|
||||
autofocus
|
||||
/>
|
||||
</QCardSection>
|
||||
<QCardActions align="right">
|
||||
<QBtn flat :label="t('Cancel')" v-close-popup class="text-primary" />
|
||||
<QBtn color="primary" v-close-popup @click="cloneRoutes">
|
||||
{{ t('globals.clone') }}
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
<VnSubToolbar />
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<RouteFilter data-key="RouteList" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
class="route-list"
|
||||
ref="tableRef"
|
||||
data-key="RouteList"
|
||||
url="Routes/filter"
|
||||
:columns="columns"
|
||||
:right-search="false"
|
||||
:is-editable="true"
|
||||
:filter="routeFilter"
|
||||
redirect="route"
|
||||
:row-click="false"
|
||||
:create="{
|
||||
urlCreate: 'Routes',
|
||||
title: t('Create route'),
|
||||
title: t('route.createRoute'),
|
||||
onDataSaved: ({ id }) => tableRef.redirect(id),
|
||||
formInitialData: {},
|
||||
}"
|
||||
save-url="Routes/crud"
|
||||
:disable-option="{ card: true }"
|
||||
table-height="85vh"
|
||||
v-model:selected="selectedRows"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
>
|
||||
<template #moreBeforeActions>
|
||||
<QBtn
|
||||
icon="vn:clone"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="confirmationDialog = true"
|
||||
>
|
||||
<QTooltip>{{ t('Clone Selected Routes') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="cloud_download"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="showRouteReport"
|
||||
>
|
||||
<QTooltip>{{ t('Download selected routes as PDF') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
icon="check"
|
||||
color="primary"
|
||||
class="q-mr-sm"
|
||||
:disable="!selectedRows?.length"
|
||||
@click="markAsServed()"
|
||||
>
|
||||
<QTooltip>{{ t('Mark as served') }}</QTooltip>
|
||||
</QBtn>
|
||||
<template #column-workerFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row?.workerUserName }}
|
||||
<WorkerDescriptorProxy :id="row?.workerFk" v-if="row?.workerFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.table-input-cell {
|
||||
max-width: 143px;
|
||||
}
|
||||
|
||||
.route-list {
|
||||
width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.table-actions {
|
||||
gap: 12px;
|
||||
}
|
||||
th:last-child,
|
||||
td:last-child {
|
||||
background-color: var(--vn-section-color);
|
||||
position: sticky;
|
||||
right: 0;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
en:
|
||||
newRoute: New Route
|
||||
hourStarted: Started hour
|
||||
hourFinished: Finished hour
|
||||
es:
|
||||
From: Desde
|
||||
To: Hasta
|
||||
Worker: Trabajador
|
||||
Agency: Agencia
|
||||
Vehicle: Vehículo
|
||||
Volume: Volumen
|
||||
Date: Fecha
|
||||
Description: Descripción
|
||||
Hour started: Hora inicio
|
||||
Hour finished: Hora fin
|
||||
KmStart: Km inicio
|
||||
KmEnd: Km fin
|
||||
Served: Servida
|
||||
newRoute: Nueva Ruta
|
||||
Clone Selected Routes: Clonar rutas seleccionadas
|
||||
Select the starting date: Seleccione la fecha de inicio
|
||||
Stating date: Fecha de inicio
|
||||
Cancel: Cancelar
|
||||
Mark as served: Marcar como servidas
|
||||
Download selected routes as PDF: Descargar rutas seleccionadas como PDF
|
||||
Add ticket: Añadir tickets
|
||||
Preview: Vista previa
|
||||
Summary: Resumen
|
||||
Route is closed: La ruta está cerrada
|
||||
Route is not served: La ruta no está servida
|
||||
hourStarted: Hora de inicio
|
||||
hourFinished: Hora de fin
|
||||
</i18n>
|
||||
|
|
|
@ -87,7 +87,7 @@ const columns = computed(() => [
|
|||
actions: [
|
||||
{
|
||||
title: t('Ver cmr'),
|
||||
icon: 'visibility',
|
||||
icon: 'preview',
|
||||
isPrimary: true,
|
||||
action: (row) => viewSummary(row?.id, RoadmapSummary),
|
||||
},
|
||||
|
|
|
@ -342,10 +342,7 @@ const openSmsDialog = async () => {
|
|||
</template>
|
||||
<template #body-cell-city="{ value, row }">
|
||||
<QTd auto-width>
|
||||
<span
|
||||
class="text-primary cursor-pointer"
|
||||
@click="goToBuscaman(row)"
|
||||
>
|
||||
<span class="link" @click="goToBuscaman(row)">
|
||||
{{ value }}
|
||||
<QTooltip>{{ t('Open buscaman') }}</QTooltip>
|
||||
</span>
|
||||
|
@ -353,7 +350,7 @@ const openSmsDialog = async () => {
|
|||
</template>
|
||||
<template #body-cell-client="{ value, row }">
|
||||
<QTd auto-width>
|
||||
<span class="text-primary cursor-pointer">
|
||||
<span class="link">
|
||||
{{ value }}
|
||||
<CustomerDescriptorProxy :id="row?.clientFk" />
|
||||
</span>
|
||||
|
@ -361,7 +358,7 @@ const openSmsDialog = async () => {
|
|||
</template>
|
||||
<template #body-cell-ticket="{ value, row }">
|
||||
<QTd auto-width class="text-center">
|
||||
<span class="text-primary cursor-pointer">
|
||||
<span class="link">
|
||||
{{ value }}
|
||||
<TicketDescriptorProxy :id="row?.id" />
|
||||
</span>
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
route:
|
||||
Worker: Worker
|
||||
Agency: Agency
|
||||
Vehicle: Vehicle
|
||||
Description: Description
|
||||
hourStarted: H.Start
|
||||
hourFinished: H.End
|
||||
createRoute: Create route
|
||||
From: From
|
||||
To: To
|
||||
Date: Date
|
||||
KmStart: Km start
|
||||
KmEnd: Km end
|
||||
Served: Served
|
||||
Clone Selected Routes: Clone selected routes
|
||||
Select the starting date: Select the starting date
|
||||
Stating date: Starting date
|
||||
Cancel: Cancel
|
||||
Mark as served: Mark as served
|
||||
Download selected routes as PDF: Download selected routes as PDF
|
||||
Add ticket: Add ticket
|
||||
Preview: Preview
|
||||
Summary: Summary
|
||||
Route is closed: Route is closed
|
||||
Route is not served: Route is not served
|
||||
cmr:
|
||||
list:
|
||||
results: results
|
||||
cmrFk: CMR id
|
||||
hasCmrDms: Attached in gestdoc
|
||||
'true': 'Yes'
|
||||
'false': 'No'
|
||||
ticketFk: Ticketd id
|
||||
routeFk: Route id
|
||||
country: Country
|
||||
clientFk: Client id
|
||||
shipped: Preparation date
|
||||
viewCmr: View CMR
|
||||
downloadCmrs: Download CMRs
|
|
@ -0,0 +1,39 @@
|
|||
route:
|
||||
Worker: Trabajador
|
||||
Agency: Agencia
|
||||
Vehicle: Vehículo
|
||||
Description: Descripción
|
||||
hourStarted: H.Inicio
|
||||
hourFinished: H.Fin
|
||||
createRoute: Crear ruta
|
||||
From: Desde
|
||||
To: Hasta
|
||||
Date: Fecha
|
||||
KmStart: Km inicio
|
||||
KmEnd: Km fin
|
||||
Served: Servida
|
||||
Clone Selected Routes: Clonar rutas seleccionadas
|
||||
Select the starting date: Seleccione la fecha de inicio
|
||||
Stating date: Fecha de inicio
|
||||
Cancel: Cancelar
|
||||
Mark as served: Marcar como servidas
|
||||
Download selected routes as PDF: Descargar rutas seleccionadas como PDF
|
||||
Add ticket: Añadir tickets
|
||||
Preview: Vista previa
|
||||
Summary: Resumen
|
||||
Route is closed: La ruta está cerrada
|
||||
Route is not served: La ruta no está servida
|
||||
cmr:
|
||||
list:
|
||||
results: resultados
|
||||
cmrFk: Id CMR
|
||||
hasCmrDms: Gestdoc
|
||||
'true': Sí
|
||||
'false': 'No'
|
||||
ticketFk: Id ticket
|
||||
routeFk: Id ruta
|
||||
country: País
|
||||
clientFk: Id cliente
|
||||
shipped: Fecha preparación
|
||||
viewCmr: Ver CMR
|
||||
downloadCmrs: Descargar CMRs
|
|
@ -4,7 +4,6 @@ import { useI18n } from 'vue-i18n';
|
|||
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
|
@ -115,7 +114,7 @@ const totalNewPrice = computed(() => {
|
|||
const totalDifference = computed(() => {
|
||||
return rows.value.reduce((acc, item) => acc + item.component?.difference || 0, 0);
|
||||
});
|
||||
const showMovablecolumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : []));
|
||||
const showMovableColumn = computed(() => (haveDifferences.value > 0 ? ['movable'] : []));
|
||||
const haveDifferences = computed(() => _ticketData.value.sale?.haveDifferences);
|
||||
const ticketHaveNegatives = () => {
|
||||
let _haveNegatives = false;
|
||||
|
@ -145,8 +144,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
@on-fetch="(data) => (ticketUpdateActions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<QDrawer side="right" :width="265" v-model="stateStore.rightDrawer">
|
||||
<QCard
|
||||
class="q-pa-md q-mb-md q-ma-md color-vn-text"
|
||||
bordered
|
||||
|
@ -158,18 +156,18 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
{{ t('basicData.total') }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="column items-center" horizontal>
|
||||
<QCardSection class="column items-left" horizontal>
|
||||
<span>
|
||||
{{ t('basicData.price') }}:
|
||||
{{ toCurrency(totalPrice) }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="column items-center" horizontal>
|
||||
<QCardSection class="column items-left" horizontal>
|
||||
<span>
|
||||
{{ t('basicData.newPrice') }}: {{ toCurrency(totalNewPrice) }}
|
||||
</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="column items-center" horizontal>
|
||||
<QCardSection class="column items-left" horizontal>
|
||||
<span>
|
||||
{{ t('basicData.difference') }}: {{ toCurrency(totalDifference) }}
|
||||
</span>
|
||||
|
@ -220,10 +218,9 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</QIcon>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</template>
|
||||
</RightMenu>
|
||||
</QDrawer>
|
||||
<QTable
|
||||
:visible-columns="showMovablecolumn"
|
||||
:visible-columns="showMovableColumn"
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
|
@ -233,15 +230,15 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
flat
|
||||
>
|
||||
<template #body-cell-item="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat color="primary">
|
||||
<QTd @click.stop class="link">
|
||||
<QBtn flat>
|
||||
{{ row.itemFk }}
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-description="{ row }">
|
||||
<QTd>
|
||||
<QTd style="display: contents">
|
||||
<div class="column">
|
||||
<span>{{ row.item.name }}</span>
|
||||
<span class="color-vn-label">{{ row.item.subName }}</span>
|
|
@ -12,6 +12,7 @@ import VnInputTime from 'components/common/VnInputTime.vue';
|
|||
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { useValidator } from 'src/composables/useValidator';
|
||||
import { toTimeFormat } from 'filters/date.js';
|
||||
|
||||
const $props = defineProps({
|
||||
|
@ -23,7 +24,7 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
const emit = defineEmits(['updateForm']);
|
||||
|
||||
const { validate } = useValidator();
|
||||
const { notify } = useNotify();
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
|
@ -51,18 +52,18 @@ const agencyByWarehouseFilter = computed(() => ({
|
|||
},
|
||||
}));
|
||||
|
||||
const zonesFilter = computed(() => ({
|
||||
fields: ['id', 'name'],
|
||||
order: 'name ASC',
|
||||
where: formData.value?.agencyModeFk
|
||||
function zoneWhere() {
|
||||
if (formData?.value?.agencyModeFk) {
|
||||
return formData.value?.agencyModeFk
|
||||
? {
|
||||
shipped: formData.value?.shipped,
|
||||
addressFk: formData.value?.addressFk,
|
||||
agencyModeFk: formData.value?.agencyModeFk,
|
||||
warehouseFk: formData.value?.warehouseFk,
|
||||
}
|
||||
: {},
|
||||
}));
|
||||
: {};
|
||||
}
|
||||
}
|
||||
|
||||
const getLanded = async (params) => {
|
||||
try {
|
||||
|
@ -293,13 +294,6 @@ onMounted(() => onFormModelInit());
|
|||
@on-fetch="(data) => (agenciesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
ref="zonesFetchRef"
|
||||
url="Zones/includingExpired"
|
||||
:filter="zonesFilter"
|
||||
@on-fetch="(data) => (zonesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<QForm>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
|
@ -313,6 +307,7 @@ onMounted(() => onFormModelInit());
|
|||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
:rules="validate('basicData.client')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -333,6 +328,7 @@ onMounted(() => onFormModelInit());
|
|||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
:rules="validate('basicData.warehouse')"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
|
@ -345,6 +341,7 @@ onMounted(() => onFormModelInit());
|
|||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
:rules="validate('basicData.address')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -392,6 +389,7 @@ onMounted(() => onFormModelInit());
|
|||
:label="t('basicData.alias')"
|
||||
v-model="formData.nickname"
|
||||
:required="true"
|
||||
:rules="validate('basicData.alias')"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow class="row q-gutter-md q-mb-md no-wrap">
|
||||
|
@ -404,6 +402,7 @@ onMounted(() => onFormModelInit());
|
|||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
:rules="validate('basicData.company')"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('basicData.agency')"
|
||||
|
@ -414,17 +413,22 @@ onMounted(() => onFormModelInit());
|
|||
hide-selected
|
||||
map-options
|
||||
@focus="agencyFetchRef.fetch()"
|
||||
:rules="validate('basicData.agency')"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('basicData.zone')"
|
||||
v-model="zoneId"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
:options="zonesOptions"
|
||||
url="Zones/includingExpired"
|
||||
:fields="['id', 'name']"
|
||||
sort-by="id"
|
||||
:where="zoneWhere"
|
||||
hide-selected
|
||||
map-options
|
||||
:required="true"
|
||||
@focus="zonesFetchRef.fetch()"
|
||||
:rules="validate('basicData.zone')"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -444,16 +448,19 @@ onMounted(() => onFormModelInit());
|
|||
:label="t('basicData.shipped')"
|
||||
v-model="formData.shipped"
|
||||
:required="true"
|
||||
:rules="validate('basicData.shipped')"
|
||||
/>
|
||||
<VnInputTime
|
||||
:label="t('basicData.shippedHour')"
|
||||
v-model="formData.shipped"
|
||||
:required="true"
|
||||
:rules="validate('basicData.shippedHour')"
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('basicData.landed')"
|
||||
v-model="formData.landed"
|
||||
:required="true"
|
||||
:rules="validate('basicData.landed')"
|
||||
/>
|
||||
</VnRow>
|
||||
</QForm>
|
||||
|
|
|
@ -3,7 +3,7 @@ import { ref, onBeforeMount } from 'vue';
|
|||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import BasicDataTable from './BasicDataTable.vue';
|
||||
import TicketBasicData from './TicketBasicData.vue';
|
||||
import TicketBasicDataForm from './TicketBasicDataForm.vue';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
|
||||
|
@ -158,7 +158,10 @@ onBeforeMount(async () => await getTicketData());
|
|||
color="primary"
|
||||
animated
|
||||
keep-alive
|
||||
style="max-width: 800px; margin: auto"
|
||||
style="margin: auto"
|
||||
:style="{
|
||||
'max-width': step > 1 ? 'none' : '800px',
|
||||
}"
|
||||
>
|
||||
<QStep :name="1" :title="t('globals.pageTitles.basicData')" :done="step > 1">
|
||||
<TicketBasicDataForm
|
||||
|
@ -168,7 +171,7 @@ onBeforeMount(async () => await getTicketData());
|
|||
/>
|
||||
</QStep>
|
||||
<QStep :name="2" :title="t('basicData.priceDifference')">
|
||||
<BasicDataTable
|
||||
<TicketBasicData
|
||||
:form-data="formData"
|
||||
v-model:haveNegatives="haveNegatives"
|
||||
@update-form="($event) => (formData = $event)"
|
||||
|
|
|
@ -31,6 +31,7 @@ const router = useRouter();
|
|||
const { notify } = useNotify();
|
||||
|
||||
const newTicketFormData = reactive({});
|
||||
const date = new Date();
|
||||
|
||||
const createTicket = async () => {
|
||||
try {
|
||||
|
@ -64,7 +65,11 @@ const createTicket = async () => {
|
|||
>
|
||||
<template #form-inputs="{ data }">
|
||||
<VnRow>
|
||||
<VnInputDate :label="t('expedition.landed')" v-model="data.landed" />
|
||||
<VnInputDate
|
||||
:label="t('expedition.landed')"
|
||||
v-model="data.landed"
|
||||
:model-value="date"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
|
|
|
@ -5,15 +5,16 @@ import { useRoute } from 'vue-router';
|
|||
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import VnImg from 'src/components/ui/VnImg.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { toCurrency } from 'filters/index';
|
||||
import axios from 'axios';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const stateStore = useStateStore();
|
||||
|
@ -75,22 +76,39 @@ const columns = computed(() => [
|
|||
name: 'item',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('lines.image'),
|
||||
name: 'image',
|
||||
columnField: {
|
||||
component: VnImg,
|
||||
attrs: (id) => {
|
||||
return {
|
||||
id,
|
||||
width: '50px',
|
||||
};
|
||||
},
|
||||
},
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
label: t('ticketComponents.description'),
|
||||
name: 'description',
|
||||
align: 'left',
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
label: t('ticketComponents.quantity'),
|
||||
name: 'quantity',
|
||||
field: 'quantity',
|
||||
align: 'left',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
format: (row) => dashIfEmpty(row.quantity),
|
||||
},
|
||||
{
|
||||
label: t('ticketComponents.serie'),
|
||||
name: 'serie',
|
||||
align: 'left',
|
||||
format: (row) => dashIfEmpty(row.serie),
|
||||
},
|
||||
{
|
||||
label: t('ticketComponents.components'),
|
||||
|
@ -174,14 +192,8 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
@on-fetch="(data) => (components = data)"
|
||||
auto-load
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<QCard
|
||||
class="q-pa-sm color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QDrawer side="right" :width="265" v-model="stateStore.rightDrawer">
|
||||
<QCard class="q-pa-sm color-vn-text" bordered flat style="border-color: black">
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('ticketComponents.total') }}
|
||||
|
@ -200,12 +212,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
<span>{{ toCurrency(getTotal) }}</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard
|
||||
class="q-pa-sm color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCard class="q-pa-sm color-vn-text" bordered flat style="border-color: black">
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('ticketComponents.components') }}
|
||||
|
@ -224,12 +231,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
}}</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard
|
||||
class="q-pa-sm color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCard class="q-pa-sm color-vn-text" bordered flat style="border-color: black">
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('ticketComponents.zoneBreakdown') }}
|
||||
|
@ -269,12 +271,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
<span>{{ dashIfEmpty(ticketData?.packages) }}</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
<QCard
|
||||
class="q-pa-sm color-vn-text"
|
||||
bordered
|
||||
flat
|
||||
style="border-color: black"
|
||||
>
|
||||
<QCard class="q-pa-sm color-vn-text" bordered flat style="border-color: black">
|
||||
<QCardSection horizontal>
|
||||
<span class="text-weight-bold text-subtitle1 text-center full-width">
|
||||
{{ t('ticketComponents.theoricalCost') }}
|
||||
|
@ -287,68 +284,74 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
<span>{{ toCurrency(theoricalCost, 'EUR', 2) }}</span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</template>
|
||||
</RightMenu>
|
||||
<QTable
|
||||
:rows="components"
|
||||
</QDrawer>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="TicketComponents"
|
||||
url="Sales"
|
||||
:user-filter="salesFilter"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
:right-search="false"
|
||||
auto-load
|
||||
:disable-option="{ card: true }"
|
||||
:column-search="false"
|
||||
>
|
||||
<template #body-cell-item="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat color="primary">
|
||||
<span class="link">{{ row.itemFk }}</span>
|
||||
<template #column-item="{ row }">
|
||||
<span @click.stop flat class="link">
|
||||
{{ row.itemFk }}
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</span>
|
||||
</template>
|
||||
<template #body-cell-description="{ row }">
|
||||
<QTd>
|
||||
<template #column-image="{ row }">
|
||||
<div class="image-wrapper">
|
||||
<VnImg :id="parseInt(row?.item?.id)" class="rounded" />
|
||||
</div>
|
||||
</template>
|
||||
<template #column-description="{ row }">
|
||||
<div class="column">
|
||||
<span>{{ row.item.name }}</span>
|
||||
<span class="color-vn-label">{{ row.item.subName }}</span>
|
||||
<FetchedTags :item="row.item" />
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-serie="{ row }">
|
||||
<QTd>
|
||||
<template #column-serie="{ row }">
|
||||
<div class="column">
|
||||
<span v-for="(saleComponent, index) in row.components" :key="index">
|
||||
{{ saleComponent.component?.componentType?.name }}
|
||||
</span>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-components="{ row }">
|
||||
<QTd>
|
||||
<template #column-components="{ row }">
|
||||
<div class="column">
|
||||
<span v-for="(saleComponent, index) in row.components" :key="index">
|
||||
{{ saleComponent.component?.name }}
|
||||
</span>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-import="{ row }">
|
||||
<QTd>
|
||||
<div class="column text-right">
|
||||
<template #column-import="{ row }">
|
||||
<div class="column text-left">
|
||||
<span v-for="(saleComponent, index) in row.components" :key="index">
|
||||
{{ toCurrency(saleComponent.value, 'EUR', 3) }}
|
||||
</span>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-total="{ row }">
|
||||
<QTd>
|
||||
<div class="column text-right">
|
||||
<template #column-total="{ row }">
|
||||
<div class="column">
|
||||
<span v-for="(saleComponent, index) in row.components" :key="index">
|
||||
{{ toCurrency(saleComponent.value * row.quantity, 'EUR', 3) }}
|
||||
<!-- <QTooltip>
|
||||
{{ saleComponent.component?.name }}:
|
||||
{{ toCurrency(saleComponent.value, 'EUR', 3) }}
|
||||
</QTooltip> -->
|
||||
</span>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.image-wrapper {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
import { ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toDate } from 'src/filters';
|
||||
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import CardDescriptor from 'components/ui/CardDescriptor.vue';
|
||||
import TicketDescriptorMenu from './TicketDescriptorMenu.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
import useCardDescription from 'src/composables/useCardDescription';
|
||||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
import { toDateTimeFormat } from 'src/filters/date';
|
||||
|
||||
const $props = defineProps({
|
||||
id: {
|
||||
|
@ -30,13 +30,24 @@ const filter = {
|
|||
{
|
||||
relation: 'address',
|
||||
scope: {
|
||||
fields: ['id', 'name', 'mobile', 'phone'],
|
||||
fields: ['id', 'name', 'mobile', 'phone', 'incotermsFk'],
|
||||
},
|
||||
},
|
||||
{
|
||||
relation: 'client',
|
||||
scope: {
|
||||
fields: ['id', 'name', 'salesPersonFk', 'phone', 'mobile', 'email'],
|
||||
fields: [
|
||||
'id',
|
||||
'name',
|
||||
'salesPersonFk',
|
||||
'phone',
|
||||
'mobile',
|
||||
'email',
|
||||
'isActive',
|
||||
'isFreezed',
|
||||
'isTaxDataChecked',
|
||||
'hasElectronicInvoice',
|
||||
],
|
||||
include: [
|
||||
{
|
||||
relation: 'user',
|
||||
|
@ -87,6 +98,10 @@ const filter = {
|
|||
};
|
||||
|
||||
const data = ref(useCardDescription());
|
||||
|
||||
function ticketFilter(ticket) {
|
||||
return JSON.stringify({ clientFk: ticket.clientFk });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -128,7 +143,10 @@ const data = ref(useCardDescription());
|
|||
/>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('ticket.card.shipped')" :value="toDate(entity.shipped)" />
|
||||
<VnLv
|
||||
:label="t('ticket.card.shipped')"
|
||||
:value="toDateTimeFormat(entity.shipped)"
|
||||
/>
|
||||
<VnLv
|
||||
v-if="entity.agencyMode"
|
||||
:label="t('ticket.card.agency')"
|
||||
|
@ -138,7 +156,39 @@ const data = ref(useCardDescription());
|
|||
<VnLv :label="t('ticket.card.alias')" :value="entity.nickname" />
|
||||
</template>
|
||||
<template #icons="{ entity }">
|
||||
<QCardActions>
|
||||
<QCardActions class="q-gutter-x-xs">
|
||||
<QIcon
|
||||
v-if="entity.client.isActive == false"
|
||||
name="vn:disabled"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Client inactive') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="entity.client.isFreezed == true"
|
||||
name="vn:frozen"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Client Frozen') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="entity.problem.includes('hasRisk')"
|
||||
name="vn:risk"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Client has debt') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="entity.client.isTaxDataChecked == false"
|
||||
name="vn:no036"
|
||||
size="xs"
|
||||
color="primary"
|
||||
>
|
||||
<QTooltip>{{ t('Client not checked') }}</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="entity.isDeleted == true"
|
||||
name="vn:deletedTicket"
|
||||
|
@ -159,6 +209,27 @@ const data = ref(useCardDescription());
|
|||
>
|
||||
<QTooltip>{{ t('ticket.card.customerCard') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
size="md"
|
||||
icon="vn:ticket"
|
||||
color="primary"
|
||||
:to="{ name: 'TicketList', query: { table: ticketFilter(entity) } }"
|
||||
>
|
||||
<QTooltip>{{ t('ticket.card.ticketList') }}</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
size="md"
|
||||
icon="vn:basketadd"
|
||||
color="primary"
|
||||
:to="{
|
||||
name: 'OrderList',
|
||||
query: {
|
||||
createForm: JSON.stringify({ clientFk: entity.clientFk }),
|
||||
},
|
||||
}"
|
||||
>
|
||||
<QTooltip>{{ t('ticket.card.newOrder') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QCardActions>
|
||||
</template>
|
||||
</CardDescriptor>
|
||||
|
@ -168,4 +239,8 @@ const data = ref(useCardDescription());
|
|||
es:
|
||||
This ticket is deleted: Este ticket está eliminado
|
||||
Go to module index: Ir al índice del modulo
|
||||
Client inactive: Cliente inactivo
|
||||
Client not checked: Cliente no verificado
|
||||
Client has debt: Cliente con deuda
|
||||
Client Frozen: Cliente congelado
|
||||
</i18n>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import axios from 'axios';
|
||||
import { ref } from 'vue';
|
||||
import { ref, toRefs } from 'vue';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
|
@ -9,6 +9,11 @@ import SendEmailDialog from 'components/common/SendEmailDialog.vue';
|
|||
import VnConfirm from 'components/ui/VnConfirm.vue';
|
||||
import VnSmsDialog from 'components/common/VnSmsDialog.vue';
|
||||
import toDate from 'filters/toDate';
|
||||
import FormPopup from 'components/FormPopup.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnInputTime from 'src/components/common/VnInputTime.vue';
|
||||
import { useAcl } from 'src/composables/useAcl';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
|
||||
|
@ -24,8 +29,16 @@ const { dialog, notify } = useQuasar();
|
|||
const { t } = useI18n();
|
||||
const { openReport, sendEmail } = usePrintService();
|
||||
const ticketSummary = useArrayData('TicketSummary');
|
||||
const ticket = ref(props.ticket);
|
||||
const { ticket } = toRefs(props);
|
||||
const ticketId = currentRoute.value.params.id;
|
||||
const client = ref();
|
||||
const showTransferDialog = ref(false);
|
||||
const showTurnDialog = ref(false);
|
||||
const showChangeTimeDialog = ref(false);
|
||||
const dialogRef = ref();
|
||||
const isEditable = ref();
|
||||
const hasInvoicing = useAcl('invoicing');
|
||||
const hasPdf = ref();
|
||||
const weight = ref();
|
||||
const actions = {
|
||||
clone: async () => {
|
||||
|
@ -76,6 +89,7 @@ const actions = {
|
|||
notify({
|
||||
message: t('You can undo this action within the first hour'),
|
||||
icon: 'info',
|
||||
type: 'warning',
|
||||
});
|
||||
|
||||
push({ name: 'TicketList' });
|
||||
|
@ -87,10 +101,14 @@ const actions = {
|
|||
|
||||
function openDeliveryNote(type = 'deliveryNote', documentType = 'pdf') {
|
||||
const path = `Tickets/${ticket.value.id}/delivery-note-${documentType}`;
|
||||
openReport(path, {
|
||||
openReport(
|
||||
path,
|
||||
{
|
||||
recipientId: ticket.value.clientFk,
|
||||
type: type,
|
||||
});
|
||||
},
|
||||
'_blank'
|
||||
);
|
||||
}
|
||||
|
||||
function sendDeliveryNoteConfirmation(type = 'deliveryNote', documentType = 'pdf') {
|
||||
|
@ -173,34 +191,281 @@ function openConfirmDialog(callback) {
|
|||
dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('This ticket will be removed from current route! Continue anyway?'),
|
||||
message: t('You are going to delete this ticket'),
|
||||
promise: actions[callback],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function generatePdfDialog() {
|
||||
dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
promise: generatePdfInvoice,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function generatePdfInvoice() {
|
||||
const { data } = await axios.get('invoiceOuts', {
|
||||
params: {
|
||||
filter: JSON.stringify({
|
||||
where: { ref: ticket.value.refFk },
|
||||
}),
|
||||
},
|
||||
});
|
||||
const invoiceId = data[0].id;
|
||||
const { response } = await axios.post(`InvoiceOuts/${invoiceId}/createPdf`);
|
||||
if (!response) {
|
||||
notify({
|
||||
message: 'The invoice PDF document has been regenerated',
|
||||
type: 'positive',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function makeInvoiceDialog() {
|
||||
dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('Are you sure you want to invoice this ticket?'),
|
||||
message: t('You are going to invoice this ticket'),
|
||||
promise: makeInvoice,
|
||||
},
|
||||
});
|
||||
}
|
||||
async function makeInvoice() {
|
||||
const params = {
|
||||
ticketsIds: [parseInt(ticketId)],
|
||||
};
|
||||
await axios.post(`Tickets/invoiceTicketsAndPdf`, params);
|
||||
|
||||
notify({
|
||||
message: t('Ticket invoiced'),
|
||||
type: 'positive',
|
||||
});
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
async function transferClient(client) {
|
||||
const params = {
|
||||
clientFk: client,
|
||||
};
|
||||
|
||||
const { data } = await axios.patch(`Tickets/${ticketId}/transferClient`, params);
|
||||
|
||||
if (data) window.location.reload();
|
||||
}
|
||||
|
||||
async function addTurn(day) {
|
||||
const params = {
|
||||
ticketFk: parseInt(ticketId),
|
||||
weekDay: day,
|
||||
agencyModeFk: ticket.value.agencyModeFk,
|
||||
};
|
||||
await axios.patch(`TicketWeeklies`, params);
|
||||
|
||||
notify({
|
||||
message: t('Current ticket deleted and added to shift'),
|
||||
type: 'positive',
|
||||
});
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
async function createRefund(withWarehouse) {
|
||||
const params = {
|
||||
ticketsIds: [parseInt(ticketId)],
|
||||
withWarehouse: withWarehouse,
|
||||
negative: true,
|
||||
};
|
||||
const { data } = await axios.post(`Tickets/cloneAll`, params);
|
||||
|
||||
if (data) {
|
||||
const [refundTicket] = data;
|
||||
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
|
||||
push({ name: 'TicketSale', params: { id: refundTicket.id } });
|
||||
}
|
||||
}
|
||||
|
||||
async function changeShippedHour(time) {
|
||||
const params = {
|
||||
shipped: time,
|
||||
};
|
||||
|
||||
const { data } = await axios.post(`Tickets/${ticketId}/updateEditableTicket`, params);
|
||||
|
||||
if (data) window.location.reload();
|
||||
}
|
||||
|
||||
function openRecalculateDialog() {
|
||||
dialog({
|
||||
component: VnConfirm,
|
||||
componentProps: {
|
||||
title: t('Recalculate components'),
|
||||
message: t('Are you sure you want to recalculate components?'),
|
||||
promise: recalculateComponents,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function recalculateComponents() {
|
||||
await axios.post(`Tickets/${ticketId}/recalculateComponents`);
|
||||
notify({
|
||||
message: t('Data saved'),
|
||||
type: 'positive',
|
||||
});
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
const handleFetchData = (data) => {
|
||||
isEditable.value = data;
|
||||
handleInvoiceOutData();
|
||||
};
|
||||
|
||||
async function handleInvoiceOutData() {
|
||||
const { data } = await axios.get(`InvoiceOuts`, {
|
||||
params: {
|
||||
filter: JSON.stringify({ where: { ref: ticket.value.refFk } }),
|
||||
},
|
||||
});
|
||||
hasPdf.value = data[0]?.hasPdf;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
:url="`Tickets/${ticketId}/isEditable`"
|
||||
auto-load
|
||||
@on-fetch="handleFetchData"
|
||||
/>
|
||||
<QItem @click="showTransferDialog = !showTransferDialog" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="content_paste" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Transfer client') }}</QItemSection>
|
||||
</QItem>
|
||||
<QDialog ref="dialogRef" v-model="showTransferDialog">
|
||||
<FormPopup
|
||||
@on-submit="transferClient(client)"
|
||||
:title="t('Transfer client')"
|
||||
:custom-submit-button-label="t('Transfer client')"
|
||||
:default-cancel-button="false"
|
||||
>
|
||||
<template #form-inputs>
|
||||
<VnSelect
|
||||
url="Clients"
|
||||
:fields="['id', 'name']"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
v-model="client"
|
||||
:label="t('Client')"
|
||||
auto-load
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel>
|
||||
{{ `#${scope.opt.id} - ` }}
|
||||
{{ scope.opt.name }}
|
||||
</QItemLabel>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</template>
|
||||
</FormPopup>
|
||||
</QDialog>
|
||||
<QItem @click="showTurnDialog = !showTurnDialog" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="vn:calendar" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('addTurn') }}</QItemSection>
|
||||
</QItem>
|
||||
<QDialog ref="dialogRef" v-model="showTurnDialog">
|
||||
<FormPopup
|
||||
@on-submit="addTurn"
|
||||
:title="t('What is the day of receipt of the ticket?')"
|
||||
:default-submit-button="false"
|
||||
:default-cancel-button="false"
|
||||
style="text-align: center"
|
||||
>
|
||||
<template #form-inputs>
|
||||
<QBtnGroup spread>
|
||||
<QBtn
|
||||
:label="t('weekdays.mon')"
|
||||
color="primary"
|
||||
@click="addTurn(0)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('weekdays.tue')"
|
||||
color="primary"
|
||||
@click="addTurn(1)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('weekdays.wed')"
|
||||
color="primary"
|
||||
@click="addTurn(2)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('weekdays.thu')"
|
||||
color="primary"
|
||||
@click="addTurn(3)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('weekdays.fri')"
|
||||
color="primary"
|
||||
@click="addTurn(4)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('weekdays.sat')"
|
||||
color="primary"
|
||||
@click="addTurn(5)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
<QBtn
|
||||
:label="t('weekdays.sun')"
|
||||
color="primary"
|
||||
@click="addTurn(6)"
|
||||
v-ripple
|
||||
class="weekdaysBtn"
|
||||
/>
|
||||
</QBtnGroup>
|
||||
</template>
|
||||
</FormPopup>
|
||||
</QDialog>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="picture_as_pdf" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Open Delivery Note...') }}</QItemSection>
|
||||
<QItemSection>{{ t('Show Delivery Note...') }}</QItemSection>
|
||||
<QItemSection side>
|
||||
<QIcon name="keyboard_arrow_right" />
|
||||
</QItemSection>
|
||||
<QMenu anchor="top end" self="top start" auto-close bordered>
|
||||
<QList>
|
||||
<QItem @click="openDeliveryNote('deliveryNote')" v-ripple clickable>
|
||||
<QItemSection>{{ t('With prices') }}</QItemSection>
|
||||
<QItemSection>{{ t('as PDF') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem @click="openDeliveryNote('withoutPrices')" v-ripple clickable>
|
||||
<QItemSection>{{ t('Without prices') }}</QItemSection>
|
||||
<QItemSection>{{ t('as PDF without prices') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
@click="openDeliveryNote('deliveryNote', 'csv')"
|
||||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection>{{ t('As CSV') }}</QItemSection>
|
||||
<QItemSection>{{ t('as CSV') }}</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QMenu>
|
||||
|
@ -220,21 +485,21 @@ function openConfirmDialog(callback) {
|
|||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection>{{ t('With prices') }}</QItemSection>
|
||||
<QItemSection>{{ t('Send PDF') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
@click="sendDeliveryNoteConfirmation('withoutPrices')"
|
||||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection>{{ t('Without prices') }}</QItemSection>
|
||||
<QItemSection>{{ t('Send PDF to tablet') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
@click="sendDeliveryNoteConfirmation('deliveryNote', 'csv')"
|
||||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection>{{ t('As CSV') }}</QItemSection>
|
||||
<QItemSection>{{ t('Send CSV') }}</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QMenu>
|
||||
|
@ -243,8 +508,26 @@ function openConfirmDialog(callback) {
|
|||
<QItemSection avatar>
|
||||
<QIcon name="receipt" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Open Proforma Invoice') }}</QItemSection>
|
||||
<QItemSection>{{ t('Show Proforma') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
v-if="isEditable"
|
||||
@click="showChangeTimeDialog = !showChangeTimeDialog"
|
||||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="schedule" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Change shipped hour') }}</QItemSection>
|
||||
</QItem>
|
||||
<QDialog ref="dialogRef" v-model="showChangeTimeDialog">
|
||||
<FormPopup @on-submit="changeShippedHour(time)" :title="t('Change shipped hour')">
|
||||
<template #form-inputs>
|
||||
<VnInputTime v-model="time" :label="t('Shipped hour')" clearable />
|
||||
</template>
|
||||
</FormPopup>
|
||||
</QDialog>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="sms" />
|
||||
|
@ -259,24 +542,72 @@ function openConfirmDialog(callback) {
|
|||
<QItemSection>{{ t('Pending payment') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem @click="showSmsDialog('minAmount')" v-ripple clickable>
|
||||
<QItemSection>{{ t('Minimum amount') }}</QItemSection>
|
||||
<QItemSection>{{ t('Minimum import') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
@click="showSmsDialogWithChanges('orderChanges')"
|
||||
v-ripple
|
||||
clickable
|
||||
>
|
||||
<QItemSection>{{ t('Order changes') }}</QItemSection>
|
||||
<QItemSection>{{ t('Notify changes') }}</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QMenu>
|
||||
</QItem>
|
||||
<QItem @click="makeInvoiceDialog()" v-ripple clickable v-if="isEditable">
|
||||
<QItemSection avatar>
|
||||
<QIcon name="picture_as_pdf" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Make invoice') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem
|
||||
@click="generatePdfDialog()"
|
||||
v-ripple
|
||||
clickable
|
||||
v-if="ticket.refFk !== null && (hasInvoicing || hasPdf)"
|
||||
>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="picture_as_pdf" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{
|
||||
hasPdf ? t('Regenerate PDF invoice') : t('Generate PDF invoice')
|
||||
}}</QItemSection>
|
||||
</QItem>
|
||||
<QItem @click="openConfirmDialog('clone')" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="content_copy" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('To clone ticket') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-if="isEditable" @click="openRecalculateDialog()" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="refresh" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Recalculate components') }}</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="monetization_on" />
|
||||
</QItemSection>
|
||||
<QItemSection>{{ t('Refund all...') }}</QItemSection>
|
||||
<QItemSection side>
|
||||
<QIcon name="keyboard_arrow_right" />
|
||||
</QItemSection>
|
||||
<QMenu anchor="top end" self="top start" auto-close bordered>
|
||||
<QList>
|
||||
<QItem v-ripple clickable @click="createRefund(true)">
|
||||
<QItemSection>
|
||||
{{ t('with warehouse') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem v-ripple clickable @click="createRefund(false)">
|
||||
<QItemSection>
|
||||
{{ t('without warehouse') }}
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</QList>
|
||||
</QMenu>
|
||||
</QItem>
|
||||
<QItem @click="$refs.weightDialog.show()" v-ripple clickable>
|
||||
<QItemSection avatar>
|
||||
<QIcon name="weight" />
|
||||
|
@ -307,29 +638,61 @@ function openConfirmDialog(callback) {
|
|||
</template>
|
||||
</VnConfirm>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.weekdaysBtn {
|
||||
margin: 1%;
|
||||
}
|
||||
</style>
|
||||
<i18n>
|
||||
en:
|
||||
addTurn: Add turn
|
||||
invoiceIds: "Invoices have been generated with the following ids: {invoiceIds}"
|
||||
|
||||
es:
|
||||
Open Delivery Note...: Abrir albarán...
|
||||
Show Delivery Note...: Ver albarán...
|
||||
Send Delivery Note...: Enviar albarán...
|
||||
With prices: Con precios
|
||||
Without prices: Sin precios
|
||||
As CSV: Como CSV
|
||||
Open Proforma Invoice: Abrir factura proforma
|
||||
as PDF: como PDF
|
||||
as PDF without prices: como PDF sin precios
|
||||
as CSV: Como CSV
|
||||
Send PDF: Enviar PDF
|
||||
Send PDF to tablet: Enviar PDF a tablet
|
||||
Send CSV: Enviar CSV
|
||||
Show Proforma: Ver proforma
|
||||
Delete ticket: Eliminar ticket
|
||||
Send SMS...: Enviar SMS
|
||||
Send SMS...: Enviar SMS...
|
||||
Pending payment: Pago pendiente
|
||||
Minimum amount: Importe mínimo
|
||||
Order changes: Cambios del pedido
|
||||
Minimum import: Importe mínimo
|
||||
Notify changes: Notificar cambios
|
||||
Ticket deleted: Ticket eliminado
|
||||
You can undo this action within the first hour: Puedes deshacer esta acción dentro de la primera hora
|
||||
To clone ticket: Clonar ticket
|
||||
Ticket cloned: Ticked clonado
|
||||
It was not able to clone the ticket: No se pudo clonar el ticket
|
||||
Generate PDF invoice: Generar PDF factura
|
||||
Regenerate PDF invoice: Regenerar PDF factura
|
||||
The invoice PDF document has been regenerated: El documento PDF de la factura ha sido regenerado
|
||||
Transfer client: Transferir cliente
|
||||
Client: Cliente
|
||||
addTurn: Añadir a turno
|
||||
What is the day of receipt of the ticket?: ¿Cuál es el día de preparación del pedido?
|
||||
Current ticket deleted and added to shift: Ticket actual eliminado y añadido al turno
|
||||
Refund all...: Abonar todo...
|
||||
with warehouse: con almacén
|
||||
without warehouse: sin almacén
|
||||
Make invoice: Crear factura
|
||||
Change shipped hour: Cambiar hora de envío
|
||||
Shipped hour: Hora de envío
|
||||
Recalculate components: Recalcular componentes
|
||||
Are you sure you want to recalculate components?: ¿Seguro que quieres recalcular los componentes?
|
||||
Data saved: Datos guardados
|
||||
Are you sure you want to invoice this ticket?: ¿Seguro que quieres facturar este ticket?
|
||||
You are going to invoice this ticket: Vas a facturar este ticket
|
||||
Ticket invoiced: Ticket facturado
|
||||
Set weight: Establecer peso
|
||||
Weight set: Peso establecido
|
||||
This ticket may be invoiced, do you want to continue?: Es posible que se facture este ticket, desea continuar?
|
||||
invoiceIds: "Se han generado las facturas con los siguientes ids: {invoiceIds}"
|
||||
This ticket will be removed from current route! Continue anyway?: ¡Se eliminará el ticket de la ruta actual! ¿Continuar de todas formas?
|
||||
You are going to delete this ticket: Vas a eliminar este ticket
|
||||
</i18n>
|
||||
|
|
|
@ -1,39 +1,35 @@
|
|||
<script setup>
|
||||
import { onMounted, ref, computed, onUnmounted, reactive, watch } from 'vue';
|
||||
import { onMounted, ref, computed, onUnmounted, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import TicketEditManaProxy from './TicketEditMana.vue';
|
||||
import TableVisibleColumns from 'src/components/common/TableVisibleColumns.vue';
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import ExpeditionNewTicket from './ExpeditionNewTicket.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toCurrency, toPercentage } from 'src/filters';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { toDateTimeFormat } from 'src/filters/date';
|
||||
import axios from 'axios';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const { notify } = useNotify();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const editPriceProxyRef = ref(null);
|
||||
const newTicketDialogRef = ref(null);
|
||||
const logsTableDialogRef = ref(null);
|
||||
|
||||
const tableRef = ref();
|
||||
const expeditionsLogsData = ref([]);
|
||||
const selectedExpeditions = ref([]);
|
||||
const allColumnNames = ref([]);
|
||||
const visibleColumns = ref([]);
|
||||
const newTicketWithRoute = ref(false);
|
||||
const selectedRows = ref([]);
|
||||
const hasSelectedRows = computed(() => selectedRows.value.length > 0);
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
switch (param) {
|
||||
|
@ -54,8 +50,6 @@ const expeditionsArrayData = useArrayData('ticketExpeditions', {
|
|||
filter: expeditionsFilter.value,
|
||||
exprBuilder: exprBuilder,
|
||||
});
|
||||
const expeditionsStore = expeditionsArrayData.store;
|
||||
const ticketExpeditions = computed(() => expeditionsStore.data);
|
||||
|
||||
const ticketArrayData = useArrayData('ticketData');
|
||||
const ticketStore = ticketArrayData.store;
|
||||
|
@ -73,129 +67,87 @@ watch(
|
|||
{ immediate: true }
|
||||
);
|
||||
|
||||
const params = reactive({});
|
||||
|
||||
const applyColumnFilter = async (col) => {
|
||||
try {
|
||||
const paramKey = col.columnFilter?.filterParamKey || col.field;
|
||||
params[paramKey] = col.columnFilter.filterValue;
|
||||
await expeditionsArrayData.addFilter({ filter: expeditionsFilter.value, params });
|
||||
} catch (err) {
|
||||
console.error('Error applying column filter', err);
|
||||
}
|
||||
};
|
||||
|
||||
const getInputEvents = (col) => {
|
||||
return col.columnFilter.type === 'select'
|
||||
? { 'update:modelValue': () => applyColumnFilter(col) }
|
||||
: {
|
||||
'keyup.enter': () => applyColumnFilter(col),
|
||||
};
|
||||
};
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
label: t('expedition.id'),
|
||||
name: 'id',
|
||||
field: 'id',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterParamKey: 'expeditionFk',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('expedition.item'),
|
||||
name: 'item',
|
||||
name: 'packagingItemFk',
|
||||
align: 'left',
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
filterParamKey: 'packageItemName',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('expedition.name'),
|
||||
name: 'name',
|
||||
field: 'packageItemName',
|
||||
name: 'packageItemName',
|
||||
align: 'left',
|
||||
isTitle: true,
|
||||
columnFilter: {
|
||||
component: VnSelect,
|
||||
type: 'select',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
url: 'Items',
|
||||
fields: ['id', 'name'],
|
||||
'sort-by': 'name ASC',
|
||||
'option-value': 'id',
|
||||
'option-label': 'name',
|
||||
dense: true,
|
||||
},
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('expedition.packageType'),
|
||||
name: 'packageType',
|
||||
field: 'freightItemName',
|
||||
name: 'freightItemName',
|
||||
align: 'left',
|
||||
columnFilter: {
|
||||
component: VnInput,
|
||||
type: 'text',
|
||||
// filterParamKey: 'expeditionFk',
|
||||
filterValue: null,
|
||||
event: getInputEvents,
|
||||
attrs: {
|
||||
dense: true,
|
||||
},
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('expedition.counter'),
|
||||
name: 'counter',
|
||||
field: 'counter',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('expedition.externalId'),
|
||||
name: 'externalId',
|
||||
field: 'externalId',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
cardVisible: true,
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('expedition.created'),
|
||||
name: 'created',
|
||||
field: 'created',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
format: (value) => toDateTimeFormat(value),
|
||||
cardVisible: true,
|
||||
format: (row) => toDateTimeFormat(row.created),
|
||||
},
|
||||
{
|
||||
label: t('expedition.state'),
|
||||
name: 'state',
|
||||
field: 'state',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
cardVisible: true,
|
||||
columnFilter: { inWhere: true },
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
name: 'history',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
align: 'right',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('expedition.historyAction'),
|
||||
icon: 'history',
|
||||
isPrimary: true,
|
||||
action: (row) => showLog(row),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -204,23 +156,29 @@ const logTableColumns = computed(() => [
|
|||
label: t('expedition.state'),
|
||||
name: 'state',
|
||||
field: 'state',
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
label: t('expedition.name'),
|
||||
name: 'name',
|
||||
align: 'name',
|
||||
field: 'name',
|
||||
align: 'center',
|
||||
columnFilter: null,
|
||||
},
|
||||
{
|
||||
label: t('expedition.created'),
|
||||
name: 'created',
|
||||
field: 'created',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
align: 'center',
|
||||
format: (value) => toDateTimeFormat(value),
|
||||
},
|
||||
{
|
||||
label: t('expedition.isScanned'),
|
||||
name: 'isScanned',
|
||||
field: 'isScanned',
|
||||
align: 'center',
|
||||
},
|
||||
]);
|
||||
|
||||
const showNewTicketDialog = (withRoute = false) => {
|
||||
|
@ -255,10 +213,20 @@ const getExpeditionState = async (expedition) => {
|
|||
order: ['created DESC'],
|
||||
};
|
||||
|
||||
const { data } = await axios.get(`ExpeditionStates/filter`, {
|
||||
const { data: expeditionStates } = await axios.get(`ExpeditionStates/filter`, {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
expeditionsLogsData.value = data;
|
||||
const { data: scannedStates } = await axios.get(`ExpeditionStates`, {
|
||||
params: { filter: JSON.stringify(filter), fields: ['id', 'isScanned'] },
|
||||
});
|
||||
|
||||
expeditionsLogsData.value = expeditionStates.map((state) => {
|
||||
const scannedState = scannedStates.find((s) => s.id === state.id);
|
||||
return {
|
||||
...state,
|
||||
isScanned: scannedState ? scannedState.isScanned : false,
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
@ -275,21 +243,13 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
|
||||
<template>
|
||||
<VnSubToolbar>
|
||||
<template #st-data>
|
||||
<TableVisibleColumns
|
||||
:all-columns="allColumnNames"
|
||||
table-code="expeditionIndex"
|
||||
labels-traductions-path="expedition"
|
||||
@on-config-saved="visibleColumns = [...$event, 'history']"
|
||||
/>
|
||||
</template>
|
||||
<template #st-actions>
|
||||
<QBtnGroup push class="q-gutter-x-sm" flat>
|
||||
<QBtnDropdown
|
||||
ref="btnDropdownRef"
|
||||
color="primary"
|
||||
:label="t('expedition.move')"
|
||||
:disable="!selectedExpeditions.length"
|
||||
:disable="!hasSelectedRows"
|
||||
>
|
||||
<template #label>
|
||||
<QTooltip>{{ t('Select lines to see the options') }}</QTooltip>
|
||||
|
@ -322,7 +282,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</QList>
|
||||
</QBtnDropdown>
|
||||
<QBtn
|
||||
:disable="!selectedExpeditions.length"
|
||||
:disable="!hasSelectedRows"
|
||||
icon="delete"
|
||||
color="primary"
|
||||
@click="
|
||||
|
@ -332,115 +292,34 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
deleteExpedition
|
||||
)
|
||||
"
|
||||
/>
|
||||
>
|
||||
<QTooltip>{{ t('expedition.removeExpedition') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QBtnGroup>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
|
||||
<QTable
|
||||
:rows="ticketExpeditions"
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="TicketExpedition"
|
||||
url="Expeditions/filter"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
selection="multiple"
|
||||
v-model:selected="selectedExpeditions"
|
||||
:visible-columns="visibleColumns"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
:filter="expeditionsFilter"
|
||||
v-model:selected="selectedRows"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
auto-load
|
||||
order="created DESC"
|
||||
>
|
||||
<template #top-row="{ cols }">
|
||||
<QTr>
|
||||
<QTd />
|
||||
<QTd v-for="(col, index) in cols" :key="index" style="max-width: 100px">
|
||||
<component
|
||||
:is="col.columnFilter.component"
|
||||
v-if="col.columnFilter"
|
||||
v-model="col.columnFilter.filterValue"
|
||||
v-bind="col.columnFilter.attrs"
|
||||
v-on="col.columnFilter.event(col)"
|
||||
dense
|
||||
/>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #body-cell-item="{ row }">
|
||||
<QTd auto-width @click.stop>
|
||||
<QBtn flat color="primary">{{ row.packagingItemFk }}</QBtn>
|
||||
<template #column-packagingItemFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.packagingItemFk }}
|
||||
<ItemDescriptorProxy :id="row.packagingItemFk" />
|
||||
</QTd>
|
||||
</span>
|
||||
</template>
|
||||
<template #body-cell-available="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBadge :color="row.available < 0 ? 'alert' : 'transparent'" dense>
|
||||
{{ row.available }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
|
||||
<template #body-cell-price="{ row }">
|
||||
<QTd>
|
||||
<template v-if="isTicketEditable && row.id">
|
||||
<QBtn flat color="primary" dense @click="onOpenEditPricePopover(row)">
|
||||
{{ toCurrency(row.price) }}
|
||||
</QBtn>
|
||||
<TicketEditManaProxy
|
||||
ref="editPriceProxyRef"
|
||||
:mana="mana"
|
||||
:new-price="getNewPrice"
|
||||
@save="updatePrice(row)"
|
||||
>
|
||||
<VnInput
|
||||
v-model.number="edit.price"
|
||||
:label="t('ticketSale.price')"
|
||||
type="number"
|
||||
/>
|
||||
</TicketEditManaProxy>
|
||||
</template>
|
||||
<span v-else>{{ toCurrency(row.price) }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-discount="{ row }">
|
||||
<QTd>
|
||||
<template v-if="!isLocked && row.id">
|
||||
<QBtn
|
||||
flat
|
||||
color="primary"
|
||||
dense
|
||||
@click="onOpenEditDiscountPopover(row)"
|
||||
>
|
||||
{{ toPercentage(row.discount / 100) }}
|
||||
</QBtn>
|
||||
<TicketEditManaProxy
|
||||
:mana="mana"
|
||||
:new-price="getNewPrice"
|
||||
@save="changeDiscount(row)"
|
||||
>
|
||||
<VnInput
|
||||
v-model.number="edit.discount"
|
||||
:label="t('ticketSale.discount')"
|
||||
type="number"
|
||||
/>
|
||||
</TicketEditManaProxy>
|
||||
</template>
|
||||
<span v-else>{{ toPercentage(row.discount / 100) }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-history="{ row }">
|
||||
<QTd>
|
||||
<QBtn
|
||||
@click.stop="showLog(row)"
|
||||
color="primary"
|
||||
icon="history"
|
||||
size="md"
|
||||
flat
|
||||
>
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('expedition.historyAction') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</VnTable>
|
||||
<QDialog ref="newTicketDialogRef" transition-show="scale" transition-hide="scale">
|
||||
<ExpeditionNewTicket
|
||||
:ticket="ticketData"
|
||||
|
@ -454,12 +333,23 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
data-key="TicketExpeditionLog"
|
||||
:rows="expeditionsLogsData"
|
||||
:columns="logTableColumns"
|
||||
class="q-pa-sm"
|
||||
class="q-pa-md full-width"
|
||||
>
|
||||
<template #body-cell-name="{ row }">
|
||||
<QTd auto-width>
|
||||
<QBtn flat dense color="primary">{{ row.name }}</QBtn>
|
||||
<QTd style="text-align: center">
|
||||
<span class="link" @click.stop>
|
||||
<QBtn flat dense>{{ row.name }}</QBtn>
|
||||
<WorkerDescriptorProxy :id="row.workerFk" />
|
||||
</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-isScanned="{ row }">
|
||||
<QTd style="text-align: center">
|
||||
<QCheckbox disable v-model="row.isScanned">
|
||||
{{
|
||||
row.isScanned === 1 ? t('expedition.yes') : t('expedition.no')
|
||||
}}
|
||||
</QCheckbox>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
|
|
|
@ -17,6 +17,7 @@ const ticketNotesCrudRef = ref(null);
|
|||
const observationTypes = ref([]);
|
||||
const arrayData = useArrayData('TicketNotes');
|
||||
const { store } = arrayData;
|
||||
const isSaving = ref(false);
|
||||
|
||||
const crudModelFilter = reactive({
|
||||
where: { ticketFk: route.params.id },
|
||||
|
@ -33,11 +34,28 @@ watch(
|
|||
await ticketNotesCrudRef.value.reload();
|
||||
}
|
||||
);
|
||||
function handleDelete(row) {
|
||||
ticketNotesCrudRef.value.remove([row]);
|
||||
}
|
||||
|
||||
async function handleSave() {
|
||||
if (!isSaving.value) {
|
||||
isSaving.value = true;
|
||||
await ticketNotesCrudRef.value?.saveChanges();
|
||||
isSaving.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (observationTypes = data)"
|
||||
@on-fetch="
|
||||
(data) =>
|
||||
(observationTypes = data.map((type) => {
|
||||
type.label = t(`ticketNotes.observationTypes.${type.description}`);
|
||||
return type;
|
||||
}))
|
||||
"
|
||||
auto-load
|
||||
url="ObservationTypes"
|
||||
/>
|
||||
|
@ -64,7 +82,7 @@ watch(
|
|||
:label="t('ticketNotes.observationType')"
|
||||
:options="observationTypes"
|
||||
hide-selected
|
||||
option-label="description"
|
||||
option-label="label"
|
||||
option-value="id"
|
||||
v-model="row.observationTypeFk"
|
||||
:disable="!!row.id"
|
||||
|
@ -73,13 +91,14 @@ watch(
|
|||
:label="t('ticketNotes.description')"
|
||||
v-model="row.description"
|
||||
class="col"
|
||||
@keyup.enter="handleSave"
|
||||
/>
|
||||
<QIcon
|
||||
name="delete"
|
||||
size="sm"
|
||||
class="cursor-pointer"
|
||||
color="primary"
|
||||
@click="ticketNotesCrudRef.remove([row])"
|
||||
@click="handleDelete(row)"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticketNotes.removeNote') }}
|
||||
|
|
|
@ -10,6 +10,7 @@ import FetchData from 'components/FetchData.vue';
|
|||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||
|
||||
import { useArrayData } from 'src/composables/useArrayData';
|
||||
import VnRow from 'src/components/ui/VnRow.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
|
|
@ -1,27 +1,35 @@
|
|||
<script setup>
|
||||
import { ref, computed, watch, reactive } from 'vue';
|
||||
import axios from 'axios';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import CrudModel from 'src/components/CrudModel.vue';
|
||||
import TicketCreateRequest from './TicketCreateRequest.vue';
|
||||
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import { toDateFormat } from 'src/filters/date.js';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { onMounted } from 'vue';
|
||||
import { useStateStore } from 'src/stores/useStateStore';
|
||||
|
||||
const route = useRoute();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const createTicketRequestDialogRef = ref(null);
|
||||
const crudModelRef = ref(null);
|
||||
const tableRef = ref();
|
||||
const attendersOptions = ref([]);
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
const { notify } = useNotify();
|
||||
|
||||
watch(
|
||||
() => route.params.id,
|
||||
async (val) => {
|
||||
crudModelFilter.where.ticketFk = val;
|
||||
crudModelRef.value.reload();
|
||||
tableRef.value.reload();
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -72,64 +80,81 @@ const crudModelFilter = reactive({
|
|||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
label: t('purchaseRequest.id'),
|
||||
name: 'id',
|
||||
field: 'id',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('purchaseRequest.description'),
|
||||
name: 'description',
|
||||
field: 'description',
|
||||
align: 'left',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('purchaseRequest.created'),
|
||||
name: 'created',
|
||||
field: 'created',
|
||||
align: 'left',
|
||||
format: (val) => toDateFormat(val),
|
||||
format: (row) => toDateFormat(row.created),
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('purchaseRequest.requester'),
|
||||
name: 'requester',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
name: 'requesterFk',
|
||||
cardVisible: true,
|
||||
format: (row) => dashIfEmpty(row.requester?.user?.nickname),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('purchaseRequest.atender'),
|
||||
name: 'atender',
|
||||
align: 'left',
|
||||
name: 'attenderFk',
|
||||
cardVisible: true,
|
||||
format: (row) => dashIfEmpty(row.atender?.user?.nickname),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('purchaseRequest.quantity'),
|
||||
name: 'quantity',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('purchaseRequest.price'),
|
||||
name: 'price',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('purchaseRequest.saleFk'),
|
||||
name: 'saleFk',
|
||||
align: 'left',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('purchaseRequest.state'),
|
||||
name: 'state',
|
||||
field: 'isOk',
|
||||
align: 'left',
|
||||
format: (val) => t(getRequestState(val)),
|
||||
name: 'isOk',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
name: 'actions',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
align: 'right',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('globals.delete'),
|
||||
icon: 'delete',
|
||||
isPrimary: true,
|
||||
action: (row) =>
|
||||
openConfirmationModal(
|
||||
t('You are going to delete this ticket purchase request'),
|
||||
t(
|
||||
'This ticket will be removed from ticket purchase requests! Continue anyway?'
|
||||
),
|
||||
() => removeLine(row.id)
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -140,131 +165,117 @@ const getRequestState = (state) => {
|
|||
case false:
|
||||
return 'Denied';
|
||||
case true:
|
||||
return 'Acepted';
|
||||
return 'Accepted';
|
||||
}
|
||||
};
|
||||
|
||||
const isEditable = (isOk) => isOk !== null;
|
||||
|
||||
const removeLine = async (row) => crudModelRef.value.remove([row]);
|
||||
async function removeLine(id) {
|
||||
try {
|
||||
await axios.delete(`TicketRequests/${id}`);
|
||||
notify(t('globals.dataSaved'), 'positive');
|
||||
location.reload();
|
||||
} catch (err) {
|
||||
console.error('Error ', err);
|
||||
}
|
||||
}
|
||||
|
||||
const openCreateModal = () => createTicketRequestDialogRef.value.show();
|
||||
onMounted(() => (stateStore.rightDrawer = false));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<CrudModel
|
||||
<FetchData
|
||||
url="TicketRequests/getItemTypeWorker"
|
||||
:filter="{ fields: ['id', 'nickname'], order: 'nickname ASC' }"
|
||||
auto-load
|
||||
@on-fetch="(data) => (attendersOptions = data)"
|
||||
/>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="PurchaseRequests"
|
||||
url="TicketRequests"
|
||||
ref="crudModelRef"
|
||||
:create="{
|
||||
urlCreate: 'TicketRequests',
|
||||
title: t('Create request'),
|
||||
onDataSaved: ({ id }) => tableRef.reload(id),
|
||||
formInitialData: {
|
||||
ticketFk: route.params.id,
|
||||
},
|
||||
}"
|
||||
save-url="TicketRequests/crud"
|
||||
:filter="crudModelFilter"
|
||||
:order="['created ASC']"
|
||||
:default-remove="false"
|
||||
:default-save="false"
|
||||
:default-reset="false"
|
||||
:limit="0"
|
||||
:columns="columns"
|
||||
:is-editable="true"
|
||||
:right-search="false"
|
||||
:column-search="false"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<QTable
|
||||
:rows="rows"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
@row-click="(_, row) => redirectToTicketSummary(row.ticketFk)"
|
||||
>
|
||||
<template #body-cell-description="{ row }">
|
||||
<QTd @click.stop>
|
||||
<VnInput
|
||||
v-model="row.description"
|
||||
@blur="crudModelRef.saveChanges()"
|
||||
:disable="isEditable(row.isOk)"
|
||||
/>
|
||||
</QTd>
|
||||
<template #column-description="{ row }">
|
||||
<VnInput v-model="row.description" :disable="isEditable(row.isOk)" />
|
||||
</template>
|
||||
<template #body-cell-requester="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn flat color="primary">
|
||||
<template #column-requesterFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.requester?.user?.nickname }}
|
||||
<WorkerDescriptorProxy :id="row.requesterFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</span>
|
||||
</template>
|
||||
<template #body-cell-atender="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn flat color="primary">
|
||||
<template #column-attenderFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.atender?.user?.nickname }}
|
||||
<WorkerDescriptorProxy :id="row.attenderFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</span>
|
||||
</template>
|
||||
<template #body-cell-quantity="{ row }">
|
||||
<QTd @click.stop>
|
||||
<template #column-quantity="{ row }">
|
||||
<VnInput v-model="row.quantity" :disable="isEditable(row.isOk)" />
|
||||
</template>
|
||||
<template #column-price="{ row }">
|
||||
<span @click.stop>
|
||||
<VnInput v-model="row.price" :disable="isEditable(row.isOk)">
|
||||
{{ row.price }}
|
||||
</VnInput>
|
||||
</span>
|
||||
</template>
|
||||
<template #column-saleFk="{ row }">
|
||||
<QTd style="width: 3%">
|
||||
<span class="link" @click.stop>
|
||||
{{ dashIfEmpty(row.sale?.itemFk) }}
|
||||
<ItemDescriptorProxy :id="row.sale?.itemFk" /> </span
|
||||
></QTd>
|
||||
</template>
|
||||
<template #column-isOk="{ row }">
|
||||
{{ t(getRequestState(row.isOk)) }}
|
||||
</template>
|
||||
|
||||
<template #more-create-dialog="{ data }">
|
||||
<VnInput
|
||||
v-model="row.quantity"
|
||||
@blur="crudModelRef.saveChanges()"
|
||||
:disable="isEditable(row.isOk)"
|
||||
v-model="data.description"
|
||||
:label="t('purchaseRequest.description')"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('purchaseRequest.atender')"
|
||||
v-model="data.attenderFk"
|
||||
:options="attendersOptions"
|
||||
hide-selected
|
||||
option-label="nickname"
|
||||
option-value="id"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-price="{ row }">
|
||||
<QTd @click.stop>
|
||||
<VnInput
|
||||
v-model="row.price"
|
||||
@blur="crudModelRef.saveChanges()"
|
||||
:disable="isEditable(row.isOk)"
|
||||
v-model="data.quantity"
|
||||
:label="t('purchaseRequest.quantity')"
|
||||
type="number"
|
||||
min="1"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-saleFk="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn v-if="row.saleFk" flat color="primary">
|
||||
{{ row.sale.itemFk }}
|
||||
<ItemDescriptorProxy :id="row.sale.itemFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-actions="{ row }">
|
||||
<QTd>
|
||||
<QIcon
|
||||
@click.stop="removeLine(row)"
|
||||
class="q-ml-sm cursor-pointer"
|
||||
color="primary"
|
||||
name="delete"
|
||||
size="sm"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('globals.delete') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
</CrudModel>
|
||||
<QDialog
|
||||
ref="createTicketRequestDialogRef"
|
||||
transition-show="scale"
|
||||
transition-hide="scale"
|
||||
>
|
||||
<TicketCreateRequest @on-request-created="crudModelRef.reload()" />
|
||||
</QDialog>
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<QBtn
|
||||
@click="openCreateModal()"
|
||||
color="primary"
|
||||
fab
|
||||
icon="add"
|
||||
shortcut="+"
|
||||
<VnInput
|
||||
v-model="data.price"
|
||||
:label="t('purchaseRequest.price')"
|
||||
type="number"
|
||||
min="0"
|
||||
/>
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('purchaseRequest.newRequest') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
New: Nueva
|
||||
|
|
|
@ -16,11 +16,12 @@ import TicketSaleMoreActions from './TicketSaleMoreActions.vue';
|
|||
import TicketTransfer from './TicketTransfer.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { toCurrency, toPercentage, dashIfEmpty } from 'src/filters';
|
||||
import { toCurrency, toPercentage } from 'src/filters';
|
||||
import { useArrayData } from 'composables/useArrayData';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import axios from 'axios';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
@ -33,7 +34,8 @@ const stateBtnDropdownRef = ref(null);
|
|||
|
||||
const arrayData = useArrayData('ticketData');
|
||||
const { store } = arrayData;
|
||||
|
||||
const selectedRows = ref([]);
|
||||
const hasSelectedRows = computed(() => selectedRows.value.length > 0);
|
||||
const ticketConfig = ref(null);
|
||||
const isLocked = ref(false);
|
||||
const isTicketEditable = ref(false);
|
||||
|
@ -47,94 +49,98 @@ const transfer = ref({
|
|||
lastActiveTickets: [],
|
||||
sales: [],
|
||||
});
|
||||
const tableRef = ref([]);
|
||||
|
||||
watch(
|
||||
() => route.params.id,
|
||||
async () => await getSales()
|
||||
() => tableRef.value.reload()
|
||||
);
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
label: '',
|
||||
align: 'left',
|
||||
name: 'statusIcons',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
name: 'picture',
|
||||
align: 'left',
|
||||
align: 'center',
|
||||
label: t('lines.image'),
|
||||
name: 'image',
|
||||
columnField: {
|
||||
component: VnImg,
|
||||
attrs: (id) => {
|
||||
return {
|
||||
id,
|
||||
width: '50px',
|
||||
};
|
||||
},
|
||||
},
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('ticketSale.visible'),
|
||||
name: 'visible',
|
||||
field: 'visible',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.visible),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('ticketSale.available'),
|
||||
name: 'available',
|
||||
field: 'available',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.available),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('ticketSale.id'),
|
||||
name: 'itemFk',
|
||||
field: 'itemFk',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('ticketSale.quantity'),
|
||||
name: 'quantity',
|
||||
field: 'quantity',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (row) => toCurrency(row.quantity),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('ticketSale.item'),
|
||||
name: 'item',
|
||||
field: 'item',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (row) => row?.item?.name,
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('ticketSale.price'),
|
||||
name: 'price',
|
||||
field: 'price',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (val) => toCurrency(val),
|
||||
format: (row) => toCurrency(row.price),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('ticketSale.discount'),
|
||||
name: 'discount',
|
||||
field: 'discount',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (row) => toPercentage(row.discount),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('ticketSale.amount'),
|
||||
name: 'amount',
|
||||
field: 'amount',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (val) => toCurrency(val),
|
||||
format: (row) => parseInt(row.amount * row.quantity),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('ticketSale.packaging'),
|
||||
name: 'itemPackingTypeFk',
|
||||
field: 'item',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
format: (val) => dashIfEmpty(val?.itemPackingTypeFk),
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row?.item?.itemPackingTypeFk),
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
name: 'history',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
align: 'right',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('ticketSale.history'),
|
||||
icon: 'history',
|
||||
isPrimary: true,
|
||||
action: (row) => goToLog(row.id),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -155,15 +161,6 @@ const onSalesFetched = (salesData) => {
|
|||
for (let sale of salesData) sale.amount = getSaleTotal(sale);
|
||||
};
|
||||
|
||||
const getSales = async () => {
|
||||
try {
|
||||
const { data } = await axios.get(`Tickets/${route.params.id}/getSales`);
|
||||
onSalesFetched(data);
|
||||
} catch (err) {
|
||||
console.error('Error fetching sales', err);
|
||||
}
|
||||
};
|
||||
|
||||
const getSaleTotal = (sale) => {
|
||||
if (sale.quantity == null || sale.price == null) return null;
|
||||
|
||||
|
@ -175,7 +172,7 @@ const getSaleTotal = (sale) => {
|
|||
|
||||
const resetChanges = async () => {
|
||||
arrayData.fetch({ append: false });
|
||||
getSales();
|
||||
tableRef.value.reload();
|
||||
};
|
||||
|
||||
const updateQuantity = async (sale) => {
|
||||
|
@ -210,6 +207,7 @@ const addSale = async (sale) => {
|
|||
sale.item = newSale.item;
|
||||
|
||||
notify('globals.dataSaved', 'positive');
|
||||
window.location.reload();
|
||||
} catch (err) {
|
||||
console.error('Error adding sale', err);
|
||||
}
|
||||
|
@ -259,7 +257,7 @@ const getMana = async () => {
|
|||
|
||||
const selectedValidSales = computed(() => {
|
||||
if (!sales.value) return;
|
||||
return selectedSales.value.filter((sale) => sale.id != undefined);
|
||||
return [...selectedRows.value];
|
||||
});
|
||||
|
||||
const onOpenEditPricePopover = async (sale) => {
|
||||
|
@ -374,7 +372,7 @@ const changeTicketState = async (val) => {
|
|||
};
|
||||
|
||||
const removeSelectedSales = () => {
|
||||
selectedSales.value.forEach((sale) => {
|
||||
selectedRows.value.forEach((sale) => {
|
||||
const index = sales.value.indexOf(sale);
|
||||
sales.value.splice(index, 1);
|
||||
});
|
||||
|
@ -382,19 +380,29 @@ const removeSelectedSales = () => {
|
|||
|
||||
const removeSales = async () => {
|
||||
try {
|
||||
const params = { sales: selectedValidSales.value, ticketId: store.data.id };
|
||||
const params = {
|
||||
sales: selectedRows.value.filter((sale) => sale.id),
|
||||
ticketId: store.data.id,
|
||||
};
|
||||
selectedRows.value
|
||||
.filter((sale) => !sale.id)
|
||||
.forEach((sale) =>
|
||||
tableRef.value.CrudModelRef.formData.splice(sale.$index, 1)
|
||||
);
|
||||
|
||||
if (params.sales.length == 0) return;
|
||||
await axios.post('Sales/deleteSales', params);
|
||||
removeSelectedSales();
|
||||
notify('globals.dataSaved', 'positive');
|
||||
window.location.reload();
|
||||
} catch (err) {
|
||||
console.error('Error deleting sales', err);
|
||||
}
|
||||
};
|
||||
|
||||
const insertRow = () => sales.value.push({ ...DEFAULT_EDIT });
|
||||
|
||||
const setTransferParams = async () => {
|
||||
try {
|
||||
selectedSales.value = selectedValidSales.value;
|
||||
const checkedSales = JSON.parse(JSON.stringify(selectedSales.value));
|
||||
transfer.value = {
|
||||
lastActiveTickets: [],
|
||||
|
@ -417,10 +425,64 @@ const setTransferParams = async () => {
|
|||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
getConfig();
|
||||
getSales();
|
||||
});
|
||||
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
|
||||
const items = ref([]);
|
||||
const newRow = ref({});
|
||||
|
||||
const updateItem = (row) => {
|
||||
const selectedItem = items.value.find((item) => item.id === row.itemFk);
|
||||
if (selectedItem) {
|
||||
row.item = selectedItem;
|
||||
row.itemFk = selectedItem.id;
|
||||
row.price = selectedItem.price;
|
||||
row.discount = 0;
|
||||
row.quantity = 0;
|
||||
row.amount = row.price * row.quantity;
|
||||
}
|
||||
endNewRow(selectedItem);
|
||||
};
|
||||
|
||||
function handleOnDataSave({ CrudModelRef }) {
|
||||
const { copy } = addRow(CrudModelRef.formData);
|
||||
CrudModelRef.insert(copy);
|
||||
}
|
||||
|
||||
const addRow = (original = null) => {
|
||||
let copy = null;
|
||||
if (!original) {
|
||||
copy = { isNew: true };
|
||||
} else {
|
||||
copy = {
|
||||
itemFk: original.itemFk,
|
||||
item: original.item,
|
||||
quantity: original.quantity,
|
||||
price: original.price,
|
||||
discount: original.discount,
|
||||
amount: original.amount,
|
||||
isNew: true,
|
||||
};
|
||||
}
|
||||
newRow.value = copy;
|
||||
return { original, copy };
|
||||
};
|
||||
|
||||
const endNewRow = (row) => {
|
||||
if (row.itemFk && row.quantity) {
|
||||
row.isNew = false;
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => newRow.value.itemFk,
|
||||
(newItemFk) => {
|
||||
if (newItemFk) {
|
||||
updateItem(newRow.value);
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -471,7 +533,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
:ticket="store.data"
|
||||
:is-ticket-editable="isTicketEditable"
|
||||
:sales="selectedValidSales"
|
||||
:disable="!selectedSales.length"
|
||||
:disable="!hasSelectedRows"
|
||||
:mana="mana"
|
||||
:ticket-config="ticketConfig"
|
||||
@get-mana="getMana()"
|
||||
|
@ -480,7 +542,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
<QBtn
|
||||
color="primary"
|
||||
icon="delete"
|
||||
:disable="!isTicketEditable || !selectedSales.length"
|
||||
:disable="!isTicketEditable || !hasSelectedRows"
|
||||
@click="
|
||||
openConfirmationModal(
|
||||
t('Continue anyway?'),
|
||||
|
@ -494,7 +556,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
<QBtn
|
||||
color="primary"
|
||||
icon="vn:splitline"
|
||||
:disable="!isTicketEditable || !selectedSales.length"
|
||||
:disable="!isTicketEditable || !hasSelectedRows"
|
||||
@click="setTransferParams()"
|
||||
>
|
||||
<QTooltip>{{ t('Transfer lines') }}</QTooltip>
|
||||
|
@ -507,44 +569,58 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</QBtnGroup>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
<QDrawer side="right" :width="270" v-model="stateStore.rightDrawer">
|
||||
<QDrawer side="right" :width="265" v-model="stateStore.rightDrawer">
|
||||
<div
|
||||
class="q-pa-md q-mb-md q-ma-md color-vn-text"
|
||||
style="border: 2px solid black"
|
||||
>
|
||||
<QCardSection class="justify-center text-subtitle1" horizontal>
|
||||
<QCardSection class="justify-end text-subtitle1" horizontal>
|
||||
<span class="q-mr-xs color-vn-label"
|
||||
>{{ t('ticketSale.subtotal') }}:
|
||||
</span>
|
||||
<span>{{ toCurrency(store.data?.totalWithoutVat) }}</span>
|
||||
</QCardSection>
|
||||
<QCardSection class="justify-center text-subtitle1" horizontal>
|
||||
<QCardSection class="justify-end text-subtitle1" horizontal>
|
||||
<span class="q-mr-xs color-vn-label"> {{ t('ticketSale.tax') }}: </span>
|
||||
<span>{{
|
||||
toCurrency(store.data?.totalWithVat - store.data?.totalWithoutVat)
|
||||
}}</span>
|
||||
</QCardSection>
|
||||
<QCardSection
|
||||
class="justify-center text-weight-bold text-subtitle1"
|
||||
horizontal
|
||||
>
|
||||
<QCardSection class="justify-end text-weight-bold text-subtitle1" horizontal>
|
||||
<span class="q-mr-xs color-vn-label"> {{ t('ticketSale.total') }}: </span>
|
||||
<span>{{ toCurrency(store.data?.totalWithVat) }}</span>
|
||||
</QCardSection>
|
||||
</div></QDrawer
|
||||
>
|
||||
<QTable
|
||||
:rows="sales"
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="TicketSales"
|
||||
:url="`Tickets/${route.params.id}/getSales`"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
selection="multiple"
|
||||
v-model:selected="selectedSales"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
v-model:selected="selectedRows"
|
||||
:bottom="true"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
:right-search="false"
|
||||
:column-search="false"
|
||||
:disable-option="{ card: true }"
|
||||
auto-load
|
||||
@on-fetch="onSalesFetched"
|
||||
:create="{
|
||||
onDataSaved: handleOnDataSave,
|
||||
}"
|
||||
:create-as-dialog="false"
|
||||
:crud-model="{
|
||||
paginate: false,
|
||||
}"
|
||||
:default-remove="false"
|
||||
:default-reset="false"
|
||||
:default-save="false"
|
||||
:disabled-attr="isTicketEditable"
|
||||
>
|
||||
<template #body-cell-statusIcons="{ row }">
|
||||
<QTd class="q-gutter-x-xs">
|
||||
<template #column-statusIcons="{ row }">
|
||||
<router-link
|
||||
v-if="row.claim?.claimFk"
|
||||
:to="{ name: 'ClaimBasicData', params: { id: row.claim?.claimFk } }"
|
||||
|
@ -586,7 +662,6 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
{{ t('ticketSale.hasComponentLack') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-picture="{ row }">
|
||||
<QTd>
|
||||
|
@ -595,78 +670,79 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-visible="{ row }">
|
||||
<QTd @click.stop>
|
||||
<template #column-image="{ row }">
|
||||
<div class="image-wrapper">
|
||||
<VnImg :id="parseInt(row?.item?.id)" class="rounded" />
|
||||
</div>
|
||||
</template>
|
||||
<template #column-visible="{ row }">
|
||||
<QBadge :color="row.visible < 0 ? 'alert' : 'transparent'" dense>
|
||||
{{ row.visible }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-available="{ row }">
|
||||
<QTd @click.stop>
|
||||
<template #column-available="{ row }">
|
||||
<QBadge :color="row.available < 0 ? 'alert' : 'transparent'" dense>
|
||||
{{ row.available }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-itemFk="{ row }">
|
||||
<QTd @click.stop>
|
||||
<div v-if="row.id">
|
||||
<QBtn flat color="primary" dense>
|
||||
{{ row.itemFk }}
|
||||
</QBtn>
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</div>
|
||||
<template #column-itemFk="{ row }">
|
||||
<VnSelect
|
||||
v-else
|
||||
hide-selected
|
||||
v-if="row.isNew"
|
||||
url="Items/WithName"
|
||||
:fields="['id', 'name']"
|
||||
:sort-by="['id DESC']"
|
||||
:options="items"
|
||||
option-label="name"
|
||||
option-value="id"
|
||||
url="Items/withName"
|
||||
:fields="['id', 'name']"
|
||||
sort-by="id DESC"
|
||||
@update:model-value="changeQuantity(row)"
|
||||
v-model="row.itemFk"
|
||||
@update:model-value="updateItem(row)"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
<QItemSection>
|
||||
<QItemLabel> #{{ scope.opt?.id }} </QItemLabel>
|
||||
<QItemLabel caption>{{ scope.opt?.name }}</QItemLabel>
|
||||
<QItemLabel>
|
||||
{{ scope.opt?.id }} - {{ scope.opt?.name }}</QItemLabel
|
||||
>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
</template>
|
||||
</VnSelect>
|
||||
</QTd>
|
||||
<span v-else class="link" @click.stop>
|
||||
{{ row?.itemFk }}
|
||||
<ItemDescriptorProxy :id="row?.itemFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #body-cell-quantity="{ row }">
|
||||
<QTd @click.stop>
|
||||
<template #column-item="{ row }">
|
||||
<div class="row column full-width justify-between items-start">
|
||||
{{ row?.item?.name }}
|
||||
<div v-if="row?.item?.subName" class="subName">
|
||||
{{ row?.item?.subName.toUpperCase() }}
|
||||
</div>
|
||||
</div>
|
||||
<FetchedTags :item="row" :max-length="6" />
|
||||
<QPopupProxy v-if="row.id && isTicketEditable">
|
||||
<VnInput v-model="row.concept" @change="updateConcept(row)" />
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
<template #column-quantity="{ row }">
|
||||
<VnInput
|
||||
v-if="isTicketEditable"
|
||||
v-if="row.isNew"
|
||||
v-model.number="row.quantity"
|
||||
type="number"
|
||||
@blur="changeQuantity(row)"
|
||||
@focus="edit.oldQuantity = row.quantity"
|
||||
/>
|
||||
<VnInput
|
||||
v-else-if="isTicketEditable"
|
||||
v-model.number="row.quantity"
|
||||
@keyup.enter="changeQuantity(row)"
|
||||
@blur="changeQuantity(row)"
|
||||
@focus="edit.oldQuantity = row.quantity"
|
||||
/>
|
||||
<span v-else>{{ row.quantity }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-item="{ row }">
|
||||
<QTd class="col">
|
||||
<div class="column">
|
||||
<span>{{ row.concept }}</span>
|
||||
<span class="color-vn-label">{{ row.item?.subName }}</span>
|
||||
<FetchedTags v-if="row.item" :item="row.item" />
|
||||
<QPopupProxy v-if="row.id && isTicketEditable">
|
||||
<VnInput v-model="row.concept" @change="updateConcept(row)" />
|
||||
</QPopupProxy>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-price="{ row }">
|
||||
<QTd>
|
||||
<template #column-price="{ row }">
|
||||
<template v-if="isTicketEditable && row.id">
|
||||
<QBtn flat color="primary" dense @click="onOpenEditPricePopover(row)">
|
||||
<QBtn flat class="link" dense @click="onOpenEditPricePopover(row)">
|
||||
{{ toCurrency(row.price) }}
|
||||
</QBtn>
|
||||
<TicketEditManaProxy
|
||||
|
@ -683,17 +759,10 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</TicketEditManaProxy>
|
||||
</template>
|
||||
<span v-else>{{ toCurrency(row.price) }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-discount="{ row }">
|
||||
<QTd>
|
||||
<template #column-discount="{ row }">
|
||||
<template v-if="!isLocked && row.id">
|
||||
<QBtn
|
||||
flat
|
||||
color="primary"
|
||||
dense
|
||||
@click="onOpenEditDiscountPopover(row)"
|
||||
>
|
||||
<QBtn flat class="link" dense @click="onOpenEditDiscountPopover(row)">
|
||||
{{ toPercentage(row.discount / 100) }}
|
||||
</QBtn>
|
||||
<TicketEditManaProxy
|
||||
|
@ -709,44 +778,13 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</TicketEditManaProxy>
|
||||
</template>
|
||||
<span v-else>{{ toPercentage(row.discount / 100) }}</span>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-history="{ row }">
|
||||
<QTd>
|
||||
<QBtn
|
||||
v-if="row.$hasLogs"
|
||||
@click.stop="goToLog(row.id)"
|
||||
color="primary"
|
||||
icon="history"
|
||||
size="md"
|
||||
flat
|
||||
>
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('ticketSale.history') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</QTd>
|
||||
<template #column-amount="{ row }">
|
||||
{{ toCurrency(row.quantity * row.price) }}
|
||||
</template>
|
||||
<template #bottom-row>
|
||||
<QBtn
|
||||
class="cursor-pointer fill-icon q-ml-md q-my-lg"
|
||||
color="primary"
|
||||
icon="add_circle"
|
||||
size="md"
|
||||
round
|
||||
flat
|
||||
shortcut="+"
|
||||
:disable="!isTicketEditable"
|
||||
@click="insertRow()"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Add item') }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</QTable>
|
||||
</VnTable>
|
||||
|
||||
<QPageSticky :offset="[20, 20]">
|
||||
<QPageSticky :offset="[20, 20]" style="z-index: 2">
|
||||
<QBtn @click="newOrderFromTicket()" color="primary" fab icon="add" shortcut="+" />
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('Add item to basket') }}
|
||||
|
@ -754,6 +792,18 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.image-wrapper {
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.subName {
|
||||
text-transform: uppercase;
|
||||
color: var(--vn-label-color);
|
||||
}
|
||||
</style>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
New item: Nuevo artículo
|
||||
|
|
|
@ -44,7 +44,7 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const router = useRouter();
|
||||
const { push } = useRouter();
|
||||
const { t } = useI18n();
|
||||
const { dialog } = useQuasar();
|
||||
const { notify } = useNotify();
|
||||
|
@ -142,7 +142,7 @@ const onCreateClaimAccepted = async () => {
|
|||
try {
|
||||
const params = { ticketId: ticket.value.id, sales: props.sales };
|
||||
const { data } = await axios.post(`Claims/createFromSales`, params);
|
||||
router.push({ name: 'ClaimBasicData', params: { id: data.id } });
|
||||
push({ name: 'ClaimBasicData', params: { id: data.id } });
|
||||
} catch (error) {
|
||||
console.error('Error creating claim: ', error);
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ const createRefund = async (withWarehouse) => {
|
|||
const { data } = await axios.post('Tickets/cloneAll', params);
|
||||
const [refundTicket] = data;
|
||||
notify(t('refundTicketCreated', { ticketId: refundTicket.id }), 'positive');
|
||||
router.push({ name: 'TicketSale', params: { id: refundTicket.id } });
|
||||
push({ name: 'TicketSale', params: { id: refundTicket.id } });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ const saleTrackingFetchDataRef = ref(null);
|
|||
|
||||
const sales = ref([]);
|
||||
const saleTrackings = ref([]);
|
||||
const itemShelvignsSales = ref([]);
|
||||
const itemShelvingsSales = ref([]);
|
||||
const saleTrackingUrl = computed(() => `SaleTrackings/${route.params.id}/filter`);
|
||||
const oldQuantity = ref(null);
|
||||
|
||||
|
@ -88,7 +88,7 @@ const logTableColumns = computed(() => [
|
|||
label: t('ticketSaleTracking.original'),
|
||||
name: 'original',
|
||||
field: 'originalQuantity',
|
||||
align: 'original',
|
||||
align: 'left',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ const getItemShelvingSales = async (sale) => {
|
|||
const { data } = await axios.get(`ItemShelvingSales/filter`, {
|
||||
params: { filter: JSON.stringify(filter) },
|
||||
});
|
||||
itemShelvignsSales.value = data;
|
||||
itemShelvingsSales.value = data;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ const qCheckBoxController = (sale, action) => {
|
|||
:no-data-label="t('globals.noResults')"
|
||||
>
|
||||
<template #body-cell-isChecked="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QTd @click.stop style="width: 20%">
|
||||
<QCheckbox
|
||||
:model-value="!!row.hasSaleGroupDetail"
|
||||
color="pink"
|
||||
|
@ -396,12 +396,14 @@ const qCheckBoxController = (sale, action) => {
|
|||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-item="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QTd @click.stop style="width: 20%">
|
||||
<div>
|
||||
<QBtn flat color="primary">
|
||||
<span class="link">
|
||||
<QBtn flat>
|
||||
{{ row.itemFk }}
|
||||
</QBtn>
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</span>
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
|
@ -416,8 +418,18 @@ const qCheckBoxController = (sale, action) => {
|
|||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-quantity="{ row }">
|
||||
<QTd style="width: 10%">
|
||||
{{ row.quantity }}
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-parking="{ row }">
|
||||
<QTd style="width: 10%">
|
||||
{{ dashIfEmpty(row.parkingFk) }}
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-actions="{ row }">
|
||||
<QTd>
|
||||
<QTd style="width: 20%">
|
||||
<QBtn
|
||||
@click.stop="showLog(row)"
|
||||
color="primary"
|
||||
|
@ -452,12 +464,14 @@ const qCheckBoxController = (sale, action) => {
|
|||
data-key="saleTrackingLog"
|
||||
:rows="saleTrackings"
|
||||
:columns="logTableColumns"
|
||||
class="q-pa-sm"
|
||||
class="q-pa-sm full-width"
|
||||
>
|
||||
<template #body-cell-worker="{ row }">
|
||||
<QTd auto-width>
|
||||
<QBtn flat dense color="primary">{{ row.name }}</QBtn>
|
||||
<QTd>
|
||||
<QBtn flat class="link">
|
||||
{{ row.name }}
|
||||
<WorkerDescriptorProxy :id="row.workerFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
|
@ -469,12 +483,12 @@ const qCheckBoxController = (sale, action) => {
|
|||
>
|
||||
<QTable
|
||||
data-key="itemShelvingsSales"
|
||||
:rows="itemShelvignsSales"
|
||||
:rows="itemShelvingsSales"
|
||||
:columns="shelvingsTableColumns"
|
||||
class="q-pa-sm"
|
||||
class="q-pa-sm full-width"
|
||||
>
|
||||
<template #body-cell-quantity="{ row }">
|
||||
<QTd auto-width>
|
||||
<QTd>
|
||||
<VnInput
|
||||
v-model.number="row.quantity"
|
||||
@keyup.enter="updateQuantity(row)"
|
||||
|
@ -484,13 +498,15 @@ const qCheckBoxController = (sale, action) => {
|
|||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-worker="{ row }">
|
||||
<QTd auto-width>
|
||||
<QBtn flat dense color="primary">{{ row.name }}</QBtn>
|
||||
<QTd>
|
||||
<QBtn flat class="link">
|
||||
{{ row.name }}
|
||||
<WorkerDescriptorProxy :id="row.userFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-shelving="{ row }">
|
||||
<QTd auto-width>
|
||||
<QTd>
|
||||
<VnSelect
|
||||
url="Shelvings"
|
||||
hide-selected
|
||||
|
@ -503,7 +519,7 @@ const qCheckBoxController = (sale, action) => {
|
|||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-parking="{ row }">
|
||||
<QTd auto-width>
|
||||
<QTd>
|
||||
<VnSelect
|
||||
url="Parkings"
|
||||
hide-selected
|
||||
|
@ -538,4 +554,10 @@ $estados: (
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 560px) {
|
||||
.q-dialog__inner--minimized > div {
|
||||
max-width: 900px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -25,7 +25,7 @@ const { notify } = useNotify();
|
|||
|
||||
const selected = ref([]);
|
||||
const defaultTaxClass = ref(null);
|
||||
|
||||
const isSaving = ref(false);
|
||||
const crudModelFilter = computed(() => ({
|
||||
where: { ticketFk: route.params.id },
|
||||
}));
|
||||
|
@ -50,7 +50,7 @@ const createRefund = async () => {
|
|||
if (!selected.value.length) return;
|
||||
|
||||
const params = {
|
||||
servicesIds: selected.value.map((s) => +s.ticketFk),
|
||||
servicesIds: selected.value.map((s) => +s.id),
|
||||
withWarehouse: false,
|
||||
negative: true,
|
||||
};
|
||||
|
@ -104,7 +104,31 @@ const columns = computed(() => [
|
|||
sortable: true,
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: '',
|
||||
name: 'actions',
|
||||
align: 'left',
|
||||
columnFilter: null,
|
||||
},
|
||||
]);
|
||||
|
||||
async function deleteService(row) {
|
||||
const serviceId = row.id;
|
||||
if (!row.id) ticketServiceCrudRef.value.reset();
|
||||
else {
|
||||
const { data } = await axios.delete(`TicketServices/${serviceId}`);
|
||||
if (data) notify('Service deleted successfully', 'positive');
|
||||
ticketServiceCrudRef.value.reload();
|
||||
}
|
||||
}
|
||||
|
||||
async function handleSave() {
|
||||
if (!isSaving.value) {
|
||||
isSaving.value = true;
|
||||
await ticketServiceCrudRef.value?.saveChanges();
|
||||
isSaving.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -123,6 +147,8 @@ const columns = computed(() => [
|
|||
:data-required="crudModelRequiredData"
|
||||
auto-load
|
||||
v-model:selected="selected"
|
||||
:order="['description ASC']"
|
||||
:default-remove="false"
|
||||
>
|
||||
<template #moreBeforeActions>
|
||||
<QBtn
|
||||
|
@ -177,9 +203,25 @@ const columns = computed(() => [
|
|||
v-model.number="row.price"
|
||||
type="number"
|
||||
min="0"
|
||||
@keyup.enter="handleSave"
|
||||
/>
|
||||
</QTd>
|
||||
</template>
|
||||
<template #body-cell-actions="{ row }">
|
||||
<QTd auto-width>
|
||||
<QIcon
|
||||
color="primary"
|
||||
name="delete"
|
||||
class="cursor-pointer"
|
||||
size="sm"
|
||||
@click.stop="deleteService(row)"
|
||||
>
|
||||
<QTooltip class="text-no-wrap">
|
||||
{{ t('globals.delete') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
</template>
|
||||
</CrudModel>
|
||||
|
@ -193,3 +235,4 @@ const columns = computed(() => [
|
|||
/>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
ñ
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<script setup>
|
||||
import RouteDescriptorProxy from 'pages/Route/Card/RouteDescriptorProxy.vue';
|
||||
import { onMounted, ref, computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
@ -16,6 +17,7 @@ import { useArrayData } from 'composables/useArrayData';
|
|||
import VnUserLink from 'src/components/ui/VnUserLink.vue';
|
||||
import VnTitle from 'src/components/common/VnTitle.vue';
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||
|
||||
const route = useRoute();
|
||||
|
@ -79,13 +81,18 @@ async function changeState(value) {
|
|||
console.error('Error changing ticket state', err);
|
||||
}
|
||||
}
|
||||
|
||||
function toTicketUrl(section) {
|
||||
return '#/ticket/' + entityId.value + '/' + section;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="States/editableStates"
|
||||
@on-fetch="(data) => (editableStates = data)"
|
||||
:filter="{ fields: ['code', 'name', 'id', 'alertLevel'], order: 'name ASC' }"
|
||||
auto-load
|
||||
@on-fetch="(data) => (editableStates = data)"
|
||||
/>
|
||||
<CardSummary
|
||||
ref="summaryRef"
|
||||
|
@ -122,14 +129,17 @@ async function changeState(value) {
|
|||
<template #body="{ entity }">
|
||||
<QCard class="vn-one">
|
||||
<VnTitle
|
||||
:url="ticketUrl + 'basic-data/step-one'"
|
||||
:url="toTicketUrl('basic-data')"
|
||||
:text="t('globals.summary.basicData')"
|
||||
/>
|
||||
<VnLv :label="t('ticket.summary.state')">
|
||||
<VnLv v-if="entity.ticketState" :label="t('ticket.summary.state')">
|
||||
<template #value>
|
||||
<QChip :color="entity.ticketState?.state?.classColor ?? 'dark'">
|
||||
{{ entity.ticketState?.state?.name }}
|
||||
</QChip>
|
||||
<QBadge
|
||||
text-color="black"
|
||||
:color="entity.ticketState.state.classColor"
|
||||
>
|
||||
{{ entity.ticketState.state.name }}
|
||||
</QBadge>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('ticket.summary.salesPerson')">
|
||||
|
@ -144,7 +154,14 @@ async function changeState(value) {
|
|||
:label="t('ticket.summary.agency')"
|
||||
:value="entity.agencyMode?.name"
|
||||
/>
|
||||
<VnLv :label="t('ticket.summary.zone')" :value="entity?.zone?.name" />
|
||||
<VnLv :label="t('ticket.summary.zone')">
|
||||
<template #value>
|
||||
<span class="link" @click.stop>
|
||||
{{ entity?.zone?.name }}
|
||||
<ZoneDescriptorProxy :id="entity.zoneFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv
|
||||
:label="t('ticket.summary.warehouse')"
|
||||
:value="entity.warehouse?.name"
|
||||
|
@ -164,7 +181,14 @@ async function changeState(value) {
|
|||
</a>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('ticket.summary.route')" :value="entity.routeFk" />
|
||||
<VnLv :label="t('ticket.summary.route')">
|
||||
<template #value>
|
||||
<span class="link">
|
||||
{{ entity.routeFk }}
|
||||
<RouteDescriptorProxy :id="entity.routeFk" />
|
||||
</span>
|
||||
</template>
|
||||
</VnLv>
|
||||
<VnLv :label="t('ticket.summary.invoice')">
|
||||
<template #value>
|
||||
<span :class="{ link: entity.refFk }">
|
||||
|
@ -181,9 +205,9 @@ async function changeState(value) {
|
|||
:value="dashIfEmpty(entity.weight)"
|
||||
/>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<QCard class="vn-one" style="flex: 2 1">
|
||||
<VnTitle
|
||||
:url="ticketUrl + 'basic-data/step-one'"
|
||||
:url="toTicketUrl('basic-data')"
|
||||
:text="t('globals.summary.basicData')"
|
||||
/>
|
||||
<VnLv
|
||||
|
@ -226,7 +250,7 @@ async function changeState(value) {
|
|||
</QCard>
|
||||
<QCard class="vn-one" v-if="entity.notes.length">
|
||||
<VnTitle
|
||||
:url="ticketUrl + 'observation'"
|
||||
:url="toTicketUrl('observation')"
|
||||
:text="t('ticket.pageTitles.notes')"
|
||||
/>
|
||||
<QVirtualScroll
|
||||
|
@ -245,12 +269,16 @@ async function changeState(value) {
|
|||
"
|
||||
>
|
||||
<span class="label" style="margin-right: 4px">
|
||||
{{ item.observationType.description }}:</span
|
||||
>
|
||||
({{
|
||||
t(
|
||||
`ticketNotes.observationTypes.${item.observationType.description}`
|
||||
)
|
||||
}}):
|
||||
</span>
|
||||
|
||||
<span>{{ item.description }}</span>
|
||||
</QItem></QVirtualScroll
|
||||
>
|
||||
</QItem>
|
||||
</QVirtualScroll>
|
||||
</QCard>
|
||||
<QCard class="vn-one">
|
||||
<VnTitle :text="t('ticket.summary.summaryAmount')" />
|
||||
|
@ -265,13 +293,14 @@ async function changeState(value) {
|
|||
/>
|
||||
<VnLv
|
||||
:label="t('ticket.summary.total')"
|
||||
:value="toCurrency(entity.totalWithVat)"
|
||||
:value="toCurrency(ticket.totalWithVat)"
|
||||
style="font-weight: bold"
|
||||
/>
|
||||
</div>
|
||||
</QCard>
|
||||
<QCard class="vn-max">
|
||||
<VnTitle
|
||||
:url="ticketUrl + 'sale'"
|
||||
:url="toTicketUrl('sale')"
|
||||
:text="t('ticket.summary.saleLines')"
|
||||
/>
|
||||
<QTable :rows="entity.sales" style="text-align: center">
|
||||
|
@ -294,11 +323,10 @@ async function changeState(value) {
|
|||
</template>
|
||||
<template #body="props">
|
||||
<QTr :props="props">
|
||||
<QTd>
|
||||
<QTd class="q-gutter-x-xs">
|
||||
<QBtn
|
||||
flat
|
||||
round
|
||||
size="xs"
|
||||
icon="vn:claims"
|
||||
v-if="props.row.claim"
|
||||
color="primary"
|
||||
|
@ -309,15 +337,14 @@ async function changeState(value) {
|
|||
},
|
||||
}"
|
||||
>
|
||||
<QTooltip
|
||||
>{{ t('ticket.summary.claim') }}:
|
||||
{{ props.row.claim.claimFk }}</QTooltip
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticket.summary.claim') }}:
|
||||
{{ props.row.claim.claimFk }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QBtn
|
||||
flat
|
||||
round
|
||||
size="xs"
|
||||
icon="vn:claims"
|
||||
v-if="props.row.claimBeginning"
|
||||
color="primary"
|
||||
|
@ -328,27 +355,27 @@ async function changeState(value) {
|
|||
},
|
||||
}"
|
||||
>
|
||||
<QTooltip
|
||||
>{{ t('ticket.summary.claim') }}:
|
||||
{{ props.row.claimBeginning.claimFk }}</QTooltip
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticket.summary.claim') }}:
|
||||
{{ props.row.claimBeginning.claimFk }}
|
||||
</QTooltip>
|
||||
</QBtn>
|
||||
<QIcon
|
||||
name="warning"
|
||||
v-show="props.row.visible < 0"
|
||||
size="xs"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip
|
||||
>{{ t('ticket.summary.visible') }}:
|
||||
{{ props.row.visible }}</QTooltip
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticket.summary.visible') }}:
|
||||
{{ props.row.visible }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
name="vn:reserva"
|
||||
name="vn:reserved"
|
||||
v-show="props.row.reserved"
|
||||
size="xs"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticket.summary.reserved') }}
|
||||
|
@ -357,8 +384,8 @@ async function changeState(value) {
|
|||
<QIcon
|
||||
name="vn:unavailable"
|
||||
v-show="props.row.itemShortage"
|
||||
size="xs"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticket.summary.itemShortage') }}
|
||||
|
@ -367,8 +394,8 @@ async function changeState(value) {
|
|||
<QIcon
|
||||
name="vn:components"
|
||||
v-show="props.row.hasComponentLack"
|
||||
size="xs"
|
||||
color="primary"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('ticket.summary.hasComponentLack') }}
|
||||
|
@ -385,8 +412,34 @@ async function changeState(value) {
|
|||
/>
|
||||
</QBtn>
|
||||
</QTd>
|
||||
<QTd>{{ props.row.visible }}</QTd>
|
||||
<QTd>{{ props.row.available }}</QTd>
|
||||
<QTd>
|
||||
<QChip
|
||||
v-if="props.row.visible < 0"
|
||||
dense
|
||||
rounded
|
||||
:color="'negative'"
|
||||
text-color="white"
|
||||
>
|
||||
{{ props.row.visible }}
|
||||
</QChip>
|
||||
<span v-else>
|
||||
{{ props.row.visible }}
|
||||
</span>
|
||||
</QTd>
|
||||
<QTd>
|
||||
<QChip
|
||||
v-if="props.row.available < 0"
|
||||
dense
|
||||
rounded
|
||||
:color="'negative'"
|
||||
text-color="white"
|
||||
>
|
||||
{{ props.row.available }}
|
||||
</QChip>
|
||||
<span v-else>
|
||||
{{ props.row.available }}
|
||||
</span>
|
||||
</QTd>
|
||||
<QTd>{{ props.row.quantity }}</QTd>
|
||||
<QTd class="description-cell">
|
||||
<div class="row full-width justify-between">
|
||||
|
@ -416,14 +469,11 @@ async function changeState(value) {
|
|||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
<QCard
|
||||
class="vn-max"
|
||||
v-if="entity.packagings.length || entity.services.length"
|
||||
>
|
||||
<VnTitle :url="ticketUrl + 'package'" :text="t('globals.packages')" />
|
||||
<QTable :rows="entity.packagings" flat>
|
||||
<QCard class="vn-max" v-if="ticket.packagings.length != 0">
|
||||
<VnTitle :url="toTicketUrl('package')" :text="t('globals.packages')" />
|
||||
<QTable :rows="ticket.packagings" flat style="text-align: center">
|
||||
<template #header="props">
|
||||
<QTr :props="props">
|
||||
<QTr class="tr-header" :props="props">
|
||||
<QTh auto-width>{{ t('ticket.summary.created') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.package') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.quantity') }}</QTh>
|
||||
|
@ -437,13 +487,15 @@ async function changeState(value) {
|
|||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
<QCard class="vn-max" v-if="ticket.services.length != 0">
|
||||
<VnTitle
|
||||
:url="ticketUrl + 'service'"
|
||||
:url="toTicketUrl('service')"
|
||||
:text="t('ticket.summary.service')"
|
||||
/>
|
||||
<QTable :rows="entity.services" flat>
|
||||
<QTable :rows="ticket.services" flat style="text-align: center">
|
||||
<template #header="props">
|
||||
<QTr :props="props">
|
||||
<QTr class="tr-header" :props="props">
|
||||
<QTh auto-width>{{ t('ticket.summary.quantity') }}</QTh>
|
||||
<QTh auto-width>{{ t('globals.description') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.price') }}</QTh>
|
||||
|
@ -464,12 +516,62 @@ async function changeState(value) {
|
|||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
<QCard class="vn-max" v-if="ticket.requests.length != 0">
|
||||
<VnTitle
|
||||
:url="toTicketUrl('request')"
|
||||
:text="t('ticket.summary.purchaseRequest')"
|
||||
/>
|
||||
<QTable :rows="ticket.requests" flat style="text-align: center">
|
||||
<template #header="props">
|
||||
<QTr class="tr-header" :props="props">
|
||||
<QTh auto-width>{{ t('ticket.summary.description') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.created') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.requester') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.attender') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.quantity') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.price') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.item') }}</QTh>
|
||||
<QTh auto-width>{{ t('ticket.summary.ok') }}</QTh>
|
||||
</QTr>
|
||||
</template>
|
||||
<template #body="props">
|
||||
<QTr :props="props">
|
||||
<QTd>{{ props.row.description }}</QTd>
|
||||
<QTd>{{ toDate(props.row.created) }}</QTd>
|
||||
<QTd>{{ props.row.requester?.user?.username }}</QTd>
|
||||
<QTd>{{ props.row.atender?.user?.username }}</QTd>
|
||||
<QTd>{{ props.row.quantity }}</QTd>
|
||||
<QTd>{{ toCurrency(props.row.price) }}</QTd>
|
||||
<QTd>
|
||||
<span class="link" v-if="props.row.isOk">
|
||||
{{ props.row.itemFk }}
|
||||
<ItemDescriptorProxy :id="props.row.itemFk" />
|
||||
</span>
|
||||
</QTd>
|
||||
<QTd>
|
||||
<QCheckbox
|
||||
v-model="props.row.isOk"
|
||||
disable
|
||||
:toggle-indeterminate="false"
|
||||
>
|
||||
<QTooltip v-if="props.row.isOk">
|
||||
{{ t('Accepted') }}
|
||||
</QTooltip>
|
||||
<QTooltip v-else>
|
||||
{{ t('Denied') }}
|
||||
</QTooltip>
|
||||
</QCheckbox>
|
||||
</QTd>
|
||||
</QTr>
|
||||
</template>
|
||||
</QTable>
|
||||
</QCard>
|
||||
</template>
|
||||
</CardSummary>
|
||||
</template>
|
||||
<style lang="scss" scoped>
|
||||
.notes {
|
||||
width: max-content;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.q-card.q-card--dark.q-dark.vn-one {
|
||||
|
|
|
@ -96,8 +96,8 @@ const openCreateModal = () => createTrackingDialogRef.value.show();
|
|||
:no-data-label="t('globals.noResults')"
|
||||
>
|
||||
<template #body-cell-worker="{ row }">
|
||||
<QTd @click.stop>
|
||||
<QBtn flat color="primary">
|
||||
<QTd>
|
||||
<QBtn flat class="link" @click.stop>
|
||||
{{ row.user?.name }}
|
||||
<WorkerDescriptorProxy :id="row.user?.worker?.id" />
|
||||
</QBtn>
|
||||
|
|
|
@ -5,17 +5,18 @@ import { useRoute } from 'vue-router';
|
|||
|
||||
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
|
||||
import FetchedTags from 'components/ui/FetchedTags.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
import axios from 'axios';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const stateStore = useStateStore();
|
||||
const { t } = useI18n();
|
||||
const salesRef = ref(null);
|
||||
const tableRef = ref();
|
||||
|
||||
watch(
|
||||
() => route.params.id,
|
||||
|
@ -34,37 +35,42 @@ const salesFilter = computed(() => ({
|
|||
|
||||
const sales = ref([]);
|
||||
const packingTypeVolume = ref([]);
|
||||
const rows = computed(() => sales.value);
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
label: t('volume.item'),
|
||||
name: 'item',
|
||||
align: 'left',
|
||||
name: 'itemFk',
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('volume.description'),
|
||||
name: 'description',
|
||||
align: 'left',
|
||||
name: 'concept',
|
||||
columnClass: 'expand',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('volume.packingType'),
|
||||
name: 'quantity',
|
||||
field: (row) => row.item.itemPackingTypeFk,
|
||||
align: 'left',
|
||||
format: (val) => dashIfEmpty(val),
|
||||
name: 'itemPackingTypeFk',
|
||||
cardVisible: true,
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.item.itemPackingTypeFk),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('volume.quantity'),
|
||||
name: 'quantity',
|
||||
field: 'quantity',
|
||||
align: 'left',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
label: t('volume.volumeQuantity'),
|
||||
name: 'quantity',
|
||||
field: (row) => row.saleVolume?.volume,
|
||||
align: 'left',
|
||||
label: t('volume.volumeQuantity'),
|
||||
name: 'volume',
|
||||
cardVisible: true,
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -87,9 +93,7 @@ const applyVolumes = async (salesData) => {
|
|||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
onMounted(() => (stateStore.rightDrawer = true));
|
||||
|
||||
onUnmounted(() => (stateStore.rightDrawer = false));
|
||||
</script>
|
||||
|
@ -102,8 +106,12 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
@on-fetch="(data) => applyVolumes(data)"
|
||||
auto-load
|
||||
/>
|
||||
<RightMenu v-if="packingTypeVolume.length">
|
||||
<template #right-panel>
|
||||
<QDrawer
|
||||
v-if="packingTypeVolume.length"
|
||||
side="right"
|
||||
:width="265"
|
||||
v-model="stateStore.rightDrawer"
|
||||
>
|
||||
<QCard
|
||||
v-for="(packingType, index) in packingTypeVolume"
|
||||
:key="index"
|
||||
|
@ -122,32 +130,31 @@ onUnmounted(() => (stateStore.rightDrawer = false));
|
|||
<span> {{ t('volume.volume') }}: {{ packingType.volume }} </span>
|
||||
</QCardSection>
|
||||
</QCard>
|
||||
</template>
|
||||
</RightMenu>
|
||||
<QTable
|
||||
:rows="rows"
|
||||
</QDrawer>
|
||||
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="TicketVolume"
|
||||
:url="`Tickets/${route.params.id}/getSales`"
|
||||
:columns="columns"
|
||||
row-key="id"
|
||||
:pagination="{ rowsPerPage: 0 }"
|
||||
class="full-width q-mt-md"
|
||||
:no-data-label="t('globals.noResults')"
|
||||
:right-search="false"
|
||||
:column-search="false"
|
||||
:order="['itemPackingTypeFk']"
|
||||
auto-load
|
||||
>
|
||||
<template #body-cell-item="{ row }">
|
||||
<QTd>
|
||||
<QBtn flat color="primary">
|
||||
<template #column-itemFk="{ row }">
|
||||
<span class="link">
|
||||
{{ row.itemFk }}
|
||||
<ItemDescriptorProxy :id="row.itemFk" />
|
||||
</QBtn>
|
||||
</QTd>
|
||||
</span>
|
||||
</template>
|
||||
<template #body-cell-description="{ row }">
|
||||
<QTd>
|
||||
<div class="column">
|
||||
<template #column-concept="{ row }">
|
||||
<span>{{ row.item.name }}</span>
|
||||
<span class="color-vn-label">{{ row.item.subName }}</span>
|
||||
<span class="color-vn-label q-pl-md">{{ row.item.subName }}</span>
|
||||
<FetchedTags :item="row.item" />
|
||||
</div>
|
||||
</QTd>
|
||||
</template>
|
||||
</QTable>
|
||||
<template #column-volume="{ rowIndex }">
|
||||
<span>{{ packingTypeVolume?.[rowIndex]?.volume }}</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
|
|
@ -456,11 +456,12 @@ const handleCloseProgressDialog = () => {
|
|||
const handleCancelProgress = () => (cancelProgress.value = true);
|
||||
|
||||
onMounted(async () => {
|
||||
let today = Date.vnNew().toISOString();
|
||||
let today = Date.vnNew();
|
||||
const tomorrow = new Date(today);
|
||||
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
userParams.dateFuture = tomorrow;
|
||||
userParams.dateToAdvance = today;
|
||||
userParams.scopeDays = 1;
|
||||
userParams.warehouseFk = user.value.warehouseFk;
|
||||
const filter = { limit: 0 };
|
||||
await arrayData.addFilter({ filter, userParams });
|
||||
|
@ -550,6 +551,7 @@ onMounted(async () => {
|
|||
style="max-width: 99%"
|
||||
>
|
||||
<template #header="props">
|
||||
{{ userParams.scopeDays }}
|
||||
<QTr :props="props">
|
||||
<QTh
|
||||
class="horizontal-separator text-uppercase color-vn-label"
|
||||
|
|
|
@ -9,6 +9,7 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
|
|||
|
||||
import axios from 'axios';
|
||||
import { onMounted } from 'vue';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
|
@ -116,6 +117,15 @@ onMounted(async () => await getItemPackingTypes());
|
|||
</VnSelect>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInputNumber
|
||||
v-model="params.scopeDays"
|
||||
:label="t('Days onward')"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
|
|
|
@ -105,6 +105,15 @@ const warehouses = ref([]);
|
|||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnInput
|
||||
v-model="params.scopeDays"
|
||||
:label="t('Days onward')"
|
||||
is-outlined
|
||||
/>
|
||||
</QItemSection>
|
||||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<QCheckbox
|
||||
|
@ -268,4 +277,5 @@ es:
|
|||
Warehouse: Almacén
|
||||
Yes: Si
|
||||
No: No
|
||||
Days onward: Días adelante
|
||||
</i18n>
|
||||
|
|
|
@ -4,7 +4,9 @@ import { computed, ref, onMounted } from 'vue';
|
|||
import { useRoute } from 'vue-router';
|
||||
import { useStateStore } from 'stores/useStateStore';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { toDate, toCurrency } from 'src/filters/index';
|
||||
import { useQuasar } from 'quasar';
|
||||
import { toDate, toCurrency, dashIfEmpty } from 'src/filters/index';
|
||||
import useNotify from 'src/composables/useNotify';
|
||||
import TicketSummary from './Card/TicketSummary.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
|
||||
|
@ -14,11 +16,19 @@ import VnInputDate from 'src/components/common/VnInputDate.vue';
|
|||
import VnRow from 'src/components/ui/VnRow.vue';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import TicketFilter from './TicketFilter.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import CustomerDescriptorProxy from '../Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import ZoneDescriptorProxy from '../Zone/Card/ZoneDescriptorProxy.vue';
|
||||
import { toTimeFormat } from 'src/filters/date';
|
||||
import InvoiceOutDescriptorProxy from '../InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const tableRef = ref();
|
||||
const quasar = useQuasar();
|
||||
const { notify } = useNotify();
|
||||
const clientsOptions = ref([]);
|
||||
const addressesOptions = ref([]);
|
||||
const agenciesOptions = ref([]);
|
||||
|
@ -26,6 +36,7 @@ const selectedClient = ref();
|
|||
const stateStore = useStateStore();
|
||||
const from = Date.vnNew();
|
||||
from.setHours(0, 0, 0, 0);
|
||||
from.setDate(from.getDate() - 7);
|
||||
const to = Date.vnNew();
|
||||
to.setHours(23, 59, 0, 0);
|
||||
to.setDate(to.getDate() + 1);
|
||||
|
@ -44,19 +55,21 @@ const initializeFromQuery = () => {
|
|||
Object.assign(userParams, { from, to });
|
||||
};
|
||||
|
||||
const selectedRows = ref([]);
|
||||
const hasSelectedRows = computed(() => selectedRows.value.length > 0);
|
||||
const showForm = ref(false);
|
||||
const dialogData = ref();
|
||||
const companiesOptions = ref([]);
|
||||
const accountingOptions = ref([]);
|
||||
const amountToReturn = ref();
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
name: 'stateFk',
|
||||
label: t('ticketList.state'),
|
||||
columnFilter: {
|
||||
name: 'stateFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'States',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
name: 'statusIcons',
|
||||
hidden: true,
|
||||
format: () => '',
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
|
@ -67,40 +80,6 @@ const columns = computed(() => [
|
|||
},
|
||||
isId: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'nickname',
|
||||
label: t('ticketList.nickname'),
|
||||
isTitle: true,
|
||||
},
|
||||
|
||||
{
|
||||
align: 'left',
|
||||
name: 'shipped',
|
||||
cardVisible: true,
|
||||
label: t('ticketList.shipped'),
|
||||
columnFilter: {
|
||||
component: 'date',
|
||||
alias: 't',
|
||||
inWhere: true,
|
||||
},
|
||||
format: ({ shipped }) => toDate(shipped),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'zoneFk',
|
||||
label: t('ticketList.zone'),
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Zones',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
alias: 't',
|
||||
inWhere: true,
|
||||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.zoneName),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('ticketList.salesPerson'),
|
||||
|
@ -118,6 +97,89 @@ const columns = computed(() => [
|
|||
},
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.salesPerson),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'shippedDate',
|
||||
cardVisible: true,
|
||||
label: t('ticketList.shipped'),
|
||||
columnFilter: {
|
||||
component: 'date',
|
||||
alias: 't',
|
||||
inWhere: true,
|
||||
},
|
||||
format: ({ shippedDate }) => toDate(shippedDate),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'shipped',
|
||||
label: t('ticketList.hour'),
|
||||
format: (row) => toTimeFormat(row.shipped),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'zoneLanding',
|
||||
label: t('ticketList.closure'),
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(toTimeFormat(row.zoneLanding)),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'nickname',
|
||||
label: t('ticketList.nickname'),
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'addressNickname',
|
||||
label: t('ticketList.addressNickname'),
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'province',
|
||||
label: t('ticketList.province'),
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'stateFk',
|
||||
label: t('ticketList.state'),
|
||||
columnFilter: {
|
||||
name: 'stateFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'States',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'refFk',
|
||||
label: t('ticketList.ref'),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'zoneFk',
|
||||
label: t('ticketList.zone'),
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Zones',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
alias: 't',
|
||||
inWhere: true,
|
||||
},
|
||||
columnClass: 'expand',
|
||||
format: (row, dashIfEmpty) => dashIfEmpty(row.zoneName),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'warehouse',
|
||||
label: t('ticketList.warehouse'),
|
||||
columnClass: 'expand',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'totalWithVat',
|
||||
|
@ -133,15 +195,27 @@ const columns = computed(() => [
|
|||
align: 'right',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('ticketList.toLines'),
|
||||
icon: 'list',
|
||||
isPrimary: true,
|
||||
action: (row) => redirectToLines(row.id),
|
||||
},
|
||||
{
|
||||
title: t('ticketList.summary'),
|
||||
icon: 'preview',
|
||||
isPrimary: true,
|
||||
action: (row) => viewSummary(row.id, TicketSummary),
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
function redirectToLines(id) {
|
||||
const url = `#/ticket/${id}/sale`;
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
|
||||
const onClientSelected = async (formData) => {
|
||||
await fetchClient(formData);
|
||||
await fetchAddresses(formData);
|
||||
|
@ -210,16 +284,174 @@ const fetchAddresses = async (formData) => {
|
|||
}
|
||||
};
|
||||
const getColor = (row) => {
|
||||
return row?.classColor ? `bg-${row.classColor}` : 'bg-orange';
|
||||
if (row.alertLevelCode === 'OK') return 'bg-success';
|
||||
else if (row.alertLevelCode === 'FREE') return 'bg-notice';
|
||||
else if (row.alertLevel === 1) return 'bg-warning';
|
||||
else if (row.alertLevel === 0) return 'bg-alert';
|
||||
};
|
||||
|
||||
const getDateColor = (date) => {
|
||||
const today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
const timeTicket = new Date(date);
|
||||
timeTicket.setHours(0, 0, 0, 0);
|
||||
const comparation = today - timeTicket;
|
||||
if (comparation == 0) return 'bg-warning';
|
||||
if (comparation < 0) return 'bg-success';
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
initializeFromQuery();
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
|
||||
async function makeInvoice(ticket) {
|
||||
const ticketsIds = ticket.map((item) => item.id);
|
||||
const { data } = await axios.post(`Tickets/invoiceTicketsAndPdf`, { ticketsIds });
|
||||
const response = data;
|
||||
if (response)
|
||||
quasar.notify({
|
||||
message: t('globals.dataSaved'),
|
||||
type: 'positive',
|
||||
});
|
||||
}
|
||||
|
||||
async function sendDocuware(ticket) {
|
||||
try {
|
||||
let ticketIds = ticket.map((item) => item.id);
|
||||
|
||||
const { data } = await axios.post(`Docuwares/upload`, {
|
||||
fileCabinet: 'deliveryNote',
|
||||
ticketIds,
|
||||
});
|
||||
|
||||
for (let ticket of ticketIds) {
|
||||
ticket.stateFk = data.id;
|
||||
ticket.state = data.name;
|
||||
ticket.alertLevel = data.alertLevel;
|
||||
ticket.alertLevelCode = data.code;
|
||||
}
|
||||
notify('globals.dataSaved', 'positive');
|
||||
} catch (err) {
|
||||
console.err('err: ', err);
|
||||
}
|
||||
}
|
||||
|
||||
function openBalanceDialog(ticket) {
|
||||
const checkedTickets = ticket;
|
||||
const amountPaid = ref(0);
|
||||
const clientFk = ref(null);
|
||||
const description = ref([]);
|
||||
const firstTicketClientId = checkedTickets[0].clientFk;
|
||||
const isSameClient = checkedTickets.every(
|
||||
(ticket) => ticket.clientFk === firstTicketClientId
|
||||
);
|
||||
|
||||
if (!isSameClient) {
|
||||
throw new Error('You cannot make a payment on account from multiple clients');
|
||||
}
|
||||
|
||||
for (let ticketData of checkedTickets) {
|
||||
amountPaid.value += ticketData.totalWithVat;
|
||||
clientFk.value = ticketData.clientFk;
|
||||
description.value.push(ticketData.id);
|
||||
}
|
||||
|
||||
const balanceCreateDialog = ref({
|
||||
amountPaid: amountPaid.value,
|
||||
clientFk: clientFk.value,
|
||||
description: `Albaran: ${description.value.join(', ')}`,
|
||||
});
|
||||
dialogData.value = balanceCreateDialog;
|
||||
showForm.value = true;
|
||||
}
|
||||
|
||||
async function onSubmit() {
|
||||
const { data: email } = await axios.get('Clients', {
|
||||
params: {
|
||||
filter: JSON.stringify({ where: { id: dialogData.value.value.clientFk } }),
|
||||
},
|
||||
});
|
||||
|
||||
const { data } = await axios.post(
|
||||
`Clients/${dialogData.value.value.clientFk}/createReceipt`,
|
||||
{
|
||||
payed: dialogData.value.payed,
|
||||
companyFk: dialogData.value.companyFk,
|
||||
bankFk: dialogData.value.bankFk,
|
||||
amountPaid: dialogData.value.value.amountPaid,
|
||||
description: dialogData.value.value.description,
|
||||
clientFk: dialogData.value.value.clientFk,
|
||||
email: email[0].email,
|
||||
}
|
||||
);
|
||||
|
||||
if (data) notify('globals.dataSaved', 'positive');
|
||||
showForm.value = false;
|
||||
}
|
||||
|
||||
const setAmountToReturn = (newAmountGiven) => {
|
||||
const amountPaid = dialogData.value.value.amountPaid;
|
||||
|
||||
amountToReturn.value = newAmountGiven - amountPaid;
|
||||
};
|
||||
|
||||
function setReference(data) {
|
||||
let newDescription = '';
|
||||
|
||||
switch (data) {
|
||||
case 1:
|
||||
newDescription = `${t(
|
||||
'ticketList.creditCard'
|
||||
)}, ${dialogData.value.value.description.replace(
|
||||
/^(Credit Card, |Cash, |Transfers, )/,
|
||||
''
|
||||
)}`;
|
||||
break;
|
||||
case 2:
|
||||
newDescription = `${t(
|
||||
'ticketList.cash'
|
||||
)}, ${dialogData.value.value.description.replace(
|
||||
/^(Credit Card, |Cash, |Transfers, )/,
|
||||
''
|
||||
)}`;
|
||||
break;
|
||||
case 3:
|
||||
newDescription = `${newDescription.replace(
|
||||
/^(Credit Card, |Cash, |Transfers, )/,
|
||||
''
|
||||
)}`;
|
||||
break;
|
||||
case 4:
|
||||
newDescription = `${t(
|
||||
'ticketList.transfers'
|
||||
)}, ${dialogData.value.value.description.replace(
|
||||
/^(Credit Card, |Cash, |Transfers, )/,
|
||||
''
|
||||
)}`;
|
||||
break;
|
||||
case 3317:
|
||||
newDescription = '';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
dialogData.value.value.description = newDescription;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData
|
||||
url="Companies"
|
||||
@on-fetch="(data) => (companiesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Accountings"
|
||||
@on-fetch="(data) => (accountingOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<VnSearchbar
|
||||
data-key="Ticket"
|
||||
:label="t('Search ticket')"
|
||||
|
@ -246,12 +478,136 @@ onMounted(() => {
|
|||
:user-params="userParams"
|
||||
:right-search="false"
|
||||
redirect="ticket"
|
||||
auto-load
|
||||
v-model:selected="selectedRows"
|
||||
:table="{
|
||||
'row-key': 'id',
|
||||
selection: 'multiple',
|
||||
}"
|
||||
>
|
||||
<template #column-statusIcons="{ row }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<QIcon
|
||||
v-if="row.isTaxDataChecked === 0"
|
||||
color="primary"
|
||||
name="vn:no036"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('No verified data') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.hasTicketRequest"
|
||||
color="primary"
|
||||
name="vn:buyrequest"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Purchase request') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.itemShortage"
|
||||
color="primary"
|
||||
name="vn:unavailable"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Not visible') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row.isFreezed" color="primary" name="vn:frozen" size="xs">
|
||||
<QTooltip>
|
||||
{{ t('Client frozen') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon v-if="row.risk" color="primary" name="vn:risk" size="xs">
|
||||
<QTooltip> {{ t('Risk') }}: {{ row.risk }} </QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.hasComponentLack"
|
||||
color="primary"
|
||||
name="vn:components"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Component lack') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
<QIcon
|
||||
v-if="row.hasRounding"
|
||||
color="primary"
|
||||
name="sync_problem"
|
||||
size="xs"
|
||||
>
|
||||
<QTooltip>
|
||||
{{ t('Rounding') }}
|
||||
</QTooltip>
|
||||
</QIcon>
|
||||
</div>
|
||||
</template>
|
||||
<template #column-salesPersonFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.salesPerson }}
|
||||
<CustomerDescriptorProxy :id="row.salesPersonFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-shippedDate="{ row }">
|
||||
<span v-if="getDateColor(row.shipped)">
|
||||
<QChip :class="getDateColor(row.shipped)" dense square>
|
||||
{{ toDate(row.shippedDate) }}
|
||||
</QChip>
|
||||
</span>
|
||||
</template>
|
||||
<template #column-nickname="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.nickname }}
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-addressNickname="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.addressNickname }}
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-stateFk="{ row }">
|
||||
<span v-if="getColor(row)">
|
||||
<QChip :class="getColor(row)" dense square>
|
||||
{{ row.state }}
|
||||
</QChip>
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ row.state }}
|
||||
</span>
|
||||
</template>
|
||||
<template #column-refFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ dashIfEmpty(row.refFk) }}
|
||||
<InvoiceOutDescriptorProxy :id="row.invoiceOutId" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-zoneFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ dashIfEmpty(row.zoneName) }}
|
||||
<ZoneDescriptorProxy :id="row.zoneFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-totalWithVat="{ row }">
|
||||
<QChip
|
||||
v-if="row.totalWithVat > 0 && row.totalWithVat < 50"
|
||||
class="bg-warning"
|
||||
dense
|
||||
square
|
||||
>
|
||||
{{ row.totalWithVat }}
|
||||
</QChip>
|
||||
</template>
|
||||
<template #more-create-dialog="{ data }">
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
url="Clients"
|
||||
:fields="['id', 'name']"
|
||||
:label="t('ticketList.client')"
|
||||
v-model="data.clientId"
|
||||
:options="clientsOptions"
|
||||
|
@ -259,6 +615,7 @@ onMounted(() => {
|
|||
option-label="name"
|
||||
hide-selected
|
||||
@update:model-value="(client) => onClientSelected(data)"
|
||||
:sort-by="'id ASC'"
|
||||
>
|
||||
<template #option="scope">
|
||||
<QItem v-bind="scope.itemProps">
|
||||
|
@ -339,12 +696,136 @@ onMounted(() => {
|
|||
</div>
|
||||
</VnRow>
|
||||
</template>
|
||||
<template #column-stateFk="{ row }">
|
||||
<QChip :class="getColor(row)" dense square>
|
||||
{{ row.state }}
|
||||
</QChip>
|
||||
</template>
|
||||
</VnTable>
|
||||
<QPageSticky :offset="[20, 80]" style="z-index: 2">
|
||||
<QBtn
|
||||
v-if="hasSelectedRows"
|
||||
@click="makeInvoice(selectedRows)"
|
||||
color="primary"
|
||||
fab
|
||||
icon="vn:invoice-in"
|
||||
/>
|
||||
<QTooltip>
|
||||
{{ t('ticketList.createInvoice') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
<QPageSticky v-if="hasSelectedRows" :offset="[20, 140]" style="z-index: 2">
|
||||
<QBtn
|
||||
@click.stop="openBalanceDialog(selectedRows)"
|
||||
color="primary"
|
||||
fab
|
||||
icon="vn:recovery"
|
||||
/>
|
||||
<QTooltip>
|
||||
{{ t('ticketList.accountPayment') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
<QDialog ref="dialogRef" v-model="showForm">
|
||||
<QCard class="q-pa-md q-mb-md">
|
||||
<QForm @submit="onSubmit()" class="q-pa-sm">
|
||||
{{ t('ticketList.addPayment') }}
|
||||
<VnRow>
|
||||
<VnInputDate
|
||||
:label="t('ticketList.date')"
|
||||
v-model="dialogData.payed"
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('ticketList.company')"
|
||||
v-model="dialogData.companyFk"
|
||||
:options="companiesOptions"
|
||||
option-value="id"
|
||||
option-label="code"
|
||||
hide-selected
|
||||
>
|
||||
</VnSelect>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('ticketList.bank')"
|
||||
v-model="dialogData.bankFk"
|
||||
:options="accountingOptions"
|
||||
option-value="id"
|
||||
option-label="bank"
|
||||
hide-selected
|
||||
@update:model-value="setReference"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('ticketList.amount')"
|
||||
v-model="dialogData.value.amountPaid"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow v-if="dialogData.bankFk === 2">
|
||||
<span>
|
||||
{{ t('ticketList.cash') }}
|
||||
</span>
|
||||
</VnRow>
|
||||
<VnRow v-if="dialogData.bankFk === 2">
|
||||
<VnInput
|
||||
:label="t('ticketList.deliveredAmount')"
|
||||
v-model="dialogData.value.amountGiven"
|
||||
@update:model-value="setAmountToReturn"
|
||||
type="number"
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('ticketList.amountToReturn')"
|
||||
:model-value="amountToReturn"
|
||||
type="number"
|
||||
readonly
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow v-if="dialogData.bankFk === 3 || dialogData.bankFk === 3117">
|
||||
<VnInput
|
||||
:label="t('ticketList.compensation')"
|
||||
v-model="dialogData.value.compensation"
|
||||
type="text"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnInput
|
||||
:label="t('ticketList.reference')"
|
||||
v-model="dialogData.value.description"
|
||||
type="text"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow v-if="dialogData.bankFk === 2">
|
||||
<QCheckbox
|
||||
:label="t('ticketList.viewReceipt')"
|
||||
v-model="dialogData.value.viewReceipt"
|
||||
:toggle-indeterminate="false"
|
||||
/>
|
||||
<QCheckbox
|
||||
:label="t('ticketList.sendEmail')"
|
||||
v-model="dialogData.value.senEmail"
|
||||
:toggle-indeterminate="false"
|
||||
/>
|
||||
</VnRow>
|
||||
<div class="q-mt-lg row justify-end">
|
||||
<QBtn
|
||||
:label="t('globals.save')"
|
||||
color="primary"
|
||||
@click="onSubmit()"
|
||||
/>
|
||||
<QBtn
|
||||
flat
|
||||
:label="t('globals.close')"
|
||||
color="primary"
|
||||
v-close-popup
|
||||
/>
|
||||
</div>
|
||||
</QForm>
|
||||
</QCard>
|
||||
</QDialog>
|
||||
<QPageSticky v-if="hasSelectedRows" :offset="[20, 200]" style="z-index: 2">
|
||||
<QBtn
|
||||
@click="sendDocuware(selectedRows)"
|
||||
color="primary"
|
||||
fab
|
||||
icon="install_mobile"
|
||||
/>
|
||||
<QTooltip>
|
||||
{{ t('ticketList.sendDocuware') }}
|
||||
</QTooltip>
|
||||
</QPageSticky>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
|
@ -353,4 +834,5 @@ es:
|
|||
You can search by ticket id or alias: Puedes buscar por id o alias del ticket
|
||||
Zone: Zona
|
||||
New ticket: Nuevo ticket
|
||||
Component lack: Faltan componentes
|
||||
</i18n>
|
||||
|
|
|
@ -14,6 +14,16 @@ ticketNotes:
|
|||
description: Description
|
||||
removeNote: Remove note
|
||||
addNote: Add note
|
||||
observationTypes:
|
||||
ItemPicker: Item picker
|
||||
Packager: Packager
|
||||
Delivery: Delivery
|
||||
SalesPerson: Sales person
|
||||
Administrative: Administrative
|
||||
Weight: Weight
|
||||
InvoiceOut: Invoice Out
|
||||
DropOff: Drop Off
|
||||
Sustitución: Sustitution
|
||||
ticketSale:
|
||||
id: Id
|
||||
visible: Visible
|
||||
|
@ -67,6 +77,8 @@ advanceTickets:
|
|||
advanceWithoutNegativeTitle: Advance tickets (without negatives)
|
||||
advanceWithoutNegativeSubtitle: Advance {selectedTickets} tickets confirmation
|
||||
errorsList: Errors list
|
||||
search: Search advance tickets
|
||||
searchInfo: Search advance tickets by ID or client ID
|
||||
futureTickets:
|
||||
problems: Problems
|
||||
ticketId: ID
|
||||
|
@ -105,7 +117,7 @@ expedition:
|
|||
name: Name
|
||||
packageType: Package type
|
||||
counter: Counter
|
||||
externalId: externalId
|
||||
externalId: external Id
|
||||
created: Created
|
||||
state: State
|
||||
historyAction: Status log
|
||||
|
@ -118,6 +130,10 @@ expedition:
|
|||
removeExpeditionSubtitle: Are you sure you want to delete this expedition?
|
||||
worker: Worker
|
||||
move: Move
|
||||
isScanned: Is scanned
|
||||
yes: Yes
|
||||
no: No
|
||||
removeExpedition: Delete expedition
|
||||
basicData:
|
||||
next: Next
|
||||
back: Back
|
||||
|
@ -233,7 +249,7 @@ package:
|
|||
removePackage: Remove package
|
||||
ticketList:
|
||||
id: Id
|
||||
nickname: Nickname
|
||||
nickname: Ticket nickname
|
||||
state: State
|
||||
shipped: Shipped
|
||||
zone: Zone
|
||||
|
@ -242,3 +258,27 @@ ticketList:
|
|||
summary: Summary
|
||||
client: Customer
|
||||
createTicket: Create ticket
|
||||
createInvoice: Create invoice
|
||||
accountPayment: Account payment
|
||||
sendDocuware: Set delivered and send delivery note(s) to the tablet
|
||||
addPayment: Add payment
|
||||
date: Date
|
||||
company: Company
|
||||
amount: Amount
|
||||
reference: Reference
|
||||
bank: Bank
|
||||
cash: Cash
|
||||
deliveredAmount: Delivered amount
|
||||
amountToReturn: Amount to return
|
||||
viewReceipt: View receipt
|
||||
sendEmail: Send email
|
||||
compensation: Compensation
|
||||
creditCard: Credit card
|
||||
transfers: Transfers
|
||||
province: Province
|
||||
warehouse: Warehouse
|
||||
hour: Hour
|
||||
closure: Closure
|
||||
toLines: Go to lines
|
||||
addressNickname: Address nickname
|
||||
ref: Reference
|
||||
|
|
|
@ -29,6 +29,18 @@ ticketNotes:
|
|||
description: Descripción
|
||||
removeNote: Quitar nota
|
||||
addNote: Añadir nota
|
||||
observationTypes:
|
||||
ItemPicker: Sacador
|
||||
Packager: Encajador
|
||||
Delivery: Envío
|
||||
SalesPerson: Comercial
|
||||
Administrative: Administrativa
|
||||
Weight: Peso
|
||||
InvoiceOut: Facturas
|
||||
DropOff: Despacho
|
||||
Sustitución: Sustitución
|
||||
Accepted: Aceptado
|
||||
Denied: Denegado
|
||||
purchaseRequest:
|
||||
Id: Id
|
||||
description: Descripción
|
||||
|
@ -114,6 +126,8 @@ advanceTickets:
|
|||
advanceWithoutNegativeTitle: Adelantar tickets (sin negativos)
|
||||
advanceWithoutNegativeSubtitle: '¿Desea adelantar {selectedTickets} tickets?'
|
||||
errorsList: Lista de errores
|
||||
search: Buscar por tickets adelantados
|
||||
searchInfo: Buscar tickets adelantados por el identificador o el identificador del cliente
|
||||
futureTickets:
|
||||
problems: Problemas
|
||||
ticketId: ID
|
||||
|
@ -192,9 +206,9 @@ expedition:
|
|||
id: Expedición
|
||||
item: Artículo
|
||||
name: Nombre
|
||||
packageType: Package type
|
||||
packageType: Embalaje
|
||||
counter: Contador
|
||||
externalId: externalId
|
||||
externalId: ID externo
|
||||
created: Fecha creación
|
||||
state: Estado
|
||||
historyAction: Historial de estados
|
||||
|
@ -207,6 +221,10 @@ expedition:
|
|||
removeExpeditionSubtitle: ¿Está seguro de eliminar esta expedición?
|
||||
worker: Trabajador
|
||||
move: Mover
|
||||
isScanned: Escaneado
|
||||
yes: Sí
|
||||
no: No
|
||||
removeExpedition: Eliminar expedición
|
||||
package:
|
||||
package: Embalaje
|
||||
quantity: Cantidad
|
||||
|
@ -236,7 +254,7 @@ You can search by ticket id or alias: Puedes buscar por id o alias del ticket
|
|||
Select lines to see the options: Selecciona líneas para ver las opciones
|
||||
ticketList:
|
||||
id: Id
|
||||
nickname: Alias
|
||||
nickname: Alias ticket
|
||||
state: Estado
|
||||
shipped: F. Envío
|
||||
zone: Zona
|
||||
|
@ -245,3 +263,27 @@ ticketList:
|
|||
summary: Resumen
|
||||
client: Cliente
|
||||
createTicket: Crear ticket
|
||||
createInvoice: Crear factura
|
||||
accountPayment: Pago a cuenta...
|
||||
sendDocuware: Marcar como servido/s y enviar albarán/es a la tablet
|
||||
addPayment: Añadir pago
|
||||
date: Fecha
|
||||
company: Empresa
|
||||
amount: Importe
|
||||
reference: Referencia
|
||||
bank: Caja
|
||||
cash: Efectivo
|
||||
deliveredAmount: Cantidad entregada
|
||||
amountToReturn: Cantidad a devolver
|
||||
viewReceipt: Ver recibido
|
||||
sendEmail: Enviar correo
|
||||
compensation: Compensación
|
||||
creditCard: Tarjeta de crédito
|
||||
transfers: Transferencias
|
||||
province: Provincia
|
||||
warehouse: Almacén
|
||||
hour: Hora
|
||||
closure: Cierre
|
||||
toLines: Ir a lineas
|
||||
addressNickname: Alias consignatario
|
||||
ref: Referencia
|
||||
|
|
|
@ -121,6 +121,20 @@ const thermographsTableColumns = computed(() => {
|
|||
name: 'temperatureFk',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('globals.maxTemperature'),
|
||||
field: 'maxTemperature',
|
||||
name: 'maxTemperature',
|
||||
align: 'left',
|
||||
format: (val) => (val ? `${val}°` : ''),
|
||||
},
|
||||
{
|
||||
label: t('globals.minTemperature'),
|
||||
field: 'minTemperature',
|
||||
name: 'minTemperature',
|
||||
align: 'left',
|
||||
format: (val) => (val ? `${val}°` : ''),
|
||||
},
|
||||
{
|
||||
label: t('travel.thermographs.state'),
|
||||
field: 'result',
|
||||
|
@ -133,7 +147,7 @@ const thermographsTableColumns = computed(() => {
|
|||
name: 'destination',
|
||||
align: 'left',
|
||||
format: (val) =>
|
||||
warehouses.value.find((warehouse) => warehouse.id === val).name,
|
||||
warehouses.value.find((warehouse) => warehouse.id === val)?.name,
|
||||
},
|
||||
{
|
||||
label: t('travel.thermographs.created'),
|
||||
|
@ -319,7 +333,7 @@ const getLink = (param) => `#/travel/${entityId.value}/${param}`;
|
|||
</template>
|
||||
<template #body-cell-id="{ col, value }">
|
||||
<QTd>
|
||||
<QBtn v-if="col.name === 'id'" flat color="blue">
|
||||
<QBtn v-if="col.name === 'id'" flat class="link">
|
||||
{{ value }}
|
||||
<EntryDescriptorProxy :id="value" />
|
||||
</QBtn>
|
||||
|
|
|
@ -47,6 +47,20 @@ const TableColumns = computed(() => {
|
|||
name: 'temperatureFk',
|
||||
align: 'left',
|
||||
},
|
||||
{
|
||||
label: t('globals.maxTemperature'),
|
||||
field: 'maxTemperature',
|
||||
name: 'maxTemperature',
|
||||
align: 'left',
|
||||
format: (val) => (val ? `${val}°` : ''),
|
||||
},
|
||||
{
|
||||
label: t('globals.minTemperature'),
|
||||
field: 'minTemperature',
|
||||
name: 'minTemperature',
|
||||
align: 'left',
|
||||
format: (val) => (val ? `${val}°` : ''),
|
||||
},
|
||||
{
|
||||
label: t('travel.thermographs.state'),
|
||||
field: 'result',
|
||||
|
@ -92,11 +106,7 @@ const openRemoveDialog = async (id) => {
|
|||
},
|
||||
})
|
||||
.onOk(async () => {
|
||||
try {
|
||||
await removeThermograph(id);
|
||||
} catch (err) {
|
||||
console.error('Error removing thermograph');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -106,9 +116,7 @@ const redirectToThermographForm = (action, id) => {
|
|||
};
|
||||
|
||||
if (action === 'edit' && id) {
|
||||
const params = {};
|
||||
params.thermographId = id;
|
||||
routeDetails.params = params;
|
||||
routeDetails.query = { travelThermographFk: id };
|
||||
}
|
||||
router.push(routeDetails);
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { reactive, ref, onBeforeMount } from 'vue';
|
||||
import { ref, onBeforeMount } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -14,6 +14,7 @@ import { useState } from 'src/composables/useState';
|
|||
import { useStateStore } from 'stores/useStateStore';
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
|
||||
const props = defineProps({
|
||||
viewAction: {
|
||||
|
@ -28,24 +29,17 @@ const route = useRoute();
|
|||
const router = useRouter();
|
||||
const state = useState();
|
||||
const { notify } = useNotify();
|
||||
|
||||
const fetchTravelThermographsRef = ref(null);
|
||||
const allowedContentTypes = ref('');
|
||||
const user = state.getUser();
|
||||
const dmsTypesOptions = ref([]);
|
||||
const companiesOptions = ref([]);
|
||||
const warehousesOptions = ref([]);
|
||||
const temperaturesOptions = ref([]);
|
||||
const thermographForm = ref({});
|
||||
const inputFileRef = ref(null);
|
||||
|
||||
const thermographForm = reactive({
|
||||
thermographId: null,
|
||||
state: null,
|
||||
reference: null,
|
||||
dmsTypeId: null,
|
||||
companyId: null,
|
||||
warehouseId: null,
|
||||
files: [],
|
||||
description: null,
|
||||
});
|
||||
|
||||
onBeforeMount(async () => {
|
||||
if (props.viewAction === 'create') {
|
||||
setCreateDefaultParams();
|
||||
|
@ -65,7 +59,7 @@ const fetchDmsTypes = async () => {
|
|||
try {
|
||||
const params = {
|
||||
filter: {
|
||||
where: { code: 'miscellaneous' },
|
||||
where: { code: 'thermograph' },
|
||||
},
|
||||
};
|
||||
const { data } = await axios.get('DmsTypes/findOne', { params });
|
||||
|
@ -77,88 +71,67 @@ const fetchDmsTypes = async () => {
|
|||
|
||||
const setCreateDefaultParams = async () => {
|
||||
const dataResponse = await fetchDmsTypes();
|
||||
thermographForm.companyId = user.value.companyFk;
|
||||
thermographForm.warehouseId = user.value.warehouseFk;
|
||||
thermographForm.reference = route.params.id;
|
||||
thermographForm.dmsTypeId = dataResponse.id;
|
||||
thermographForm.state = 'Ok';
|
||||
thermographForm.description = t('travel.thermographs.travelFileDescription', {
|
||||
thermographForm.value.companyId = user.value.companyFk;
|
||||
thermographForm.value.warehouseId = user.value.warehouseFk;
|
||||
thermographForm.value.reference = route.params.id;
|
||||
thermographForm.value.dmsTypeId = dataResponse.id;
|
||||
thermographForm.value.state = 'Ok';
|
||||
thermographForm.value.description = t('travel.thermographs.travelFileDescription', {
|
||||
travelId: route.params.id,
|
||||
}).toUpperCase();
|
||||
};
|
||||
|
||||
const setEditDefaultParams = async () => {
|
||||
try {
|
||||
const filterObj = { include: { relation: 'dms' } };
|
||||
const filter = encodeURIComponent(JSON.stringify(filterObj));
|
||||
const { data } = await axios.get(
|
||||
`TravelThermographs/${route.params.thermographId}?filter=${filter}`
|
||||
`TravelThermographs/${route.query.travelThermographFk}?filter=${filter}`
|
||||
);
|
||||
|
||||
if (data) {
|
||||
thermographForm.thermographId = data.thermographFk;
|
||||
thermographForm.state = data.result;
|
||||
thermographForm.reference = data.dms?.reference;
|
||||
thermographForm.warehouseId = data.dms?.warehouseFk;
|
||||
thermographForm.companyId = data.dms?.companyFk;
|
||||
thermographForm.dmsTypeId = data.dms?.dmsTypeFk;
|
||||
thermographForm.description = data.dms?.description || '';
|
||||
thermographForm.hasFile = data.dms?.hasFile;
|
||||
thermographForm.hasFileAttached = false;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error fetching termograph');
|
||||
thermographForm.value.thermographFk = data.thermographFk;
|
||||
thermographForm.value.state = data.result;
|
||||
thermographForm.value.reference = data.dms?.reference;
|
||||
thermographForm.value.warehouseId = data.warehouseFk;
|
||||
thermographForm.value.companyId = data.dms?.companyFk;
|
||||
thermographForm.value.dmsTypeId = data.dms?.dmsTypeFk;
|
||||
thermographForm.value.description = data.dms?.description || '';
|
||||
thermographForm.value.hasFile = data.dms?.hasFile;
|
||||
thermographForm.value.hasFileAttached = false;
|
||||
thermographForm.value.maxTemperature = data.maxTemperature;
|
||||
thermographForm.value.minTemperature = data.minTemperature;
|
||||
thermographForm.value.temperatureFk = data.temperatureFk;
|
||||
thermographForm.value.travelThermographFk = data.id;
|
||||
}
|
||||
};
|
||||
|
||||
const onSubmit = () => {
|
||||
props.viewAction === 'create' ? createThermograph() : updateThermograph();
|
||||
};
|
||||
|
||||
const createThermograph = async () => {
|
||||
const onSubmit = async () => {
|
||||
const formData = new FormData();
|
||||
|
||||
thermographForm.files.forEach((file) => {
|
||||
if (Array.isArray(thermographForm.value.files)) {
|
||||
thermographForm.value.hasFileAttached = true;
|
||||
thermographForm.value.files.forEach((file) => {
|
||||
formData.append(file.name, file);
|
||||
});
|
||||
|
||||
try {
|
||||
await axios.post(`/travels/${route.params.id}/createThermograph`, formData, {
|
||||
params: thermographForm,
|
||||
}
|
||||
delete thermographForm.value.files;
|
||||
await axios.post(`/travels/${route.params.id}/saveThermograph`, formData, {
|
||||
params: thermographForm.value,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
});
|
||||
router.push({ name: 'TravelThermographsIndex' });
|
||||
notify(t('Thermograph created'), 'positive');
|
||||
} catch (error) {
|
||||
console.error('Error creating thermograph');
|
||||
}
|
||||
};
|
||||
|
||||
const updateThermograph = async () => {
|
||||
const formData = new FormData();
|
||||
|
||||
thermographForm.files.forEach((file) => {
|
||||
formData.append(file.name, file);
|
||||
});
|
||||
|
||||
try {
|
||||
await axios.post(`travels/${route.params.id}/updateThermograph`, formData, {
|
||||
params: thermographForm,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
});
|
||||
router.push({ name: 'TravelThermographsIndex' });
|
||||
notify(t('Thermograph created'), 'positive');
|
||||
} catch (error) {
|
||||
console.error('Error creating thermograph');
|
||||
}
|
||||
};
|
||||
|
||||
const onThermographCreated = async (data) => {
|
||||
thermographForm.thermographId = data.id;
|
||||
await fetchTravelThermographsRef.value.fetch();
|
||||
thermographForm.value = {
|
||||
...thermographForm.value,
|
||||
...data,
|
||||
travelThermographFk: data.id,
|
||||
warehouseId: data.warehouseFk,
|
||||
};
|
||||
};
|
||||
</script>
|
||||
<template>
|
||||
|
@ -185,6 +158,11 @@ const onThermographCreated = async (data) => {
|
|||
:filter="{ order: 'name' }"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (temperaturesOptions = data)"
|
||||
auto-load
|
||||
url="Temperatures"
|
||||
/>
|
||||
<QPage class="column items-center full-width">
|
||||
<QForm
|
||||
model="travel"
|
||||
|
@ -219,21 +197,20 @@ const onThermographCreated = async (data) => {
|
|||
<VnRow>
|
||||
<VnSelectDialog
|
||||
:label="t('travel.thermographs.thermograph')"
|
||||
v-model="thermographForm.thermographId"
|
||||
v-model="thermographForm.travelThermographFk"
|
||||
url="TravelThermographs"
|
||||
option-value="thermographFk"
|
||||
option-label="thermographFk"
|
||||
:fields="['thermographFk']"
|
||||
:where="{ travelFk: null }"
|
||||
:fields="['id', 'thermographFk']"
|
||||
:where="{
|
||||
or: [{ travelFk: null }, { travelFk: $route.params.id }],
|
||||
}"
|
||||
sort-by="thermographFk ASC"
|
||||
option-label="thermographFk"
|
||||
:disable="viewAction === 'edit'"
|
||||
:tooltip="t('New thermograph')"
|
||||
>
|
||||
<template #form>
|
||||
<CreateThermographForm
|
||||
@on-data-saved="
|
||||
(data) => (thermographForm.thermographId = data.id)
|
||||
"
|
||||
@on-data-saved="onThermographCreated"
|
||||
/>
|
||||
</template>
|
||||
</VnSelectDialog>
|
||||
|
@ -271,6 +248,26 @@ const onThermographCreated = async (data) => {
|
|||
option-label="name"
|
||||
/>
|
||||
</VnRow>
|
||||
<VnRow>
|
||||
<VnSelect
|
||||
:label="t('travel.thermographs.temperature')"
|
||||
:options="temperaturesOptions"
|
||||
hide-selected
|
||||
option-label="name"
|
||||
option-value="code"
|
||||
v-model="thermographForm.temperatureFk"
|
||||
:required="true"
|
||||
/>
|
||||
<VnInputNumber
|
||||
v-model="thermographForm.maxTemperature"
|
||||
:label="t('globals.maxTemperature')"
|
||||
/>
|
||||
<VnInputNumber
|
||||
v-model="thermographForm.minTemperature"
|
||||
:label="t('globals.minTemperature')"
|
||||
/>
|
||||
</VnRow>
|
||||
|
||||
<VnRow v-if="viewAction === 'edit'" class="row q-gutter-md q-mb-md">
|
||||
<QInput
|
||||
:label="t('globals.description')"
|
||||
|
@ -310,7 +307,7 @@ const onThermographCreated = async (data) => {
|
|||
</QPage>
|
||||
</template>
|
||||
<i18n>
|
||||
es:
|
||||
es:
|
||||
Select files: Selecciona ficheros
|
||||
Thermograph created: Termógrafo creado
|
||||
New thermograph: Nuevo termógrafo
|
||||
|
|
|
@ -0,0 +1,163 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||
import VnSelect from 'components/common/VnSelect.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||
import VnInputTime from 'src/components/common/VnInputTime.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const props = defineProps({
|
||||
dataKey: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const states = ref([]);
|
||||
|
||||
defineExpose({ states });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData url="warehouses" @on-fetch="(data) => (states = data)" auto-load />
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true" search-url="table">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
<span>{{ formatFn(tag.value) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body="{ params, searchFn }">
|
||||
<div class="q-pa-sm q-gutter-y-sm">
|
||||
<VnInput
|
||||
:label="t('travel.Id')"
|
||||
v-model="params.id"
|
||||
lazy-rules
|
||||
is-outlined
|
||||
>
|
||||
<template #prepend> <QIcon name="badge" size="xs" /></template>
|
||||
</VnInput>
|
||||
<VnInput
|
||||
:label="t('travel.ref')"
|
||||
v-model="params.ref"
|
||||
lazy-rules
|
||||
is-outlined
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('travel.agency')"
|
||||
v-model="params.agencyModeFk"
|
||||
@update:model-value="searchFn()"
|
||||
url="agencyModes"
|
||||
:use-like="false"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
option-filter="name"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('travel.warehouseInFk')"
|
||||
v-model="params.warehouseInFk"
|
||||
@update:model-value="searchFn()"
|
||||
url="warehouses"
|
||||
:use-like="false"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
option-filter="name"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('travel.shipped')"
|
||||
v-model="params.shipped"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
<VnInputTime
|
||||
v-model="params.shipmentHour"
|
||||
@update:model-value="searchFn()"
|
||||
:label="t('travel.shipmentHour')"
|
||||
outlined
|
||||
rounded
|
||||
dense
|
||||
/>
|
||||
<VnSelect
|
||||
:label="t('travel.warehouseOut')"
|
||||
v-model="params.warehouseOut"
|
||||
@update:model-value="searchFn()"
|
||||
url="warehouses"
|
||||
:use-like="false"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
option-filter="name"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
<VnInputDate
|
||||
:label="t('travel.landed')"
|
||||
v-model="params.landed"
|
||||
@update:model-value="searchFn()"
|
||||
dense
|
||||
outlined
|
||||
rounded
|
||||
/>
|
||||
<VnInputTime
|
||||
v-model="params.landingHour"
|
||||
@update:model-value="searchFn()"
|
||||
:label="t('travel.landingHour')"
|
||||
outlined
|
||||
rounded
|
||||
dense
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('travel.totalEntries')"
|
||||
v-model="params.totalEntries"
|
||||
lazy-rules
|
||||
is-outlined
|
||||
/>
|
||||
<VnInput
|
||||
:label="t('travel.travelList.tableVisibleColumns.daysOnward')"
|
||||
v-model="params.daysOnward"
|
||||
lazy-rules
|
||||
is-outlined
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</VnFilterPanel>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
en:
|
||||
travel:
|
||||
Id: Contains
|
||||
ref: Reference
|
||||
agency: Agency
|
||||
warehouseInFk: W. In
|
||||
shipped: Shipped
|
||||
shipmentHour: Shipment Hour
|
||||
warehouseOut: W. Out
|
||||
landed: Landed
|
||||
landingHour: Landing Hour
|
||||
totalEntries: Σ
|
||||
es:
|
||||
travel:
|
||||
Id: Id
|
||||
ref: Referencia
|
||||
agency: Agencia
|
||||
warehouseInFk: Alm.Salida
|
||||
shipped: F.Envío
|
||||
shipmentHour: Hora de envío
|
||||
warehouseOut: Alm.Entrada
|
||||
landed: F.Entrega
|
||||
landingHour: Hora de entrega
|
||||
totalEntries: Σ
|
||||
</i18n>
|
|
@ -9,6 +9,8 @@ import TravelSummary from './Card/TravelSummary.vue';
|
|||
import VnSearchbar from 'components/ui/VnSearchbar.vue';
|
||||
import { toDate } from 'src/filters';
|
||||
import { getDateQBadgeColor } from 'src/composables/getDateQBadgeColor.js';
|
||||
import RightMenu from 'src/components/common/RightMenu.vue';
|
||||
import TravelFilter from './TravelFilter.vue';
|
||||
|
||||
const { viewSummary } = useSummaryDialog();
|
||||
const router = useRouter();
|
||||
|
@ -24,6 +26,7 @@ const $props = defineProps({
|
|||
});
|
||||
const entityId = computed(() => $props.id || route.params.id);
|
||||
|
||||
const travelFilterRef = ref();
|
||||
onMounted(async () => {
|
||||
stateStore.rightDrawer = true;
|
||||
});
|
||||
|
@ -158,15 +161,6 @@ const columns = computed(() => [
|
|||
cardVisible: true,
|
||||
create: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'daysOnward',
|
||||
label: t('travel.travelList.tableVisibleColumns.daysOnward'),
|
||||
visible: false,
|
||||
columnFilter: {
|
||||
inWhere: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: '',
|
||||
|
@ -201,6 +195,11 @@ const columns = computed(() => [
|
|||
:label="t('Search travel')"
|
||||
data-key="TravelList"
|
||||
/>
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
<TravelFilter data-key="TravelList" ref="travelFilterRef" />
|
||||
</template>
|
||||
</RightMenu>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="TravelList"
|
||||
|
@ -213,6 +212,7 @@ const columns = computed(() => [
|
|||
editorFk: entityId,
|
||||
},
|
||||
}"
|
||||
:right-search="false"
|
||||
:user-params="{ daysOnward: 7 }"
|
||||
order="landed DESC"
|
||||
:columns="columns"
|
||||
|
@ -220,7 +220,6 @@ const columns = computed(() => [
|
|||
redirect="travel"
|
||||
:is-editable="false"
|
||||
:use-model="true"
|
||||
chip-locale="travel.travelList.tableVisibleColumns"
|
||||
>
|
||||
<template #column-shipped="{ row }">
|
||||
<QBadge
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue