From dabde7e133873297edc3e8f639afec6ac2d5fdd8 Mon Sep 17 00:00:00 2001 From: nelo Date: Mon, 16 Jan 2017 10:11:11 +0100 Subject: [PATCH 1/3] dialogo al cambiar los datos al realizar un put, machacamos el objeto con la respuesta --- @salix/crud/src/client/basic-data/index.js | 37 ++++++++++------ @salix/crud/src/client/confirm/index.html | 6 +-- @salix/crud/src/client/create/index.html | 39 ++++++++-------- @salix/crud/src/client/create/index.js | 4 +- @salix/crud/src/client/fiscal-data/index.html | 3 +- @salix/crud/src/client/fiscal-data/index.js | 44 +++++++++++++++++-- @salix/crud/src/client/web-access/index.html | 3 +- @salix/crud/src/client/web-access/index.js | 42 ++++++++++++++++-- 8 files changed, 132 insertions(+), 46 deletions(-) diff --git a/@salix/crud/src/client/basic-data/index.js b/@salix/crud/src/client/basic-data/index.js index c9947c1e3..d58e442ef 100644 --- a/@salix/crud/src/client/basic-data/index.js +++ b/@salix/crud/src/client/basic-data/index.js @@ -8,42 +8,51 @@ export const COMPONENT = { bindings: { client: '<' }, - controller: function($http, copyObject, equalsObject, $transitions, $state) { + controller: function($http, copyObject, equalsObject, $transitions, $element) { - var self = this; - + var self = this; var deregister = $transitions.onStart({ }, callback); - this.$onChanges = function (changes) { - if(this.client){ - this.clientOld = copyObject(this.client); + this.$onChanges = function(changes) { + if (this.client) { + this.copyClient(); } - } + }; - this.$onDestroy = function(){ + this.$onDestroy = function() { deregister(); - } + }; $http.get('/client/api/SalesPeople').then( json => this.sales = json.data ); function callback(transition) { - if(!equalsObject(self.client, self.clientOld)){ + if (!equalsObject(self.client, self.clientOld)) { self.state = transition.to().name; - var dialog = document.querySelector('dialog'); + var dialog = $element[0].querySelector('dialog'); dialog.showModal(); return false; } } this.submit = function() { - if(!equalsObject(this.client, this.clientOld)){ + if (!equalsObject(this.client, this.clientOld)) { this.client.modify = "BasicData"; - $http.put('/client/api/Clients', this.client); + $http.put('/client/api/Clients', this.client).then( + json => { + this.client = json.data; + this.copyClient(); + } + ); } }; + + this.copyClient = function() { + this.clientOld = {}; + copyObject(this.client, this.clientOld); + }; } }; -COMPONENT.controller.$inject = ['$http', 'copyObject', 'equalsObject', '$transitions', '$state']; +COMPONENT.controller.$inject = ['$http', 'copyObject', 'equalsObject', '$transitions', '$element']; module.component(NAME, COMPONENT); diff --git a/@salix/crud/src/client/confirm/index.html b/@salix/crud/src/client/confirm/index.html index ed2f19b32..703a0b448 100644 --- a/@salix/crud/src/client/confirm/index.html +++ b/@salix/crud/src/client/confirm/index.html @@ -1,11 +1,11 @@

- Allow this site to collect usage data to improve your experience? + ¿Desea salir sin guardar?

- - + +
\ No newline at end of file diff --git a/@salix/crud/src/client/create/index.html b/@salix/crud/src/client/create/index.html index 650ce5df7..0371f986f 100644 --- a/@salix/crud/src/client/create/index.html +++ b/@salix/crud/src/client/create/index.html @@ -1,20 +1,21 @@
- - - Crear Cliente - - - - - - - - - - - - - - - -
\ No newline at end of file + + + Crear Cliente + + + + + + + + + + + + + + + + + diff --git a/@salix/crud/src/client/create/index.js b/@salix/crud/src/client/create/index.js index c4a4607bf..b7c8ce7f5 100644 --- a/@salix/crud/src/client/create/index.js +++ b/@salix/crud/src/client/create/index.js @@ -5,8 +5,8 @@ export const NAME = "vnClientCreate"; export const COMPONENT = { template: template, controllerAs: "create", - controller: function($http, $state){ - this.submit = function(){ + controller: function($http, $state) { + this.submit = function() { $http.post('/client/api/Clients', this.model).then( json => $state.go('clientCard.basicData',{id: json.data.id}) ); diff --git a/@salix/crud/src/client/fiscal-data/index.html b/@salix/crud/src/client/fiscal-data/index.html index 2b97bee5d..27a70f6cb 100644 --- a/@salix/crud/src/client/fiscal-data/index.html +++ b/@salix/crud/src/client/fiscal-data/index.html @@ -61,4 +61,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/@salix/crud/src/client/fiscal-data/index.js b/@salix/crud/src/client/fiscal-data/index.js index bf8d88fc2..bccda409d 100644 --- a/@salix/crud/src/client/fiscal-data/index.js +++ b/@salix/crud/src/client/fiscal-data/index.js @@ -8,22 +8,60 @@ export const COMPONENT = { bindings: { client: '<' }, - controller: function($http) { + controller: function($http, copyObject, equalsObject, $transitions, $element) { + + var self = this; + var deregister = $transitions.onStart({ }, callback); + $http.get('/client/api/Countries').then( json => this.countries = json.data ); + $http.get('/client/api/Provinces').then( json => this.provinces = json.data ); + $http.get('/client/api/PaymentMethods').then( json => this.payments = json.data ); this.submit = function() { - $http.put('/client/api/Clients', this.client); + if (!equalsObject(this.client, this.clientOld)) { + this.client.modify = "FiscalData"; + $http.put('/client/api/Clients', this.client).then( + json => { + this.client = json.data; + this.copyClient(); + } + ); + } + }; + + this.$onChanges = function(changes) { + if (this.client) { + this.copyClient(); + } + }; + + this.$onDestroy = function() { + deregister(); + }; + + function callback(transition) { + if (!equalsObject(self.client, self.clientOld)) { + self.state = transition.to().name; + var dialog = $element[0].querySelector('dialog'); + dialog.showModal(); + return false; + } + } + + this.copyClient = function() { + this.clientOld = {}; + copyObject(this.client, this.clientOld); }; } }; -COMPONENT.controller.$inject = ['$http']; +COMPONENT.controller.$inject = ['$http', 'copyObject', 'equalsObject', '$transitions', '$element']; module.component(NAME, COMPONENT); diff --git a/@salix/crud/src/client/web-access/index.html b/@salix/crud/src/client/web-access/index.html index ba6696619..df54b3b84 100644 --- a/@salix/crud/src/client/web-access/index.html +++ b/@salix/crud/src/client/web-access/index.html @@ -7,4 +7,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/@salix/crud/src/client/web-access/index.js b/@salix/crud/src/client/web-access/index.js index 04bd3ac12..b123c888d 100644 --- a/@salix/crud/src/client/web-access/index.js +++ b/@salix/crud/src/client/web-access/index.js @@ -8,11 +8,47 @@ export const COMPONENT = { bindings: { client: '<' }, - controller: function($http) { + controller: function($http, copyObject, equalsObject, $transitions, $element) { + + var self = this; + var deregister = $transitions.onStart({ }, callback); + this.submit = function() { - $http.put('/client/api/Clients', this.client); + if (!equalsObject(this.client, this.clientOld)) { + this.client.modify = "WebAccess"; + $http.put('/client/api/Clients', this.client).then( + json => { + this.client = json.data; + this.copyClient(); + } + ); + } + }; + + this.$onChanges = function(changes) { + if (this.client) { + this.copyClient(); + } + }; + + this.$onDestroy = function() { + deregister(); + }; + + function callback(transition) { + if (!equalsObject(self.client, self.clientOld)) { + self.state = transition.to().name; + var dialog = $element[0].querySelector('dialog'); + dialog.showModal(); + return false; + } + } + + this.copyClient = function() { + this.clientOld = {}; + copyObject(this.client, this.clientOld); }; } }; -COMPONENT.controller.$inject = ['$http']; +COMPONENT.controller.$inject = ['$http', 'copyObject', 'equalsObject', '$transitions', '$element']; module.component(NAME, COMPONENT); From 04b7bdf2fb2c5c718d0d630fd4a9a55e1504802f Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Mon, 16 Jan 2017 11:04:04 +0100 Subject: [PATCH 2/3] consignee inactive --- @salix/app/src/styles/background.scss | 4 ++++ @salix/crud/src/client/addresses/index.html | 4 ++-- services/nginx/logs/error.log | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/@salix/app/src/styles/background.scss b/@salix/app/src/styles/background.scss index 55b4fa426..1ce253807 100644 --- a/@salix/app/src/styles/background.scss +++ b/@salix/app/src/styles/background.scss @@ -30,3 +30,7 @@ html [bg-dark-menu], .bg-dark-menu { background-color: $bg-dark-bar; color: $color-white; } +/* utilizado para mostrar el color inactivo en el consignatario */ +.bg-opacity-item{ + opacity: 0.6; +} diff --git a/@salix/crud/src/client/addresses/index.html b/@salix/crud/src/client/addresses/index.html index 9bc43dc39..f563071b9 100644 --- a/@salix/crud/src/client/addresses/index.html +++ b/@salix/crud/src/client/addresses/index.html @@ -5,7 +5,7 @@ Consignatario - +
{{i.consignee}}
@@ -24,4 +24,4 @@
- \ No newline at end of file + diff --git a/services/nginx/logs/error.log b/services/nginx/logs/error.log index 5bd791e40..34c0b0e91 100644 --- a/services/nginx/logs/error.log +++ b/services/nginx/logs/error.log @@ -48,3 +48,6 @@ 2017/01/13 15:01:49 [notice] 4688#4208: signal process started 2017/01/13 15:25:59 [notice] 10896#6992: signal process started 2017/01/13 15:29:26 [notice] 2412#10456: signal process started +2017/01/13 15:37:25 [notice] 5088#9876: signal process started +2017/01/16 07:49:58 [notice] 9028#8132: signal process started +2017/01/16 08:26:22 [notice] 1256#3772: signal process started From 5d75a69b5cbf83a622e916e9039a05cf2043597d Mon Sep 17 00:00:00 2001 From: nelo Date: Mon, 16 Jan 2017 11:43:32 +0100 Subject: [PATCH 3/3] componente textarea --- @salix/core/src/textarea/textarea.js | 19 ++++++++++++++++++ @salix/core/src/textarea/textarea.mdl.html | 2 ++ @salix/core/src/textarea/textarea.mdl.js | 20 +++++++++++++++++++ @salix/crud/src/client/confirm/index.html | 2 +- @salix/crud/src/client/create/index.js | 2 +- @salix/crud/src/client/index/item-client.html | 3 +++ 6 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 @salix/core/src/textarea/textarea.js create mode 100644 @salix/core/src/textarea/textarea.mdl.html create mode 100644 @salix/core/src/textarea/textarea.mdl.js diff --git a/@salix/core/src/textarea/textarea.js b/@salix/core/src/textarea/textarea.js new file mode 100644 index 000000000..ebcffc9a1 --- /dev/null +++ b/@salix/core/src/textarea/textarea.js @@ -0,0 +1,19 @@ +import {module as _module} from '../module'; +import * as resolveFactory from '../resolveDefaultComponents'; +import * as util from '../util'; + +const _NAME = 'textarea'; +export const NAME = util.getName(_NAME); + +directive.$inject = [resolveFactory.NAME]; +export function directive(resolve) { + return { + require: 'E', + template: function(_, attr) { + return resolve.getTemplate(_NAME, attr); + } + }; +} + +_module.directive(NAME, directive); + diff --git a/@salix/core/src/textarea/textarea.mdl.html b/@salix/core/src/textarea/textarea.mdl.html new file mode 100644 index 000000000..4505aeb41 --- /dev/null +++ b/@salix/core/src/textarea/textarea.mdl.html @@ -0,0 +1,2 @@ + + diff --git a/@salix/core/src/textarea/textarea.mdl.js b/@salix/core/src/textarea/textarea.mdl.js new file mode 100644 index 000000000..901ce2117 --- /dev/null +++ b/@salix/core/src/textarea/textarea.mdl.js @@ -0,0 +1,20 @@ +import {module as _module} from '../module'; +import * as util from '../util'; +import * as constant from '../constants'; +import template from './textarea.mdl.html'; + +const _NAME = 'textarea'; +const DEFAULT_CLASS = ''; + +export const NAME = util.getFactoryName(_NAME + constant.MATERIAL_DESIGN_FRAMEWORK); + +export function factory() { + return { + template: template, + default: { + className: DEFAULT_CLASS, + } + } +} + +_module.factory(NAME, factory); diff --git a/@salix/crud/src/client/confirm/index.html b/@salix/crud/src/client/confirm/index.html index 703a0b448..cb48b6324 100644 --- a/@salix/crud/src/client/confirm/index.html +++ b/@salix/crud/src/client/confirm/index.html @@ -1,7 +1,7 @@

- ¿Desea salir sin guardar? + ¿Desea salir sin guardar los cambios?

diff --git a/@salix/crud/src/client/create/index.js b/@salix/crud/src/client/create/index.js index b7c8ce7f5..83adcb6a2 100644 --- a/@salix/crud/src/client/create/index.js +++ b/@salix/crud/src/client/create/index.js @@ -8,7 +8,7 @@ export const COMPONENT = { controller: function($http, $state) { this.submit = function() { $http.post('/client/api/Clients', this.model).then( - json => $state.go('clientCard.basicData',{id: json.data.id}) + json => $state.go('clientCard.basicData', {id: json.data.id}) ); }; } diff --git a/@salix/crud/src/client/index/item-client.html b/@salix/crud/src/client/index/item-client.html index da06f7427..e425379fe 100644 --- a/@salix/crud/src/client/index/item-client.html +++ b/@salix/crud/src/client/index/item-client.html @@ -1,4 +1,7 @@
{{itemClient.client.name}}
{{itemClient.client.id}}
+
{{itemClient.client.phone}}
+
{{itemClient.client.city}}
+
{{itemClient.client.email}}
\ No newline at end of file