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

Updates for delivery form #173

Open
5 tasks
delano opened this issue Jun 27, 2024 · 0 comments · May be fixed by #174
Open
5 tasks

Updates for delivery form #173

delano opened this issue Jun 27, 2024 · 0 comments · May be fixed by #174
Assignees
Labels
enhancement ux User experience

Comments

@delano
Copy link
Contributor

delano commented Jun 27, 2024

Description

The current delivery form for the animal food bank needs several updates to improve user experience and data collection. These changes will help streamline the delivery process and provide more accurate information for our volunteers and recipients.

Proposed Changes

  1. Add a field for preferred delivery time (morning, afternoon, evening)
  2. Include a dropdown menu for selecting the type of pet food needed (dog, cat, small animal, etc.)
  3. Implement address validation to ensure accurate delivery locations
  4. Add a checkbox for recurring deliveries
  5. Include a section for special instructions or notes

Tasks

  • Update HTML structure of the form
  • Modify CSS styling to accommodate new fields
  • Implement JavaScript for address validation
  • Update backend to process and store new form data
  • Test form functionality across different devices and browsers

Benefits

  • Improved user experience for recipients
  • More efficient routing for delivery volunteers
  • Better data collection for inventory management
  • Reduced errors in delivery addresses
@delano delano added enhancement ux User experience labels Jun 27, 2024
@delano delano self-assigned this Jun 27, 2024
@delano delano moved this from 🆕 Triage to 🏗 In progress in AFB Requests MVP - June 2024 Jun 27, 2024
delano added a commit that referenced this issue Jun 27, 2024
ALso consistent nav toolbar
delano added a commit that referenced this issue Jun 27, 2024
model

- Introduce `latitude`, `longitude`, `delivery_radius` fields to Branch
model
- Migrate database to accommodate new fields
- Update branch fixtures with default delivery radius
- Extend PhysicalLocationSerializerMixin with `instructions` field
- Refine field length constraints for address serializer fields

This change enables tracking branch location coordinates and delivery
range. It supports upcoming functionality for location-based branch
discovery and delivery request mapping. The serializer updates align
field lengths with typical use cases.
delano added a commit that referenced this issue Jun 27, 2024
This change enhances the food request form by introducing a new optional
textarea field for users to provide delivery instructions. Key benefits
include:

- Allowing users to specify additional details like buzz codes, suite
numbers, etc. to facilitate smoother deliveries
- Improving the overall user experience by accommodating diverse address
formats and delivery scenarios
- Potentially reducing delivery delays or failed attempts due to missing
information

The new field is rendered alongside the existing building type field,
maintaining a clean and intuitive layout. Corresponding changes have
been made to the data model and TypeScript type definitions to support
this new attribute.
delano added a commit that referenced this issue Jun 27, 2024
delano added a commit that referenced this issue Jun 27, 2024
delano added a commit that referenced this issue Jun 27, 2024
delano added a commit that referenced this issue Jun 27, 2024
API

- Enable CRUD operations on Branch model through Django admin interface
- Implement BranchViewSet to expose Branch data through API endpoints
- Add BranchSerializer to handle Branch model
serialization/deserialization
- Configure filtering, searching, and ordering for Branch API endpoints
- Enhance admin UI with previews, filtering, and form customizations

This change equips the application with comprehensive tooling to manage
Branch data, allowing administrators to create, update, and maintain
branch information through the admin interface. It also exposes this
data to client applications via a RESTful API, enabling efficient
retrieval, filtering, and manipulation of branch details. Additionally,
the admin UI has been enhanced with previews, filters, and form
customizations for an improved user experience when managing branches.
delano added a commit that referenced this issue Jun 28, 2024
delano added a commit that referenced this issue Jun 28, 2024
delano added a commit that referenced this issue Jun 28, 2024
From nuxt start-time warnings

Signed-off-by: delano <[email protected]>
delano added a commit that referenced this issue Jun 28, 2024
delano added a commit that referenced this issue Jun 28, 2024
This github issue explains the problem and the solution in
high fidelity, particularly this comment from ayalon:
nuxt/nuxt#27558 (comment)

The comment from danielroe a few messages down indicates that the
next release of nuxi-cli will have the fix (current 3.12.0).
https://vitejs.dev/config/server-options#server-hmr
delano added a commit that referenced this issue Jun 28, 2024
birth year range and general notes.

In this commit, several improvements are made to the pet details section
of the food request form:

- The birth year field now dynamically generates a range of years from
1980 up to the current year, instead of a hardcoded list
- A new "General Notes" field is added to allow users to provide
additional information about their pets
- The "Usual Brands" field is removed, as it was deemed unnecessary

