forked from yvv/decision
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:
@@ -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")
|
||||
@@ -12,6 +12,7 @@ class Mandate(Base):
|
||||
|
||||
id: Mapped[uuid.UUID] = mapped_column(Uuid, primary_key=True, default=uuid.uuid4)
|
||||
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)
|
||||
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
|
||||
|
||||
@@ -46,9 +46,12 @@ class MandateCreate(BaseModel):
|
||||
"""Payload for creating a new mandate."""
|
||||
|
||||
title: str = Field(..., min_length=1, max_length=256)
|
||||
origin: str | None = None
|
||||
description: str | None = None
|
||||
mandate_type: str = Field(..., max_length=64, description="techcomm, smith, custom")
|
||||
decision_id: UUID | None = None
|
||||
starts_at: datetime | None = None
|
||||
ends_at: datetime | None = None
|
||||
|
||||
|
||||
class MandateUpdate(BaseModel):
|
||||
@@ -73,6 +76,7 @@ class MandateOut(BaseModel):
|
||||
|
||||
id: UUID
|
||||
title: str
|
||||
origin: str | None = None
|
||||
description: str | None = None
|
||||
mandate_type: str
|
||||
status: str
|
||||
@@ -92,6 +96,7 @@ class MandateAdvanceOut(BaseModel):
|
||||
|
||||
id: UUID
|
||||
title: str
|
||||
origin: str | None = None
|
||||
description: str | None = None
|
||||
mandate_type: str
|
||||
status: str
|
||||
|
||||
@@ -353,7 +353,7 @@ const confidenceLabel: Record<string, string> = {
|
||||
Aucun mandat actif pour l'espace de travail sélectionné.
|
||||
</p>
|
||||
|
||||
<NuxtLink to="/mandates" class="mandate-request-btn">
|
||||
<NuxtLink to="/mandates/new" class="mandate-request-btn">
|
||||
<UIcon name="i-lucide-plus" />
|
||||
Demander un mandat
|
||||
</NuxtLink>
|
||||
|
||||
@@ -154,14 +154,14 @@ async function handleCreate() {
|
||||
{{ opt.label }}
|
||||
</option>
|
||||
</select>
|
||||
<button
|
||||
<NuxtLink
|
||||
v-if="auth.isAuthenticated"
|
||||
to="/mandates/new"
|
||||
class="action-btn"
|
||||
@click="showCreateModal = true"
|
||||
>
|
||||
<UIcon name="i-lucide-plus" class="text-xs" />
|
||||
<span>Nouveau</span>
|
||||
</button>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
||||
<!-- Main content: mandates list -->
|
||||
@@ -199,11 +199,11 @@ async function handleCreate() {
|
||||
<div class="mandate-onboarding__actions">
|
||||
<UButton
|
||||
v-if="auth.isAuthenticated"
|
||||
to="/mandates/new"
|
||||
label="Créer un premier mandat"
|
||||
icon="i-lucide-plus"
|
||||
color="primary"
|
||||
size="sm"
|
||||
@click="showCreateModal = true"
|
||||
/>
|
||||
<UButton
|
||||
to="/protocols"
|
||||
@@ -290,7 +290,7 @@ async function handleCreate() {
|
||||
:actions="[
|
||||
{ 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 -->
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,7 @@ export interface MandateStep {
|
||||
export interface Mandate {
|
||||
id: string
|
||||
title: string
|
||||
origin: string | null
|
||||
description: string | null
|
||||
mandate_type: string
|
||||
status: string
|
||||
@@ -34,6 +35,7 @@ export interface Mandate {
|
||||
|
||||
export interface MandateCreate {
|
||||
title: string
|
||||
origin?: string | null
|
||||
description?: string | null
|
||||
mandate_type: string
|
||||
decision_id?: string | null
|
||||
|
||||
Reference in New Issue
Block a user