2281 - Added claim pickup checkbox
gitea/salix/pipeline/head This commit has test failures
Details
gitea/salix/pipeline/head This commit has test failures
Details
This commit is contained in:
parent
696de03ad1
commit
f39719cc46
|
@ -585,6 +585,7 @@ export default {
|
||||||
claimState: 'vn-claim-basic-data vn-autocomplete[ng-model="$ctrl.claim.claimStateFk"]',
|
claimState: 'vn-claim-basic-data vn-autocomplete[ng-model="$ctrl.claim.claimStateFk"]',
|
||||||
responsabilityInputRange: 'vn-range',
|
responsabilityInputRange: 'vn-range',
|
||||||
observation: 'vn-textarea[ng-model="$ctrl.claim.observation"]',
|
observation: 'vn-textarea[ng-model="$ctrl.claim.observation"]',
|
||||||
|
hasToPickUpCheckbox: 'vn-claim-basic-data vn-check[ng-model="$ctrl.claim.hasToPickUp"]',
|
||||||
saveButton: `button[type=submit]`
|
saveButton: `button[type=submit]`
|
||||||
},
|
},
|
||||||
claimDetail: {
|
claimDetail: {
|
||||||
|
@ -619,8 +620,7 @@ export default {
|
||||||
firstLineDestination: 'vn-claim-action vn-tr:nth-child(1) vn-autocomplete[ng-model="saleClaimed.claimDestinationFk"]',
|
firstLineDestination: 'vn-claim-action vn-tr:nth-child(1) vn-autocomplete[ng-model="saleClaimed.claimDestinationFk"]',
|
||||||
secondLineDestination: 'vn-claim-action vn-tr:nth-child(2) vn-autocomplete[ng-model="saleClaimed.claimDestinationFk"]',
|
secondLineDestination: 'vn-claim-action vn-tr:nth-child(2) vn-autocomplete[ng-model="saleClaimed.claimDestinationFk"]',
|
||||||
firstDeleteLine: 'vn-claim-action vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
firstDeleteLine: 'vn-claim-action vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
||||||
isPaidWithManaCheckbox: 'vn-claim-action vn-check[ng-model="$ctrl.claim.isChargedToMana"]',
|
isPaidWithManaCheckbox: 'vn-claim-action vn-check[ng-model="$ctrl.claim.isChargedToMana"]'
|
||||||
hasToPickUpCheckbox: 'vn-claim-action vn-check[ng-model="$ctrl.claim.hasToPickUp"]'
|
|
||||||
},
|
},
|
||||||
ordersIndex: {
|
ordersIndex: {
|
||||||
searchResult: 'vn-order-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
searchResult: 'vn-order-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
describe('Claim edit basic data path', () => {
|
fdescribe('Claim edit basic data path', () => {
|
||||||
let browser;
|
let browser;
|
||||||
let page;
|
let page;
|
||||||
|
|
||||||
|
@ -34,6 +34,15 @@ describe('Claim edit basic data path', () => {
|
||||||
await page.waitForState('claim.card.detail');
|
await page.waitForState('claim.card.detail');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should check the "Pick up" checkbox', async() => {
|
||||||
|
await page.reloadSection('claim.card.basicData');
|
||||||
|
await page.waitToClick(selectors.claimBasicData.hasToPickUpCheckbox);
|
||||||
|
await page.waitToClick(selectors.claimBasicData.saveButton);
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.type).toBe('success');
|
||||||
|
});
|
||||||
|
|
||||||
it('should confirm the claim state was edited', async() => {
|
it('should confirm the claim state was edited', async() => {
|
||||||
await page.reloadSection('claim.card.basicData');
|
await page.reloadSection('claim.card.basicData');
|
||||||
await page.wait(selectors.claimBasicData.claimState);
|
await page.wait(selectors.claimBasicData.claimState);
|
||||||
|
@ -42,6 +51,12 @@ describe('Claim edit basic data path', () => {
|
||||||
expect(result).toEqual('Gestionado');
|
expect(result).toEqual('Gestionado');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should confirm the "is paid with mana" and "Pick up" checkbox are checked', async() => {
|
||||||
|
const hasToPickUpCheckbox = await page.checkboxState(selectors.claimBasicData.hasToPickUpCheckbox);
|
||||||
|
|
||||||
|
expect(hasToPickUpCheckbox).toBe('checked');
|
||||||
|
});
|
||||||
|
|
||||||
it('should confirm the claim observation was edited', async() => {
|
it('should confirm the claim observation was edited', async() => {
|
||||||
const result = await page
|
const result = await page
|
||||||
.waitToGetProperty(selectors.claimBasicData.observation, 'value');
|
.waitToGetProperty(selectors.claimBasicData.observation, 'value');
|
||||||
|
|
|
@ -72,19 +72,26 @@ describe('Claim action path', () => {
|
||||||
expect(message.type).toBe('success');
|
expect(message.type).toBe('success');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check the "Pick up" checkbox', async() => {
|
/* it('should check the "Pick up" checkbox', async() => {
|
||||||
await page.waitToClick(selectors.claimAction.hasToPickUpCheckbox);
|
await page.waitToClick(selectors.claimAction.hasToPickUpCheckbox);
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
expect(message.type).toBe('success');
|
expect(message.type).toBe('success');
|
||||||
|
}); */
|
||||||
|
|
||||||
|
it('should confirm the "is paid with mana" is checked', async() => {
|
||||||
|
await page.reloadSection('claim.card.action');
|
||||||
|
const isPaidWithManaCheckbox = await page.checkboxState(selectors.claimAction.isPaidWithManaCheckbox);
|
||||||
|
|
||||||
|
expect(isPaidWithManaCheckbox).toBe('checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the "is paid with mana" and "Pick up" checkbox are checked', async() => {
|
/* it('should confirm the "is paid with mana" and "Pick up" checkbox are checked', async() => {
|
||||||
await page.reloadSection('claim.card.action');
|
await page.reloadSection('claim.card.action');
|
||||||
const isPaidWithManaCheckbox = await page.checkboxState(selectors.claimAction.isPaidWithManaCheckbox);
|
const isPaidWithManaCheckbox = await page.checkboxState(selectors.claimAction.isPaidWithManaCheckbox);
|
||||||
const hasToPickUpCheckbox = await page.checkboxState(selectors.claimAction.hasToPickUpCheckbox);
|
const hasToPickUpCheckbox = await page.checkboxState(selectors.claimAction.hasToPickUpCheckbox);
|
||||||
|
|
||||||
expect(isPaidWithManaCheckbox).toBe('checked');
|
expect(isPaidWithManaCheckbox).toBe('checked');
|
||||||
expect(hasToPickUpCheckbox).toBe('checked');
|
expect(hasToPickUpCheckbox).toBe('checked');
|
||||||
});
|
}); */
|
||||||
});
|
});
|
||||||
|
|
|
@ -88,32 +88,11 @@ module.exports = Self => {
|
||||||
}, options);
|
}, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
let claim = await Self.findById(claimFk, {
|
let claim = await Self.findById(claimFk, null, options);
|
||||||
include: {
|
|
||||||
relation: 'client',
|
|
||||||
scope: {
|
|
||||||
include: {
|
|
||||||
relation: 'salesPerson'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, options);
|
|
||||||
claim = await claim.updateAttributes({
|
claim = await claim.updateAttributes({
|
||||||
claimStateFk: resolvedState
|
claimStateFk: resolvedState
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
// Get sales person from claim client
|
|
||||||
const salesPerson = claim.client().salesPerson();
|
|
||||||
if (salesPerson && claim.hasToPickUp) {
|
|
||||||
const origin = ctx.req.headers.origin;
|
|
||||||
const message = $t('Claim will be picked', {
|
|
||||||
claimId: claim.id,
|
|
||||||
clientName: claim.client().name,
|
|
||||||
claimUrl: `${origin}/#!/claim/${claim.id}/summary`
|
|
||||||
});
|
|
||||||
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
await tx.commit();
|
await tx.commit();
|
||||||
|
|
||||||
return claim;
|
return claim;
|
||||||
|
|
|
@ -27,8 +27,18 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.updateClaim = async(ctx, id, data) => {
|
Self.updateClaim = async(ctx, id, data) => {
|
||||||
let models = Self.app.models;
|
const models = Self.app.models;
|
||||||
let claim = await models.Claim.findById(id);
|
const $t = ctx.req.__; // $translate
|
||||||
|
const claim = await models.Claim.findById(id, {
|
||||||
|
include: {
|
||||||
|
relation: 'client',
|
||||||
|
scope: {
|
||||||
|
include: {
|
||||||
|
relation: 'salesPerson'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
let canUpdate = await canChangeState(ctx, claim.claimStateFk);
|
let canUpdate = await canChangeState(ctx, claim.claimStateFk);
|
||||||
let hasRights = await canChangeState(ctx, data.claimStateFk);
|
let hasRights = await canChangeState(ctx, data.claimStateFk);
|
||||||
|
@ -36,6 +46,18 @@ module.exports = Self => {
|
||||||
if (!canUpdate || !hasRights)
|
if (!canUpdate || !hasRights)
|
||||||
throw new UserError(`You don't have enough privileges to change that field`);
|
throw new UserError(`You don't have enough privileges to change that field`);
|
||||||
|
|
||||||
|
// Get sales person from claim client
|
||||||
|
const salesPerson = claim.client().salesPerson();
|
||||||
|
if (salesPerson && claim.hasToPickUp) {
|
||||||
|
const origin = ctx.req.headers.origin;
|
||||||
|
const message = $t('Claim will be picked', {
|
||||||
|
claimId: claim.id,
|
||||||
|
clientName: claim.client().name,
|
||||||
|
claimUrl: `${origin}/#!/claim/${claim.id}/summary`
|
||||||
|
});
|
||||||
|
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message);
|
||||||
|
}
|
||||||
|
|
||||||
return await claim.updateAttributes(data);
|
return await claim.updateAttributes(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,6 @@ module.exports = Self => {
|
||||||
arg: 'isChargedToMana',
|
arg: 'isChargedToMana',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
required: false
|
required: false
|
||||||
}, {
|
|
||||||
arg: 'hasToPickUp',
|
|
||||||
type: 'boolean',
|
|
||||||
required: false
|
|
||||||
}],
|
}],
|
||||||
returns: {
|
returns: {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
|
|
|
@ -43,11 +43,6 @@
|
||||||
on-change="$ctrl.save({responsibility: value})">
|
on-change="$ctrl.save({responsibility: value})">
|
||||||
</vn-range>
|
</vn-range>
|
||||||
</vn-tool-bar>
|
</vn-tool-bar>
|
||||||
<vn-check vn-one class="vn-mr-md"
|
|
||||||
label="Pick up"
|
|
||||||
ng-model="$ctrl.claim.hasToPickUp"
|
|
||||||
on-change="$ctrl.save({hasToPickUp: value})">
|
|
||||||
</vn-check>
|
|
||||||
<vn-check vn-one
|
<vn-check vn-one
|
||||||
label="Is paid with mana"
|
label="Is paid with mana"
|
||||||
ng-model="$ctrl.claim.isChargedToMana"
|
ng-model="$ctrl.claim.isChargedToMana"
|
||||||
|
|
|
@ -9,5 +9,4 @@ Regularize: Regularizar
|
||||||
Do you want to insert greuges?: Desea insertar greuges?
|
Do you want to insert greuges?: Desea insertar greuges?
|
||||||
Insert greuges on client card: Insertar greuges en la ficha del cliente
|
Insert greuges on client card: Insertar greuges en la ficha del cliente
|
||||||
Greuge inserted: Greuge insertado
|
Greuge inserted: Greuge insertado
|
||||||
ClaimGreugeDescription: Reclamación id {{claimId}}
|
ClaimGreugeDescription: Reclamación id {{claimId}}
|
||||||
Pick up: Recoger
|
|
|
@ -53,6 +53,12 @@
|
||||||
rule>
|
rule>
|
||||||
</vn-textarea>
|
</vn-textarea>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-check vn-one class="vn-mr-md"
|
||||||
|
label="Pick up"
|
||||||
|
ng-model="$ctrl.claim.hasToPickUp">
|
||||||
|
</vn-check>
|
||||||
|
</vn-horizontal>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-button-bar>
|
<vn-button-bar>
|
||||||
<vn-submit label="Save"></vn-submit>
|
<vn-submit label="Save"></vn-submit>
|
||||||
|
|
|
@ -3,4 +3,5 @@ Claim state: Estado de la reclamación
|
||||||
Is paid with mana: Cargado al maná
|
Is paid with mana: Cargado al maná
|
||||||
Responsability: Responsabilidad
|
Responsability: Responsabilidad
|
||||||
Company: Empresa
|
Company: Empresa
|
||||||
Sales/Client: Comercial/Cliente
|
Sales/Client: Comercial/Cliente
|
||||||
|
Pick up: Recoger
|
Loading…
Reference in New Issue