
<center><h2><strong>Ubuntu</strong></h2>
­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php
    session_start();
    $ClassLpf = new ClassLpf();
    $Etape    = $_SESSION['LPF']['Etape'] ;


?>
<style>
    body {
        color:#e5692c;
    }


     .MySelect {
        border:1px solid #fff ;
        background-color: #e5692c;
         color: #fff;
     }

     .US {
         border:1px solid #000;
         height:100px;
     }


</style>
<?php

if ($Etape=="2") { $css_etape_2 =""; }
else             { $css_etape_2 ="margin100;"; }


//echo "<pre>"; print_r($_SESSION['LPF']['Commande']); echo "</pre>";
if( $Etape<5) {?>
    <div class="row justify-content-center h-100">

        <div class="col-12 <?=$css_etape_2?> zoneselection" style="">


            <?php  // NOTE : ETAPE 1 la date
            if ($Etape=="1") {?>
                <div class="Text2 animated fadeIn" style="margin-bottom:5px; ">
                    <?php $Msg = $ClassLpf->Accueil_Msg(); echo $Msg[1];?>
                </div>
                <div class="Text2 animated fadeIn" >Quand souhaitez-vous venir retirer votre repas ?</div>

                <br>
                <input type="hidden" name="etape" value="2">
                <?=$ClassLpf->ChoixRetrait();?>
                <br>

                <button type="submit"   class="animated slideInUp btn btn-continuer"  name="A">Continuer</button>
            <?php } ?>

            <?php  // NOTE : ETAPE 2 la Carte
                if ($Etape=="2") { ?>

                <script>
                // Selection Plat
                    function MySelect (id, type ) {
                        console.log(id +" "+type);
                        var rad = "RAD_"+type;
                        $("input:radio[class='"+rad+"']").each(function(){
                            N = $(this).attr('id');
                            var result = N.split('_');
                            $('#DIV_'+result[1]).removeClass("MySelect");

                        })

                    // Coche un plat
                        if($('#CHK_'+id).is(':checked')==false) {
                            console.log("Check");
                            $('#DIV_'+id).addClass("MySelect");
                            $("#CHK_"+id).attr('checked', true);
                            $("#CHK_"+id).prop('checked', true);

                            if(id=="45") {

                                //$("#TITRE_sauce_v2").css("display","block");
                                //$("#SECTION_sauce_v2").css("display","block");
                            }

                            // Force la base legumes si Plat
                            if(type=="plat_v2") {

                                $("#CHK_45").prop('checked', true);
                                $('#DIV_45').addClass("MySelect");
                            }

                        }

                    // Decoche un plat
                        else {
                            $('#DIV_'+id).removeClass("MySelect");
                            $("#CHK_"+id).attr('checked', false);
                            $("#CHK_"+id).prop('checked', false);

                            if(id=="45") {
                                //$("#TITRE_sauce_v2").css("display","none");
                                //$("#SECTION_sauce_v2").css("display","none");
                            }
                        // Plus de plat decoche les legumes
                            if(type=="plat_v2") {
                                //$("#CHK_45").prop('checked', false);
                               // $('#DIV_45').removeClass("MySelect");
                                $("input:radio[class='RAD_sauce_v2']").each(function(){
                                    //$(this).attr('checked', false);

                                    //OU $(this).attr('checked', true);
                                    N = $(this).attr('id');

                                    var result = N.split('_');

                                    $('#DIV_'+result[1]).removeClass("MySelect");
                                    $("#CHK_"+result[1]).prop('checked', false);
                                    //console.log( "->"+N ) ;

                                })

                            }
                        }





                        //$('#question_txt').removeClass("animated fadeInDown");
                        /*
                        if ($('#DIV_'+id).is(':checked')) {
                            //$("#tabD").find(':checkbox').attr("checked", true);
                            alert ($('#DIV_'+id).prop("checked"));
                        }*/
                        //$('#DIV_'+id).className("style","border:2px solid #00ff00");


                    }

                    function UnCheck(id) {
                        $("input[class='RAD']:checked").each(function(){
                            $(this).attr('checked', false);
                            console.log(this);
                            //OU $(this).attr('checked', true);
                        })
                        //$('#DIV_'+id).removeClass("MySelect");
                        //$("#CHK_"+id).attr('checked', false);
                    }

                </script>
                <div class="Text1 animated fadeIn" style="margin-bottom:5px; ">RESTONS ENSEMBLE</div>
                <div class="Text2 animated fadeIn" >
                    Les P'tits Fayots vous propose d'emporter et de déguster chez vous les plats suivant.
                </div>

            <br>
                <?php
                //  $Menus = $ClassLpf->AfficheChoix('menus');
                    $Menus = $ClassLpf->ChoixCarte();
                ?>

            <br>
                <input type="hidden" name="etape" value="3">

                <br>
                <button type="button"   class="animated slideInUp btn btn-continuer"  name="A" onclick="location=('?etape=<?=($Etape-1)?>')">Retour</button>
                <button type="submit"   class="animated slideInUp btn btn-continuer"  style="animation-delay: 0.2s; " name="A">Continuer</button>

            <?php } ?>


            <?php  // NOTE : ETAPE 3 la date
            if ($Etape=="3") {?>

                <input type="hidden" name="etape" value="<?=($Etape+1)?>">
                <?php
                $ClassLpf->SelectionTitre();
                $ClassLpf->AfficheChoix("vin");
                ?>
                <br>
                <button type="submit"   class="animated slideInUp btn btn-continuer"  name="retour" value="<?=($Etape-1)?>">Retour</button>
                <button type="submit"   class="animated slideInUp btn btn-continuer"  name="A">Continuer</button>
            <?php } ?>




            <?php  // NOTE : ETAPE 2 le menu
            if ($Etape=="2_v1") { ?>
                <div class="Text1 animated fadeIn" style="margin-bottom:5px; ">RESTONS ENSEMBLE</div>
                <div class="Text2 animated fadeIn" >
                    <?php if ($_SESSION['LPF']['Commande']['TYPE']=="fete") { ?>
                    Les P'tits Fayots vous propose d'emporter et de déguster chez vous le menu suivant.</div>
                    <?php } else { ?>
                    Les P'tits Fayots vous propose d'emporter et de déguster chez vous les menus suivants.</div>
                    <?php } ?>
                <br>
                <?php $Menus = $ClassLpf->AfficheChoix('menus');   ?>

                <br>
                <input type="hidden" name="etape" value="3">
                <button type="button"   class="animated slideInUp btn btn-continuer"  name="A" onclick="location=('?etape=<?=($Etape-1)?>')">Retour</button>
                <!--<button type="submit"   class="animated slideInUp btn btn-orange"  style="animation-delay: 0.2s; " name="A">Continuer</button>-->
            <?php } ?>

            <?php  // NOTE : ETAPE 3 QTE e nombre de menu
            if ($Etape=="3_v1") {

                list($Nom,$Prix) = explode ('-', $_SESSION['LPF']['Commande']['MENU']); ?>
                <script>
                    function Qte( ope ) {
                        if (ope == "m") {
                            if($('#qte').val() == "1") return false;
                            $('#qte').val(parseInt($('#qte').val()) -1);
                        }
                        if (ope == "p") $('#qte').val(parseInt($('#qte').val()) + 1);
                    }
                </script>
                <div class="Text1 animated fadeIn" >Combien de menus <?=$Nom?> désirez-vous ?</div>
                <div class="Text2 animated fadeIn" >
                    <?php
                    if ($_SESSION['LPF']['Commande']['TYPE']=="carte") {
                        $Phrase=" Découvrez le menu du chef concocté spécialement pour vous.";
                    }
                    else  if ($_SESSION['LPF']['Commande']['TYPE']=="fete") {
                       echo "<br>".$ClassLpf->DescriptionFete();
                    }
                    else {
                        $Phrase="Découvrez le menu du moment élaboré avec des produits frais de saison.";
                    }
                    echo $Phrase;
                    ?>
                </div>
                <br>
            <div class="" style="text-align:center">
                <div class="row">
                    <div class="col-4" ><button type="button"   class="btn btn-qte" style='width:50%' onclick="javascript:Qte('m')"><i class="fas fa-minus fa-2x"></i></button></div>
                    <div class="col-4" ><input name="qte" id="qte" type="text" class="form-control" style=" width:100%" value="1" ></div>
                    <div class="col-4" ><button type="button"   class="btn btn-qte" style='width:50%' onclick="javascript:Qte('p')"><i class="fas fa-plus fa-2x"></i></button></div>
                </div>
            </div>
                <br>
                <input type="hidden" name="etape" value="4">
                <button type="button"   class="animated slideInUp btn btn-continuer"  name="A" onclick="location=('?etape=<?=($Etape-1)?>')">Retour</button>
                <button type="submit"   class="animated slideInUp btn btn-continuer"  style="animation-delay: 0.2s; " name="A">Continuer</button>
            <?php } ?>




        <?php  // NOTE VERSION 2 : ETAPE 3
            if ($Etape=="4") { ?>
                <div class="Text1 animated fadeIn" >Avez-vous certaines allergies à déclarer ?</div>
                <div class="row">
                    <div class="col-4" ></div>
                    <div class="col-4" >
                        <div class="btn-group btn-group-toggle" data-toggle="buttons">
                            <label class="btn btn-selection btn-lg active" >
                                <input type="radio" name="allergies" id="option1" value="non" checked><?="&nbsp;"?>NON<?="&nbsp;"?></label>
                            <label class="btn btn-selection btn-lg" >
                                <input type="radio" name="allergies" id="option3" value="oui"><?="&nbsp;"?>OUI<?="&nbsp;"?></label>
                        </div>
                    </div>
                    <div class="col-4" ></div>

                </div><br>
                <textarea name="allergie_comm" class="form-control" style="width:90%; height:100px; " placeholder="Précisez ici vos allergies pour que nous en prenions compte..."></textarea>
                <br>

                <div class="Text1 animated fadeIn" >Précision, commentaire ou une question ?</div>
                <textarea name="texte_libre_comm" class="form-control" style="width:90%; height:100px; " placeholder="Précisez ici votre message"></textarea>
                <input type="hidden" name="etape" value="<?=($Etape+1)?>">
                <br>
                <button type="submit"   class="animated slideInUp btn btn-continuer"  name="retour" value="<?=($Etape-1)?>">Retour</button>
                <button type="submit"   class="animated slideInUp btn btn-continuer"  style="animation-delay: 0.2s; " name="A">Continuer</button>

            <?php } ?>


        <?php  // NOTE VERSION 2 : ETAPE 4 Selection
            if ($Etape>="5") { ?>
                <div class="row justify-content-center h-100">
                    <div class="col-12 margin100" style="padding:50px;">
                        <div class="Text1 animated fadeIn" >C'est noté !</div>
                        <input type="hidden" name="etape" value="<?=($Etape+1)?>">
                        <?php

                        $ClassLpf->Recapitulatif();

                        ?>
                        <button type="button"   class="animated slideInUp btn btn-continuer"  name="A" onclick="location=('?etape=<?=($Etape-1)?>')">Retour</button>
                        <button type="submit"   class="animated slideInUp btn btn-continuer"  style="animation-delay: 0.2s; " name="PAIEMENT" value="OK">Continuer</button>
                    </div>
                </div>
            <?php } ?>


        <?php  // NOTE : ETAPE 4 Selection
            if ($Etape>="4_v1") {

            // MENU CLASSIQUE
                if ( $_SESSION['LPF']['Commande']['TYPE']=="choix") {
                    $btn_continer = false;
                    $ClassLpf->SelectionTitre();
                    $ClassLpf->SelectionMenu();

                }

            // MENU CARTE BLANCHE
                if ( $_SESSION['LPF']['Commande']['TYPE']=="carte" || $_SESSION['LPF']['Commande']['TYPE']=="fete" ) {
                    $btn_continer = true;
                    if( $_SESSION['LPF']['Commande']['mnu_suite'][$Etape+1]<>'vin' ) {
                    ?>
                    <div class="Text1 animated fadeIn" >Avez-vous certaines allergies à déclarer ?</div>
                    <div class="row">
                        <div class="col-4" ></div>
                        <div class="col-4" >
                            <div class="btn-group btn-group-toggle" data-toggle="buttons">
                                <label class="btn btn-selection btn-lg active" >
                                    <input type="radio" name="allergies" id="option1" value="non" checked><?="&nbsp;"?>NON<?="&nbsp;"?></label>
                                <label class="btn btn-selection btn-lg" >
                                    <input type="radio" name="allergies" id="option3" value="oui"><?="&nbsp;"?>OUI<?="&nbsp;"?></label>
                            </div>
                        </div>
                        <div class="col-4" ></div>

                    </div><br>
                    <textarea name="allergie_comm" class="form-control" style="width:90%; height:100px; " placeholder="Précisez ici vos allergies pour que nous en prenions compte..."></textarea>
                    <?php } else {
                        $btn_continer = false;
                        $ClassLpf->SelectionTitre();
                        $ClassLpf->AfficheChoix("vin");}?>
                <?php }
            ?>

                <br>
                <div class="" style="text-align:center">

                </div>
                <br>
                <input type="hidden" name="etape" value="<?=($Etape+1)?>">
                <button type="submit"   class="animated slideInUp btn btn-continuer"  name="retour" value="<?=($Etape-1)?>">Retour</button>
                <?php if ( $btn_continer==true  ) { ?>
                    <button type="submit"   class="animated slideInUp btn btn-continuer"  style="animation-delay: 0.2s; " name="A">Continuer</button>
                <?php } ?>
            <?php } ?>

        </div>
    </div>
<?php } else {?>
<div class="row justify-content-center h-100">
    <div class="col-12 margin100" style="padding:50px;">
        <div class="Text1 animated fadeIn" >C'est noté !</div>
        <input type="hidden" name="etape" value="<?=($Etape+1)?>">
    <?php

    $ClassLpf->Recapitulatif();

    ?>
    <button type="button"   class="animated slideInUp btn btn-continuer"  name="A" onclick="location=('?etape=<?=($Etape-1)?>')">Retour</button>
    <button type="submit"   class="animated slideInUp btn btn-continuer"  style="animation-delay: 0.2s; " name="PAIEMENT" value="OK">Continuer</button>
    </div>
</div>
<?php } ?>
