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

This commit is contained in:
Gerard 2018-03-26 14:57:32 +02:00
commit 58c6c080eb
19 changed files with 102 additions and 196 deletions

View File

@ -8,6 +8,7 @@
</input>
<div class="icons">
<vn-icon
ng-show="!$ctrl.disabled"
icon="clear"
class="clear"
ng-click="$ctrl.onClearClick($event)"

View File

@ -1,5 +1,5 @@
import ngModule from '../../module';
import Component from '../../lib/component';
import Input from '../../lib/input';
import './style.scss';
/**
@ -11,7 +11,7 @@ import './style.scss';
* @property {Object} intialData A initial data to avoid the server request used to get the selection
* @property {Boolean} multiple Wether to allow multiple selection
*/
export default class Autocomplete extends Component {
export default class Autocomplete extends Input {
constructor($element, $scope, $http, $transclude) {
super($element, $scope);
this.$http = $http;

View File

@ -9,8 +9,8 @@
show="$ctrl.showDropDown"
selected="$ctrl.selected"
filter="true"
parent="$ctrl.element"
></vn-drop-down>
parent="$ctrl.element">
</vn-drop-down>
</div>
<div ng-if="$ctrl.findMore">
<vn-drop-down
@ -21,7 +21,7 @@
load-more="$ctrl.getItems()"
show-load-more="$ctrl.maxRow"
filter-action="$ctrl.findItems(search)"
parent="$ctrl.element"
></vn-drop-down>
parent="$ctrl.element">
</vn-drop-down>
</div>
</div>

View File

@ -20,7 +20,7 @@
info_outline
</i>
<i class="material-icons pointer"
ng-show="$ctrl.hasValue && ($ctrl.hasFocus || $ctrl.hasMouseIn)"
ng-show="!$ctrl.disabled && $ctrl.hasValue && ($ctrl.hasFocus || $ctrl.hasMouseIn)"
ng-click="$ctrl.clear()">
clear
</i>

View File

@ -71,7 +71,7 @@
}
},
{
"url": "/Expedition",
"url": "/expedition",
"state": "ticket.card.expedition",
"component": "vn-ticket-expedition",
"params": {
@ -82,6 +82,18 @@
"icon": "icon-volum"
}
},
{
"url": "/mana",
"state": "ticket.card.mana",
"component": "vn-ticket-mana",
"params": {
"ticket": "$ctrl.ticket"
},
"menu": {
"description": "Mana",
"icon": "icon-sms"
}
},
{
"url" : "/package",
"state": "ticket.card.package",

View File

@ -0,0 +1,8 @@
<vn-vertical style="text-align:center">
<vn-one>{{::$ctrl.sale.concept}}</vn-one>
<vn-one>
<vn-one ng-repeat="fetchedTag in $ctrl.sale.itemTag track by $index">
<vn-label>{{::fetchedTag.tag.name}} </vn-label>{{::fetchedTag.value}}
</vn-one>
</vn-one>
</vn-vertical>

View File

@ -0,0 +1,12 @@
import ngModule from '../module';
class Controller {}
Controller.$inject = [];
ngModule.component('vnFetchedTags', {
template: require('./fetched-tags.html'),
controller: Controller,
bindings: {
sale: '<'
}
});

View File

@ -1,39 +1,30 @@
<mg-ajax path="/ticket/api/sales/filter" options="vnIndexNonAuto"></mg-ajax>
<vn-vertical>
<vn-card pad-large>
<vn-vertical>
<vn-title>Sale</vn-title>
<table class="vn-grid">
<thead>
<tr>
<th number translate>Item</th>
<th translate style="text-align:center">Description</th>
<th number translate>Quantity</th>
<th number translate>Price</th>
<th number translate>Discount</th>
<th number translate>Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="sale in index.model.instances track by sale.id">
<td number>{{::sale.itemFk}}</td>
<td>
<vn-vertical style="text-align:center">
<vn-one>{{::sale.concept}}</vn-one>
<vn-one>
<vn-one ng-repeat="fetchedTag in sale.itemTag track by $index">
<vn-label>{{::fetchedTag.tag.name}} </vn-label>{{::fetchedTag.value}}
</vn-one>
</vn-one>
</vn-vertical>
</td>
<td number>{{::sale.quantity}}</td>
<td number>{{::sale.price | currency:'€':2}}</td>
<td number>{{::sale.discount}} %</td>
<td number>{{::sale.quantity * sale.price | currency:'€':2}}</td>
</tr>
</tbody>
</table>
</vn-vertical>
<vn-vertical>
<vn-title>Sale</vn-title>
<table class="vn-grid">
<thead>
<tr>
<th number translate>Item</th>
<th translate style="text-align:center">Description</th>
<th number translate>Quantity</th>
<th number translate>Price</th>
<th number translate>Discount</th>
<th number translate>Amount</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="sale in index.model.instances track by sale.id">
<td number>{{::sale.itemFk}}</td>
<td><vn-fetched-tags sale="sale"/></td>
<td number>{{::sale.quantity}}</td>
<td number>{{::sale.price | currency:'€':2}}</td>
<td number>{{::sale.discount}} %</td>
<td number>{{::sale.quantity * sale.price | currency:'€':2}}</td>
</tr>
</tbody>
</table>
</vn-vertical>
</vn-card>
</vn-vertical>

View File

@ -11,3 +11,4 @@ import './volume/ticket-volume';
import './package/package';
import './sale/sale';
import './tracking/tracking';
import './fetched-tags/fetched-tags';

View File

@ -19,121 +19,6 @@ class Controller {
this.ticketVolumes = response.data;
});
}
// _setIconAdd() {
// if (this.ticketVolumes.length) {
// this.ticketVolumes.map(element => {
// element.showAddIcon = false;
// return true;
// });
// this.ticketVolumes[this.ticketVolumes.length - 1].showAddIcon = true;
// }
// }
// _setDirtyForm() {
// if (this.$scope.form) {
// this.$scope.form.$setDirty();
// }
// }
// _unsetDirtyForm() {
// if (this.$scope.form) {
// this.$scope.form.$setPristine();
// }
// }
// addVolume() {
// this.ticketVolumes.push({description: null, ticketFk: this.params.id, showAddIcon: true});
// this._setIconAdd();
// }
// removeVolume(index) {
// let item = this.ticketVolumes[index];
// if (item) {
// this.ticketVolumes.splice(index, 1);
// this._setIconAdd();
// if (item.id) {
// this.removedVolumes.push(item.id);
// this._setDirtyForm();
// }
// }
// }
// _equalVolumes(oldVolume, newVolume) {
// return oldVolume.id === newVolume.id && oldVolume.VolumeTypeFk === newVolume.VolumeTypeFk && oldVolume.description === newVolume.description;
// }
// setOldVolumes(response) {
// this._setIconAdd();
// response.data.forEach(Volume => {
// this.oldVolumes[Volume.id] = Object.assign({}, Volume);
// });
// }
// getVolumes() {
// let filter = {
// where: {ticketFk: this.params.id},
// include: ['VolumeType']
// };
// this.$http.get(`/ticket/api/TicketVolumes?filter=${JSON.stringify(filter)}`).then(response => {
// this.ticketVolumes = response.data;
// this.setOldVolumes(response);
// });
// }
// submit() {
// let typesDefined = [];
// let repeatedType = false;
// let canSubmit;
// let VolumesObj = {
// delete: this.removedVolumes,
// create: [],
// update: []
// };
// this.ticketVolumes.forEach(Volume => {
// let isNewVolume = !Volume.id;
// delete Volume.showAddIcon;
// if (typesDefined.indexOf(Volume.VolumeTypeFk) !== -1) {
// repeatedType = true;
// return;
// }
// typesDefined.push(Volume.VolumeTypeFk);
// if (isNewVolume && Volume.description && Volume.VolumeTypeFk) {
// VolumesObj.create.push(Volume);
// }
// if (!isNewVolume && !this._equalVolumes(this.oldVolumes[Volume.id], Volume)) {
// VolumesObj.update.push(Volume);
// }
// });
// if (this.$scope.form.$invalid) {
// return this.vnApp.showMessage(this.$translate.instant('Some fields are invalid'));
// }
// if (repeatedType) {
// return this.vnApp.showMessage(this.$translate.instant('The Volume type must be unique'));
// }
// canSubmit = VolumesObj.update.length > 0 || VolumesObj.create.length > 0 || VolumesObj.delete.length > 0;
// if (canSubmit) {
// return this.$http.post(`/ticket/api/TicketVolumes/crudTicketVolumes`, VolumesObj).then(() => {
// this.getVolumes();
// this._unsetDirtyForm();
// });
// }
// this.vnApp.showMessage(this.$translate.instant('No changes to save'));
// }
$onInit() {
// this.getVolumes();
}
}
Controller.$inject = ['$stateParams', '$scope', '$http', '$translate', 'vnApp'];

