Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] Ajout d'un bouton de validation du Diagnostic pour une projet #932

Merged
merged 12 commits into from
Jan 20, 2025

Conversation

Jeremy-Bojko
Copy link
Collaborator

Il s'agit de :

  • Une correction de bug
  • Une nouvelle fonctionnalité programmée
  • Une nouvelle fonctionnalité spontanée

Décrivez vos changements

Ajout d'une partie diagnostic dans la présentation d'un projet, uniquement pour les membres du staff.

Resolve #852

Checklist d'acceptation de revue de code

  • Aucun texte ne fait référence à du vocabulaire spécifique d'un métier
  • Mon code est auto-documenté ou la documentation a été mise à jour/créée
  • La gestion du multi-portail a été prise en compte
  • L'accessibilité a été prise en compte
  • Pre-commit est configuré et a été lancé
  • Des tests couvrant le code changé ont été ajoutés/modifiés
  • L'ensemble des tests front et back sont au vert

Demandes

  • Je souhaite un déploiement en préproduction

@Jeremy-Bojko Jeremy-Bojko requested a review from etchegom January 16, 2025 10:27
@Jeremy-Bojko
Copy link
Collaborator Author

@etchegom J'ai fait une modification dans le model du projet (ajout de l'attribut is_diagnostic_done) pourrais-tu vérifier le model ainsi que la migration s'il te plait ?

Comment on lines 91 to 107
<div x-data="MarkDiagAsDone({{ request.user.id }}, {{ project.id }}, '{{ project.is_diagnostic_done }}' == 'True')">
<header>
<h6 class="font-small text-uppercase fr-mb-1v">Diagnostic</h6>
</header>
<template x-if="displayDiagButton">
<button class="fr-btn fr-btn--sm fr-btn--secondary fr-mt-2w fr-py-2w fr-mb-2w text-uppercase w-100 justify-content-center"
@click='handleClickMarkDiagAsDone'
data-cy="button-diag-project-done">
<span class="fr-icon-double-check-line" aria-hidden="true"></span> Marquer l’appel de “diagnostic” comme fait
</button>
</template>
<template x-if="!displayDiagButton">
<p class="fw-700 fr-my-1w" data-cy="diag-project-done">
<span class="fr-icon-double-check-line" aria-hidden="true"></span> Appel de "diagnostic" effectué
</p>
</template>
</div>
Copy link
Collaborator

@etchegom etchegom Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A titre d'exemple, avec htmx, on pourrait se passer de créer le fichier MarkDiagAsDone.js.
Ca donnerait qq chose comme ça (non testé):

<div x-data="{displayDiagButton: false}">
    <header>
        <h6 class="font-small text-uppercase fr-mb-1v">Diagnostic</h6>
    </header>
    <template x-if="displayDiagButton">
        <button class="fr-btn fr-btn--sm fr-btn--secondary fr-mt-2w fr-py-2w fr-mb-2w text-uppercase w-100 justify-content-center"
                data-cy="button-diag-project-done"
                hx-put={% url 'projects-project-detail' project.id %}
                hx-vals='{"is_diagnostic_done": true}'
                hx-on::after-request="displayDiagButton = true">
            <span class="fr-icon-double-check-line" aria-hidden="true"></span> Marquer lappel dediagnosticcomme fait
        </button>
    </template>
    <template x-if="!displayDiagButton">
        <p class="fw-700 fr-my-1w" data-cy="diag-project-done">
            <span class="fr-icon-double-check-line" aria-hidden="true"></span> Appel de "diagnostic" effectué
        </p>
    </template>
</div>

Doc: https://htmx.org/events/#htmx:afterRequest

is_diagnostic_done: true,
});
if (response.status !== 200) {
throw new Error('Error while marking the diag as done');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ca envoie un message dans sentry quand on raise une erreur?

Copy link
Collaborator

@etchegom etchegom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@glibersat glibersat merged commit 2a812a9 into develop Jan 20, 2025
4 checks passed
@glibersat glibersat deleted the feat/add-btn-diagnostic#852 branch January 20, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ETQ staff, je peux indiquer depuis la Présentation que le diag a été réalisé
4 participants