Jump to content

Fratozzi

New Members
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Fratozzi

  • Rank
    Newbie
  1. hello everyone, I have a php form, everything works, I do not carry any header() at the end of the form because I have to stay on the same page and because I feel it wipes out the message you sent the form successfully, but for this though if reloading the page shows me the popup asking me to resend the form. how can i solve? I found a function in js with replacestate but I saw that it doesn't work with mobile Safari. if ( window.history.replaceState ) { window.history.replaceState( null, null, window.location.href ); }
  2. @maxxd This function blocks the pop-up that requires the module to be sent back to the update after sending the form. Works on all devices and browsers less than for Safari. I was wondering if there is an alternative
  3. @mac_gyver I tried and it works! thank you very much. But I noticed that if in the array the start date is like 10:15 and the end like 10:47, it doesn't enter me 10:00 and 10:30 as busy times
  4. I have a file in js structured like this: if ( window.history.replaceState ) { window.history.replaceState( null, null, window.location.href ); } the function blocks the submit request if it has already been executed if you want to reload the page. on desktop devices it works while from my smartphone no. have any idea why? Thanks
  5. thank you so much for answering me, I will definitely try this solution and I'll let you know! Thanks again
  6. I'm going crazy. I have two arrays. The first has working hours and the array is like this: ```array(7) { [0]=> array(4) { ["morning_from"]=> string(6) "closed" ["morning_to"]=> string(6) "closed" ["afternoon_from"]=> string(5) "13:00" ["afternoon_to"]=> string(5) "19:00" }``` The second one is the busy times, the array is like this: ```array(2) { [0]=> { ["title"]=> string(13) "Test" ["start_date"]=> string(19) "2019-11-25 13:00:00" ["end_date"]=> string(19) "2019-11-25 14:00:00" } }``` Now I do a cycle of 15 times because I need to make the list for the next 15 days from today. Then I compare the working hours in the morning with the appointments, if the time is occupied by an appointment I add a class to the div. The HTML that comes out should look like this: ``` <ul> <li> <div> <p>Sun</p><p>24 Nov</p> </div> <div class="uk-book-a-visit-closed">Closed</div> </li> <li> <div> <p>Mon</p> <p>25 Nov</p> </div> <div> <a class="uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy" id="a-book-a-visit" data-book-day="2019-11-25" data-book-hour="13:00">13:00</a> <a class="uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy" id="a-book-a-visit" data-book-day="2019-11-25" data-book-hour="13:30">13:30</a> <a class="uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy" id="a-book-a-visit" data-book-day="2019-11-25" data-book-hour="14:00">14:00</a> <a class="uk-button-book-a-visit-hour" id="a-book-a-visit" data-book-day="2019-11-25" data-book-hour="14:30">14:30</a> <a class="uk-button-book-a-visit-hour" id="a-book-a-visit" data-book-day="2019-11-25" data-book-hour="15:00">15:00</a> </div> </li> </ul> ``` Unfortunately it does not work as I would like, it does not mark correctly if the date is occupied. I'll post a piece of code: ```for ($book_i=0; $book_i <= 15; $book_i++) { if($book_i == 0){ $book_today_day = date('Y-m-d', strtotime($book_today)); }else{ $book_today_day = date('Y-m-d', strtotime($book_today . ' +'.$book_i.' day')); } $book_day = ucwords(strftime('%d %h', strtotime($book_today_day))); $book_name_day = ucwords(strftime('%a', strtotime($book_today_day))); if(count($getListCalendarStartToday) > $count_list_calendar_p){ $day_appointment_p_start = date('Y-m-d', strtotime($getListCalendarStartToday[$count_list_calendar_p]["start_date"])); $day_appointment_p_end = date('Y-m-d', strtotime($getListCalendarStartToday[$count_list_calendar_p]["end_date"])); }else{ $day_appointment_p_start = "N.D."; $day_appointment_p_end = "N.D."; } if($day_appointment_p_start == $book_today_day){ $count_more_appointment_on_some_days_morning = 0; $count_more_appointment_on_some_days_afternoon = 0; foreach ($getListCalendarStartToday as $key => $value) { $day = date('Y-m-d', strtotime($value["start_date"])); if($day == $book_today_day){ $count_more_appointment_on_some_days_morning += 1; $count_more_appointment_on_some_days_afternoon += 1; } } $book_output .= "<li>"; if(isset($user["working_time"]) && $user["working_time"]){ $book_output .= "<div><p>".$book_name_day."</p><p>".$book_day."</p></div>"; if($book_name_day == $lang["days-mon"]){ $book_day_int = 0; }else if($book_name_day == $lang["days-tue"]){ $book_day_int = 1; }else if($book_name_day == $lang["days-wed"]){ $book_day_int = 2; }else if($book_name_day == $lang["days-thu"]){ $book_day_int = 3; }else if($book_name_day == $lang["days-fri"]){ $book_day_int = 4; }else if($book_name_day == $lang["days-sat"]){ $book_day_int = 5; }else if($book_name_day == $lang["days-sun"]){ $book_day_int = 6; } $book_morning_from = $book_array_working_time[$book_day_int]["morning_from"]; $book_morning_to = $book_array_working_time[$book_day_int]["morning_to"]; $book_afternoon_from = $book_array_working_time[$book_day_int]["afternoon_from"]; $book_afternoon_to = $book_array_working_time[$book_day_int]["afternoon_to"]; $book_morning_from_hour = (int)substr($book_morning_from, 0, 2); $book_morning_to_hour = (int)substr($book_morning_to, 0, 2); $book_morning_from_min = (int)substr($book_morning_from, 3, 5); $book_morning_to_min = (int)substr($book_morning_to, 3, 5); $book_afternoon_from_hour = (int)substr($book_afternoon_from, 0, 2); $book_afternoon_to_hour = (int)substr($book_afternoon_to, 0, 2); $book_afternoon_from_min = (int)substr($book_afternoon_from, 3, 5); $book_afternoon_to_min = (int)substr($book_afternoon_to, 3, 5); $book_morning_from_hour_duplicated = $book_morning_from_hour; $book_morning_to_hour_duplicated = $book_morning_to_hour; $book_afternoon_from_hour_duplicated = $book_afternoon_from_hour; $book_afternoon_to_hour_duplicated = $book_afternoon_to_hour; $book_check_closed = 0; $check_day_morning = 0; if($book_afternoon_from_hour == 0 && $book_afternoon_to_hour == 0){ if($book_afternoon_from_hour == 0 && $book_afternoon_to_hour == 0 && $book_check_closed == 0){ $book_output .= "<div class='uk-book-a-visit-closed'>".$lang["system-appointment-book-a-visit-closed"]."</div>"; $book_check_closed = 1; } }else{ $book_output .= "<div>"; for ($n=0; $n < $count_more_appointment_on_some_days_afternoon; $n++) { if($count_list_calendar_p === $count_more_appointment_on_some_days_afternoon && $count_more_appointment_on_some_days_afternoon > 1){ $count_list_calendar_p -= 1; } $day_appointment_p_start_hour = date('H', strtotime($getListCalendarStartToday[$count_list_calendar_p]["start_date"])); $day_appointment_p_end_hour = date('H', strtotime($getListCalendarStartToday[$count_list_calendar_p]["end_date"])); $day_appointment_p_start_min = date('i', strtotime($getListCalendarStartToday[$count_list_calendar_p]["start_date"])); $day_appointment_p_end_min = date('i', strtotime($getListCalendarStartToday[$count_list_calendar_p]["end_date"])); for($book_afternoon_from_hour; $book_afternoon_from_hour <= $book_afternoon_to_hour; $book_afternoon_from_hour++){ if($book_afternoon_from_hour_duplicated != $book_afternoon_from_hour){ continue; } if($book_afternoon_from_hour != $book_afternoon_to_hour){ if($day_appointment_p_start_hour == number_add_leading_0($book_afternoon_from_hour)){ $book_afternoon_from_hour_duplicated += 1; $count_list_calendar_p += 1; if($book_afternoon_from_min == 0){ if($day_appointment_p_start_hour == $day_appointment_p_end_hour){ if($day_appointment_p_start_min >= 0 && $day_appointment_p_start_min <= 30){ $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":00'>".number_add_leading_0($day_appointment_p_start_hour).":00</a>"; $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":30'>".number_add_leading_0($day_appointment_p_start_hour).":30</a>"; }else{ $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":00'>".number_add_leading_0($day_appointment_p_start_hour).":00</a>"; $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":30'>".number_add_leading_0($day_appointment_p_start_hour).":30</a>"; } }else{ $count_hour_appointment = 0; for($day_appointment_p_start_hour; $day_appointment_p_start_hour <= $day_appointment_p_end_hour; $day_appointment_p_start_hour++) { if($day_appointment_p_start_hour == $day_appointment_p_end_hour){ if($day_appointment_p_end_min >= 0 && $day_appointment_p_end_min <= 30){ $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":00'>".number_add_leading_0($day_appointment_p_start_hour).":00</a>"; $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":30'>".number_add_leading_0($day_appointment_p_start_hour).":30</a>"; }else{ $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":00'>".number_add_leading_0($day_appointment_p_start_hour).":00</a>"; $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":30'>".number_add_leading_0($day_appointment_p_start_hour).":30</a>"; } }else{ if($day_appointment_p_start_min >= 0){ $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":00'>".number_add_leading_0($day_appointment_p_start_hour).":00</a>"; $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":30'>".number_add_leading_0($day_appointment_p_start_hour).":30</a>"; }else{ $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":30'>".number_add_leading_0($day_appointment_p_start_hour).":30</a>"; } $count_hour_appointment += 1; } } $book_afternoon_from_hour_duplicated += $count_hour_appointment; $count_list_calendar_p += 1; } break; }else{ if($book_i == 0){ if($day_appointment_p_start_min >= $book_afternoon_from_min && $day_appointment_p_start_min <= 30){ $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":".number_add_leading_0($book_afternoon_from_min)."'>".number_add_leading_0($day_appointment_p_start_hour).":".number_add_leading_0($book_afternoon_from_min)."</a>"; }else{ $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($book_afternoon_from_hour).":".number_add_leading_0($book_afternoon_from_min)."'>".number_add_leading_0($book_afternoon_from_hour).":".number_add_leading_0($book_afternoon_from_min)."</a>"; $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":30'>".number_add_leading_0($day_appointment_p_start_hour).":30</a>"; } }else{ if($day_appointment_p_start_min >= $book_afternoon_from_min && $day_appointment_p_start_min >= 30){ $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":30'>".number_add_leading_0($day_appointment_p_start_hour).":30</a>"; }else{ $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-busy' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($book_afternoon_from_hour).":00'>".number_add_leading_0($book_afternoon_from_hour).":00</a>"; $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($day_appointment_p_start_hour).":30'>".number_add_leading_0($day_appointment_p_start_hour).":30</a>"; } } $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($book_afternoon_from_hour).":00'>".number_add_leading_0($book_afternoon_from_hour).":00</a>"; } }else{ $book_afternoon_from_hour_duplicated += 1; $count_list_calendar_p += 1; if($book_afternoon_from_min == 0){ $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($book_afternoon_from_hour).":00'>".number_add_leading_0($book_afternoon_from_hour).":00</a>"; $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($book_afternoon_from_hour).":30'>".number_add_leading_0($book_afternoon_from_hour).":30</a>"; }else{ if($book_i == 0){ $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($book_afternoon_from_hour).":".number_add_leading_0($book_afternoon_from_min)."'>".number_add_leading_0($book_afternoon_from_hour).":".number_add_leading_0($book_afternoon_from_min)."</a>"; }else{ $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($book_afternoon_from_hour).":30'>".number_add_leading_0($book_afternoon_from_hour).":30</a>"; } $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($book_afternoon_from_hour).":00'>".number_add_leading_0($book_afternoon_from_hour).":00</a>"; } } }else{ if($book_afternoon_from_min == $book_afternoon_to_min){ $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-closed' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($book_afternoon_from_hour).":00'>".number_add_leading_0($book_afternoon_from_hour).":".number_add_leading_0($book_afternoon_from_min)."</a>"; }else{ if($book_afternoon_from_min == 0){ $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($book_afternoon_from_hour).":00'>".number_add_leading_0($book_afternoon_from_hour).":00</a>"; $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-closed' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($book_afternoon_from_hour).":".number_add_leading_0($book_afternoon_from_min)."'>".number_add_leading_0($book_afternoon_from_hour).":".number_add_leading_0($book_afternoon_from_min)."</a>"; }else{ $book_output .= "<a class='uk-button-book-a-visit-hour' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($book_afternoon_from_hour).":".number_add_leading_0($book_afternoon_from_min)."'>".number_add_leading_0($book_afternoon_from_hour).":".number_add_leading_0($book_afternoon_from_min)."</a>"; $book_output .= "<a class='uk-button-book-a-visit-hour uk-button-book-a-visit-hour-closed' id='a-book-a-visit' data-book-day='".$book_today_day."' data-book-hour='".number_add_leading_0($book_afternoon_from_hour).":30'>".number_add_leading_0($book_afternoon_from_hour).":30</a>"; } } } } } $book_output .= "</div>"; } $book_output .= "</li>"; ```
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.