$num_wd = date('w',strtotime($_GET['day']));
$str_wd = strtolower(date('D',strtotime($_GET['day'])));
$sql ="select ".$str_wd."_values as hour_values,option1_name,option1_values,option2_name,option2_values,option3_name,option3_values,option4_name,option4_values from timesheets where startdate <= date('".$_GET['day']."') and weekdays LIKE '%".$num_wd."%' and id_user=".$iduser." order by startdate desc LIMIT 1;";
- error_log("GET RDVDAY:".$sql);
+
$daydata = $db->dbquery($sql);
$sql ="select dayhours from exceptions where daydate=date('".$_GET['day']."') and id_user=".$iduser.";";
$exception = $db->dbquery($sql);
- // $daydata["exception"] = explode(',',$exception["dayhours"]);
+
if ($daydata["hour_values"] != ""){
$daydata["hour_values"] = explode(',',$daydata["hour_values"]);
} else {
//exclude taken rdv times
$sql = "select eventhour from events where eventdate=date('".$_GET['day']."') and id_user='".$iduser."' and (user_status != 'canceled' or client_status != 'canceled')";
$takenevents = $db->dbquery($sql);
- // $daydata["taken"] = explode(',',$takenevents["eventhour"]);
+
if ($daydata["hour_values"] != null){
$dhnew = array();
if ($takenevents != null){
REPLACE(FORMAT(payedamount, 2),'.',',') as payedamount from invoicedata where id_user=".$user["id"]." order by invoicedate DESC,id DESC LIMIT 1;";
$pdfdata = $db->dbquery($sql);
$pdffile = create_pdfinvoice($pdfdata);
- $msg .= '<br/>'.$pdffile;
+ //$msg .= '<br/>'.$pdffile;
if ($pdffile != ""){
$send = sendemail('user_invoice',array("email" => $user["useremail"],"id" => $user["id"]),array($pdffile));
if ($send == 0){
global $db,$user,$msg;
$sql = "select id,service,expiration,payeddate,isevaluation from userservices where id_app='".$gdt["id"]."' and id_user=".$user["id"].";";
$eval = $db->dbquery($sql);
- // $msg = $sql;
+
if ($eval){
if ($gdt["enable"] == "0"){ $gdt["enable"] = 'null';}
$sql = "UPDATE userservices set enabled=".$gdt["enable"]." WHERE id=".$eval["id"].";";
- // $msg .= '<br/>'.$sql;
+
$db->dbexec($sql);
} else {
$sql = "select id,evaluationdays,app from apps where id=".$gdt["id"].";";
if (($eapp) && ($eapp["evaluationdays"] == null)){
$sql = "INSERT INTO userservices (id_user,service,id_app,enabled) VALUES (".$user["id"].",'".$eapp["app"]."',".$gdt["id"].",".$gdt["enable"].")";
- // $msg .= '<br/>'.$sql;
$db->dbexec($sql);
}
}
$luser = $db->dbquery($sql);
$sid = null;
$retuser=null;
- //echo "<pre>$sql<br/>".$luser["cnt"]."</pre>";
+
if ($luser["cnt"] == 1){
$sid = generateRandomString();
$sql = "INSERT INTO usersession (sessionid, id_user, lastlogin, useragent, remoteaddr)
$db->dbexec($sql);
setcookie("juridig",$sid);
$retuser = getsessiondata($sid);
-
- //$p='profile';
+
}else {
setcookie("juridig","");
$msg='<div class="alert alert-danger">Utilisateur et/ou mot de passe non connu!</div>';
- //$p='/home';
+
}
return $retuser;
}
// $msg .= $senddata;
// $send = 0;
if ($send == 0){
- $msg .= '<div class="alert alert-info">Votre demande à été enregistrée!<br/>
+ $msg = '<div class="alert alert-info">Votre demande à été enregistrée!<br/>
Nous vous avons envoyés un email avec un lien de confirmation.<br/>Après confirmation votre demande sera tranférée au avocat!
</div>';
} else {
- $msg .= '<div class="alert alert-danger">Erreur! quelque chose n\'a pas bien fonctionnée!</div>';
+ $msg = '<div class="alert alert-danger">Erreur! quelque chose n\'a pas bien fonctionnée!</div>';
}
}
from events ev
left join users usr on (ev.id_user=usr.id)
left join users cl on (ev.id_client=cl.id) where ev.clientuuid='".$db->secvalue($rdv["uuid"])."' or ev.useruuid='".$db->secvalue($rdv["uuid"])."'";
- // $msg .= "SQL 1: $sql<br/>";
+
$event = $db->dbquery($sql);
$sql = "";
$newrdv = 0;
$sql = "UPDATE events SET user_status='canceled' where useruuid='".$rdv["uuid"]."'";
}
}
- // $msg .= "SQL 2: $sql<br/>";
+
if ($sql != ""){
$res = $db->dbexec($sql);
if ($res !== false){
}
function process_getdata($gdt){
- global $baseurl,$p,$db,$user;
+ global $baseurl,$p,$db,$user,$sp;
// print_r($gdt);
if ($user != null){
if (isset($gdt["action"])){
switch ($gdt['action']){
case 'logout':
- $db->dbexec("delete from usersession where sessionid='".$user["sessionid"]."';");
+ $db->dbexec("delete from usersession where sessionid='".$user["sessionid"]."' and id_user=".$user["id"].";");
$user=array();
setcookie("juridig","");
$p='home';
break;
-
+ case 'deleterdv':
+ $db->dbexec("delete from events where id='".$gdt["id"]."' and id_user='".$user["id"]."';");
+ break;
+ case 'deletetimesheet':
+ $db->dbexec("delete from timesheets where id='".$gdt["id"]."' and id_user='".$user["id"]."';");
+ break;
+ case 'block':
+ $db->dbexec("insert into userclients (id_client,id_user,clientblocked) VALUES ('".$gdt["clientid"]."','".$user["id"]."','1')");
+ break;
+ case 'unblock':
+ $db->dbexec("delete from userclients WHERE id_client='".$gdt["clientid"]."' and id_user='".$user["id"]."'");
+ break;
}
}
+++ /dev/null
-<?php phpinfo(); ?>
\ No newline at end of file
function handleFileSelect(evt) {
- var files = evt.target.files; // FileList object
+ var files = evt.target.files;
var utype = "";
if ($("form").attr('id') == "dksrdv_catalog"){
$("form").prepend('<input type="hidden" id="photo" name="photo" value=""/>');
-
- // Loop through the FileList and render image files as thumbnails.
for (var i = 0, f; f = files[i]; i++) {
-
- // Only process image files.
if (!f.type.match('image.*')) {
continue;
}
-
var reader = new FileReader();
-
- // Closure to capture the file information.
reader.onload = (function(theFile) {
return function(e) {
$("#preview").attr("src",e.target.result);
$("#"+utype+"photo").val(e.target.result);
- //console.log($("#userphoto"));
};
})(f);
-
- // Read in the image file as a data URL.
reader.readAsDataURL(f);
}
}
}
}
-
-
function initstandard(){
var forms = document.querySelectorAll('form.dks');
if (forms.length > 0){
tinymce.init({
selector: '.richeditarea',
- //height: 300,
branding: false,
menubar:false,
statusbar: false,
function imsg(data){
var tmp = h1(data);
- console.log(tmp);
window.location.href=tmp;
}
left join `catalog` cat on (usr.id=cat.id_user)
where usr.usergroup in ('avocat') and usr.userblocked is null and usr.activationkey is null group by usr.id order by cat.company,cat.surname,cat.prename;";
$avocats = $db->dbqueryall($sql);
- // echo "$sql";
+
?>
<div class="row justify-content-center">
<script src="<?php echo $baseurl; ?>/vendor/bootstrap4-tagsinput/tagsinput.js"></script>
<script src="<?php echo $baseurl; ?>/vendor/twbs-toggle-buttons/jquery.twbs-toggle-buttons.min.js"></script>
<script src="<?php echo $baseurl; ?>/vendor/tinymce/js/tinymce/tinymce.min.js"></script>
-<script src="<?php echo $baseurl; ?>/site.js?v=4"></script>
\ No newline at end of file
+<script src="<?php echo $baseurl; ?>/site.js?v=5"></script>
\ No newline at end of file
$sql = "select cl.id as id_client,ev.id_user,cl.usersurname,cl.userprename,cl.userphone,cl.useremail,case when uc.clientblocked=1 then 1 else 0 end as clientblocked,cl.userblocked as globalblocked from events ev
left join users cl on (cl.id=ev.id_client)
left join userclients uc on (uc.id_client=cl.id and uc.id_user=".$user['id'].") group by cl.id;";
- //echo $sql;
+
$tablelist = $db->dbqueryall($sql);
?>
if ($row["globalblocked"] == "1"){
echo '<span class="text-danger">blocké par juridig.lu</span>';
} else if ($row["clientblocked"] == "1"){
- echo '<button class="btn btn-danger" onclick="location.href='.$baseurl.'/profile/rendezvous/clientlist?action=unblock&clientid='.$row['id_client'].';"><i class="fas fa-lock"></i></button>';
+ echo '<button class="btn btn-danger" onclick="location.href=\''.$baseurl.'/profile/rendezvous/clientlist?action=unblock&clientid='.$row['id_client'].'\';"><i class="fas fa-lock"></i></button>';
} else {
- echo '<button class="btn btn-success" onclick="location.href='.$baseurl.'/profile/rendezvous/clientlist?action=block&clientid='.$row['id_client'].';"><i class="fas fa-lock-open"></i></button>';
+ echo '<button class="btn btn-success" onclick="location.href=\''.$baseurl.'/profile/rendezvous/clientlist?action=block&clientid='.$row['id_client'].'\';"><i class="fas fa-lock-open"></i></button>';
}
?>
?>
<tr></tr>
</tbody>
-</table>
\ No newline at end of file
+</table>
+<script>
+function initdata(){
+}
+</script>
\ No newline at end of file
echo '<span class="text-warning">INCONNUE</span>';
}; ?></td>
<?php } ?>
- <td><button class="btn btn-danger" onclick="location.href='<?php echo $baseurl.'/rendezvouslistold?action=deletetimesheet&id='.$row['id']; ?>';"><i class="fas fa-trash"></i></button></td>
+ <td><button class="btn btn-danger" onclick="location.href='<?php echo $baseurl.'/profile/rendezvous/rendezvouslistold?action=deleterdv&id='.$row['id']; ?>';"><i class="fas fa-trash"></i></button></td>
</tr>
<?php
}
-<?php
-
-
-?>
-
<form id="dksrdv_exception" id="dksrdv_exception" class="needs-validation" novalidate>
<input type="hidden" id="id_user" name="id_user" value="<?php echo $user['id']; ?>" />
<div class="row">
</div>
</form>
<script type="text/javascript">
+
var wds={"mon":null,"tue":null,"wed": null,"thu":null, "fri": null, "sat": null, "sun": null};
-function initdata(){
- moment.locale('fr');
- $('.datepicker').datepicker({
- language: 'fr',
- format: {
- toDisplay: function(date) {
- var d = moment(date); // In my case, week begin on Sat. +1 day to make sure Sat moved to next week (Default start from Sun)
+
+function getweek(date){
+ var d = moment(date);
wds.mon = moment(date).startOf('week').add(1,'d');
$("#datemon").html(wds.mon.format("D. MMM"));
wds.tue = moment(date).startOf('week').add(2,'d');
$("#datesat").html(wds.sat.format("D. MMM"));
wds.sun = moment(date).startOf('week').add(7, 'd');
$("#datesun").html(wds.sun.format("D. MMM"));
- console.log(wds);
return d.format("[CW]WW")+ " - ( " + wds.mon.format("DD/MM/YYYY") + " - " + wds.sun.format("DD/MM/YYYY") + " )";
+}
+
+function initdata(){
+ moment.locale('fr');
+ $('.datepicker').datepicker({
+ language: 'fr',
+ format: {
+ toDisplay: function(date) {
+ return getweek(date);
},
toValue: function(date) {
var year = Number(date.split("-W")[0]);
return d.toDate();
}
},
- container: '#weekpicker', // Inject to placeholder to apply css
+ container: '#weekpicker',
autoclose: true,
calendarWeeks: true,
- weekStart: 1 // Week starts on Sat
+ weekStart: 1
});
$('.datepicker').on('show', function() {
$('#weekpicker').find('.datepicker table tr').each(function() {
}
});
});
+ $("#calendarweek").val(getweek(new Date()));
+ getdaytimesheets();
}
function getdaytimesheets() {
encoding:"UTF-8",
url:'<?php echo $baseurl; ?>/api.php?action=timesheetday&day='+wds[d].format('YYYY-MM-DD')+'&id_user='+ $("#id_user").val(),
success: function (data){
- console.log(data);
+
if (data.daydata){
var dd = data.daydata.split(',');
for (var i in dd){
}
function setstatus(objid){
- console.log("id for status:" + objid + $("#" + objid).hasClass("btn"));
+
status=null;
if ($("#" + objid).hasClass("btn-success")){
status="set";
$("#" + objid).removeClass("btn-danger");
$("#" + objid).addClass("btn-success");
}
- console.log('/api.php?action=setexception&type='+ status+'&day='+$("#" + objid).attr("data-date")+'&value='+$("#" + objid).html()+'&id_user='+ $("#id_user").val());
- $.ajax({
+ $.ajax({
encoding:"UTF-8",
url:'<?php echo $baseurl; ?>/api.php?action=setexception&type='+ status+'&day='+$("#" + objid).attr("data-date")+'&value='+$("#" + objid).html()+'&id_user='+ $("#id_user").val(),
success: function (data){
- console.log(data);
-
+
},
error: function(data){
replace(replace(replace(replace(replace(replace(replace(ts.weekdays,'1','Lu'),'2','Ma'),'3','Me'),'4','Je'),'5','Ve'),'6','Sa'),'0','Di') as weekdays,
CONCAT(COALESCE(option1_name,''),',',COALESCE(option2_name,''),COALESCE(option3_name,''),COALESCE(option4_name,'')) as options
FROM timesheets ts where ts.id_user=".$user['id'].";";
- //echo "$sql";
+
$tablelist = $db->dbqueryall($sql);
?>
<h5>Mes Horaires</h5>
<td><?php echo $row['options']; ?></td>
<td>
<button class="btn btn-info" onclick="location.href='<?php echo $baseurl; ?>/profile/rendezvous/timesheet?id=<?php echo $row['id']; ?>';"><i class="fas fa-edit"></i></button>
- <button class="btn btn-danger" onclick="location.href='<?php echo $baseurl; ?>/profile/rendezvous/timesheetlist?action=deletetimesheet&id=<?php echo $row['id']; ?>"><i class="fas fa-trash"></i></button>
+ <button class="btn btn-danger" onclick="location.href='<?php echo $baseurl; ?>/profile/rendezvous/timesheetlist?action=deletetimesheet&id=<?php echo $row['id']; ?>';"><i class="fas fa-trash"></i></button>
</td>
</tr>
<?php
}
?>
</tbody>
-</table>
\ No newline at end of file
+</table>
+<script>
+function initdata(){
+}
+</script>
\ No newline at end of file
if (isset($_GET["id"]) && ($_GET['id'] != "")){
$selid = $_GET['id'];
$sql = "SELECT usr.id,usr.userprename,usr.usersurname from users usr left join userservices srv on (usr.id=srv.id_user) where srv.service='rendezvous' and srv.expiration >= CURRENT_DATE and usr.id='".$_GET["id"]."';";
-// echo $sql;
+
$avosel = $db->dbquery($sql);
}
?>
<div class="row justify-content-center">
<div class="col-md-4">
<div class="card" style="">
- <div class="card-header"><h6>Votre Rendez-Vous</h6></div>
+ <div class="card-header"><h5>Votre Rendez-Vous</h5></div>
<div class="card-body">
<table>
<tr><th>Votre Nom</th><td><?php echo $event["clientname"];?></td></tr>
?>
<div class="card" style="">
- <div class="card-header"><h6>Votre Rendez-Vous</h6></div>
+ <div class="card-header"><h5>Votre Rendez-Vous</h5></div>
<div class="card-body">
<table>
<tr><th style="width: 150px;">Votre Nom</th><td><?php echo $event["username"];?></td></tr>
echo '<span class="text-warning">INCONNUE</span>';
}; ?></td></tr>
<?php
- if (($user) && ($user["usergroup"] == 'avocat'){
+ if (($user) && ($user["usergroup"] == 'avocat')){
?>
<tr><th>Tél. Client</th><td><a href="tel:<?php echo $event["clientphone"];?>"><?php echo $event["clientphone"];?></a></td></tr>
<tr><th>E-mail Client</th><td><a href="mailto:<?php echo $event["clientemail"];?>"><?php echo $event["clientemail"];?></a></td></tr>