Merge pull request '2995-supplierAccount-modificaciones' (#714) from 2995-supplierAccount-modificaciones into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #714 Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
commit
352f214f6f
|
@ -0,0 +1 @@
|
|||
DROP TRIGGER vn.supplierAccount_AfterInsert;
|
|
@ -219,11 +219,12 @@ UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23;
|
|||
|
||||
INSERT INTO `vn`.`payMethod`(`id`,`code`, `name`, `graceDays`, `outstandingDebt`, `ibanRequired`)
|
||||
VALUES
|
||||
(1, NULL, 'PayMethod one', 0, 001, 0),
|
||||
(2, NULL, 'PayMethod two', 10, 001, 0),
|
||||
(3, 'compensation', 'PayMethod three', 0, 001, 0),
|
||||
(4, NULL, 'PayMethod with IBAN', 0, 001, 1),
|
||||
(5, NULL, 'PayMethod five', 10, 001, 0);
|
||||
(1, NULL, 'PayMethod one', 0, 001, 0),
|
||||
(2, NULL, 'PayMethod two', 10, 001, 0),
|
||||
(3, 'compensation', 'PayMethod three', 0, 001, 0),
|
||||
(4, NULL, 'PayMethod with IBAN', 0, 001, 1),
|
||||
(5, NULL, 'PayMethod five', 10, 001, 0),
|
||||
(8,'wireTransfer', 'WireTransfer', 5, 001, 1);
|
||||
|
||||
INSERT INTO `vn`.`payDem`(`id`, `payDem`)
|
||||
VALUES
|
||||
|
|
|
@ -1,183 +1,8 @@
|
|||
{
|
||||
"name": "salix-front",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "salix-front",
|
||||
"version": "1.0.0",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@uirouter/angularjs": "^1.0.20",
|
||||
"angular": "^1.7.5",
|
||||
"angular-animate": "^1.7.8",
|
||||
"angular-moment": "^1.3.0",
|
||||
"angular-translate": "^2.18.1",
|
||||
"angular-translate-loader-partial": "^2.18.1",
|
||||
"croppie": "^2.6.5",
|
||||
"js-yaml": "^3.13.1",
|
||||
"mg-crud": "^1.1.2",
|
||||
"oclazyload": "^0.6.3",
|
||||
"require-yaml": "0.0.1",
|
||||
"validator": "^6.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@uirouter/angularjs": {
|
||||
"version": "1.0.29",
|
||||
"resolved": "https://registry.npmjs.org/@uirouter/angularjs/-/angularjs-1.0.29.tgz",
|
||||
"integrity": "sha512-RImWnBarNixkMto0o8stEaGwZmvhv5cnuOLXyMU2pY8MP2rgEF74ZNJTLeJCW14LR7XDUxVH8Mk8bPI6lxedmQ==",
|
||||
"dependencies": {
|
||||
"@uirouter/core": "6.0.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@uirouter/core": {
|
||||
"version": "6.0.7",
|
||||
"resolved": "https://registry.npmjs.org/@uirouter/core/-/core-6.0.7.tgz",
|
||||
"integrity": "sha512-KUTJxL+6q0PiBnFx4/Z+Hsyg0pSGiaW5yZQeJmUxknecjpTbnXkLU8H2EqRn9N2B+qDRa7Jg8RcgeNDPY72O1w==",
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/angular": {
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/angular/-/angular-1.8.2.tgz",
|
||||
"integrity": "sha512-IauMOej2xEe7/7Ennahkbb5qd/HFADiNuLSESz9Q27inmi32zB0lnAsFeLEWcox3Gd1F6YhNd1CP7/9IukJ0Gw=="
|
||||
},
|
||||
"node_modules/angular-animate": {
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/angular-animate/-/angular-animate-1.8.2.tgz",
|
||||
"integrity": "sha512-Jbr9+grNMs9Kj57xuBU3Ju3NOPAjS1+g2UAwwDv7su1lt0/PLDy+9zEwDiu8C8xJceoTbmBNKiWGPJGBdCQLlA=="
|
||||
},
|
||||
"node_modules/angular-moment": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/angular-moment/-/angular-moment-1.3.0.tgz",
|
||||
"integrity": "sha512-KG8rvO9MoaBLwtGnxTeUveSyNtrL+RNgGl1zqWN36+HDCCVGk2DGWOzqKWB6o+eTTbO3Opn4hupWKIElc8XETA==",
|
||||
"dependencies": {
|
||||
"moment": ">=2.8.0 <3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/angular-translate": {
|
||||
"version": "2.18.4",
|
||||
"resolved": "https://registry.npmjs.org/angular-translate/-/angular-translate-2.18.4.tgz",
|
||||
"integrity": "sha512-KohNrkH6J9PK+VW0L/nsRTcg5Fw70Ajwwe3Jbfm54Pf9u9Fd+wuingoKv+h45mKf38eT+Ouu51FPua8VmZNoCw==",
|
||||
"dependencies": {
|
||||
"angular": "^1.8.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/angular-translate-loader-partial": {
|
||||
"version": "2.18.4",
|
||||
"resolved": "https://registry.npmjs.org/angular-translate-loader-partial/-/angular-translate-loader-partial-2.18.4.tgz",
|
||||
"integrity": "sha512-bsjR+FbB0sdA2528E/ugwKdlPPQhA1looxLxI3otayBTFXBpED33besfSZhYAISLgNMSL038vSssfRUen9qD8w==",
|
||||
"dependencies": {
|
||||
"angular-translate": "~2.18.4"
|
||||
}
|
||||
},
|
||||
"node_modules/argparse": {
|
||||
"version": "1.0.10",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||
"dependencies": {
|
||||
"sprintf-js": "~1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/croppie": {
|
||||
"version": "2.6.5",
|
||||
"resolved": "https://registry.npmjs.org/croppie/-/croppie-2.6.5.tgz",
|
||||
"integrity": "sha512-IlChnVUGG5T3w2gRZIaQgBtlvyuYnlUWs2YZIXXR3H9KrlO1PtBT3j+ykxvy9eZIWhk+V5SpBmhCQz5UXKrEKQ=="
|
||||
},
|
||||
"node_modules/esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||
"bin": {
|
||||
"esparse": "bin/esparse.js",
|
||||
"esvalidate": "bin/esvalidate.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "3.14.1",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz",
|
||||
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==",
|
||||
"dependencies": {
|
||||
"argparse": "^1.0.7",
|
||||
"esprima": "^4.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"js-yaml": "bin/js-yaml.js"
|
||||
}
|
||||
},
|
||||
"node_modules/mg-crud": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/mg-crud/-/mg-crud-1.1.2.tgz",
|
||||
"integrity": "sha1-p6AWGzWSPK7/8ZpIBpS2V1vDggw=",
|
||||
"dependencies": {
|
||||
"angular": "^1.6.1"
|
||||
}
|
||||
},
|
||||
"node_modules/moment": {
|
||||
"version": "2.29.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/oclazyload": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/oclazyload/-/oclazyload-0.6.3.tgz",
|
||||
"integrity": "sha1-Kjirv/QJDAihEBZxkZRbWfLoJ5w="
|
||||
},
|
||||
"node_modules/require-yaml": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/require-yaml/-/require-yaml-0.0.1.tgz",
|
||||
"integrity": "sha1-LhsY2RPDuqcqWk03O28Tjd0sMr0=",
|
||||
"dependencies": {
|
||||
"js-yaml": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/require-yaml/node_modules/argparse": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
|
||||
},
|
||||
"node_modules/require-yaml/node_modules/js-yaml": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz",
|
||||
"integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==",
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"js-yaml": "bin/js-yaml.js"
|
||||
}
|
||||
},
|
||||
"node_modules/sprintf-js": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
|
||||
},
|
||||
"node_modules/validator": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/validator/-/validator-6.3.0.tgz",
|
||||
"integrity": "sha1-R84j7Y1Ord+p1LjvAHG2zxB418g=",
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@uirouter/angularjs": {
|
||||
"version": "1.0.29",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<vn-tr>
|
||||
<vn-th field="creationDate">Date</vn-th>
|
||||
<vn-th field="userFk" class="expendable" shrink>Author</vn-th>
|
||||
<vn-th field="changedModel" class="expendable" shrink>Model</vn-th>
|
||||
<vn-th field="changedModel" class="expendable">Model</vn-th>
|
||||
<vn-th field="action" class="expendable" shrink>Action</vn-th>
|
||||
<vn-th field="changedModelValue" class="expendable">Name</vn-th>
|
||||
<vn-th expand>Before</vn-th>
|
||||
|
@ -17,7 +17,7 @@
|
|||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="log in $ctrl.logs">
|
||||
<vn-td expand>
|
||||
<vn-td shrink-datetime>
|
||||
{{::log.creationDate | date:'dd/MM/yyyy HH:mm'}}
|
||||
<div class="changes">
|
||||
<div>
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"code": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th expand>Date</vn-th>
|
||||
<vn-th expand>Creation date</vn-th>
|
||||
<vn-th>Creation date</vn-th>
|
||||
<vn-th>Employee</vn-th>
|
||||
<vn-th>Reference</vn-th>
|
||||
<vn-th number>Bank</vn-th>
|
||||
|
@ -65,7 +65,7 @@
|
|||
{{::balance.payed | date:'dd/MM/yyyy'}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td expand>
|
||||
<vn-td shrink-datetime>
|
||||
<span title="{{::balance.created | date:'dd/MM/yyyy HH:mm'}}">
|
||||
{{::balance.created | date:'dd/MM/yyyy HH:mm'}}
|
||||
</span>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="credit in credits track by credit.id">
|
||||
<vn-td>{{::credit.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-td shrink-datetime>{{::credit.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-td>
|
||||
<span
|
||||
ng-click="workerDescriptor.show($event, credit.worker.userFk)"
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
<vn-th expand>Description</vn-th>
|
||||
<vn-th field="hasFile" shrink>Original</vn-th>
|
||||
<vn-th shrink>File</vn-th>
|
||||
<vn-th shrink>Employee</vn-th>
|
||||
<vn-th field="created" expand>Created</vn-th>
|
||||
<vn-th>Employee</vn-th>
|
||||
<vn-th field="created">Created</vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
|
@ -70,7 +70,7 @@
|
|||
ng-click="workerDescriptor.show($event, document.dms.workerFk)">
|
||||
{{::document.dms.worker.user.name | dashIfEmpty}}
|
||||
</span></vn-td>
|
||||
<vn-td expand>
|
||||
<vn-td shrink-datetime>
|
||||
{{::document.dms.created | date:'dd/MM/yyyy HH:mm'}}
|
||||
</vn-td>
|
||||
<vn-td shrink>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="greuge in greuges">
|
||||
<vn-td expand>{{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }}</vn-td>
|
||||
<vn-td shrink-datetime>{{::greuge.shipped | date:'dd/MM/yyyy HH:mm' }}</vn-td>
|
||||
<vn-td>
|
||||
<span title="{{::greuge.description}}">{{::greuge.description}}</span>
|
||||
</vn-td>
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
<vn-th field="id" number>Id</vn-th>
|
||||
<vn-th field="companyFk">Company</vn-th>
|
||||
<vn-th field="mandateTypeFk">Type</vn-th>
|
||||
<vn-th field="created" expand>Register date</vn-th>
|
||||
<vn-th field="finished" expand>End date</vn-th>
|
||||
<vn-th field="created">Register date</vn-th>
|
||||
<vn-th field="finished">End date</vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
|
@ -27,8 +27,8 @@
|
|||
<vn-td number>{{::mandate.id}}</vn-td>
|
||||
<vn-td>{{::mandate.company.code}}</vn-td>
|
||||
<vn-td>{{::mandate.mandateType.name}}</vn-td>
|
||||
<vn-td expand>{{::mandate.created | date:'dd/MM/yyyy HH:mm' | dashIfEmpty}}</vn-td>
|
||||
<vn-td expand>{{::mandate.finished | date:'dd/MM/yyyy HH:mm' | dashIfEmpty}}</vn-td>
|
||||
<vn-td shrink-datetime>{{::mandate.created | date:'dd/MM/yyyy HH:mm' | dashIfEmpty}}</vn-td>
|
||||
<vn-td shrink-datetime>{{::mandate.finished | date:'dd/MM/yyyy HH:mm' | dashIfEmpty}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="sample in samples">
|
||||
<vn-td>{{::sample.created | date:'dd/MM/yyyy HH:mm' }}</vn-td>
|
||||
<vn-td
|
||||
<vn-td shrink-datetime>{{::sample.created | date:'dd/MM/yyyy HH:mm' }}</vn-td>
|
||||
<vn-td expand
|
||||
title="{{::sample.type.description}}">
|
||||
{{::sample.type.description}}
|
||||
</vn-td>
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</vn-icon>
|
||||
</vn-td>
|
||||
<vn-td number>{{::transaction.id}}</vn-td>
|
||||
<vn-td expand>{{::transaction.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-td>{{::transaction.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-td number>{{::transaction.amount | currency: 'EUR':2}}</vn-td>
|
||||
<vn-td shrink>
|
||||
<vn-icon-button
|
||||
|
|
|
@ -10,13 +10,13 @@ describe('InvoiceIn', () => {
|
|||
|
||||
beforeEach(ngModule('invoiceIn'));
|
||||
|
||||
beforeEach(inject(($componentController, _$httpBackend_, $rootScope, _vnApp_) => {
|
||||
beforeEach(inject(($componentController, $rootScope, _vnApp_) => {
|
||||
vnApp = _vnApp_;
|
||||
jest.spyOn(vnApp, 'showError');
|
||||
$scope = $rootScope.$new();
|
||||
$scope.model = crudModel;
|
||||
|
||||
$scope.watcher = watcher;
|
||||
|
||||
const $element = angular.element('<vn-invoice-in-tax></vn-invoice-in-tax>');
|
||||
controller = $componentController('vnInvoiceInTax', {$element, $scope});
|
||||
controller.invoiceIn = {id: 1};
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<vn-tr>
|
||||
<vn-th vn-tooltip="Ignored" center>Ig</vn-th>
|
||||
<vn-th field="warehouseFk">Warehouse</vn-th>
|
||||
<vn-th field="landed" expand>Landed</vn-th>
|
||||
<vn-th field="landed">Landed</vn-th>
|
||||
<vn-th number>Entry</vn-th>
|
||||
<vn-th number vn-tooltip="Price Per Unit">P.P.U</vn-th>
|
||||
<vn-th number vn-tooltip="Price Per Package">P.P.P</vn-th>
|
||||
|
@ -49,7 +49,7 @@
|
|||
</vn-check>
|
||||
</vn-td>
|
||||
<vn-td title="{{::entry.warehouse| dashIfEmpty}}">{{::entry.warehouse| dashIfEmpty}}</vn-td>
|
||||
<vn-td expand>{{::entry.landed | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-td shrink-datetime>{{::entry.landed | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-td shrink>
|
||||
<span
|
||||
vn-click-stop="entryDescriptor.show($event, entry.entryFk)"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const validateIban = require('vn-loopback/util/validateIban');
|
||||
const LoopBackContext = require('loopback-context');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.validateAsync('iban', ibanValidation, {
|
||||
|
@ -19,4 +20,16 @@ module.exports = Self => {
|
|||
err();
|
||||
done();
|
||||
}
|
||||
Self.observe('after save', async ctx => {
|
||||
const loopBackContext = LoopBackContext.getCurrentContext();
|
||||
const models = Self.app.models;
|
||||
const user = await models.user.findById(loopBackContext.active.accessToken.userId);
|
||||
const bankEntity = await models.BankEntity.findById(ctx.instance.bankEntityFk);
|
||||
await Self.app.models.Mail.create({
|
||||
sender: 'finanzas@verdnatura.es',
|
||||
subject: 'Añadida cuenta bancaria al proveedor' + ctx.instance.supplierFk,
|
||||
body: user.username + ' ha añadido: ' +
|
||||
ctx.instance.iban + ', entidad: ' + bankEntity.name + ', bic: ' + bankEntity.bic
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -15,31 +15,40 @@
|
|||
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-lg">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal ng-repeat="supplierAccount in $ctrl.supplierAccounts">
|
||||
<vn-textfield vn-three
|
||||
ng-show="supplierAccount.iban || supplierAccount.iban == undefined"
|
||||
label="Iban"
|
||||
ng-model="supplierAccount.iban"
|
||||
rule>
|
||||
<vn-textfield
|
||||
ng-show="supplierAccount.iban || supplierAccount.iban == undefined"
|
||||
label="Iban"
|
||||
ng-model="supplierAccount.iban"
|
||||
on-change="supplierAccount.bankEntityFk = supplierAccount.iban.slice(4,8)"
|
||||
rule>
|
||||
</vn-textfield>
|
||||
<vn-autocomplete vn-three
|
||||
<vn-autocomplete
|
||||
label="Bank entity"
|
||||
ng-model="supplierAccount.bankEntityFk"
|
||||
url="BankEntities"
|
||||
show-field="name"
|
||||
rule>
|
||||
<append>
|
||||
<vn-icon-button
|
||||
icon="add_circle"
|
||||
vn-tooltip="New bank entity"
|
||||
ng-click="$ctrl.showBankEntity($event, $index)"
|
||||
tabindex="-1">
|
||||
</vn-icon-button>
|
||||
</append>
|
||||
</vn-autocomplete>
|
||||
<append>
|
||||
<vn-icon-button
|
||||
vn-auto
|
||||
icon="add_circle"
|
||||
vn-click-stop="bankEntity.show({index: $index})"
|
||||
vn-tooltip="New bank entity">
|
||||
</vn-icon-button>
|
||||
</append>
|
||||
<vn-textfield vn-three
|
||||
<vn-textfield
|
||||
label="Beneficiary"
|
||||
ng-model="supplierAccount.beneficiary"
|
||||
info="Beneficiary information">
|
||||
<append>
|
||||
<vn-icon-button
|
||||
vn-auto
|
||||
icon="add_circle"
|
||||
vn-click-stop="bankEntity.show({index: $index})"
|
||||
vn-tooltip="New bank entity">
|
||||
</vn-icon-button>
|
||||
</append>
|
||||
</vn-textfield>
|
||||
<vn-none>
|
||||
<vn-icon-button
|
||||
|
@ -71,4 +80,11 @@
|
|||
<vn-new-bank-entity
|
||||
vn-id="bankEntity"
|
||||
on-accept="$ctrl.onAccept($data)">
|
||||
</vn-new-bank-entity>
|
||||
</vn-new-bank-entity>
|
||||
|
||||
<vn-confirm
|
||||
class="edit"
|
||||
vn-id="payMethodToTransfer"
|
||||
on-accept="$ctrl.setWireTransfer()"
|
||||
message="Do you want to change the pay method to wire transfer?">
|
||||
</vn-confirm>
|
|
@ -10,6 +10,14 @@ class Controller extends Section {
|
|||
fields: ['countryFk', 'id', 'name', 'bic']
|
||||
}
|
||||
};
|
||||
const filter = {
|
||||
where: {code: 'wireTransfer'}
|
||||
};
|
||||
|
||||
this.$http.get(`payMethods/findOne`, {filter})
|
||||
.then(res => {
|
||||
this.wireTransferFk = res.data.id;
|
||||
});
|
||||
}
|
||||
|
||||
add() {
|
||||
|
@ -26,11 +34,16 @@ class Controller extends Section {
|
|||
|
||||
onSubmit() {
|
||||
this.$.watcher.check();
|
||||
this.$.model.save().then(() => {
|
||||
this.$.watcher.notifySaved();
|
||||
this.$.watcher.updateOriginalData();
|
||||
this.card.reload();
|
||||
});
|
||||
return this.$.model.save()
|
||||
.then(() => {
|
||||
this.$.watcher.notifySaved();
|
||||
this.$.watcher.updateOriginalData();
|
||||
return this.card.reload();
|
||||
})
|
||||
.then(() => {
|
||||
if (this.supplier.payMethodFk != this.wireTransferFk)
|
||||
this.$.payMethodToTransfer.show();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
import './index.js';
|
||||
import watcher from 'core/mocks/watcher';
|
||||
import crudModel from 'core/mocks/crud-model';
|
||||
|
||||
describe('Supplier Component vnSupplierAccount', () => {
|
||||
let $scope;
|
||||
let $element;
|
||||
let controller;
|
||||
beforeEach(ngModule('supplier'));
|
||||
|
||||
beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
|
||||
$scope = $rootScope.$new();
|
||||
$scope.model = crudModel;
|
||||
$scope.watcher = watcher;
|
||||
|
||||
$scope.bankEntity = {
|
||||
open: () => {}
|
||||
};
|
||||
$element = angular.element('<vn-supplier-accounts></supplier-accounts>');
|
||||
|
||||
const $element = angular.element('<vn-supplier-account></vn-supplier-account>');
|
||||
controller = $componentController('vnSupplierAccount', {$element, $scope});
|
||||
controller.supplierAccount = {
|
||||
supplierFk: 442,
|
||||
|
@ -35,5 +40,31 @@ describe('Supplier Component vnSupplierAccount', () => {
|
|||
expect(targetAccount.bankEntityFk).toEqual(data.id);
|
||||
});
|
||||
});
|
||||
|
||||
describe('onSubmit()', () => {
|
||||
it(`should reload the card`, done => {
|
||||
controller.card = {reload: () => {}};
|
||||
controller.$.payMethodToTransfer = {show: () => {}};
|
||||
jest.spyOn(controller.$.payMethodToTransfer, 'show');
|
||||
jest.spyOn(controller.$.model, 'save').mockReturnValue(new Promise(resolve => {
|
||||
return resolve({
|
||||
id: 1234
|
||||
});
|
||||
}));
|
||||
jest.spyOn(controller.card, 'reload').mockReturnValue(new Promise(resolve => {
|
||||
return resolve({
|
||||
id: 1234
|
||||
});
|
||||
}));
|
||||
|
||||
controller.wireTransferFk = 'a';
|
||||
controller.supplier = {payMethodFk: 'b'};
|
||||
controller.onSubmit().then(() => {
|
||||
expect(controller.card.reload).toHaveBeenCalledWith();
|
||||
expect(controller.$.payMethodToTransfer.show).toHaveBeenCalled();
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -2,4 +2,5 @@ Bank entity: Entidad bancaria
|
|||
swift: Swift BIC
|
||||
Add account: Añadir cuenta
|
||||
Beneficiary: Beneficiario
|
||||
Beneficiary information: Nombre del titular de la cuenta bancaria en caso de ser diferente del proveedor
|
||||
Beneficiary information: Nombre del titular de la cuenta bancaria en caso de ser diferente del proveedor
|
||||
Do you want to change the pay method to wire transfer?: ¿Quieres modificar la forma de pago a transferencia?
|
|
@ -37,7 +37,7 @@ class Controller extends ModuleCard {
|
|||
}
|
||||
]
|
||||
};
|
||||
this.$http.get(`Suppliers/${this.$params.id}`, {filter})
|
||||
return this.$http.get(`Suppliers/${this.$params.id}`, {filter})
|
||||
.then(response => this.supplier = response.data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<vn-th field="hasFile" shrink>Original</vn-th>
|
||||
<vn-th shrink>File</vn-th>
|
||||
<vn-th shrink>Employee</vn-th>
|
||||
<vn-th field="created" expand>Created</vn-th>
|
||||
<vn-th field="created">Created</vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
|
@ -69,7 +69,7 @@
|
|||
{{::document.dms.worker.user.name | dashIfEmpty}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td expand>
|
||||
<vn-td shrink-datetime>
|
||||
{{::document.dms.created | date:'dd/MM/yyyy HH:mm'}}
|
||||
</vn-td>
|
||||
<vn-td shrink>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
{{::tracking.worker.user.name || 'System' | translate}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td>{{::tracking.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
<vn-td shrink-datetime>{{::tracking.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
</vn-table>
|
||||
|
|
|
@ -59,7 +59,6 @@ module.exports = Self => {
|
|||
travel.agencyFk
|
||||
]
|
||||
);
|
||||
|
||||
stmts.push(stmt);
|
||||
const newTravelIndex = stmts.push('SELECT @vTravelFk AS id') - 1;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<vn-th expand>Description</vn-th>
|
||||
<vn-th field="hasFile" shrink>Original</vn-th>
|
||||
<vn-th shrink>File</vn-th>
|
||||
<vn-th field="created" expand>Created</vn-th>
|
||||
<vn-th field="created">Created</vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
<vn-th shrink></vn-th>
|
||||
|
@ -57,7 +57,7 @@
|
|||
{{::document.file}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td expand>
|
||||
<vn-td shrink-datetime>
|
||||
{{::document.created | date:'dd/MM/yyyy HH:mm'}}
|
||||
</vn-td>
|
||||
<vn-td shrink>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue