Verification du statut avant la creation d'un contrat
This commit is contained in:
13
staticfiles/js/monprofil.js
Normal file
13
staticfiles/js/monprofil.js
Normal file
@@ -0,0 +1,13 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
// Vérifie si le formulaire contient des erreurs
|
||||
var formErrors = {{ complet_form.non_field_errors|length|default:0 }};
|
||||
if (formErrors > 0) {
|
||||
// Ouvre la modale
|
||||
var modal = new bootstrap.Modal(document.getElementById('modalModifierProfil'));
|
||||
modal.show();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
102
staticfiles/js/rapport.js
Normal file
102
staticfiles/js/rapport.js
Normal file
@@ -0,0 +1,102 @@
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function() {
|
||||
navigator.serviceWorker.register('{% static "sw.js" %}').then(function(reg) {
|
||||
console.log('Service worker registered.', reg);
|
||||
}).catch(function(err) {
|
||||
console.warn('Service worker registration failed:', err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const couleursOrange = ['#b35400', '#ff9f1c', '#ffc107', '#ffb84d', '#ffcc80'];
|
||||
const departementLabels = {{ departement_labels|safe }};
|
||||
const departementCounts = {{ departement_counts|safe }};
|
||||
const sexeLabels = {{ sexe_labels|safe }};
|
||||
const sexeCounts = {{ sexe_counts|safe }};
|
||||
const projetLabels = {{ projet_labels|safe }};
|
||||
const projetCounts = {{ projet_counts|safe }};
|
||||
const ticketsLabels = ["Traités", "Non traités"];
|
||||
const ticketsCounts = [{{ tickets_traite }}, {{ tickets_non_traite }}];
|
||||
const domaineLabels = {{ domaine_labels|safe }};
|
||||
const domaineCounts = {{ domaine_counts|safe }};
|
||||
|
||||
new Chart(document.getElementById("chartDepartement"), {
|
||||
type: 'pie',
|
||||
plugins: [ChartDataLabels],
|
||||
data: {
|
||||
labels: departementLabels,
|
||||
datasets: [{ data: departementCounts, backgroundColor: couleursOrange }]
|
||||
},
|
||||
options: {
|
||||
plugins: {
|
||||
legend: { position: 'bottom' },
|
||||
datalabels: { color: '#fff', font: { weight: 'bold', size: 14 }, formatter: v => v }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
new Chart(document.getElementById("chartSexe"), {
|
||||
type: 'doughnut',
|
||||
plugins: [ChartDataLabels],
|
||||
data: {
|
||||
labels: sexeLabels,
|
||||
datasets: [{ data: sexeCounts, backgroundColor: couleursOrange }]
|
||||
},
|
||||
options: {
|
||||
plugins: {
|
||||
legend: { position: 'bottom' },
|
||||
datalabels: { color: '#fff', font: { weight: 'bold', size: 14 }, formatter: v => v }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
new Chart(document.getElementById("chartProjets"), {
|
||||
type: 'bar',
|
||||
plugins: [ChartDataLabels],
|
||||
data: {
|
||||
labels: projetLabels,
|
||||
datasets: [{ label:'Nombre de projets', data: projetCounts, backgroundColor: couleursOrange }]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
datalabels: { anchor:'end', align:'top', color:'#000', font:{ weight:'bold', size:16 }, formatter:v => v }
|
||||
},
|
||||
scales: {
|
||||
y: { beginAtZero:true, ticks:{ stepSize:1, precision:0 }, title:{ display:true, text:'Nombre de projets' } },
|
||||
x: { title:{ display:true, text:'' } }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
new Chart(document.getElementById("chartDomaine"), {
|
||||
type: 'bar',
|
||||
plugins: [ChartDataLabels],
|
||||
data: {
|
||||
labels: domaineLabels,
|
||||
datasets: [{ label:'Nombre de projets', data: domaineCounts, backgroundColor: couleursOrange }]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
datalabels: { anchor:'end', align:'top', color:'#000', font:{ weight:'bold', size:14 }, formatter:v => v }
|
||||
},
|
||||
scales: {
|
||||
y: { beginAtZero:true, title:{ display:true, text:'Nombre de projets' }, ticks:{ precision:0, stepSize:1 } },
|
||||
x: {
|
||||
ticks:{ autoSkip:false, maxRotation:100, minRotation:30, callback: function(value){ return this.getLabelForValue(value); } }
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('btnVoirRapport').addEventListener('click', function() {
|
||||
const projetId = document.getElementById('projetId').value;
|
||||
if(!projetId) return alert("Veuillez sélectionner un projet.");
|
||||
fetch(`/rapports/projet/${projetId}/`)
|
||||
.then(resp => { if(!resp.ok) throw new Error("Projet non trouvé"); return resp.text(); })
|
||||
.then(html => { document.getElementById('contenuRapportProjet').innerHTML = html; })
|
||||
.catch(err => { document.getElementById('contenuRapportProjet').innerHTML = "<p class='text-danger'>Erreur lors du chargement.</p>"; console.error(err); });
|
||||
});
|
||||
75
staticfiles/js/sirh-index.js
Normal file
75
staticfiles/js/sirh-index.js
Normal file
@@ -0,0 +1,75 @@
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function() {
|
||||
navigator.serviceWorker.register('{% static "sw.js" %}').then(function(reg) {
|
||||
console.log('Service worker registered.', reg);
|
||||
}).catch(function(err) {
|
||||
console.warn('Service worker registration failed:', err);
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
var messageModal = new bootstrap.Modal(document.getElementById('messageModal'));
|
||||
messageModal.show();
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
var politiqueModal = new bootstrap.Modal(document.getElementById('politiqueModal'));
|
||||
politiqueModal.show();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
var politiqueModal = new bootstrap.Modal(document.getElementById('politiqueModal'));
|
||||
politiqueModal.show();
|
||||
});
|
||||
</script>
|
||||
>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
var modal = new bootstrap.Modal(document.getElementById('politiqueModal'));
|
||||
modal.show();
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
|
||||
<script>
|
||||
// Afficher / masquer le mot de passe
|
||||
function togglePassword() {
|
||||
const input = document.querySelector('input[name="password"]');
|
||||
input.type = input.type === 'password' ? 'text' : 'password';
|
||||
}
|
||||
|
||||
// AJAX pour réinitialisation
|
||||
$('#resetPasswordForm').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
const email = $('input[name="email"]').val();
|
||||
const csrfToken = $('[name=csrfmiddlewaretoken]').val();
|
||||
|
||||
$.ajax({
|
||||
url: "{% url 'password_reset' %}",
|
||||
type: 'POST',
|
||||
data: {
|
||||
'email': email,
|
||||
'csrfmiddlewaretoken': csrfToken
|
||||
},
|
||||
success: function(response) {
|
||||
$('#resetMessage').html('<div class="alert alert-success">Email envoyé ! Vérifiez votre boîte de réception.</div>');
|
||||
},
|
||||
error: function() {
|
||||
$('#resetMessage').html('<div class="alert alert-danger">Erreur lors de l’envoi. Vérifiez l’email.</div>');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user