Merge branch 'master' of ssh://git.verdnatura.es:/var/lib/git/salix

This commit is contained in:
Juan Ferrer Toribio 2017-01-10 13:46:41 +01:00
commit 248a92fe10
19 changed files with 299 additions and 104 deletions

View File

@ -7,12 +7,11 @@ export const COMPONENT = {
template: template,
controllerAs: "mainMenu",
controller: function() {
this.onLogoutClick = function ()
{
this.onLogoutClick = function() {
let appName = 'salix';
document.cookie = `${appName}-session=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
window.location = `/account?api_key=${appName}`;
}
};
}
};
module.component(NAME, COMPONENT);

View File

@ -1,6 +1,6 @@
import * as vendors from 'vendor';
import {getModuleName,getVendorDependencies} from './util';
import {getModuleName, getVendorDependencies} from './util';
const DEPENDENCIES = getVendorDependencies(vendors)
const DEPENDENCIES = getVendorDependencies(vendors);
export const NAME = getModuleName('core');
export const module = vendors.ng.module(NAME,DEPENDENCIES);
export const module = vendors.ng.module(NAME, DEPENDENCIES);

View File

@ -4,7 +4,7 @@ export const NAME = 'vnRule';
export function directive() {
return {
restrict: 'A',
link: function (attrs, element) {
link: function(attrs, element) {
}
};
}

View File

@ -0,0 +1,35 @@
<form name="form" ng-submit="form.$valid && addressData.submit()" pad-medium>
<vn-vertical pad-medium>
<vn-card >
<vn-vertical pad-large>
<vn-title vn-one>Consignatario</vn-title>
<vn-horizontal>
<vn-check vn-one label="Activo" field="addressData.activo"></vn-check>
<vn-check vn-one label="Predeterminado" field="addressData.address.enabled"></vn-check>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Identificador" field="addressData.address.id" focus></vn-textfield>
<vn-textfield vn-one label="Consignatario" field="addressData.address.consignee"></vn-textfield>
<vn-textfield vn-one label="Domicilio" field="addressData.address.street"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Código Postal" field="addressData.address.postcode"></vn-textfield>
<vn-textfield vn-one label="Municipio" field="addressData.address.city"></vn-textfield>
<vn-combo vn-one label="Provincia" field="addressData.address.province">
<option ng-repeat="p in addressData.provinces" value="{{p.id}}">{{p.name}}</ng-repeat>
</vn-combo>
<vn-textfield vn-one label="Teléfono" field="addressData.address.phone"></vn-textfield>
<vn-textfield vn-one label="Móvil" field="addressData.address.mobile"></vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-combo vn-one label="Agencia" field="addressData.address.agency">
<option ng-repeat="p in addressData.agencies | orderBy:'name'" value="{{p.id}}">{{p.name}}</ng-repeat>
</vn-combo>
</vn-horizontal>
<vn-empty>
<vn-submit label="Guardar" id="save"></vn-submit>
</vn-empty>
</vn-vertical>
</vn-card>
</vn-vertical>
</form>

View File

@ -0,0 +1,39 @@
import template from './index.html';
import {module} from '../../module';
export const NAME = 'vnClientAddressesData';
export const COMPONENT = {
template: template,
controllerAs: 'addressData',
bindings: {
address: '<'
},
controller: function($http,$stateParams)
{
$http.get(`/client/api/Addresses/${$stateParams.addressId}`).then(
json => this.address = json.data,
json => console.error(json.data.error.message)
);
$http.get('/client/api/Agencies').then(
json => this.agencies = json.data,
json => console.error(json.data.error.message)
);
$http.get('/client/api/Provinces').then(
json => this.provinces = json.data,
json => console.error(json.data.error.message)
);
this.submit = function(){
$http.post('/client/api/Addresses', this.address).then(
json => console.log(json.statusText),
json => console.error(json.data.error.message)
);
};
}
};
COMPONENT.controller.$inject = ['$http' , '$stateParams'];
module.component(NAME, COMPONENT);

View File

@ -1,7 +1,10 @@
<vn-vertical pad-medium>
<vn-card >
<vn-card>
<vn-vertical pad-large>
<vn-title>Addresses</vn-title>
<vn-horizontal>
<vn-title vn-one>Consignatario</vn-title>
<a vn-empty ui-sref="clientCard.addressCreate" style="align-items: right;"><vn-button label="Nuevo"></vn-button></a>
</vn-horizontal>
<vn-horizontal ng-repeat="i in address.addresses" class="pad-medium-top" style="align-items: center;">
<vn-auto style="border-radius: .5em;" class="pad-small border-solid">
<vn-horizontal style="align-items: center;">
@ -11,9 +14,7 @@
<div>{{i.city}}, {{i.province}}</div>
<div>{{i.phone}}, {{i.mobile}}</div>
</vn-auto>
<vn-empty>
<vn-icon-button icon="edit"></vn-icon-button>
</vn-empty>
<a vn-empty ui-sref="clientCard.addressEdit({ addressId: {{i.id}} })"><vn-icon-button icon="edit"></vn-icon-button></a>
</vn-horizontal>
</vn-auto>
</vn-horizontal>

View File

@ -5,23 +5,22 @@ export const NAME = 'vnClientAddresses';
export const COMPONENT = {
template: template,
controllerAs: 'address',
bindings: {
adresses: '<',
client: '<'
},
controller: function($http)
{
this.addresses = [];
for (var i = 1; i <= 4; i++)
this.addresses.push({
consignee: "Consignee",
street: "Street",
city: "City",
postcode: "46600",
province: "Province",
country: "Country",
phone: "+XX XXX XX XX XX",
mobile: "+XX 6XX XX XX XX",
enabled: true
});
$http.get('/client/api/Addresses').then(
json => this.addresses = json.data,
json => console.error(json.data.error.message)
);
this.submit = function(){
$http.post('/client/api/Clients', this.model).then(
json => $state.go('clientCard.basicData',{id: json.data.id}),
json => console.error(json.data.error.message)
);
};
}
};

View File

@ -9,7 +9,6 @@ export const COMPONENT = {
client: '='
},
controller: function($http) {
$http.get('/client/api/SalesPeople').then(
json => this.sales = json.data,
json => console.error(json.data.error.message)

View File

@ -20,3 +20,5 @@ export {NAME as CLIENT_ITEM,
COMPONENT as CLIENT_ITEM_COMPONENT} from './index/item-client';
export {NAME as CLIENT_CREATE,
COMPONENT as CLIENT_CREATE_COMPONENT} from './create/index';
export {NAME as CLIENT_ADDRESSES_DATA_INDEX,
COMPONENT as CLIENT_ADDRESSES_DATA_INDEX_COMPONENT} from './addresses-data/index';

View File

@ -59,6 +59,17 @@
url: "/create",
state: "create",
component: "vn-client-create",
}
},
{
url: "/address/create",
state: "clientCard.addressCreate",
component: "vn-client-addresses-data"
},
{
url: "/address/:addressId",
state: "clientCard.addressEdit",
component: "vn-client-addresses-data"
},
]
}

View File

@ -1,11 +1,11 @@
export function getComponentName(name, isProvider){
if(isProvider){
export function getComponentName(name, isProvider) {
if (isProvider) {
return {
name: name,
provider: name + "Provider"
}
};
}
return {
name: name
}
};
}

26
db.json
View File

@ -4,7 +4,11 @@
"AccessToken": 2,
"Client": 15,
"PaymentMethod": 4,
"SalesPerson": 4
"SalesPerson": 4,
"Address": 56,
"Country": 3,
"Province": 3,
"Agency": 4
},
"models": {
"User": {
@ -26,6 +30,26 @@
"1": "{\"id\":1,\"name\":\"Jesus Brocal\"}",
"2": "{\"name\":\"Juan Carlos Lorenzo\",\"id\":2}",
"3": "{\"name\":\"Carlos Zambrano\",\"id\":3}"
},
"Address": {
"1": "{\"street\":\"Avda Espioca 11\",\"consignee\":\"Verndatura Silla\",\"city\":\"Silla\",\"postcode\":\"46900\",\"enabled\":true,\"phone\":\"969999898\",\"mobile\":\"989898888\",\"agencyId\":1,\"provinceId\":1,\"countryId\":1,\"id\":1}",
"2": "{\"street\":\"Avda Espioca 100\",\"consignee\":\"Verndatura Madrid\",\"city\":\"2\",\"postcode\":\"46900\",\"enabled\":true,\"phone\":\"963242100\",\"mobile\":\"649599333\",\"agencyId\":2,\"provinceId\":2,\"countryId\":1,\"id\":2}",
"5": "{\"id\":5,\"street\":\"c/prueba\",\"consignee\":\"prueba\",\"city\":\"Valencia\",\"postcode\":\"46900\",\"phone\":\"659125488\",\"mobile\":\"6987452354\"}",
"34": "{\"id\":34,\"street\":\"prueba34\",\"consignee\":\"prueba34\",\"city\":\"Valencia\",\"postcode\":\"46900\",\"phone\":\"636898196\",\"mobile\":\"636898196\"}",
"55": "{\"id\":55,\"street\":\"C/ Fernando Senent Perez 11\",\"consignee\":\"prueba55\",\"city\":\"Valencia\",\"postcode\":\"46026\",\"phone\":\"636898196\",\"mobile\":\"636898196\"}"
},
"Country": {
"1": "{\"id\":1,\"name\":\"Spain\"}",
"2": "{\"id\":2,\"name\":\"France\"}"
},
"Province": {
"1": "{\"id\":1,\"name\":\"Valencia\"}",
"2": "{\"id\":2,\"name\":\"Madrid\"}"
},
"Agency": {
"1": "{\"name\":\"Zeleris\",\"id\":1}",
"2": "{\"name\":\"MRW\",\"id\":2}",
"3": "{\"name\":\"DHL\",\"id\":3}"
}
}
}

View File

@ -22,13 +22,6 @@
"postcode": {
"type": "string"
},
"province": {
"type": "string"
},
"country": {
"type": "string",
"required": "true"
},
"enabled": {
"type": "boolean"
},
@ -38,5 +31,22 @@
"mobile": {
"type": "string"
}
},
"relations": {
"agency": {
"type": "belongsTo",
"model": "Agency",
"foreignKey": "agencyId"
},
"country":{
"type": "belongsTo",
"model": "Country",
"foreignKey": "countryId"
},
"province":{
"type": "belongsTo",
"model": "Province",
"foreignKey": "provinceId"
}
}
}

View File

@ -0,0 +1,15 @@
{
"name": "Agency",
"base": "PersistedModel",
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"name": {
"type": "string",
"required": "true"
}
}
}

View File

@ -0,0 +1,15 @@
{
"name": "Country",
"base": "PersistedModel",
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"name": {
"type": "string",
"required": "true"
}
}
}

View File

@ -0,0 +1,15 @@
{
"name": "Province",
"base": "PersistedModel",
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"name": {
"type": "string",
"required": "true"
}
}
}

View File

@ -47,5 +47,17 @@
"Address": {
"dataSource": "db",
"public": true
},
"Agency": {
"dataSource": "db",
"public": true
},
"Province": {
"dataSource": "db",
"public": true
},
"Country": {
"dataSource": "db",
"public": true
}
}

View File

@ -22,3 +22,22 @@
2017/01/03 09:03:51 [notice] 12180#7128: signal process started
2017/01/03 09:10:23 [notice] 10312#10316: signal process started
2017/01/03 09:10:23 [error] 10312#10316: OpenEvent("Global\ngx_stop_7928") failed (2: FormatMessage() error:(15100))
2017/01/04 10:26:40 [notice] 4504#9428: signal process started
2017/01/04 14:07:17 [notice] 11868#5492: signal process started
2017/01/09 11:53:09 [notice] 11240#10704: signal process started
2017/01/09 12:44:02 [notice] 11056#1952: signal process started
2017/01/10 07:17:14 [notice] 8528#7668: signal process started
2017/01/10 07:37:36 [notice] 10004#6120: signal process started
2017/01/10 07:40:59 [notice] 9720#5092: signal process started
2017/01/10 07:54:19 [notice] 8504#5184: signal process started
2017/01/10 08:07:03 [notice] 10248#584: signal process started
2017/01/10 08:11:07 [notice] 12044#12168: signal process started
2017/01/10 08:14:43 [notice] 5184#10924: signal process started
2017/01/10 08:24:48 [notice] 8584#2932: signal process started
2017/01/10 09:05:08 [notice] 7700#11068: signal process started
2017/01/10 09:16:23 [notice] 5476#9244: signal process started
2017/01/10 09:29:47 [notice] 5512#1644: signal process started
2017/01/10 09:34:14 [notice] 8724#8608: signal process started
2017/01/10 10:51:29 [notice] 7236#9764: signal process started
2017/01/10 10:54:19 [notice] 11368#8376: signal process started
2017/01/10 12:26:32 [notice] 6916#8152: signal process started