diff --git a/client/client/src/web-access/index.html b/client/client/src/web-access/index.html index e883853c1..ce425e0b9 100644 --- a/client/client/src/web-access/index.html +++ b/client/client/src/web-access/index.html @@ -1,4 +1,4 @@ -
+ Web access @@ -27,7 +27,7 @@ - - + + diff --git a/client/core/src/confirm/index.html b/client/core/src/confirm/index.html index 6dfbedf74..d317e0ca4 100644 --- a/client/core/src/confirm/index.html +++ b/client/core/src/confirm/index.html @@ -3,7 +3,7 @@
- {{$ctrl.title}} + {{$ctrl.question}}
{{$ctrl.message}} @@ -13,8 +13,8 @@
- - + +
diff --git a/client/core/src/confirm/index.js b/client/core/src/confirm/index.js index 951909167..4f63e8a55 100644 --- a/client/core/src/confirm/index.js +++ b/client/core/src/confirm/index.js @@ -13,7 +13,7 @@ module.component('vnConfirm', { template: require('./index.html'), bindings: { onResponse: '&', - title: '@', + question: '@', message: '@' }, controller: Confirm diff --git a/client/core/src/directives/focus.js b/client/core/src/directives/focus.js index 43a2f3b86..096531fcc 100644 --- a/client/core/src/directives/focus.js +++ b/client/core/src/directives/focus.js @@ -7,8 +7,13 @@ export function directive() { return { restrict: 'A', link: function($scope, $element, $attrs) { - var input = $element[0].parentNode.querySelector('input, textarea'); + let input = $element[0]; + let isInput = + input instanceof HTMLInputElement || + input instanceof HTMLTextAreaElement; + if(input && !isInput) + input = input.querySelector('input, textarea'); if(!input) throw new Error(`vnFocus: Can't find an input element`); diff --git a/client/core/src/watcher/index.html b/client/core/src/watcher/index.html index efd498ecb..76315ece8 100644 --- a/client/core/src/watcher/index.html +++ b/client/core/src/watcher/index.html @@ -1,4 +1,6 @@ - + \ No newline at end of file diff --git a/client/core/src/watcher/index.js b/client/core/src/watcher/index.js index b6120d3bb..55436983f 100644 --- a/client/core/src/watcher/index.js +++ b/client/core/src/watcher/index.js @@ -11,11 +11,12 @@ import isEqual from '../lib/equals'; * properties are provided. */ export default class Watcher extends Component { - constructor($element, $scope, $state, $transitions, $http, vnAppLogger) { + constructor($element, $scope, $state, $transitions, $http, vnAppLogger, $translate) { super($element); this.$scope = $scope; this.$state = $state; this.$http = $http; + this.$translate = $translate; this.vnAppLogger = vnAppLogger; this.state = null; @@ -47,7 +48,9 @@ export default class Watcher extends Component { } submit() { if (!this.dataChanged()) { - this.vnAppLogger.showMessage('No changes detected'); + this.vnAppLogger.showMessage( + this.$translate.instant('No changes to save') + ); return; } @@ -55,7 +58,6 @@ export default class Watcher extends Component { let changedData = getModifiedData(this.data, this.orgData); if(id) { - console.log(changedData); return new Promise((resolve, reject) => { this.$http.put(`${this.url}/${id}`, changedData).then( json => this.writeData(json, resolve), @@ -83,8 +85,7 @@ export default class Watcher extends Component { callback(transition) { if (!this.state && this.dataChanged()) { this.state = transition.to().name; - let dialog = this.element.querySelector('vn-confirm'); - dialog.$ctrl.show(); + this.$scope.confirm.show(); return false; } @@ -103,7 +104,7 @@ export default class Watcher extends Component { } } } -Watcher.$inject = ['$element', '$scope', '$state', '$transitions', '$http', 'vnAppLogger']; +Watcher.$inject = ['$element', '$scope', '$state', '$transitions', '$http', 'vnAppLogger', '$translate']; module.component('vnWatcher', { template: require('./index.html'), diff --git a/client/core/src/watcher/locale/es.json b/client/core/src/watcher/locale/es.json index da8eeb4f1..b1cf962d0 100644 --- a/client/core/src/watcher/locale/es.json +++ b/client/core/src/watcher/locale/es.json @@ -1,4 +1,5 @@ { "Are you sure exit without saving?": "¿Seguro que quieres salir sin guardar?", - "Unsaved changes will be lost": "Los cambios que no hayas guardado se perderán" + "Unsaved changes will be lost": "Los cambios que no hayas guardado se perderán", + "No changes to save": "No hay cambios que guardar" } \ No newline at end of file diff --git a/db.json b/db.json index 0cf642367..5581f67e4 100644 --- a/db.json +++ b/db.json @@ -21,7 +21,7 @@ }, "Client": { "12": "{\"name\":\"Verdnatura\",\"id\":12,\"fi\":\"B97367486\",\"salesPerson\":3,\"telefono\":\"963242100\",\"socialName\":\"Verdnatura Levante SL\",\"active\":true,\"user\":\"verdnatura\",\"fax\":\"963242100\",\"phone\":\"963242101\",\"email\":\"informatica@verdnatura.es\",\"surcharge\":true,\"cyc\":321,\"credit\":1000,\"iban\":\"456\",\"street\":\"Avenida Espioca, 100\",\"city\":\"Silla\",\"postcode\":\"12345678\",\"mobile\":\"654654654\",\"dueDay\":321,\"gestdoc\":23452343,\"province\":1,\"country\":1,\"modify\":\"BasicData\",\"navigate\":true,\"payMethod\":\"1\",\"coreVnh\":true,\"coreVnl\":true,\"invoiceByEmail\":true}", - "14": "{\"name\":\"Leopoldo\",\"id\":14,\"street\":\"Casa\",\"fi\":\"1234567890A\",\"socialName\":\"Leopoldo\",\"fax\":\"963242100\",\"dischargeDate\":\"01/01/2017\",\"telefono\":\"963242100\",\"salesPerson\":\"2\",\"email\":\"informatica@verdnatura.es\",\"city\":\"asdf\",\"postcode\":\"123\",\"phone\":\"963215469\",\"mobile\":\"667985632\",\"credit\":2345,\"cyc\":56,\"iban\":\"asdf\",\"dueDay\":345,\"gestdoc\":2435,\"surcharge\":true,\"navigate\":true,\"province\":6,\"country\":2}", + "14": "{\"name\":\"Leopoldo\",\"id\":14,\"street\":\"Casa\",\"fi\":\"1234567890A\",\"socialName\":\"Leopoldo\",\"fax\":\"963242100\",\"dischargeDate\":\"01/01/2017\",\"telefono\":\"963242100\",\"salesPerson\":\"2\",\"email\":\"informatica@verdnatura.es\",\"city\":\"asdf\",\"postcode\":\"123\",\"phone\":\"963215469\",\"mobile\":\"667985632\",\"credit\":2345,\"cyc\":56,\"iban\":\"asdf\",\"dueDay\":345,\"gestdoc\":2435,\"surcharge\":true,\"navigate\":true,\"province\":6,\"country\":2,\"payMethod\":1}", "15": "{\"name\":\"Florsiteria Pepa\",\"fi\":\"12341234rasf\",\"socialName\":\"asdfasd\",\"dueDay\":5,\"id\":15,\"payMethod\":\"2\",\"salesPerson\":\"1\",\"modify\":\"BasicData\",\"iban\":\"sdfgsdfgsdfg\",\"email\":\"pepa@flores.es\"}", "16": "{\"name\":\"Floristeria Antonieta\",\"fi\":\"2345234523d\",\"socialName\":\"23452345assdfgsdfgt\",\"active\":true,\"dueDay\":5,\"id\":16,\"modify\":\"FiscalData\",\"email\":\"antonieta@gmail.com\",\"phone\":\"654654654\",\"mobile\":\"654456456\",\"fax\":\"456456456\",\"street\":\"asdfasdf\",\"salesPerson\":8}", "19": "{\"name\":\"Planticas Eustaquio\",\"fi\":\"789456123B\",\"socialName\":\"Eustaquio Martinez\",\"active\":true,\"dueDay\":5,\"id\":19,\"email\":\"peustaquio@hotmail.es\"}" diff --git a/services/client/common/models/Client.json b/services/client/common/models/Client.json index f5a9d2b1f..e3a5850b0 100644 --- a/services/client/common/models/Client.json +++ b/services/client/common/models/Client.json @@ -93,6 +93,9 @@ "where": {"name": "Verdnatura"} } }, + "_scope": { + "where": {"name": "Verdnatura"} + }, "acls": [], "methods": {} }