JezK
Edit File: bookAppointment (copy).php
<?php ini_set('memory_limit', '-1'); include('mainHeader.php'); if(!isset($_REQUEST['pid'])) { echo "<script>alert('Invalid details');window.location='index.php'</script>"; } $id=$users->encrypt_decrypt('decrypt',$_REQUEST['pid']); if($id<=0) { echo "<script>alert('Invalid details');window.location='index.php'</script>"; } $bookingDet=''; $rescheduleId=''; $rescheduleparams=''; if(isset($_REQUEST['scheduleby']) && $_REQUEST['scheduleby']!='') { $rescheduleId=$users->encrypt_decrypt('decrypt',$_REQUEST['scheduleby']); $rescheduleparams='&scheduleby='.$_REQUEST['scheduleby']; if($rescheduleId<=0) { echo "<script>alert('Invalid details');window.location='bookAppointment.php?pid=".$_REQUEST['pid']."'</script>"; }else{ $bookingDet=$users->getUserTransactionDet('',$rescheduleId); } } $availableDates=$users->availableDatesTime(date('Y-m-d'), $id); $todayava=$users->todayAvailabilityDates($id,date('Y-m-d')); $getava=$users->getBusiness('id',$id); $getPrice=''; if(count($availableDates)>0) { $getPrice=$users->getBusinessPrice($availableDates['0']['addedby_id']); } $avaDatesPicking=''; foreach($availableDates as $k=>$v) { /*$avaDatesPicking.="{ d: new Date(".date('Y',strtotime($v['slot_dates'])).", ".date('m',strtotime($v['slot_dates']))."+1, ".date('d',strtotime($v['slot_dates']))."), background: '#ea4986' },";*/ $avaDatesPicking.="{ start: new Date(".date('Y',strtotime($v['slot_dates'])).", ".date('m',strtotime($v['slot_dates']))."-1, ".date('d',strtotime($v['slot_dates']))."), text: 'Conference', background: '#f4511e' },"; } //echo $avaDatesPicking; //print_r($getPrice); ?> <!-- <link rel="stylesheet" href="src/mini-event-calendar.min.css"> --> <link href="css/mobiscroll.javascript.min.css" rel="stylesheet" /> <script src="js/mobiscroll.javascript.min.js"></script> <style> .nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link{ background: #b8d2de !important; border-radius:0; padding:5px 15px; border:unset !important; } .nav-tabs .nav-link{ padding:5px 15px; } .nav-link{ color:black; } .event a { background-color: #42B373 !important; background-image :none !important; color: #ffffff !important; } .mbsc-ios .mbsc-cal-cell,.mbsc-ios.mbsc-fr-inline .mbsc-fr-c,.mbsc-ios.mbsc-fr-inline .mbsc-fr-w{ border:unset !important; } .mbsc-col-sm-12 .mbsc-col-md-4{ height: 300px !important; } </style> <section class="mt-5 pt-4 mx-5"> <div class="container-fluid bg-white text-dark pb-4 px-4 mb-4"> <?php $businesspic='img/dummybusinesspic.png'; if($getava['0']['business_pic']!='' && file_exists('uploads/'.$getava['0']['business_pic'])) { $businesspic='uploads/'.$getava['0']['business_pic']; } ?> <form method="post" id="bookappiontmentsubmit" action="confirmAppointment.php?pid=<?php echo $_REQUEST['pid'].$rescheduleparams;?>" class=""> <div class="row" > <div class="col-xl-1 col-sm-6 col-md-4 mbrPadding text-center"> <div> <img width="90px" height="90px" src="<?php echo $businesspic;?>"> </div> </div> <div class="col-xl-11 col-sm-6 col-md-8 videoConf"> <div class="row mt-4 pt-2"> <div class="col-xl-9 col-sm-6 col-md-8 mbrMargin"> <p class="mb-1 text-dark"><?php echo (isset($getava['0']['business_name']) && $getava['0']['business_name']!='')?$getava['0']['business_name']:$getava['0']['profession'];?></p> <p class="mb-1"><img src="img/verified.png"> Verified</p> </div> <div id="printpricedate"> <?php if(isset($getPrice['call_cost']) && $getPrice['call_cost']>0 && is_array($todayava) && count($todayava)>0){ ?> <div class="col-xl-3 col-sm-6 col-md-8 mbrMargin text-right mb-2"> <p class="mb-1 text-dark consultation-rate">Consultation <?php echo $getPrice['call_cost'];?>$/ <?php echo $getPrice['call_to_minutes'];?>Min</p> <button class="btn btn-primary b-appointment" onclick="return bookAppiontment();">Confirm Appointment</button> <input type="hidden" name="callcost" value="<?php echo $getPrice['call_cost'];?>"> </div> <?php } ?> </div> </div> </div> </div> <div class="row border-right border-bottom border-primaryTop mx-0 mb-3"> <div class="col-12 col-sm-4 col-xl-3 col-md-5 px-0 border-left border-right"> <div class="mbsc-col-sm-12 mbsc-col-md-4"> <div class="mbsc-form-group"> <div id="demo-colored"></div> </div> </div> <!-- <div id="calendar2" class="border-right border-left"></div> --> </div> <div class="col-12 col-sm-8 col-xl-9 col-md-7 mt-3" id="replaceWithAjaxRec"> <h3><?php echo date('d M, Y')?></h3> <?php //if($availableDates['0']['available_from']<='12 AM'){ if(is_array($todayava) && count($todayava)) { $date1 = strtotime(date('Y-m-d '.$todayava['available_from'])); $date2 = strtotime(date('Y-m-d '.$todayava['available_to'])); $mins = ($date2 - $date1) / 60; $numofslots=ceil($mins/$getPrice['call_to_minutes']); $availablefrom=strtotime(date('Y-m-d 12:00')); $afternoonfrom=strtotime(date('Y-m-d 12:00')); $afternoonto=strtotime(date('Y-m-d 15:00')); $from_presenttime=$date1; $to_presenttime=$date1; $mycount=0; $afternoonslots=''; $eveningslots=''; ?> <div class="row mx-0"> <p class="fs-14">Morning</p> <div class="table-responsive"> <table class="slot-book" cellspacing="0"> <tbody> <tr> <!--<td><div class="p-1 slotFull text-white text-nowrap fs-14 mr-1">09:00-09:20AM</div></td> <td><div class="p-1 slotFull text-white text-nowrap fs-14 mr-1">09:20-09:40AM</div></td> <td> <div id ="slot-a" class="p-1 slotAvailable text-white text-nowrap fs-14 mr-1"> <label for="check1" class="ava-slot">09:40-10:00AM</label> <input type='checkbox' id="check1" class="hidden" onclick="available()" value =""> </div> </td> <td><div class="p-1 slotNot-available text-white text-nowrap fs-14 mr-1">10:00-10:20AM</div></td> <td><div class="p-1 slotFull text-white text-nowrap fs-14 mr-1">10:20-10:40AM</div></td> <td><div class="p-1 slotFull text-white text-nowrap fs-14 mr-1">10:40-11:00AM</div> </td> <td><div class="p-1 slotAvailable text-white text-nowrap fs-14 mr-1">11:00-11:20AM</div> </td> <td><div class="p-1 slotNot-released text-white text-nowrap fs-14 mr-1">11:20-11:40AM</div></td>--> <?php for($i=1;$i<=$numofslots;$i++) { if($date1<=$availablefrom && $to_presenttime<=$availablefrom) { $to_presenttime=$to_presenttime + ($getPrice['call_to_minutes'] * 60); echo '<td> <div id="slot-a'.$i.'" class="p-1 slotAvailable text-white text-nowrap fs-14 mr-1 ava-slot"> <label for="check'.$i.'">'.date('H:i',$from_presenttime).'-'.date('H:i A',$to_presenttime).'</label> <input type="checkbox" name="slotbooking[]" id="check'.$i.'" class="hidden" onclick="available('.$i.')" value ="'.date('H:i',$from_presenttime).'-'.date('H:i',$to_presenttime).'"> </div> </td>'; $from_presenttime=$from_presenttime + ($getPrice['call_to_minutes'] * 60); }else if($afternoonfrom<=$to_presenttime && $afternoonto>=$to_presenttime){ $to_presenttime=$to_presenttime + ($getPrice['call_to_minutes'] * 60); $afternoonslots.='<td> <div id="slot-a'.$i.'" class="p-1 slotAvailable text-white text-nowrap fs-14 mr-1 ava-slot"> <label for="check'.$i.'">'.date('H:i',$from_presenttime).'-'.date('H:i A',$to_presenttime).'</label> <input type="checkbox" name="slotbooking[]" id="check'.$i.'" class="hidden" onclick="available('.$i.')" value ="'.date('H:i',$from_presenttime).'-'.date('H:i',$to_presenttime).'"> </div> </td>'; $from_presenttime=$from_presenttime + ($getPrice['call_to_minutes'] * 60); } else if($afternoonto<$to_presenttime){ $to_presenttime=$to_presenttime + ($getPrice['call_to_minutes'] * 60); $eveningslots.='<td> <div id="slot-a'.$i.'" class="p-1 slotAvailable text-white text-nowrap fs-14 mr-1 ava-slot"> <label for="check'.$i.'">'.date('H:i',$from_presenttime).'-'.date('H:i A',$to_presenttime).'</label> <input type="checkbox" name="slotbooking[]" id="check'.$i.'" class="hidden" onclick="available('.$i.')" value ="'.date('H:i',$from_presenttime).'-'.date('H:i',$to_presenttime).'"> </div> </td>'; $from_presenttime=$from_presenttime + ($getPrice['call_to_minutes'] * 60); } } ?> </tr> </tbody> </table> </div> </div> <?php //} ?> <div class="row mx-0 mt-4"> <p class="fs-14">Afternoon</p> <div class="table-responsive"> <table class="slot-book" cellspacing="0"> <tbody> <tr> <!--<td><div class="p-1 slotNot-released text-white text-nowrap fs-14 mr-1">12:00-12:20AM</div></td> <td><div class="p-1 slotNot-released text-white text-nowrap fs-14 mr-1">12:20-12:40AM</div> </td> <td><div class="p-1 slotNot-released text-white text-nowrap fs-14 mr-1">12:40-01:00AM</div></td> <td><div class="p-1 slotFull text-white text-nowrap fs-14 mr-1">01:00-01:20AM</div> </td> <td><div class="p-1 slotFull text-white text-nowrap fs-14 mr-1">01:20-01:40AM</div> </td> <td><div class="p-1 slotAvailable text-white text-nowrap fs-14 mr-1">01:40-02:00AM</div> </td> <td><div class="p-1 slotAvailable text-white text-nowrap fs-14 mr-1">02:00-02:20AM</div></td> <td><div class="p-1 slotAvailable text-white text-nowrap fs-14 mr-1"> 2:20-02:40AM</div></td>--> <?php echo $afternoonslots;?> </tr> </tbody> </table> </div> </div> <div class="row mx-0 mt-4"> <p class="fs-14">Evening</p> <div class="table-responsive"> <table class="slot-book" cellspacing="0"> <tbody> <tr> <!--<td><div class="p-1 slotAvailable text-white text-nowrap fs-14 mr-1">03:00-03:20AM</div></td> <td><div class="p-1 slotAvailable text-white text-nowrap fs-14 mr-1">03:20-03:40AM</div> </td> <td><div class="p-1 slotAvailable text-white text-nowrap fs-14 mr-1">03:40-04:00AM</div></td> <td><div class="p-1 slotAvailable text-white text-nowrap fs-14 mr-1">04:00-41:20AM</div> </td> <td><div class="p-1 slotAvailable text-white text-nowrap fs-14 mr-1">04:20-04:40AM</div> </td> <td><div class="p-1 slot-grey text-white text-nowrap fs-14 mr-1">04:40-05:00AM</div> </td> <td><div class="p-1 slot-grey text-white text-nowrap fs-14 mr-1">05:00-05:20AM</div></td> <td><div class="p-1 slot-grey text-white text-nowrap fs-14 mr-1">05:20-05:40AM</div></td>--> <?php echo $eveningslots;?> </tr> </tbody> </table> </div> </div> <div class="row mx-0 mt-4"> <div class="col-12 col-lg-2 col-sm-3 col-md-3 p-0"><span class="s-available"></span ><span class="span-text1">Available</span></div> <div class="col-12 col-lg-2 col-sm-3 col-md-3 p-0"><span class="s-full"></span><span class="span-text2">Slot is full</span></div> <div class="col-12 col-lg-3 col-sm-3 col-md-3 p-0"><span class="s-n-released"></span><span class="span-text3">Slot Not Released</span></div> <div class="col-12 col-lg-4 col-sm-3 col-md-3 p-0"><span class="s-n-available"></span><span class="span-text4">Slot Not Available</span></div> </div> <?php }else{ ?> <h1 style="color:red;text-align:center;">No Slots Available</h1> <?php } ?> <input type="hidden" name="slotbooking_date" value="<?php echo date('Y-m-d');?>"> </div> </div> <input type="hidden" name="businessid" value="<?php echo $id;?>"> <input type="hidden" name="rescheduleId" value="<?php echo $rescheduleId;?>"> <input type="hidden" name="rescheduleSlotscnt" id="rescheduleSlotscnt" value="<?php echo (isset($bookingDet['slot_times']) && $bookingDet['slot_times']!='')?count(explode(',',$bookingDet['slot_times'])):0;?>"> </form> <div class="border mx-0"> <ul class="nav nav-tabs border-0" role="tablist"> <li class="nav-item"> <a class="nav-link active top-tabs" data-toggle="tab" href="#ongoing">Over View</a> </li> <!--<li class="nav-item"> <a class="nav-link top-tabs" data-toggle="tab" href="#upcoming">Q & A</a> </li>--> </ul> <div class="tab-content"> <div id="ongoing" class="container tab-pane active UserFont"><br> <h6>About</h6> <p class="paraColor mb-4">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p> <div class="row"> <div class="col-xl-4 col-sm-6 col-md-4 UserFont"> <p class="paraColor"><img src="img/address.png"> Address</p> <p class="mb-1"><?php echo $getava['0']['location'];?></p> <!--<p class="mb-1">Timmapuram,</p> <p class="mb-1">Kakinada,</p> <p class="mb-1">Andhra Pradesh.</p>--> </div> <!--<div class="col-xl-4 col-sm-6 col-md-4 border-right UserFont"> <p class="paraColor"><img src="img/timings.png"> Timings</p> <p class="mb-1">Mon - Fri : 10.00AM -6.00PM</p> </div> <div class="col-xl-4 col-sm-6 col-md-4 UserFont"> <p class="paraColor"><img src="img/services.png"> Services</p> <p class="mb-1">Logo Designs</p> <p class="mb-1">Graphics</p> <p class="mb-1">Web Services</p> <p class="mb-1">Web Design</p> </div>--> </div> </div> <!--<div id var x = document.getElementsByClassName("");="upcoming" class="container tab-pane UserFont"><br> <div id var x = document.getElementsByClassName("");="accordion" class="accordion"> <di var x = document.getElementsByClassName("");v class="card mb-0"> var x = document.getElementsByClassName(""); <div class="card-header collapsed border pb-0" data-toggle="collapse" href="#collapseOne"> var x = document.getElementsByClassName(""); <a class="card-title">Item 1</a> var x = document.getElementsByClassName(""); </div> <div id="collapseOne" class="card-body collapse" data-parent="#accordion" > <p>Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. </p> </div> <div class="card-header collapsed border pb-0" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo"> <a class="card-title">Item 2</a> </div> <div id="collapseTwo" class="card-body collapse" data-parent="#accordion" > <div class="border mx-0"> </div> </div> </div> </div> </div>--> </div> </div> </section> <?php include('mainFooter.php')?> <script> /*$(document).ready(function(){ $("#calendar2").MEC({ months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], daysMin: ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'], // dayLetter: ['S', 'M', 'T', 'W', 'T', 'F', 'S'] }); //if you don't have events, use // $("#calendar2").MEC(); $('.mbsc-cal-day-date mbsc-cal-cell-txt').on('click', function(){ alert(); }) }) */ $(document).ready(function(){ $('.mbsc-cal-day-date mbsc-cal-cell-txt').click(function () { alert("okdv"); }); }); function available(id) { var checkBox = document.getElementById("check"+id); var text = document.getElementById("slot-a"+id); if (checkBox.checked == true){ text.style.background = "black"; } else { text.style.background = "green"; } } </script> <script> mobiscroll.form('#md-form'); mobiscroll.form({ minDate: new Date()}); mobiscroll.settings = { lang: 'en', // Specify language like: lang: 'pl' or omit setting to use default theme: 'ios' // Specify theme like: theme: 'ios' or omit setting to use default }; var now = new Date(); min = new Date(now.getFullYear(), now.getMonth(), now.getDate()); mobiscroll.date('#md-form', { onInit: function (event, inst) { alert("okdfglvgkf"); } }); mobiscroll.form('#md-form'); mobiscroll.calendar('#demo-colored', { display: 'inline', // Specify display mode like: display: 'bottom' or omit setting to use default min: min, colors: [ // More info about colors: https://docs.mobiscroll.com/4-8-1/javascript/calendar#opt-colors // { d: '12/8', background: '#9ccc65' }, // { d: '5/1', background: 'red' }, // { d: '12/24', background: "#fff568" }, // { d: '12/25', background: "#e88080" }, // { d: new Date(now.getFullYear(), now.getMonth() + 1, 4), background: '#cfd8dc' }, // { d: new Date(now.getFullYear(), now.getMonth() + 2, 24), background: '#9575cd' }, // { d: new Date(now.getFullYear(), now.getMonth() - 2, 13), background: '#d4e157' }, // { d: new Date(now.getFullYear(), now.getMonth() - 1, 6), background: "#f4511e" }, // { d: new Date(now.getFullYear(), now.getMonth() + 1, 6), background: '#46c4f3' }, // { d: new Date(now.getFullYear(), now.getMonth() + 1, 22), background: '#7e56bd' }, // { d: new Date(now.getFullYear(), now.getMonth() - 1, 11), background: '#46c4f3' }, // { d: new Date(now.getFullYear(), now.getMonth() - 1, 29), background: '#7e56bd' }, // { d: new Date(now.getFullYear(), now.getMonth(), 2), background: '#46c4f3' }, // { d: new Date(now.getFullYear(), now.getMonth(), 3), background: '#7e56bd' }, // { d: new Date(now.getFullYear(), now.getMonth(), 11), background: '#f13f77' }, // { d: new Date(now.getFullYear(), now.getMonth(), 19), background: '#8dec7d' }, /*{ d: new Date(now.getFullYear(), now.getMonth(), 28), background: '#ea4986' }, { d: new Date(now.getFullYear(), now.getMonth(), 27), background: '#ea4986' }, { d: new Date(now.getFullYear(), now.getMonth(), 26), background: '#ea4986' },*/ <?php echo $avaDatesPicking;?> /*{ start: new Date(now.getFullYear(), now.getMonth() + 1, 15), end: new Date(now.getFullYear(), now.getMonth() + 1, 18), text: 'Conference', background: '#f4511e' }*/ ] }); document .getElementById('demo-colored') .addEventListener('click', function (e) { var selectedVal = e.target $('.mbsc-selected').each(function(){ if($(this).attr('data-full')!=undefined) { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var data=this.responseText; var mydata=data.split('###########'); document.getElementById("printpricedate").innerHTML=mydata['0']; document.getElementById("replaceWithAjaxRec").innerHTML =mydata['1']; } }; xhttp.open("GET", "ajax.php?action=getusertimedet&seldate="+$(this).attr('data-full')+"&pid=<?php echo $_REQUEST['pid'];?>", true); xhttp.send(); } }) }, false); function bookAppiontment() { var i=0; var chkblkentry='No'; var slots=[]; $.each($("input[name='slotbooking[]']:checked"), function(){ i++; chkblkentry=='Yes'; slots.push($(this).val()); }); if($('#rescheduleSlotscnt').val()>1) { if(slots.length>$('#rescheduleSlotscnt').val()) { alert("Please select "+$('#rescheduleSlotscnt').val()+" slots only");return false; } } if(chkblkentry=='Yes' && i!=0){ /*if($('#rescheduleSlotscnt').val()>0) { if(confirm("You are eligible to select "+$('#rescheduleSlotscnt').val()+" slots.Are you sure wants to submit")) }*/ document.getElementById('bookappiontmentsubmit').submit(); }else if(chkblkentry=='No' && i==0){ alert("Please select atleast one time slot to Appointment");return false; } } </script>