Skip to content
Snippets Groups Projects
Commit b93fdb94 authored by nicrausaz's avatar nicrausaz
Browse files

update

parent c630b70b
No related branches found
No related tags found
No related merge requests found
...@@ -312,8 +312,62 @@ function deletePostulation ($pdo, $id, $sciper, $rep1, $rep2) { ...@@ -312,8 +312,62 @@ function deletePostulation ($pdo, $id, $sciper, $rep1, $rep2) {
header('Location: viewpostulation.php'); header('Location: viewpostulation.php');
} }
function updatePostulation ($pdo, $id) { function updatePostulation ($pdo, $id, $posted_data) {
echo "editing: $id"; echo "editing: $id";
echo "<pre>";
print_r($posted_data);
// update applicant data
// -- applicant_birthdate= :applicant_birthdate,
$sqlreq = "UPDATE applicant
SET
applicant_maturity= :applicant_maturity,
applicant_gender= :applicant_gender,
applicant_address_street= :applicant_address_street,
applicant_address_npa= :applicant_address_npa,
applicant_home_phone= :applicant_home_phone,
applicant_personal_phone= :applicant_personal_phone,
applicant_origin= :applicant_origin,
applicant_nationality= :applicant_nationality,
applicant_foreign_authorization= :applicant_foreign_authorization,
applicant_avs= :applicant_avs,
applicant_main_language= :applicant_main_language,
applicant_speaks_french= :applicant_speaks_french,
applicant_speaks_german= :applicant_speaks_german,
applicant_speaks_english= :applicant_speaks_english,
applicant_speaks_other= :applicant_speaks_other,
applicant_has_majority= :applicant_has_majority,
applicant_scolarity_end= :applicant_scolarity_end,
applicant_already_applicant= :applicant_already_applicant,
applicant_already_applicant_year= :applicant_already_applicant_year,
applicant_application_updated_date= :applicant_application_updated_date
WHERE applicant_id=:id";
$query = $pdo->prepare($sqlreq);
$query->bindParam(':id', $id, PDO::PARAM_STR);
$query->bindParam(':applicant_maturity', $posted_data['applicant_maturity'], PDO::PARAM_STR);
$query->bindParam(':applicant_gender', $posted_data['applicant_gender'], PDO::PARAM_STR);
$query->bindParam(':applicant_address_street', $posted_data['applicant_address_street'], PDO::PARAM_STR);
$query->bindParam(':applicant_address_npa', $posted_data['applicant_address_npa'], PDO::PARAM_STR);
$query->bindParam(':applicant_home_phone', $posted_data['applicant_home_phone'], PDO::PARAM_STR);
$query->bindParam(':applicant_personal_phone', $posted_data['applicant_personal_phone'], PDO::PARAM_STR);
$query->bindParam(':applicant_origin', $posted_data['applicant_origin'], PDO::PARAM_STR);
$query->bindParam(':applicant_nationality', $posted_data['applicant_nationality'], PDO::PARAM_STR);
$query->bindParam(':applicant_foreign_authorization', $posted_data['applicant_foreign_authorization'], PDO::PARAM_STR);
$query->bindParam(':applicant_avs', $posted_data['applicant_avs'], PDO::PARAM_STR);
$query->bindParam(':applicant_main_language', $posted_data['applicant_main_language'], PDO::PARAM_STR);
$query->bindParam(':applicant_speaks_french', $posted_data['applicant_speaks_french'], PDO::PARAM_STR);
$query->bindParam(':applicant_speaks_german', $posted_data['applicant_speaks_german'], PDO::PARAM_STR);
$query->bindParam(':applicant_speaks_english', $posted_data['applicant_speaks_english'], PDO::PARAM_STR);
$query->bindParam(':applicant_speaks_other', $posted_data['applicant_speaks_other'], PDO::PARAM_STR);
$query->bindParam(':applicant_has_majority', $posted_data['applicant_has_majority'], PDO::PARAM_STR);
$query->bindParam(':applicant_already_applicant', $posted_data['applicant_already_applicant'], PDO::PARAM_STR);
$query->bindParam(':applicant_already_applicant_year', $posted_data['applicant_already_applicant_year'], PDO::PARAM_STR);
$query->bindParam(':applicant_scolarity_end', $posted_data['applicant_scolarity_end'], PDO::PARAM_STR);
$query->bindParam(':applicant_application_updated_date', date("Y-m-d H:i:s"), PDO::PARAM_STR);
$query->execute();
// header('Location: viewpostulation.php'); // header('Location: viewpostulation.php');
} }
#endregion #endregion
......
...@@ -261,6 +261,7 @@ function initEdits() { ...@@ -261,6 +261,7 @@ function initEdits() {
document.location.href = "viewpostulation.php?delete"; document.location.href = "viewpostulation.php?delete";
} }
}); });
$('#editPost').click(function () { $('#editPost').click(function () {
$('#editPost').prop('disabled', true); $('#editPost').prop('disabled', true);
$('#confirmEditPost').show(); $('#confirmEditPost').show();
...@@ -273,6 +274,10 @@ function initEdits() { ...@@ -273,6 +274,10 @@ function initEdits() {
$('.editPostInputs').each(function () { $('.editPostInputs').each(function () {
$(this).show(); $(this).show();
}) })
if ($("#applicant_already_applicant_year").val() == '') {
$("#applicant_already_applicant_year").hide();
}
}); });
// $('#confirmEditPost').click(function () { // $('#confirmEditPost').click(function () {
...@@ -291,6 +296,15 @@ function initEdits() { ...@@ -291,6 +296,15 @@ function initEdits() {
}) })
}); });
// deja cand switch
$("#applicant_already_applicant1").click(function () {
$("#applicant_already_applicant_year").val(null);
$("#applicant_already_applicant_year").hide();
})
$("#applicant_already_applicant2").click(function () {
$("#applicant_already_applicant_year").show();
})
// hide default // hide default
$('#confirmEditPost').hide(); $('#confirmEditPost').hide();
$('#cancelEditPost').hide(); $('#cancelEditPost').hide();
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<td> <td>
<label for="newann">Ajouter un annexe</strong></label> <label for="newann">Ajouter un annexe</strong></label>
<small>Formats autorisés: <b>PDF, JPG, JPEG, PNG</b></small> <small>Formats autorisés: <b>PDF, JPG, JPEG, PNG</b></small>
<input type="file" name="photo" class="upload-input" id="photo" onchange="changeTitleFile(this)" data-required/> <input type="file" name="photo" class="upload-input" id="photo" onchange="changeTitleFile(this)"/>
<br> <br>
<label for="photo" class="btn btn-secondary btn-sm icon-right"> <label for="photo" class="btn btn-secondary btn-sm icon-right">
Choisir... Choisir...
......
...@@ -35,7 +35,13 @@ ...@@ -35,7 +35,13 @@
</tr> </tr>
<tr> <tr>
<td>Genre</td> <td>Genre</td>
<td><?= $postulation['applicant_gender'] ?></td> <td>
<span class="postulationDataSpans"><?= $postulation['applicant_gender'] ?></span>
<select name="applicant_gender" class="custom-select editPostInputs">
<option value="Homme" <?php echo ($postulation['applicant_gender'] == "Homme") ? "selected" : ''; ?>>Homme</option>
<option value="Femme" <?php echo ($postulation['applicant_gender'] == "Femme") ? "selected" : ''; ?>>Femme</option>
</select>
</td>
</tr> </tr>
<tr> <tr>
<td>Email</td> <td>Email</td>
...@@ -99,6 +105,7 @@ ...@@ -99,6 +105,7 @@
<tr> <tr>
<td>Connaissances linguistiques</td> <td>Connaissances linguistiques</td>
<td> <td>
<span class="postulationDataSpans">
<?php <?php
if ($postulation['applicant_speaks_french']) { if ($postulation['applicant_speaks_french']) {
echo '<img src="/assets/img/french_logo.png" alt="french_logo" width="30px">'; echo '<img src="/assets/img/french_logo.png" alt="french_logo" width="30px">';
...@@ -113,6 +120,25 @@ ...@@ -113,6 +120,25 @@
echo '<img src="/assets/img/others_logo.png" alt="others_logo" width="30px">'; echo '<img src="/assets/img/others_logo.png" alt="others_logo" width="30px">';
} }
?> ?>
</span>
<div class="editPostInputs">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="french" value="1" name="applicant_speaks_french" <?php echo ($postulation['applicant_speaks_french'] == 1) ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="french">Français</label>
</div>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="german" value="1" name="applicant_speaks_german" <?php echo ($postulation['applicant_speaks_german'] == 1) ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="german">Allemand</label>
</div>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="english" value="1" name="applicant_speaks_english" <?php echo ($postulation['applicant_speaks_english'] == 1) ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="english">Anglais</label>
</div>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="other" value="1" name="applicant_speaks_other" <?php echo ($postulation['applicant_speaks_other'] == 1) ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="other">Autres</label>
</div>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -138,7 +164,18 @@ ...@@ -138,7 +164,18 @@
</tr> </tr>
<tr> <tr>
<td>Déja candidat ? (année)</td> <td>Déja candidat ? (année)</td>
<td><?= $postulation['applicant_already_applicant'] ? "&#10004 (" .$postulation['applicant_already_applicant_year'] . ")" : "&#10008" ?></td> <td>
<span class="postulationDataSpans"><?= $postulation['applicant_already_applicant'] ? "&#10004 (" .$postulation['applicant_already_applicant_year'] . ")" : "&#10008" ?></span>
<div class="custom-control custom-radio editPostInputs">
<input type="radio" name="applicant_already_applicant" id="applicant_already_applicant1" class="custom-control-input" value="0" <?php echo ($postulation['applicant_already_applicant'] == 0) ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="applicant_already_applicant1">Non</label>
</div>
<div class="custom-control custom-radio editPostInputs">
<input type="radio" name="applicant_already_applicant" id="applicant_already_applicant2" class="custom-control-input" value="1" <?php echo ($postulation['applicant_already_applicant'] == 1) ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="applicant_already_applicant2">Oui</label>
</div>
<input class="editPostInputs form-control" id="applicant_already_applicant_year" placeholder="année" value="<?= $postulation['applicant_already_applicant_year'] ?>" name="applicant_already_applicant_year" >
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
......
...@@ -44,8 +44,7 @@ ...@@ -44,8 +44,7 @@
if (isset($_GET['delete'])) { if (isset($_GET['delete'])) {
deletePostulation($pdo, $_SESSION['current_post']['applicant_id'], $_SESSION['current_post']['applicant_guest_sciper'], $_SESSION['current_post']['fk_applicant_main_responsible'], $_SESSION['current_post']['fk_applicant_sec_responsible']); deletePostulation($pdo, $_SESSION['current_post']['applicant_id'], $_SESSION['current_post']['applicant_guest_sciper'], $_SESSION['current_post']['fk_applicant_main_responsible'], $_SESSION['current_post']['fk_applicant_sec_responsible']);
} else if (isset($_GET['update'])) { } else if (isset($_GET['update'])) {
print_r($_POST); updatePostulation($pdo, $_SESSION['current_post']['applicant_id'], $_POST);
updatePostulation($pdo, $_SESSION['current_post']['applicant_id']);
} else { } else {
if ($_POST['selected_post']) { if ($_POST['selected_post']) {
$postulation = $postulations[$_POST['selected_post']]; $postulation = $postulations[$_POST['selected_post']];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment