Mandat : wizard création 4 étapes + boîte à outils élection

- Mandate model : champ origin (contexte/déclencheur) + migration
- MandateCreate schema : origin, starts_at, ends_at
- mandates/new.vue : wizard complet
  · Étape 1 : type · nom · origine · description · durée (relative ou dates)
  · Étape 2 : auto-désignation (ratification) ou désignation collective
  · Étape 3 : boîte à outils — sans/avec candidature, 6 modalités,
    paramètres configurables (durée, quorum, seuil, slider+input)
  · Étape 4 : récap + génération automatique des étapes du mandat
- Tous les boutons "Nouveau mandat" pointent vers /mandates/new
- decisions/new.vue : "Demander un mandat" → /mandates/new

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-04-24 05:29:13 +02:00
parent 1f92f153c5
commit 3ba9c43ce3
7 changed files with 1045 additions and 6 deletions
@@ -0,0 +1,24 @@
"""Add origin column to mandates table.
Revision ID: d91a3c7f8b02
Revises: c4e812fb3a01
Create Date: 2026-04-24 10:00:00.000000
"""
from __future__ import annotations
import sqlalchemy as sa
from alembic import op
revision = "d91a3c7f8b02"
down_revision = "c4e812fb3a01"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.add_column("mandates", sa.Column("origin", sa.Text(), nullable=True))
def downgrade() -> None:
op.drop_column("mandates", "origin")
+1
View File
@@ -12,6 +12,7 @@ class Mandate(Base):
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, default=uuid.uuid4) id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, default=uuid.uuid4)
title: Mapped[str] = mapped_column(String(256), nullable=False) title: Mapped[str] = mapped_column(String(256), nullable=False)
origin: Mapped[str | None] = mapped_column(Text) # contexte / déclencheur du mandat
description: Mapped[str | None] = mapped_column(Text) description: Mapped[str | None] = mapped_column(Text)
mandate_type: Mapped[str] = mapped_column(String(64), nullable=False) # techcomm, smith, custom mandate_type: Mapped[str] = mapped_column(String(64), nullable=False) # techcomm, smith, custom
status: Mapped[str] = mapped_column(String(32), default="draft") # draft, candidacy, voting, active, reporting, completed, revoked status: Mapped[str] = mapped_column(String(32), default="draft") # draft, candidacy, voting, active, reporting, completed, revoked
+5
View File
@@ -46,9 +46,12 @@ class MandateCreate(BaseModel):
"""Payload for creating a new mandate.""" """Payload for creating a new mandate."""
title: str = Field(..., min_length=1, max_length=256) title: str = Field(..., min_length=1, max_length=256)
origin: str | None = None
description: str | None = None description: str | None = None
mandate_type: str = Field(..., max_length=64, description="techcomm, smith, custom") mandate_type: str = Field(..., max_length=64, description="techcomm, smith, custom")
decision_id: UUID | None = None decision_id: UUID | None = None
starts_at: datetime | None = None
ends_at: datetime | None = None
class MandateUpdate(BaseModel): class MandateUpdate(BaseModel):
@@ -73,6 +76,7 @@ class MandateOut(BaseModel):
id: UUID id: UUID
title: str title: str
origin: str | None = None
description: str | None = None description: str | None = None
mandate_type: str mandate_type: str
status: str status: str
@@ -92,6 +96,7 @@ class MandateAdvanceOut(BaseModel):
id: UUID id: UUID
title: str title: str
origin: str | None = None
description: str | None = None description: str | None = None
mandate_type: str mandate_type: str
status: str status: str
+1 -1
View File
@@ -353,7 +353,7 @@ const confidenceLabel: Record<string, string> = {
Aucun mandat actif pour l'espace de travail sélectionné. Aucun mandat actif pour l'espace de travail sélectionné.
</p> </p>
<NuxtLink to="/mandates" class="mandate-request-btn"> <NuxtLink to="/mandates/new" class="mandate-request-btn">
<UIcon name="i-lucide-plus" /> <UIcon name="i-lucide-plus" />
Demander un mandat Demander un mandat
</NuxtLink> </NuxtLink>
+5 -5
View File
@@ -154,14 +154,14 @@ async function handleCreate() {
{{ opt.label }} {{ opt.label }}
</option> </option>
</select> </select>
<button <NuxtLink
v-if="auth.isAuthenticated" v-if="auth.isAuthenticated"
to="/mandates/new"
class="action-btn" class="action-btn"
@click="showCreateModal = true"
> >
<UIcon name="i-lucide-plus" class="text-xs" /> <UIcon name="i-lucide-plus" class="text-xs" />
<span>Nouveau</span> <span>Nouveau</span>
</button> </NuxtLink>
</template> </template>
<!-- Main content: mandates list --> <!-- Main content: mandates list -->
@@ -199,11 +199,11 @@ async function handleCreate() {
<div class="mandate-onboarding__actions"> <div class="mandate-onboarding__actions">
<UButton <UButton
v-if="auth.isAuthenticated" v-if="auth.isAuthenticated"
to="/mandates/new"
label="Créer un premier mandat" label="Créer un premier mandat"
icon="i-lucide-plus" icon="i-lucide-plus"
color="primary" color="primary"
size="sm" size="sm"
@click="showCreateModal = true"
/> />
<UButton <UButton
to="/protocols" to="/protocols"
@@ -290,7 +290,7 @@ async function handleCreate() {
:actions="[ :actions="[
{ label: 'Nouveau mandat', icon: 'i-lucide-plus', emit: 'create', primary: true }, { label: 'Nouveau mandat', icon: 'i-lucide-plus', emit: 'create', primary: true },
]" ]"
@action="e => e === 'create' && (showCreateModal = true)" @action="e => e === 'create' && navigateTo('/mandates/new')"
/> />
<!-- Révocation --> <!-- Révocation -->
File diff suppressed because it is too large Load Diff
+2
View File
@@ -20,6 +20,7 @@ export interface MandateStep {
export interface Mandate { export interface Mandate {
id: string id: string
title: string title: string
origin: string | null
description: string | null description: string | null
mandate_type: string mandate_type: string
status: string status: string
@@ -34,6 +35,7 @@ export interface Mandate {
export interface MandateCreate { export interface MandateCreate {
title: string title: string
origin?: string | null
description?: string | null description?: string | null
mandate_type: string mandate_type: string
decision_id?: string | null decision_id?: string | null