diff --git a/canapEPFL/form.php b/canapEPFL/form.php index 7180345704c9ef399a155cbf31ed0704971952a2..71facd4c016662f44ed2495e15692f27e8eff10a 100644 --- a/canapEPFL/form.php +++ b/canapEPFL/form.php @@ -107,13 +107,18 @@ </div> </div> <!-- / Conditions --> - <button type="submit" class="btn btn-primary btn-block" type="submit">Terminer</button> + <button class="btn btn-primary btn-block" type="submit">Terminer</button> + <button class="btn btn-secondary btn-block" id="cancelEditBtn" type="button">Annuler</button> </div> <!-- / div all --> </form> </main> - <script> lieu='<?php echo $_SESSION['postedForm']['lieu'] ;?>';</script> + <?php if (isset($_GET['edit'])) { ?> + <script> lieu='<?php echo $_SESSION['postedForm']['lieu'] ;?>';</script> + <?php } else { ?> + <script> lieu='<?php echo $_SESSION['current_post']['applicant_formation_location'] ;?>';</script> <?php + } if (isset($_SESSION['formError'])) { echo "<script>showOnFormReturn(lieu);</script>"; } diff --git a/canapEPFL/script.js b/canapEPFL/script.js index ff0019618acd4e047fc14b80cdcef25a8292a092..dca62d0f151ddd78bb9e270dea6713e6771721ba 100644 --- a/canapEPFL/script.js +++ b/canapEPFL/script.js @@ -1,7 +1,6 @@ $(document).ready(function () { initButtonsAction(); if (location.search == "?edit") { - // showPolyAndInfoDivs(); $("#all").show(); initButtonsAction(); initAddChildButtons(); @@ -114,6 +113,9 @@ function initButtonsAction() { $('#editPost').click(function () { document.location.href = "form.php?edit"; }); + $('#cancelEditBtn').click(function () { + document.location.href = "viewpostulation.php"; + }) $('#infoFilieres').click(function () { window.open("https://www.ict-berufsbildung.ch/fr/formation-professionnelle/formation-initiale-ict/", '_blank'); }); @@ -236,14 +238,20 @@ function initJobChange() { } function showOnFormReturn(lieu) { - if (lieu == 'Lausanne') { - var selectedFormation = $("#jbLausanne option:selected")[0].value; - } - else if (lieu == 'Sion') { - var selectedFormation = $("#jbSion option:selected")[0].value; + if (location.search != "?edit") { + if (lieu == 'Lausanne') { + var selectedFormation = $("#jbLausanne option:selected")[0].value; + } + else if (lieu == 'Sion') { + var selectedFormation = $("#jbSion option:selected")[0].value; + } + showListJob(lieu); + showPolyAndInfoDivs(selectedFormation); + + } else { + var selectedFormation = $('#job').val(); + showPolyAndInfoDivs(selectedFormation); } - showListJob(lieu) - showPolyAndInfoDivs(selectedFormation); } function showListJob(lieu) { if (lieu == 'Lausanne') { diff --git a/canapEPFL/templates/errorText.php b/canapEPFL/templates/errorText.php index 7c45fa8886a77a68fb433ae29db36c3f6191720d..000100d449b4fd483510aba6f6bd03a2d245b151 100644 --- a/canapEPFL/templates/errorText.php +++ b/canapEPFL/templates/errorText.php @@ -5,6 +5,7 @@ if (!$_POST && !$_FILES) { echo "<li>Fichiers fournis trop volumineux ! <small>(Taille recommandée env. 2Mo)</small></li>"; } else { + echo isset($_SESSION['edit_error']['files']) ? $_SESSION['edit_error']['files'] : ''; foreach($validator->errors() as $error => $errorVal) { echo "<li>$errorVal</li>"; } diff --git a/canapEPFL/templates/formParts/edit/annexes.php b/canapEPFL/templates/formParts/edit/annexes.php index 77fa2116c738c3f68129e867e0265ecced34768c..1b1f92c0b62ca8abd449c1c8987c6959da265c81 100644 --- a/canapEPFL/templates/formParts/edit/annexes.php +++ b/canapEPFL/templates/formParts/edit/annexes.php @@ -1,8 +1,5 @@ <?php $files = getFilesById($pdo, $current_post['applicant_id']); - echo "<pre>"; - print_r($files); - echo "</pre>"; ?> <small>Remplacez ou ajouter des annexes (le fichier actuel est conservé si il n'est pas remplacé)</small> <br> @@ -36,9 +33,9 @@ </label> <br> <small class="error" class="form-text text-muted"></small> - </div> + </div> --> - <div class="form-group" id="griTest"> + <!-- <div class="form-group" id="griTest"> <label for="griTestInput">Attestation de tests d'aptitudes GRI (informaticien):</label> <input type="file" name="griTestInput" class="upload-input" id="griTestInput" onchange="changeTitleFile(this)"/> <br> diff --git a/canapEPFL/templates/formParts/edit/jobselection.php b/canapEPFL/templates/formParts/edit/jobselection.php index a617737559c47dabda6643196a7c08f01caec269..877ce7040f43a6588818f68a4bc3a102b8647a35 100644 --- a/canapEPFL/templates/formParts/edit/jobselection.php +++ b/canapEPFL/templates/formParts/edit/jobselection.php @@ -1,4 +1,4 @@ <p>Formation: <b><?= $LISTJOB[$current_post['applicant_formation_location']][$current_post['applicant_formation']]?></b></p> <p>Lieu: <b><?= $current_post['applicant_formation_location'] ?></b></p> -<input type="text" hidden readonly name="job" value="<?= $current_post['applicant_formation']?>"> -<input type="text" hidden readonly name="lieu" value="<?= $current_post['applicant_formation_location'] ?>"> +<input type="text" hidden readonly name="job" id="job" value="<?= $current_post['applicant_formation']?>"> +<input type="text" hidden readonly name="lieu" id="lieu" value="<?= $current_post['applicant_formation_location'] ?>">