Merge branch 'dev' of http://git.verdnatura.es/salix into dev
This commit is contained in:
commit
801926bd27
|
@ -46,6 +46,47 @@
|
||||||
<vn-textfield vn-one label="Phone" field="$ctrl.address.phone"></vn-textfield>
|
<vn-textfield vn-one label="Phone" field="$ctrl.address.phone"></vn-textfield>
|
||||||
<vn-textfield vn-one label="Mobile" field="$ctrl.address.mobile"></vn-textfield>
|
<vn-textfield vn-one label="Mobile" field="$ctrl.address.mobile"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
|
||||||
|
<vn-one margin-medium-top>
|
||||||
|
<vn-title>Notes</vn-title>
|
||||||
|
<mg-ajax path="/client/api/ObservationTypes" options="mgIndex as observationsTypes"></mg-ajax>
|
||||||
|
<vn-horizontal ng-repeat="note in $ctrl.notes track by note.id">
|
||||||
|
<vn-autocomplete
|
||||||
|
vn-one
|
||||||
|
initial-data = "note.observationType"
|
||||||
|
field = "note.observationTypeFk"
|
||||||
|
data = "observationsTypes.model"
|
||||||
|
show-field = "description"
|
||||||
|
label = "Observation type"
|
||||||
|
order = "description ASC"
|
||||||
|
filter-search="{where: {description: {regexp: 'search'}} }"
|
||||||
|
>
|
||||||
|
<tpl-item>{{$parent.$parent.item.description}}</tpl-item>
|
||||||
|
</vn-autocomplete>
|
||||||
|
<vn-textfield vn-three label="Description" model="note.description"></vn-textfield>
|
||||||
|
<vn-one pad-medium-top>
|
||||||
|
<vn-icon
|
||||||
|
pointer
|
||||||
|
medium-grey
|
||||||
|
icon="remove_circle_outline"
|
||||||
|
ng-if = "note.showRemoveIcon"
|
||||||
|
ng-click="$ctrl.removeNote(note.id)"
|
||||||
|
>
|
||||||
|
</vn-icon>
|
||||||
|
<vn-icon
|
||||||
|
pointer
|
||||||
|
margin-medium-left
|
||||||
|
orange
|
||||||
|
icon="add_circle"
|
||||||
|
ng-if = "note.showAddIcon"
|
||||||
|
ng-click="$ctrl.addNote()"
|
||||||
|
></vn-icon>
|
||||||
|
</vn-one>
|
||||||
|
</vn-horizontal>
|
||||||
|
|
||||||
|
</vn-one>
|
||||||
|
|
||||||
|
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-button-bar>
|
<vn-button-bar>
|
||||||
|
|
|
@ -1,13 +1,76 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
|
||||||
export default class Controller {
|
export default class Controller {
|
||||||
constructor($state) {
|
constructor($state, $http) {
|
||||||
this.address = {
|
this.address = {
|
||||||
id: parseInt($state.params.addressId)
|
id: parseInt($state.params.addressId)
|
||||||
};
|
};
|
||||||
|
this.$http = $http;
|
||||||
|
this.notes = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
_setIconAdd() {
|
||||||
|
if (this.notes.length) {
|
||||||
|
this.notes.forEach(element => {
|
||||||
|
element.showAddIcon = false;
|
||||||
|
});
|
||||||
|
this.notes[this.notes.length - 1].showAddIcon = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_setRemoveAdd() {
|
||||||
|
if (this.notes.length) {
|
||||||
|
this.notes.forEach(element => {
|
||||||
|
element.showRemoveIcon = true;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.notes = [this._createEmptyNote()];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_createEmptyNote() {
|
||||||
|
return {id: this._createFakeId(), observationTypeFk: null, description: null, showRemoveIcon: true, showAddIcon: true};
|
||||||
|
}
|
||||||
|
_createFakeId() {
|
||||||
|
let now = Date.now();
|
||||||
|
let random = Math.ceil((Math.random() * 100000) + 1);
|
||||||
|
return `fakeId${now}${random}`;
|
||||||
|
}
|
||||||
|
addNote() {
|
||||||
|
this.notes.push(this._createEmptyNote());
|
||||||
|
this._setIconAdd();
|
||||||
|
this._setRemoveAdd();
|
||||||
|
}
|
||||||
|
removeNote(id) {
|
||||||
|
let found = false;
|
||||||
|
for (let i = 0; i < this.notes.length; i++) {
|
||||||
|
if (this.notes[i].id === id) {
|
||||||
|
this.notes.splice(i, 1);
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found) {
|
||||||
|
this._setIconAdd();
|
||||||
|
this._setRemoveAdd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$onInit() {
|
||||||
|
let filter = {
|
||||||
|
where: {
|
||||||
|
addressFk: this.address.id
|
||||||
|
},
|
||||||
|
include: [
|
||||||
|
{relation: 'observationType'}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
this.$http.get(`/client/api/AddressObservations?filter=${JSON.stringify(filter)}`).then(res => {
|
||||||
|
this.notes = (res.data && res.data.length) ? res.data : [this._createEmptyNote()];
|
||||||
|
this._setIconAdd();
|
||||||
|
this._setRemoveAdd();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controller.$inject = ['$state'];
|
Controller.$inject = ['$state', '$http'];
|
||||||
|
|
||||||
ngModule.component('vnAddressEdit', {
|
ngModule.component('vnAddressEdit', {
|
||||||
template: require('./address-edit.html'),
|
template: require('./address-edit.html'),
|
||||||
|
|
|
@ -5,21 +5,29 @@
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-title vn-one>Addresses</vn-title>
|
<vn-title vn-one>Addresses</vn-title>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal ng-repeat="i in index.model.items track by i.id" class="pad-medium-top" style="align-items: center;">
|
<vn-horizontal ng-repeat="address in index.model.items track by address.id" class="pad-medium-top" style="align-items: center;">
|
||||||
<vn-one border-radius class="pad-small border-solid"
|
<vn-one border-radius class="pad-small border-solid"
|
||||||
ng-class="{'bg-dark-item': i.isDefaultAddress,'bg-opacity-item': !i.isEnabled && !i.isDefaultAddress}">
|
ng-class="{'bg-dark-item': address.isDefaultAddress,'bg-opacity-item': !address.isEnabled && !address.isDefaultAddress}">
|
||||||
<vn-horizontal style="align-items: center;">
|
<vn-horizontal style="align-items: center;">
|
||||||
<vn-none pad-medium-h style="color:#FFA410;">
|
<vn-none pad-medium-h style="color:#FFA410;">
|
||||||
<i class="material-icons" ng-if="i.isDefaultAddress">star</i>
|
<i class="material-icons" ng-if="address.isDefaultAddress">star</i>
|
||||||
<i class="material-icons pointer" ng-if="!i.isDefaultAddress&&i.isEnabled" vn-tooltip="Set as default" tooltip-position="left" ng-click="$ctrl.setDefault(i.id)">star_border</i>
|
<i class="material-icons pointer" ng-if="!address.isDefaultAddress&&address.isEnabled" vn-tooltip="Set as default" tooltip-position="left" ng-click="$ctrl.setDefault(address.id)">star_border</i>
|
||||||
</vn-none>
|
</vn-none>
|
||||||
<vn-one>
|
<vn-one border-solid-right>
|
||||||
<div><b>{{::i.consignee}}</b></div>
|
<div><b>{{::address.consignee}}</b></div>
|
||||||
<div>{{::i.street}}</div>
|
<div>{{::address.street}}</div>
|
||||||
<div>{{::i.city}}, {{::i.province}}</div>
|
<div>{{::address.city}}, {{::address.province}}</div>
|
||||||
<div>{{::i.phone}}, {{::i.mobile}}</div>
|
<div>{{::address.phone}}, {{::address.mobile}}</div>
|
||||||
</vn-one>
|
</vn-one>
|
||||||
<a vn-auto ui-sref="clientCard.addresses.edit({addressId: {{i.id}}})">
|
|
||||||
|
<vn-vertical vn-one pad-medium-h>
|
||||||
|
<vn-one ng-repeat="observation in address.observations track by $index" ng-class="{'pad-small-top': $index}">
|
||||||
|
<b margin-medium-right>{{::observation.observationType.description}}:</b>
|
||||||
|
<span>{{::observation.description}}</span>
|
||||||
|
</vn-one>
|
||||||
|
</vn-vertical>
|
||||||
|
|
||||||
|
<a vn-auto ui-sref="clientCard.addresses.edit({addressId: {{address.id}}})">
|
||||||
<vn-icon-button icon="edit"></vn-icon-button>
|
<vn-icon-button icon="edit"></vn-icon-button>
|
||||||
</a>
|
</a>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
|
|
@ -14,7 +14,9 @@ class ItemCard {
|
||||||
{relation: "origin"},
|
{relation: "origin"},
|
||||||
{relation: "ink"},
|
{relation: "ink"},
|
||||||
{relation: "producer"},
|
{relation: "producer"},
|
||||||
{relation: "intrastat"}
|
{relation: "intrastat"},
|
||||||
|
{relation: "expence"},
|
||||||
|
{relation: "taxClass"}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
this.$http.get(`/item/api/Items/${this.$state.params.id}?filter=${JSON.stringify(filter)}`).then(
|
this.$http.get(`/item/api/Items/${this.$state.params.id}?filter=${JSON.stringify(filter)}`).then(
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
show-field="name"
|
show-field="name"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
field="$ctrl.item.typeFk"
|
field="$ctrl.item.typeFk"
|
||||||
|
initial-data="$ctrl.item.itemType"
|
||||||
>
|
>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
@ -35,6 +36,7 @@
|
||||||
field="$ctrl.item.intrastatFk"
|
field="$ctrl.item.intrastatFk"
|
||||||
order="description ASC"
|
order="description ASC"
|
||||||
filter-search="{where: {description: {regexp: 'search'}} }"
|
filter-search="{where: {description: {regexp: 'search'}} }"
|
||||||
|
initial-data="$ctrl.item.intrastat"
|
||||||
>
|
>
|
||||||
<tpl-item>{{$parent.$parent.item.description}}</tpl-item>
|
<tpl-item>{{$parent.$parent.item.description}}</tpl-item>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
@ -49,13 +51,28 @@
|
||||||
show-field="name"
|
show-field="name"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
field="$ctrl.item.originFk"
|
field="$ctrl.item.originFk"
|
||||||
|
initial-data="$ctrl.item.origin"
|
||||||
></vn-autocomplete>
|
></vn-autocomplete>
|
||||||
<vn-autocomplete vn-one
|
<vn-autocomplete vn-one
|
||||||
url="/item/api/Expences"
|
url="/item/api/Expences"
|
||||||
label="Expence"
|
label="Expence"
|
||||||
field="$ctrl.item.expenceFk"
|
field="$ctrl.item.expenceFk"
|
||||||
|
initial-data="$ctrl.item.expence"
|
||||||
></vn-autocomplete>
|
></vn-autocomplete>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-autocomplete vn-one
|
||||||
|
url="/item/api/TaxClasses"
|
||||||
|
label="TaxClass"
|
||||||
|
show-field="description"
|
||||||
|
value-field="id"
|
||||||
|
order="description ASC"
|
||||||
|
filter-search="{where: {description: {regexp: 'search'}} }"
|
||||||
|
field="$ctrl.item.taxClassFk"
|
||||||
|
initial-data="$ctrl.item.taxClass"
|
||||||
|
><tpl-item>{{$parent.$parent.item.description}}</tpl-item></vn-autocomplete>
|
||||||
|
<vn-one></vn-one>
|
||||||
|
</vn-horizontal>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-button-bar>
|
<vn-button-bar>
|
||||||
|
|
|
@ -9,4 +9,16 @@ body {
|
||||||
}
|
}
|
||||||
html [uppercase], .uppercase {
|
html [uppercase], .uppercase {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html [green], .green{color: $color-green}
|
||||||
|
html [orange], .orange{color: $color-orange}
|
||||||
|
html [white], .white{color: $color-white}
|
||||||
|
html [dark], .dark{color: $color-dark}
|
||||||
|
html [dark-grey], .dark-grey{color: $color-dark-grey}
|
||||||
|
html [light-grey], .light-grey{color: $color-light-grey}
|
||||||
|
html [medium-grey], .medium-grey{color: $color-medium-grey}
|
||||||
|
html [medium-green], .medium-green{color: $color-medium-green}
|
||||||
|
html [medium-orange], .medium-orange{color: $color-medium-orange}
|
||||||
|
html [light-green], .light-green{color: $color-light-green}
|
||||||
|
html [light-orange], .light-orange{color: $color-light-orange}
|
|
@ -61,10 +61,10 @@ module.exports = function(config) {
|
||||||
|
|
||||||
// start these browsers
|
// start these browsers
|
||||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||||
browsers: ['ChromeNoSandboxHeadless'],
|
browsers: ['ChromiumNoSandboxHeadless'],
|
||||||
customLaunchers: {
|
customLaunchers: {
|
||||||
ChromeNoSandboxHeadless: {
|
ChromiumNoSandboxHeadless: {
|
||||||
base: 'Chrome',
|
base: 'Chromium',
|
||||||
flags: [
|
flags: [
|
||||||
'--no-sandbox',
|
'--no-sandbox',
|
||||||
// See https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
|
// See https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
|
||||||
|
|
|
@ -38,7 +38,8 @@ module.exports = function(Client) {
|
||||||
},
|
},
|
||||||
skip: (params.page - 1) * params.size,
|
skip: (params.page - 1) * params.size,
|
||||||
limit: params.size,
|
limit: params.size,
|
||||||
order: ['isDefaultAddress DESC', 'isEnabled DESC']
|
order: ['isDefaultAddress DESC', 'isEnabled DESC'],
|
||||||
|
include: {observations: 'observationType'}
|
||||||
};
|
};
|
||||||
|
|
||||||
let total = null;
|
let total = null;
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
"name": "AddressObservation",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "addressObservation",
|
||||||
|
"database": "vn"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "Number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"address": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Address",
|
||||||
|
"foreignKey": "addressFk"
|
||||||
|
},
|
||||||
|
"observationType": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "ObservationType",
|
||||||
|
"foreignKey": "observationTypeFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -60,6 +60,11 @@
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "AgencyMode",
|
"model": "AgencyMode",
|
||||||
"foreignKey": "defaultAgencyFk"
|
"foreignKey": "defaultAgencyFk"
|
||||||
|
},
|
||||||
|
"observations": {
|
||||||
|
"type": "hasMany",
|
||||||
|
"model": "AddressObservation",
|
||||||
|
"foreignKey": "addressFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"name": "ObservationType",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "observationType",
|
||||||
|
"database": "vn"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "Number",
|
||||||
|
"id": true,
|
||||||
|
"description": "Identifier"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -74,5 +74,11 @@
|
||||||
},
|
},
|
||||||
"Company": {
|
"Company": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"AddressObservation": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"ObservationType": {
|
||||||
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,11 @@
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Expence",
|
"model": "Expence",
|
||||||
"foreignKey": "expenceFk"
|
"foreignKey": "expenceFk"
|
||||||
|
},
|
||||||
|
"taxClass": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "TaxClass",
|
||||||
|
"foreignKey": "taxClassFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue