Affects Version/s: 1.0
Fix Version/s: 1.0
Implement page used by administrators to assign available volunteers to specific roles and time-slots (e.g. to Needs). They can also use this widget to move volunteers from one slot to another or 'un-assign' them.
1. Link to "Manage Volunteer Assignments" will be included in Manage Events >> Volunteers tab. Link should contain volunteer project ID of the volunteer_project row linked to this event. Logic for this workflow uses the volunteer_project.id key.
I think URL formation should be something like "civicrm/volunteer/assign" (i.e. NOT in civicrm/event scope). Need to think about permissioning though. Maybe inherit 'edit all events' permission for now?? Or should the extension add it's own 'manage volunteers' permission?
2. Clicking the link loads a page with two blocks (as shown in mockup)
2.1 Left side block is a simple table ("Available Volunteers") containing a row for each contact who is 'available' to volunteer for this project (event) but has not been assigned to a specific need.
We'll need a BAO to retrieve this list by getting contact display name for activities of type Volunteer and status = Available, which are linked to a flexible Need (need.is_flexible = 1) which belongs to this project. To get the list of related needs:
SELECT * FROM civicrm_volunteer_need WHERE project_id IN (SELECT ID FROM civicrm_volunteer_project WHERE entity_id = $thisEventId AND entity_table = 'civicrm_event' AND is_active = 1);
2.2 Left side block also includes Add Volunteer button which inserts a new row in the table with auto-complete contact selector (OR might be a pop-up dialog allowing select contact AND create contact ???).
2.3 Right side block lists the Needs which belong to this project WHERE is_flexible = 0. Needs are grouped by Role (role_id) and then Start Date/Time. Quantity (need.quantity) is displayed in parenthesis after start-end date.
2.4 Place-holder for dragging in a volunteer is rendered after each need as shown in the mockup.
Volunteers can be moved from one need to another by dragging them up or down on the right side.
2.5 We need a way to remove volunteers from lists on both right and left side (i.e. a 'delete' action). We can use the 'trashcan' icon as we've done in the profile form builder (shown on hover over the volunteer contact element).
NOTE: Need.quantity is information only for phase 1. We do not 'enforce' a quantity limit.
3. Processing notes
DB Changes are recorded immediately as the user drags/drops volunteers (or deletes them).
3.1 Assign available volunteer to a need (drag left to right)
- Update this volunteer activity record, set volunteer_need_id = target need.id, activity_status = Scheduled
3.2 Move volunteer from one need to another (drag up or down on right side)
- Update this volunteer activity record, set volunteer_need_id = target need.id
3.3 Unassign scheduled volunteer (drag right to left, back into 'available pool')
- Update this volunteer activity record, set volunteer_need_id = the is_flexible need.id for this project, activity_status = Available
3.4 Add volunteer to left side listing
- Create volunteer activity record, volunteer_need_id = the is_flexible need.id for this project, activity_status = Available.
3.5 Delete volunteer from either table