refs #6157 refactor stateColor, updateDestinations, change responsability
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-11-09 13:52:45 +01:00
parent 20bbee8397
commit ae655dabe2
5 changed files with 32 additions and 28 deletions

View File

@ -103,27 +103,17 @@ function getDestination(destinationId) {
return destinationTypes.value.find((type) => type.id == destinationId); return destinationTypes.value.find((type) => type.id == destinationId);
} }
async function deleteSale(sale) {
await axios.post(`ClaimEnds/deleteClamedSales`, { sales: [sale] });
claimActionsForm.value.reload();
}
async function updateDestinations(claimDestinationFk) { async function updateDestinations(claimDestinationFk) {
if (claimDestinationFk) { await updateDestination(claimDestinationFk, selectedRows.value, { reload: true });
await axios.post('Claims/updateClaimDestination', {
claimDestinationFk,
rows: [...selectedRows.value],
});
claimActionsForm.value.reload();
}
} }
async function updateDestination(claimDestinationFk, row) { async function updateDestination(claimDestinationFk, row, options = {}) {
if (claimDestinationFk) { if (claimDestinationFk) {
await axios.post('Claims/updateClaimDestination', { await axios.post('Claims/updateClaimDestination', {
claimDestinationFk, claimDestinationFk,
rows: [row], rows: Array.isArray(row) ? row : [row],
}); });
options.reload && claimActionsForm.value.reload();
} }
} }
@ -251,7 +241,7 @@ async function importToNewRefundTicket() {
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 })" @change="(value) => save({ responsibility: value })"
label-always label-always
color="primary" color="primary"
markers markers

View File

@ -62,10 +62,15 @@ const filter = {
], ],
}; };
const STATE_COLOR = {
pending: 'positive',
managed: 'warning',
resolved: 'negative',
};
function stateColor(code) { function stateColor(code) {
if (code === 'pending') return 'positive'; return STATE_COLOR[code];
if (code === 'managed') return 'warning';
if (code === 'resolved') return 'negative';
} }
const data = ref(useCardDescription()); const data = ref(useCardDescription());
const setData = (entity) => { const setData = (entity) => {

View File

@ -85,10 +85,15 @@ const detailsColumns = ref([
}, },
]); ]);
const STATE_COLOR = {
pending: 'positive',
managed: 'warning',
resolved: 'negative',
};
function stateColor(code) { function stateColor(code) {
if (code === 'pending') return 'green'; return STATE_COLOR[code];
if (code === 'managed') return 'orange';
if (code === 'resolved') return 'red';
} }
const developmentColumns = ref([ const developmentColumns = ref([

View File

@ -17,12 +17,16 @@ const router = useRouter();
const quasar = useQuasar(); const quasar = useQuasar();
const { t } = useI18n(); const { t } = useI18n();
function stateColor(code) { const STATE_COLOR = {
if (code === 'pending') return 'green'; pending: 'positive',
if (code === 'managed') return 'orange';
if (code === 'resolved') return 'red';
}
managed: 'warning',
resolved: 'negative',
};
function stateColor(code) {
return STATE_COLOR[code];
}
function navigate(id) { function navigate(id) {
router.push({ path: `/claim/${id}` }); router.push({ path: `/claim/${id}` });
} }

View File

@ -1,7 +1,7 @@
/// <reference types="cypress" /> /// <reference types="cypress" />
describe('ClaimAction', () => { describe('ClaimAction', () => {
const claimId = 2; const claimId = 2;
const firstLineReason = 'tbody > :nth-child(1) > :nth-child(2)';
const firstRow = 'tbody > :nth-child(1)'; const firstRow = 'tbody > :nth-child(1)';
beforeEach(() => { beforeEach(() => {
@ -15,7 +15,7 @@ describe('ClaimAction', () => {
}); });
it('should change destination', () => { it('should change destination', () => {
const rowData = [true, null, null, 'Bueno', null, null, null, null, null, null]; const rowData = [true, null, null, 'Bueno'];
cy.fillRow(firstRow, rowData); cy.fillRow(firstRow, rowData);
}); });