View File

@ -167,8 +167,6 @@ export default {
intrastatSelectOptionOne: `${components.vnAutocomplete}[field="$ctrl.item.intrastatFk"] vn-drop-down ul > li:nth-child(2)`,
originSelect: `${components.vnAutocomplete}[field="$ctrl.item.originFk"] input`,
originSelectOptionOne: `${components.vnAutocomplete}[field="$ctrl.item.originFk"] vn-drop-down ul > li:nth-child(2)`,
expenceSelect: `${components.vnAutocomplete}[field="$ctrl.item.expenceFk"] input`,
expenceSelectOptionOne: `${components.vnAutocomplete}[field="$ctrl.item.expenceFk"] vn-drop-down ul > li:nth-child(2)`,
createButton: `${components.vnSubmit}`
},
@ -242,15 +240,15 @@ export default {
firstWarehouseSelect: `${components.vnAutocomplete}[field="itemNiche.warehouseFk"] input`,
firstWarehouseDisabled: `vn-horizontal:nth-child(2) > vn-textfield[label="Warehouse"] > div > input`,
firstWarehouseSelectSecondOption: `${components.vnAutocomplete}[field="itemNiche.warehouseFk"] vn-drop-down ul > li:nth-child(2)`,
firstCodeInput: `vn-horizontal:nth-child(2) > vn-textfield[label="code"] > div > input`,
firstCodeInput: `vn-horizontal:nth-child(2) > vn-textfield[label="Code"] > div > input`,
secondWarehouseSelect: `vn-horizontal:nth-child(3) > ${components.vnAutocomplete}[field="itemNiche.warehouseFk"] input`,
secondWarehouseDisabled: `vn-horizontal:nth-child(3) > vn-textfield[label="Warehouse"] > div > input`,
secondCodeInput: `vn-horizontal:nth-child(3) > vn-textfield[label="code"] > div > input`,
secondCodeInput: `vn-horizontal:nth-child(3) > vn-textfield[label="Code"] > div > input`,
secondNicheRemoveButton: `vn-horizontal:nth-child(3) > vn-one > ${components.vnIcon}[icon="remove_circle_outline"]`,
thirdWarehouseSelect: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemNiche.warehouseFk"] input`,
thirdWarehouseDisabled: `vn-horizontal:nth-child(4) > vn-textfield[label="Warehouse"] > div > input`,
thirdWarehouseSelectFourthOption: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemNiche.warehouseFk"] vn-drop-down ul > li:nth-child(4)`,
thirdCodeInput: `vn-horizontal:nth-child(4) > vn-textfield[label="code"] > div > input`,
thirdCodeInput: `vn-horizontal:nth-child(4) > vn-textfield[label="Code"] > div > input`,
submitNichesButton: `${components.vnSubmit}`
},
itemBotanical: {
@ -279,7 +277,7 @@ export default {
searchButton: `${components.vnSearchBar} > vn-icon-button > button`
},
ticketNotes: {
notesButton: `${components.vnMenuItem}[ui-sref="ticket.card.observations"]`,
notesButton: `${components.vnMenuItem}[ui-sref="ticket.card.observation"]`,
firstNoteRemoveButton: `${components.vnIcon}[icon="remove_circle_outline"]`,
addNoteButton: `${components.vnIcon}[icon="add_circle"]`,
firstNoteSelect: `${components.vnAutocomplete}[field="ticketObservation.observationTypeFk"] input`,

View File

@ -112,7 +112,7 @@ describe('edit item basic data path', () => {
return nightmare
.getInputValue(selectors.itemBasicData.expenceSelect)
.then(result => {
expect(result).toEqual('loan');
expect(result).toEqual('Adquisición mercancia Extracomunitaria');
});
});
});

