feat: refs #8296 sistema de warnings #1332

Open
carlosap wants to merge 2 commits from 8296-sistema-de-warnings into dev
8 changed files with 114 additions and 3 deletions

View File

@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}

View File

@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>

View File

@ -0,0 +1,24 @@
// ***********************************************************
// This example support/component.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'
import { mount } from 'cypress/vue'
Cypress.Commands.add('mount', mount)
// Example use:
// cy.mount(MyComponent)

View File

@ -0,0 +1,12 @@
<script setup>
defineProps({ row: { type: Object, required: true } });
</script>
<template>
<template v-for="(warning, key) of JSON.parse(row.warnings)" :key="key">
<QIcon :name="warning.icon" size="xs">
<QTooltip>
{{ warning.title }}
</QTooltip>
</QIcon>
</template>
</template>

View File

@ -15,6 +15,7 @@ import RightMenu from 'src/components/common/RightMenu.vue';
import MonitorTicketSearchbar from './MonitorTicketSearchbar.vue'; import MonitorTicketSearchbar from './MonitorTicketSearchbar.vue';
import MonitorTicketFilter from './MonitorTicketFilter.vue'; import MonitorTicketFilter from './MonitorTicketFilter.vue';
import TicketProblems from 'src/components/TicketProblems.vue'; import TicketProblems from 'src/components/TicketProblems.vue';
import TicketWarnings from 'src/components/TicketWarnings.vue';
import VnDateBadge from 'src/components/common/VnDateBadge.vue'; import VnDateBadge from 'src/components/common/VnDateBadge.vue';
import { useStateStore } from 'src/stores/useStateStore'; import { useStateStore } from 'src/stores/useStateStore';
import useOpenURL from 'src/composables/useOpenURL'; import useOpenURL from 'src/composables/useOpenURL';
@ -71,6 +72,10 @@ function exprBuilder(param, value) {
} }
const columns = computed(() => [ const columns = computed(() => [
{
name: 'warnings',
align: 'left',
},
{ {
label: t('salesTicketsTable.problems'), label: t('salesTicketsTable.problems'),
name: 'totalProblems', name: 'totalProblems',
@ -421,6 +426,9 @@ const openTab = (id) => useOpenURL(`#/ticket/${id}/sale`);
<QTooltip>{{ $t('refreshInfo') }}</QTooltip> <QTooltip>{{ $t('refreshInfo') }}</QTooltip>
</QCheckbox> </QCheckbox>
</template> </template>
<template #column-warnings="{ row }">
<TicketWarnings :row="row" />
</template>
<template #column-totalProblems="{ row }"> <template #column-totalProblems="{ row }">
<TicketProblems :row="row" /> <TicketProblems :row="row" />
</template> </template>

View File

@ -322,6 +322,18 @@ onMounted(async () => {
</template> </template>
<template #body="props"> <template #body="props">
<QTr :props="props"> <QTr :props="props">
<QTd>
<template
v-for="(warning, key) of props.row.warnings"
:key="key"
>
<QIcon :name="warning.icon" size="xs">
<QTooltip>
{{ warning.title }}
</QTooltip>
</QIcon>
</template>
</QTd>
<QTd class="q-gutter-x-xs"> <QTd class="q-gutter-x-xs">
<TicketProblems :row="props.row" /> <TicketProblems :row="props.row" />
</QTd> </QTd>

View File

@ -22,6 +22,7 @@ import ZoneDescriptorProxy from 'src/pages/Zone/Card/ZoneDescriptorProxy.vue';
import { toTimeFormat } from 'src/filters/date'; import { toTimeFormat } from 'src/filters/date';
import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue'; import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue';
import TicketProblems from 'src/components/TicketProblems.vue'; import TicketProblems from 'src/components/TicketProblems.vue';
import TicketWarnings from 'src/components/TicketWarnings.vue';
import VnSection from 'src/components/common/VnSection.vue'; import VnSection from 'src/components/common/VnSection.vue';
import { getAddresses } from 'src/pages/Customer/composables/getAddresses'; import { getAddresses } from 'src/pages/Customer/composables/getAddresses';
import { getAgencies } from 'src/pages/Route/Agency/composables/getAgencies'; import { getAgencies } from 'src/pages/Route/Agency/composables/getAgencies';
@ -82,6 +83,10 @@ const dataKey = 'TicketList';
const formInitialData = ref({}); const formInitialData = ref({});
const columns = computed(() => [ const columns = computed(() => [
{
name: 'warnings',
align: 'left',
},
{ {
align: 'left', align: 'left',
name: 'statusIcons', name: 'statusIcons',
@ -302,6 +307,12 @@ function redirectToLines(id) {
window.open(url, '_blank'); window.open(url, '_blank');
} }
const onClientSelected = async (formData) => {
resetAgenciesSelector(formData);
await fetchClient(formData);
await fetchAddresses(formData);
};
const fetchAvailableAgencies = async (formData) => { const fetchAvailableAgencies = async (formData) => {
resetAgenciesSelector(formData); resetAgenciesSelector(formData);
const response = await getAgencies(formData, selectedClient.value); const response = await getAgencies(formData, selectedClient.value);
@ -471,6 +482,7 @@ function setReference(data) {
@on-fetch="(data) => (accountingOptions = data)" @on-fetch="(data) => (accountingOptions = data)"
auto-load auto-load
/> />
<VnSection <VnSection
:data-key="dataKey" :data-key="dataKey"
:columns="columns" :columns="columns"
@ -506,6 +518,9 @@ function setReference(data) {
}" }"
data-cy="ticketListTable" data-cy="ticketListTable"
> >
<template #column-totalProblems="{ row }">
<TicketProblems :row="row" /> </template
>s
<template #column-statusIcons="{ row }"> <template #column-statusIcons="{ row }">
<TicketProblems :row="row" /> <TicketProblems :row="row" />
</template> </template>
@ -700,9 +715,7 @@ function setReference(data) {
icon="vn:invoice-in" icon="vn:invoice-in"
data-cy="ticketListMakeInvoiceBtn" data-cy="ticketListMakeInvoiceBtn"
/> />
<QTooltip> <QTooltip> {{ t('ticketList.createInvoice') }} </QTooltip>
{{ t('ticketList.createInvoice') }}
</QTooltip>
</QPageSticky> </QPageSticky>
<QPageSticky v-if="hasSelectedRows" :offset="[20, 140]" style="z-index: 2"> <QPageSticky v-if="hasSelectedRows" :offset="[20, 140]" style="z-index: 2">
<QBtn <QBtn