<!DOCTYPE html>
<html>
<?php
    $OffresMobile = $MyCde->OffresMobile();
    $Ss_Etape      = $_SESSION['airmob']['etape']['courante'];
    $Ss_Cde        = $_SESSION['airmob']['macommande']['panier'];

//  Offre Mobile SMART
    foreach($OffresMobile as $Key=>$OffreMobile) {
    //  Si aucune selection (Default)
        if (!$Ss_Cde[$Ss_Etape]['mobile']['offre']) $Ss_Cde[$Ss_Etape]['mobile']['offre']="S10";
    //  Si selection
        ( $Ss_Cde[$Ss_Etape]['mobile']['offre']==$OffreMobile['ref']) ? $S1 = "checked" : $S1="";
        

    ?>
    <div class="Smartswitch" >
        <input id="Offre_<?=$Key?>" type="radio" name="form_offre_mobile" class="Smartswitch-checkbox"  value="<?=$OffreMobile['ref']?>" <?=$S1?> >
        <label id="aaaa" class="Smartswitch-label" for="Offre_<?=$Key?>">
            <h4 ><b><?=$OffreMobile['nom']?></b></h4>
            <h6 ><b><?=number_format($OffreMobile['rec'], 0, ',','')?> €/mois</b></h6>
            <div class="SepLeftMini" style="height:5px; width:20px;"></div>
            <p class="card-text" style="font-size:0.8em"><?=utf8_encode($OffreMobile['resume'])?></p>
        </label>
    </div>
<?php
    }
?>
<div style="clear:both;"></div>
<div class="row">
    <div class="col-md-6">
        <div class="form-group">

            <label><img src="images/p_man.svg" >&nbsp;Nom prénom</label>

            <?php
                if($Ss_Cde[$Ss_Etape]['mobile']['nomprenom']) $NomSaisie = $Ss_Cde[$Ss_Etape]['mobile']['nomprenom']; else $NomSaisie=$_SESSION['airmob']['macommande']['nomprenom'];

            ?>
            <input id="form_nomprenom_mobile" type="texte" class="form-control" name="form_nomprenom_mobile" placeholder="Dupont Jean" value="<?=$NomSaisie?>" >
        </div>

    </div>
    <div class="col-md-6">
        <div class="form-group">
            <label><img src="images/p_mobile.svg" >&nbsp;Choix du réseau</label>
            <?php
            // Reseau
            echo "<select id=\"form_reseau_mobile\" name=\"form_reseau_mobile\" class=\"form-control\" required>";
            echo "<option value=''>Réseau mobile</option>";
            foreach($OpeMobiles as $Code=>$Nom) {
                ($Ss_Cde[$Ss_Etape]['mobile']['reseau']==$Code) ? $S3 = "selected" : $S3="";
                echo "<option  value=\"".$Code."\" $S3>".$Nom."<br>";
            }
            echo "</select>";
            ?>
        </div>
    </div>
</div>


<div class="row">
    <div class="col-md-6">
        <div class="form-group">

            <div class="row">
                <div class="col-lg-2">
                    <?php
                    // Case PORTA
                    echo "<input type=\"hidden\" name=\"form_porta_mobile\" value=\"\">";
                    ($Ss_Cde[$Ss_Etape]['mobile']['porta']=="oui") ? $S2 = "checked" : $S2="";
                    ?>
                    <div class="onoffswitch" >
                        <input type="checkbox" name="form_porta_mobile" class="form_porta_mobile-checkbox" id="form_porta_mobile" value="oui" <?=$S2?> >
                        <label id="xxx" class="form_porta_mobile-label" for="form_porta_mobile"></label>
                    </div>
                </div>
                <div class="col-lg-10">
                    <label>Garder le même numéro</label>
                </div>
            </div>

        </div>
    </div>
    <div class="col-md-6">

    </div>
</div>


<?php
//  Si Porta affiche la zone
($Ss_Cde[$Ss_Etape]['mobile']['porta']) ? $Css="display:block" : $Css="display:none";?>
<div id="GardeNumero"  style="<?=$Css?>">

    <div  class="row">
        <div class="col-md-6">
            <div class="form-group">
                <label><img src="images/p_phone.svg" >&nbsp;Votre numéro *</label>
                <input id="form_numero_mobile"   type="texte" class="form-control" name="form_numero_mobile"  placeholder="0000000000" attern="[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}-[0-9]{2}"  value="<?=$Ss_Cde[$Ss_Etape]['mobile']['numero']?>" >
            </div>
        </div>
        <div class="col-md-6">
            <div class="form-group" style="color:#245ba5; font-size:0.9em; font-weight: bold;">
                <label>Code RIO *</label><br>

                <input id="form_rio_mobile"  type="texte" class="form-control" name="form_rio_mobile"   placeholder="CODERIO"     value="<?=$Ss_Cde[$Ss_Etape]['mobile']['rio']?>" >
                <div style="background:#f7fbff; padding:10px; margin:5px;">
                RIO : <br>Composez le 3179 depuis la ou les lignes mobiles concernées.
                    Recevez votre code RIO par SMS et saisissez-le.</div>
            </div>
        </div>


    </div>
</div>
<script>
var ChoixSmart;

   function Selectionne( id ) {

       console.debug(ChoixSmart);
       $('#Offre_'+ChoixSmart).removeClass('cardsBorder');
       $('#Offre_'+id).addClass('cardsBorder');

       ChoixSmart = id;
       console.debug(ChoixSmart);


   }


</script>