View File

@ -51,8 +51,6 @@ describe('Item', () => {
.waitToClick(selectors.itemCreateView.intrastatSelectOptionOne)
.waitToClick(selectors.itemCreateView.originSelect)
.waitToClick(selectors.itemCreateView.originSelectOptionOne)
.waitToClick(selectors.itemCreateView.expenceSelect)
.waitToClick(selectors.itemCreateView.expenceSelectOptionOne)
.click(selectors.itemCreateView.createButton)
.waitForSnackbar()
.then(result => {
@ -81,11 +79,6 @@ describe('Item', () => {
})
.then(result => {
expect(result).toBe('Spain');
return nightmare
.getInputValue(selectors.itemBasicData.expenceSelect);
})
.then(result => {
expect(result).toBe('loan');
});
});
});

View File

@ -36,10 +36,10 @@ describe('create ticket notes path', () => {
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketNotes.notesButton)
.waitForURL('observations')
.waitForURL('observation')
.url()
.then(url => {
expect(url).toContain('observations');
expect(url).toContain('observation');
});
});

View File

@ -36,10 +36,10 @@ describe('delete ticket expeditions path', () => {
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketExpedition.expeditionButton)
.waitForURL('Expedition')
.waitForURL('expedition')
.url()
.then(url => {
expect(url).toContain('Expedition');
expect(url).toContain('expedition');
});
});

