feat: drag-and-drop entries across days and editable date in entry modal#198
Merged
Conversation
- Edit modal: new Date dropdown constrained to the current week; modal title reacts to the selection. Saving a new date moves the entry to that day. - Weekly view: time entries are draggable between day columns when the timesheet is open; target column highlights on hover. - Service: add moveEntryDate() that writes hours to the new date then zeros the old date (BC has no first-class date field on a detail). Same-line conflicts on the target date are merged (sum of hours). - Both behaviors are gated by the existing canEdit / isTimesheetEditable check, so locked timesheets stay read-only. Closes #194 Closes #195 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds the ability to reassign time entries to different days within the current week, via both a Date selector in the entry modal and HTML5 drag-and-drop in the weekly grid. This builds on the existing Business Central timesheet-line + date-detail model by introducing a dedicated “move date” mutation and refreshing client state from the service cache after moves.
Changes:
- Added
timeEntryService.moveEntryDate(entryId, newDate)plus a cache-to-entries helper to refresh UI state after merges. - Wired a new
moveEntryDateaction into the Zustand time entries store. - Updated weekly timesheet UI to support drag/drop across day columns and updated the modal to allow changing an entry’s date within the week.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/services/bc/timeEntryService.ts | Adds moveEntryDate (including same-line merge behavior) and getCachedEntries for post-mutation refresh. |
| src/hooks/useTimeEntriesStore.ts | Exposes moveEntryDate in the store and refreshes entries from the service cache after moves. |
| src/components/timesheet/WeeklyTimesheet.tsx | Plumbs onMoveEntry into day cells and passes weekStart to the modal. |
| src/components/timesheet/TimeEntryModal.tsx | Adds an in-week Date dropdown and triggers move+update flow when editing entries. |
| src/components/timesheet/TimeEntryCell.tsx | Implements HTML5 drag-and-drop source/target behavior with drop-target highlighting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When editing an entry and changing the date, moveEntryDate may merge with an existing detail on the same timesheet line at the target date (sum of hours). The follow-up updateEntry call was unconditionally writing the form's hours to that date, overwriting the merged total. Only forward fields the user actually changed; if only the date changed, skip the updateEntry call entirely so the merge result stands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
BenGWeeks
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
isTimesheetEditablecheck, so locked/submitted/approved timesheets stay read-only.moveEntryDate(entryId, newDate): writes hours to the new date, then zeros the old one (BC details key on line+date). Same-line conflicts on the target date are merged (hours sum).Test plan
Fixes #194
Fixes #195
🤖 Generated with Claude Code