diff --git a/client/client/src/credit-insurance/index/index.html b/client/client/src/credit-insurance/index/index.html index b285d3629..9a56ec1a8 100644 --- a/client/client/src/credit-insurance/index/index.html +++ b/client/client/src/credit-insurance/index/index.html @@ -34,7 +34,7 @@ - + diff --git a/client/client/src/credit-insurance/index/locale/es.yml b/client/client/src/credit-insurance/index/locale/es.yml index 731fe3c2a..1262a5dd4 100644 --- a/client/client/src/credit-insurance/index/locale/es.yml +++ b/client/client/src/credit-insurance/index/locale/es.yml @@ -2,5 +2,6 @@ Contract credit insurance: Contratos de seguro de crédito New contract: Nuevo contrato Close contract: Cerrar contrato Edit contract: Modificar contrato -List classifications: Ver clasificaciones -Are you sure you want to close this contract?: ¿Seguro que quieres cerrar este contrato? \ No newline at end of file +View credits: Ver créditos +Are you sure you want to close this contract?: ¿Seguro que quieres cerrar este contrato? +Grade: Grado \ No newline at end of file diff --git a/client/client/src/credit-insurance/insurance/create/index.html b/client/client/src/credit-insurance/insurance/create/index.html index 49aae53ae..77465eb91 100644 --- a/client/client/src/credit-insurance/insurance/create/index.html +++ b/client/client/src/credit-insurance/insurance/create/index.html @@ -8,7 +8,7 @@
- New classification + New credit + \ No newline at end of file diff --git a/client/client/src/credit-insurance/insurance/create/index.js b/client/client/src/credit-insurance/insurance/create/index.js index 43cb1ccce..51feab0f5 100644 --- a/client/client/src/credit-insurance/insurance/create/index.js +++ b/client/client/src/credit-insurance/insurance/create/index.js @@ -1,15 +1,14 @@ import ngModule from '../../../module'; class Controller { - constructor($state, $filter) { + constructor($filter) { this.insurance = { created: $filter('date')(new Date(), 'yyyy-MM-dd HH:mm') }; - this.classificationId = $state.params.classificationId; } } -Controller.$inject = ['$state', '$filter']; +Controller.$inject = ['$filter']; ngModule.component('vnClientCreditInsuranceInsuranceCreate', { template: require('./index.html'), diff --git a/client/client/src/credit-insurance/insurance/create/locale/es.yml b/client/client/src/credit-insurance/insurance/create/locale/es.yml index be5810643..4c9b75dea 100644 --- a/client/client/src/credit-insurance/insurance/create/locale/es.yml +++ b/client/client/src/credit-insurance/insurance/create/locale/es.yml @@ -1 +1 @@ -New classification: Nueva clasificación \ No newline at end of file +New credit: Nuevo crédito \ No newline at end of file diff --git a/client/client/src/credit-insurance/insurance/index/index.html b/client/client/src/credit-insurance/insurance/index/index.html index 9380b4303..b5c42326a 100644 --- a/client/client/src/credit-insurance/insurance/index/index.html +++ b/client/client/src/credit-insurance/insurance/index/index.html @@ -1,31 +1,38 @@ - + Requested credits - - - - - - - - {{::insurance.credit}} - {{::insurance.grade}} - {{::insurance.created | date: 'dd/MM/yyyy'}} - - - No results - + + + + + + + + + + + + + + + + + + +
CreditGradeCreated
{{::insurance.credit | currency: '€': 2}}{{::insurance.grade}}{{::insurance.created | date: 'dd/MM/yyyy'}}
No results
+ + + -
+ fixed-bottom-right vn-tooltip="New credit" vn-bind="+" ng-if="!$ctrl.isClosed"> \ No newline at end of file diff --git a/client/client/src/locale/es.yml b/client/client/src/locale/es.yml index d6e498802..79af548b1 100644 --- a/client/client/src/locale/es.yml +++ b/client/client/src/locale/es.yml @@ -21,3 +21,4 @@ Credit contracts: Contratos de crédito Verified data: Datos comprobados Mandate: Mandato Amount: Importe +Back: Volver \ No newline at end of file diff --git a/services/client/common/methods/credit-insurance/filter.js b/services/client/common/methods/credit-insurance/filter.js deleted file mode 100644 index 033afae7a..000000000 --- a/services/client/common/methods/credit-insurance/filter.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = Self => { - Self.installMethod('filter', filterParams); - - function filterParams(params) { - return { - where: { - creditClassification: params.creditClassificationFk - }, - skip: (params.page - 1) * params.size, - limit: params.size, - order: params.order - }; - } -}; diff --git a/services/client/common/models/credit-insurance.js b/services/client/common/models/credit-insurance.js index 653c7e2fd..20a832ee2 100644 --- a/services/client/common/models/credit-insurance.js +++ b/services/client/common/models/credit-insurance.js @@ -1,6 +1,4 @@ module.exports = function(Self) { - require('../methods/credit-insurance/filter')(Self); - Self.validateCredit = function(credit) { return credit >= 0; }; @@ -20,6 +18,26 @@ module.exports = function(Self) { allowNull: true }); + async function validateNullGrade(err, done) { + let filter = { + fields: ['grade'], + where: { + creditClassification: this.creditClassification + }, + order: 'created DESC' + }; + let insurance = await Self.findOne(filter); + + if (insurance && (!insurance.grade && this.grade || insurance.grade && ! this.grade)) + err(); + + done(); + } + + Self.validateAsync('nullGrade', validateNullGrade, { + message: 'The grade must be similar to the last one' + }); + Self.messageSend = async function(data, accessToken) { let filter = { include: { diff --git a/services/loopback/common/locale/es.json b/services/loopback/common/locale/es.json index caf866ca5..48c0ec819 100644 --- a/services/loopback/common/locale/es.json +++ b/services/loopback/common/locale/es.json @@ -18,6 +18,7 @@ "That payment method requires an IBAN": "El método de pago seleccionado requiere que se especifique el IBAN", "State cannot be blank": "El estado no puede estar en blanco", "Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado", - "EXPIRED_DATE": "EXPIRED_DATE", - "NO_AGENCY_AVAILABLE": "NO_AGENCY_AVAILABLE" + "NO_AGENCY_AVAILABLE": "NO_AGENCY_AVAILABLE", + "The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero", + "The grade must be similar to the last one": "El grado debe ser similar al último crédito" } \ No newline at end of file diff --git a/services/loopback/server/server.js b/services/loopback/server/server.js index 294500854..012dd21b7 100644 --- a/services/loopback/server/server.js +++ b/services/loopback/server/server.js @@ -75,7 +75,7 @@ function vnBoot(app, rootDir, rootModule) { let packageJson = require(`${rootDir}/../package.json`); let appName = packageJson.name; let baseUrl = app.get('url').replace(/\/$/, ''); - console.log(`Web server ${appName} listening at: %s`, baseUrl); + console.log(`Web server ${appName} listening at: %s`, `${baseUrl}/explorer`); } let args = port ? [port, onListen] : [onListen];