Skip to content

fix: refactore create blade#177

Merged
Bilaljanir merged 1 commit into
productionfrom
main
Apr 27, 2026
Merged

fix: refactore create blade#177
Bilaljanir merged 1 commit into
productionfrom
main

Conversation

@Bilaljanir
Copy link
Copy Markdown
Collaborator

No description provided.

@Bilaljanir Bilaljanir merged commit a9eded4 into production Apr 27, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the "Période et horaire" section of the form, updating the grid layout and separating the "Pauses" and "Jours d'école" sections into distinct blocks. The review feedback indicates that these changes break the reactivity of the Alpine.js component by narrowing its scope and removing shared state. It is recommended to move the projectHoursCalculator initialization to a higher-level container to ensure that all related fields, such as dates and school days, are correctly observed for calculations and validation.

<div class="grid grid-cols-1 md:grid-cols-2 gap-4" x-data="{
totalHours: {{ old('nombre_heures', '90') }}
}">
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The removal of the x-data object that previously held the totalHours state (line 242 in the original version) breaks the reactivity between the hour calculation and the planning section. The planning section (line 352) depends on this value for its calculations and validation. By removing this shared scope, the two sections are now decoupled, which will likely lead to incorrect data being submitted or validation errors in the UI. To maintain reactivity across all project-related fields (Dates, Hours, Pauses, and School Days), the projectHoursCalculator should be initialized at this level.

                            <div class="grid grid-cols-1 lg:grid-cols-2 gap-6" x-data="projectHoursCalculator()" x-init="init()">

</div>

<!-- Colonne 2: Horaires -->
<div x-data="projectHoursCalculator()" x-init="init()">
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The projectHoursCalculator component is now scoped only to the 'Horaire de travail' section. This is problematic because the calculation of total project hours typically requires data from the 'Dates', 'Pauses', and 'Jours d'école' sections, which are now outside this component's scope. This prevents the calculator from observing changes in those fields. If you move the x-data declaration to the parent container as suggested above, this local initialization should be removed to avoid redundant nested scopes.

                                <div>

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.

1 participant