diff --git a/CHANGELOG.md b/CHANGELOG.md
index aa63ad637..17259f545 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
-
diff --git a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
index 9d6fddbe6..9e4898be9 100644
--- a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
+++ b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
@@ -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);
diff --git a/e2e/paths/05-ticket/18_index_payout.spec.js b/e2e/paths/05-ticket/18_index_payout.spec.js
index 89b5937a1..220dacf61 100644
--- a/e2e/paths/05-ticket/18_index_payout.spec.js
+++ b/e2e/paths/05-ticket/18_index_payout.spec.js
@@ -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');
});
});
diff --git a/loopback/common/methods/application/post.js b/loopback/common/methods/application/post.js
index 9ea9a7f71..739f1341a 100644
--- a/loopback/common/methods/application/post.js
+++ b/loopback/common/methods/application/post.js
@@ -12,6 +12,7 @@ module.exports = Self => {
});
Self.post = async ctx => {
+ console.log(ctx.req.body);
return ctx.req.body;
};
};
diff --git a/modules/claim/back/methods/claim/filter.js b/modules/claim/back/methods/claim/filter.js
index d653229e5..2daee6413 100644
--- a/modules/claim/back/methods/claim/filter.js
+++ b/modules/claim/back/methods/claim/filter.js
@@ -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
diff --git a/modules/claim/back/models/claim.json b/modules/claim/back/models/claim.json
index 14c4f3452..cd5b767e4 100644
--- a/modules/claim/back/models/claim.json
+++ b/modules/claim/back/models/claim.json
@@ -77,6 +77,11 @@
"type": "belongsTo",
"model": "Ticket",
"foreignKey": "ticketFk"
- }
+ },
+ "claimDms": {
+ "type": "hasMany",
+ "model": "ClaimDms",
+ "foreignKey": "claimFk"
+ }
}
}
diff --git a/modules/claim/front/index/index.html b/modules/claim/front/index/index.html
index 102e27245..6b2481429 100644
--- a/modules/claim/front/index/index.html
+++ b/modules/claim/front/index/index.html
@@ -52,8 +52,8 @@
-
- {{::claim.description}}
+
+ {{::claim.stateDescription}}
|
diff --git a/modules/claim/front/index/index.js b/modules/claim/front/index/index.js
index 084618e16..e3fdabf79 100644
--- a/modules/claim/front/index/index.js
+++ b/modules/claim/front/index/index.js
@@ -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';
}
}
diff --git a/modules/client/back/methods/client/getCard.js b/modules/client/back/methods/client/getCard.js
index afbe36e49..99c59f757 100644
--- a/modules/client/back/methods/client/getCard.js
+++ b/modules/client/back/methods/client/getCard.js
@@ -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;
};
diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js
index ef22c968a..cc9e1ab5a 100644
--- a/modules/client/front/balance/create/index.js
+++ b/modules/client/front/balance/create/index.js
@@ -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;
diff --git a/modules/client/front/balance/create/index.spec.js b/modules/client/front/balance/create/index.spec.js
index 408e6b66a..fa6b48ea4 100644
--- a/modules/client/front/balance/create/index.spec.js
+++ b/modules/client/front/balance/create/index.spec.js
@@ -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');
});
});
diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html
index ef5c2997f..edf3cc8c3 100644
--- a/modules/client/front/descriptor/index.html
+++ b/modules/client/front/descriptor/index.html
@@ -18,26 +18,26 @@
+ info="Invoices minus payments plus orders not yet invoiced">
-
{{$ctrl.client.salesPersonUser.name}}
@@ -70,6 +70,11 @@
icon="icon-no036"
ng-if="$ctrl.client.isTaxDataChecked == false">
+
+
@@ -118,7 +123,7 @@
on-send="$ctrl.onSmsSend($sms)"
sms="$ctrl.newSMS">
-
diff --git a/modules/client/front/descriptor/index.js b/modules/client/front/descriptor/index.js
index 4d8d70edf..86e8f4e61 100644
--- a/modules/client/front/descriptor/index.js
+++ b/modules/client/front/descriptor/index.js
@@ -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}) +
+ ' ' + this.$t(`Unpaid Amount`, {amount: this.client.unpaid.amount});
+ }
}
ngModule.vnComponent('vnClientDescriptor', {
diff --git a/modules/client/front/descriptor/locale/es.yml b/modules/client/front/descriptor/locale/es.yml
index 71723e654..85ae5b4a6 100644
--- a/modules/client/front/descriptor/locale/es.yml
+++ b/modules/client/front/descriptor/locale/es.yml
@@ -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
\ No newline at end of file
+Pay method: Forma de pago
+Unpaid Dated: "Fecha: {{dated | date:'dd/MM/yyyy'}}"
+Unpaid Amount: "Importe: {{amount | currency: 'EUR':2}}"
diff --git a/modules/client/front/sample/create/index.js b/modules/client/front/sample/create/index.js
index 13ef875da..b25bf7919 100644
--- a/modules/client/front/sample/create/index.js
+++ b/modules/client/front/sample/create/index.js
@@ -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
+ };
});
}
}
diff --git a/modules/client/front/sample/create/index.spec.js b/modules/client/front/sample/create/index.spec.js
index 8e33a1075..ecaf038fa 100644
--- a/modules/client/front/sample/create/index.spec.js
+++ b/modules/client/front/sample/create/index.spec.js
@@ -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);
});
});
});
diff --git a/modules/ticket/back/methods/ticket/getSales.js b/modules/ticket/back/methods/ticket/getSales.js
index 3e45b3fb5..321e8e24e 100644
--- a/modules/ticket/back/methods/ticket/getSales.js
+++ b/modules/ticket/back/methods/ticket/getSales.js
@@ -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;
diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html
index fd259e120..8764417a8 100644
--- a/modules/ticket/front/sale/index.html
+++ b/modules/ticket/front/sale/index.html
@@ -211,7 +211,8 @@
vn-none
vn-tooltip="History"
icon="history"
- ng-click="log.open()">
+ ng-click="log.open()"
+ ng-show="sale.$hasLogs">
|