Hi all,
I'm new to Yii and learning based on Larry's work-in-progress book and the online resources.
I'm doing some work for a non-profit as my first Yii project and trying to create an event reservation app for them using Yii.
Here's a "working" demo of the form I am working with:
http://dev.inglouriousdesigners.com/aers/index.php/Reservation/create?eventRecord=6
Just to give some background data, the relationships look like this. I left out some fields for the sake of brevity.
tbl_event (Event model)
event_id (pk)
title
descr
.....
tbl_reservation
reservation_id (pk)
event_record_id (fk --> eventRecord->event_record_id)
cust_name
cust_address1
visitor_count (sum of ticket count)
txn_amount (dollar amount of ticketcount*(rate) for each rate selection)
<snipped additional fields -- see form>
tbl_reservation_detail
reservation_detail_id (pk)
reservation_id (fk --> tbl_reservation->reservation_id)
rate_id (fk --> tbl_rate-->rate_id)
quantity (count of tickets of type rate_id)
tbl_event_record (EventRecord model)
event_record_Id (pk)
event_id (fk --> event->event_id)
start_datetime
end_datetime
max_occupancy (Max # of visitors for this time slot.)
reserved_occupancy (Currently reserved spots for this eventRecord.)
...
tbl_rate
rate_id (pk)
event_id (fk --> event->event_id)
rate_class_id (fk --> rateClass->rate_class_id)
amount
...
tbl_rate_class
rate_class_id (pk)
descr (Description of rate class ex: "Adult", "Child" "Senior Citizen")
...
What I'm working on is the Reservation/Create action as shown on this demo page:
http://dev.inglouriousdesigners.com/aers/index.php/Reservation/create?eventRecord=6
I can save customer information to the Reservation model (except txn amount and visitor count). That was easy..
What I want to implement is this:
On the form in the "Ticket Information" section, change this to a cGridView (or similar) to show
Rate Class (rateClass->descr) Cost (rate->amount) Desired Tickets
Adult 10.00 (dropdown list)
Child 9.00 (dropdown list)
Member 5.00 (dropdown list)
Senior citizen 5.00 (dropdown list)
Then, below that, show:
Total Tickets: ___
Amount: _____
<Reserve Button>
The form should, via ajax/jquery or whatever the Yii appropriate method is, not permit > "Tickets Available" (eventrecord->max_occupancy - eventrecord->reserved_occupancy) to be selected in any combination on the dropdowns.
Calculate the total amount at the bottom.
Then validate everything and save Reservation and ReservationDetail models. Also, update EventRecord model with the new reserved_occupancy value (this is easy.. I can do that.)
I'm lost on the on-form calculations and the correct way to do the validation.
I'll gladly *pay* someone for their time to help if you have a good solution. In a time crunch as the non-profit has tours coming up soon that they will need this app for.
Thanks in advance!
Jeff