Merge branch 'dev' of http://git.verdnatura.es/salix into dev

This commit is contained in:
Carlos Jimenez 2018-08-01 14:01:59 +02:00
commit d8fb0b2d95
14 changed files with 212 additions and 69 deletions

View File

@ -1,4 +1,7 @@
<vn-popover vn-id="popover">
<vn-client-descriptor client="$ctrl.client" clientFk="$ctrl.clientFk">
<vn-client-descriptor
client="$ctrl.client"
clientFk="$ctrl.clientFk"
quicklinks="$ctrl.quicklinks">
</vn-client-descriptor>
</vn-popover>

View File

@ -9,6 +9,22 @@ class Controller extends Component {
this.$timeout = $timeout;
this.isTooltip = true;
this.client = {};
this.links = {};
}
set clientFk(value) {
if (value) {
this._getClient(value);
this._getClientDebt(value);
}
}
set quicklinks(value = {}) {
this._quicklinks = Object.assign(value, this.links);
}
get quicklinks() {
return this._quicklinks;
}
clear() {
@ -34,13 +50,6 @@ class Controller extends Component {
this.$state.go('ticket.index', {q: `{"clientFk": ${this.client.id}}`});
}
set clientFk(value) {
if (value) {
this._getClient(value);
this._getClientDebt(value);
}
}
show() {
this.$.popover.parent = this.parent;
setTimeout(() => {
@ -56,6 +65,7 @@ ngModule.component('vnClientDescriptorPopover', {
controller: Controller,
bindings: {
client: '<',
clientFk: '<'
clientFk: '<',
quicklinks: '<'
}
});

View File

@ -53,11 +53,23 @@
ng-class="{bright: $ctrl.client.isTaxDataChecked == false}">
</vn-icon>
</vn-horizontal>
<vn-horizontal pad-small class="buttons">
<vn-button
vn-tooltip="Client ticket list"
icon="icon-ticket"
ng-click="$ctrl.goToClientTickets()">
<vn-horizontal pad-small class="quicklinks">
<vn-button ng-if="$ctrl.quicklinks.btnOne" pad-small-right
vn-tooltip="{{::$ctrl.quicklinks.btnOne.tooltip}}"
icon="{{::$ctrl.quicklinks.btnOne.icon}}"
ng-click="$ctrl.quicklinkGo($ctrl.quicklinks.btnOne.state, $ctrl.quicklinks.btnOne.params)">
</vn-button>
<vn-button ng-if="$ctrl.quicklinks.btnTwo" pad-small-right
vn-tooltip="{{::$ctrl.quicklinks.btnTwo.tooltip}}"
icon="{{::$ctrl.quicklinks.btnTwo.icon}}"
ng-click="$ctrl.quicklinkGo($ctrl.quicklinks.btnTwo.state, $ctrl.quicklinks.btnTwo.params)">
</vn-button>
<vn-button ng-if="$ctrl.quicklinks.btnThree" pad-small-right
vn-tooltip="{{::$ctrl.quicklinks.btnThree.tooltip}}"
icon="{{::$ctrl.quicklinks.btnThree.icon}}"
ng-click="$ctrl.quicklinkGo($ctrl.quicklinks.btnThree.state, $ctrl.quicklinks.btnThree.params)">
</vn-button>
</vn-horizontal>
</vn-card>

View File

@ -4,7 +4,31 @@ class Controller {
constructor($http, $state) {
this.$state = $state;
this.$http = $http;
this.links = {
btnOne: {
icon: 'icon-ticket',
state: 'ticket.index',
params: {q: `{"clientFk": ${$state.params.id}}`},
tooltip: 'Client ticket list'
}
};
}
set clientFk(value) {
if (value) {
this._getClient(value);
this._getClientDebt(value);
}
}
set quicklinks(value = {}) {
this._quicklinks = Object.assign(value, this.links);
}
get quicklinks() {
return this._quicklinks;
}
_getClientDebt(clientFk) {
this.$http.get(`/client/api/Clients/${clientFk}/getDebt`)
.then(response => {
@ -23,11 +47,8 @@ class Controller {
this.$state.go('ticket.index', {q: `{"clientFk": ${this.client.id}}`});
}
set clientFk(value) {
if (value) {
this._getClient(value);
this._getClientDebt(value);
}
quicklinkGo(state, params) {
this.$state.go(state, params);
}
}
@ -37,7 +58,8 @@ ngModule.component('vnClientDescriptor', {
template: require('./index.html'),
bindings: {
client: '<',
clientFk: '<?'
clientFk: '<?',
quicklinks: '<'
},
controller: Controller
});

View File

@ -2,6 +2,7 @@
<vn-item-descriptor
item="$ctrl.item"
item-tags="$ctrl.itemTags"
tags="$ctrl.tags">
tags="$ctrl.tags"
quicklinks="$ctrl.quicklinks">
</vn-item-descriptor>
</vn-popover>

View File

@ -7,11 +7,19 @@ class Controller extends Component {
super($element, $scope);
this.$http = $http;
this.$timeout = $timeout;
this.links = {};
this.isTooltip = true;
this.clear();
}
set quicklinks(value = {}) {
this._quicklinks = Object.assign(value, this.links);
}
get quicklinks() {
return this._quicklinks;
}
clear() {
this.item = null;
this.tags = {};
@ -90,7 +98,8 @@ Controller.$inject = ['$element', '$scope', '$http', '$timeout'];
ngModule.component('vnItemDescriptorPopover', {
template: require('./index.html'),
bindings: {
itemFk: '<'
itemFk: '<',
quicklinks: '<'
},
controller: Controller
});

View File

@ -37,4 +37,23 @@
</vn-label-value>
</vn-auto>
</vn-vertical>
<vn-horizontal pad-small class="quicklinks">
<vn-button ng-if="$ctrl.quicklinks.btnOne" pad-small-right
vn-tooltip="{{::$ctrl.quicklinks.btnOne.tooltip}}"
icon="{{::$ctrl.quicklinks.btnOne.icon}}"
ng-click="$ctrl.quicklinkGo($ctrl.quicklinks.btnOne.state, $ctrl.quicklinks.btnOne.params)">
</vn-button>
<vn-button ng-if="$ctrl.quicklinks.btnTwo" pad-small-right
vn-tooltip="{{::$ctrl.quicklinks.btnTwo.tooltip}}"
icon="{{::$ctrl.quicklinks.btnTwo.icon}}"
ng-click="$ctrl.quicklinkGo($ctrl.quicklinks.btnTwo.state, $ctrl.quicklinks.btnTwo.params)">
</vn-button>
<vn-button ng-if="$ctrl.quicklinks.btnThree" pad-small-right
vn-tooltip="{{::$ctrl.quicklinks.btnThree.tooltip}}"
icon="{{::$ctrl.quicklinks.btnThree.icon}}"
ng-click="$ctrl.quicklinkGo($ctrl.quicklinks.btnThree.state, $ctrl.quicklinks.btnThree.params)">
</vn-button>
</vn-horizontal>
</vn-card>

View File

@ -1,11 +1,34 @@
import ngModule from '../module';
import './style.scss';
class Controller {
constructor($state) {
this.$state = $state;
this.links = {};
}
set quicklinks(value = {}) {
this._quicklinks = Object.assign(value, this.links);
}
get quicklinks() {
return this._quicklinks;
}
quicklinkGo(state, params) {
this.$state.go(state, params);
}
}
Controller.$inject = ['$state'];
ngModule.component('vnItemDescriptor', {
template: require('./index.html'),
controller: Controller,
bindings: {
item: '<',
itemTags: '<',
tags: '<'
tags: '<',
quicklinks: '<'
}
});

View File

@ -206,7 +206,7 @@ vn-main-block {
}
}
.buttons {
.quicklinks {
justify-content: center;
align-items: center;

View File

@ -164,7 +164,8 @@
</vn-table>
</vn-vertical>
</vn-card>
<vn-item-descriptor-popover vn-id="descriptor">
<vn-item-descriptor-popover vn-id="descriptor"
quicklinks="$ctrl.quicklinks">
</vn-item-descriptor-popover>
<!-- Add Turn Dialog -->

View File

@ -20,6 +20,25 @@ class Controller {
];
}
set ticket(value) {
this._ticket = value;
if (!value) return;
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: 'item.card.diary',
params: {id: value.id, q: `{"warehouseFk": ${value.warehouseFk}}`},
tooltip: 'Item diary'
}
};
}
get ticket() {
return this._ticket;
}
onDataChange() {
this.sales = this.$scope.model.data;
this.getTaxes();

View File

@ -88,6 +88,7 @@ describe('Client', () => {
.wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput)
.type(selectors.clientFiscalData.socialNameInput, 'SMASH!')
.waitForTextInInput(selectors.clientFiscalData.socialNameInput, 'SMASH!')
.clearInput(selectors.clientFiscalData.fiscalIdInput)
.type(selectors.clientFiscalData.fiscalIdInput, '94980061C')
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel)

View File

@ -20,17 +20,17 @@ INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`)
(105, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'MaxEisenhardt@verdnatura.es'),
(106, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'DavidCharlesHaller@verdnatura.es'),
(107, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'HankPym@verdnatura.es'),
(108, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'CharlesXavier@verdnatura.es'),
(108, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 20, 1, 'CharlesXavier@verdnatura.es'),
(109, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'BruceBanner@verdnatura.es'),
(110, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91' , 2, 1, 'JessicaJones@verdnatura.es');
(110, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 1 , 1, 'JessicaJones@verdnatura.es');
INSERT INTO `vn`.`worker`(`workerCode`, `id`, `firstName`, `name`, `userFk`)
VALUES
('LGN', 106, 'David Charles', 'Haller', 106),
('ANT', 107, 'Hank' , 'Pym' , 107),
('DCX', 108, 'Charles' , 'Xavier', 108),
('DCX', 110, 'Charles' , 'Xavier', 108),
('HLK', 109, 'Bruce' , 'Banner', 109),
('JJJ', 110, 'Jessica' , 'Jones' , 110);
('JJJ', 108, 'Jessica' , 'Jones' , 110);
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`)
VALUES
@ -614,7 +614,30 @@ INSERT INTO `vn`.`tag`(`id`,`name`,`isFree`,`isQuantitatif`,`sourceTable`,`unit`
(3, 'Shape', 0, 0, null, null),
(4, 'Location', 1, 0, null, null),
(5, 'Owner', 1, 1, null, null);
/*
INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
VALUES
(1, 1, 1, 'Yellow', 5),
(2, 1, 2, 'Manipulates time', 4),
(3, 1, 3, 'round', 3),
(4, 1, 4, 'Gamoras hideout', 2),
(5, 1, 5, 'Gamora', 1),
(6, 2, 1, 'Red', 5),
(7, 2, 2, 'Manipulates mind', 4),
(8, 2, 3, 'square', 3),
(9, 2, 4, 'unknown location', 2),
(10, 2, 5, 'Thanos', 1),
(11, 3, 1, 'Green', 5),
(12, 3, 2, 'Save the children', 4),
(13, 3, 3, 'human shape', 3),
(14, 3, 4, 'Stark tower', 2),
(15, 3, 5, 'Tony Stark', 1),
(16, 4, 1, 'Blue', 5),
(17, 4, 2, 'Protect the citizen', 4),
(18, 4, 3, 'human shape', 3),
(19, 4, 4, 'Manhattan', 2),
(20, 4, 5, 'Tony Stark', 1);
*/
INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
VALUES
(1, 1, 1, 'Yellow', 5),

View File

@ -7,7 +7,7 @@ describe('Client listWorkers', () => {
.then(result => {
let amountOfEmployees = Object.keys(result).length;
expect(amountOfEmployees).toEqual(39);
expect(amountOfEmployees).toEqual(41);
done();
})
.catch(catchErrors(done));