Merge branch 'dev'
This commit is contained in:
commit
31a22cf4e3
|
@ -48,7 +48,7 @@
|
|||
"client": "$ctrl.client"
|
||||
},
|
||||
"menu": {
|
||||
"description": "Datos facturación",
|
||||
"description": "Pay method",
|
||||
"icon": "assignment"
|
||||
}
|
||||
}, {
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete vn-one
|
||||
initial-data="$ctrl.address.defaultAgency"
|
||||
field="$ctrl.address.defaultAgencyFk"
|
||||
url="/client/api/AgencyModes"
|
||||
show-field="name"
|
||||
|
|
|
@ -10,17 +10,20 @@
|
|||
<vn-vertical pad-large>
|
||||
<vn-title>Basic data</vn-title>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Name" field="$ctrl.client.name" vn-focus></vn-textfield>
|
||||
<vn-textfield vn-one label="Tax number" field="$ctrl.client.fi"></vn-textfield>
|
||||
<vn-textfield autofocus vn-one label="Social name" field="$ctrl.client.socialName"></vn-textfield>
|
||||
<vn-textfield vn-one label="Comercial Name" field="$ctrl.client.name" vn-focus></vn-textfield>
|
||||
<vn-textfield vn-one label="Contact" field="$ctrl.client.contact"></vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Phone" field="$ctrl.client.phone"></vn-textfield>
|
||||
<vn-textfield vn-one label="Mobile" field="$ctrl.client.mobile"></vn-textfield>
|
||||
<vn-textfield vn-one label="Fax" field="$ctrl.client.fax"></vn-textfield>
|
||||
<vn-textfield vn-one
|
||||
label="Email"
|
||||
field="$ctrl.client.email"
|
||||
info="You can save multiple emails by chaining them using comma without spaces, example: user@domain.com,user2@domain.com the first email will be considered as the main"
|
||||
>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Email" field="$ctrl.client.email" info="You can save multiple emails by chaining them using comma without spaces, example: user@domain.com,user2@domain.com the first email will be considered as the main"></vn-textfield>
|
||||
<vn-autocomplete vn-one
|
||||
initial-data="$ctrl.client.salesPerson"
|
||||
field="$ctrl.client.salesPersonFk"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"Basic data": "Datos básicos",
|
||||
"Name": "Nombre",
|
||||
"Comercial Name": "Nombre comercial",
|
||||
"Tax number": "NIF/CIF",
|
||||
"Social name": "Razón social",
|
||||
"Phone": "Teléfono",
|
||||
|
@ -9,5 +9,6 @@
|
|||
"Email": "Correo electrónico",
|
||||
"Salesperson": "Comercial",
|
||||
"Channel": "Canal",
|
||||
"You can save multiple emails by chaining them using comma without spaces, example: user@domain.com,user2@domain.com the first email will be considered as the main": "Puede guardar varios correos electrónicos encadenándolos mediante comas sin espacios, ejemplo: user@dominio.com,user2@dominio.com siendo el primer correo electrónico el principal"
|
||||
"You can save multiple emails by chaining them using comma without spaces, example: user@domain.com,user2@domain.com the first email will be considered as the main": "Puede guardar varios correos electrónicos encadenándolos mediante comas sin espacios, ejemplo: user@dominio.com,user2@dominio.com siendo el primer correo electrónico el principal",
|
||||
"Contact": "Contacto"
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
<form name="form" ng-submit="$ctrl.submit()" pad-medium>
|
||||
<vn-card margin-small-bottom>
|
||||
<vn-vertical pad-large>
|
||||
<vn-title>Billing information</vn-title>
|
||||
<vn-title>Pay method</vn-title>
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete vn-two
|
||||
vn-acl="administrative"
|
||||
|
@ -16,33 +16,16 @@
|
|||
url="/client/api/PayMethods"
|
||||
select-fields="ibanRequired"
|
||||
initial-data="$ctrl.client.payMethod"
|
||||
label="Forma de pago">
|
||||
label="Pay method">
|
||||
</vn-autocomplete>
|
||||
<vn-textfield vn-two label="IBAN" field="$ctrl.client.iban" vn-acl="administrative"></vn-textfield>
|
||||
<vn-textfield vn-one label="Vencimiento" field="$ctrl.client.dueDay" vn-acl="administrative"></vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Descuento" field="$ctrl.client.discount" vn-acl="administrative"></vn-textfield>
|
||||
<vn-textfield vn-one label="Crédito" field="$ctrl.client.credit" vn-acl="administrative"></vn-textfield>
|
||||
<vn-textfield vn-one label="Crédito asegurado" field="$ctrl.client.creditInsurance" vn-acl="administrative"></vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-one>
|
||||
<vn-check label="Equalization tax" field="$ctrl.client.equalizationTax" vn-acl="administrative"></vn-check>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<vn-check label="Vies" field="$ctrl.client.vies" vn-acl="administrative"></vn-check>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<vn-check label="Invoice by address" field="$ctrl.client.hasToInvoiceByAddress" vn-acl="administrative"></vn-check>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
<vn-card margin-small-bottom>
|
||||
<vn-vertical pad-large>
|
||||
<vn-title>Documentación</vn-title>
|
||||
<vn-horizontal>
|
||||
<vn-horizontal margin-medium-bottom>
|
||||
<vn-one>
|
||||
<vn-check label="Recibido core VNH" field="$ctrl.client.coreVnh" vn-acl="administrative"></vn-check>
|
||||
</vn-one>
|
||||
|
@ -55,6 +38,7 @@
|
|||
</vn-horizontal>
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Guardar" vn-acl="administrative"></vn-submit>
|
||||
</vn-button-bar>
|
||||
|
@ -73,17 +57,3 @@
|
|||
<button response="ACCEPT" translate>Yes, notify</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
||||
<vn-dialog
|
||||
vn-id="propagate-equalizationTax"
|
||||
on-response="$ctrl.returnDialogEt(response)">
|
||||
<tpl-body>
|
||||
<vn-vertical>
|
||||
<vn-one text-center translate>You changes the equivalent tax</vn-one>
|
||||
<vn-one text-center translate>Do you want to spread the change to their consignees?</vn-one>
|
||||
</vn-vertical>
|
||||
</tpl-body>
|
||||
<tpl-buttons>
|
||||
<button response="CANCEL" translate>No</button>
|
||||
<button response="ACCEPT" translate>Yes, propagate</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
|
@ -9,11 +9,9 @@ export default class Controller {
|
|||
this.billData = {};
|
||||
this.copyData();
|
||||
}
|
||||
|
||||
$onChanges() {
|
||||
this.copyData();
|
||||
}
|
||||
|
||||
copyData() {
|
||||
if (this.client) {
|
||||
this.billData.payMethodFk = this.client.payMethodFk;
|
||||
|
@ -22,15 +20,12 @@ export default class Controller {
|
|||
this.billData.discount = this.client.discount;
|
||||
this.billData.credit = this.client.credit;
|
||||
this.billData.creditInsurance = this.client.creditInsurance;
|
||||
this.equalizationTax = this.client.equalizationTax;
|
||||
}
|
||||
}
|
||||
|
||||
submit() {
|
||||
return this.$.watcher.submit().then(
|
||||
() => this.checkPaymentChanges());
|
||||
}
|
||||
|
||||
checkPaymentChanges() {
|
||||
let equals = true;
|
||||
Object.keys(this.billData).forEach(
|
||||
|
@ -42,40 +37,15 @@ export default class Controller {
|
|||
}
|
||||
);
|
||||
|
||||
if (equals) {
|
||||
this.checkEtChanges();
|
||||
} else {
|
||||
if (!equals) {
|
||||
this.$.sendMail.show();
|
||||
}
|
||||
}
|
||||
|
||||
returnDialog(response) {
|
||||
if (response === 'ACCEPT') {
|
||||
this.$http.post(`/mailer/manuscript/payment-update/${this.client.id}`).then(
|
||||
() => {
|
||||
this.vnApp.showMessage(this.translate.instant('Notification sent!'));
|
||||
this.checkEtChanges();
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.checkEtChanges();
|
||||
}
|
||||
}
|
||||
|
||||
checkEtChanges() {
|
||||
let equals = this.equalizationTax == this.client.equalizationTax;
|
||||
this.equalizationTax = this.client.equalizationTax;
|
||||
|
||||
if (!equals)
|
||||
this.$.propagateEqualizationTax.show();
|
||||
}
|
||||
|
||||
returnDialogEt(response) {
|
||||
if (response === 'ACCEPT') {
|
||||
this.$http.patch(`/client/api/Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.equalizationTax}).then(
|
||||
res => {
|
||||
if (res.data)
|
||||
this.vnApp.showMessage(this.translate.instant('Equivalent tax spreaded'));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -5,31 +5,29 @@
|
|||
form="form"
|
||||
save="patch">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="watcher.submit()" pad-medium>
|
||||
<form name="form" ng-submit="$ctrl.submit()" pad-medium>
|
||||
<vn-card margin-small-bottom>
|
||||
<vn-vertical pad-large>
|
||||
<vn-title>Fiscal data</vn-title>
|
||||
<vn-horizontal>
|
||||
<vn-one>
|
||||
<vn-check label="Has to invoice" field="$ctrl.client.hasToInvoice"></vn-check>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<vn-check label="Invoice by mail" field="$ctrl.client.invoiceByEmail"></vn-check>
|
||||
</vn-one>
|
||||
<vn-textfield autofocus vn-two label="Social name" field="$ctrl.client.socialName" vn-acl="administrative"></vn-textfield>
|
||||
<vn-textfield vn-one label="Tax number" field="$ctrl.client.fi" vn-acl="administrative"></vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-two label="Street" field="$ctrl.client.street" vn-focus></vn-textfield>
|
||||
<vn-textfield vn-one label="City" field="$ctrl.client.city"></vn-textfield>
|
||||
<vn-textfield vn-two label="Street" field="$ctrl.client.street" vn-focus vn-acl="administrative"></vn-textfield>
|
||||
<vn-textfield vn-one label="City" field="$ctrl.client.city" vn-acl="administrative"></vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Postcode" field="$ctrl.client.postcode"></vn-textfield>
|
||||
<vn-textfield vn-one label="Postcode" field="$ctrl.client.postcode" vn-acl="administrative"></vn-textfield>
|
||||
<vn-autocomplete vn-one
|
||||
initial-data="$ctrl.client.province"
|
||||
field="$ctrl.client.provinceFk"
|
||||
url="/client/api/Provinces"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Province">
|
||||
label="Province"
|
||||
vn-acl="administrative"
|
||||
>
|
||||
</vn-autocomplete>
|
||||
<vn-autocomplete vn-one
|
||||
initial-data="$ctrl.client.country"
|
||||
|
@ -37,13 +35,52 @@
|
|||
url="/client/api/Countries"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
label="Country">
|
||||
label="Country"
|
||||
vn-acl="administrative"
|
||||
>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal margin-small-bottom>
|
||||
<vn-one>
|
||||
<vn-check label="Equalization tax" field="$ctrl.client.equalizationTax" vn-acl="administrative" vn-acl="administrative"></vn-check>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<vn-check label="Invoice by address" field="$ctrl.client.hasToInvoiceByAddress" vn-acl="administrative" vn-acl="administrative"></vn-check>
|
||||
</vn-one>
|
||||
<vn-one></vn-one>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-one>
|
||||
<vn-check label="Has to invoice" field="$ctrl.client.hasToInvoice" vn-acl="administrative"></vn-check>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<vn-check label="Invoice by mail" field="$ctrl.client.invoiceByEmail" vn-acl="administrative"></vn-check>
|
||||
</vn-one>
|
||||
<vn-one>
|
||||
<vn-check label="Vies" field="$ctrl.client.vies" vn-acl="administrative" vn-acl="administrative"></vn-check>
|
||||
</vn-one>
|
||||
</vn-horizontal>
|
||||
|
||||
</vn-vertical>
|
||||
|
||||
</vn-card>
|
||||
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Save"></vn-submit>
|
||||
</vn-button-bar>
|
||||
</form>
|
||||
<vn-dialog
|
||||
vn-id="propagate-equalizationTax"
|
||||
on-response="$ctrl.returnDialogEt(response)"
|
||||
>
|
||||
<tpl-body>
|
||||
<vn-vertical>
|
||||
<vn-one text-center translate>You changes the equivalent tax</vn-one>
|
||||
<vn-one text-center translate>Do you want to spread the change to their consignees?</vn-one>
|
||||
</vn-vertical>
|
||||
</tpl-body>
|
||||
<tpl-buttons>
|
||||
<button response="CANCEL" translate>No</button>
|
||||
<button response="ACCEPT" translate>Yes, propagate</button>
|
||||
</tpl-buttons>
|
||||
</vn-dialog>
|
|
@ -1,7 +1,54 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
export default class ClientFiscalData {
|
||||
constructor($scope, $http, vnApp, $translate) {
|
||||
this.$ = $scope;
|
||||
this.$http = $http;
|
||||
this.vnApp = vnApp;
|
||||
this.translate = $translate;
|
||||
this.equalizationTax = undefined;
|
||||
this.copyData();
|
||||
}
|
||||
|
||||
$onChanges() {
|
||||
this.copyData();
|
||||
}
|
||||
|
||||
copyData() {
|
||||
if (this.client) {
|
||||
this.equalizationTax = this.client.equalizationTax;
|
||||
}
|
||||
}
|
||||
|
||||
submit() {
|
||||
return this.$.watcher.submit().then(
|
||||
() => this.checkEtChanges());
|
||||
}
|
||||
|
||||
checkEtChanges() {
|
||||
let equals = this.equalizationTax == this.client.equalizationTax;
|
||||
this.equalizationTax = this.client.equalizationTax;
|
||||
|
||||
if (!equals)
|
||||
this.$.propagateEqualizationTax.show();
|
||||
}
|
||||
|
||||
returnDialogEt(response) {
|
||||
if (response === 'ACCEPT') {
|
||||
this.$http.patch(`/client/api/Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.equalizationTax}).then(
|
||||
res => {
|
||||
if (res.data)
|
||||
this.vnApp.showMessage(this.translate.instant('Equivalent tax spreaded'));
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
ClientFiscalData.$inject = ['$scope', '$http', 'vnApp', '$translate'];
|
||||
|
||||
ngModule.component('vnClientFiscalData', {
|
||||
template: require('./fiscal-data.html'),
|
||||
controller: ClientFiscalData,
|
||||
bindings: {
|
||||
client: '<'
|
||||
}
|
||||
|
|
|
@ -9,5 +9,6 @@
|
|||
"City": "Municipio",
|
||||
"Postcode": "Código postal",
|
||||
"Province": "Provincia",
|
||||
"Save": "Guardar"
|
||||
"Save": "Guardar",
|
||||
"Pay method" : "Forma de pago"
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
export default class Controller {
|
||||
constructor($window) {
|
||||
this.$window = $window;
|
||||
constructor(sessionStorage) {
|
||||
this.sessionStorage = sessionStorage;
|
||||
// onSubmit() is defined by @vnSearchbar
|
||||
this.onSubmit = () => {};
|
||||
}
|
||||
|
@ -13,16 +13,16 @@ export default class Controller {
|
|||
}
|
||||
|
||||
$onChanges() {
|
||||
var value = JSON.parse(this.$window.sessionStorage.getItem('filter'));
|
||||
var value = this.sessionStorage.get('filter');
|
||||
if (value !== undefined)
|
||||
this.filter = value;
|
||||
}
|
||||
|
||||
setStorageValue() {
|
||||
this.$window.sessionStorage.setItem('filter', JSON.stringify(this.filter));
|
||||
this.sessionStorage.set('filter', this.filter);
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$window'];
|
||||
Controller.$inject = ['sessionStorage'];
|
||||
|
||||
ngModule.component('vnClientSearchPanel', {
|
||||
template: require('./search-panel.html'),
|
||||
|
|
|
@ -3,17 +3,17 @@ import './search-panel.js';
|
|||
describe('Client', () => {
|
||||
describe('Component vnClientSearchPanel', () => {
|
||||
let $componentController;
|
||||
let $window;
|
||||
let sessionStorage;
|
||||
let controller;
|
||||
|
||||
beforeEach(() => {
|
||||
angular.mock.module('client');
|
||||
});
|
||||
|
||||
beforeEach(angular.mock.inject((_$componentController_, _$window_) => {
|
||||
beforeEach(angular.mock.inject((_$componentController_, _sessionStorage_) => {
|
||||
$componentController = _$componentController_;
|
||||
$window = _$window_;
|
||||
controller = $componentController('vnClientSearchPanel', {$window: $window});
|
||||
sessionStorage = _sessionStorage_;
|
||||
controller = $componentController('vnClientSearchPanel', {sessionStorage: sessionStorage});
|
||||
}));
|
||||
|
||||
describe('onSearch()', () => {
|
||||
|
@ -31,10 +31,10 @@ describe('Client', () => {
|
|||
describe('$onChanges()', () => {
|
||||
it('should set filter properties using the search values', () => {
|
||||
expect(controller.filter).not.toBeDefined();
|
||||
spyOn(JSON, 'parse').and.returnValue({data: 'data'});
|
||||
spyOn(sessionStorage, 'get').and.returnValue({data: 'data'});
|
||||
controller.$onChanges();
|
||||
|
||||
expect(controller.filter).toBe(JSON.parse({data: 'data'}));
|
||||
expect(controller.filter).toBe(sessionStorage.get({data: 'data'}));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -39,6 +39,11 @@ export default class Paging {
|
|||
this.pageChange();
|
||||
}
|
||||
}
|
||||
$doCheck() {
|
||||
if (this.index && this.index.filter && this.index.filter.page && this.index.filter.page != this.currentPage) {
|
||||
this.currentPage = this.index.filter.page;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Paging.$inject = ['$http', '$scope'];
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"url": "/production",
|
||||
"state": "production",
|
||||
"component": "vn-production-index",
|
||||
"acl": ["employee"]
|
||||
"acl": ["developer"]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -9,6 +9,6 @@
|
|||
style="cursor: pointer;">
|
||||
</vn-icon>
|
||||
<vn-button ng-if="$ctrl.label" vn-none label="{{$ctrl.label}}"></vn-button>
|
||||
<vn-icon-button ng-if="!$ctrl.label" icon="search"></vn-icon-button>
|
||||
<vn-icon-button ng-if="!$ctrl.label" icon="search" ng-click="$ctrl.clearFilter()"></vn-icon-button>
|
||||
</vn-horizontal>
|
||||
</form>
|
|
@ -1,15 +1,22 @@
|
|||
import ngModule from '../../module';
|
||||
|
||||
export default class Controller {
|
||||
constructor($element, $scope, $document, $compile, vnPopover, $window) {
|
||||
constructor($element, $scope, $document, $compile, vnPopover, sessionStorage, $timeout) {
|
||||
this.element = $element[0];
|
||||
this.$scope = $scope;
|
||||
this.$document = $document;
|
||||
this.$compile = $compile;
|
||||
this.vnPopover = vnPopover;
|
||||
this.$window = $window;
|
||||
this.sessionStorage = sessionStorage;
|
||||
this.$timeout = $timeout;
|
||||
}
|
||||
clearFilter() {
|
||||
this.index.filter = {};
|
||||
this.sessionStorage.remove('filter');
|
||||
}
|
||||
onClick(event) {
|
||||
this.search = null;
|
||||
|
||||
this.child = this.vnPopover.showComponent(this.popover, this.$scope, this.element);
|
||||
|
||||
// XXX: ¿Existe una forma más adecuada de acceder al controlador de un componente?
|
||||
|
@ -37,10 +44,10 @@ export default class Controller {
|
|||
delete this.child;
|
||||
}
|
||||
$onDestroy() {
|
||||
this.$window.sessionStorage.removeItem('filter');
|
||||
this.clearFilter();
|
||||
}
|
||||
}
|
||||
Controller.$inject = ['$element', '$scope', '$document', '$compile', 'vnPopover', '$window'];
|
||||
Controller.$inject = ['$element', '$scope', '$document', '$compile', 'vnPopover', 'sessionStorage', '$timeout'];
|
||||
|
||||
ngModule.component('vnSearchbar', {
|
||||
template: require('./searchbar.html'),
|
||||
|
|
|
@ -25,12 +25,19 @@ module.exports = function(Self) {
|
|||
|
||||
Self.beforeRemote('findById', function(ctx, modelInstance, next) {
|
||||
ctx.args.filter = {
|
||||
include: {
|
||||
include: [{
|
||||
relation: "province",
|
||||
scope: {
|
||||
fields: ["id", "name"]
|
||||
}
|
||||
},
|
||||
{
|
||||
relation: "defaultAgency",
|
||||
scope: {
|
||||
fields: ["id", "name"]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
next();
|
||||
});
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
},
|
||||
"defaultAgency": {
|
||||
"type": "belongsTo",
|
||||
"model": "Agency",
|
||||
"model": "AgencyMode",
|
||||
"foreignKey": "defaultAgencyFk"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue