This commit is contained in:
Juan Ferrer Toribio 2017-10-11 16:00:36 +02:00
commit ad24380043
7 changed files with 17 additions and 12 deletions

View File

@ -37,7 +37,8 @@ class DatePicker extends Component {
set model(value) {
this._model = value;
if (value && !this.modelView) {
let format = this._formatFlat2Angular(this.iniOptions.dateFormat || 'Y-m-d');
let initialDateFormat = (this.iniOptions && this.iniOptions.dateFormat) ? this.iniOptions.dateFormat : 'Y-m-d';
let format = this._formatFlat2Angular(initialDateFormat);
this.modelView = this.$filter('date')(value, format);
}
}
@ -83,7 +84,7 @@ class DatePicker extends Component {
let model;
if (!value) {
model = undefined;
} else if (!this.iniOptions.dateFormat || (this.iniOptions.dateFormat && this.iniOptions.dateFormat.startsWith('Y-m-d'))) {
} else if (!this.iniOptions || (this.iniOptions.dateFormat && this.iniOptions.dateFormat.startsWith('Y-m-d'))) {
model = value;
} else {
let formats = this.iniOptions.dateFormat.split(/[ZT.,/ :-]/);

View File

@ -11,8 +11,13 @@
<vn-vertical pad-large>
<vn-title>Create Route</vn-title>
<vn-horizontal>
<vn-date-picker vn-one label="Date" field="$ctrl.delivery.date"></vn-date-picker>
<vn-textfield vn-one label="Agency" field="$ctrl.delivery.agency"></vn-textfield>
<vn-date-picker vn-one label="Date" model="$ctrl.delivery.date"></vn-date-picker>
<vn-autocomplete vn-one
label="Agency"
url="/route/api/Agencies"
field="$ctrl.delivery.agency"
>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textfield vn-one label="Driver" field="$ctrl.delivery.driver"></vn-textfield>

View File

@ -1,4 +0,0 @@
module.exports = function(Agency) {
require('../methods/agency/list.js')(Agency);
};

View File

@ -47,5 +47,9 @@
},
"Zone": {
"dataSource": "vn"
},
"Agency": {
"dataSource": "vn",
"public": true
}
}

View File

@ -0,0 +1,3 @@
module.exports = function(Self) {
require('../methods/agency/list.js')(Self);
};

View File

@ -10,10 +10,6 @@
"name": {
"type": "String",
"required": false
},
"tpv":{
"type": "Number",
"required": false
}
}
}