Merge branch 'dev' into 5036-regularizar-historicos
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alexandre Riera 2023-02-27 06:05:21 +00:00
commit 76cd2d160e
18 changed files with 69 additions and 34 deletions

View File

@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [2308.01] - 2023-03-09
### Added
-
- (Client -> Descriptor) Nuevo icono $ con barrotes para los clientes con impago
### Changed
-

View File

@ -197,6 +197,7 @@ describe('Ticket Edit sale path', () => {
});
it('should check in the history that logs has been added', async() => {
await page.reload({waitUntil: ['networkidle0', 'domcontentloaded']});
await page.waitToClick(selectors.ticketSales.firstSaleHistoryButton);
await page.waitForSelector(selectors.ticketSales.firstSaleHistory);
const result = await page.countElement(selectors.ticketSales.firstSaleHistory);

View File

@ -63,6 +63,6 @@ describe('Ticket index payout path', () => {
const reference = await page.waitToGetProperty(selectors.clientBalance.firstLineReference, 'innerText');
expect(count).toEqual(4);
expect(reference).toContain('Cash,Albaran: 7, 8Payment');
expect(reference).toContain('Cash, Albaran: 7, 8Payment');
});
});

View File

@ -12,6 +12,7 @@ module.exports = Self => {
});
Self.post = async ctx => {
console.log(ctx.req.body);
return ctx.req.body;
};
};

View File

@ -166,7 +166,8 @@ module.exports = Self => {
c.name AS clientName,
cl.workerFk,
u.name AS workerName,
cs.description,
cs.code stateCode,
cs.description stateDescription,
cl.created
FROM claim cl
LEFT JOIN client c ON c.id = cl.clientFk

View File

@ -77,6 +77,11 @@
"type": "belongsTo",
"model": "Ticket",
"foreignKey": "ticketFk"
}
},
"claimDms": {
"type": "hasMany",
"model": "ClaimDms",
"foreignKey": "claimFk"
}
}
}

View File

@ -52,8 +52,8 @@
</span>
</td>
<td>
<span class="chip {{::$ctrl.stateColor(claim)}}">
{{::claim.description}}
<span class="chip {{::$ctrl.stateColor(claim.stateCode)}}">
{{::claim.stateDescription}}
</span>
</td>
<td shrink>

View File

@ -55,13 +55,13 @@ class Controller extends Section {
}
}
stateColor(claim) {
switch (claim.description) {
case 'Pendiente':
stateColor(code) {
switch (code) {
case 'pending':
return 'warning';
case 'Gestionado':
case 'managed':
return 'notice';
case 'Resuelto':
case 'resolved':
return 'success';
}
}

View File

@ -80,6 +80,7 @@ module.exports = function(Self) {
const data = await Self.rawSql(query, [id, date], myOptions);
client.debt = data[0].debt;
client.unpaid = await Self.app.models.ClientUnpaid.findOne({id}, myOptions);
return client;
};

View File

@ -68,7 +68,7 @@ class Controller extends Dialog {
this.receipt.description.push(accountingType.receiptDescription);
if (this.originalDescription)
this.receipt.description.push(this.originalDescription);
this.receipt.description.join(', ');
this.receipt.description = this.receipt.description.join(', ');
}
this.maxAmount = accountingType && accountingType.maxAmount;

View File

@ -38,7 +38,7 @@ describe('Client', () => {
}
};
expect(controller.receipt.description.join(',')).toEqual('Cash,Albaran: 1, 2');
expect(controller.receipt.description).toEqual('Cash, Albaran: 1, 2');
});
});

View File

@ -18,26 +18,26 @@
<slot-body>
<div class="attributes">
<vn-label-value
label="Pay method"
label="Pay method"
value="{{$ctrl.client.payMethod.name}}">
</vn-label-value>
<vn-label-value
label="Credit"
label="Credit"
value="{{$ctrl.client.credit | currency: 'EUR': 2}}">
</vn-label-value>
<vn-label-value
label="Secured credit"
label="Secured credit"
value="{{$ctrl.client.creditInsurance | currency: 'EUR': 2}}">
</vn-label-value>
<vn-label-value
label="Risk"
label="Risk"
value="{{$ctrl.client.debt | currency: 'EUR':2}}"
ng-class="{alert: $ctrl.client.debt > $ctrl.client.credit}"
info="Invoices minus payments plus orders not yet invoiced">
info="Invoices minus payments plus orders not yet invoiced">
</vn-label-value>
<vn-label-value
label="Sales person">
<span
<span
ng-click="workerDescriptor.show($event, $ctrl.client.salesPersonFk)"
class="link">
{{$ctrl.client.salesPersonUser.name}}
@ -70,6 +70,11 @@
icon="icon-no036"
ng-if="$ctrl.client.isTaxDataChecked == false">
</vn-icon>
<vn-icon
vn-tooltip="{{$ctrl.clientUnpaid()}}"
icon="icon-clientUnpaid"
ng-if="$ctrl.client.unpaid">
</vn-icon>
</div>
<div class="quicklinks">
<div ng-transclude="btnOne">
@ -118,7 +123,7 @@
on-send="$ctrl.onSmsSend($sms)"
sms="$ctrl.newSMS">
</vn-sms-dialog>
<vn-worker-descriptor-popover
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>
<vn-popup vn-id="summary">

View File

@ -44,6 +44,11 @@ class Controller extends Descriptor {
return this.$http.post(`Clients/${this.id}/sendSms`, sms)
.then(() => this.vnApp.showSuccess(this.$t('SMS sent')));
}
clientUnpaid() {
return this.$t(`Unpaid Dated`, {dated: this.client.unpaid.dated}) +
'<br/>' + this.$t(`Unpaid Amount`, {amount: this.client.unpaid.amount});
}
}
ngModule.vnComponent('vnClientDescriptor', {

View File

@ -5,4 +5,6 @@ To date: Fecha hasta
Go to user: Ir al usuario
Go to supplier: Ir al proveedor
Client invoices list: Listado de facturas del cliente
Pay method: Forma de pago
Pay method: Forma de pago
Unpaid Dated: "Fecha: {{dated | date:'dd/MM/yyyy'}}"
Unpaid Amount: "Importe: {{amount | currency: 'EUR':2}}"

View File

@ -5,10 +5,6 @@ import './style.scss';
class Controller extends Section {
constructor($element, $, vnEmail) {
super($element, $);
this.clientSample = {
clientFk: this.$params.id,
companyId: this.vnConfig.companyFk
};
this.vnEmail = vnEmail;
}
@ -19,10 +15,8 @@ class Controller extends Section {
set client(value) {
this._client = value;
if (value) {
this.clientSample.recipient = value.email;
this.getWorkerEmail();
}
if (value)
this.setClientSample(value);
}
get companyId() {
@ -119,12 +113,17 @@ class Controller extends Section {
.then(() => this.$state.go('client.card.sample.index'));
}
getWorkerEmail() {
setClientSample(client) {
const userId = window.localStorage.currentUserWorkerId;
const params = {filter: {where: {userFk: userId}}};
this.$http.get('EmailUsers', params).then(res => {
const [worker] = res && res.data;
this.clientSample.replyTo = worker.email;
this.clientSample = {
clientFk: this.$params.id,
companyId: this.vnConfig.companyFk,
recipient: client.email,
replyTo: worker.email
};
});
}
}

View File

@ -191,15 +191,19 @@ describe('Client', () => {
});
});
describe('getWorkerEmail()', () => {
describe('setClientSample()', () => {
it(`should perform a query and then set the replyTo property to the clientSample object`, () => {
const client = {email: 'test@example.com'};
const expectedEmail = 'batman@arkhamcity.com';
const serializedParams = $httpParamSerializer({filter: {where: {}}});
$httpBackend.expect('GET', `EmailUsers?${serializedParams}`).respond([{email: expectedEmail}]);
controller.getWorkerEmail();
controller.setClientSample(client);
$httpBackend.flush();
expect(controller.clientSample.replyTo).toEqual(expectedEmail);
expect(controller.clientSample.clientFk).toEqual(controller.$params.id);
expect(controller.clientSample.recipient).toEqual(client.email);
expect(controller.clientSample.companyId).toEqual(controller.vnConfig.companyFk);
});
});
});

View File

@ -87,6 +87,14 @@ module.exports = Self => {
for (let problem of problems)
saleProblems.set(problem.saleFk, problem);
const ticketLog = await Self.rawSql(`SELECT DISTINCT changedModelId
FROM ticketLog tl
WHERE changedModel = 'Sale'
AND originFk = ?`, [id], myOptions);
const salesWithLogs = ticketLog.map(sale => {
return sale.changedModelId;
});
for (let sale of sales) {
const problems = saleProblems.get(sale.id);
const itemStock = itemAvailable.get(sale.itemFk);
@ -98,6 +106,8 @@ module.exports = Self => {
sale.hasTicketRequest = problems.hasTicketRequest;
sale.hasComponentLack = problems.hasComponentLack;
}
if (salesWithLogs.includes(sale.id))
sale.$hasLogs = true;
}
return sales;

View File

@ -211,7 +211,8 @@
vn-none
vn-tooltip="History"
icon="history"
ng-click="log.open()">
ng-click="log.open()"
ng-show="sale.$hasLogs">
</vn-icon-button>
<vn-instance-log
vn-id="log"