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

datefield fixes

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