Nombre totale de missions achevées: ${doneCnt}
@@ -351,6 +377,28 @@ function get_admin(type) {
}
function refreshListener() {
+ $('#switch-state').click(() => {
+
+ $.ajax({
+ type: "POST",
+ url: base_url + "switchState",
+ data: JSON.stringify({
+ uid: localStorage.getItem('user'),
+ token: localStorage.getItem('token'),
+ }),
+ contentType: "application/json; charset=utf-8",
+ dataType: "json",
+ success: function(data) {
+ if(data.state == 'open') {
+ $("#switch-state").text('Vérouiller');
+ } else {
+ $("#switch-state").text('Dévérouiller');
+ }
+ }
+ })
+
+ })
+
$(".prank-btn-accept").click((e) => {
let uid = e.target.parentNode.parentNode.id
$.ajax({
@@ -715,8 +763,35 @@ $('#demande-button').click(function () {
});
});
+var saved_form = $('#login-form').html();
+
+function is_locked() {
+
+}
+
function updateDemandes() {
+
if(localStorage.getItem('user') && localStorage.getItem('token')) {
+ $.ajax({
+ type: "POST",
+ url: base_url + "get",
+ data: JSON.stringify({
+ uid: localStorage.getItem('user'),
+ token: localStorage.getItem('token'),
+ type: "state"
+ }),
+
+ success: function(data) {
+ if(data.success) {
+ if(data.state == "open") {
+ $('#login-form').html(saved_form);
+ } else {
+ $('#login-form').html('Les commandes sont fermés pour le moment mais on revient vite !
');
+ }
+ }
+ }
+ });
+
$.ajax({
type: "POST",
url: base_url + "get",