}
}
if (exists($p->{set}) && (exists($p->{page}))){
- my $nd = JSON::PP::decode_json($p->{set});
- if (-e $datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json'){
- my $strget = "";
- open(CFG,$datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json');
- while (my $l = <CFG>){
- $strget .= $l;
+ if ($p->{set} ne ""){
+ my $nd = JSON::PP::decode_json($p->{set});
+ if (-e $datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json'){
+ my $strget = "";
+ open(CFG,$datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json');
+ while (my $l = <CFG>){
+ $strget .= $l;
+ }
+ close(CFG);
+ if (($strget =~ /^{/) && ($strget =~ /}$/)){
+ $html = JSON::PP::decode_json($strget);
+ }
}
- close(CFG);
- if (($strget =~ /^{/) && ($strget =~ /}$/)){
- $html = JSON::PP::decode_json($strget);
- }
+ foreach my $k (keys(%{$nd})){
+ $html->{$k} = $nd->{$k};
+ }
+ # if (keys(%{$html}) == 0){
+ # unlink($datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json');
+ # } else {
+ # open(CFG,">".$datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json');
+ # print CFG JSON::PP::encode_json($html);
+ # close(CFG);
+ # }
+ open(CFG,">".$datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json');
+ print CFG JSON::PP::encode_json($html);
+ close(CFG);
}
- foreach my $k (keys(%{$nd})){
- $html->{$k} = $nd->{$k};
+ else {
+ if (-e $datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json'){
+ unlink($datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json');
+ }
}
- open(CFG,">".$datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json');
- print CFG JSON::PP::encode_json($html);
- close(CFG);
$html= ();
$html->{result} = 1;
}
while(my $data = $sth->fetchrow_hashref())
{
foreach my $k (keys %{$data}){
- $retdata->{$count}->{$k} = decode( "utf8", $data->{$k});
+ $retdata->{$count}->{$k} = (($data->{$k} eq "")?'':decode( "utf8", $data->{$k}));
}
$count++;
}
input[type="date"]::-webkit-calendar-picker-indicator {
display: none;
-webkit-appearance: none;
-}
\ No newline at end of file
+}
+
+input[type="month"]::-webkit-inner-spin-button,
+input[type="month"]::-webkit-calendar-picker-indicator {
+ display: none;
+ -webkit-appearance: none;
+}
+
+// ::-webkit-datetime-edit-year-field:not([aria-valuenow]),
+// ::-webkit-datetime-edit-month-field:not([aria-valuenow]),
+// ::-webkit-datetime-edit-day-field:not([aria-valuenow]) {
+// color: transparent;
+// }
\ No newline at end of file
return false;
}
+
var app = {
url: location.protocol + '//' + location.host + '/apps_dks_lu/apps/creorga/',
api: location.protocol + '//' + location.host + '/apps_dks_lu/api/',
- currentdb: null,
- info: null,
+ browser: function(){
+ console.log(navigator.userAgent);
+ var brx = "unknown";
+ if (/Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent)){
+ brx = "Safari";
+ }
+ if (/Chrome/.test(navigator.userAgent)){
+ brx ="Chrome";
+ }
+ if (/Edge/.test(navigator.userAgent)){
+ brx ="Edge";
+ }
+ if (/Firefox/.test(navigator.userAgent)){
+ brx ="Firefox";
+ }
+ if (/OPR/.test(navigator.userAgent)){
+ brx ="Opera";
+ }
+ if (/Trident/.test(navigator.userAgent)){
+ brx ="IE";
+ }
+ return brx;
+ },
+ currentdb: null,
+ info: null,
loadpage: function(page,data = null){
// console.log("load Page => " + page);
// console.log(app);
});
//dump("load month helper\n");
- $(".input-group.month input[type='date']").datetimepicker({
+ $(".input-group.month input[type='text']").datetimepicker({
locale: 'fr',
format: 'MM.YYYY',
viewMode:'months'
});
+ // $(".input-group.month input[type='date']").datetimepicker({
+ // locale: 'fr',
+ // format: 'MM.YYYY',
+ // viewMode:'months'
+ // });
//dump("load week helper\n");
$(".input-group.week input[type='date']").datetimepicker({
locale: 'fr',
}
function set_infoheader(strinfoheader) {
- $("#pagehead").html(strinfoheader)
+ console.log("Set Header:" + strinfoheader);
+ $("#pagehead").html(strinfoheader);
//globelreq.send_request({page:'infoheader',header:strinfoheader});
}
jQuery.fn.exists = function(){ return this.length > 0; }
+Date.prototype.getWeekNumber = function(){
+ var d = new Date(Date.UTC(this.getFullYear(), this.getMonth(), this.getDate()));
+ var dayNum = d.getUTCDay() || 7;
+ d.setUTCDate(d.getUTCDate() + 4 - dayNum);
+ var yearStart = new Date(Date.UTC(d.getUTCFullYear(),0,1));
+ return Math.ceil((((d - yearStart) / 86400000) + 1)/7)
+};
\ No newline at end of file
url: 'http://' + location.host + '/apps_dks_lu/api/sqlite.cgi?',
dbquery: function(sQuery){
var type='querysorted';
- var result= {sqldata:[]};
+ var result= {sqldata:[]};
+ //console.log(sQuery);
//console.log(this.url + 'db=' + this.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery));
//dump(this.url + 'db=' + this.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery) + "\n");
$.ajax({
- encoding:"UTF-8",
- url:appdb.url + 'db=' + appdb.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery) ,
- crossDomain: true,
+ encoding:"UTF-8",
+ method: "POST",
+ url:appdb.url,
+ data: 'db=' + appdb.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery),
+ //crossDomain: true,
success: function (data){
//dump(data + "\n");
result=data.result;
var type='exec';
var result= {sqldata:[]};
//dump(this.url + 'db=' + this.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery) + "\n");
- console.log(appdb.url + 'db=' + appdb.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery) );
+ //console.log(appdb.url + 'db=' + appdb.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery) );
$.ajax({
encoding:"UTF-8",
- url:appdb.url + 'db=' + appdb.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery) ,
- crossDomain: true,
+ method: "POST",
+ url:appdb.url,
+ data: 'db=' + appdb.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery),
success: function (data){
result=data.result;
},
//var page = location.pathname.substring(location.pathname.lastIndexOf("/"));
- //page = page.replace(/\.html/,'');
+ //page = page.replace(/\.html/,'');
+
$.ajax({
encoding:"UTF-8",
url: apppref.api + 'prefs.cgi?page=' + key + '&set=' +encodeURIComponent(JSON.stringify(value)) ,
});
},
getpreference: function(key){
- // if ((apppref) && (apppref.curcfg)){
- // apppref.curcfg['pageconfig'] = {};
- // }else {
- // apppref['curcfg']['pageconfig'] = {};
- // }
+ console.log("getpref:" + key);
var retdata = null;
$.ajax({
encoding:"UTF-8",
url: apppref.api + 'prefs.cgi?get=' + key ,
- crossDomain: true,
- success: function (data){
- retdata = data.result;
- // console.log("DATA");
- // console.log(data);
- // if (data.result){
-
- // apppref.curcfg.pageconfig = data.result;
- // }
+ success: function (data){
+ if (!data.result){
+ retdata = {};
+ }else {
+ retdata = data.result;
+ }
},
error: function(data){
alert("Error:" + JSON.stringify(data));
<div id="frmchart_child" class="form-inline" style="margin-bottom: 7px;">
<div class="input-group month btn-group">
<span class="input-group-addon">du mois:</span>
- <input type="date" class="form-control" value="" placeholder="mm.yyyy" style="width: 120px;" id="calmonth">
+ <input type="text" class="form-control" value="" style="width: 120px;" id="calmonth">
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
<button class="btn btn-primary" onclick="onpreviousmonth();"><span class="glyphicon glyphicon-chevron-left"></span></button>
<script src="../../js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
<!-- <script src="../../js/bootstrap-timepicker.min.js" type="text/javascript"></script> -->
<script src="../../js/bootstrap-multiselect.js" type="text/javascript"></script>
- <script src="js/rrule.js" type="text/javascript"></script>
- <script src="js/nlp.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
- <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
+ <script src="../../vendor/rrule/rrule.js" type="text/javascript"></script>
+ <script src="../../vendor/rrule/nlp.js" type="text/javascript"></script>
+ <script src="../../js/webpreferences.js" type="text/javascript"></script>
+ <script src="../../js/webdatabase.js" type="text/javascript"></script>
<script src="../../js/creorga.js" type="text/javascript"></script>
<script src="../../js/labels.js" type="text/javascript"></script>
<script src="js/calchilds.js" type="text/javascript"></script>
function initdata() {
load_helpers();
- var configdata = apppref.getpreference("pageconfig.calchilds");
- if (!configdata) {
- apppref.setpreference("pageconfig.calchilds", '');
- }
- if (configdata !== '') {
- pconfig = JSON.parse(configdata);
+ pconfig = apppref.getpreference("calchilds");
+ if (!pconfig){
+ pconfig = {};
}
+ console.log(pconfig);
//if (!pconfig.printlayout) {
pconfig.printlayout = 'table';
- apppref.setpreference("pageconfig.calchilds",pconfig);
+ apppref.setpreference("calchilds",pconfig);
//}
if (pconfig.calmonth) {
initdate = new Date(encodeparam(pconfig.calmonth, 'month').replace(/'/g, ''));
$("#calmonth").val(pconfig.calmonth);
} else {
- $("#calmonth").val(initdate.toLocaleFormat('%m.%Y'));
- pconfig.calmonth = initdate.toLocaleFormat('%m.%Y');
+ $("#calmonth").val(initdate.getMonth() + '.' + initdate.getFullYear());
+ pconfig.calmonth = initdate.getMonth() + '.' + initdate.getFullYear();
}
var infogrp ="Nombre d'enfants";
if (!pconfig.calendar){
pconfig.calendar = "childsbyplan";
}
-
- set_infoheader(infogrp+" - " + amonth[parseInt(pconfig.calmonth.substring(0, 3))] + " " + pconfig.calmonth.substring(3, 8));
+ console.log("initdate loaded:" + initdate);
+ //set_infoheader(infogrp+" - " + amonth[parseInt(pconfig.calmonth.substring(0, 3))] + " " + pconfig.calmonth.substring(3, 8));
drsql = getdaterangesql();
$('#calmonth').on('dp.hide', function() {
}
for (var t in ttdata){
var rdata = ttdata[t];
- var ctday = rdata.daydate.substring(8,10);
+ var ctday = parseInt(rdata.daydate.substring(8,10));
if (alltr[rdata.weekhours]){
if (alltr[rdata.weekhours][ctday]){
alltr[rdata.weekhours][ctday] = ttdata[t].childcnt;
trn += '<td class="alignright" ><span>' +((alltr[a][coldays[h]] != 0)?alltr[a][coldays[h]]:'')+ '</span>';
trn +='</td>';
if (alltr[a][coldays[h]] != 0){
- tfooter[parseInt(coldays[h])] += alltr[a][coldays[h]];
+ tfooter[parseInt(coldays[h])] += parseInt(alltr[a][coldays[h]]);
}
}
trn += '</tr>';
for (var t in ttdata){
var rdata = ttdata[t];
- var ctday = rdata.daydate.substring(8,10);
+ var ctday = parseInt(rdata.daydate.substring(8,10));
if (alltr[rdata.daytime]){
if (alltr[rdata.daytime][ctday]){
alltr[rdata.daytime][ctday] = ttdata[t].childcnt;
trn += '<td style="background-color: #6D6D6D !important"></td>';
continue;
}
- trn += '<td class="alignright" ><span>' +((alltr[a][coldays[h]] != 0)?alltr[a][coldays[h]]:'')+ '</span>';
+ trn += '<td class="alignright"><span>' +((alltr[a][coldays[h]] != 0)?alltr[a][coldays[h]]:'')+ '</span>';
trn +='</td>';
if (alltr[a][coldays[h]] != 0){
- tfooter[parseInt(coldays[h])] += alltr[a][coldays[h]];
+ tfooter[parseInt(coldays[h])] += parseInt(alltr[a][coldays[h]]);
}
}
trn += '</tr>';
function set_calmonth(){
pconfig.calmonth =$("#calmonth").val();
- apppref.setpreference("pageconfig.calchilds",pconfig);
- globelreq.send_request({
- page: 'calchilds',
- module: 'calendar',
- data: null,
- header: 'Organisation Enfants'
- });
+ apppref.setpreference("calchilds",pconfig);
+ parent.app.loadpage('modules/calendar/index.html',{calmonth:pconfig.calmonth});
}
function onnextmonth() {
- var tmpmonth = new Date(encodeparam(pconfig.calmonth, 'month').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() + 1, tmpmonth.getDate());
- pconfig.calmonth = nmonth.toLocaleFormat('%m.%Y');
- apppref.setpreference("pageconfig.calchilds", pconfig);
- globelreq.send_request({
- page: 'calchilds',
- module: 'calendar',
- header: 'Organisation Enfants'
- }, null);
+ var xdate = appdb.dbquery("select STRFTIME('%m.%Y',date('"+initdate.toISOString().substring(0,10)+"','+1 month')) as ndate");
+ pconfig.calmonth = xdate.sqldata[0].ndate;
+ apppref.setpreference("calchilds", pconfig);
+ parent.app.loadpage('modules/calendar/index.html',{calmonth:pconfig.calmonth});
}
function onpreviousmonth() {
- var tmpmonth = new Date(encodeparam(pconfig.calmonth, 'month').replace(/'/g, ''));
- var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() - 1, tmpmonth.getDate());
- pconfig.calmonth = nmonth.toLocaleFormat('%m.%Y');
- apppref.setpreference("pageconfig.calchilds", pconfig);
- globelreq.send_request({
- page: 'calchilds',
- module: 'calendar',
- header: 'Organisation Enfants'
- }, null);
+ var xdate = appdb.dbquery("select STRFTIME('%m.%Y',date('"+initdate.toISOString().substring(0,10)+"','-1 month')) as ndate");
+ pconfig.calmonth = xdate.sqldata[0].ndate;
+ apppref.setpreference("calchilds", pconfig);
+ parent.app.loadpage('modules/calendar/index.html',{calmonth:pconfig.calmonth});
}
//get childs planning with exact hours (planning)
//dump (initdate + ": " + firstmonday + " -> " + lastmonthday + "\n");
for (var cdt = firstmonday; cdt < lastmonthday; cdt.setDate(cdt.getDate() + 1)) {
if ((cdt.getDay() !== 0)){
- if ((lwr === -1) || (!wrs[parseInt(cdt.toLocaleFormat('%W'))])) {
- wrs[parseInt(cdt.toLocaleFormat('%W'))] = 1;
+ if ((lwr === -1) || (!wrs[cdt.getWeekNumber()])) {
+ wrs[cdt.getWeekNumber()] = 1;
}else {
- wrs[parseInt(cdt.toLocaleFormat('%W'))] += 1;
+ wrs[cdt.getWeekNumber()] += 1;
}
- lwr = parseInt(cdt.toLocaleFormat('%W'));
- adays.push(cdt.toLocaleFormat('%d'));
+ lwr = cdt.getWeekNumber();
+ adays.push(cdt.getDate());
}
}
function onselcalendar(objid){
//$('#' + objid).val() + "\n");
pconfig.calendar = $('#' + objid).val();
- apppref.setpreference("pageconfig.calchilds",pconfig);
- globelreq.send_request({
- page: 'calchilds',
- module: 'calendar',
- header: 'Organisation Enfants'
- }, null);
+ apppref.setpreference("calchilds", pconfig);
+ parent.app.loadpage('modules/calendar/index.html',{});
+ // globelreq.send_request({
+ // page: 'calchilds',
+ // module: 'calendar',
+ // header: 'Organisation Enfants'
+ // }, null);
}
function initdata() {
load_helpers();
- curcfg.loadconfig(apppref.getpreference("support.database.currentdb.num"));
- var configdata = apppref.getpreference("pageconfig.child");
- if (configdata != '') {
- pconfig = JSON.parse(configdata);
- }
+ pconfig = getSearchParams();
+ //curcfg.loadconfig(apppref.getpreference("support.database.currentdb.num"));
+ //var configdata = apppref.getpreference("pageconfig.child");
+ //if (configdata != '') {
+ //pconfig = JSON.parse(configdata);
+ //}
var cname = appdb.dbquery("select uuid from creche LIMIT 1;");
cruuid = cname.sqldata[0].uuid;
- if (!pconfig.printlayout) {
+ //if (!pconfig.printlayout) {
pconfig.printlayout = 'child';
- apppref.setpreference("pageconfig.child",pconfig);
- }
- var cdatasql = "select uuid,clientnumber,prename,surname,strftime('%d.%m.%Y',birthday) as birthday,address,city,zip,country,strftime('%d.%m.%Y',entrydate) as entrydate,checkservicenumber,strftime('%d.%m.%Y',checkserviceexpiration) as checkserviceexpiration,strftime('%d.%m.%Y',leavedate) as leavedate,nationality,nativelanguage,bankaccount,bankbic,cautionamount,cautionremark,remark ,infohealth from childs where uuid='" + pconfig.uuid + "';";
+ // apppref.setpreference("child",pconfig);
+ //}
+ //console.log(parent.app.browser.isChromiumBased);
+ var cdatasql = "select uuid,clientnumber,prename,surname,strftime('%d.%m.%Y',birthday) as birthday,address,city,zip,country,strftime('%d.%m.%Y',entrydate) as entrydate,checkservicenumber,strftime('%d.%m.%Y',checkserviceexpiration) as checkserviceexpiration,strftime('%d.%m.%Y',leavedate) as leavedate,nationality,nativelanguage,bankaccount,bankbic,cautionamount,cautionremark,remark ,infohealth from childs where uuid='" + pconfig.uuid + "';";
+ console.log("Browser:" + parent.app.browser());
+ if (parent.app.browser() == "Chrome"){
+ cdatasql = "select uuid,clientnumber,prename,surname,birthday,address,city,zip,country,entrydate,checkservicenumber,checkserviceexpiration,leavedate,nationality,nativelanguage,bankaccount,bankbic,cautionamount,cautionremark,remark ,infohealth from childs where uuid='" + pconfig.uuid + "';";
+ }
var cdata = appdb.dbquery(cdatasql);
cdata = cdata.sqldata[0];
- set_infoheader(cdata.prename + " " + cdata.surname);
+ //set_infoheader(cdata.prename + " " + cdata.surname);
for (var ci in cdata) {
if (document.getElementById("childs_" + ci)) {
if (document.getElementById("childs_" + ci).tagName == "TEXTAREA"){
var plandata = appdb.dbqueryarray(plandatasql);
var headerdata = getlabels(plandata.sqlhead.join(","));
- dump("Header" + JSON.stringify(headerdata) + "\n");
+ //dump("Header" + JSON.stringify(headerdata) + "\n");
$("#tbl_planning").html("");
var tblplan = $("#tbl_planning").dataTable({
"language": {
for (var x in row){
//jsdump(x);
if (x == 7){
- tr += "<td>"+ htmlUnescape(row[x])+"</td>";
+ if (row[x] == null){
+ tr += "<td></td>";
+ } else {
+ tr += "<td>"+ htmlUnescape(row[x])+"</td>";
+ }
} else {
- tr += "<td>"+ row[x]+"</td>";
+ if (row[x] == null){
+ tr += "<td></td>";
+ }else {
+ tr += "<td>"+ row[x]+"</td>";
+ }
+
}
}
tr += "</tr>";
function initdata(){
//appdb.dbfile=parent.app.currentdb;
var pconfig = apppref.getpreference("childs");
- console.log("CFG");
- //console.log(configdata);
+ //console.log("CFG");
+ //console.log(pconfig);
// if (configdata) {
// pconfig = JSON.parse(configdata);
// }
pconfig.printlayout = 'list';
apppref.setpreference("childs",pconfig);
}
- console.log("get appinfo");
- console.log(parent.app.info);
+ //console.log("get appinfo");
+ //console.log(parent.app.info);
if (parent.app.info.modules.childs.delete === true){
candelete = 1;
}
var filters = getallfilters();
- console.log(filters);
+ //console.log(filters);
var strfilters = "";
- for (var f in filters) {
- if (!pconfig.filterid) {
- idfilter = 0;
- filter = filters[0];
- set_infoheader(filter.description);
-
- pconfig.idfilter = 0;
- apppref.setpreference("pageconfig.childs",pconfig);
- } else {
- idfilter = f;
- filter = filters[f];
- set_infoheader(filter.description);
-
- }
+ for (var f in filters) {
strfilters += '<li><a href="javascript:setfilter(\'' + f + '\');">' + filters[f].description + '</a></li>';
}
-
-
+ if (pconfig.filterid) {
+ // console.log("id Filter:" + pconfig.filterid);
+ // idfilter = f;
+ filter = filters[pconfig.filterid];
+ } else {
+ pconfig.filterid = 0;
+ filter = filters[0];
+ apppref.setpreference("childs",pconfig);
+ }
+ //console.log("Filter");
+ //console.log(filter);
+ set_infoheader(filter.description);
$("#cmb_childsfilter").html(strfilters);
loadtable();
<div class="tabbable">
<ul class="nav nav-tabs" id="tabgrouphead">
<li><a data-toggle="tab" href="#openinghours">Heures d'ouvertures</a></li>
-
<li><a data-toggle="tab" href="#groups">Groupes d'enfants</a></li>
<li><a data-toggle="tab" href="#planningtemplate">modèles planification</a></li>
var delgroups = null;
var winh = window.innerHeight - 360;
var weekdays = ['mon','tue','wed','thu','fri','sat'];
-
+var pconfig ={};
function initdata() {
load_helpers();
- check_crechetable();
- var sql = "SELECT uuid,crechename, adress, city, country, zip,maxchilds,minage,maxage,stafflist,idcheckservice FROM creche LIMIT 1;";
+ //check_crechetable();
+ var sql = "SELECT uuid,crechename, adress, city, country, zip,maxchilds,minage,maxage,idcheckservice FROM creche LIMIT 1;";
var crdata = appdb.dbquery(sql);
- set_infoheader("");
+ //set_infoheader("");
//dump(JSON.stringify(crdata) + "\n");
if (crdata.sqldata.length == 0){
- check_defaultdata();
+ //check_defaultdata();
crdata = appdb.dbquery(sql);
}
crident = crdata.sqldata[0].uuid;
for (var ci in cdata) {
if (document.getElementById("creche_" + ci)) {
- if (ci == "stafflist"){
- $("#creche_stafflist").prop('checked', true);
- } else {
+ // if (ci == "stafflist"){
+ // $("#creche_stafflist").prop('checked', true);
+ // } else {
document.getElementById("creche_" + ci).setAttribute('value', cdata[ci]);
- }
+ // }
}
}
- var configdata = apppref.getpreference("pageconfig.creche");
-
- if (configdata != '') {
- pconfig = JSON.parse(configdata);
+ pconfig = apppref.getpreference("creche");
+ if (!pconfig) {
+ pconfig = {};
+ // pconfig = JSON.parse(configdata);
}
- $('#tabgrouphead a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
- var tn = e.target.toString();
- pconfig.activetab = tn.substring(tn.lastIndexOf("#") + 1);
- apppref.setpreference("pageconfig.creche", pconfig);
-
- if (pconfig.activetab == 'openinghours') {
- load_table_workinghours();
- }
- if (pconfig.activetab == 'groups') {
- load_table_groups();
- }
- if (pconfig.activetab == 'planningtemplate') {
- load_table_planningtemplate();
- }
-
- });
+
$('#frmeditgroups #color').minicolors({theme:'bootstrap',position: 'bottom right'});
if (pconfig && pconfig.activetab) {
$('#tabgrouphead a[href="#' + pconfig.activetab + '"]').tab('show');
}
}
-$('#creche_stafflist').on('change', function() {
- // From the other examples
- if (this.checked) {
- appdb.dbexec("update creche set stafflist='1';");
- } else {
- appdb.dbexec("update creche set stafflist=null;");
- }
+
+$('#tabgrouphead a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
+ var tn = e.target.toString();
+ console.log("tab:" + tn);
+ pconfig.activetab = tn.substring(tn.lastIndexOf("#") + 1);
+ //apppref.setpreference("creche", pconfig);
+
+ if (pconfig.activetab == 'openinghours') {
+ load_table_workinghours();
+ }
+ if (pconfig.activetab == 'groups') {
+ load_table_groups();
+ }
+ if (pconfig.activetab == 'planningtemplate') {
+ load_table_planningtemplate();
+ }
+
});
+// $('#creche_stafflist').on('change', function() {
+// // From the other examples
+// if (this.checked) {
+// appdb.dbexec("update creche set stafflist='1';");
+// } else {
+// appdb.dbexec("update creche set stafflist=null;");
+// }
+// });
function load_table_workinghours() {
}
function check_defaultdata() {
- curcfg.loadconfig(apppref.getpreference("support.database.currentdb.num"));
- var tables = ['creche','groups','workinghours','vacancy','planningtemplate'];
- for (var t in tables) {
- var sql = "select count(*) as cnt from "+ tables[t]+";";
+// curcfg.loadconfig(apppref.getpreference("support.database.currentdb.num"));
+// var tables = ['creche','groups','workinghours','vacancy','planningtemplate'];
+// for (var t in tables) {
+// var sql = "select count(*) as cnt from "+ tables[t]+";";
- var res = appdb.dbquery(sql);
+// var res = appdb.dbquery(sql);
- if ((res) && (res.sqldata[0].cnt == '0')) {
+// if ((res) && (res.sqldata[0].cnt == '0')) {
-var inssql = [];
-if (tables[t] == 'creche') {
- inssql.push("INSERT INTO creche (crechename, adress, city, country, zip, maxchilds, uuid, minage, maxage) VALUES ('Crèche', '', '', 'Luxembourg', '', 28, '"+ curcfg.uuid +"', 2, 84);");
-} else if (tables[t] == 'groups') {
- var sinssql = "INSERT INTO groups (grpname, maxchilds, minage, maxage, uuid) VALUES ";
- sinssql += "('Groupe Bébé', 6, 2, 12, '"+ appdb.generate_uuid() +"'),";
- sinssql += "('Groupe plus 1 an ', 6, 12, 24, '"+ appdb.generate_uuid() +"'),";
- sinssql += "('Groupe de 2 ans à 3 ans', 8, 24, 36, '"+ appdb.generate_uuid() +"'),";
- sinssql += "('Groupe de 3 à 4 ans ', 8, 36, 48, '"+ appdb.generate_uuid() +"'),";
- sinssql += "('Groupe plus 4 ans ( Scolaires)', 11, 48, 84, '"+ appdb.generate_uuid() +"');"
- inssql.push(sinssql);
-} else if (tables[t] == 'workinghours') {
- inssql.push("INSERT INTO workinghours (uuid, datestart, montimeopen, montimeclose, tuetimeopen, tuetimeclose, wedtimeopen, wedtimeclose, thutimeopen, thutimeclose, fritimeopen, fritimeclose, sattimeopen, sattimeclose, suntimeopen, suntimeclose, crecheuuid) VALUES ('"+appdb.generate_uuid()+"', strftime(\"%Y\",date('now','-1 year')) || '-01-01', '07:00', '19:00', '07:00', '19:00', '07:00', '19:00', '07:00', '19:00', '07:00', '19:00', null, null, null, null, '"+ curcfg.uuid+"');");
-
-}
-
-else if (tables[t] == 'planningtemplate') {
-
- var sinssql = "INSERT INTO planningtemplate (uuid, montimebegin, montimeend, monlunch, tuetimebegin, tuetimeend, tuelunch, wedtimebegin, wedtimeend, wedlunch, thutimebegin, thutimeend, thulunch, fritimebegin, fritimeend, frilunch, templatename) VALUES ";
- sinssql += "('"+ appdb.generate_uuid()+"', '08:00', '18:00', 1, '08:00', '18:00', 1, '08:00', '18:00', 1, '08:00', '18:00', 1, '08:00', '18:00',1, 'plain temps (60h)'),";
- sinssql += "('"+ appdb.generate_uuid()+"', '08:00', '13:00', 1, '08:00', '13:00', 1, '08:00', '13:00', 1, '08:00', '13:00', 1, '08:00', '13:00',1,'matin (30h)'),";
- sinssql += "('"+ appdb.generate_uuid()+"', '13:00', '18:00', 1, '13:00', '18:00', 1, '13:00', '18:00', 1, '13:00', '18:00', 1, '13:00', '18:00',1, 'après-midi (30h)');";
- inssql.push(sinssql);
-
-}
-for (var i in inssql){
-
- appdb.dbexec(inssql[i]);
-}
-
-
-}
-}
+// var inssql = [];
+// if (tables[t] == 'creche') {
+// inssql.push("INSERT INTO creche (crechename, adress, city, country, zip, maxchilds, uuid, minage, maxage) VALUES ('Crèche', '', '', 'Luxembourg', '', 28, '"+ curcfg.uuid +"', 2, 84);");
+// } else if (tables[t] == 'groups') {
+// var sinssql = "INSERT INTO groups (grpname, maxchilds, minage, maxage, uuid) VALUES ";
+// sinssql += "('Groupe Bébé', 6, 2, 12, '"+ appdb.generate_uuid() +"'),";
+// sinssql += "('Groupe plus 1 an ', 6, 12, 24, '"+ appdb.generate_uuid() +"'),";
+// sinssql += "('Groupe de 2 ans à 3 ans', 8, 24, 36, '"+ appdb.generate_uuid() +"'),";
+// sinssql += "('Groupe de 3 à 4 ans ', 8, 36, 48, '"+ appdb.generate_uuid() +"'),";
+// sinssql += "('Groupe plus 4 ans ( Scolaires)', 11, 48, 84, '"+ appdb.generate_uuid() +"');"
+// inssql.push(sinssql);
+// } else if (tables[t] == 'workinghours') {
+// inssql.push("INSERT INTO workinghours (uuid, datestart, montimeopen, montimeclose, tuetimeopen, tuetimeclose, wedtimeopen, wedtimeclose, thutimeopen, thutimeclose, fritimeopen, fritimeclose, sattimeopen, sattimeclose, suntimeopen, suntimeclose, crecheuuid) VALUES ('"+appdb.generate_uuid()+"', strftime(\"%Y\",date('now','-1 year')) || '-01-01', '07:00', '19:00', '07:00', '19:00', '07:00', '19:00', '07:00', '19:00', '07:00', '19:00', null, null, null, null, '"+ curcfg.uuid+"');");
+
+// }
+
+// else if (tables[t] == 'planningtemplate') {
+
+// var sinssql = "INSERT INTO planningtemplate (uuid, montimebegin, montimeend, monlunch, tuetimebegin, tuetimeend, tuelunch, wedtimebegin, wedtimeend, wedlunch, thutimebegin, thutimeend, thulunch, fritimebegin, fritimeend, frilunch, templatename) VALUES ";
+// sinssql += "('"+ appdb.generate_uuid()+"', '08:00', '18:00', 1, '08:00', '18:00', 1, '08:00', '18:00', 1, '08:00', '18:00', 1, '08:00', '18:00',1, 'plain temps (60h)'),";
+// sinssql += "('"+ appdb.generate_uuid()+"', '08:00', '13:00', 1, '08:00', '13:00', 1, '08:00', '13:00', 1, '08:00', '13:00', 1, '08:00', '13:00',1,'matin (30h)'),";
+// sinssql += "('"+ appdb.generate_uuid()+"', '13:00', '18:00', 1, '13:00', '18:00', 1, '13:00', '18:00', 1, '13:00', '18:00', 1, '13:00', '18:00',1, 'après-midi (30h)');";
+// inssql.push(sinssql);
+
+// }
+// for (var i in inssql){
+
+// appdb.dbexec(inssql[i]);
+// }
+
+
+// }
+// }
}
function check_crechetable(){
pconfig.presday = $('#presday').val();
console.log(pconfig);
var tmpweek = new Date(pconfig.presday);
- var nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()-2);
+ var nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()-1);
if (nweek.getDay() == 0){
- nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()-3);
+ nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()-2);
}
// if (nweek.getDay() == 6){
// nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()-2);
var tmpweek = new Date(pconfig.presday);
var nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()+2);
if (nweek.getDay() == 0){
- nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()+3);
+ nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()+4);
}
console.log("new next Date");
console.log(nweek);
function timefocus(obj){
if (!obj.value || obj.value == ''){
var currentdate = new Date();
- obj.value=currentdate.toLocaleFormat("%H:%M");
+ obj.value=currentdate.getHours() + ":" +currentdate.getMinutes();
}
obj.select();
}
--- /dev/null
+{"printlayout":"table","calmonth":"11.2018","calendar":"childsbyplan"}
\ No newline at end of file
-{"printlayout":"list"}
\ No newline at end of file
+{"order":[[0,"asc"]],"filterid":"4","printlayout":"list"}
\ No newline at end of file
--- /dev/null
+{}
\ No newline at end of file
-{"presday":"2019-04-02","db":"underatert"}
\ No newline at end of file
+{"presday":"2019-04-12","db":"underatert"}
\ No newline at end of file
-{"idfilter":0,"order":[[0,"asc"]],"printlayout":"list"}
\ No newline at end of file
+{"order":[[0,"asc"]]}
\ No newline at end of file
+++ /dev/null
-{"groupuuid":"9cd95522-acab-a24a-87ee-74a2f0825401","printlayout":"multilist","presweek":null,"activetab":"tblgrp_9cd95522-acab-a24a-87ee-74a2f0825401"}
\ No newline at end of file
-{"presweek":null,"activetab":"tblgrp_null","groupuuid":"null","printlayout":"multilist"}
\ No newline at end of file
+{"groupuuid":"9cd95522-acab-a24a-87ee-74a2f0825401","printlayout":"multilist","presweek":null,"activetab":"tblgrp_9cd95522-acab-a24a-87ee-74a2f0825401"}
\ No newline at end of file
<link rel="icon" type="image/png" href="img/favicon/android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="imgfavicon/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="img/favicon/favicon-16x16.png" sizes="16x16">
- <link rel="manifest" href="img/favicon/manifest.json">
+ <!-- <link rel="manifest" href="img/favicon/manifest.json">
<link rel="mask-icon" href="img/favicon/safari-pinned-tab.svg" color="#5BBAD5">
<meta name="msapplication-TileColor" content="#ffffff">
- <meta name="msapplication-TileImage" content="img/favicon/mstile-144x144.png">
+ <meta name="msapplication-TileImage" content="img/favicon/mstile-144x144.png"> -->
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.min.css" >
<link rel="stylesheet" href="css/apps.css" >
</div>
<div class="ml-auto text-white lead" >
+ <button onclick="logout();">Logout</button>
Apps
</div>
</nav>
<div class="container main">
<div class="row">
- <div class="col-sm-3">
+ <div class="col-sm-2" style="cursor: pointer;" onclick="window.open('apps/creorga/index.html','_blank');">
<div class="card">
<img src="img/apps/creorgalogo.svg" class="card-img-top" style="padding: 5px;" alt="...">
- <div class="card-body">
- <h5 class="card-title">Creorga</h5>
- <p class="card-text">Application pour crèches au Luxembourg</p>
- </div>
- <div class="card-footer">
- <a class="btn btn-secondary text-white" target="_blank" href="apps/creorga/index.html">Lancer</a>
- </div>
+ <div class="card-header align-items-center bg-white"><h5>Creorga</h5></div>
</div>
</div>
- <div class="col-sm-3">
+ <div class="col-sm-2" style="cursor: pointer;" onclick="window.open('apps/hourtrax/index.html','_blank');">
<div class="card">
<img src="img/apps/hourtraxlogo.svg" class="card-img-top" style="padding: 5px;" alt="...">
- <div class="card-body">
- <h5 class="card-title">Hourtrax</h5>
- <p class="card-text">Gérance de disponibilité et du congé du personnel</p>
- </div>
- <div class="card-footer">
- <a class="btn btn-secondary text-white">Lancer</a>
- </div>
+ <div class="card-header align-items-center bg-white"><h5>Hourtrax</h5></div>
</div>
</div>
- <div class="col-sm-3">
+ <div class="col-sm-2" style="cursor: pointer;" onclick="window.open('apps/invoicejournal_co/index.html','_blank');">
<div class="card">
<img src="img/apps/invoicejournallogo.svg" class="card-img-top" style="padding: 5px;" alt="...">
- <div class="card-body">
- <h5 class="card-title">Invoice Journal</h5>
- <p class="card-text">Gérance des Factures et Rappels</p>
- </div>
- <div class="card-footer">
- <a class="btn btn-secondary text-white">Lancer</a>
- </div>
+ <div class="card-header align-items-center bg-white"><h5>Invoice Journal</h5></div>
</div>
</div>
</div>
</div>
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js" ></script>
-
+ <script src="js/apps.js"></script>
</body>
</html>
\ No newline at end of file
--- /dev/null
+// function logout(){
+// alert(('https:' == document.location.protocol ? 'https' : 'http') + '://'+ location.host + '/apps_dks_lu');
+// //location.href=location.protocol + "://nouser:nopwd@" + location.host + '/apps_dks_lu';
+// }
+function logout() {
+ //alert("TEST");
+ secUrl = ('https:' == document.location.protocol ? 'https' : 'http') + '://'+ location.host + '/apps_dks_lu';
+ redirUrl= 'https://www.dks.lu'
+ var bowser = getBrowser();
+ console.log(bowser);
+ if (bowser == "IE") {
+ document.execCommand('ClearAuthenticationCache', 'false');
+ } else if (bowser == "Firefox") {
+ $.ajax({
+ async: false,
+ url: secUrl,
+ type: 'GET',
+ username: 'logout'
+ });
+ } else if (bowser == "Safari" || bowser == "Chrome") {
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.open("GET", secUrl, true);
+ xmlhttp.setRequestHeader("Authorization", "Basic logout");
+ xmlhttp.send();
+ } else {
+ alert("Logging out automatically is unsupported for " + bowser
+ + "\nYou must close the browser to log out.");
+ }
+ setTimeout(function () {
+ window.location.href = redirUrl;
+ }, 200);
+}
+
+function getBrowser(){
+ var brx = "unknown";
+ if (/Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent)){
+ brx = "Safari";
+ }
+ if (/Chrome/.test(navigator.userAgent)){
+ brx ="Chrome";
+ }
+ if (/Edge/.test(navigator.userAgent)){
+ brx ="Edge";
+ }
+ if (/Firefox/.test(navigator.userAgent)){
+ brx ="Firefox";
+ }
+ if (/OPR/.test(navigator.userAgent)){
+ brx ="Opera";
+ }
+ if (/Trident|msie/.test(navigator.userAgent)){
+ brx ="IE";
+ }
+ return brx;
+}
\ No newline at end of file