use CGI;
use CGI::Cookie;
use CGI::Carp qw/fatalsToBrowser/;
-#use FindBin qw($Bin $RealBin);
+
use Data::Dumper;
use JSON::PP;
use session;
-#my $tmpldir = "/mnt/c/Users/ksaff/Workspace/juridig/app/tmpl";
-# chdir(dirname($0));
+
my $skl = "skeleton/index.tt";
my $cgi = new CGI();
my $p=();
# foreach my $pp (@params){
# $p->{$pp} = $cgi->param($pp);
# }
+my $status = '200 ok';
my $sess = ();
my $se = session->new();
my $page = "index.tt";
# if (!exists($sesdata->{usersession})){
# $p->{page} = "login";
# }
-print $cgi->header(-type=>'text/html', -charset=>"utf-8",-cookie => $cookie);
+print $cgi->header(-status => $status, -type=>'text/html', -charset=>"utf-8",-cookie => $cookie);
my $template = Template->new({INCLUDE_PATH => [dirname($ENV{"SCRIPT_FILENAME"}).'/tmpl']});
my @lv = split(/\//,$filepath);
}
- var https = 'https';
+ var https = 'http';
$(document).ready(function() {
app.baseurl = https + '://' + location.host + location.pathname.substring(0,location.pathname.lastIndexOf('/apps/')+6);
app.loadsites();
});
- // $("#appframe").on('load', function(){
- // //console.log($("#appframe").attr("src"));
- // var src = $("#appframe").attr("src").replace(/\\/g,'/');
- // src = src.substring(src.indexOf('/creorga/') + 5);
- // src = src.substring(0,src.indexOf('?'));
- // $.ajax({
- // encoding:"UTF-8",
- // url:app.api() +'prefs.cgi?page=service&set=' +encodeURIComponent('{"lastpage":"'+ src+'"}') ,
-
- // success: function (data){
-
-
- // },
- // error: function(data){
-
- // console.log("Error:" + JSON.stringify(data));
- // },
- // async:false
- // });
- // })
\ No newline at end of file
-var https ='https';
+var https ='http';
function logout() {
myurl = https + '://'+ location.host + '/apps/';
$.ajax({
result=data.result;
},
error: function(data){
-
- console.log("Error:" + JSON.stringify(data));
+
+ console.log("Error:" + JSON.stringify(data));
},
async:false
});
</div>
</div>
+ <div class="form-group">
+ <label for="vacancy_total">congé normale ouvert</label>
+
+ <div class="input-group" style="width: 120px;">
+ <input type="text" id="vacancyyeartotalopen" class="form-control" value="" disabled>
+ <span class="input-group-addon">h</span>
+ </div>
+
+ </div>
</div>
<table id="tbl_vacancy" class="table table-striped table-bordered" data-toggle="table" data-heigth="10vh" style="width: 100%;" >
if (pconfig == null) {
pconfig = {};
}
- parent.appdb.dbexec("update vacancycalendar set vacyear=strftime('%Y',datefrom) where vacyear is null;");
+
if (!pconfig.year) {
pconfig.year=new Date().getFullYear();
- }
- if (!pconfig.printlayout) {
- pconfig.printlayout = 'list';
parent.apppref.setpreference("coworker",pconfig);
}
+
var cdatasql = "SELECT jobtitle, prename, surname, address, zip, city, country, entrydate, exitdate, iban, bic, accountname, phone, email, uuid,color,weekhours,maxdayhours FROM staff where uuid='" + pconfig.uuid + "';";
var cdata = parent.appdb.dbquery(cdatasql);
cdata = cdata.sqldata[0];
if ((yearvac) && (yearvac.sqldata)){
nvyear = yearvac.sqldata[0].hours;
}
+
$("#vacancyyeartotal").val(nvyear);
var vacdatasql = "SELECT '<button type=\"button\" class=\"btn btn-primary\" onclick=\"dlg_vacancy({''uuid'':'''|| uuid || '''},''upd'');\"><span class=\"glyphicon glyphicon-pencil\"></span></button>" +
"<button type=\"button\" class=\"btn btn-danger\" onclick=\"confirm_delete_vacancy(''' || uuid || ''');\"><span class=\"glyphicon glyphicon-remove\"></span></button>' AS action," + "vacyear," +
"cast(cast(strftime(\"%s\",vc.timeto) as int)- cast(strftime(\"%s\",vc.timefrom) as int) as real)/3600 as hours " +
"from vacancycalendar vc join staff st on (vc.staffuuid=st.uuid) where vc.staffuuid='"+ pconfig.uuid+"' and vc.vacyear=" + pconfig.year+"));";
-//jsdump("XXSQL:" + vacdatasql + "\n");
+
var vacdata = parent.appdb.dbquery(vacdatasql);
var sums = { normal:0,except:0,ill:0,normal_ok:0,except_ok:0,ill_ok:0};
for (var i in vacdata.sqldata){
var row = vacdata.sqldata[i];
- // sums.all = sums.all + ((row.dayhours != '')?parseFloat(row.dayhours):0.00);
+
sums.normal = sums.normal + ((row.thnormalnv != '')?parseFloat(row.thnormalnv):0.00);
sums.except = sums.except + ((row.thextranv != '')?parseFloat(row.thextranv):0.00);
sums.ill = sums.ill + ((row.thillnv != '')?parseFloat(row.thillnv):0.00);
+ '<th class="alignright" style="color: green;width: 60px;">' + sums.ill_ok.toFixed(2) + '</th>'
+"</tr>";
$("#tbl_vacancy > tfoot").html(tfoot);
-
+ $("#vacancyyeartotalopen").val("");
+ if (nvyear != ""){
+ var sumrest = parseFloat(nvyear) - sums.normal_ok;
+ $("#vacancyyeartotalopen").val(sumrest.toFixed(2));
+ }
+
$("#tbl_vacancy").bootstrapTable({
locale: 'fr-FR',
pagination: false,
timefrom: '00:00',
hours: maxdayhours,
type:'0',
- //dailyduration:'1.0',
- //hourmax: whr
+
};
if (type == 'upd') {
var evsql = "select uuid,vacdatefrom,vacdateto,timefrom,description,staffuuid,case when hours = '0.00' then '" + maxdayhours +"' else hours end as hours,accepted from (SELECT uuid, strftime(\"%d.%m.%Y\",datefrom) as vacdatefrom, strftime(\"%d.%m.%Y\",dateto) as vacdateto, timefrom, description, '"+pconfig.uuid+"' as staffuuid,type, printf(\"%.2f\",cast((cast(strftime(\"%s\",timeto) as int)- cast(strftime(\"%s\",timefrom) as int))/3600 as real)) as hours,accepted FROM vacancycalendar where uuid='" + uuid.uuid + "');";
- //var evsql = "SELECT uuid, strftime(\"%d.%m.%Y\",datefrom) as vacdatefrom, strftime(\"%d.%m.%Y\",dateto) as vacdateto, timefrom, description, '"+pconfig.uuid+"' as staffuuid,type, case when timefrom!=timeto then '0.' || (cast(substr(timeto,1,2) as int) - cast(substr(timefrom,1,2) as int)) else 1.0 end as dailyduration,null as hours,accepted FROM vacancycalendar where uuid='" + uuid.uuid + "';";
- //dump("EVSQL: " + evsql + "\n");
+
evdata = parent.appdb.dbquery(evsql);
evdata = evdata.sqldata[0];
if (evdata.type == -1){
}
if ($("#frmeditvacancy #" + w)) {
- //dump(w + "->"+evdata[w]+"\n");
+
if (w == "type"){
$("#frmeditvacancy #" + w + " select").val(evdata[w]);
} else {
} else {
savesql = "UPDATE vacancycalendar SET vacyear=" + encodeparam(evsvdata.datefrom, 'year') + ", datefrom = date("+encodeparam(evsvdata.datefrom, 'date')+"), dateto = date("+encodeparam(evsvdata.dateto, 'date')+"), timefrom = "+encodeparam(evsvdata.timefrom, 'text')+", timeto = strftime(\"%H:%M\",time("+encodeparam(evsvdata.timefrom, 'text')+",'+"+evsvdata.hours+" hours')), description = "+encodeparam(evsvdata.description, 'text')+", staffuuid = "+encodeparam(evsvdata.staffuuid, 'text')+", type = "+evsvdata.type+" WHERE uuid = '"+evsvdata.uuid+"';";
}
- //dump("VACSAVESQL:" + savesql + "\n");
+
parent.appdb.dbexec(savesql);
load_table_vacancy();
function set_selectyears() {
- var years = parent.appdb.dbquery("select strftime('%Y',coalesce(min(entrydate),date('now','-1 year'))) as minyear, strftime('%Y',date('now', '+1 year')) as maxyear from staff where uuid='"+pconfig.uuid+"';");
+ var years = parent.appdb.dbquery("select COALESCE((select cast(min(vacancyyear) as TEXT) as minyear from staffvacancydays where staffuuid='4b86fe07-d175-c74e-aafc-40e2275f3b6d'),strftime('%Y',coalesce(min(entrydate),date('now','-1 year')))) as minyear,strftime('%Y',date('now', '+1 year')) as maxyear from staff where uuid='"+pconfig.uuid+"';");
var minyear = parseInt(years.sqldata[0].minyear);
var maxyear = parseInt(years.sqldata[0].maxyear);
for (var y=minyear;y<=maxyear;y++){
[% IF creorga.modules.staff.delete %]
delbtn = "<button type=\"button\" class=\"btn btn-danger\" onclick=\"confirm_delete_coworker(''' || uuid || ''');\" title=\"supprimer\"><span class=\"glyphicon glyphicon-remove\"></span></button>";
[% END %]
- var sql = "SELECT '<button type=\"button\" class=\"btn btn-primary\" onclick=\"parent.app.loadpage(''modules/staff/coworker.html'',{uuid:''' || uuid || '''});\" title=\"editer\"><span class=\"glyphicon glyphicon-pencil\"></span></button>"+delbtn+"' as action, coalesce(prename,'') || '<br/>' || coalesce(surname,'') as name,case when color is not null then '<div style=\"width: 50px; height: 30px;background-color: ' || color ||';\"></div>' else null end color, coalesce(address,'')|| '<br/>' || coalesce(zip,'') || ' ' || coalesce(city,'') || '<br/>' || coalesce(country,'') as address, case when phone is not null then '<span class=\"glyphicon glyphicon-earphone\" aria-hidden=\"true\"></span>: ' || phone || '<br/>' else '' end || case when email is not null then '<span class=\"glyphicon glyphicon-envelope\" aria-hidden=\"true\"></span>:' || email else '' end as phonemail, coalesce(jobtitle,'') || '<br/>' || case when entrydate is not null then 'à partir du: ' || strftime('%d.%m.%Y',entrydate) else '' end || case when exitdate is not null then ' jusqu''au: ' || strftime('%d.%m.%Y',exitdate) else '' end as jobtitle FROM staff;";
+ var sql = "SELECT '<button type=\"button\" class=\"btn btn-primary\" onclick=\"parent.app.loadpage(''modules/staff/coworker.html'',{uuid:''' || uuid || '''});\" title=\"editer\"><span class=\"glyphicon glyphicon-pencil\"></span></button>"+delbtn+"' as action, coalesce(prename,'') || '<br/>' || coalesce(surname,'') as name,case when color is not null then '<div style=\"width: 50px; height: 30px;background-color: ' || color ||';\"></div>' else null end color, coalesce(address,'')|| '<br/>' || coalesce(zip,'') || ' ' || coalesce(city,'') || '<br/>' || coalesce(country,'') as address, case when phone is not null then '<span class=\"glyphicon glyphicon-earphone\" aria-hidden=\"true\"></span>: ' || phone || '<br/>' else '' end || case when email is not null then '<span class=\"glyphicon glyphicon-envelope\" aria-hidden=\"true\"></span>:' || email else '' end as phonemail, coalesce(jobtitle,'') || '<br/>' || case when entrydate is not null then 'à partir du: ' || strftime('%d.%m.%Y',entrydate) else '' end || case when exitdate is not null then ' jusqu''au: ' || strftime('%d.%m.%Y',exitdate) else '' end as jobtitle FROM staff where inactive is null;";
var data = parent.appdb.dbqueryarray(sql);
-ALTER TABLE creche add column idcheckservice TEXT;
\ No newline at end of file
+ALTER TABLE creche add column idcheckservice TEXT;
+update vacancycalendar set vacyear=strftime('%Y',datefrom) where vacyear is null;
+update vacancycalendar set timeto='08:00' where timeto='00:00';
+ALTER TABLE vacancycalendar add column vacyear integer;
+alter table staff add column inactive boolean;
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ viewBox="0 0 360.00001 160"
+ height="160"
+ width="360"
+ xml:space="preserve"
+ id="svg4485"
+ version="1.1"
+ sodipodi:docname="logofull.svg"
+ inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1920"
+ inkscape:window-height="1017"
+ id="namedview16"
+ showgrid="false"
+ inkscape:zoom="0.97222222"
+ inkscape:cx="180"
+ inkscape:cy="80"
+ inkscape:window-x="-8"
+ inkscape:window-y="-8"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg4485" /><metadata
+ id="metadata4491"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs4489"><clipPath
+ id="clipPath4505"
+ clipPathUnits="userSpaceOnUse"><path
+ id="path4503"
+ d="M 0,566.93 H 850.39 V 0 H 0 Z" /></clipPath></defs><g
+ transform="matrix(1.3333333,0,0,-1.3333333,0,159.99999)"
+ id="g4493"><g
+ transform="translate(-293.05712,-301.76546)"
+ id="g4842"><g
+ id="g4507"
+ transform="translate(382.7939,357.5762)"
+ style="fill:#52638e;fill-opacity:1"><path
+ d="m 0,0 c -0.035,2.886 -0.737,5.485 -2.083,7.785 -1.305,2.302 -3.264,4.235 -5.866,5.825 -2.557,1.591 -6.082,2.596 -10.558,3.11 -4.453,0.513 -8.43,0.378 -11.969,-0.39 -3.564,-0.769 -6.709,-1.936 -9.447,-3.529 -2.772,-1.593 -5.179,-3.488 -7.233,-5.725 -2.079,-2.239 -3.797,-4.639 -5.171,-7.243 -1.287,-2.442 -2.125,-4.999 -2.508,-7.709 -0.364,-2.708 -0.014,-5.337 1.07,-7.892 1.133,-2.556 3.04,-4.924 5.763,-7.058 2.786,-2.132 6.607,-3.823 11.521,-4.93 5.264,-1.174 9.99,-1.411 14.094,-0.753 4.079,0.657 7.575,1.966 10.452,3.875 2.84,1.908 5.136,4.26 6.88,7.005 1.723,2.747 3.008,5.659 3.865,8.713 C -0.333,-5.864 0.059,-2.886 0,0 m -9.001,-36.676 c -5.294,-3.442 -11.596,-5.439 -18.77,-5.839 -7.194,-0.401 -14.785,0.485 -22.591,2.695 -8.701,2.51 -15.453,6.035 -20.494,10.108 -4.81,4.077 -7.985,8.398 -9.744,12.767 -1.594,4.371 -2.046,8.67 -1.41,12.916 0.712,4.247 2.287,8.172 4.778,11.946 2.398,3.633 5.48,6.864 9.347,9.883 3.806,3.019 8.152,5.56 13.092,7.73 4.858,2.168 10.267,3.85 16.246,5.053 5.91,1.201 12.241,1.598 18.998,1.042 5.487,-0.447 10.441,-1.673 14.873,-3.808 4.55,-2.132 7.852,-5.08 9.886,-8.887 0.13,-0.008 0.261,-0.016 0.391,-0.024 3.513,12.381 7.019,24.762 10.515,37.146 7.686,0.154 15.375,0.328 23.063,0.522 -4.933,-35.386 -9.888,-70.771 -14.865,-106.155 -12.055,0.565 -23.914,1.704 -35.473,3.387 0.884,3.15 1.767,6.3 2.65,9.45 -0.164,0.023 -0.328,0.046 -0.492,0.068"
+ style="fill:#52638e;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path4509" /></g><g
+ id="g4511"
+ transform="translate(422.3311,417.3052)"
+ style="fill:#52638e;fill-opacity:1"><path
+ d="m 0,0 c -2.774,-19.845 -5.553,-39.688 -8.34,-59.53 13.833,9.364 26.543,19.541 38.014,29.718 10.562,0.52 21.035,1.288 31.369,2.288 -10.655,-10.499 -22.623,-21.549 -36.067,-32.164 17.262,-16.25 36.767,-31.215 57.535,-42.98 -14.355,-3.269 -29.295,-5.665 -44.617,-7.107 -12.951,10.731 -24.833,22.44 -35.515,34.501 -4.596,-2.76 -9.287,-5.445 -14.067,-8.035 -1.302,-9.222 -2.604,-18.443 -3.908,-27.665 -12.758,0.611 -25.289,1.868 -37.474,3.731 10.21,35.519 20.35,71.052 30.423,106.597 C -15.091,-0.432 -7.542,-0.216 0,0"
+ style="fill:#52638e;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path4513" /></g><g
+ id="g4515"
+ transform="translate(510.582,329.7437)"
+ style="fill:#52638e;fill-opacity:1"><path
+ d="m 0,0 c 2.295,0.563 4.635,1.332 7.016,2.311 2.361,0.979 4.416,2.093 6.171,3.325 1.731,1.231 3.043,2.585 3.946,4.051 0.885,1.465 1.04,3.003 0.461,4.627 -0.973,2.736 -4.578,3.882 -10.971,3.782 -6.401,-0.097 -15.267,-0.585 -26.799,-0.929 -4.722,-0.098 -9.383,0.041 -13.953,0.405 -4.555,0.363 -8.652,1.164 -12.264,2.365 -3.574,1.2 -6.468,2.908 -8.671,5.084 -2.172,2.175 -3.298,4.964 -3.422,8.327 -0.185,4.944 0.994,9.075 3.466,12.387 2.392,3.315 5.563,6.009 9.508,8.11 3.858,2.103 8.203,3.714 13.058,4.872 4.792,1.16 9.728,2.005 14.808,2.572 5.052,0.568 10.015,0.806 14.91,0.763 4.895,-0.045 9.439,-0.546 13.638,-1.464 4.236,-0.922 8.063,-2.341 11.488,-4.257 3.473,-1.924 6.267,-4.573 8.424,-8.079 C 22.947,45.995 14.772,43.93 6.311,42.1 c -1.597,3.437 -4.342,5.434 -8.265,6.095 -3.901,0.656 -8.255,0.652 -13.099,-0.04 -1.537,-0.219 -3.189,-0.518 -4.963,-0.897 -1.784,-0.378 -3.376,-0.892 -4.779,-1.547 -1.416,-0.658 -2.567,-1.494 -3.458,-2.52 -0.905,-1.028 -1.221,-2.306 -0.95,-3.826 0.323,-1.808 1.547,-3.169 3.685,-4.047 2.152,-0.878 4.856,-1.438 8.099,-1.652 3.243,-0.213 6.907,-0.242 10.974,-0.048 4.049,0.195 8.152,0.425 12.285,0.713 4.256,0.313 8.413,0.561 12.465,0.753 4.045,0.189 7.743,0.094 11.11,-0.296 3.378,-0.394 6.315,-1.189 8.841,-2.417 2.548,-1.232 4.445,-3.139 5.737,-5.828 C 45.82,22.738 46.107,19 44.847,15.198 43.485,11.407 41.035,7.678 37.392,4.118 33.599,0.564 28.789,-2.773 22.855,-5.683 16.761,-8.588 10.215,-11.03 3.216,-12.892 c -7.268,-1.904 -14.654,-3.123 -22.081,-3.623 -7.462,-0.499 -14.259,-0.027 -20.297,1.307 -5.967,1.3 11.697,8.166 11.483,9.89 C -27.873,-3.668 -15.333,-5.485 0,0"
+ style="fill:#52638e;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path4517" /></g></g><g
+ transform="translate(572.5645,362.0737)"
+ id="g4651" /></g></svg>
\ No newline at end of file
use File::Basename;
use Template;
use CGI;
-use CGI::Carp qw/fatalsToBrowser/;
-#use FindBin qw($Bin $RealBin);
-
+# use CGI::Carp qw/fatalsToBrowser/;
# use Data::Dumper;
use JSON::PP;
-#my $tmpldir = "/mnt/c/Users/ksaff/Workspace/juridig/app/tmpl";
-# chdir(dirname($0));
+
my $cgi = new CGI();
my $p=();
$p->{$pp} = $cgi->param($pp);
}
my $page = "index.tt";
-my $basepath = substr(dirname($0),length($ENV{"DOCUMENT_ROOT"}));
+my $basepath = substr(dirname($ENV{"SCRIPT_FILENAME"}),length($ENV{"DOCUMENT_ROOT"}));
my $filepath = substr($cgi->url({-absolute=>1}),length($basepath)+1);
-#if (exists($p->{p})){
+
if ($filepath ne ""){
$page = $filepath;
$page =~ s/html$/tt/;
}
-#}
-#$p->{dirname} = dirname($0);
-#if (!exists($p))
-#$p->{baseurl} = $cgi->url({-base=>1});
-#$p->{pathinfo} =
-#$p->{basepath} = ;
+my $status = '200 ok';
-# if (!exists($p->{sid}))
-# {
-# $p->{sid} = $cgi->cookie('juridig');
-# }
-# my $se = session->new();
-# my $sesdata = $se->getsession($p->{sid});
-# if (!exists($sesdata->{usersession})){
-# $p->{page} = "login";
-# }
-print $cgi->header(-type=>'text/html', -charset=>"utf-8");
-my $template = Template->new({INCLUDE_PATH => [dirname($0).'/tmpl']});
+my $template = Template->new({INCLUDE_PATH => [dirname($ENV{"SCRIPT_FILENAME"}).'/tmpl']});
my @lv = split(/\//,$filepath);
my $absnum = scalar(@lv)-1;
my $vars->{abspath} = "";
for (my $i=0;$i<$absnum;$i++){
$vars->{abspath} .= "../";
}
-
+if (! -e dirname($ENV{"SCRIPT_FILENAME"}).'/tmpl/page/'.$page){
+ $page = 'error.tt';
+ $status = '404 not Found';
+}
$vars->{basepath} = $basepath;
$vars->{page} = 'page/'.$page;
$vars->{pagename} = basename($page);
$vars->{pagename} =~ s/\.tt$//;
-# print Dumper($vars);
+
my $skl = dirname($page);
-# print Dumper($template);
+print $cgi->header(-status=>$status, -type=>'text/html', -charset=>"utf-8");
+
$template->process("skeleton/index.tt",$vars) || die "Template process failed X: ", $template->error(), "\n";
-# my %headers = map { $_ => $cgi->http($_) } $cgi->http();
-# print "Got the following headers:\n";
-# for my $header ( keys %headers ) {
-# print "$header: $headers{$header}<br/>";
-# }
-# for my $e ( keys %ENV ) {
-# print "ENV: $e: ".$ENV{$e}."<br/>";
-# }
--- /dev/null
+<section>
+<div class="container">
+<h1>ERROR!</h1>
+<p>Diese Seite existiert nicht!</p>
+<p>This Page does not exist!</p>
+<p>cette page n'existe pas!</p>
+</div>
+</section>
\ No newline at end of file