diff --git a/client/client/src/credit-insurance/create/index.html b/client/client/src/credit-insurance/create/index.html
index b37ed2c9a0..38c598601d 100644
--- a/client/client/src/credit-insurance/create/index.html
+++ b/client/client/src/credit-insurance/create/index.html
@@ -6,7 +6,7 @@
vn-one
label="Credit"
model="$ctrl.creditClassification.credit",
- rule="CreditInsurance.credit"
+ rule="creditInsurance.credit"
step="1"
vn-focus>
@@ -20,7 +20,7 @@
vn-one
label="Since"
model="$ctrl.creditClassification.started"
- ini-options="{dateFormat: 'd-m-Y'}">
+ ini-options="{enableTime: true, dateFormat: 'd-m-Y', time_24hr: true}">
diff --git a/client/client/src/credit-insurance/create/index.js b/client/client/src/credit-insurance/create/index.js
index 81ab7c67da..221580b27a 100644
--- a/client/client/src/credit-insurance/create/index.js
+++ b/client/client/src/credit-insurance/create/index.js
@@ -14,7 +14,7 @@ class Controller {
submit() {
if (this.$scope.form.$invalid)
- return this.vnApp.showMessage(this.$translate.instant('Some fields are invalid'));
+ return this.vnApp.showError(this.$translate.instant('Some fields are invalid'));
let query = `/client/api/creditClassifications/createWithInsurance`;
let data = this.creditClassification;
diff --git a/client/client/src/credit-insurance/index/credit-insurance-index.spec.js b/client/client/src/credit-insurance/index/credit-insurance-index.spec.js
index 74cf9f789d..19128c8216 100644
--- a/client/client/src/credit-insurance/index/credit-insurance-index.spec.js
+++ b/client/client/src/credit-insurance/index/credit-insurance-index.spec.js
@@ -20,7 +20,7 @@ describe('Client', () => {
describe('_getClassifications()', () => {
it('should perform a GET query to define the classifications property in the controller', () => {
let res = ['some classifications'];
- let query = '/client/api/CreditClassifications?filter=%7B%22order%22%3A%22finished%20ASC%2C%20started%20DESC%22%2C%22include%22%3A%5B%7B%22relation%22%3A%22creditInsurances%22%2C%22scope%22%3A%7B%22fields%22%3A%5B%22id%22%2C%22credit%22%2C%22created%22%2C%22grade%22%5D%2C%22order%22%3A%22created%20DESC%22%2C%22limit%22%3A2%7D%7D%5D%2C%22where%22%3A%7B%7D%7D';
+ let query = '/client/api/CreditClassifications?filter=%7B%22order%22%3A%22finished%20ASC%2C%20started%20DESC%22%2C%22include%22%3A%5B%7B%22relation%22%3A%22insurances%22%2C%22scope%22%3A%7B%22fields%22%3A%5B%22id%22%2C%22credit%22%2C%22created%22%2C%22grade%22%5D%2C%22order%22%3A%22created%20DESC%22%2C%22limit%22%3A2%7D%7D%5D%2C%22where%22%3A%7B%7D%7D';
$httpBackend.whenGET(query).respond(res);
$httpBackend.expectGET(query);
diff --git a/client/client/src/credit-insurance/index/index.html b/client/client/src/credit-insurance/index/index.html
index 69ee6cb745..b8c2480c58 100644
--- a/client/client/src/credit-insurance/index/index.html
+++ b/client/client/src/credit-insurance/index/index.html
@@ -15,7 +15,7 @@
To {{classification.finished | date:'dd/MM/yyyy'}}
-
+
diff --git a/client/client/src/credit-insurance/index/index.js b/client/client/src/credit-insurance/index/index.js
index cee5a20b27..6d6994a9a2 100644
--- a/client/client/src/credit-insurance/index/index.js
+++ b/client/client/src/credit-insurance/index/index.js
@@ -17,7 +17,7 @@ class Controller {
order: 'finished ASC, started DESC',
include: [
{
- relation: 'creditInsurances',
+ relation: 'insurances',
scope: {
fields: ['id', 'credit', 'created', 'grade'],
order: 'created DESC',
diff --git a/client/client/src/credit-insurance/insurance/create/index.html b/client/client/src/credit-insurance/insurance/create/index.html
index 77465eb917..f2f9efef38 100644
--- a/client/client/src/credit-insurance/insurance/create/index.html
+++ b/client/client/src/credit-insurance/insurance/create/index.html
@@ -1,4 +1,4 @@
-
+
+ ini-options="{enableTime: true, dateFormat: 'd-m-Y', time_24hr: true}">
diff --git a/client/client/src/credit-insurance/insurance/create/index.js b/client/client/src/credit-insurance/insurance/create/index.js
index 51feab0f56..5f615bdb25 100644
--- a/client/client/src/credit-insurance/insurance/create/index.js
+++ b/client/client/src/credit-insurance/insurance/create/index.js
@@ -3,7 +3,7 @@ import ngModule from '../../../module';
class Controller {
constructor($filter) {
this.insurance = {
- created: $filter('date')(new Date(), 'yyyy-MM-dd HH:mm')
+ created: $filter('date')(new Date(), 'yyyy-MM-dd HH:mm:ss')
};
}
}
diff --git a/client/client/src/credit-insurance/insurance/index/index.html b/client/client/src/credit-insurance/insurance/index/index.html
index b5c42326a3..0190e9eec6 100644
--- a/client/client/src/credit-insurance/insurance/index/index.html
+++ b/client/client/src/credit-insurance/insurance/index/index.html
@@ -1,4 +1,4 @@
-
+
diff --git a/client/client/src/summary/index.html b/client/client/src/summary/index.html
index 5767f48c7d..fda4ebe041 100644
--- a/client/client/src/summary/index.html
+++ b/client/client/src/summary/index.html
@@ -199,9 +199,16 @@
-
-
+
+
+
+
+
+
+ {{$ctrl.grade ? ' / ' + $ctrl.grade : ' / - '}}
+
+
diff --git a/client/client/src/summary/index.js b/client/client/src/summary/index.js
index a8a54b55ac..8c1986bd69 100644
--- a/client/client/src/summary/index.js
+++ b/client/client/src/summary/index.js
@@ -11,8 +11,12 @@ class Controller {
return;
this.$http.get(`/client/api/Clients/${this.client.id}/summary`).then(res => {
- if (res && res.data)
+ if (res && res.data) {
this.summary = res.data;
+
+ if (res.data.classifications.length)
+ this.grade = res.data.classifications[0].insurances[0].grade;
+ }
});
}
}
diff --git a/client/item/src/barcode/barcode.spec.js b/client/item/src/barcode/barcode.spec.js
index 585af2d713..06adc75da3 100644
--- a/client/item/src/barcode/barcode.spec.js
+++ b/client/item/src/barcode/barcode.spec.js
@@ -88,7 +88,7 @@ describe('Item', () => {
describe('submit()', () => {
it("should return an error message 'The barcode must be unique' when the code isnt unique", () => {
- spyOn(controller.vnApp, 'showMessage').and.callThrough();
+ spyOn(controller.vnApp, 'showError').and.callThrough();
controller.barcodes = [
{code: 123454, itemFk: 1, id: 1},
{code: 123454, itemFk: 1}
@@ -96,7 +96,7 @@ describe('Item', () => {
controller.oldBarcodes = {1: {id: 1, code: 123454, itemFk: 1}};
controller.submit();
- expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The barcode must be unique');
+ expect(controller.vnApp.showError).toHaveBeenCalledWith('The barcode must be unique');
});
it("should perfom a query to delete barcodes", () => {
@@ -131,7 +131,7 @@ describe('Item', () => {
});
it("should return a message 'No changes to save' when there are no changes to apply", () => {
- spyOn(controller.vnApp, 'showMessage').and.callThrough();
+ spyOn(controller.vnApp, 'showError').and.callThrough();
controller.oldBarcodes = [
{code: 1, itemFk: 1, id: 1},
{code: 2, itemFk: 1, id: 2}
@@ -139,7 +139,7 @@ describe('Item', () => {
controller.barcodes = [];
controller.submit();
- expect(controller.vnApp.showMessage).toHaveBeenCalledWith('No changes to save');
+ expect(controller.vnApp.showError).toHaveBeenCalledWith('No changes to save');
});
});
});
diff --git a/client/item/src/barcode/index.js b/client/item/src/barcode/index.js
index 3e31cab81f..b1bbab3f4f 100644
--- a/client/item/src/barcode/index.js
+++ b/client/item/src/barcode/index.js
@@ -86,7 +86,7 @@ export default class Controller {
}
if (repeatedBarcodes) {
- return this.vnApp.showMessage(this.$translate.instant('The barcode must be unique'));
+ return this.vnApp.showError(this.$translate.instant('The barcode must be unique'));
}
canSubmit = barcodesObj.update.length > 0 || barcodesObj.create.length > 0 || barcodesObj.delete.length > 0;
@@ -98,7 +98,7 @@ export default class Controller {
this.$scope.watcher.notifySaved();
});
}
- this.vnApp.showMessage(this.$translate.instant('No changes to save'));
+ this.vnApp.showError(this.$translate.instant('No changes to save'));
}
setOldBarcodes(response) {
diff --git a/client/item/src/niche/index.js b/client/item/src/niche/index.js
index 9fec4ba91e..f483fb1f9b 100644
--- a/client/item/src/niche/index.js
+++ b/client/item/src/niche/index.js
@@ -122,11 +122,11 @@ export default class Controller {
});
if (this.$scope.form.$invalid) {
- return this.vnApp.showMessage(this.$translate.instant('Some fields are invalid'));
+ return this.vnApp.showError(this.$translate.instant('Some fields are invalid'));
}
if (repeatedWarehouse) {
- return this.vnApp.showMessage(this.$translate.instant('The niche must be unique'));
+ return this.vnApp.showError(this.$translate.instant('The niche must be unique'));
}
canSubmit = nichesObj.update.length > 0 || nichesObj.create.length > 0 || nichesObj.delete.length > 0;
@@ -138,7 +138,7 @@ export default class Controller {
this.$scope.watcher.notifySaved();
});
}
- this.vnApp.showMessage(this.$translate.instant('No changes to save'));
+ this.vnApp.showError(this.$translate.instant('No changes to save'));
}
}
diff --git a/client/item/src/niche/niche.spec.js b/client/item/src/niche/niche.spec.js
index d3b91be9e5..0309d2535c 100644
--- a/client/item/src/niche/niche.spec.js
+++ b/client/item/src/niche/niche.spec.js
@@ -98,7 +98,7 @@ describe('Item', () => {
describe('submit()', () => {
it("should return an error message 'The niche must be unique' when the niche warehouse isnt unique", () => {
controller.$scope.form = {};
- spyOn(controller.vnApp, 'showMessage').and.callThrough();
+ spyOn(controller.vnApp, 'showError').and.callThrough();
controller.niches = [
{warehouseFk: 1, code: 123454, itemFk: 1, id: 1},
{warehouseFk: 1, code: 123454, itemFk: 1}
@@ -106,7 +106,7 @@ describe('Item', () => {
controller.oldNiches = {1: {warehouseFk: 1, id: 1, code: 123454, itemFk: 1}};
controller.submit();
- expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The niche must be unique');
+ expect(controller.vnApp.showError).toHaveBeenCalledWith('The niche must be unique');
});
it("should perfom a query to delete niches", () => {
@@ -144,7 +144,7 @@ describe('Item', () => {
it("should return a message 'No changes to save' when there are no changes to apply", () => {
controller.$scope.form = {$setPristine: () => {}};
- spyOn(controller.vnApp, 'showMessage').and.callThrough();
+ spyOn(controller.vnApp, 'showError').and.callThrough();
controller.oldNiches = [
{warehouseFk: 1, code: 1, itemFk: 1, id: 1},
{warehouseFk: 2, code: 2, itemFk: 1, id: 2}
@@ -152,7 +152,7 @@ describe('Item', () => {
controller.niches = [];
controller.submit();
- expect(controller.vnApp.showMessage).toHaveBeenCalledWith('No changes to save');
+ expect(controller.vnApp.showError).toHaveBeenCalledWith('No changes to save');
});
});
});
diff --git a/client/item/src/tags/tags.spec.js b/client/item/src/tags/tags.spec.js
index 41e2380a61..5b3049809d 100644
--- a/client/item/src/tags/tags.spec.js
+++ b/client/item/src/tags/tags.spec.js
@@ -132,7 +132,7 @@ describe('Item', () => {
// TODO: Server validation should be implemented
xit("should return an error message 'The tag must be unique' when the tag value isnt unique", () => {
controller.$.form = [];
- spyOn(controller.vnApp, 'showMessage').and.callThrough();
+ spyOn(controller.vnApp, 'showError').and.callThrough();
controller.tags = [
{typeFk: 1, value: 123454, itemFk: 1, id: 1},
{typeFk: 1, value: 123454, itemFk: 1}
@@ -140,7 +140,7 @@ describe('Item', () => {
controller.orgTags = {1: {typeFk: 1, id: 1, value: 123454, itemFk: 1}};
controller.submit();
- expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The tag must be unique');
+ expect(controller.vnApp.showError).toHaveBeenCalledWith('The tag must be unique');
});
it("should perfom a query to delete tags", () => {
diff --git a/client/item/src/tax/index.js b/client/item/src/tax/index.js
index 9ad2ad5923..5e5e108f1c 100644
--- a/client/item/src/tax/index.js
+++ b/client/item/src/tax/index.js
@@ -29,7 +29,7 @@ export default class Controller {
let url = `/item/api/Items/${this.$stateParams.id}/updateTaxes`;
this.$http.post(url, data).then(
- () => this.vnApp.showMessage(this._.instant('Data saved!'))
+ () => this.vnApp.showSuccess(this._.instant('Data saved!'))
);
}
}
diff --git a/client/ticket/src/note/index.js b/client/ticket/src/note/index.js
index 8c2c602c9d..ff9eef7b37 100644
--- a/client/ticket/src/note/index.js
+++ b/client/ticket/src/note/index.js
@@ -106,11 +106,11 @@ class Controller {
});
if (this.$scope.form.$invalid) {
- return this.vnApp.showMessage(this.$translate.instant('Some fields are invalid'));
+ return this.vnApp.showError(this.$translate.instant('Some fields are invalid'));
}
if (repeatedType) {
- return this.vnApp.showMessage(this.$translate.instant('The observation type must be unique'));
+ return this.vnApp.showError(this.$translate.instant('The observation type must be unique'));
}
canSubmit = observationsObj.update.length > 0 || observationsObj.create.length > 0 || observationsObj.delete.length > 0;
@@ -122,7 +122,7 @@ class Controller {
this.$scope.watcher.notifySaved();
});
}
- this.vnApp.showMessage(this.$translate.instant('No changes to save'));
+ this.vnApp.showError(this.$translate.instant('No changes to save'));
}
$onInit() {
diff --git a/client/ticket/src/note/ticket-observation.spec.js b/client/ticket/src/note/ticket-observation.spec.js
index f1bbbdd0b9..fc2681375d 100644
--- a/client/ticket/src/note/ticket-observation.spec.js
+++ b/client/ticket/src/note/ticket-observation.spec.js
@@ -90,7 +90,7 @@ describe('ticket', () => {
it("should return an error message 'Some fields are invalid'", () => {
controller.$scope.form = {};
controller.$scope.form.$invalid = true;
- spyOn(controller.vnApp, 'showMessage').and.callThrough();
+ spyOn(controller.vnApp, 'showError').and.callThrough();
controller.ticketObservations = [
{id: 1, observationTypeFk: 1, description: 'one', itemFk: 1},
{observationTypeFk: 1, description: 'one', itemFk: 1}
@@ -98,12 +98,12 @@ describe('ticket', () => {
controller.oldObservations = {1: {id: 1, observationTypeFk: 1, description: 'one', itemFk: 1}};
controller.submit();
- expect(controller.vnApp.showMessage).toHaveBeenCalledWith('Some fields are invalid');
+ expect(controller.vnApp.showError).toHaveBeenCalledWith('Some fields are invalid');
});
it("should return an error message 'The observation type must be unique'", () => {
controller.$scope.form = {};
- spyOn(controller.vnApp, 'showMessage').and.callThrough();
+ spyOn(controller.vnApp, 'showError').and.callThrough();
controller.ticketObservations = [
{id: 1, observationTypeFk: 1, description: 'one', itemFk: 1},
{observationTypeFk: 1, description: 'one', itemFk: 1}
@@ -111,7 +111,7 @@ describe('ticket', () => {
controller.oldObservations = {1: {id: 1, observationTypeFk: 1, description: 'one', itemFk: 1}};
controller.submit();
- expect(controller.vnApp.showMessage).toHaveBeenCalledWith('The observation type must be unique');
+ expect(controller.vnApp.showError).toHaveBeenCalledWith('The observation type must be unique');
});
it("should perfom a query to delete observations", () => {
@@ -149,7 +149,7 @@ describe('ticket', () => {
it("should return a message 'No changes to save' when there are no changes to apply", () => {
controller.$scope.form = {$setPristine: () => {}};
- spyOn(controller.vnApp, 'showMessage').and.callThrough();
+ spyOn(controller.vnApp, 'showError').and.callThrough();
controller.oldObservations = [
{id: 1, observationTypeFk: 1, description: 'one', showAddIcon: false},
{id: 2, observationTypeFk: 2, description: 'two', showAddIcon: true}
@@ -157,7 +157,7 @@ describe('ticket', () => {
controller.ticketObservations = [];
controller.submit();
- expect(controller.vnApp.showMessage).toHaveBeenCalledWith('No changes to save');
+ expect(controller.vnApp.showError).toHaveBeenCalledWith('No changes to save');
});
});
});
diff --git a/client/ticket/src/package/index.js b/client/ticket/src/package/index.js
index a3f1119f96..c26be3d212 100644
--- a/client/ticket/src/package/index.js
+++ b/client/ticket/src/package/index.js
@@ -26,10 +26,10 @@ class Controller {
});
if (this.$.form.$invalid)
- return this.vnApp.showMessage(this.$translate.instant('Some fields are invalid'));
+ return this.vnApp.showError(this.$translate.instant('Some fields are invalid'));
if (!this.hasChanges(packagesObj))
- return this.vnApp.showMessage(this.$translate.instant('No changes to save'));
+ return this.vnApp.showError(this.$translate.instant('No changes to save'));
this.$http.post(query, packagesObj).then(res => {
this.$.index.accept();
diff --git a/services/client/common/models/credit-classification.json b/services/client/common/models/credit-classification.json
index 51bda330ad..2e636af63c 100644
--- a/services/client/common/models/credit-classification.json
+++ b/services/client/common/models/credit-classification.json
@@ -33,7 +33,7 @@
"model": "Client",
"foreignKey": "client"
},
- "creditInsurances": {
+ "insurances": {
"type": "hasMany",
"model": "CreditInsurance",
"foreignKey": "creditClassification"
diff --git a/services/loopback/common/methods/client/summary.js b/services/loopback/common/methods/client/summary.js
index 95cecbc9d4..ab07320323 100644
--- a/services/loopback/common/methods/client/summary.js
+++ b/services/loopback/common/methods/client/summary.js
@@ -47,6 +47,19 @@ module.exports = Self => {
where: {isDefaultAddress: true},
fields: ['nickname', 'street', 'city', 'postalCode']
}
+ },
+ {
+ relation: 'classifications',
+ scope: {
+ include: {
+ relation: 'insurances',
+ scope: {
+ fields: ['id', 'grade', 'created'],
+ order: 'created DESC'
+ }
+ },
+ where: {finished: null}
+ }
}
],
where: {id: clientId}
diff --git a/services/loopback/common/models/client.json b/services/loopback/common/models/client.json
index 4c7d4d31b8..d80e31d9e4 100644
--- a/services/loopback/common/models/client.json
+++ b/services/loopback/common/models/client.json
@@ -160,7 +160,7 @@
"model": "Greuge",
"foreignKey": "clientFk"
},
- "creditClassifications": {
+ "classifications": {
"type": "hasMany",
"model": "CreditClassification",
"foreignKey": "client"