diff --git a/ensiie-project/src/View/commande_finie.php b/ensiie-project/src/View/commande_finie.php index dfdf5b91df0e9c22fefdfc60501bd1f417a6652a..6a9d7a5e996bf445c2b5f1cce35d29fd5a4c504c 100644 --- a/ensiie-project/src/View/commande_finie.php +++ b/ensiie-project/src/View/commande_finie.php @@ -9,11 +9,13 @@ foreach($utilisateur->getCommandes() as $commande){ ?> <div class="panel panel-default"> + <div class="panel-heading text-left"> + Vous avez commandé : <br/> + </div> <div class="panel-body"> <div class="text-left"> - Vous avez commandé : <br/><?php echo $commande->toString();?> + <?php echo $commande->toString();?> </div> - <html> <form method="post"> <button class="btn btn-danger btn-xs" name="supprime" style="float: right; margin-bottom: 10px;">Supprimer</button> </form> diff --git a/ensiie-project/src/View/commande_form.php b/ensiie-project/src/View/commande_form.php index 9f76ff6c37e6958da79907ea5b6b9c28556664ca..47f316f415121f6299ad3885b80bdb58f797c2e1 100644 --- a/ensiie-project/src/View/commande_form.php +++ b/ensiie-project/src/View/commande_form.php @@ -20,102 +20,43 @@ {?> <div class="input-group"> <label class="input-group-addon"><?php echo $typeFood?></label> - <select name=<?php echo $typeFood['nomType']?> class="form-control"> - <option value="0">Cliquez pour voir les choix</option> + <select name=<?php echo $typeFood['nomType'];?> class="form-control" onchange="show_special(this)"> + <option value="0" slected>Cliquez pour voir les choix</option> <?php foreach($typeFood['Foods'] as $food) {?> - <option value=<?php echo $food['nameFood']?>><?php echo $food['nameFood']." (".$food['priceFood'].")"?></option> - <?php + <option value="<?php echo $food['nameFood'];?>"><?php echo $food['nameFood']." (".$food['priceFood'].")";?></option> + <?php + int $j = 0; + foreach($food['idSpecial'] as $id) + {?> + <input name="nbMin<?php echo $j;?>" type="hidden" value="<?php echo $food['nbMinSpecial'][$j]; ?>"></span> + <input name="nbMax<?php echo $j;?>" type="hidden" value="<?php echo $food['nbMax'][$j]; ?>"></span> + <?php + $j++; + } }?> </select> - </div> + </div> <?php }?> </div> <?php }?> - </form> </div> </div> <script type="text/javascript"> -var current_max_meats = 0; - -$('select').change(function () +function show_special(selectObject) { - var food_type_id = $(this).attr('data-food-type'); - var parent_sauces = $('#sauce-checkboxes-'+food_type_id).attr('id'); - var parent_meats = $('#meat-checkboxes-'+food_type_id).attr('id'); - current_max_meats = parseInt($('select[name="'+$(this).attr('name')+'"] option:selected').attr('data-max-meats')); - - if ($(this).val() === "0") { - $("#hidden-"+food_type_id).slideUp(200); - refresh_sauce_checkboxes(parent_sauces, true); - refresh_meat_checkboxes(parent_meats, true); + var value = selectObject.value; + if (value != "0") + { + plural_message = ngettext('votre', 'vos', special_count); } - else - $("#hidden-"+food_type_id).slideDown(200); - - if ($(this).val() === "0") - $('#meat-message-'+food_type_id).html('<strong>Choisissez votre ou vos viandes :</strong>'); - else - if (current_max_meats === 1) - $('#meat-message-'+food_type_id).html('<strong>Choisissez votre viande :</strong>'); - else - $('#meat-message-'+food_type_id).html('<strong>Choisissez vos viandes <span class="text-danger">('+current_max_meats+' au maximum)</span> :</strong>'); - - refresh_meat_checkboxes(parent_meats); -}) - -$('input[type="checkbox"]').click(function () -{ - var parent_sauces = $(this).parents('[id^="sauce-checkboxes-"]').attr('id'); - refresh_sauce_checkboxes(parent_sauces); - - var parent_meats = $(this).parents('[id^="meat-checkboxes-"]').attr('id'); - refresh_meat_checkboxes(parent_meats); -}) - -$('[id^="reset-sauces-"]').click(function () -{ - var id_div = $(this).attr('data-food-type'); - refresh_sauce_checkboxes('sauce-checkboxes-'+id_div, true); -}) -$('[id^="reset-meats-"]').click(function () -{ - var id_div = $(this).attr('data-food-type'); - refresh_meat_checkboxes('meat-checkboxes-'+id_div, true); -}) - -function refresh_sauce_checkboxes(parent_sauces, clear=false) -{ - var number_checked_sauces = $('#'+parent_sauces+' input[type="checkbox"]:checked').length; - - if (number_checked_sauces > 2 || clear) - $('#'+parent_sauces+' input[type="checkbox"]').prop('checked', false).prop('disabled', false); - else if (number_checked_sauces === 2) - $('#'+parent_sauces+' input[type="checkbox"]').not(':checked').prop('disabled', true); - else - $('#'+parent_sauces+' input[type="checkbox"]').not(':checked').prop('disabled', false); -} - -function refresh_meat_checkboxes(parent_meats, clear=false) -{ - var number_checked_meats = $('#'+parent_meats+' input[type="checkbox"]:checked').length; - - if (number_checked_meats > current_max_meats || clear) - $('#'+parent_meats+' input[type="checkbox"]').prop('checked', false).prop('disabled', false); - else if (number_checked_meats === current_max_meats) - $('#'+parent_meats+' input[type="checkbox"]').not(':checked').prop('disabled', true); - else - $('#'+parent_meats+' input[type="checkbox"]').not(':checked').prop('disabled', false); } - -$('[id^="hidden-"]').hide(); - </script> </body> </html> \ No newline at end of file diff --git a/ensiie-project/src/index.php b/ensiie-project/src/index.php index 18a1afc5f7e9d579da5ae87d77581308f02b06a0..a26e0f13dd5d5a227a0bcb46568b1ce54acc3700 100644 --- a/ensiie-project/src/index.php +++ b/ensiie-project/src/index.php @@ -27,6 +27,8 @@ $menu3 = new Menu(3,$nourriture3,array($special0,$special1,$special2)); + + require_once("Controller/set_utilisateur.php"); require_once('Model/infos_njv.php');