View File

@ -1,22 +1,22 @@
module.exports = function(Self) {
require('../methods/creditInsurance/filter.js')(Self);
Self.validateCredit = function(credit) {
return credit >= 0;
};
Self.validateBinded('credit', Self.validateCredit, {
message: 'The credit must be an integer greater than or equal to zero',
allowNull: false, // FIXME: Ignored by loopback when it's false
allowBlank: false
});
Self.validateCredit = function(credit) {
return (credit >= 0 && credit % 1 == 0);
Self.validateGrade = function(grade) {
return typeof grade === 'undefined' || grade >= 0;
};
Self.validateBinded('grade', Self.validateGrade, {
message: 'The grade must be an integer greater than or equal to zero',
allowNull: true
});
Self.validateGrade = function(grade) {
return (typeof grade === 'undefined' || (grade >= 0 && grade % 1 == 0));
};
};

File diff suppressed because one or more lines are too long

View File

@ -384,18 +384,13 @@ INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`)
(05080000, 'Coral y materiales similares' , 2, 2),
(06021010, 'Plantas vivas: Esqueje/injerto, Vid', 1, 1);
INSERT INTO `vn`.`expence`(`id`, `taxTypeFk`, `name`, `isWithheld`)
VALUES
(1, 1, 'bail', 0),
(2, 1, 'loan', 1);
INSERT INTO `vn`.`item`(`id`, `name`,`typeFk`,`size`,`inkFk`,`category`,`stems`,`originFk`,`description`,`producerFk`,`intrastatFk`,`isOnOffer`,`expenceFk`,`isBargain`,`comment`,`relevancy`,`image`,`taxClassFk`)
VALUES
(1, 'Gem of Time', 2, 70, 'AMA', 'EXT', 1, 1, 'One of the infinity gems', 1, 06021010, 0, 1, 0, NULL, 0, 66540, 1),
(2, 'Gem of Mind', 2, 70, 'AZL', 'EXT', 1, 2, 'One of the infinity gems', 1, 06021010, 0, 1, 0, NULL, 0, 65540, 1),
(3, 'Iron Patriot', 1, 60, 'AMR', 'EXT', 1, 3, 'Rhodeys armor', 1, 05080000, 0, 1, 0, NULL, 0, 61692, 1),
(4, 'Mark I', 1, 60, 'AMR', 'EXT', 1, 1, 'Iron Mans first armor', 1, 05080000, 1, 2, 0, NULL, 0, 66090, 2),
(5, 'Mjolnir', 3, 30, 'AZR', 'EXT', 1, 2, 'Thors hammer!', 2, 06021010, 1, 2, 0, NULL, 0, 67350, 2);
(1, 'Gem of Time', 2, 70, 'AMA', 'EXT', 1, 1, 'One of the infinity gems', 1, 06021010, 0, 2000000000, 0, NULL, 0, 66540, 1),
(2, 'Gem of Mind', 2, 70, 'AZL', 'EXT', 1, 2, 'One of the infinity gems', 1, 06021010, 0, 2000000000, 0, NULL, 0, 65540, 1),
(3, 'Iron Patriot', 1, 60, 'AMR', 'EXT', 1, 3, 'Rhodeys armor', 1, 05080000, 0, 4751000000, 0, NULL, 0, 61692, 1),
(4, 'Mark I', 1, 60, 'AMR', 'EXT', 1, 1, 'Iron Mans first armor', 1, 05080000, 1, 4751000000, 0, NULL, 0, 66090, 2),
(5, 'Mjolnir', 3, 30, 'AZR', 'EXT', 1, 2, 'Thors hammer!', 2, 06021010, 1, 4751000000, 0, NULL, 0, 67350, 2);
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`)
VALUES

View File

@ -6,7 +6,7 @@ mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> 02-dumpedFix
echo USE `vn`; >> 02-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak >> 02-dumpedFixtures.sql
echo USE `vn2008`; >> 02-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits >> 02-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos >> 02-dumpedFixtures.sql