These changes aim to enhance the user experience and gather more
relevant information about the pets, facilitating better service
delivery.

Considerations:
- The birth year range may need adjusting if pets older than 1980 need
to be accommodated
- Character limits are imposed on the general notes field to prevent
excessive input
delano added a commit that referenced this issue Jun 28, 2024
- Utilize model utilities like AutoCreatedField and
AutoLastModifiedField
- Add "details" JSONField to store additional data for models
- Add "is_removed" flag to soft-delete models instead of hard deletion
- Replace hard-coded UUID default with UUIDField for Delivery model
- Enhance model mixins with HasDetailsMixin for uniform details handling

This change introduces several improvements to the data models:

1. Leverages Django model utilities like `AutoCreatedField` and
`AutoLastModifiedField` to automatically track creation and modification
timestamps.

2. Adds a `details` JSONField to multiple models, allowing storage of
arbitrary metadata without schema changes.

3. Introduces an `is_removed` flag for soft-deletion of records instead
of permanent removal.

4. Replaces hard-coded UUID defaults with Django's `UUIDField` for the
`Delivery` model.

5. Enhances model mixins with `HasDetailsMixin` for consistent handling
of details across models.

These changes enhance data integrity, provide more flexibility for
future requirements, and align with best practices for Django model
design.
delano added a commit that referenced this issue Jun 28, 2024
Further details:

- Configures Gunicorn as the WSGI server for running the Django API
- Sets up worker processes, worker class (gthread for I/O and CPU
workloads), logging, and other server options
- Includes hook functions for on_starting, on_reload, on_exit events
- Implements custom when_ready and worker_abort handlers

Rationale:

- Gunicorn provides a lean, robust production-grade HTTP server for
serving Django apps efficiently
- Threading configuration balances performance for mixed I/O and CPU
workloads typical of web apps
- Hooks allow custom logic during server lifecycle events
- Proper configuration is essential for optimized performance and
resource utilization in production
delano added a commit that referenced this issue Jun 29, 2024
- Default branch filter shows only operational branches
- Branch selection updates Google Maps autocomplete bounds
- Minor code cleanup and refactoring

This change enhances the user experience when creating a new food
request by:

1. Hiding non-operational branches from the branch selection dropdown by
default. This prevents confusion and ensures users only select from
available options.

2. Updating the Google Maps autocomplete bounds when a branch is
selected from the dropdown. This focuses the address search area around
the chosen branch, providing more relevant address suggestions.

3. Removing unused code and comments, improving code readability and
maintainability.

Overall, these changes streamline the food request creation process,
guide users to relevant choices, and improve the quality of the
codebase.
delano added a commit that referenced this issue Jun 30, 2024
delano added a commit that referenced this issue Jun 30, 2024
And store the place_id and Place object details.
delano added a commit that referenced this issue Jun 30, 2024
delano added a commit that referenced this issue Jun 30, 2024
delano added a commit that referenced this issue Jun 30, 2024
Body:
- Decrease `TOKEN_EXPIRED_AFTER_WEEKS` setting from 2 to 1 week for
improved security
- Add Django RunServerPlus configuration:
- Set `RUNSERVER_PLUS_PRINT_SQL_TRUNCATE` to 1000 for better SQL query
logging
- Use `RUNSERVERPLUS_POLLER_RELOADER_TYPE='stat'` for efficient file
watching
- Exclude common files/directories from being watched to improve
performance
delano added a commit that referenced this issue Jun 30, 2024
delano added a commit that referenced this issue Jun 30, 2024
In the DeliveryInfoForm component, the phone number validation is
updated to accept empty values but require a minimum of 10 digits if
provided. Additionally, form fields in FoodRequestForm are now
prepopulated with user profile information stored in Vuex, including:

- Branch location
- Preferred name
- Email address
- Phone number (which is now read-only to encourage updating in the
profile)

This streamlines the request submission process by utilizing existing
user data, while still allowing updates. The commit also includes minor
refactoring and console logging cleanups.
delano added a commit that referenced this issue Jun 30, 2024
delano added a commit that referenced this issue Jun 30, 2024
- Extract branch location change handler for clarity
- Move branch location initialization logic to onMounted
- Import clientPetsSchema dynamically based on default pet data
- Add TODOs for implementing summary step functionality
delano added a commit that referenced this issue Jun 30, 2024
Which would nagivate to the next step in the formset, but not actually
select the autocompleted value.
delano added a commit that referenced this issue Jun 30, 2024
- Allow editing and saving changes to pet details
- Add default example pet to provide guidance
- Refactor submission handling to match API requirements
- Enhance validation and UI feedback on form state

The client pet details form has been updated to enable editing and
persisting changes to a user's pet information. Key enhancements
include:

- Introducing a default example pet to guide users on expected input
format
- Refactoring form submission to match API payload requirements for pet
details
- Enhancing form validation with better error handling and success
feedback
- Improving UI with consistent styling and better guidance for input
fields
delano added a commit that referenced this issue Jun 30, 2024
delano added a commit that referenced this issue Jun 30, 2024
delano added a commit that referenced this issue Jun 30, 2024
delano added a commit that referenced this issue Jul 1, 2024
delano added a commit that referenced this issue Jul 1, 2024
w/ a few fixes that were discovered during the process
delano added a commit that referenced this issue Jul 1, 2024
delano added a commit that referenced this issue Jul 1, 2024
Implement the following changes:

- Convert `pet_type` values to lowercase on save in `Pet` model
- Order `Profile` objects by creation date, oldest first
- Add `get_default_profile()` method to `User` model
- Allow reconciling pets for a profile via `reconcile_pets` action
- Refine `PetsForm` component and client pet schema

Rationale:

- Ensure consistent `pet_type` values by converting to lowercase
- Order profiles by creation date to determine the "main" profile easily
- Provide a convenient method to retrieve the default/first profile
- Enable synchronizing pet data between client and server efficiently
- Improve form UI and validation for better user experience

Benefits:

- Data integrity and consistency
- Intuitive profile ordering and retrieval
- Streamlined pet data management
- Enhanced form usability and validation
delano added a commit that referenced this issue Jul 1, 2024
- Add `spay_or_neutered` boolean field to `Pet` model to track pet's
spay/neuter status
- Add `animal_details` JSONField to `Pet` model for storing additional
animal-specific details
- Order `Profile` instances by creation date
- Order `DeliveryRegion` instances alphabetically by name

This allows tracking important pet health information and additional
animal details in a flexible JSON format. Ordering `Profile` and
`DeliveryRegion` instances provides a more logical default sorting.
delano added a commit that referenced this issue Jul 1, 2024
- Improve form layout and styling with larger inputs, tabs, and card-like sections
- Change pet type options to lowercase ("dog", "cat", etc.)
- Add creation and modification dates to PetInfo model
- Refactor spay/neuter field to boolean type
- Consolidate animal-specific details under "animal_details" object
- Enhance pets list with sorting, reordering, and easier adding/removal
- Disable save button until form is modified to prevent accidental submissions
- Handle form validation and show focused error on unsuccessful submit
delano added a commit that referenced this issue Jul 1, 2024
…ellation

- Allow adding pets in PetsForm only if user has none
- Display pet details in FoodRequestForm without controls
- Add cancel button in PetsForm to navigate back
- Update clientPetsSchema to accept beforeText param
- Add custom Tailwind color for cancel button styling
- Apply 'afbcore-form' class to Vueform instances

Key changes:

- PetsForm:
  - Conditionally render pet add/remove controls based on user's existing pets
  - Add cancel button to navigate back
  - Style cancel button with custom Tailwind color
- FoodRequestForm: Display existing user pets without add/remove controls
- clientPetsSchema: Accept beforeText param to customize instructions
- Tailwind config: Add custom 'custom-cancel' color
- Vueform config: Apply 'afbcore-form' class to all Vueform instances

The updates enhance user experience by tailoring pet management based on existing data, providing clearer instructions, and offering cancellation in relevant forms.
delano added a commit that referenced this issue Jul 1, 2024
delano added a commit that referenced this issue Jul 1, 2024
Long description:

1. The `FoodRequestForm.vue` component now stores the entire food
request form data in the `details` field when submitting to the API.
This change aims to facilitate debugging by providing a complete
snapshot of the form data received by the backend.

2. In `food_request_serializer.py`, the `details` field has been added
to the list of serialized fields for the
`AbstractFoodRequestSerializer`.

3. The `contact_phone` and `contact_email` fields in the `FoodRequest`
model have been made nullable by setting `null=True`. This change allows
for cases where the contact information is not provided.

4. The `DeliveryContactSerializer` in `food_request_serializer.py` now
includes additional fields for alternative contact information:
`alt_contact_name`, `alt_contact_phone`, and `alt_contact_email`.

By storing the complete form data, any issues or discrepancies between
the frontend and backend can be more easily investigated and resolved,
improving the overall debugging experience.
delano added a commit that referenced this issue Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ux User experience
Projects
Status: 🏗 In progress
1 participant