Phase 2: Dashboard Attendee Management Enhancements
Historical design/implementation plan. It is retained as background, not a statement that every proposed feature is available. Use the current component/project guides and the deployed editor before following its recipes.
Overview
This document details the enhancements to the dashboard attendee management interface, including dynamic quick add forms, dropdown type selection, quick actions, and navigation improvements.
Feature Summary
- Dynamic Quick Add Form: Form fields change based on selected attendee type
- Dropdown Type Selection: Add button shows dropdown of attendee types
- Quick Actions Card: Configurable action buttons on attendee edit page
- Navigation Pagination: Next/previous buttons in datatable context
- Navigation Grouping: Attendee Fields grouped under Attendee Types
1. DataTable Dropdown Create Button
Backend Changes
AttendeeController Updates
// app/Http/Controllers/Admin/AttendeeController.php
public function index(Request $request)
{
// ... existing code ...
return Inertia::render('Dashboard/Pages/Admin/Projects/Attendees/Index', [
// ... existing props ...
// New: Attendee types for dropdown
'attendeeTypesForCreate' => fn () => $this->attendeeTypeService
->list($project->id)
->map(fn ($type) => [
'id' => $type->id,
'name' => $type->name,
'slug' => $type->slug,
'icon' => $type->icon ?? 'user',
'color' => $type->color ?? 'primary',
]),
// New: Quick add fields per type
'quickAddFieldsByType' => fn () => $this->getQuickAddFieldsByType($project),
]);
}
/**
* Get quick add fields organized by attendee type
*/
protected function getQuickAddFieldsByType(Project $project): array
{
$types = $this->attendeeTypeService->listWithSections($project->id);
$result = [];
foreach ($types as $type) {
$fields = $this->attendeeFieldService->list($project->id)
->filter(fn ($field) => $field->include_in_quick_add)
->map(fn ($field) => $this->mapFieldToFormField($field));
// Add type-specific fields from sections
$typeFields = $type->fieldSections
->flatMap(fn ($section) => $section->pivot->attendeeFields)
->filter(fn ($field) => $field->include_in_quick_add)
->map(fn ($field) => $this->mapFieldToFormField($field));
$result[$type->slug] = [
'type' => $type->only(['id', 'name', 'slug']),
'fields' => $fields->merge($typeFields)->unique('name')->values(),
];
}
return $result;
}
/**
* Map attendee field to form field definition
*/
protected function mapFieldToFormField(AttendeeField $field): array
{
return [
'type' => $this->mapFieldType($field->field_type),
'style' => $this->mapFieldStyle($field->field_type),
'name' => $field->slug,
'label' => $field->name,
'required' => $field->pivot?->metadata['required'] ?? false,
'colsMd' => 6,
'options' => $field->fieldEnums->map(fn ($e) => [
'value' => $e->value,
'label' => $e->label,
])->toArray(),
'validation' => $field->validation_rules,
];
}
Frontend Changes
DataTable Enhancement
Update /resources/js/Components/Mod/DataTable.vue to support dropdown create buttons:
<!-- In toolbar section, replace single create button with dropdown -->
<template v-if="createConfig?.dropdownCreate">
<MDBDropdown v-model="showCreateDropdown">
<MDBDropdownToggle
tag="a"
class="btn btn-primary"
:disabled="isProcessing"
>
<ModIcon :icon="createConfig.create?.buttonIconLeft || 'circle-plus'" />
{{ createConfig.create?.buttonText || 'Add' }}
<ModIcon icon="chevron-down" class="ms-1" />
</MDBDropdownToggle>
<MDBDropdownMenu>
<MDBDropdownItem
v-for="option in createConfig.dropdownOptions"
:key="option.value"
@click="handleDropdownCreateSelect(option)"
>
<ModIcon v-if="option.icon" :icon="option.icon" class="me-2" />
{{ option.label }}
</MDBDropdownItem>
</MDBDropdownMenu>
</MDBDropdown>
</template>
useDataTableCreateModal Enhancement
// resources/js/Composables/useDataTableCreateModal.js
export function useDataTableCreateModal(props, emit) {
const selectedCreateType = ref(null)
const dynamicFormFields = ref([])
const handleDropdownCreateSelect = (option) => {
selectedCreateType.value = option.value
// Load dynamic fields for selected type
if (props.createConfig.dynamicFieldsKey && props[props.createConfig.dynamicFieldsKey]) {
const typeFields = props[props.createConfig.dynamicFieldsKey][option.value]
if (typeFields) {
dynamicFormFields.value = typeFields.fields
// Update form definition with dynamic fields
updateCreateFormDefinition(typeFields)
}
}
showCreateDialog.value = true
}
const updateCreateFormDefinition = (typeData) => {
// Merge dynamic fields into create form
const baseForm = { ...props.createConfig }
// Find fields_list card and update
if (baseForm.tabsList) {
baseForm.tabsList = baseForm.tabsList.map(tab => ({
...tab,
cards: tab.cards.map(card => {
if (card.type === 'fields_list' && card.dynamicFieldsPlaceholder) {
return {
...card,
fieldsList: [
// Pre-populate attendee type
{
type: 'hidden',
name: 'attendee_type_id',
value: typeData.type.id,
},
...typeData.fields,
],
}
}
return card
}),
}))
}
activeCreateConfig.value = baseForm
}
return {
selectedCreateType,
dynamicFormFields,
handleDropdownCreateSelect,
// ... existing returns
}
}
Attendee Index Page Update
// resources/js/Dashboard/Pages/Admin/Projects/Attendees/Index.vue
const createConfig = computed(() => ({
modalSize: 'lg',
position: 'top',
dropdownCreate: true, // Enable dropdown mode
dropdownOptions: props.attendeeTypesForCreate.map(type => ({
value: type.slug,
label: type.name,
icon: type.icon,
color: type.color,
})),
dynamicFieldsKey: 'quickAddFieldsByType', // Prop name for dynamic fields
create: {
route: 'dashboard.attendees.store',
params: { project: usePage().props.project.slug },
buttonText: 'Add Attendee',
buttonIconLeft: 'user-plus',
},
tabsList: [
{
tabId: 'quick-add',
title: 'Quick Add',
cards: [
{
type: 'fields_list',
dynamicFieldsPlaceholder: true, // Marker for dynamic fields
fieldsList: [], // Will be populated dynamically
},
],
createButton: 'Create Attendee',
},
],
}))
2. Quick Actions Card
Backend Changes
AttendeeTypeQuickActionService
<?php
namespace App\Services;
use App\Models\AttendeeType;
use App\Models\AttendeeTypeQuickAction;
use Illuminate\Support\Collection;
class AttendeeTypeQuickActionService
{
public function list(AttendeeType $attendeeType): Collection
{
return $attendeeType->quickActions()
->where('is_active', true)
->orderBy('sort_order')
->get();
}
public function create(AttendeeType $attendeeType, array $data): AttendeeTypeQuickAction
{
$maxOrder = $attendeeType->quickActions()->max('sort_order') ?? 0;
return $attendeeType->quickActions()->create([
...$data,
'sort_order' => $maxOrder + 1,
]);
}
public function update(AttendeeTypeQuickAction $action, array $data): AttendeeTypeQuickAction
{
$action->update($data);
return $action->fresh();
}
public function delete(AttendeeTypeQuickAction $action): void
{
$action->delete();
}
public function reorder(AttendeeType $attendeeType, array $ids): void
{
foreach ($ids as $index => $id) {
AttendeeTypeQuickAction::where('id', $id)
->where('attendee_type_id', $attendeeType->id)
->update(['sort_order' => $index]);
}
}
/**
* Get default quick actions for new attendee types
*/
public function getDefaultActions(): array
{
return [
[
'label' => 'Send Welcome Email',
'icon' => 'envelope',
'color' => 'primary',
'action_type' => 'workflow',
'action_config' => ['workflow_key' => 'welcome_email'],
],
[
'label' => 'Generate Badge',
'icon' => 'id-card',
'color' => 'secondary',
'action_type' => 'route',
'action_config' => [
'route' => 'dashboard.attendee-credentials.create',
'params' => ['attendee' => ':attendee_id'],
],
],
[
'label' => 'Add to Group',
'icon' => 'users',
'color' => 'info',
'action_type' => 'modal',
'action_config' => ['modal' => 'add_to_group'],
],
];
}
}
AttendeeController Show Method Update
public function show(Request $request, Project $project, Attendee $attendee)
{
// ... existing code ...
return Inertia::render('Dashboard/Pages/Admin/Projects/Attendees/Show', [
// ... existing props ...
// Quick actions for this attendee's type
'quickActions' => fn () => $attendee->attendeeType?->quick_actions_enabled
? $this->quickActionService->list($attendee->attendeeType)
->filter(fn ($action) => $this->evaluateActionConditions($action, $attendee))
->map(fn ($action) => $this->formatQuickAction($action, $attendee))
: [],
// Pagination context for navigation
'paginationContext' => fn () => $this->getPaginationContext($request, $project),
]);
}
protected function formatQuickAction(AttendeeTypeQuickAction $action, Attendee $attendee): array
{
$config = $action->action_config;
// Replace placeholders in config
if (isset($config['params'])) {
$config['params'] = collect($config['params'])->map(function ($value) use ($attendee) {
return str_replace(':attendee_id', $attendee->id, $value);
})->toArray();
}
return [
'id' => $action->id,
'label' => $action->label,
'icon' => $action->icon,
'color' => $action->color,
'actionType' => $action->action_type,
'actionConfig' => $config,
];
}
protected function evaluateActionConditions(AttendeeTypeQuickAction $action, Attendee $attendee): bool
{
if (!$action->display_conditions) {
return true;
}
foreach ($action->display_conditions as $condition) {
$value = data_get($attendee, $condition['field']);
$expected = $condition['value'];
$result = match ($condition['operator']) {
'==' => $value == $expected,
'!=' => $value != $expected,
'exists' => !is_null($value),
'not_exists' => is_null($value),
'in' => in_array($value, (array) $expected),
default => true,
};
if (!$result) {
return false;
}
}
return true;
}
Frontend Quick Actions Card
<!-- resources/js/Components/Attendee/QuickActionsCard.vue -->
<script setup>
import { ref } from 'vue'
import { router } from '@inertiajs/vue3'
import ModCard from '@/Components/Mod/v2/Cards/ModCard.vue'
import ModButton from '@/Components/Mod/v2/Elements/ModButton.vue'
import ModIcon from '@/Components/Mod/ModIcon.vue'
import AddToGroupModal from './Modals/AddToGroupModal.vue'
const props = defineProps({
actions: { type: Array, default: () => [] },
attendee: { type: Object, required: true },
})
const emit = defineEmits(['action-executed'])
const processing = ref(null)
const showAddToGroupModal = ref(false)
const executeAction = async (action) => {
processing.value = action.id
try {
switch (action.actionType) {
case 'route':
router.visit(route(action.actionConfig.route, action.actionConfig.params))
break
case 'workflow':
await triggerWorkflow(action.actionConfig.workflow_key)
break
case 'modal':
openModal(action.actionConfig.modal)
break
case 'api_call':
await makeApiCall(action.actionConfig)
break
}
emit('action-executed', action)
} catch (error) {
console.error('Action failed:', error)
} finally {
processing.value = null
}
}
const triggerWorkflow = async (workflowKey) => {
await axios.post(route('api.workflows.trigger'), {
workflow_key: workflowKey,
attendee_id: props.attendee.id,
})
}
const openModal = (modalType) => {
if (modalType === 'add_to_group') {
showAddToGroupModal.value = true
}
}
const makeApiCall = async (config) => {
await axios({
method: config.method || 'post',
url: route(config.route, config.params),
data: config.data,
})
}
</script>
<template>
<ModCard title="Quick Actions" icon="bolt">
<div class="d-flex flex-wrap gap-2">
<ModButton
v-for="action in actions"
:key="action.id"
:color="action.color"
:disabled="processing === action.id"
@click="executeAction(action)"
>
<ModIcon v-if="action.icon" :icon="action.icon" class="me-1" />
{{ action.label }}
<span v-if="processing === action.id" class="spinner-border spinner-border-sm ms-1" />
</ModButton>
</div>
<p v-if="actions.length === 0" class="text-muted mb-0">
No quick actions configured for this attendee type.
</p>
</ModCard>
<AddToGroupModal
v-model="showAddToGroupModal"
:attendee="attendee"
@added="emit('action-executed', { type: 'add_to_group' })"
/>
</template>
Attendee Show Page Integration
// resources/js/Dashboard/Pages/Admin/Projects/Attendees/Show.vue
const showConfig = computed(() => ({
title: `${props.data.first_name} ${props.data.last_name}`,
// ... existing config ...
// Add quick actions as first card in first tab
tabsList: [
{
title: 'Details',
tabId: 'details',
cards: [
// Quick Actions Card (conditionally shown)
...(props.quickActions?.length > 0 ? [{
type: 'component',
component: 'QuickActionsCard',
props: {
actions: props.quickActions,
attendee: props.data,
},
colsMd: 12,
}] : []),
// Existing attendee details cards...
{
type: 'fields_list',
title: 'Contact Information',
// ... existing fields
},
],
},
// ... other tabs
],
}))
3. Navigation Pagination (Next/Previous)
Pinia Store for Pagination Context
// resources/js/Store/datatablePaginationStore.js
import { defineStore } from 'pinia'
export const useDatatablePaginationStore = defineStore('datatablePagination', {
state: () => ({
// Current datatable context
context: {
entityType: null, // 'attendees', 'forms', etc.
projectSlug: null,
currentPage: 1,
perPage: 25,
totalItems: 0,
itemIds: [], // IDs of items on current page
searchParams: null, // Current search/filter params
sortBy: null,
sortDirection: 'asc',
},
// Current position in the list
currentIndex: -1,
}),
getters: {
currentId: (state) => state.context.itemIds[state.currentIndex] ?? null,
hasPrevious: (state) => state.currentIndex > 0,
hasNext: (state) => state.currentIndex < state.context.itemIds.length - 1,
previousId: (state) => {
if (state.currentIndex > 0) {
return state.context.itemIds[state.currentIndex - 1]
}
return null
},
nextId: (state) => {
if (state.currentIndex < state.context.itemIds.length - 1) {
return state.context.itemIds[state.currentIndex + 1]
}
return null
},
positionLabel: (state) => {
if (state.currentIndex < 0 || state.context.itemIds.length === 0) {
return ''
}
const globalPosition = (state.context.currentPage - 1) * state.context.perPage + state.currentIndex + 1
return `${globalPosition} of ${state.context.totalItems}`
},
},
actions: {
setContext(context) {
this.context = { ...this.context, ...context }
},
setCurrentItem(itemId) {
this.currentIndex = this.context.itemIds.indexOf(itemId)
},
clearContext() {
this.context = {
entityType: null,
projectSlug: null,
currentPage: 1,
perPage: 25,
totalItems: 0,
itemIds: [],
searchParams: null,
sortBy: null,
sortDirection: 'asc',
}
this.currentIndex = -1
},
},
persist: {
storage: sessionStorage,
},
})
DataTable Integration
// In DataTable.vue or useDataTable composable
import { useDatatablePaginationStore } from '@/Store/datatablePaginationStore'
const paginationStore = useDatatablePaginationStore()
// Update store when data changes
watch(() => props.paginatedItems, (newData) => {
if (newData && props.options?.enableNavigation) {
paginationStore.setContext({
entityType: props.options.entityType,
projectSlug: usePage().props.project?.slug,
currentPage: newData.current_page,
perPage: newData.per_page,
totalItems: newData.total,
itemIds: newData.data.map(item => item.id),
searchParams: currentSearchParams.value,
sortBy: sortBy.value,
sortDirection: sortDirection.value,
})
}
}, { immediate: true })
Navigation Footer Component
<!-- resources/js/Components/Mod/NavigationFooter.vue -->
<script setup>
import { computed } from 'vue'
import { router } from '@inertiajs/vue3'
import { useDatatablePaginationStore } from '@/Store/datatablePaginationStore'
import ModButton from '@/Components/Mod/v2/Elements/ModButton.vue'
import ModIcon from '@/Components/Mod/ModIcon.vue'
const props = defineProps({
currentId: { type: [Number, String], required: true },
routeName: { type: String, required: true },
routeParams: { type: Object, default: () => ({}) },
returnRoute: { type: String, default: null },
returnParams: { type: Object, default: () => ({}) },
})
const store = useDatatablePaginationStore()
// Set current position when component mounts
store.setCurrentItem(props.currentId)
const navigateTo = (id) => {
router.visit(route(props.routeName, {
...props.routeParams,
[Object.keys(props.routeParams).find(k => k !== 'project') || 'id']: id,
}))
}
const returnToList = () => {
if (props.returnRoute) {
router.visit(route(props.returnRoute, props.returnParams))
} else {
// Try to construct return route from current route
const listRoute = props.routeName.replace('.show', '.index').replace('.edit', '.index')
router.visit(route(listRoute, { project: props.routeParams.project }))
}
}
</script>
<template>
<div class="navigation-footer d-flex align-items-center justify-content-between py-3 px-4 bg-light border-top">
<div class="d-flex align-items-center gap-2">
<ModButton
color="secondary"
outline
:disabled="!store.hasPrevious"
@click="navigateTo(store.previousId)"
>
<ModIcon icon="chevron-left" class="me-1" />
Previous
</ModButton>
<span class="text-muted">
{{ store.positionLabel }}
</span>
<ModButton
color="secondary"
outline
:disabled="!store.hasNext"
@click="navigateTo(store.nextId)"
>
Next
<ModIcon icon="chevron-right" class="ms-1" />
</ModButton>
</div>
<ModButton
color="link"
@click="returnToList"
>
<ModIcon icon="arrow-left" class="me-1" />
Return to List
</ModButton>
</div>
</template>
<style scoped>
.navigation-footer {
position: sticky;
bottom: 0;
z-index: 100;
margin: 0 -1.5rem -1.5rem;
}
</style>
ShowPage Integration
// resources/js/Dashboard/Pages/Admin/Projects/Attendees/Show.vue
<template>
<ShowPage :show-config="showConfig" :show-item="data">
<!-- ... existing content ... -->
<template #footer>
<NavigationFooter
v-if="paginationContext"
:current-id="data.id"
route-name="dashboard.attendees.show"
:route-params="{ project: $page.props.project.slug, attendee: data.id }"
return-route="dashboard.attendees.index"
:return-params="{ project: $page.props.project.slug }"
/>
</template>
</ShowPage>
</template>
4. Navigation Grouping
AppNavigation Update
Update the navigation configuration to group Attendee Fields under Attendee Types:
// resources/js/Data/appNavigation.js
export const projectNavigation = [
// ... other items ...
{
label: 'Attendees',
icon: 'users',
children: [
{
label: 'All Attendees',
route: 'dashboard.attendees.index',
icon: 'users',
},
{
label: 'Attendee Types',
icon: 'user-tag',
route: 'dashboard.attendee-types.index',
children: [
{
label: 'Attendee Fields',
route: 'dashboard.attendee-fields.index',
icon: 'input-text',
},
],
},
{
label: 'Groups',
route: 'dashboard.groups.index',
icon: 'users-group',
},
{
label: 'Credentials',
route: 'dashboard.attendee-credentials.index',
icon: 'id-card',
},
{
label: 'Attendee Assets', // NEW
route: 'dashboard.attendee-assets.index',
icon: 'files',
},
],
},
// ... other items ...
]
ShowPage Configuration Reference
Attendee Show Page Complete Config
// resources/js/Dashboard/Pages/Admin/Projects/Attendees/Show.vue
const showConfig = computed(() => ({
title: fullName.value,
subtitle: props.data.attendeeType?.name,
avatar: props.data.user_avatar,
defaultAvatar: props.data.attendeeType?.default_avatar_path,
breadCrumbs: [
{ label: 'Attendees', route: 'dashboard.attendees.index' },
{ label: fullName.value },
],
actionMenu: {
items: [
{
label: 'Export',
icon: 'download',
action: 'export',
},
{
label: 'Delete',
icon: 'trash',
color: 'danger',
action: 'delete',
confirm: true,
},
],
},
updateConfig: {
update: {
route: 'dashboard.attendees.update',
params: {
project: usePage().props.project.slug,
attendee: props.data.id,
},
},
},
deleteConfig: {
delete: {
route: 'dashboard.attendees.destroy',
params: {
project: usePage().props.project.slug,
attendee: props.data.id,
},
confirmText: 'DELETE',
redirectRoute: 'dashboard.attendees.index',
},
},
tabsList: [
{
title: 'Details',
tabId: 'details',
cards: [
// Quick Actions (top of page)
{
type: 'component',
component: 'QuickActionsCard',
props: {
actions: props.quickActions,
attendee: props.data,
},
condition: props.quickActions?.length > 0,
colsMd: 12,
},
// Contact Information
{
type: 'fields_list',
title: 'Contact Information',
icon: 'address-book',
colsMd: 6,
fieldsList: [
{
type: 'input',
style: 'email',
name: 'contact_email',
label: 'Email',
colsMd: 12,
},
{
type: 'input',
style: 'tel',
name: 'mobile_phone',
label: 'Mobile Phone',
colsMd: 12,
},
],
},
// Basic Information
{
type: 'fields_list',
title: 'Basic Information',
icon: 'user',
colsMd: 6,
fieldsList: [
{
type: 'input',
style: 'text',
name: 'first_name',
label: 'First Name',
colsMd: 6,
},
{
type: 'input',
style: 'text',
name: 'last_name',
label: 'Last Name',
colsMd: 6,
},
{
type: 'input',
style: 'text',
name: 'company',
label: 'Company',
colsMd: 6,
},
{
type: 'input',
style: 'text',
name: 'title',
label: 'Title',
colsMd: 6,
},
],
},
// Dynamic attendee fields based on type
...attendeeFieldCards.value,
],
},
{
title: 'Groups',
tabId: 'groups',
cards: [
{
type: 'data_table',
tableTitle: 'Group Memberships',
listKey: 'groups',
headers: groupHeaders,
options: {
id: 'attendee-groups',
searchRoute: {
route: 'api.attendee-groups.index',
params: { attendee: props.data.id },
},
},
createConfig: {
create: {
route: 'dashboard.attendee-groups.store',
params: { attendee: props.data.id },
},
tabsList: [/* group selection form */],
},
},
],
},
{
title: 'Credentials',
tabId: 'credentials',
cards: [/* credential management */],
},
{
title: 'Activity',
tabId: 'activity',
cards: [/* activity log, form responses, etc. */],
},
{
title: 'Assets',
tabId: 'assets',
cards: [
{
type: 'data_table',
tableTitle: 'Uploaded Files',
listKey: 'assets',
headers: assetHeaders,
options: {
id: 'attendee-assets',
searchRoute: {
route: 'api.attendee-assets.index',
params: { attendee: props.data.id },
},
},
},
],
},
],
// Footer with navigation
showNavigationFooter: true,
navigationConfig: {
routeName: 'dashboard.attendees.show',
routeParams: { project: usePage().props.project.slug },
returnRoute: 'dashboard.attendees.index',
},
}))
API Endpoints
Quick Actions API
// routes/admin/dashboard.php
Route::prefix('attendee-types/{attendee_type}')->group(function () {
Route::get('quick-actions', [AttendeeTypeQuickActionController::class, 'index']);
Route::post('quick-actions', [AttendeeTypeQuickActionController::class, 'store']);
Route::put('quick-actions/{quick_action}', [AttendeeTypeQuickActionController::class, 'update']);
Route::delete('quick-actions/{quick_action}', [AttendeeTypeQuickActionController::class, 'destroy']);
Route::post('quick-actions/reorder', [AttendeeTypeQuickActionController::class, 'reorder']);
});
Next Steps
- 03-FIELD-BUILDER.md - Attendee type field builder improvements
- 04-REGISTRATION-FORMS.md - Registration form type implementation