WIP: development_backend #4

Draft
MahmoudEmad wants to merge 26 commits from development_backend into main

26 Commits

Author SHA1 Message Date
Mahmoud-Emad
7e95391a9c feat: Refactor governance models and views
- Moved governance models (`Vote`, `VoteType`, `VotingResults`) from
  `models/governance.rs` to `controllers/governance.rs` for better
  organization and to avoid circular dependencies.  This improves
  maintainability and reduces complexity.
- Updated governance views to use the new model locations.
- Added a limit to the number of recent activities displayed on the
  dashboard for performance optimization.
2025-06-03 15:31:50 +03:00
Mahmoud-Emad
9802d51acc feat: Migrate to hero-models for calendar event data
- Replaced custom `CalendarEvent` model with `heromodels`' `Event` model.
- Updated database interactions and controller logic to use the new model.
- Removed unnecessary `CalendarEvent` model and related code.
- Updated views to reflect changes in event data structure.
2025-06-03 15:12:53 +03:00
Mahmoud-Emad
2299b61e79 feat: Enhance calendar display of all-day events
- Improve display of all-day events by adding a message
  indicating when there are no all-day events scheduled.
- Add visual improvements to all-day event display using
  bootstrap classes.
- Clarify messaging when there are no events scheduled for a
  given day.
2025-05-29 14:17:48 +03:00
Mahmoud-Emad
b8928379de feat: Fix timezone issues in event creation
- Correctly handle timezones when creating events, ensuring that
  start and end times are accurately represented regardless of the
  user's timezone.
- Add 1-day compensation to event times to handle timezone shifts
  during conversion to UTC.
- Improve default time setting for date-specific events.
2025-05-29 14:07:03 +03:00
Mahmoud-Emad
45c4f4985e feat: Enhance calendar display and event management
- Improve event display: Show only the first two events for each day
  in the calendar, with a "+X more" link to show the rest.
- Add event details modal:  Allows viewing and deleting events.
- Enhance event creation modal: Improve user experience and add color
  selection for events.
- Improve year view: Show the number of events for each month.
- Improve day view: Display all day events separately.
- Improve styling and layout: Enhance the visual appeal and
  responsiveness of the calendar.
2025-05-28 16:59:24 +03:00
Mahmoud-Emad
58d1cde1ce feat: Migrate calendar functionality to a database
- Replaced Redis-based calendar with a database-backed solution
- Implemented database models for calendars and events
- Improved error handling and logging for database interactions
- Added new database functions for calendar management
- Updated calendar views to reflect the database changes
- Enhanced event creation and deletion processes
- Refined date/time handling for better consistency
2025-05-28 15:48:54 +03:00
Mahmoud-Emad
d815d9d365 feat: Add custom Tera filters for date/time formatting
- Add three new Tera filters: `format_hour`, `extract_hour`, and
  `format_time` for flexible date/time formatting in templates.
- Improve template flexibility and maintainability by allowing
  customizable date/time display.
- Enhance the user experience with more precise date/time rendering.
2025-05-28 10:43:02 +03:00
Mahmoud-Emad
2827cfebc9 refactor: Rename proposals module to governance
The `proposals` module has been renamed to `governance` to better
reflect its purpose and content.  This improves code clarity and
consistency.

- Renamed the `proposals` module to `governance` throughout the
  project to reflect the broader scope of governance features.
- Updated all related imports and function calls to use the new
  module name.
2025-05-28 09:29:19 +03:00
Mahmoud-Emad
7b15606da5 refactor: Remove unnecessary debug print statements
- Removed several `println!` statements from the `governance`
  controller and `proposals` database module to improve code
  cleanliness and reduce unnecessary console output.
- Updated the `all_activities.html` template to use the
  `created_at` field instead of `timestamp` for activity dates.
- Updated the `index.html` template to use the `created_at`
  field instead of `timestamp` for activity timestamps.
- Added `#[allow(unused_assignments)]` attribute to the
  `create_activity` function in `proposals.rs` to suppress a
  potentially unnecessary warning.
2025-05-28 09:24:56 +03:00
Mahmoud-Emad
11d7ae37b6 feat: Enhance governance module with activity tracking and DB refactor
- Refactor database interaction for proposals and activities.
- Add activity tracking for proposal creation and voting.
- Improve logging for better debugging and monitoring.
- Update governance views to display recent activities.
- Add strum and strum_macros crates for enum handling.
- Update Cargo.lock file with new dependencies.
2025-05-27 20:45:30 +03:00
Mahmoud-Emad
70ca9f1605 feat: Enhance governance dashboard with activity tracking
- Add governance activity tracker to record user actions.
- Display recent activities on the governance dashboard.
- Add a dedicated page to view all governance activities.
- Improve header information and styling across governance pages.
- Track proposal creation and voting activities.
2025-05-25 16:02:34 +03:00
Mahmoud-Emad
d12a082ca1 feat: Enhance Governance Controller and Proposal Handling
- Improve proposal search to include description field: This
  allows for more comprehensive search results.
- Fix redirect after voting: The redirect now correctly handles
  the success message.
- Handle potential invalid timestamps in ballots: The code now
  gracefully handles ballots with invalid timestamps, preventing
  crashes and using the current time as a fallback.
- Add local time formatting function:  This provides a way to
  display dates and times in the user's local timezone.
- Update database path: This simplifies the database setup.
- Improve proposal vote handling: Addresses issues with vote
  submission and timestamping.
- Add client-side pagination and filtering to proposal details:
  Improves user experience for viewing large vote lists.
2025-05-25 10:48:02 +03:00
Mahmoud-Emad
97e7a04827 feat: Add pagination and filtering improvements to proposal votes
- Added pagination to the proposal votes table to improve usability
  with large datasets.
- Implemented client-side filtering of votes by type and search
  terms, enhancing the user experience.
- Improved the responsiveness and efficiency of the vote filtering
  and pagination.
2025-05-22 17:13:52 +03:00
Mahmoud-Emad
3d8aca19cc feat: Improve user experience after voting on proposals
- Redirect users to the proposal detail page with a success
  message after a successful vote, improving feedback.
- Automatically remove the success message from the URL after a
  short time to avoid URL clutter and maintain a clean browsing
  experience.
- Add a success alert message on the proposal detail page to
  provide immediate visual confirmation of a successful vote.
- Improve the visual presentation of the votes list on the
  proposal detail page by adding top margin for better spacing.
2025-05-22 17:05:26 +03:00
Mahmoud-Emad
52fbc77e3e feat: Enhance proposal creation and display
- Improve proposal creation form with input validation and
  default date settings for a better user experience.
- Add context variables to the proposals template for
  consistent display across governance pages.
- Enhance proposal detail page with visual improvements,
  voting results display, and user voting functionality.
- Add styles for better visual presentation of proposal details
  and voting information.
2025-05-22 16:31:11 +03:00
Mahmoud-Emad
fad288f67d feat: Add total vote counts to governance views
- Add functionality to calculate total yes, no, and abstain votes
  across all proposals. This provides a summary of community
  voting patterns on the governance page.
- Improve the user experience by displaying total vote counts
  prominently on the "My Votes" page. This gives users a quick
  overview of the overall voting results.
- Enhance the "Create Proposal" page with informative guidelines
  and a helpful alert to guide users through the proposal creation
  process.  This improves clarity and ensures proposals are well-
  structured.
2025-05-22 16:08:12 +03:00
Mahmoud-Emad
4659697ae2 feat: Add filtering and searching to governance proposals page
- Added filtering of proposals by status (Draft, Active, Approved, Rejected, Cancelled).
- Added searching of proposals by title and description.
- Improved UI to persist filter and search values.
- Added a "No proposals found" message for better UX.
2025-05-22 15:47:11 +03:00
Mahmoud-Emad
67b80f237d feat: Enahnced the dashboard 2025-05-21 18:01:22 +03:00
Mahmoud-Emad
b606923102 feat: Finish the proposal dashboard 2025-05-21 15:56:47 +03:00
Mahmoud-Emad
8f1438dc01 feat: Remove mock proposals 2025-05-21 15:43:17 +03:00
Mahmoud-Emad
916f435dbc feat: Load voting 2025-05-21 15:04:45 +03:00
Mahmoud-Emad
5d9eaac1f8 feat: Implemented submit vote 2025-05-21 13:49:20 +03:00
Mahmoud-Emad
9c71c63ec5 feat: Working on the propsal page:
- Integerated the view proposal detail db call
- Use real data instead of mock data
2025-05-21 12:21:38 +03:00
Mahmoud-Emad
4a2f1c7282 feat: Implement Proposals page:
- Added the create new proposal functionality
- Added the list all proposals functionnality
2025-05-21 11:44:06 +03:00
Mahmoud Emad
60198dc2d4 fix: Remove warnings 2025-05-18 09:48:28 +03:00
Mahmoud Emad
e4e403e231 feat: Integerated the DB:
- Added an initialization with the db
- Implemented 'add_new_proposal' function to be used in the form
2025-05-18 09:07:59 +03:00