Errores solucionados
This commit is contained in:
parent
a98580dc10
commit
558ad8f393
|
@ -1,4 +1,4 @@
|
|||
<form name="form" ng-submit="form.$valid && watcher.submit()" pad-medium >
|
||||
<form name="form" ng-submit="form.$valid && watcher.submit()" pad-medium>
|
||||
<vn-card>
|
||||
<vn-vertical pad-large>
|
||||
<vn-title>Web access</vn-title>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<vn-password label="Repeat password" model="$ctrl.repeatPassword"></vn-password>
|
||||
</dbody>
|
||||
<buttons>
|
||||
<button response="CANCEL">Cancel</button>
|
||||
<button response="ACCEPT">Change password</button>
|
||||
<button response="CANCEL" translate>Cancel</button>
|
||||
<button response="ACCEPT" translate>Change password</button>
|
||||
</buttons>
|
||||
</vn-dialog>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div>
|
||||
<dbody>
|
||||
<h6 class="dialog-title" translate>
|
||||
{{$ctrl.title}}
|
||||
{{$ctrl.question}}
|
||||
</h6>
|
||||
<h6 translate>
|
||||
{{$ctrl.message}}
|
||||
|
@ -13,8 +13,8 @@
|
|||
<div class="button-bar"
|
||||
ng-click="$ctrl.onButtonClick($event)">
|
||||
<buttons>
|
||||
<button response="CANCEL">Cancel</button>
|
||||
<button response="ACCEPT">Accept</button>
|
||||
<button response="CANCEL" translate>Cancel</button>
|
||||
<button response="ACCEPT" translate>Accept</button>
|
||||
</buttons>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -13,7 +13,7 @@ module.component('vnConfirm', {
|
|||
template: require('./index.html'),
|
||||
bindings: {
|
||||
onResponse: '&',
|
||||
title: '@',
|
||||
question: '@',
|
||||
message: '@'
|
||||
},
|
||||
controller: Confirm
|
||||
|
|
|
@ -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`);
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<vn-confirm on-response="$ctrl.onConfirmResponse(response)"
|
||||
title="Are you sure exit without saving?"
|
||||
message="Unsaved changes will be lost">
|
||||
<vn-confirm
|
||||
vn-id="confirm"
|
||||
question="Are you sure exit without saving?"
|
||||
message="Unsaved changes will be lost"
|
||||
on-response="$ctrl.onConfirmResponse(response)">
|
||||
</vn-confirm>
|
|
@ -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'),
|
||||
|
|
|
@ -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"
|
||||
}
|
2
db.json
2
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\"}"
|
||||
|
|
|
@ -93,6 +93,9 @@
|
|||
"where": {"name": "Verdnatura"}
|
||||
}
|
||||
},
|
||||
"_scope": {
|
||||
"where": {"name": "Verdnatura"}
|
||||
},
|
||||
"acls": [],
|
||||
"methods": {}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue