Compare commits
8 Commits
dev
...
7638-showA
Author | SHA1 | Date |
---|---|---|
|
e52c6afe4c | |
|
4b5fb2453a | |
|
bdcd8cad91 | |
|
5b0090adc9 | |
|
ac19803fcd | |
|
af612f9379 | |
|
f2e4fff69a | |
|
ee1fcf75fb |
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "25.18.0",
|
||||
"version": "25.16.0",
|
||||
"description": "Salix frontend",
|
||||
"productName": "Salix",
|
||||
"author": "Verdnatura",
|
||||
|
@ -89,4 +89,4 @@
|
|||
"vite": "^6.0.11",
|
||||
"vitest": "^0.31.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import { onMounted } from 'vue';
|
||||
import { useQuasar, Dark } from 'quasar';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import VnScroll from './components/common/VnScroll.vue';
|
||||
|
||||
const quasar = useQuasar();
|
||||
const { availableLocales, locale, fallbackLocale } = useI18n();
|
||||
|
@ -39,7 +38,6 @@ quasar.iconMapFn = (iconName) => {
|
|||
|
||||
<template>
|
||||
<RouterView />
|
||||
<VnScroll/>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
|
@ -406,7 +406,6 @@ defineExpose({
|
|||
</QBtnDropdown>
|
||||
<QBtn
|
||||
v-else
|
||||
data-cy="saveDefaultBtn"
|
||||
:label="tMobile('globals.save')"
|
||||
color="primary"
|
||||
icon="save"
|
||||
|
|
|
@ -69,7 +69,7 @@ const refresh = () => window.location.reload();
|
|||
'no-visible': !stateQuery.isLoading().value,
|
||||
}"
|
||||
size="sm"
|
||||
data-cy="navBar-spinner"
|
||||
data-cy="loading-spinner"
|
||||
/>
|
||||
<QSpace />
|
||||
<div id="searchbar" class="searchbar"></div>
|
||||
|
|
|
@ -33,7 +33,6 @@ import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
|
|||
import VnTableFilter from './VnTableFilter.vue';
|
||||
import { getColAlign } from 'src/composables/getColAlign';
|
||||
import RightMenu from '../common/RightMenu.vue';
|
||||
import VnScroll from '../common/VnScroll.vue'
|
||||
|
||||
const arrayData = useArrayData(useAttrs()['data-key']);
|
||||
const $props = defineProps({
|
||||
|
@ -169,7 +168,6 @@ const params = ref(useFilterParams($attrs['data-key']).params);
|
|||
const orders = ref(useFilterParams($attrs['data-key']).orders);
|
||||
const app = inject('app');
|
||||
const tableHeight = useTableHeight();
|
||||
const vnScrollRef = ref(null);
|
||||
|
||||
const editingRow = ref(null);
|
||||
const editingField = ref(null);
|
||||
|
@ -191,17 +189,6 @@ const tableModes = [
|
|||
},
|
||||
];
|
||||
|
||||
const onVirtualScroll = ({ to }) => {
|
||||
handleScroll();
|
||||
const virtualScrollContainer = tableRef.value?.$el?.querySelector('.q-table__middle');
|
||||
if (virtualScrollContainer) {
|
||||
virtualScrollContainer.dispatchEvent(new CustomEvent('scroll'));
|
||||
if (vnScrollRef.value) {
|
||||
vnScrollRef.value.updateScrollContainer(virtualScrollContainer);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onBeforeMount(() => {
|
||||
const urlParams = route.query[$props.searchUrl];
|
||||
hasParams.value = urlParams && Object.keys(urlParams).length !== 0;
|
||||
|
@ -340,13 +327,16 @@ function handleOnDataSaved(_) {
|
|||
if (_.onDataSaved) _.onDataSaved({ CrudModelRef: CrudModelRef.value });
|
||||
else $props.create.onDataSaved(_);
|
||||
}
|
||||
|
||||
function handleScroll() {
|
||||
if ($props.crudModel.disableInfiniteScroll) return;
|
||||
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
|
||||
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
|
||||
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
||||
if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate();
|
||||
if ($props.crudModel.disableInfiniteScroll) return;
|
||||
|
||||
const tMiddle = tableRef.value.$el.querySelector('.q-table__middle');
|
||||
const { scrollHeight, scrollTop, clientHeight } = tMiddle;
|
||||
const isAtBottom = Math.abs(scrollHeight - scrollTop - clientHeight) <= 40;
|
||||
if (isAtBottom) CrudModelRef.value.vnPaginateRef.paginate();
|
||||
}
|
||||
|
||||
function handleSelection({ evt, added, rows: selectedRows }, rows) {
|
||||
if (evt?.shiftKey && added) {
|
||||
const rowIndex = selectedRows[0].$index;
|
||||
|
@ -679,9 +669,9 @@ const rowCtrlClickFunction = computed(() => {
|
|||
ref="tableRef"
|
||||
v-bind="table"
|
||||
:class="[
|
||||
'vnTable',
|
||||
table ? 'selection-cell' : '',
|
||||
$props.footer ? 'last-row-sticky' : '',
|
||||
'vnTable',
|
||||
table ? 'selection-cell' : '',
|
||||
$props.footer ? 'last-row-sticky' : '',
|
||||
]"
|
||||
wrap-cells
|
||||
:columns="splittedColumns.columns"
|
||||
|
@ -693,7 +683,7 @@ const rowCtrlClickFunction = computed(() => {
|
|||
flat
|
||||
:style="isTableMode && `max-height: ${$props.tableHeight || tableHeight}`"
|
||||
:virtual-scroll="isTableMode"
|
||||
@virtual-scroll="onVirtualScroll"
|
||||
@virtual-scroll="handleScroll"
|
||||
@row-click="(event, row) => handleRowClick(event, row)"
|
||||
@update:selected="emit('update:selected', $event)"
|
||||
@selection="(details) => handleSelection(details, rows)"
|
||||
|
@ -751,7 +741,6 @@ const rowCtrlClickFunction = computed(() => {
|
|||
withFilters
|
||||
"
|
||||
:column="col"
|
||||
:data-cy="`column-filter-${col.name}`"
|
||||
:show-title="true"
|
||||
:data-key="$attrs['data-key']"
|
||||
v-model="params[columnName(col)]"
|
||||
|
@ -1098,11 +1087,6 @@ const rowCtrlClickFunction = computed(() => {
|
|||
</template>
|
||||
</FormModelPopup>
|
||||
</QDialog>
|
||||
<VnScroll
|
||||
ref="vnScrollRef"
|
||||
v-if="isTableMode"
|
||||
:scroll-target="tableRef?.$el?.querySelector('.q-table__middle')"
|
||||
/>
|
||||
</template>
|
||||
<i18n>
|
||||
en:
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
<script setup>
|
||||
import { ref, onMounted, onUnmounted, watch, nextTick } from 'vue';
|
||||
|
||||
const props = defineProps({
|
||||
scrollTarget: { type: [String, Object], default: 'window' }
|
||||
});
|
||||
|
||||
const scrollPosition = ref(0);
|
||||
const showButton = ref(false);
|
||||
let scrollContainer = null;
|
||||
|
||||
const onScroll = () => {
|
||||
if (!scrollContainer) return;
|
||||
scrollPosition.value =
|
||||
typeof props.scrollTarget === 'object'
|
||||
? scrollContainer.scrollTop
|
||||
: window.scrollY;
|
||||
};
|
||||
|
||||
watch(scrollPosition, (newValue) => {
|
||||
showButton.value = newValue > 0;
|
||||
});
|
||||
|
||||
const scrollToTop = () => {
|
||||
if (scrollContainer) {
|
||||
scrollContainer.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
}
|
||||
};
|
||||
|
||||
const updateScrollContainer = (container) => {
|
||||
if (container) {
|
||||
if (scrollContainer) {
|
||||
scrollContainer.removeEventListener('scroll', onScroll);
|
||||
}
|
||||
scrollContainer = container;
|
||||
scrollContainer.addEventListener('scroll', onScroll);
|
||||
onScroll();
|
||||
}
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
updateScrollContainer
|
||||
});
|
||||
|
||||
const initScrollContainer = async () => {
|
||||
await nextTick();
|
||||
|
||||
if (typeof props.scrollTarget === 'object') {
|
||||
scrollContainer = props.scrollTarget;
|
||||
} else {
|
||||
scrollContainer = window;
|
||||
}
|
||||
|
||||
if (!scrollContainer) return
|
||||
scrollContainer.addEventListener('scroll', onScroll);
|
||||
};
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
initScrollContainer();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
if (scrollContainer) {
|
||||
scrollContainer.removeEventListener('scroll', onScroll);
|
||||
scrollContainer = null;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QIcon
|
||||
v-if="showButton"
|
||||
color="primary"
|
||||
name="keyboard_arrow_up"
|
||||
class="scroll-to-top"
|
||||
@click="scrollToTop"
|
||||
>
|
||||
<QTooltip>{{ $t('globals.scrollToTop') }}</QTooltip>
|
||||
</QIcon>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.scroll-to-top {
|
||||
position: fixed;
|
||||
top: 70px;
|
||||
font-size: 65px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 1000;
|
||||
transition: transform 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
.scroll-to-top:hover {
|
||||
transform: translateX(-50%) scale(1.2);
|
||||
cursor: pointer;
|
||||
filter: brightness(0.8);
|
||||
}
|
||||
</style>
|
||||
|
|
@ -232,7 +232,7 @@ fr:
|
|||
pt: Portugais
|
||||
pt:
|
||||
Send SMS: Enviar SMS
|
||||
CustomerDefaultLanguage: Este cliente utiliza o {locale} como seu idioma padrão
|
||||
CustomerDefaultLanguage: Este cliente utiliza o <strong>{locale}</strong> como seu idioma padrão
|
||||
Language: Linguagem
|
||||
Phone: Móvel
|
||||
Subject: Assunto
|
||||
|
|
|
@ -212,7 +212,6 @@ const getLocale = (label) => {
|
|||
color="primary"
|
||||
style="position: fixed; z-index: 1; right: 0; bottom: 0"
|
||||
icon="search"
|
||||
data-cy="vnFilterPanel_search"
|
||||
@click="search()"
|
||||
>
|
||||
<QTooltip bottom anchor="bottom right">
|
||||
|
@ -230,7 +229,6 @@ const getLocale = (label) => {
|
|||
<QItemSection top side>
|
||||
<QBtn
|
||||
@click="clearFilters"
|
||||
data-cy="clearFilters"
|
||||
color="primary"
|
||||
dense
|
||||
flat
|
||||
|
@ -294,7 +292,6 @@ const getLocale = (label) => {
|
|||
</QList>
|
||||
</QForm>
|
||||
<QInnerLoading
|
||||
data-cy="filterPanel-spinner"
|
||||
:label="t('globals.pleaseWait')"
|
||||
:showing="isLoading"
|
||||
color="primary"
|
||||
|
|
|
@ -6,7 +6,6 @@ globals:
|
|||
quantity: Quantity
|
||||
entity: Entity
|
||||
preview: Preview
|
||||
scrollToTop: Go up
|
||||
user: User
|
||||
details: Details
|
||||
collapseMenu: Collapse lateral menu
|
||||
|
|
|
@ -6,7 +6,6 @@ globals:
|
|||
quantity: Cantidad
|
||||
entity: Entidad
|
||||
preview: Vista previa
|
||||
scrollToTop: Ir arriba
|
||||
user: Usuario
|
||||
details: Detalles
|
||||
collapseMenu: Contraer menú lateral
|
||||
|
|
|
@ -11,7 +11,7 @@ const $props = defineProps({
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy data-cy="CustomerDescriptor">
|
||||
<QPopupProxy>
|
||||
<CustomerDescriptor v-if="$props.id" :id="$props.id" :summary="CustomerSummary" />
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
|
|
@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n';
|
|||
import { useRoute } from 'vue-router';
|
||||
|
||||
import { QBtn, useQuasar } from 'quasar';
|
||||
|
||||
import WorkerDescriptorProxy from 'src/pages/Worker/Card/WorkerDescriptorProxy.vue';
|
||||
import { toDateTimeFormat } from 'src/filters/date';
|
||||
import VnTable from 'src/components/VnTable/VnTable.vue';
|
||||
|
@ -73,11 +74,12 @@ const tableRef = ref();
|
|||
<template>
|
||||
<VnTable
|
||||
ref="tableRef"
|
||||
data-key="CustomerSamples"
|
||||
data-key="ClientSamples"
|
||||
auto-load
|
||||
:user-filter="filter"
|
||||
:filter="filter"
|
||||
url="ClientSamples"
|
||||
:columns="columns"
|
||||
:pagination="{ rowsPerPage: 12 }"
|
||||
:disable-option="{ card: true }"
|
||||
:right-search="false"
|
||||
:rows="rows"
|
||||
|
|
|
@ -228,15 +228,11 @@ async function handleTicketConfig(data) {
|
|||
url="TicketConfigs"
|
||||
:filter="{ fields: ['lackAlertPrice'] }"
|
||||
@on-fetch="handleTicketConfig"
|
||||
></FetchData>
|
||||
<QInnerLoading
|
||||
:showing="isLoading"
|
||||
:label="t && t('globals.pleaseWait')"
|
||||
color="primary"
|
||||
auto-load
|
||||
/>
|
||||
|
||||
<VnTable
|
||||
v-if="!isLoading"
|
||||
v-if="ticketConfig"
|
||||
auto-load
|
||||
data-cy="proposalTable"
|
||||
ref="proposalTableRef"
|
||||
|
|
|
@ -8,14 +8,14 @@ import VnRow from 'src/components/ui/VnRow.vue';
|
|||
class="q-pa-md"
|
||||
:style="{ 'flex-direction': $q.screen.lt.lg ? 'column' : 'row', gap: '0px' }"
|
||||
>
|
||||
<div style="flex: 0.3" data-cy="clientsOnWebsite">
|
||||
<div style="flex: 0.3">
|
||||
<span
|
||||
class="q-ml-md text-body1"
|
||||
v-text="$t('salesMonitor.clientsOnWebsite')"
|
||||
/>
|
||||
<SalesClientTable />
|
||||
</div>
|
||||
<div style="flex: 0.7" data-cy="recentOrderActions">
|
||||
<div style="flex: 0.7">
|
||||
<span
|
||||
class="q-ml-md text-body1"
|
||||
v-text="$t('salesMonitor.recentOrderActions')"
|
||||
|
|
|
@ -9,7 +9,6 @@ import { toDateFormat, toDateTimeFormat } from 'src/filters/date.js';
|
|||
import { toCurrency } from 'src/filters';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
import axios from 'axios';
|
||||
import VnDateBadge from 'src/components/common/VnDateBadge.vue';
|
||||
import useOpenURL from 'src/composables/useOpenURL';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -166,7 +165,16 @@ const openTab = (id) => useOpenURL(`#/order/${id}/summary`);
|
|||
</div>
|
||||
</template>
|
||||
<template #column-dateSend="{ row }">
|
||||
<VnDateBadge :date="row.date_send" />
|
||||
<QTd>
|
||||
<QBadge
|
||||
:color="getBadgeColor(row.date_send)"
|
||||
text-color="black"
|
||||
class="q-pa-sm"
|
||||
style="font-size: 14px"
|
||||
>
|
||||
{{ toDateFormat(row.date_send) }}
|
||||
</QBadge>
|
||||
</QTd>
|
||||
</template>
|
||||
|
||||
<template #column-clientFk="{ row }">
|
||||
|
|
|
@ -9,7 +9,6 @@ import VnInput from 'src/components/common/VnInput.vue';
|
|||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||
import FetchData from 'src/components/FetchData.vue';
|
||||
import { dateRange } from 'src/filters';
|
||||
import VnCheckbox from 'src/components/common/VnCheckbox.vue';
|
||||
|
||||
defineProps({ dataKey: { type: String, required: true } });
|
||||
const { t, te } = useI18n();
|
||||
|
@ -210,7 +209,7 @@ const getLocale = (label) => {
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnCheckbox
|
||||
<QCheckbox
|
||||
:label="t('params.myTeam')"
|
||||
v-model="params.myTeam"
|
||||
toggle-indeterminate
|
||||
|
@ -219,7 +218,7 @@ const getLocale = (label) => {
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnCheckbox
|
||||
<QCheckbox
|
||||
:label="t('params.problems')"
|
||||
v-model="params.problems"
|
||||
toggle-indeterminate
|
||||
|
@ -228,7 +227,7 @@ const getLocale = (label) => {
|
|||
</QItem>
|
||||
<QItem>
|
||||
<QItemSection>
|
||||
<VnCheckbox
|
||||
<QCheckbox
|
||||
:label="t('params.pending')"
|
||||
v-model="params.pending"
|
||||
toggle-indeterminate
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
import DepartmentDescriptorProxy from 'src/pages/Worker/Department/Card/DepartmentDescriptorProxy.vue';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import TicketDescriptorProxy from 'src/pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
|
@ -167,11 +168,9 @@ const columns = computed(() => [
|
|||
component: 'select',
|
||||
name: 'provinceFk',
|
||||
attrs: {
|
||||
url: 'Provinces',
|
||||
fields: ['id', 'name'],
|
||||
sortBy: ['name ASC'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'name',
|
||||
options: provinceOpts.value,
|
||||
'option-value': 'id',
|
||||
'option-label': 'name',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
|
@ -184,11 +183,9 @@ const columns = computed(() => [
|
|||
component: 'select',
|
||||
name: 'stateFk',
|
||||
attrs: {
|
||||
sortBy: ['name ASC'],
|
||||
url: 'States',
|
||||
fields: ['id', 'name'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'name',
|
||||
options: stateOpts.value,
|
||||
'option-value': 'id',
|
||||
'option-label': 'name',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
|
@ -215,12 +212,9 @@ const columns = computed(() => [
|
|||
component: 'select',
|
||||
name: 'zoneFk',
|
||||
attrs: {
|
||||
url: 'Zones',
|
||||
fields: ['id', 'name'],
|
||||
sortBy: ['name ASC'],
|
||||
|
||||
optionValue: 'id',
|
||||
optionLabel: 'name',
|
||||
options: zoneOpts.value,
|
||||
'option-value': 'id',
|
||||
'option-label': 'name',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
|
@ -231,12 +225,11 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
url: 'PayMethods',
|
||||
attrs: {
|
||||
url: 'PayMethods',
|
||||
fields: ['id', 'name'],
|
||||
sortBy: ['id ASC'],
|
||||
optionLabel: 'name',
|
||||
options: PayMethodOpts.value,
|
||||
optionValue: 'id',
|
||||
optionLabel: 'name',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
|
@ -261,9 +254,7 @@ const columns = computed(() => [
|
|||
columnFilter: {
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Departments',
|
||||
fields: ['id', 'name'],
|
||||
sortBy: ['id ASC'],
|
||||
options: DepartmentOpts.value,
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
|
@ -274,12 +265,11 @@ const columns = computed(() => [
|
|||
align: 'left',
|
||||
columnFilter: {
|
||||
component: 'select',
|
||||
url: 'ItemPackingTypes',
|
||||
attrs: {
|
||||
url: 'ItemPackingTypes',
|
||||
fields: ['code'],
|
||||
sortBy: ['code ASC'],
|
||||
optionValue: 'code',
|
||||
optionCode: 'code',
|
||||
options: ItemPackingTypeOpts.value,
|
||||
'option-value': 'code',
|
||||
'option-label': 'code',
|
||||
dense: true,
|
||||
},
|
||||
},
|
||||
|
@ -334,6 +324,60 @@ const totalPriceColor = (ticket) => {
|
|||
const openTab = (id) => useOpenURL(`#/ticket/${id}/sale`);
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
url="Provinces"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
order: 'name ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (provinceOpts = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="States"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
order: 'name ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (stateOpts = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="Zones"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
order: 'name ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (zoneOpts = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="ItemPackingTypes"
|
||||
:filter="{
|
||||
fields: ['code'],
|
||||
order: 'code ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (ItemPackingTypeOpts = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="Departments"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
order: 'id ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (DepartmentOpts = data)"
|
||||
/>
|
||||
<FetchData
|
||||
url="PayMethods"
|
||||
:filter="{
|
||||
fields: ['id', 'name'],
|
||||
order: 'id ASC',
|
||||
}"
|
||||
auto-load
|
||||
@on-fetch="(data) => (PayMethodOpts = data)"
|
||||
/>
|
||||
<MonitorTicketSearchbar />
|
||||
<RightMenu>
|
||||
<template #right-panel>
|
||||
|
|
|
@ -6,13 +6,18 @@ import { useRoute } from 'vue-router';
|
|||
import { useSession } from 'src/composables/useSession';
|
||||
import { toDateHourMin } from 'filters/index';
|
||||
import { useStateStore } from 'src/stores/useStateStore';
|
||||
import { dashIfEmpty } from 'src/filters';
|
||||
|
||||
import AgencyDescriptorProxy from '../Agency/Card/AgencyDescriptorProxy.vue';
|
||||
import CustomerDescriptorProxy from 'src/pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
import RouteDescriptorProxy from '../Card/RouteDescriptorProxy.vue';
|
||||
import SupplierDescriptorProxy from 'src/pages/Supplier/Card/SupplierDescriptorProxy.vue';
|
||||
import TicketDescriptorProxy from 'pages/Ticket/Card/TicketDescriptorProxy.vue';
|
||||
import CustomerDescriptorProxy from 'pages/Customer/Card/CustomerDescriptorProxy.vue';
|
||||
|
||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||
import VnTable from 'components/VnTable/VnTable.vue';
|
||||
import VnSearchbar from 'src/components/ui/VnSearchbar.vue';
|
||||
import VnInput from 'src/components/common/VnInput.vue';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -30,39 +35,117 @@ const userParams = {
|
|||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
align: 'left',
|
||||
align: 'right',
|
||||
name: 'cmrFk',
|
||||
label: t('route.cmr.params.cmrFk'),
|
||||
label: t('cmr.params.cmrFk'),
|
||||
chip: {
|
||||
condition: () => true,
|
||||
},
|
||||
isId: true,
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'hasCmrDms',
|
||||
label: t('route.cmr.params.hasCmrDms'),
|
||||
component: 'checkbox',
|
||||
cardVisible: true,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('route.cmr.params.ticketFk'),
|
||||
align: 'right',
|
||||
label: t('cmr.params.ticketFk'),
|
||||
name: 'ticketFk',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('route.cmr.params.routeFk'),
|
||||
align: 'right',
|
||||
label: t('cmr.params.routeFk'),
|
||||
name: 'routeFk',
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('route.cmr.params.clientFk'),
|
||||
label: t('cmr.params.client'),
|
||||
name: 'clientFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Clients',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnFilter: {
|
||||
name: 'clientFk',
|
||||
attrs: {
|
||||
url: 'Clients',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: t('route.cmr.params.countryFk'),
|
||||
label: t('cmr.params.agency'),
|
||||
name: 'agencyModeFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Agencies',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnFilter: {
|
||||
name: 'agencyModeFk',
|
||||
attrs: {
|
||||
url: 'Agencies',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
format: ({ agencyName }) => agencyName,
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.supplier'),
|
||||
name: 'supplierFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'suppliers',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
columnFilter: {
|
||||
name: 'supplierFk',
|
||||
attrs: {
|
||||
url: 'suppliers',
|
||||
fields: ['id', 'name'],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.sender'),
|
||||
name: 'addressFromFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'Addresses',
|
||||
fields: ['id', 'nickname'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'nickname',
|
||||
},
|
||||
columnFilter: {
|
||||
name: 'addressFromFk',
|
||||
attrs: {
|
||||
url: 'Addresses',
|
||||
fields: ['id', 'nickname'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'nickname',
|
||||
},
|
||||
},
|
||||
format: ({ origin }) => origin,
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.destination'),
|
||||
name: 'addressToFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
url: 'addresses',
|
||||
fields: ['id', 'nickname'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'nickname',
|
||||
},
|
||||
columnFilter: {
|
||||
name: 'addressToFk',
|
||||
attrs: {
|
||||
url: 'addresses',
|
||||
fields: ['id', 'nickname'],
|
||||
optionValue: 'id',
|
||||
optionLabel: 'nickname',
|
||||
},
|
||||
},
|
||||
format: ({ destination }) => destination,
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.country'),
|
||||
name: 'countryFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
|
@ -79,16 +162,61 @@ const columns = computed(() => [
|
|||
format: ({ countryName }) => countryName,
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: t('route.cmr.params.shipped'),
|
||||
name: 'shipped',
|
||||
cardVisible: true,
|
||||
label: t('cmr.params.created'),
|
||||
name: 'created',
|
||||
component: 'date',
|
||||
format: ({ shipped }) => toDateHourMin(shipped),
|
||||
format: ({ created }) => dashIfEmpty(toDateHourMin(created)),
|
||||
},
|
||||
{
|
||||
align: 'right',
|
||||
label: t('route.cmr.params.warehouseFk'),
|
||||
label: t('cmr.params.shipped'),
|
||||
name: 'shipped',
|
||||
component: 'date',
|
||||
format: ({ shipped }) => dashIfEmpty(toDateHourMin(shipped)),
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.etd'),
|
||||
name: 'ead',
|
||||
component: 'date',
|
||||
format: ({ ead }) => dashIfEmpty(toDateHourMin(ead)),
|
||||
toolTip: t('cmr.params.etdTooltip'),
|
||||
},
|
||||
{
|
||||
label: t('globals.landed'),
|
||||
name: 'landed',
|
||||
component: 'date',
|
||||
format: ({ landed }) => dashIfEmpty(toDateHourMin(landed)),
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('cmr.params.packageList'),
|
||||
name: 'packagesList',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('cmr.params.observation'),
|
||||
name: 'observation',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('cmr.params.senderInstructions'),
|
||||
name: 'senderInstruccions',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('cmr.params.paymentInstructions'),
|
||||
name: 'paymentInstruccions',
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
label: t('cmr.params.vehiclePlate'),
|
||||
name: 'truckPlate',
|
||||
},
|
||||
{
|
||||
label: t('cmr.params.warehouse'),
|
||||
name: 'warehouseFk',
|
||||
component: 'select',
|
||||
attrs: {
|
||||
|
@ -96,7 +224,6 @@ const columns = computed(() => [
|
|||
fields: ['id', 'name'],
|
||||
},
|
||||
columnFilter: {
|
||||
inWhere: true,
|
||||
name: 'warehouseFk',
|
||||
attrs: {
|
||||
url: 'warehouses',
|
||||
|
@ -105,12 +232,23 @@ const columns = computed(() => [
|
|||
},
|
||||
format: ({ warehouseName }) => warehouseName,
|
||||
},
|
||||
{
|
||||
align: 'left',
|
||||
name: 'specialAgreements',
|
||||
label: t('cmr.params.specialAgreements'),
|
||||
columnFilter: false,
|
||||
},
|
||||
{
|
||||
name: 'hasCmrDms',
|
||||
label: t('cmr.params.hasCmrDms'),
|
||||
component: 'checkbox',
|
||||
},
|
||||
{
|
||||
align: 'center',
|
||||
name: 'tableActions',
|
||||
actions: [
|
||||
{
|
||||
title: t('route.cmr.params.viewCmr'),
|
||||
title: t('cmr.params.viewCmr'),
|
||||
icon: 'visibility',
|
||||
isPrimary: true,
|
||||
action: (row) => window.open(getCmrUrl(row?.cmrFk), '_blank'),
|
||||
|
@ -151,11 +289,7 @@ function downloadPdfs() {
|
|||
}
|
||||
</script>
|
||||
<template>
|
||||
<VnSearchbar
|
||||
:data-key
|
||||
:label="t('route.cmr.search')"
|
||||
:info="t('route.cmr.searchInfo')"
|
||||
/>
|
||||
<VnSearchbar :data-key :label="t('cmr.search')" :info="t('cmr.searchInfo')" />
|
||||
<VnSubToolbar>
|
||||
<template #st-actions>
|
||||
<QBtn
|
||||
|
@ -165,7 +299,7 @@ function downloadPdfs() {
|
|||
:disable="!selectedRows?.length"
|
||||
@click="downloadPdfs"
|
||||
>
|
||||
<QTooltip>{{ t('route.cmr.params.downloadCmrs') }}</QTooltip>
|
||||
<QTooltip>{{ t('cmr.params.downloadCmrs') }}</QTooltip>
|
||||
</QBtn>
|
||||
</template>
|
||||
</VnSubToolbar>
|
||||
|
@ -191,11 +325,72 @@ function downloadPdfs() {
|
|||
<TicketDescriptorProxy :id="row.ticketFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-routeFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.routeFk }}
|
||||
<RouteDescriptorProxy :id="row.routeFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-clientFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.clientFk }}
|
||||
{{ row.clientName }}
|
||||
<CustomerDescriptorProxy :id="row.clientFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-agencyModeFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.agencyName }}
|
||||
<AgencyDescriptorProxy :id="row.agencyModeFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-supplierFk="{ row }">
|
||||
<span class="link" @click.stop>
|
||||
{{ row.carrierName }}
|
||||
<SupplierDescriptorProxy :id="row.supplierFk" />
|
||||
</span>
|
||||
</template>
|
||||
<template #column-observation="{ row }">
|
||||
<VnInput
|
||||
v-if="row.observation"
|
||||
type="textarea"
|
||||
v-model="row.observation"
|
||||
readonly
|
||||
dense
|
||||
rows="2"
|
||||
style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap"
|
||||
/>
|
||||
</template>
|
||||
<template #column-packagesList="{ row }">
|
||||
<span>
|
||||
{{ row.packagesList }}
|
||||
<QTooltip v-if="row.packagesList" :label="row.packagesList">
|
||||
{{ row.packagesList }}
|
||||
</QTooltip>
|
||||
</span>
|
||||
</template>
|
||||
<template #column-senderInstruccions="{ row }">
|
||||
<span>
|
||||
{{ row.senderInstruccions }}
|
||||
<QTooltip v-if="row.packagesList" :label="row.packagesList">
|
||||
{{ row.senderInstruccions }}
|
||||
</QTooltip>
|
||||
</span>
|
||||
</template>
|
||||
<template #column-paymentInstruccions="{ row }">
|
||||
<span>
|
||||
{{ row.paymentInstruccions }}
|
||||
<QTooltip v-if="row.packagesList" :label="row.packagesList">
|
||||
{{ row.paymentInstruccions }}
|
||||
</QTooltip>
|
||||
</span>
|
||||
</template>
|
||||
<template #column-specialAgreements="{ row }">
|
||||
<span>
|
||||
{{ row.specialAgreements }}
|
||||
<QTooltip v-if="row.packagesList" :label="row.packagesList">
|
||||
{{ row.specialAgreements }}
|
||||
</QTooltip>
|
||||
</span>
|
||||
</template>
|
||||
</VnTable>
|
||||
</template>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
cmr:
|
||||
search: Search Cmr
|
||||
searchInfo: You can search Cmr by Id
|
||||
params:
|
||||
agency: Agency
|
||||
client: Client
|
||||
cmrFk: CMR id
|
||||
country: Country
|
||||
created: Created
|
||||
destination: Destination
|
||||
downloadCmrs: Download CMRs
|
||||
etd: ETD
|
||||
etdTooltip: Estimated Time Delivery
|
||||
hasCmrDms: Attached in gestdoc
|
||||
observation: Observation
|
||||
packageList: Package List
|
||||
paymentInstructions: Payment instructions
|
||||
routeFk: Route id
|
||||
results: results
|
||||
search: General search
|
||||
sender: Sender
|
||||
senderInstructions: Sender instructions
|
||||
shipped: Shipped
|
||||
specialAgreements: Special agreements
|
||||
supplier: Carrier
|
||||
ticketFk: Ticket id
|
||||
vehiclePlate: Vehicle plate
|
||||
viewCmr: View CMR
|
||||
warehouse: Warehouse
|
||||
'true': 'Yes'
|
||||
'false': 'No'
|
|
@ -0,0 +1,31 @@
|
|||
cmr:
|
||||
search: Buscar Cmr
|
||||
searchInfo: Puedes buscar cmr por id
|
||||
params:
|
||||
agency: Agencia
|
||||
client: Cliente
|
||||
cmrFk: Id cmr
|
||||
country: País
|
||||
created: Creado
|
||||
destination: Destinatario
|
||||
downloadCmrs: Descargar CMRs
|
||||
etd: ETD
|
||||
etdTooltip: Fecha estimada de entrega
|
||||
hasCmrDms: Adjunto en gestdoc
|
||||
observation: Observaciones
|
||||
packageList: Listado embalajes
|
||||
paymentInstructions: Instrucciones de pago
|
||||
routeFk: Id ruta
|
||||
results: Resultados
|
||||
search: Busqueda general
|
||||
sender: Remitente
|
||||
senderInstructions: Instrucciones de envío
|
||||
shipped: F. envío
|
||||
specialAgreements: Acuerdos especiales
|
||||
supplier: Transportista
|
||||
ticketFk: Id ticket
|
||||
vehiclePlate: Matrícula
|
||||
viewCmr: Ver CMR
|
||||
warehouse: Almacén
|
||||
'true': 'Si'
|
||||
'false': 'No'
|
|
@ -51,6 +51,11 @@ route:
|
|||
agencyModeName: Agency route
|
||||
isOwn: Own
|
||||
isAnyVolumeAllowed: Any volume allowed
|
||||
created: Created
|
||||
addressFromFk: Sender
|
||||
addressToFk: Destination
|
||||
landed: Landed
|
||||
ead: EAD
|
||||
Worker: Worker
|
||||
Agency: Agency
|
||||
Vehicle: Vehicle
|
||||
|
@ -70,21 +75,3 @@ route:
|
|||
searchInfo: You can search by route reference
|
||||
dated: Dated
|
||||
preview: Preview
|
||||
cmr:
|
||||
search: Search Cmr
|
||||
searchInfo: You can search Cmr by Id
|
||||
params:
|
||||
results: results
|
||||
cmrFk: CMR id
|
||||
hasCmrDms: Attached in gestdoc
|
||||
'true': 'Yes'
|
||||
'false': 'No'
|
||||
ticketFk: Ticketd id
|
||||
routeFk: Route id
|
||||
countryFk: Country
|
||||
clientFk: Client id
|
||||
warehouseFk: Warehouse
|
||||
shipped: Preparation date
|
||||
viewCmr: View CMR
|
||||
downloadCmrs: Download CMRs
|
||||
search: General search
|
||||
|
|
|
@ -47,11 +47,16 @@ route:
|
|||
routeFk: Id ruta
|
||||
clientFk: Id cliente
|
||||
countryFk: Pais
|
||||
shipped: Fecha preparación
|
||||
shipped: F. envío
|
||||
agencyModeName: Agencia Ruta
|
||||
agencyAgreement: Agencia Acuerdo
|
||||
isOwn: Propio
|
||||
isAnyVolumeAllowed: Cualquier volumen
|
||||
created: Creado
|
||||
addressFromFk: Remitente
|
||||
addressToFk: Destinatario
|
||||
landed: F. entrega
|
||||
ead: ETD
|
||||
Worker: Trabajador
|
||||
Agency: Agencia
|
||||
Vehicle: Vehículo
|
||||
|
|
|
@ -10,7 +10,7 @@ const $props = defineProps({
|
|||
});
|
||||
</script>
|
||||
<template>
|
||||
<QPopupProxy data-cy="TicketDescriptor">
|
||||
<QPopupProxy>
|
||||
<TicketDescriptor v-if="$props.id" :id="$props.id" :summary="TicketSummary" />
|
||||
</QPopupProxy>
|
||||
</template>
|
||||
|
|
|
@ -42,11 +42,7 @@ const groupedStates = ref([]);
|
|||
auto-load
|
||||
/>
|
||||
<FetchData url="Warehouses" @on-fetch="(data) => (warehouses = data)" auto-load />
|
||||
<VnFilterPanel
|
||||
:data-key="props.dataKey"
|
||||
:search-button="true"
|
||||
:unremovableParams="['from', 'to']"
|
||||
>
|
||||
<VnFilterPanel :data-key="props.dataKey" :search-button="true">
|
||||
<template #tags="{ tag, formatFn }">
|
||||
<div class="q-gutter-x-xs">
|
||||
<strong>{{ t(`params.${tag.label}`) }}: </strong>
|
||||
|
|
|
@ -11,7 +11,7 @@ const $props = defineProps({
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<QPopupProxy data-cy="DepartmentDescriptor">
|
||||
<QPopupProxy>
|
||||
<DepartmentDescriptor
|
||||
v-if="$props.id"
|
||||
:id="$props.id"
|
||||
|
|
|
@ -68,7 +68,7 @@ const arrayData = useArrayData('ZoneEvents');
|
|||
const exclusionGeoCreate = async () => {
|
||||
const params = {
|
||||
zoneFk: parseInt(route.params.id),
|
||||
date: dated.value,
|
||||
date: dated,
|
||||
geoIds: tickedNodes.value,
|
||||
};
|
||||
await axios.post('Zones/exclusionGeo', params);
|
||||
|
@ -101,17 +101,9 @@ const exclusionCreate = async () => {
|
|||
const existsEvent = data.events.find(
|
||||
(event) => toDateFormat(event.dated) === toDateFormat(dated.value),
|
||||
);
|
||||
const existsGeoEvent = data.geoExclusions.find(
|
||||
(event) => toDateFormat(event.dated) === toDateFormat(dated.value),
|
||||
);
|
||||
if (existsEvent) {
|
||||
await axios.delete(`Zones/${existsEvent?.zoneFk}/events/${existsEvent?.id}`);
|
||||
}
|
||||
if (existsGeoEvent) {
|
||||
await axios.delete(
|
||||
`Zones/${existsGeoEvent?.zoneFk}/exclusions/${existsGeoEvent?.zoneExclusionFk}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (isNew.value || props.event?.type) await axios.post(`${url}`, [body]);
|
||||
else await axios.put(`${url}/${props.event?.id}`, body);
|
||||
|
@ -130,21 +122,8 @@ const onSubmit = async () => {
|
|||
|
||||
const deleteEvent = async () => {
|
||||
if (!props.event) return;
|
||||
if (!props.event.created) {
|
||||
const filter = {
|
||||
where: {
|
||||
dated: dated.value,
|
||||
},
|
||||
};
|
||||
const params = { filter: JSON.stringify(filter) };
|
||||
const { data: res } = await axios.get(`Zones/${route.params.id}/exclusions`, {
|
||||
params,
|
||||
});
|
||||
if (res) await axios.delete(`Zones/${route.params.id}/exclusions/${res[0].id}`);
|
||||
} else {
|
||||
const exclusionId = props.event?.zoneExclusionFk || props.event?.id;
|
||||
await axios.delete(`Zones/${route.params.id}/exclusions/${exclusionId}`);
|
||||
}
|
||||
const exclusionId = props.event?.zoneExclusionFk || props.event?.id;
|
||||
await axios.delete(`Zones/${route.params.id}/exclusions/${exclusionId}`);
|
||||
await refetchEvents();
|
||||
};
|
||||
|
||||
|
@ -156,7 +135,7 @@ const refetchEvents = async () => {
|
|||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (props.event && props.event.dated) {
|
||||
if (props.event) {
|
||||
dated.value = props.event?.dated;
|
||||
excludeType.value =
|
||||
props.eventType === 'geoExclusion' ? 'specificLocations' : 'all';
|
||||
|
|
|
@ -56,7 +56,6 @@ const isNew = computed(() => props.isNewMode);
|
|||
const eventInclusionFormData = ref({ wdays: [] });
|
||||
const dated = ref(props.date || Date.vnNew());
|
||||
const _inclusionType = ref('indefinitely');
|
||||
const hasDeletedEvent = ref(false);
|
||||
const inclusionType = computed({
|
||||
get: () => _inclusionType.value,
|
||||
set: (val) => {
|
||||
|
@ -85,7 +84,7 @@ const createEvent = async () => {
|
|||
}
|
||||
|
||||
const zoneIds = props.zoneIds?.length ? props.zoneIds : [route.params.id];
|
||||
for (const zoneId of zoneIds) {
|
||||
for (const id of zoneIds) {
|
||||
let today = eventInclusionFormData.value.dated
|
||||
? moment(eventInclusionFormData.value.dated)
|
||||
: moment(dated.value);
|
||||
|
@ -93,7 +92,7 @@ const createEvent = async () => {
|
|||
|
||||
const { data } = await axios.get(`Zones/getEventsFiltered`, {
|
||||
params: {
|
||||
zoneFk: zoneId,
|
||||
zoneFk: id,
|
||||
started: today,
|
||||
ended: lastDay,
|
||||
},
|
||||
|
@ -107,19 +106,15 @@ const createEvent = async () => {
|
|||
await axios.delete(
|
||||
`Zones/${existsExclusion?.zoneFk}/exclusions/${existsExclusion?.id}`,
|
||||
);
|
||||
await refetchEvents();
|
||||
hasDeletedEvent.value = true;
|
||||
}
|
||||
|
||||
delete eventInclusionFormData.value.id;
|
||||
if (isNew.value || hasDeletedEvent.value)
|
||||
await axios.post(`Zones/${zoneId}/events`, eventInclusionFormData.value);
|
||||
if (isNew.value)
|
||||
await axios.post(`Zones/${id}/events`, eventInclusionFormData.value);
|
||||
else
|
||||
await axios.put(
|
||||
`Zones/${zoneId}/events/${props.event?.id}`,
|
||||
`Zones/${id}/events/${props.event?.id}`,
|
||||
eventInclusionFormData.value,
|
||||
);
|
||||
hasDeletedEvent.value = false;
|
||||
}
|
||||
quasar.notify({
|
||||
message: t('globals.dataSaved'),
|
||||
|
|
|
@ -53,7 +53,7 @@ describe('invoiceInCorrective', () => {
|
|||
it('should show/hide the section if it is a corrective invoice', () => {
|
||||
cy.visit('/#/invoice-in/1/summary');
|
||||
cy.get('[data-cy="InvoiceInCorrective-menu-item"]').should('not.exist');
|
||||
cy.clickDescriptorAction(4);
|
||||
cy.clicDescriptorAction(4);
|
||||
cy.get('[data-cy="InvoiceInCorrective-menu-item"]').should('exist');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -64,17 +64,17 @@ describe('InvoiceInDescriptor', () => {
|
|||
beforeEach(() => cy.visit('/#/invoice-in/1/summary'));
|
||||
|
||||
it('should navigate to the supplier summary', () => {
|
||||
cy.clickDescriptorAction(1);
|
||||
cy.clicDescriptorAction(1);
|
||||
cy.url().should('to.match', /supplier\/\d+\/summary/);
|
||||
});
|
||||
|
||||
it('should navigate to the entry summary', () => {
|
||||
cy.clickDescriptorAction(2);
|
||||
cy.clicDescriptorAction(2);
|
||||
cy.url().should('to.match', /entry\/\d+\/summary/);
|
||||
});
|
||||
|
||||
it('should navigate to the invoiceIn list', () => {
|
||||
cy.clickDescriptorAction(3);
|
||||
cy.clicDescriptorAction(3);
|
||||
cy.url().should('to.match', /invoice-in\/list\?table=\{.*supplierFk.+\}/);
|
||||
});
|
||||
});
|
||||
|
@ -93,7 +93,7 @@ describe('InvoiceInDescriptor', () => {
|
|||
createCorrective();
|
||||
redirect(originalId);
|
||||
|
||||
cy.clickDescriptorAction(4);
|
||||
cy.clicDescriptorAction(4);
|
||||
cy.validateVnTableRows({
|
||||
cols: [
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ function createCorrective() {
|
|||
function redirect(subtitle) {
|
||||
const regex = new RegExp(`InvoiceIns/${subtitle}\\?filter=.*`);
|
||||
cy.intercept('GET', regex).as('getOriginal');
|
||||
cy.clickDescriptorAction(4);
|
||||
cy.clicDescriptorAction(4);
|
||||
cy.wait('@getOriginal');
|
||||
cy.validateDescriptor({ subtitle });
|
||||
}
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
/// <reference types="cypress" />
|
||||
|
||||
describe('Monitor Clients actions', () => {
|
||||
beforeEach(() => {
|
||||
cy.login('salesPerson');
|
||||
cy.intercept('GET', '**/Departments**').as('departments');
|
||||
cy.visit('/#/monitor/clients-actions');
|
||||
cy.waitForElement('.q-page');
|
||||
cy.wait('@departments').then((xhr) => {
|
||||
cy.window().then((win) => {
|
||||
const user = JSON.parse(win.sessionStorage.getItem('user'));
|
||||
const { where } = JSON.parse(xhr.request.query.filter);
|
||||
expect(where.id.like).to.include(user.departmentFk.toString());
|
||||
});
|
||||
});
|
||||
cy.intercept('GET', '**/SalesMonitors/ordersFilter*').as('ordersFilter');
|
||||
cy.intercept('GET', '**/SalesMonitors/clientsFilter*').as('clientsFilter');
|
||||
});
|
||||
it('Should filter by field', () => {
|
||||
cy.get('.q-page').should('be.visible');
|
||||
cy.dataCy('clientsOnWebsite')
|
||||
.find('[data-cy="column-filter-departmentFk"] [data-cy="_select"]')
|
||||
.click();
|
||||
cy.dataCy('recentOrderActions').within(() => {
|
||||
cy.getRowCol('clientFk').find('span').should('have.class', 'link').click();
|
||||
});
|
||||
cy.checkVisibleDescriptor('Customer');
|
||||
|
||||
cy.dataCy('recentOrderActions').within(() => {
|
||||
cy.getRowCol('departmentFk', 2)
|
||||
.find('span')
|
||||
.should('have.class', 'link')
|
||||
.click();
|
||||
});
|
||||
|
||||
cy.checkVisibleDescriptor('Department');
|
||||
|
||||
cy.dataCy('clientsOnWebsite')
|
||||
.find('.q-ml-md')
|
||||
.should('have.text', 'Clients on website');
|
||||
cy.dataCy('recentOrderActions')
|
||||
.find('.q-ml-md')
|
||||
.should('have.text', 'Recent order actions');
|
||||
cy.dataCy('From_inputDate').should('have.value', '01/01/2001');
|
||||
cy.dataCy('To_inputDate').should('have.value', '01/01/2001');
|
||||
});
|
||||
});
|
|
@ -1,69 +0,0 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('Monitor Tickets Table', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
cy.login('salesPerson');
|
||||
cy.visit('/#/monitor/tickets');
|
||||
cy.waitForElement('.q-page');
|
||||
cy.intercept('GET', '**/SalesMonitors/salesFilter*').as('filterRequest');
|
||||
cy.openRightMenu();
|
||||
});
|
||||
it('should open new tab when ctrl+click on client link', () => {
|
||||
cy.intercept('GET', '**/SalesMonitors/salesFilter*').as('filterRequest');
|
||||
|
||||
cy.window().then((win) => {
|
||||
cy.stub(win, 'open').as('windowOpen');
|
||||
});
|
||||
|
||||
cy.getRowCol('provinceFk').click({ ctrlKey: true });
|
||||
cy.get('@windowOpen').should('be.calledWithMatch', /\/ticket\/\d+\/sale/);
|
||||
});
|
||||
it('should open the descriptorProxy and SummaryPopup', () => {
|
||||
cy.getRowCol('totalProblems');
|
||||
|
||||
cy.getRowCol('id').find('span').should('have.class', 'link').click();
|
||||
cy.checkVisibleDescriptor('Ticket');
|
||||
|
||||
cy.getRowCol('zoneFk').find('span').should('have.class', 'link').click();
|
||||
cy.checkVisibleDescriptor('Zone');
|
||||
|
||||
cy.getRowCol('clientFk').find('span').should('have.class', 'link').click();
|
||||
cy.checkVisibleDescriptor('Customer');
|
||||
|
||||
cy.getRowCol('departmentFk').find('span').should('have.class', 'link').click();
|
||||
cy.checkVisibleDescriptor('Department');
|
||||
|
||||
cy.getRowCol('shippedDate').find('.q-badge');
|
||||
cy.tableActions().click({ ctrlKey: true });
|
||||
cy.tableActions(1).click();
|
||||
cy.get('.summaryHeader').should('exist');
|
||||
});
|
||||
|
||||
it('clear scopeDays', () => {
|
||||
cy.get('[data-cy="Days onward_input"]').clear().type('2');
|
||||
cy.searchInFilterPanel();
|
||||
cy.get('.q-chip__content > span').should('have.text', '"2"');
|
||||
cy.waitSpinner();
|
||||
checkScopeDays(2);
|
||||
cy.get('[data-cy="Days onward_input"]').clear();
|
||||
cy.searchInFilterPanel();
|
||||
cy.get('.q-chip__content > span').should('have.text', '"0"');
|
||||
cy.waitSpinner();
|
||||
checkScopeDays(0);
|
||||
});
|
||||
});
|
||||
|
||||
function checkScopeDays(scopeDays) {
|
||||
cy.url().then((url) => {
|
||||
const urlParams = new URLSearchParams(url.split('?')[1]);
|
||||
const saleMonitorTickets = JSON.parse(
|
||||
decodeURIComponent(urlParams.get('saleMonitorTickets')),
|
||||
);
|
||||
expect(saleMonitorTickets.scopeDays).to.equal(scopeDays);
|
||||
const fromDate = new Date(saleMonitorTickets.from);
|
||||
const toDate = new Date(saleMonitorTickets.to);
|
||||
expect(toDate.getDate() - fromDate.getDate()).to.equal(
|
||||
saleMonitorTickets.scopeDays,
|
||||
);
|
||||
});
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
describe('OrderCatalog', () => {
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
cy.viewport(1920, 1080);
|
||||
cy.viewport(1920, 720);
|
||||
cy.visit('/#/order/8/catalog');
|
||||
});
|
||||
|
||||
|
|
|
@ -11,15 +11,14 @@ describe('OrderList', () => {
|
|||
|
||||
it('create order', () => {
|
||||
cy.get('[data-cy="vnTableCreateBtn"]').click();
|
||||
cy.selectOption('[data-cy="Client_select"]', 1101);
|
||||
cy.dataCy('landedDate').find('input').type('06/01/2001');
|
||||
cy.get('[data-cy="Address_select"]').click();
|
||||
cy.selectOption(clientCreateSelect, 1101);
|
||||
cy.get(addressCreateSelect).click();
|
||||
cy.get(
|
||||
'.q-menu > div> div.q-item:nth-child(1) >div.q-item__section--avatar > i',
|
||||
).should('have.text', 'star');
|
||||
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
|
||||
cy.get('.q-card [data-cy="Agency_select"]').click();
|
||||
cy.get('.q-menu > div> .q-item:nth-child(1)').click();
|
||||
cy.dataCy('landedDate').find('input').type('06/01/2001');
|
||||
cy.selectOption(agencyCreateSelect, 1);
|
||||
|
||||
cy.intercept('GET', /\/api\/Orders\/\d/).as('orderSale');
|
||||
cy.get('[data-cy="FormModelPopup_save"] > .q-btn__content > .block').click();
|
||||
cy.wait('@orderSale');
|
||||
|
|
|
@ -5,6 +5,9 @@ describe('Cmr list', () => {
|
|||
const selectors = {
|
||||
ticket: getLinkSelector('ticketFk'),
|
||||
client: getLinkSelector('clientFk'),
|
||||
route: getLinkSelector('routeFk'),
|
||||
agency: getLinkSelector('agencyModeFk'),
|
||||
carrier: getLinkSelector('supplierFk'),
|
||||
lastRowSelectCheckBox:
|
||||
'.q-virtual-scroll__content > tr:last-child > :nth-child(1) > .q-checkbox',
|
||||
downloadBtn: '#subToolbar > .q-btn',
|
||||
|
@ -21,6 +24,10 @@ describe('Cmr list', () => {
|
|||
const data = {
|
||||
ticket: '1',
|
||||
client: 'Bruce Wayne',
|
||||
route: 'first route',
|
||||
routeId: '1',
|
||||
agency: 'inhouse pickup',
|
||||
carrier: 'PLANTS SL',
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -68,6 +75,26 @@ describe('Cmr list', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('Route pop-ups', () => {
|
||||
it('Should redirect to the route summary from the route descriptor pop-up', () => {
|
||||
cy.get(selectors.route).should('be.visible').click();
|
||||
cy.containContent(selectors.descriptorId, data.routeId);
|
||||
cy.get(selectors.descriptorGoToSummaryBtn).should('be.visible').click();
|
||||
cy.url().should('include', '/route/1/summary');
|
||||
cy.containContent(selectors.summaryTitle, data.route);
|
||||
});
|
||||
|
||||
it('Should redirect to the route summary from summary pop-up from the route descriptor pop-up', () => {
|
||||
cy.get(selectors.route).should('be.visible').click();
|
||||
cy.containContent(selectors.descriptorId, data.routeId);
|
||||
cy.get(selectors.descriptorOpenSummaryBtn).should('be.visible').click();
|
||||
cy.containContent(selectors.summaryTitle, data.route);
|
||||
cy.get(selectors.summaryGoToSummaryBtn).should('be.visible').click();
|
||||
cy.url().should('include', '/route/1/summary');
|
||||
cy.containContent(selectors.summaryTitle, data.route);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Client pop-ups', () => {
|
||||
it('Should redirect to the client summary from the client descriptor pop-up', () => {
|
||||
cy.get(selectors.client).should('be.visible').click();
|
||||
|
@ -87,4 +114,44 @@ describe('Cmr list', () => {
|
|||
cy.containContent(selectors.summaryTitle, data.client);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Agency pop-ups', () => {
|
||||
it('Should redirect to the agency summary from the agency descriptor pop-up', () => {
|
||||
cy.get(selectors.agency).should('be.visible').click();
|
||||
cy.containContent(selectors.descriptorTitle, data.agency);
|
||||
cy.get(selectors.descriptorGoToSummaryBtn).should('be.visible').click();
|
||||
cy.url().should('include', '/agency/1/summary');
|
||||
cy.containContent(selectors.summaryTitle, data.agency);
|
||||
});
|
||||
|
||||
it('Should redirect to the agency summary from summary pop-up from the agency descriptor pop-up', () => {
|
||||
cy.get(selectors.agency).should('be.visible').click();
|
||||
cy.containContent(selectors.descriptorTitle, data.agency);
|
||||
cy.get(selectors.descriptorOpenSummaryBtn).should('be.visible').click();
|
||||
cy.containContent(selectors.summaryTitle, data.agency);
|
||||
cy.get(selectors.summaryGoToSummaryBtn).should('be.visible').click();
|
||||
cy.url().should('include', '/agency/1/summary');
|
||||
cy.containContent(selectors.summaryTitle, data.agency);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Carrier pop-ups', () => {
|
||||
it('Should redirect to the supplier summary from the supplier descriptor pop-up', () => {
|
||||
cy.get(selectors.carrier).should('be.visible').click();
|
||||
cy.containContent(selectors.descriptorTitle, data.carrier);
|
||||
cy.get(selectors.descriptorGoToSummaryBtn).should('be.visible').click();
|
||||
cy.url().should('include', '/supplier/1/summary');
|
||||
cy.containContent(selectors.summaryTitle, data.carrier);
|
||||
});
|
||||
|
||||
it('Should redirect to the supplier summary from summary pop-up from the supplier descriptor pop-up', () => {
|
||||
cy.get(selectors.carrier).should('be.visible').click();
|
||||
cy.containContent(selectors.descriptorTitle, data.carrier);
|
||||
cy.get(selectors.descriptorOpenSummaryBtn).should('be.visible').click();
|
||||
cy.containContent(selectors.summaryTitle, data.carrier);
|
||||
cy.get(selectors.summaryGoToSummaryBtn).should('be.visible').click();
|
||||
cy.url().should('include', '/supplier/1/summary');
|
||||
cy.containContent(selectors.summaryTitle, data.carrier);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,7 +6,9 @@ describe('ParkingBasicData', () => {
|
|||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/shelving/parking/1/basic-data`);
|
||||
cy.get('[data-cy="navBar-spinner"]', { timeout: 10000 }).should('not.be.visible');
|
||||
cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should(
|
||||
'not.be.visible',
|
||||
);
|
||||
});
|
||||
|
||||
it('should give an error if the code aldready exists', () => {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
const firstRow = 'tbody > :nth-child(1)';
|
||||
|
||||
describe('TicketSale', () => {
|
||||
describe.skip('Ticket #23', () => {
|
||||
describe.skip('#23', () => {
|
||||
beforeEach(() => {
|
||||
cy.login('claimManager');
|
||||
cy.viewport(1920, 1080);
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
Cypress.Commands.add('checkVisibleDescriptor', (alias) =>
|
||||
cy
|
||||
.get(`[data-cy="${alias}Descriptor"] [data-cy="vnDescriptor"] > .header`)
|
||||
.should('exist')
|
||||
.and('be.visible'),
|
||||
);
|
|
@ -2,7 +2,9 @@ Cypress.Commands.add('getRow', (index = 1) =>
|
|||
cy.get(`.vnTable .q-virtual-scroll__content tr:nth-child(${index})`),
|
||||
);
|
||||
Cypress.Commands.add('getRowCol', (field, index = 1) =>
|
||||
cy.getRow(index).find(`[data-col-field="${field}"]`),
|
||||
cy.get(
|
||||
`.vnTable .q-virtual-scroll__content > :nth-child(${index}) > [data-col-field="${field}"]`,
|
||||
),
|
||||
);
|
||||
|
||||
Cypress.Commands.add('vnTableCreateBtn', () =>
|
||||
|
@ -12,9 +14,3 @@ Cypress.Commands.add('vnTableCreateBtn', () =>
|
|||
Cypress.Commands.add('waitTableScrollLoad', () =>
|
||||
cy.waitForElement('[data-q-vs-anchor]'),
|
||||
);
|
||||
|
||||
Cypress.Commands.add('tableActions', (n = 0, child = 1) =>
|
||||
cy.get(
|
||||
`:nth-child(${child}) > .q-table--col-auto-width > [data-cy="tableAction-${n}"] > .q-btn__content > .q-icon`,
|
||||
),
|
||||
);
|
||||
|
|
|
@ -10,7 +10,7 @@ describe('WagonTypeEdit', () => {
|
|||
cy.get('.q-card');
|
||||
cy.get('input').first().type(' changed');
|
||||
cy.get('div.q-checkbox__bg').first().click();
|
||||
cy.dataCy('saveDefaultBtn').click();
|
||||
cy.get('.q-btn--standard').click();
|
||||
});
|
||||
|
||||
it('should delete a tray', () => {
|
||||
|
|
|
@ -78,21 +78,20 @@ Cypress.Commands.add('waitForElement', (element) => {
|
|||
Cypress.Commands.add('getValue', (selector) => {
|
||||
cy.get(selector).then(($el) => {
|
||||
if ($el.find('.q-checkbox__inner').length > 0) {
|
||||
return cy.get(`${selector}.q-checkbox__inner`);
|
||||
return cy.get(selector + '.q-checkbox__inner');
|
||||
}
|
||||
// Si es un QSelect
|
||||
if ($el.find('.q-select__dropdown-icon').length) {
|
||||
return cy
|
||||
.get(
|
||||
`${
|
||||
selector
|
||||
}> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input`,
|
||||
selector +
|
||||
'> .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > input',
|
||||
)
|
||||
.invoke('val');
|
||||
}
|
||||
// Si es un QSelect
|
||||
if ($el.find('span').length) {
|
||||
return cy.get(`${selector} span`).then(($span) => {
|
||||
return cy.get(selector + ' span').then(($span) => {
|
||||
return $span[0].innerText;
|
||||
});
|
||||
}
|
||||
|
@ -101,15 +100,10 @@ Cypress.Commands.add('getValue', (selector) => {
|
|||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('waitSpinner', (_spinner = 'navBar') => {
|
||||
const spinners = {
|
||||
navBar: '[data-cy="navBar-spinner"]',
|
||||
filterPanel: '[data-cy="filterPanel-spinner"]',
|
||||
};
|
||||
const spinner = spinners[_spinner];
|
||||
Cypress.Commands.add('waitSpinner', () => {
|
||||
cy.get('body').then(($body) => {
|
||||
if ($body.find(spinner).length) {
|
||||
cy.get(spinner).should('not.be.visible');
|
||||
if ($body.find('[data-cy="loading-spinner"]').length) {
|
||||
cy.get('[data-cy="loading-spinner"]').should('not.be.visible');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -148,7 +142,7 @@ function selectItem(selector, option, ariaControl, hasWrite = true) {
|
|||
function getItems(ariaControl, startTime = Cypress._.now(), timeout = 2500) {
|
||||
// Se intenta obtener la lista de opciones del desplegable de manera recursiva
|
||||
return cy
|
||||
.get(`#${ariaControl}`, { timeout })
|
||||
.get('#' + ariaControl, { timeout })
|
||||
.should('exist')
|
||||
.find('.q-item')
|
||||
.should('exist')
|
||||
|
@ -358,21 +352,11 @@ Cypress.Commands.add('openListSummary', (row) => {
|
|||
cy.get('.card-list-body .actions .q-btn:nth-child(2)').eq(row).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('openRightMenu', (element = 'toggle-right-drawer') => {
|
||||
if (element) cy.waitForElement(`[data-cy="${element}"]`);
|
||||
cy.dataCy(element).click();
|
||||
Cypress.Commands.add('openRightMenu', (element) => {
|
||||
if (element) cy.waitForElement(element);
|
||||
cy.get('[data-cy="toggle-right-drawer"]').click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('cleanFilterPanel', (element = 'clearFilters') => {
|
||||
cy.get('#filterPanelForm').scrollIntoView();
|
||||
if (element) cy.waitForElement(`[data-cy="${element}"]`);
|
||||
cy.dataCy(element).click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('searchInFilterPanel', (element = 'vnFilterPanel_search') => {
|
||||
if (element) cy.waitForElement(`[data-cy="${element}"]`);
|
||||
cy.dataCy(element).click();
|
||||
});
|
||||
Cypress.Commands.add('openLeftMenu', (element) => {
|
||||
if (element) cy.waitForElement(element);
|
||||
cy.get('.q-toolbar > .q-btn--round.q-btn--dense > .q-btn__content > .q-icon').click();
|
||||
|
@ -470,9 +454,9 @@ Cypress.Commands.add('clickButtonWith', (type, value) => {
|
|||
|
||||
Cypress.Commands.add('clickButtonWithIcon', (iconClass) => {
|
||||
cy.waitForElement('[data-cy="descriptor_actions"]');
|
||||
cy.waitSpinner();
|
||||
cy.get('[data-cy="loading-spinner"]', { timeout: 10000 }).should('not.be.visible');
|
||||
cy.get('.q-btn')
|
||||
.filter((index, el) => Cypress.$(el).find(`.q-icon.${iconClass}`).length > 0)
|
||||
.filter((index, el) => Cypress.$(el).find('.q-icon.' + iconClass).length > 0)
|
||||
.then(($btn) => {
|
||||
cy.wrap($btn).click();
|
||||
});
|
||||
|
@ -607,7 +591,7 @@ Cypress.Commands.add('validatePdfDownload', (match, trigger) => {
|
|||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('clickDescriptorAction', (index = 1) => {
|
||||
Cypress.Commands.add('clicDescriptorAction', (index = 1) => {
|
||||
cy.get(`[data-cy="descriptor_actions"] .q-btn:nth-of-type(${index})`).click();
|
||||
});
|
||||
|
||||
|
|
|
@ -68,7 +68,6 @@ const waitForApiReady = (url, maxRetries = 20, delay = 1000) => {
|
|||
};
|
||||
|
||||
before(() => {
|
||||
cy.viewport(1920, 1080);
|
||||
waitForApiReady('/api/Applications/status');
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue