0
0
Fork 0

refs #6157 test ui

This commit is contained in:
Carlos Satorres 2023-11-07 12:42:39 +01:00
parent 08060d276a
commit 6db52e00ea
4 changed files with 235 additions and 249 deletions

View File

@ -268,7 +268,7 @@ watch(formUrl, async () => {
</VnPaginate> </VnPaginate>
<SkeletonTable v-if="!formData" /> <SkeletonTable v-if="!formData" />
<Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown()"> <Teleport to="#st-actions" v-if="stateStore?.isSubToolbarShown()">
<QBtnGroup push class="q-gutter-x-sm"> <QBtnGroup push style="column-gap: 10px">
<slot name="moreBeforeActions" /> <slot name="moreBeforeActions" />
<QBtn <QBtn
:label="tMobile('globals.remove')" :label="tMobile('globals.remove')"

View File

@ -33,7 +33,7 @@ const dialogGreuge = ref(false);
const columns = computed(() => [ const columns = computed(() => [
{ {
name: 'Id', name: 'Id',
label: t('Id'), label: t('Id item'),
field: (row) => row.itemFk, field: (row) => row.itemFk,
}, },
{ {
@ -119,6 +119,7 @@ async function updateDestinations(claimDestinationFk) {
} }
async function updateDestination(claimDestinationFk, row) { async function updateDestination(claimDestinationFk, row) {
console.log(claimDestinationFk, row);
if (claimDestinationFk) { if (claimDestinationFk) {
await axios.post('Claims/updateClaimDestination', { await axios.post('Claims/updateClaimDestination', {
claimDestinationFk, claimDestinationFk,
@ -238,251 +239,220 @@ async function importToNewRefundTicket() {
show-if-above show-if-above
v-if="claim" v-if="claim"
> >
<QScrollArea class="fit text-grey-8 q-mt-lg"> <div class="totalClaim q-mb-md">
<div class="totalClaim q-mb-md"> {{ `${t('Total claimed')}: ${toCurrency(totalClaimed)}` }}
{{ `${t('Total claimed')}: ${toCurrency(totalClaimed)}` }} </div>
</div> <QCard class="q-mb-md q-pa-sm">
<QCard class="q-mb-md q-pa-sm"> <QItem class="justify-between">
<QItem class="justify-between"> <QItemLabel class="slider-container">
<QItemLabel class="slider-container"> <p class="text-primary">
<p class="text-primary"> {{ t('claim.summary.actions') }}
{{ t('claim.summary.actions') }} </p>
</p> <QSlider
<QSlider class="responsibility { 'background-color:primary': quasar.platform.is.mobile }"
class="responsibility { 'background-color:primary': quasar.platform.is.mobile }" v-model="claim.responsibility"
v-model="claim.responsibility" :label-value="t('claim.summary.responsibility')"
:label-value="t('claim.summary.responsibility')" @update:model-value="(value) => save({ responsibility: value })"
@update:model-value=" label-always
(value) => save({ responsibility: value }) color="primary"
" markers
label-always :marker-labels="[
color="primary" { value: 1, label: t('claim.summary.company') },
markers { value: 5, label: t('claim.summary.person') },
:marker-labels="[ ]"
{ value: 1, label: t('claim.summary.company') }, :min="1"
{ value: 5, label: t('claim.summary.person') }, :max="5"
]" />
:min="1" </QItemLabel>
:max="5" </QItem>
/> </QCard>
</QItemLabel> <QItemLabel class="mana q-mb-md">
</QItem> <QCheckbox
</QCard> v-model="claim.isChargedToMana"
<QItemLabel class="mana q-mb-md"> @update:model-value="(value) => save({ isChargedToMana: value })"
<QCheckbox />
v-model="claim.isChargedToMana" <span>{{ t('mana') }}</span>
@update:model-value="(value) => save({ isChargedToMana: value })" </QItemLabel>
/>
<span>{{ t('mana') }}</span>
</QItemLabel>
</QScrollArea>
</QDrawer> </QDrawer>
<Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()"> </Teleport> <Teleport to="#st-data" v-if="stateStore.isSubToolbarShown()"> </Teleport>
<div class="claim-action"> <CrudModel
<CrudModel v-if="claim"
v-if="claim" data-key="ClaimEnds"
data-key="ClaimEnds" url="ClaimEnds/filter"
url="ClaimEnds/filter" save-url="ClaimEnds/crud"
save-url="ClaimEnds/crud" ref="claimActionsForm"
ref="claimActionsForm" v-model:selected="selectedRows"
v-model:selected="selectedRows" :filter="{ where: { claimFk: claimId } }"
:filter="{ where: { claimFk: claimId } }" :default-remove="true"
:default-remove="true" :default-save="false"
:default-save="false" :default-reset="false"
:default-reset="false" @on-fetch="(data) => (rows = data)"
@on-fetch="(data) => (rows = data)" auto-load
auto-load >
> <template #body>
<template #body> <QTable
<QTable :columns="columns"
:columns="columns" :rows="rows"
:rows="rows" :dense="$q.screen.lt.md"
:dense="$q.screen.lt.md" :pagination="{ rowsPerPage: 0 }"
:pagination="{ rowsPerPage: 0 }" row-key="id"
row-key="id" selection="multiple"
selection="multiple" v-model:selected="selectedRows"
v-model:selected="selectedRows" hide-pagination
hide-pagination :grid="$q.screen.lt.md"
:grid="$q.screen.lt.md" >
> <template #body-cell-ticket="{ value }">
<template #body-cell-ticket="{ value }"> <QTd align="center">
<QTd align="center"> <span class="link">
<span class="link"> {{ value }}
{{ value }} <TicketDescriptorProxy :id="value" />
<TicketDescriptorProxy :id="value" />
</span>
</QTd>
</template>
<template #body-cell-destination="{ rowIndex }">
<QTd>
<VnSelectFilter
v-model="destinations[rowIndex]"
:options="destinationTypes"
option-value="id"
option-label="description"
@update:model-value="
(value) => updateDestination(value, rows[rowIndex])
"
/>
</QTd>
</template>
<template #body-cell-price="{ value }">
<QTd align="center">
{{ toCurrency(value) }}
</QTd>
</template>
<template #body-cell-total="{ value }">
<QTd align="center">
{{ toCurrency(value) }}
</QTd>
</template>
<template #body-cell-delete="{ rowIndex }">
<QTd>
<QBtn
icon="delete"
color="primary"
padding="xs"
round
flat
@click="deleteSale(rows[rowIndex])"
>
<QTooltip>
{{ t('Remove line') }}
</QTooltip>
</QBtn>
</QTd>
</template>
<!-- View for grid mode -->
<template #item="props">
<div class="q-mb-md col-12 grid-style-transition">
<QCard>
<QCardSection class="row justify-between">
<QCheckbox v-model="props.selected" />
<QBtn color="primary" icon="delete" flat round />
</QCardSection>
<QSeparator inset />
<QList dense>
<QItem
v-for="column of props.cols"
:key="column.name"
>
<QItemSection>
<QItemLabel caption>
{{ column.label }}
</QItemLabel>
</QItemSection>
<QItemSection side>
<QItemLabel
v-if="column.name === 'destination'"
>
{{ column.value.description }}
</QItemLabel>
<QItemLabel v-else>
{{ column.value }}
</QItemLabel>
</QItemSection>
</QItem>
</QList>
</QCard>
</div>
</template>
</QTable>
</template>
<template #moreBeforeActions>
<QBtn
color="primary"
text-color="white"
:unelevated="true"
:label="tMobile('Regularize')"
:title="t('Regularize')"
icon="check"
@click="regularizeClaim"
:disable="claim.claimStateFk == resolvedStateId"
/>
<QBtn
color="primary"
text-color="white"
:unelevated="true"
:disable="!selectedRows.length"
:label="tMobile('Change destination')"
:title="t('Change destination')"
icon="swap_horiz"
@click="dialogDestination = !dialogDestination"
/>
<QBtn
color="primary"
text-color="white"
:unelevated="true"
:label="tMobile('Import claim')"
:title="t('Import claim')"
icon="Upload"
@click="importToNewRefundTicket"
:disable="claim.claimStateFk == resolvedStateId"
/>
</template>
</CrudModel>
<QDialog v-model="dialogDestination">
<QCard>
<QCardSection>
<QItem class="q-pa-none">
<span class="q-dialog__title text-white">
{{ t('dialog title') }}
</span> </span>
<QBtn icon="close" flat round dense v-close-popup /> </QTd>
</QItem> </template>
</QCardSection> <template #body-cell-destination="{ row }">
<QCardSection> <QTd>
<VnSelectFilter <VnSelectFilter
v-model="claimDestinationFk" v-model="row.claimDestinationFk"
:options="destinationTypes" :options="destinationTypes"
option-label="description" option-label="description"
option-value="id" option-value="id"
/> :autofocus="true"
</QCardSection> dense
<QCardActions class="justify-end q-mr-sm"> input-debounce="0"
<QBtn hide-selected
flat @update:model-value="(value) => updateDestination(value, row)"
:label="t('globals.close')" />
color="primary" </QTd>
v-close-popup </template>
/> <template #body-cell-price="{ value }">
<QBtn <QTd align="center">
:disable="!claimDestinationFk" {{ toCurrency(value) }}
:label="t('globals.save')" </QTd>
color="primary" </template>
v-close-popup <template #body-cell-total="{ value }">
@click="updateDestinations(claimDestinationFk)" <QTd align="center">
/> {{ toCurrency(value) }}
</QCardActions> </QTd>
</QCard> </template>
</QDialog> <!-- View for grid mode -->
<QDialog v-model="dialogGreuge"> <template #item="props">
<div class="q-mb-md col-12 grid-style-transition">
<QCard>
<QCardSection class="row justify-between">
<QCheckbox v-model="props.selected" />
<QBtn color="primary" icon="delete" flat round />
</QCardSection>
<QSeparator inset />
<QList dense>
<QItem v-for="column of props.cols" :key="column.name">
<QItemSection>
<QItemLabel caption>
{{ column.label }}
</QItemLabel>
</QItemSection>
<QItemSection side>
<QItemLabel v-if="column.name === 'destination'">
{{ column.value.description }}
</QItemLabel>
<QItemLabel v-else>
{{ column.value }}
</QItemLabel>
</QItemSection>
</QItem>
</QList>
</QCard>
</div>
</template>
</QTable>
</template>
<template #moreBeforeActions>
<QBtn
color="primary"
text-color="white"
:unelevated="true"
:label="tMobile('Regularize')"
:title="t('Regularize')"
icon="check"
@click="regularizeClaim"
:disable="claim.claimStateFk == resolvedStateId"
/>
<QBtn
color="primary"
text-color="white"
:unelevated="true"
:disable="!selectedRows.length"
:label="tMobile('Change destination')"
:title="t('Change destination')"
icon="swap_horiz"
@click="dialogDestination = !dialogDestination"
/>
<QBtn
color="primary"
text-color="white"
:unelevated="true"
:label="tMobile('Import claim')"
:title="t('Import claim')"
icon="Upload"
@click="importToNewRefundTicket"
:disable="claim.claimStateFk == resolvedStateId"
/>
</template>
</CrudModel>
<QDialog v-model="dialogDestination">
<QCard>
<QCardSection> <QCardSection>
<QItem class="q-pa-none"> <QItem class="q-pa-none">
<span class="q-dialog__title text-white"> <span class="q-dialog__title text-white">
{{ t('dialogGreuge title') }} {{ t('dialog title') }}
</span> </span>
<QBtn icon="close" flat round dense v-close-popup /> <QBtn icon="close" flat round dense v-close-popup />
</QItem> </QItem>
<QCardActions class="justify-end q-mr-sm">
<QBtn
flat
:label="t('globals.close')"
color="primary"
v-close-popup
/>
<QBtn
:label="t('globals.save')"
color="primary"
v-close-popup
@click="onUpdateGreugeAccept"
/>
</QCardActions>
</QCardSection> </QCardSection>
</QDialog> <QItemSection>
</div> <VnSelectFilter
v-model="claimDestinationFk"
:options="destinationTypes"
option-label="description"
option-value="id"
:autofocus="true"
dense
input-debounce="0"
hide-selected
/>
</QItemSection>
<QCardActions class="justify-end q-mr-sm">
<QBtn flat :label="t('globals.close')" color="primary" v-close-popup />
<QBtn
:disable="!claimDestinationFk"
:label="t('globals.save')"
color="primary"
v-close-popup
@click="updateDestinations(claimDestinationFk)"
/>
</QCardActions>
</QCard>
</QDialog>
<QDialog v-model="dialogGreuge">
<QCardSection>
<QItem class="q-pa-none">
<span class="q-dialog__title text-white">
{{ t('dialogGreuge title') }}
</span>
<QBtn icon="close" flat round dense v-close-popup />
</QItem>
<QCardActions class="justify-end q-mr-sm">
<QBtn flat :label="t('globals.close')" color="primary" v-close-popup />
<QBtn
:label="t('globals.save')"
color="primary"
v-close-popup
@click="onUpdateGreugeAccept"
/>
</QCardActions>
</QCardSection>
</QDialog>
</template> </template>
<style lang="scss"> <style lang="scss">
.claim-action { .claim-action {
@ -514,10 +484,11 @@ async function importToNewRefundTicket() {
} }
} }
.totalClaim { .totalClaim {
border: 3px solid black; background-color: #313131;
color: white; color: white;
padding: 10px; padding: 10px;
margin: 5px; margin: 5px;
border-radius: 8px;
} }
.responsibility { .responsibility {
max-width: 100%; max-width: 100%;
@ -555,4 +526,5 @@ es:
Remove: Eliminar Remove: Eliminar
dialogGreuge title: Insertar greuges en la ficha del cliente dialogGreuge title: Insertar greuges en la ficha del cliente
ClaimGreugeDescription: Id reclamación ClaimGreugeDescription: Id reclamación
Id item: Id artículo
</i18n> </i18n>

View File

@ -43,17 +43,6 @@ onMounted(async () => {
<QSeparator /> <QSeparator />
<LeftMenu source="card" /> <LeftMenu source="card" />
<QSeparator /> <QSeparator />
<QList>
<QItem
active-class="text-primary"
clickable
v-ripple
:href="`${salixUrl}/action`"
>
<QItemSection avatar><QIcon name="vn:actions"></QIcon></QItemSection>
<QItemSection>{{ t('Action') }}</QItemSection>
</QItem>
</QList>
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
<QPageContainer> <QPageContainer>

View File

@ -0,0 +1,25 @@
/// <reference types="cypress" />
describe('ClaimAction', () => {
const claimId = 2;
const firstLineReason = 'tbody > :nth-child(1) > :nth-child(2)';
const firstRow = 'tbody > :nth-child(1)';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/claim/${claimId}/action`);
});
it('should import claim', () => {
cy.get('[title="Import claim"]').click();
});
it('should change destination', () => {
const rowData = [true, null, null, 'Bueno', null, null, null, null, null, null];
cy.fillRow(firstRow, rowData);
});
it('should regularize', () => {
cy.get('[title="Regularize"]').click();
});
});