Init Git Prod Mars 2026

This commit is contained in:
Oleg Barykin committed 2026-03-05 10:25:39 +01:00
commit d81efe93b1
362 files changed
+86627

No files matched your search

+171
View File
@@ -0,0 +1,171 @@
<?php
require_once __DIR__ . '/../../includes/init_praticien.php';
require_once __DIR__ . '/../../includes/header.php';
function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); }
$praticien_id = (int)($_SESSION['reference_id'] ?? 0);
$note_id = (int)($_GET['note_id'] ?? 0);
if ($note_id<=0) { header('Location: index.php'); exit; }
// Vérif propriétaire + récupérer dossier_id pour le retour
$sql = "SELECT s.*, d.praticien_id, d.id AS dossier_id
FROM client_suivi s
JOIN client_dossiers d ON d.id=s.dossier_id
WHERE s.id=:id AND d.praticien_id=:p AND d.archived_at IS NULL";
$st = $pdo->prepare($sql);
$st->execute([':id'=>$note_id, ':p'=>$praticien_id]);
$note = $st->fetch(PDO::FETCH_ASSOC);
if (!$note) { header('Location: index.php'); exit; }
$stF = $pdo->prepare("SELECT id, path, mime, size_bytes FROM client_suivi_files WHERE entry_id=:e ORDER BY id ASC");
$stF->execute([':e'=>$note_id]);
$files = $stF->fetchAll(PDO::FETCH_ASSOC);
if (empty($_SESSION['cl_csrf'])) $_SESSION['cl_csrf'] = bin2hex(random_bytes(32));
$CSRF = $_SESSION['cl_csrf'];
?>
<div class="main1">
<div class="container py-5">
<div class="shadow p-4 rounded bg-light">
<main class="container my-4">
<div class="card p-3 shadow-sm">
<h4 class="mb-3"><?= h($translations['modifier'] ?? 'Modifier') ?></h4>
<form id="edit-form" enctype="multipart/form-data">
<input type="hidden" name="csrf" value="<?= h($CSRF) ?>">
<input type="hidden" name="note_id" value="<?= (int)$note_id ?>">
<div class="row g-3">
<div class="col-12 col-md-4">
<label class="form-label"><?= h($translations['cl_date_rdv'] ?? 'Date') ?></label>
<input type="datetime-local" name="date_rdv" class="form-control"
value="<?= h((new DateTime($note['date_rdv']))->format('Y-m-d\TH:i')) ?>">
</div>
<div class="col-12 col-md-4">
<label class="form-label"><?= h($translations['cl_type_rdv'] ?? 'Type') ?></label>
<select class="form-select" name="type_rdv">
<?php foreach([''.$translations['cl_type_online'].'',''.$translations['cl_type_cabinet'].'',''.$translations['cl_type_tel'].'',''.$translations['cl_type_autre'].''] as $opt): ?>
<option value="<?= $opt ?>" <?= $note['type_rdv']===$opt?'selected':'' ?>><?= h($opt) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-12 col-md-4">
<label class="form-label"><?= h($translations['cl_duree'] ?? 'Durée (min)') ?></label>
<input type="number" name="duree_minutes" class="form-control" min="1" max="600" value="<?= h((string)($note['duree_minutes'] ?? '')) ?>">
</div>
<div class="col-12">
<label class="form-label"><?= h($translations['cl_titre'] ?? 'Titre') ?></label>
<input type="text" name="titre" class="form-control" required value="<?= h($note['titre']) ?>">
</div>
<div class="col-12">
<label class="form-label"><?= h($translations['cl_notes'] ?? 'Notes') ?></label>
<textarea name="notes" class="form-control" rows="6" required><?= h($note['notes']) ?></textarea>
</div>
<div class="col-12 col-md-6">
<label class="form-label"><?= h($translations['cl_prochaine_action'] ?? 'Prochaine action') ?></label>
<input type="text" name="prochaine_action" class="form-control" value="<?= h((string)$note['prochaine_action']) ?>">
</div>
<div class="col-12">
<label class="form-label"><?= h($translations['cl_pieces_jointes'] ?? 'Pièces jointes') ?></label>
<?php if($files): ?>
<ul class="list-unstyled">
<?php foreach($files as $f): $name = basename((string)$f['path']); ?>
<li class="d-flex align-items-center gap-2 mb-1">
<span class="small"><?= h($name) ?></span>
<a class="btn btn-outline-secondary btn--no-shadow" href="download.php?id=<?= (int)$f['id'] ?>">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16">
<path d="M.5 9.9a.5.5 0 0 1 .5.5V13a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V10.4a.5.5 0 0 1 1 0V13a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10.4a.5.5 0 0 1 .5-.5z"/>
<path d="M7.646 10.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 9.293V1.5a.5.5 0 0 0-1 0v7.793L5.354 7.146a.5.5 0 1 0-.708.708l3 3z"/>
</svg>
</a>
<button type="button" class="btn btn-outline-danger btn--no-shadow"
data-file="<?= (int)$f['id'] ?>">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16">
<path d="M5.5 5.5A.5.5 0 0 1 6 5h4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0V6h-3v6.5a.5.5 0 0 1-1 0v-7z"/>
<path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1 0-2h3l.5-.5h4l.5.5h3a1 1 0 0 1 1 1zM4.118 4l.82 9.823A1 1 0 0 0 5.933 15h4.134a1 1 0 0 0 .995-.823L11.882 4H4.118z"/>
</svg>
</button>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<input type="file" name="files[]" class="form-control" multiple accept=".pdf,.jpg,.jpeg,.png,.doc,.docx,.txt">
<div class="form-text"><?= $translations['8_max']?></div>
</div>
<div class="col-12 d-flex justify-content-end gap-2">
<button class="btn btn-primary" type="submit"><?= h($translations['enregistrer'] ?? 'Enregistrer') ?></button>
<a href="fiche.php?dossier_id=<?= (int)$note['dossier_id'] ?>" class="btn btn-outline-secondary"><?= h($translations['cl_pagination_prec'] ?? 'Annuler') ?></a>
<button type="button" id="btn-delete-note" class="btn btn-outline-danger btn--no-shadow">
<?= h($translations['supprimer'] ?? 'Supprimer') ?>
</button>
</div>
</div>
</form>
</div>
</main>
</div>
</div>
</div>
<footer class="site-footer">
<div class="container">
<p><?= $translations['copyr'] ?></p>
</div>
</footer>
<script>
document.getElementById('btn-delete-note')?.addEventListener('click', async ()=>{
const res = await Swal.fire({
title: <?= json_encode($translations['cl_confirmer_suppression']) ?>,
text: <?= json_encode($translations['cl_action_irreversible']) ?>,
icon: 'warning',
showCancelButton: true,
confirmButtonText: <?= json_encode($translations['btn_supprimer']) ?>,
cancelButtonText: <?= json_encode($translations['btn_annuler']) ?>
});
if (!res.isConfirmed) return;
const fd = new FormData();
fd.append('csrf', '<?= h($CSRF) ?>');
fd.append('note_id', '<?= (int)$note['id'] ?>');
const r = await fetch('ajax_supprimer_note.php', { method:'POST', body:fd, credentials:'same-origin' });
const j = await r.json();
if (j.ok) {
location.href = 'fiche.php?dossier_id=<?= (int)$note['dossier_id'] ?>';
} else {
Swal.fire('Oops', j.message || 'Erreur', 'error');
}
});
</script>
<script>
document.getElementById('edit-form').addEventListener('submit', async (e)=>{
e.preventDefault();
const fd = new FormData(e.currentTarget);
const r = await fetch('ajax_editer_note.php',{method:'POST', body:fd, credentials:'same-origin'});
const j = await r.json();
if(j.ok){
location.href = 'fiche.php?dossier_id=<?= (int)$note['dossier_id'] ?>';
}else{
alert(j.message||'Erreur');
}
});
document.addEventListener('click', async (e)=>{
const b = e.target.closest('button[data-file]');
if(!b) return;
if(!confirm('Supprimer ce fichier ?')) return;
const fd = new FormData();
fd.append('csrf', '<?= h($CSRF) ?>');
fd.append('file_id', b.getAttribute('data-file'));
const r = await fetch('ajax_supprimer_fichier.php',{method:'POST', body:fd, credentials:'same-origin'});
const j = await r.json();
if(j.ok) location.reload(); else alert(j.message||'Erreur');
});
</script>