Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb35075614 | ||
|
|
19b5b9e19c |
@@ -137,7 +137,7 @@ export class CardsService {
|
||||
const absenceType = this.mapAbsenceType(dto.type_code);
|
||||
|
||||
let motif = dto.motif ?? null;
|
||||
let finalPayload: Record<string, any> = {
|
||||
let finalPayload = {
|
||||
date_debut: dto.date_debut,
|
||||
date_fin: dto.date_fin,
|
||||
motif,
|
||||
@@ -145,40 +145,40 @@ export class CardsService {
|
||||
};
|
||||
|
||||
if (dto.type_code === 'soin_enfant') {
|
||||
const p = dto.payload as Record<string, any>;
|
||||
if (!p || !p?.sous_type || !p?.heure_releve) {
|
||||
const p = dto.payload;
|
||||
if (!p || !p.sous_type || !p.heure_releve) {
|
||||
throw new BadRequestException('sous_type et heure_releve requis pour soin_enfant');
|
||||
}
|
||||
if (!/^([01]\d|2[0-3]):([0-5]\d)$/.test(p?.heure_releve)) {
|
||||
if (!/^([01]\d|2[0-3]):([0-5]\d)$/.test(p.heure_releve)) {
|
||||
throw new BadRequestException('Format heure_releve invalide (HH:mm)');
|
||||
}
|
||||
|
||||
if (p?.sous_type === 'fievre') {
|
||||
if (typeof p?.temperature_c !== 'number' || p?.temperature_c < 34.0 || p?.temperature_c > 43.0) {
|
||||
if (p.sous_type === 'fievre') {
|
||||
if (typeof p.temperature_c !== 'number' || p.temperature_c < 34.0 || p.temperature_c > 43.0) {
|
||||
throw new BadRequestException('temperature_c invalide (34.0 - 43.0)');
|
||||
}
|
||||
motif = `${p?.temperature_c.toFixed(1).replace('.', ',')} °C à ${p?.heure_releve}`;
|
||||
if (p?.medicament_donne && typeof p?.medicament_donne === 'string' && p?.medicament_donne.trim()) {
|
||||
motif += ` (Médicament : ${p?.medicament_donne.trim()})`;
|
||||
motif = `${p.temperature_c.toFixed(1).replace('.', ',')} °C à ${p.heure_releve}`;
|
||||
if (p.medicament_donne && typeof p.medicament_donne === 'string' && p.medicament_donne.trim()) {
|
||||
motif += ` (Médicament : ${p.medicament_donne.trim()})`;
|
||||
}
|
||||
} else if (p?.sous_type === 'bobo') {
|
||||
} else if (p.sous_type === 'bobo') {
|
||||
const natures = ['chute', 'coup', 'egratignure', 'piqure', 'brulure', 'autre'];
|
||||
if (!natures.includes(p?.bobo_nature)) {
|
||||
if (!natures.includes(p.bobo_nature)) {
|
||||
throw new BadRequestException('bobo_nature invalide');
|
||||
}
|
||||
motif = `Bobo (${p?.bobo_nature}) à ${p?.heure_releve}`;
|
||||
if (p?.description && typeof p?.description === 'string' && p?.description.trim()) {
|
||||
const desc = p?.description.trim();
|
||||
motif = `Bobo (${p.bobo_nature}) à ${p.heure_releve}`;
|
||||
if (p.description && typeof p.description === 'string' && p.description.trim()) {
|
||||
const desc = p.description.trim();
|
||||
if (desc.length > 120) throw new BadRequestException('description trop longue (max 120)');
|
||||
motif += ` : ${desc.length > 30 ? desc.substring(0, 30) + '...' : desc}`;
|
||||
}
|
||||
} else if (p?.sous_type === 'medicament') {
|
||||
if (!p?.medicament_nom || typeof p?.medicament_nom !== 'string' || !p?.medicament_nom.trim()) {
|
||||
} else if (p.sous_type === 'medicament') {
|
||||
if (!p.medicament_nom || typeof p.medicament_nom !== 'string' || !p.medicament_nom.trim()) {
|
||||
throw new BadRequestException('medicament_nom requis');
|
||||
}
|
||||
motif = `Médicament (${p?.medicament_nom.trim()}) à ${p?.heure_releve}`;
|
||||
if (p?.contexte && typeof p?.contexte === 'string' && p?.contexte.trim()) {
|
||||
if (p?.contexte.trim().length > 120) throw new BadRequestException('contexte trop long (max 120)');
|
||||
motif = `Médicament (${p.medicament_nom.trim()}) à ${p.heure_releve}`;
|
||||
if (p.contexte && typeof p.contexte === 'string' && p.contexte.trim()) {
|
||||
if (p.contexte.trim().length > 120) throw new BadRequestException('contexte trop long (max 120)');
|
||||
}
|
||||
} else {
|
||||
throw new BadRequestException('sous_type invalide pour soin_enfant');
|
||||
@@ -192,7 +192,7 @@ export class CardsService {
|
||||
type: absenceType,
|
||||
date_debut: dto.date_debut,
|
||||
date_fin: dto.date_fin,
|
||||
motif: motif ? String(motif) : undefined,
|
||||
motif: motif ?? undefined,
|
||||
});
|
||||
absenceId = absence.id;
|
||||
} else {
|
||||
@@ -205,7 +205,7 @@ export class CardsService {
|
||||
await this.evenementsService.maj(userId, role, absenceId, {
|
||||
date_debut: dto.date_debut,
|
||||
date_fin: dto.date_fin,
|
||||
motif: motif ? String(motif) : undefined,
|
||||
motif: motif ?? undefined,
|
||||
// Congé accepté modifié → repasse en attente via cartes respond flow;
|
||||
// pour absence enfant update immédiat déjà fait.
|
||||
...(dto.type_code === 'conge_am'
|
||||
@@ -352,7 +352,7 @@ export class CardsService {
|
||||
}
|
||||
|
||||
let motif = dto.motif ?? card.payload?.['motif'] ?? null;
|
||||
let finalPayload: Record<string, any> = {
|
||||
let finalPayload = {
|
||||
...card.payload,
|
||||
date_debut: debut,
|
||||
date_fin: fin,
|
||||
@@ -361,39 +361,39 @@ export class CardsService {
|
||||
|
||||
if (card.type_code === 'soin_enfant') {
|
||||
const p = finalPayload;
|
||||
if (!p || !p?.sous_type || !p?.heure_releve) {
|
||||
if (!p || !p.sous_type || !p.heure_releve) {
|
||||
throw new BadRequestException('sous_type et heure_releve requis pour soin_enfant');
|
||||
}
|
||||
if (!/^([01]\d|2[0-3]):([0-5]\d)$/.test(p?.heure_releve)) {
|
||||
if (!/^([01]\d|2[0-3]):([0-5]\d)$/.test(p.heure_releve)) {
|
||||
throw new BadRequestException('Format heure_releve invalide (HH:mm)');
|
||||
}
|
||||
|
||||
if (p?.sous_type === 'fievre') {
|
||||
if (typeof p?.temperature_c !== 'number' || p?.temperature_c < 34.0 || p?.temperature_c > 43.0) {
|
||||
if (p.sous_type === 'fievre') {
|
||||
if (typeof p.temperature_c !== 'number' || p.temperature_c < 34.0 || p.temperature_c > 43.0) {
|
||||
throw new BadRequestException('temperature_c invalide (34.0 - 43.0)');
|
||||
}
|
||||
motif = `${p?.temperature_c.toFixed(1).replace('.', ',')} °C à ${p?.heure_releve}`;
|
||||
if (p?.medicament_donne && typeof p?.medicament_donne === 'string' && p?.medicament_donne.trim()) {
|
||||
motif += ` (Médicament : ${p?.medicament_donne.trim()})`;
|
||||
motif = `${p.temperature_c.toFixed(1).replace('.', ',')} °C à ${p.heure_releve}`;
|
||||
if (p.medicament_donne && typeof p.medicament_donne === 'string' && p.medicament_donne.trim()) {
|
||||
motif += ` (Médicament : ${p.medicament_donne.trim()})`;
|
||||
}
|
||||
} else if (p?.sous_type === 'bobo') {
|
||||
} else if (p.sous_type === 'bobo') {
|
||||
const natures = ['chute', 'coup', 'egratignure', 'piqure', 'brulure', 'autre'];
|
||||
if (!natures.includes(p?.bobo_nature)) {
|
||||
if (!natures.includes(p.bobo_nature)) {
|
||||
throw new BadRequestException('bobo_nature invalide');
|
||||
}
|
||||
motif = `Bobo (${p?.bobo_nature}) à ${p?.heure_releve}`;
|
||||
if (p?.description && typeof p?.description === 'string' && p?.description.trim()) {
|
||||
const desc = p?.description.trim();
|
||||
motif = `Bobo (${p.bobo_nature}) à ${p.heure_releve}`;
|
||||
if (p.description && typeof p.description === 'string' && p.description.trim()) {
|
||||
const desc = p.description.trim();
|
||||
if (desc.length > 120) throw new BadRequestException('description trop longue (max 120)');
|
||||
motif += ` : ${desc.length > 30 ? desc.substring(0, 30) + '...' : desc}`;
|
||||
}
|
||||
} else if (p?.sous_type === 'medicament') {
|
||||
if (!p?.medicament_nom || typeof p?.medicament_nom !== 'string' || !p?.medicament_nom.trim()) {
|
||||
} else if (p.sous_type === 'medicament') {
|
||||
if (!p.medicament_nom || typeof p.medicament_nom !== 'string' || !p.medicament_nom.trim()) {
|
||||
throw new BadRequestException('medicament_nom requis');
|
||||
}
|
||||
motif = `Médicament (${p?.medicament_nom.trim()}) à ${p?.heure_releve}`;
|
||||
if (p?.contexte && typeof p?.contexte === 'string' && p?.contexte.trim()) {
|
||||
if (p?.contexte.trim().length > 120) throw new BadRequestException('contexte trop long (max 120)');
|
||||
motif = `Médicament (${p.medicament_nom.trim()}) à ${p.heure_releve}`;
|
||||
if (p.contexte && typeof p.contexte === 'string' && p.contexte.trim()) {
|
||||
if (p.contexte.trim().length > 120) throw new BadRequestException('contexte trop long (max 120)');
|
||||
}
|
||||
} else {
|
||||
throw new BadRequestException('sous_type invalide pour soin_enfant');
|
||||
@@ -418,7 +418,7 @@ export class CardsService {
|
||||
await this.evenementsService.maj(userId, role, card.id_evenement, {
|
||||
date_debut: debut,
|
||||
date_fin: fin,
|
||||
motif: motif ? String(motif) : undefined,
|
||||
motif: motif ?? undefined,
|
||||
...(card.type_code !== 'soin_enfant' ? { statut: StatutEvenementAgendaType.EN_ATTENTE } : {}),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import {
|
||||
IsDateString,
|
||||
IsEnum,
|
||||
IsOptional,
|
||||
IsObject,
|
||||
IsString,
|
||||
IsUUID,
|
||||
MaxLength,
|
||||
@@ -52,7 +51,6 @@ export class CreerCarteDto {
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
payload?: Record<string, any>;
|
||||
}
|
||||
|
||||
@@ -88,7 +86,6 @@ export class MajCarteDto {
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
payload?: Record<string, any>;
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 202 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 217 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 137 KiB |
@@ -110,56 +110,11 @@ class CarteBulle {
|
||||
String? get dateDebut => payload['date_debut']?.toString();
|
||||
String? get dateFin => payload['date_fin']?.toString();
|
||||
String? get motif => payload['motif']?.toString();
|
||||
|
||||
/// Heure de relevé (payload soins), format API `HH:mm`.
|
||||
String? get heureReleve => payload['heure_releve']?.toString();
|
||||
|
||||
/// Heure affichable `18h19` (depuis `heure_releve`).
|
||||
String? get heureReleveAffichee {
|
||||
final h = heureReleve?.trim();
|
||||
if (h == null || h.isEmpty) return null;
|
||||
final parts = h.split(':');
|
||||
if (parts.length < 2) return h;
|
||||
return '${parts[0]}h${parts[1]}';
|
||||
}
|
||||
|
||||
/// Ligne détail soin (sans date/heure) — sous la ligne agenda.
|
||||
String? get detailSoin {
|
||||
|
||||
/// Helper pour extraire les informations de soin
|
||||
String? get resumerSoin {
|
||||
if (!isSoinEnfant) return null;
|
||||
final st = payload['sous_type']?.toString();
|
||||
if (st == 'fievre') {
|
||||
final t = payload['temperature_c'];
|
||||
final med = payload['medicament_donne']?.toString().trim();
|
||||
String? temp;
|
||||
if (t is num) {
|
||||
temp = t.toStringAsFixed(1).replaceAll('.', ',');
|
||||
} else if (t != null) {
|
||||
temp = t.toString().replaceAll('.', ',');
|
||||
}
|
||||
if (temp == null || temp.isEmpty) return motif;
|
||||
var s = '$temp °C';
|
||||
if (med != null && med.isNotEmpty) {
|
||||
s += ' (Médicament : $med)';
|
||||
}
|
||||
return s;
|
||||
}
|
||||
if (st == 'bobo') {
|
||||
final nature = payload['bobo_nature']?.toString() ?? 'bobo';
|
||||
final desc = payload['description']?.toString().trim();
|
||||
if (desc != null && desc.isNotEmpty) {
|
||||
return 'Bobo ($nature) : $desc';
|
||||
}
|
||||
return 'Bobo ($nature)';
|
||||
}
|
||||
if (st == 'medicament') {
|
||||
final nom = payload['medicament_nom']?.toString().trim();
|
||||
final ctx = payload['contexte']?.toString().trim();
|
||||
final label =
|
||||
(nom != null && nom.isNotEmpty) ? 'Médicament ($nom)' : 'Médicament';
|
||||
if (ctx != null && ctx.isNotEmpty) return '$label : $ctx';
|
||||
return label;
|
||||
}
|
||||
return motif;
|
||||
return payload['motif']?.toString();
|
||||
}
|
||||
|
||||
/// Motif de refus : réponse API, sinon motif payload (co-parent / reload).
|
||||
@@ -219,9 +174,9 @@ class CarteBulle {
|
||||
return 'assets/images/sac_lapin.png';
|
||||
case 'soin_enfant':
|
||||
final st = payload['sous_type']?.toString();
|
||||
if (st == 'fievre') return 'assets/images/thermo_verre.png';
|
||||
if (st == 'bobo') return 'assets/images/pansement.png';
|
||||
if (st == 'medicament') return 'assets/images/flacon.png';
|
||||
if (st == 'fievre') return 'assets/images/thermo_croix.png';
|
||||
if (st == 'medicament') return 'assets/images/cuillere.png'; // Using generic fallback or specific if added later. Assuming thermo_croix or similar could work.
|
||||
if (st == 'bobo') return 'assets/images/sac_lapin.png'; // Will adjust these later if better assets exist. Let's use generic ones for now, or null if no appropriate assets.
|
||||
return null;
|
||||
default:
|
||||
return null;
|
||||
|
||||
@@ -612,15 +612,12 @@ class _BulleTile extends StatelessWidget {
|
||||
}
|
||||
|
||||
String _fmtPeriodeUneLigne() {
|
||||
// Soin : « Le 08 octobre 2026 à 18h19 » (détail en italique sous la ligne).
|
||||
// Si c'est un soin_enfant en singleDay, on affiche juste "Le ..." ou un résumé si pertinent
|
||||
if (card.isSoinEnfant) {
|
||||
final jour = card.dateDebut != null
|
||||
? 'Le ${_fmtLong(card.dateDebut)}'
|
||||
: '';
|
||||
final h = card.heureReleveAffichee;
|
||||
if (jour.isEmpty) return h != null ? 'À $h' : '';
|
||||
if (h == null || h.isEmpty) return jour;
|
||||
return '$jour à $h';
|
||||
final resume = card.resumerSoin;
|
||||
final jour = card.dateDebut != null ? 'Le ${_fmtLong(card.dateDebut)}' : '';
|
||||
if (resume != null) return '$jour\n$resume';
|
||||
return jour;
|
||||
}
|
||||
|
||||
final d1 = DateTime.tryParse(card.dateDebut ?? '');
|
||||
@@ -726,6 +723,8 @@ class _BulleTile extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Text(
|
||||
periode,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: GoogleFonts.merienda(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -737,27 +736,14 @@ class _BulleTile extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
],
|
||||
if (card.isSoinEnfant &&
|
||||
(card.detailSoin?.trim().isNotEmpty ?? false)) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
card.detailSoin!,
|
||||
softWrap: true,
|
||||
style: GoogleFonts.merriweather(
|
||||
fontSize: 13,
|
||||
fontStyle: FontStyle.italic,
|
||||
height: 1.35,
|
||||
color: encre.ink,
|
||||
),
|
||||
),
|
||||
],
|
||||
if (card.isCongeAm &&
|
||||
card.statut == CarteStatut.refusee &&
|
||||
card.motifRefus != null) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Motif : ${card.motifRefus}',
|
||||
softWrap: true,
|
||||
maxLines: 4,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: GoogleFonts.merriweather(
|
||||
fontSize: 13,
|
||||
fontStyle: FontStyle.italic,
|
||||
|
||||
Reference in New Issue
Block a user