diff --git a/@salix/app/src/components/main-menu/main-menu.js b/@salix/app/src/components/main-menu/main-menu.js index e9c1e4626..b79f64141 100644 --- a/@salix/app/src/components/main-menu/main-menu.js +++ b/@salix/app/src/components/main-menu/main-menu.js @@ -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); diff --git a/@salix/core/src/core.js b/@salix/core/src/core.js index b0b011074..f70bb48e4 100644 --- a/@salix/core/src/core.js +++ b/@salix/core/src/core.js @@ -1,54 +1,54 @@ -require('./mdl-override.css'); - -export * from './module'; -export * from './util'; - -export {SplitingRegister as splitingRegister} from './splitingregister'; -export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents'; -export {NAME as INTERPOLATE, Interpolate} from './interpolate'; -export {NAME as ROUTES_LOADER, RoutesLoader} from './routesLoader'; - -export {NAME as FOCUS, directive as Focus} from './focus'; -export {NAME as RULE, directive as Rule} from './rule'; - -export {NAME as BUTTON, directive as ButtonDirective} from './button/button'; -export {NAME as BUTTON_MDL, factory as buttonMdl} from './button/button.mdl'; -export {NAME as BUTTON_BT, factory as buttonBt} from './button/button.bt'; -export {NAME as CHECK, directive as CheckDirective} from './check/check'; -export {NAME as CHECK_MDL, factory as checknMdl} from './check/check.mdl'; -export {NAME as CHECK_BT, factory as checkBt} from './check/check.bt'; -export {NAME as RADIO, directive as RadioDirective} from './radio/radio'; -export {NAME as RADIO_MDL, factory as radionMdl} from './radio/radio.mdl'; -export {NAME as RADIO_BT, factory as radioBt} from './radio/radio.bt'; -export {NAME as TEXTFIELD, directive as TextfieldDirective} from './textfield/textfield'; -export {NAME as TEXTFIELD_MDL, factory as textfieldMdl} from './textfield/textfield.mdl'; -export {NAME as TEXTFIELD_BT, factory as textfieldBt} from './textfield/textfield.bt'; -export {NAME as LABEL, directive as LabelDirective} from './label/label'; -export {NAME as LABEL_MDL, factory as labelMdl} from './label/label.mdl'; -export {NAME as LABEL_BT, factory as labelBt} from './label/label.bt'; -export {NAME as ICON_BUTTON, directive as IconButtonDirective} from './icon-button/icon-button'; -export {NAME as ICON_BUTTON_MDL, factory as iconButtonMdl} from './icon-button/icon-button.mdl'; -export {NAME as PASSWORD, directive as PasswordDirective} from './password/password'; -export {NAME as PASSWORD_MDL, factory as passwordMdl} from './password/password.mdl'; -export {NAME as SUBMIT, directive as SubmitDirective} from './submit/submit'; -export {NAME as SUBMIT_MDL, factory as submitMdl} from './submit/submit.mdl'; -export {NAME as SNACKBAR, directive as SnackbarDirective} from './snackbar/snackbar'; -export {NAME as SNACKBAR_MDL, factory as snackbarMdl} from './snackbar/snackbar.mdl'; -export {NAME as SPINNER, directive as SpinnerDirective} from './spinner/spinner'; -export {NAME as SPINNER_MDL, factory as spinnerMdl} from './spinner/spinner.mdl'; -export {NAME as COMBO, directive as ComboDirective} from './combo/combo'; -export {NAME as COMBO_MDL, factory as comboMdl} from './combo/combo.mdl'; -export {NAME as DATE_PICKER, directive as DatePickerDirective} from './date-picker/date-picker'; -export {NAME as DATE_PICKER_MDL, factory as datePickerMdl} from './date-picker/date-picker.mdl'; -export {NAME as CARD, directive as CardDirective} from './card/card'; -export {NAME as CARD_MDL, factory as cardMdl} from './card/card.mdl'; -export {NAME as SWITCH, directive as SwitchDirective} from './switch/switch'; -export {NAME as SWITCH_MDL, factory as switchdMdl} from './switch/switch.mdl'; - -export {directive as Popover} from './popover/popover'; -export {factory as PopoverMdl} from './popover/popover.mdl'; -export {directive as Icon} from './icon/icon'; -export {factory as IconMdl} from './icon/icon.mdl'; - -export {NAME as TITLE, COMPONENT as TITLE_COMPONENT} from './title/title'; -export {NAME as SUBTITLE, COMPONENT as SUBTITLE_COMPONENT} from './subtitle/subtitle'; +require('./mdl-override.css'); + +export * from './module'; +export * from './util'; + +export {SplitingRegister as splitingRegister} from './splitingregister'; +export {NAME as RESOLVEDEFAULTCOMPONENT, ResolveDefaultComponent} from './resolveDefaultComponents'; +export {NAME as INTERPOLATE, Interpolate} from './interpolate'; +export {NAME as ROUTES_LOADER, RoutesLoader} from './routesLoader'; + +export {NAME as FOCUS, directive as Focus} from './focus'; +export {NAME as RULE, directive as Rule} from './rule'; + +export {NAME as BUTTON, directive as ButtonDirective} from './button/button'; +export {NAME as BUTTON_MDL, factory as buttonMdl} from './button/button.mdl'; +export {NAME as BUTTON_BT, factory as buttonBt} from './button/button.bt'; +export {NAME as CHECK, directive as CheckDirective} from './check/check'; +export {NAME as CHECK_MDL, factory as checknMdl} from './check/check.mdl'; +export {NAME as CHECK_BT, factory as checkBt} from './check/check.bt'; +export {NAME as RADIO, directive as RadioDirective} from './radio/radio'; +export {NAME as RADIO_MDL, factory as radionMdl} from './radio/radio.mdl'; +export {NAME as RADIO_BT, factory as radioBt} from './radio/radio.bt'; +export {NAME as TEXTFIELD, directive as TextfieldDirective} from './textfield/textfield'; +export {NAME as TEXTFIELD_MDL, factory as textfieldMdl} from './textfield/textfield.mdl'; +export {NAME as TEXTFIELD_BT, factory as textfieldBt} from './textfield/textfield.bt'; +export {NAME as LABEL, directive as LabelDirective} from './label/label'; +export {NAME as LABEL_MDL, factory as labelMdl} from './label/label.mdl'; +export {NAME as LABEL_BT, factory as labelBt} from './label/label.bt'; +export {NAME as ICON_BUTTON, directive as IconButtonDirective} from './icon-button/icon-button'; +export {NAME as ICON_BUTTON_MDL, factory as iconButtonMdl} from './icon-button/icon-button.mdl'; +export {NAME as PASSWORD, directive as PasswordDirective} from './password/password'; +export {NAME as PASSWORD_MDL, factory as passwordMdl} from './password/password.mdl'; +export {NAME as SUBMIT, directive as SubmitDirective} from './submit/submit'; +export {NAME as SUBMIT_MDL, factory as submitMdl} from './submit/submit.mdl'; +export {NAME as SNACKBAR, directive as SnackbarDirective} from './snackbar/snackbar'; +export {NAME as SNACKBAR_MDL, factory as snackbarMdl} from './snackbar/snackbar.mdl'; +export {NAME as SPINNER, directive as SpinnerDirective} from './spinner/spinner'; +export {NAME as SPINNER_MDL, factory as spinnerMdl} from './spinner/spinner.mdl'; +export {NAME as COMBO, directive as ComboDirective} from './combo/combo'; +export {NAME as COMBO_MDL, factory as comboMdl} from './combo/combo.mdl'; +export {NAME as DATE_PICKER, directive as DatePickerDirective} from './date-picker/date-picker'; +export {NAME as DATE_PICKER_MDL, factory as datePickerMdl} from './date-picker/date-picker.mdl'; +export {NAME as CARD, directive as CardDirective} from './card/card'; +export {NAME as CARD_MDL, factory as cardMdl} from './card/card.mdl'; +export {NAME as SWITCH, directive as SwitchDirective} from './switch/switch'; +export {NAME as SWITCH_MDL, factory as switchdMdl} from './switch/switch.mdl'; + +export {directive as Popover} from './popover/popover'; +export {factory as PopoverMdl} from './popover/popover.mdl'; +export {directive as Icon} from './icon/icon'; +export {factory as IconMdl} from './icon/icon.mdl'; + +export {NAME as TITLE, COMPONENT as TITLE_COMPONENT} from './title/title'; +export {NAME as SUBTITLE, COMPONENT as SUBTITLE_COMPONENT} from './subtitle/subtitle'; diff --git a/@salix/core/src/module.js b/@salix/core/src/module.js index 98383f185..83c25dd76 100644 --- a/@salix/core/src/module.js +++ b/@salix/core/src/module.js @@ -1,6 +1,6 @@ -import * as vendors from 'vendor'; -import {getModuleName,getVendorDependencies} from './util'; - -const DEPENDENCIES = getVendorDependencies(vendors) -export const NAME = getModuleName('core'); -export const module = vendors.ng.module(NAME,DEPENDENCIES); +import * as vendors from 'vendor'; +import {getModuleName, getVendorDependencies} from './util'; + +const DEPENDENCIES = getVendorDependencies(vendors); +export const NAME = getModuleName('core'); +export const module = vendors.ng.module(NAME, DEPENDENCIES); diff --git a/@salix/core/src/rule.js b/@salix/core/src/rule.js index b7d768f1d..addf815d2 100644 --- a/@salix/core/src/rule.js +++ b/@salix/core/src/rule.js @@ -4,8 +4,8 @@ export const NAME = 'vnRule'; export function directive() { return { restrict: 'A', - link: function (attrs, element) { - } + link: function(attrs, element) { + } }; } module.directive(NAME, directive); diff --git a/@salix/crud/src/client/addresses-data/index.html b/@salix/crud/src/client/addresses-data/index.html new file mode 100644 index 000000000..6ab814f7c --- /dev/null +++ b/@salix/crud/src/client/addresses-data/index.html @@ -0,0 +1,35 @@ +
+ + + + Consignatario + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/@salix/crud/src/client/addresses-data/index.js b/@salix/crud/src/client/addresses-data/index.js new file mode 100644 index 000000000..2a5a27d83 --- /dev/null +++ b/@salix/crud/src/client/addresses-data/index.js @@ -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); diff --git a/@salix/crud/src/client/addresses/index.html b/@salix/crud/src/client/addresses/index.html index 71f08c750..6c172b366 100644 --- a/@salix/crud/src/client/addresses/index.html +++ b/@salix/crud/src/client/addresses/index.html @@ -1,7 +1,10 @@ - + - Addresses + + Consignatario + + @@ -11,9 +14,7 @@
{{i.city}}, {{i.province}}
{{i.phone}}, {{i.mobile}}
- - - +
diff --git a/@salix/crud/src/client/addresses/index.js b/@salix/crud/src/client/addresses/index.js index f00d9ea39..2d5cf4fe2 100644 --- a/@salix/crud/src/client/addresses/index.js +++ b/@salix/crud/src/client/addresses/index.js @@ -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) + ); + }; } }; diff --git a/@salix/crud/src/client/basic-data/index.js b/@salix/crud/src/client/basic-data/index.js index a883e09b3..5e283f555 100644 --- a/@salix/crud/src/client/basic-data/index.js +++ b/@salix/crud/src/client/basic-data/index.js @@ -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) diff --git a/@salix/crud/src/client/client.js b/@salix/crud/src/client/client.js index 386b49a9e..366853b42 100644 --- a/@salix/crud/src/client/client.js +++ b/@salix/crud/src/client/client.js @@ -19,4 +19,6 @@ export {NAME as CLIENT_SEARCH_PANEL, 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'; \ No newline at end of file + 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'; diff --git a/@salix/crud/src/client/routes.js b/@salix/crud/src/client/routes.js index 4d2c9d163..293a49358 100644 --- a/@salix/crud/src/client/routes.js +++ b/@salix/crud/src/client/routes.js @@ -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" + }, + ] } \ No newline at end of file diff --git a/@salix/vendor/src/util.js b/@salix/vendor/src/util.js index fdf3a36d8..494f1f6e0 100644 --- a/@salix/vendor/src/util.js +++ b/@salix/vendor/src/util.js @@ -1,11 +1,11 @@ -export function getComponentName(name, isProvider){ - if(isProvider){ +export function getComponentName(name, isProvider) { + if (isProvider) { return { - name: name, + name: name, provider: name + "Provider" - } - } + }; + } return { name: name - } + }; } diff --git a/db.json b/db.json index 6f3d37c0a..68cf05a8a 100644 --- a/db.json +++ b/db.json @@ -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}" } } } \ No newline at end of file diff --git a/services/client/common/models/Address.json b/services/client/common/models/Address.json index 01c060a4b..27e395ebc 100644 --- a/services/client/common/models/Address.json +++ b/services/client/common/models/Address.json @@ -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" + } + } } diff --git a/services/client/common/models/Agency.json b/services/client/common/models/Agency.json new file mode 100644 index 000000000..33cd2944d --- /dev/null +++ b/services/client/common/models/Agency.json @@ -0,0 +1,15 @@ +{ + "name": "Agency", + "base": "PersistedModel", + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string", + "required": "true" + } + } +} diff --git a/services/client/common/models/Country.json b/services/client/common/models/Country.json new file mode 100644 index 000000000..464380345 --- /dev/null +++ b/services/client/common/models/Country.json @@ -0,0 +1,15 @@ +{ + "name": "Country", + "base": "PersistedModel", + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string", + "required": "true" + } + } +} \ No newline at end of file diff --git a/services/client/common/models/Province.json b/services/client/common/models/Province.json new file mode 100644 index 000000000..16738ef16 --- /dev/null +++ b/services/client/common/models/Province.json @@ -0,0 +1,15 @@ +{ + "name": "Province", + "base": "PersistedModel", + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string", + "required": "true" + } + } +} \ No newline at end of file diff --git a/services/client/server/model-config.json b/services/client/server/model-config.json index 16701ccfe..3990548e5 100644 --- a/services/client/server/model-config.json +++ b/services/client/server/model-config.json @@ -47,5 +47,17 @@ "Address": { "dataSource": "db", "public": true + }, + "Agency": { + "dataSource": "db", + "public": true + }, + "Province": { + "dataSource": "db", + "public": true + }, + "Country": { + "dataSource": "db", + "public": true } -} +} \ No newline at end of file diff --git a/services/nginx/logs/error.log b/services/nginx/logs/error.log index 0e6e26399..05a8df933 100644 --- a/services/nginx/logs/error.log +++ b/services/nginx/logs/error.log @@ -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