Commit 4ba1cb54 authored by Evren Kutar's avatar Evren Kutar

datefield fixes

parent 5d12657c
......@@ -25,7 +25,8 @@
</div>
<div class="panel-body">
<div class="dashboard-student-search" data-step="2"
data-intro="isim veya tcno ile öğrenci araması yapabilirsiniz.">
data-intro="isim veya tcno ile öğrenci araması yapabilirsiniz."
ng-show="menuitems.ogrenci">
<div class="text-center">
<h3>ÖĞRENCİ</h3>
<input type="text" placeholder="Öğrenci ara" ng-model="keyword.student"
......@@ -47,7 +48,7 @@
</div>
<!-- end of dashboard-student-search -->
<div class="dashboard-personnel-search" data-step="3"
data-intro="isim veya tcno ile personel araması yapabilirsiniz.">
data-intro="isim veya tcno ile personel araması yapabilirsiniz." ng-show="menuitems.personel">
<div class="text-center">
<h3>PERSONEL</h3>
<input type="text" placeholder="Personel ara" ng-model="keyword.staff"
......
......@@ -17,11 +17,12 @@
class="form-control {{form.fieldHtmlClass}} datepickerfield"
id="{{form.key.slice(-1)[0]}}"
ng-model-options="form.ngModelOptions"
ng-model="form.modelDate"
ng-model="$$value$$"
ng-disabled="form.readonly"
schema-validate="form"
name="{{form.key.slice(-1)[0]}}"
aria-describedby="{{form.key.slice(-1)[0] + 'Status'}}"
ng-change="form.onSelect()"
type="{{form.type}}"
uib-datepicker-popup="{{form.format}}"
......
......@@ -291,17 +291,10 @@ angular.module('formService', ['ui.bootstrap'])
// check if type is date and if type date found change it to string
if (v.type === 'date') {
if (isNaN(new Date(scope.model[k]))) {
var modelDate;
}
else {
var modelDate = new Date(scope.model[k]);
}
scope.model[k] = generator.dateformatter(scope.model[k]);
scope.model[k] = generator.dateformatter(scope.model[k] || new Date());
scope.form[scope.form.indexOf(k)] = {
key: k, name: k, title: v.title,
type: 'template',
modelDate: modelDate,
templateUrl: 'shared/templates/datefield.html',
validationMessage: {
'dateNotValid': "Girdiğiniz tarih geçerli değildir. <i>orn: '01.01.2015'<i/>",
......@@ -334,7 +327,10 @@ angular.module('formService', ['ui.bootstrap'])
open: function ($event) {
this.status.opened = true;
},
format: 'dd.MM.yyyy'
format: 'dd.MM.yyyy',
onSelect: function () {
scope.model[k] = generator.dateformatter(scope.model[k]);
}
};
}
......@@ -581,10 +577,15 @@ angular.module('formService', ['ui.bootstrap'])
scope[v.type][k].form.push(item.name);
}
if (item.type === 'date') {
scope.model[k][item.name] = generator.dateformatter(scope.model[k][item.name]);
try {
if (item.type === 'date') {
scope.model[k][item.name] = generator.dateformatter(scope.model[k][item.name]);
}
} catch (e) {
$log.debug('Error: ', e.message);
}
});
if (scope.model[k]) {
......@@ -983,7 +984,7 @@ angular.module('formService', ['ui.bootstrap'])
Generator.generate(newscope, {forms: scope.node});
// modal will add only one item to listNode, so just need one model (not array)
newscope.model = angular.copy(newscope.model[node.edit] || newscope.model[0] || {});
newscope.model = newscope.model[node.edit] || newscope.model[0] || {};
return newscope;
}
}
......
......@@ -121,7 +121,7 @@ app.config(['$httpProvider', function ($httpProvider) {
$location.path("/dashboard");
}
}
errorModal();
//errorModal();
}
$rootScope.$broadcast('show_notifications', rejection.data);
......
This diff is collapsed.
......@@ -297,7 +297,8 @@ angular.module("components/dashboard/dashboard.html", []).run(["$templateCache",
" </div>\n" +
" <div class=\"panel-body\">\n" +
" <div class=\"dashboard-student-search\" data-step=\"2\"\n" +
" data-intro=\"isim veya tcno ile öğrenci araması yapabilirsiniz.\">\n" +
" data-intro=\"isim veya tcno ile öğrenci araması yapabilirsiniz.\"\n" +
" ng-show=\"menuitems.ogrenci\">\n" +
" <div class=\"text-center\">\n" +
" <h3>ÖĞRENCİ</h3>\n" +
" <input type=\"text\" placeholder=\"Öğrenci ara\" ng-model=\"keyword.student\"\n" +
......@@ -319,7 +320,7 @@ angular.module("components/dashboard/dashboard.html", []).run(["$templateCache",
" </div>\n" +
" <!-- end of dashboard-student-search -->\n" +
" <div class=\"dashboard-personnel-search\" data-step=\"3\"\n" +
" data-intro=\"isim veya tcno ile personel araması yapabilirsiniz.\">\n" +
" data-intro=\"isim veya tcno ile personel araması yapabilirsiniz.\" ng-show=\"menuitems.personel\">\n" +
" <div class=\"text-center\">\n" +
" <h3>PERSONEL</h3>\n" +
" <input type=\"text\" placeholder=\"Personel ara\" ng-model=\"keyword.staff\"\n" +
......@@ -671,11 +672,12 @@ angular.module("shared/templates/datefield.html", []).run(["$templateCache", fun
" class=\"form-control {{form.fieldHtmlClass}} datepickerfield\"\n" +
" id=\"{{form.key.slice(-1)[0]}}\"\n" +
" ng-model-options=\"form.ngModelOptions\"\n" +
" ng-model=\"form.modelDate\"\n" +
" ng-model=\"$$value$$\"\n" +
" ng-disabled=\"form.readonly\"\n" +
" schema-validate=\"form\"\n" +
" name=\"{{form.key.slice(-1)[0]}}\"\n" +
" aria-describedby=\"{{form.key.slice(-1)[0] + 'Status'}}\"\n" +
" ng-change=\"form.onSelect()\"\n" +
"\n" +
" type=\"{{form.type}}\"\n" +
" uib-datepicker-popup=\"{{form.format}}\"\n" +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment