<!DOCTYPE html>
<html>
<?php
    $ClassLpf   = new ClassLpf();

// Enregsitre la configuration Menu
    if( isset($_REQUEST['btn_modif']) || $_REQUEST['btn_ajout'] || $_REQUEST['btn_suppr']) {
        $Message = $ClassLpf->EnregType();
    }

$Type = $ClassLpf->Composition($no);
?>

<?php if($Message) echo $Message['msg'];?>
<div class="form-group row">
    <div class="col-4" >
        <h2>
        <?php   // Menu rapide
        foreach(Type as $Item=>$f) {
            ($no == $Item) ? $s="color:#e5692c;" : $s="color:#dddddd;";
            echo "<a style='$s  text-decoration: none;'  href='?p=c,$Item'>".ucwords(Type[$Item])."s</a><br>";
        }
        ?>
        </h2>
    </div>
    <div class="col-8" >
        <form action="" method="post" class="">
            <input name="type" type="hidden" value="<?=$no?>">
            <table border="0" width="100%">
            <?php
            foreach($Type as $k=>$dtl_type) {
                $CheckCustom = "CC_".$k;
                ?>
                <tr>
                <td width="70%">
                <input class="form-control" name="nom[<?=$k?>]" value="<?=($dtl_type['nom']) ?>">

                </td>
                <?php if ($no=="vin") { ?>
                <td >
                    <input class="form-control" name="prix[<?=$k?>]" value="<?=($dtl_type['prix']) ?>" style="width:60px">
                </td>
                <?php } ?>
                <td>
                    <button type="submit" name="btn_modif" value="<?=$k?>" class="btn btn-light"><i class="fas fa-check"></i></button>
                    <button type="submit" name="btn_suppr" value="<?=$k?>" class="btn btn-danger"><i class="far fa-trash-alt"></i></button>
                </td>
                </tr>
            <?php } ?>
                <tr>
                    <td colspan="2">
                        <br>
                        <small>Pour ajouter un nouvel enregistrement  </small>
                    </td>
                </tr>
                <tr>
                    <td>
                    <input class="form-control" name="btn_ajout" value="" placeholder="indiquez ici votre <?=Type[$no]?>">
                    </td>
                    <?php if ($no=="vin") { ?>
                    <td>
                        <input class="form-control" name="prix_ajout" value="" style="width:60px" placeholder="€">
                    </td>
                    <?php } ?>
                    <td>
                    <button type="submit" value="0" class="btn btn-success"><i class="fas fa-plus"></i></button>
                    </td>
            </tr>
            </table>
            <br>
            <hr>
            <div class="float-right">
                <button type="button"   class="btn btn-orange" style="width:200px" Onclick="location=('index.php')">Accueil</button>
            </div>
        </form>
    </div>
</div>