feat(election): committee meeting UI — schedule/edit drawer, online/offline mode toggle, soft delete
- committee-board: collapsible meetings section per card, Schedule Meeting button, meeting list with status chips and join links - Meeting form drawer: ONLINE (platform, link, ID, password) vs OFFLINE (venue, address, city) mode toggle - Actions: edit/complete/cancel for SCHEDULED; delete (soft) for all statuses on active committees - election.service.ts: getMeetings, scheduleMeeting, updateMeeting, patchMeetingStatus, deleteMeeting - election-audit-log: meeting action metas (SCHEDULE_MEETING, UPDATE_MEETING, CANCEL_MEETING, COMPLETE_MEETING, DELETE_MEETING + FAILEDs), COMMITTEE entity action list updated Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
3e51eae4b5
commit
e952bc546f
@@ -116,6 +116,122 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Meetings Section -->
|
||||
<div class="meetings-section">
|
||||
<button class="meetings-toggle" (click)="toggleMeetings(c)" [class.expanded]="isMeetingsExpanded(c.id)">
|
||||
<mat-icon>event</mat-icon>
|
||||
<span>Meetings</span>
|
||||
@if (getMeetings(c.id).length > 0) {
|
||||
<span class="meeting-count-badge">{{ getMeetings(c.id).length }}</span>
|
||||
}
|
||||
<mat-icon class="chevron">{{ isMeetingsExpanded(c.id) ? 'expand_less' : 'expand_more' }}</mat-icon>
|
||||
</button>
|
||||
|
||||
@if (isMeetingsExpanded(c.id)) {
|
||||
<div class="meetings-panel">
|
||||
@if (c.status === 'ACTIVE') {
|
||||
<button class="btn-schedule" (click)="openScheduleMeeting(c, $event)">
|
||||
<mat-icon>add</mat-icon> Schedule Meeting
|
||||
</button>
|
||||
}
|
||||
|
||||
@if (isMeetingsLoading(c.id)) {
|
||||
<div class="loading-inline">
|
||||
<div class="spinner-sm"></div>
|
||||
<span>Loading...</span>
|
||||
</div>
|
||||
} @else if (getMeetings(c.id).length === 0) {
|
||||
<div class="meetings-empty">
|
||||
<mat-icon>event_busy</mat-icon>
|
||||
<span>No meetings scheduled</span>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="meeting-list">
|
||||
@for (m of getMeetings(c.id); track m.id) {
|
||||
<div class="meeting-row">
|
||||
<div class="meeting-mode-icon" [title]="m.mode">
|
||||
<mat-icon>{{ meetingModeIcon(m.mode) }}</mat-icon>
|
||||
</div>
|
||||
<div class="meeting-info">
|
||||
<span class="meeting-title">{{ m.title }}</span>
|
||||
<div class="meeting-meta-row">
|
||||
<mat-icon class="meta-icon">calendar_today</mat-icon>
|
||||
<span>{{ m.meetingDate | date: 'dd MMM yyyy' }}</span>
|
||||
@if (m.meetingTime) {
|
||||
<span class="meta-sep">·</span>
|
||||
<mat-icon class="meta-icon">schedule</mat-icon>
|
||||
<span>{{ m.meetingTime }}</span>
|
||||
}
|
||||
<span class="meta-sep">·</span>
|
||||
<span
|
||||
class="meeting-status-chip"
|
||||
[style.background]="meetingStatusColor(m.status) + '18'"
|
||||
[style.color]="meetingStatusColor(m.status)"
|
||||
>{{ m.status }}</span
|
||||
>
|
||||
</div>
|
||||
@if (m.mode === 'ONLINE' && m.platform) {
|
||||
<div class="meeting-platform-row">
|
||||
<mat-icon class="meta-icon">videocam</mat-icon>
|
||||
<span>{{ m.platform }}</span>
|
||||
@if (m.meetingLink) {
|
||||
<a
|
||||
[href]="m.meetingLink"
|
||||
target="_blank"
|
||||
class="join-link"
|
||||
(click)="$event.stopPropagation()"
|
||||
>
|
||||
<mat-icon>open_in_new</mat-icon> Join
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@if (m.mode === 'OFFLINE' && m.venue) {
|
||||
<div class="meeting-platform-row">
|
||||
<mat-icon class="meta-icon">place</mat-icon>
|
||||
<span>{{ m.venue }}{{ m.city ? ', ' + m.city : '' }}</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@if (c.status === 'ACTIVE') {
|
||||
<div class="meeting-actions">
|
||||
@if (m.status === 'SCHEDULED') {
|
||||
<button class="btn-icon" title="Edit" (click)="openEditMeeting(m, c.id, $event)">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
<button
|
||||
class="btn-icon green"
|
||||
title="Mark Completed"
|
||||
(click)="patchMeetingStatus(m, c.id, 'COMPLETED', $event)"
|
||||
>
|
||||
<mat-icon>check_circle</mat-icon>
|
||||
</button>
|
||||
<button
|
||||
class="btn-icon red"
|
||||
title="Cancel Meeting"
|
||||
(click)="patchMeetingStatus(m, c.id, 'CANCELLED', $event)"
|
||||
>
|
||||
<mat-icon>cancel</mat-icon>
|
||||
</button>
|
||||
}
|
||||
<button
|
||||
class="btn-icon danger"
|
||||
title="Delete"
|
||||
(click)="confirmDeleteMeeting(m, c.id, $event)"
|
||||
>
|
||||
<mat-icon>delete_outline</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Card Actions -->
|
||||
<div class="card-actions">
|
||||
@if (c.status === 'ACTIVE') {
|
||||
<button class="btn-edit" (click)="openEdit(c)"><mat-icon>edit</mat-icon> Edit</button>
|
||||
@@ -130,7 +246,7 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Drawer -->
|
||||
<!-- Committee Drawer -->
|
||||
@if (showForm) {
|
||||
<div class="overlay" (click)="closeForm()"></div>
|
||||
<div class="form-drawer">
|
||||
@@ -167,7 +283,6 @@
|
||||
<input #imageInput type="file" accept="image/*" style="display: none" (change)="onImageSelect($event)" />
|
||||
</div>
|
||||
|
||||
<!-- Name -->
|
||||
<div class="form-group">
|
||||
<label>Committee Name <span class="req">*</span></label>
|
||||
<input
|
||||
@@ -186,7 +301,6 @@
|
||||
<textarea [(ngModel)]="form.description" rows="2" placeholder="Optional description..."></textarea>
|
||||
</div>
|
||||
|
||||
<!-- Director Selection -->
|
||||
<div class="section-title">Select Members (Current Election Directors)</div>
|
||||
|
||||
@if (directorsLoading) {
|
||||
@@ -239,3 +353,130 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Meeting Drawer -->
|
||||
@if (showMeetingForm) {
|
||||
<div class="overlay" (click)="closeMeetingForm()"></div>
|
||||
<div class="form-drawer meeting-drawer">
|
||||
<div class="drawer-header">
|
||||
<h3>{{ editingMeetingId ? 'Edit Meeting' : 'Schedule Meeting' }}</h3>
|
||||
<button class="close-btn" (click)="closeMeetingForm()"><mat-icon>close</mat-icon></button>
|
||||
</div>
|
||||
|
||||
<div class="drawer-body">
|
||||
<!-- Title -->
|
||||
<div class="form-group">
|
||||
<label>Title <span class="req">*</span></label>
|
||||
<input
|
||||
type="text"
|
||||
[(ngModel)]="meetingForm.title"
|
||||
placeholder="e.g. Q1 Strategy Review"
|
||||
[class.input-error]="submittedMeeting && !meetingForm.title?.trim()"
|
||||
/>
|
||||
@if (submittedMeeting && !meetingForm.title?.trim()) {
|
||||
<span class="error-msg">Title is required</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Date + Time -->
|
||||
<div class="form-row-2">
|
||||
<div class="form-group">
|
||||
<label>Date <span class="req">*</span></label>
|
||||
<input
|
||||
type="date"
|
||||
[(ngModel)]="meetingForm.meetingDate"
|
||||
[class.input-error]="submittedMeeting && !meetingForm.meetingDate"
|
||||
/>
|
||||
@if (submittedMeeting && !meetingForm.meetingDate) {
|
||||
<span class="error-msg">Date is required</span>
|
||||
}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Time</label>
|
||||
<input type="time" [(ngModel)]="meetingForm.meetingTime" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Mode Toggle -->
|
||||
<div class="form-group">
|
||||
<label>Meeting Mode <span class="req">*</span></label>
|
||||
<div class="mode-toggle">
|
||||
<button
|
||||
class="mode-btn"
|
||||
[class.active]="meetingForm.mode === 'OFFLINE'"
|
||||
(click)="meetingForm.mode = 'OFFLINE'"
|
||||
type="button"
|
||||
>
|
||||
<mat-icon>location_on</mat-icon> Offline
|
||||
</button>
|
||||
<button
|
||||
class="mode-btn"
|
||||
[class.active]="meetingForm.mode === 'ONLINE'"
|
||||
(click)="meetingForm.mode = 'ONLINE'"
|
||||
type="button"
|
||||
>
|
||||
<mat-icon>video_call</mat-icon> Online
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Online Fields -->
|
||||
@if (meetingForm.mode === 'ONLINE') {
|
||||
<div class="mode-fields-group">
|
||||
<div class="mode-label online-label"><mat-icon>video_call</mat-icon> Online Details</div>
|
||||
<div class="form-group">
|
||||
<label>Platform</label>
|
||||
<input type="text" [(ngModel)]="meetingForm.platform" placeholder="e.g. Zoom, Google Meet, Teams" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Meeting Link</label>
|
||||
<input type="url" [(ngModel)]="meetingForm.meetingLink" placeholder="https://..." />
|
||||
</div>
|
||||
<div class="form-row-2">
|
||||
<div class="form-group">
|
||||
<label>Meeting ID</label>
|
||||
<input type="text" [(ngModel)]="meetingForm.meetingIdRef" placeholder="123 456 789" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Password</label>
|
||||
<input type="text" [(ngModel)]="meetingForm.meetingPassword" placeholder="Optional" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Offline Fields -->
|
||||
@if (meetingForm.mode === 'OFFLINE') {
|
||||
<div class="mode-fields-group">
|
||||
<div class="mode-label offline-label"><mat-icon>location_on</mat-icon> Venue Details</div>
|
||||
<div class="form-group">
|
||||
<label>Venue</label>
|
||||
<input type="text" [(ngModel)]="meetingForm.venue" placeholder="e.g. Board Room, Conference Hall" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Address</label>
|
||||
<textarea [(ngModel)]="meetingForm.address" rows="2" placeholder="Full address..."></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>City</label>
|
||||
<input type="text" [(ngModel)]="meetingForm.city" placeholder="City name" />
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Agenda -->
|
||||
<div class="form-group">
|
||||
<label>Agenda</label>
|
||||
<textarea [(ngModel)]="meetingForm.agenda" rows="3" placeholder="Meeting agenda..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="drawer-footer">
|
||||
<button class="btn-cancel" (click)="closeMeetingForm()">Cancel</button>
|
||||
<button class="btn-save" (click)="saveMeeting()" [disabled]="savingMeeting">
|
||||
<mat-icon>{{ savingMeeting ? 'hourglass_empty' : 'event' }}</mat-icon>
|
||||
{{ savingMeeting ? 'Saving...' : editingMeetingId ? 'Update' : 'Schedule' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -883,6 +883,367 @@ $font:
|
||||
}
|
||||
}
|
||||
|
||||
// ── Meetings Section ──────────────────────────────────────────────
|
||||
.meetings-section {
|
||||
border-top: $border;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.meetings-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
width: 100%;
|
||||
padding: 10px 4px;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: $sub;
|
||||
text-align: left;
|
||||
transition: color 0.15s;
|
||||
|
||||
mat-icon {
|
||||
font-size: 16px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
color: $sub;
|
||||
}
|
||||
|
||||
.chevron {
|
||||
margin-left: auto;
|
||||
font-size: 18px;
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
&.expanded {
|
||||
color: $primary;
|
||||
|
||||
mat-icon {
|
||||
color: $primary;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: $text;
|
||||
}
|
||||
}
|
||||
|
||||
.meeting-count-badge {
|
||||
background: $primary;
|
||||
color: #fff;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
padding: 1px 6px;
|
||||
border-radius: 10px;
|
||||
min-width: 18px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.meetings-panel {
|
||||
padding: 4px 0 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.btn-schedule {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 6px 12px;
|
||||
border: 1px dashed #a5b4fc;
|
||||
border-radius: 8px;
|
||||
background: rgb(99 102 241 / 4%);
|
||||
color: $primary;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
align-self: flex-start;
|
||||
|
||||
mat-icon {
|
||||
font-size: 14px;
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgb(99 102 241 / 10%);
|
||||
border-color: $primary;
|
||||
}
|
||||
}
|
||||
|
||||
.meetings-empty {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 10px 0;
|
||||
font-size: 12px;
|
||||
color: #94a3b8;
|
||||
|
||||
mat-icon {
|
||||
font-size: 16px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.meeting-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.meeting-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
padding: 8px 10px;
|
||||
background: #f8fafc;
|
||||
border-radius: 8px;
|
||||
border: $border;
|
||||
}
|
||||
|
||||
.meeting-mode-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 8px;
|
||||
background: rgb(99 102 241 / 10%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
|
||||
mat-icon {
|
||||
font-size: 14px;
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
color: $primary;
|
||||
}
|
||||
}
|
||||
|
||||
.meeting-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.meeting-title {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: $text;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.meeting-meta-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 3px;
|
||||
font-size: 11px;
|
||||
color: $sub;
|
||||
|
||||
.meta-icon {
|
||||
font-size: 11px;
|
||||
height: 11px;
|
||||
width: 11px;
|
||||
}
|
||||
|
||||
.meta-sep {
|
||||
color: #cbd5e1;
|
||||
}
|
||||
}
|
||||
|
||||
.meeting-status-chip {
|
||||
font-size: 9px;
|
||||
font-weight: 700;
|
||||
padding: 1px 6px;
|
||||
border-radius: 8px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
.meeting-platform-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-top: 3px;
|
||||
font-size: 11px;
|
||||
color: $sub;
|
||||
|
||||
.meta-icon {
|
||||
font-size: 11px;
|
||||
height: 11px;
|
||||
width: 11px;
|
||||
}
|
||||
}
|
||||
|
||||
.join-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
color: $primary;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
margin-left: 4px;
|
||||
|
||||
mat-icon {
|
||||
font-size: 11px;
|
||||
height: 11px;
|
||||
width: 11px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.meeting-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.btn-icon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 6px;
|
||||
border: none;
|
||||
background: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
color: $sub;
|
||||
transition: all 0.15s;
|
||||
|
||||
mat-icon {
|
||||
font-size: 14px;
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: #f1f5f9;
|
||||
color: $text;
|
||||
}
|
||||
|
||||
&.green:hover {
|
||||
background: #dcfce7;
|
||||
color: #10b981;
|
||||
}
|
||||
|
||||
&.red:hover {
|
||||
background: #fef9c3;
|
||||
color: #f59e0b;
|
||||
}
|
||||
|
||||
&.danger:hover {
|
||||
background: #fee2e2;
|
||||
color: #ef4444;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Meeting Drawer ────────────────────────────────────────────────
|
||||
.meeting-drawer {
|
||||
width: 500px;
|
||||
}
|
||||
|
||||
.mode-toggle {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.mode-btn {
|
||||
flex: 1;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
padding: 10px;
|
||||
border: $border;
|
||||
border-radius: 10px;
|
||||
background: #fff;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: $sub;
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
|
||||
mat-icon {
|
||||
font-size: 16px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: $primary;
|
||||
background: rgb(99 102 241 / 6%);
|
||||
color: $primary;
|
||||
}
|
||||
|
||||
&:hover:not(.active) {
|
||||
background: #f8fafc;
|
||||
}
|
||||
}
|
||||
|
||||
.mode-fields-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
padding: 14px;
|
||||
border-radius: 10px;
|
||||
border: $border;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.mode-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
|
||||
mat-icon {
|
||||
font-size: 15px;
|
||||
height: 15px;
|
||||
width: 15px;
|
||||
}
|
||||
|
||||
&.online-label {
|
||||
color: #2563eb;
|
||||
|
||||
mat-icon {
|
||||
color: #2563eb;
|
||||
}
|
||||
}
|
||||
|
||||
&.offline-label {
|
||||
color: #16a34a;
|
||||
|
||||
mat-icon {
|
||||
color: #16a34a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-row-2 {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
@media (width <= 600px) {
|
||||
.committee-page {
|
||||
padding: 16px;
|
||||
@@ -895,4 +1256,8 @@ $font:
|
||||
.form-drawer {
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.form-row-2 {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,14 +46,26 @@ export class CommitteeBoardComponent implements OnInit {
|
||||
memberPhotoMap: Record<number, SafeResourceUrl | null> = {};
|
||||
memberPhotoRaw: Record<number, string> = {};
|
||||
|
||||
// drawer state
|
||||
// committee drawer state
|
||||
showForm = false;
|
||||
editingId: number | null = null;
|
||||
saving = false;
|
||||
submitted = false;
|
||||
|
||||
form: any = this.emptyForm();
|
||||
|
||||
// meeting state
|
||||
meetingsByCommittee: Record<number, any[]> = {};
|
||||
meetingsLoading: Set<number> = new Set();
|
||||
expandedMeetings: Set<number> = new Set();
|
||||
|
||||
// meeting drawer state
|
||||
showMeetingForm = false;
|
||||
editingMeetingId: number | null = null;
|
||||
currentMeetingCommitteeId: number | null = null;
|
||||
savingMeeting = false;
|
||||
submittedMeeting = false;
|
||||
meetingForm: any = this.emptyMeetingForm();
|
||||
|
||||
ngOnInit(): void {
|
||||
this.load();
|
||||
}
|
||||
@@ -120,7 +132,6 @@ export class CommitteeBoardComponent implements OnInit {
|
||||
this.service.getCurrentElectionDirectors().subscribe((data) => {
|
||||
this.availableDirectors = data ?? [];
|
||||
this.directorsLoading = false;
|
||||
// load photos for selection list
|
||||
for (const d of this.availableDirectors) {
|
||||
if (d.memberId && this.memberPhotoMap[d.memberId] === undefined) {
|
||||
this.service.getClientImage(d.memberId).subscribe((base64) => {
|
||||
@@ -209,17 +220,13 @@ export class CommitteeBoardComponent implements OnInit {
|
||||
: this.service.createCommittee(payload);
|
||||
|
||||
call.subscribe({
|
||||
next: (result) => {
|
||||
next: () => {
|
||||
if (this.editingId != null) {
|
||||
// sync members separately if editing
|
||||
const existing = this.committees.find((c) => c.id === this.editingId);
|
||||
const existingIds: number[] = (existing?.members ?? []).map((m: any) => m.directorAppointmentId);
|
||||
const toAdd = this.form.selectedIds.filter((id: number) => !existingIds.includes(id));
|
||||
const toRemove = existingIds.filter((id: number) => !this.form.selectedIds.includes(id));
|
||||
|
||||
const removes = toRemove.map((id: number) =>
|
||||
this.service.removeCommitteeMember(this.editingId!, id).subscribe()
|
||||
);
|
||||
toRemove.forEach((id: number) => this.service.removeCommitteeMember(this.editingId!, id).subscribe());
|
||||
if (toAdd.length > 0) {
|
||||
this.service.addCommitteeMembers(this.editingId!, toAdd).subscribe();
|
||||
}
|
||||
@@ -254,7 +261,184 @@ export class CommitteeBoardComponent implements OnInit {
|
||||
return status === 'ACTIVE' ? '#10b981' : '#94a3b8';
|
||||
}
|
||||
|
||||
// ── Meetings ──────────────────────────────────────────────────────
|
||||
|
||||
toggleMeetings(committee: any): void {
|
||||
if (this.expandedMeetings.has(committee.id)) {
|
||||
this.expandedMeetings.delete(committee.id);
|
||||
} else {
|
||||
this.expandedMeetings.add(committee.id);
|
||||
if (!this.meetingsByCommittee[committee.id]) {
|
||||
this.loadMeetings(committee.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
isMeetingsExpanded(committeeId: number): boolean {
|
||||
return this.expandedMeetings.has(committeeId);
|
||||
}
|
||||
|
||||
loadMeetings(committeeId: number): void {
|
||||
this.meetingsLoading.add(committeeId);
|
||||
this.service.getMeetings(committeeId).subscribe({
|
||||
next: (data) => {
|
||||
this.meetingsByCommittee[committeeId] = data ?? [];
|
||||
this.meetingsLoading.delete(committeeId);
|
||||
},
|
||||
error: () => {
|
||||
this.meetingsByCommittee[committeeId] = [];
|
||||
this.meetingsLoading.delete(committeeId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isMeetingsLoading(committeeId: number): boolean {
|
||||
return this.meetingsLoading.has(committeeId);
|
||||
}
|
||||
|
||||
getMeetings(committeeId: number): any[] {
|
||||
return this.meetingsByCommittee[committeeId] ?? [];
|
||||
}
|
||||
|
||||
openScheduleMeeting(committee: any, event: MouseEvent): void {
|
||||
event.stopPropagation();
|
||||
this.editingMeetingId = null;
|
||||
this.currentMeetingCommitteeId = committee.id;
|
||||
this.submittedMeeting = false;
|
||||
this.meetingForm = this.emptyMeetingForm();
|
||||
this.showMeetingForm = true;
|
||||
}
|
||||
|
||||
openEditMeeting(meeting: any, committeeId: number, event: MouseEvent): void {
|
||||
event.stopPropagation();
|
||||
this.editingMeetingId = meeting.id;
|
||||
this.currentMeetingCommitteeId = committeeId;
|
||||
this.submittedMeeting = false;
|
||||
this.meetingForm = {
|
||||
title: meeting.title,
|
||||
meetingDate: meeting.meetingDate,
|
||||
meetingTime: meeting.meetingTime ?? '',
|
||||
mode: meeting.mode ?? 'OFFLINE',
|
||||
agenda: meeting.agenda ?? '',
|
||||
platform: meeting.platform ?? '',
|
||||
meetingLink: meeting.meetingLink ?? '',
|
||||
meetingIdRef: meeting.meetingIdRef ?? '',
|
||||
meetingPassword: meeting.meetingPassword ?? '',
|
||||
venue: meeting.venue ?? '',
|
||||
address: meeting.address ?? '',
|
||||
city: meeting.city ?? ''
|
||||
};
|
||||
this.showMeetingForm = true;
|
||||
}
|
||||
|
||||
closeMeetingForm(): void {
|
||||
this.showMeetingForm = false;
|
||||
this.editingMeetingId = null;
|
||||
this.currentMeetingCommitteeId = null;
|
||||
this.meetingForm = this.emptyMeetingForm();
|
||||
this.submittedMeeting = false;
|
||||
}
|
||||
|
||||
saveMeeting(): void {
|
||||
this.submittedMeeting = true;
|
||||
if (!this.meetingForm.title?.trim() || !this.meetingForm.meetingDate) return;
|
||||
|
||||
this.savingMeeting = true;
|
||||
const payload: any = {
|
||||
title: this.meetingForm.title.trim(),
|
||||
meetingDate: this.meetingForm.meetingDate,
|
||||
meetingTime: this.meetingForm.meetingTime || null,
|
||||
mode: this.meetingForm.mode,
|
||||
agenda: this.meetingForm.agenda?.trim() || null
|
||||
};
|
||||
|
||||
if (this.meetingForm.mode === 'ONLINE') {
|
||||
payload.platform = this.meetingForm.platform || null;
|
||||
payload.meetingLink = this.meetingForm.meetingLink || null;
|
||||
payload.meetingIdRef = this.meetingForm.meetingIdRef || null;
|
||||
payload.meetingPassword = this.meetingForm.meetingPassword || null;
|
||||
} else {
|
||||
payload.venue = this.meetingForm.venue || null;
|
||||
payload.address = this.meetingForm.address || null;
|
||||
payload.city = this.meetingForm.city || null;
|
||||
}
|
||||
|
||||
const committeeId = this.currentMeetingCommitteeId!;
|
||||
const call =
|
||||
this.editingMeetingId != null
|
||||
? this.service.updateMeeting(this.editingMeetingId, payload)
|
||||
: this.service.scheduleMeeting(committeeId, payload);
|
||||
|
||||
call.subscribe({
|
||||
next: () => {
|
||||
this.savingMeeting = false;
|
||||
this.closeMeetingForm();
|
||||
this.loadMeetings(committeeId);
|
||||
this.snackBar.open(this.editingMeetingId != null ? 'Meeting updated!' : 'Meeting scheduled!', 'Close', {
|
||||
duration: 3000
|
||||
});
|
||||
},
|
||||
error: (err) => {
|
||||
this.savingMeeting = false;
|
||||
const msg = err?.error?.errors?.[0]?.defaultUserMessage ?? err?.error?.message ?? 'Operation failed';
|
||||
this.snackBar.open(msg, 'Close', { duration: 5000 });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
confirmDeleteMeeting(meeting: any, committeeId: number, event: MouseEvent): void {
|
||||
event.stopPropagation();
|
||||
if (!confirm(`Delete meeting "${meeting.title}"?`)) return;
|
||||
this.service.deleteMeeting(meeting.id).subscribe({
|
||||
next: () => {
|
||||
this.loadMeetings(committeeId);
|
||||
this.snackBar.open('Meeting deleted.', 'Close', { duration: 3000 });
|
||||
},
|
||||
error: (err) => {
|
||||
const msg = err?.error?.errors?.[0]?.defaultUserMessage ?? err?.error?.message ?? 'Delete failed';
|
||||
this.snackBar.open(msg, 'Close', { duration: 4000 });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
patchMeetingStatus(meeting: any, committeeId: number, status: string, event: MouseEvent): void {
|
||||
event.stopPropagation();
|
||||
this.service.patchMeetingStatus(meeting.id, status).subscribe({
|
||||
next: () => {
|
||||
this.loadMeetings(committeeId);
|
||||
this.snackBar.open(`Marked as ${status}.`, 'Close', { duration: 3000 });
|
||||
},
|
||||
error: () => this.snackBar.open('Status update failed.', 'Close', { duration: 3000 })
|
||||
});
|
||||
}
|
||||
|
||||
meetingStatusColor(status: string): string {
|
||||
const map: Record<string, string> = { SCHEDULED: '#2563eb', COMPLETED: '#10b981', CANCELLED: '#94a3b8' };
|
||||
return map[status] ?? '#64748b';
|
||||
}
|
||||
|
||||
meetingModeIcon(mode: string): string {
|
||||
return mode === 'ONLINE' ? 'video_call' : 'location_on';
|
||||
}
|
||||
|
||||
private emptyForm(): any {
|
||||
return { name: '', description: '', image: null, selectedIds: [] };
|
||||
}
|
||||
|
||||
private emptyMeetingForm(): any {
|
||||
return {
|
||||
title: '',
|
||||
meetingDate: '',
|
||||
meetingTime: '',
|
||||
mode: 'OFFLINE',
|
||||
agenda: '',
|
||||
platform: '',
|
||||
meetingLink: '',
|
||||
meetingIdRef: '',
|
||||
meetingPassword: '',
|
||||
venue: '',
|
||||
address: '',
|
||||
city: ''
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,15 @@ const DETAIL_LABELS: Record<string, string> = {
|
||||
committeeId: 'Committee ID',
|
||||
members: 'Members',
|
||||
addedIds: 'Added IDs',
|
||||
removedAppointmentId: 'Removed Appointment ID'
|
||||
removedAppointmentId: 'Removed Appointment ID',
|
||||
// Committee Meeting
|
||||
meetingId: 'Meeting ID',
|
||||
meetingTitle: 'Meeting Title',
|
||||
meetingDate: 'Meeting Date',
|
||||
mode: 'Mode',
|
||||
platform: 'Platform',
|
||||
venue: 'Venue',
|
||||
city: 'City'
|
||||
};
|
||||
|
||||
const ACTION_META: Record<string, { label: string; icon: string; color: string }> = {
|
||||
@@ -156,7 +164,15 @@ const ACTION_META: Record<string, { label: string; icon: string; color: string }
|
||||
UPDATE_COMMITTEE: { label: 'Committee Updated', icon: 'edit_note', color: '#2563eb' },
|
||||
DISSOLVE_COMMITTEE: { label: 'Committee Dissolved', icon: 'group_off', color: '#dc2626' },
|
||||
ADD_COMMITTEE_MEMBER: { label: 'Member Added', icon: 'group_add', color: '#0891b2' },
|
||||
REMOVE_COMMITTEE_MEMBER: { label: 'Member Removed', icon: 'person_off', color: '#d97706' }
|
||||
REMOVE_COMMITTEE_MEMBER: { label: 'Member Removed', icon: 'person_off', color: '#d97706' },
|
||||
// Committee Meeting
|
||||
SCHEDULE_MEETING: { label: 'Meeting Scheduled', icon: 'event', color: '#16a34a' },
|
||||
UPDATE_MEETING: { label: 'Meeting Updated', icon: 'edit_calendar', color: '#2563eb' },
|
||||
CANCEL_MEETING: { label: 'Meeting Cancelled', icon: 'event_busy', color: '#dc2626' },
|
||||
COMPLETE_MEETING: { label: 'Meeting Completed', icon: 'event_available', color: '#10b981' },
|
||||
DELETE_MEETING: { label: 'Meeting Deleted', icon: 'delete_outline', color: '#94a3b8' },
|
||||
SCHEDULE_MEETING_FAILED: { label: 'Schedule Failed', icon: 'error_outline', color: '#dc2626' },
|
||||
UPDATE_MEETING_FAILED: { label: 'Update Meeting Failed', icon: 'error_outline', color: '#dc2626' }
|
||||
};
|
||||
|
||||
@Component({
|
||||
@@ -269,7 +285,14 @@ export class ElectionAuditLogComponent implements OnInit, OnDestroy {
|
||||
'UPDATE_COMMITTEE',
|
||||
'DISSOLVE_COMMITTEE',
|
||||
'ADD_COMMITTEE_MEMBER',
|
||||
'REMOVE_COMMITTEE_MEMBER'
|
||||
'REMOVE_COMMITTEE_MEMBER',
|
||||
'SCHEDULE_MEETING',
|
||||
'UPDATE_MEETING',
|
||||
'CANCEL_MEETING',
|
||||
'COMPLETE_MEETING',
|
||||
'DELETE_MEETING',
|
||||
'SCHEDULE_MEETING_FAILED',
|
||||
'UPDATE_MEETING_FAILED'
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
@@ -244,4 +244,29 @@ export class ElectionService {
|
||||
dissolveCommittee(id: number): Observable<any> {
|
||||
return this.http.post(`/election/committees/${id}/dissolve`, {});
|
||||
}
|
||||
|
||||
// ── Committee Meetings ─────────────────────────────────────────
|
||||
getMeetings(committeeId: number): Observable<any[]> {
|
||||
return this.http.get<any[]>(`/election/committee-meetings/committee/${committeeId}`).pipe(catchError(() => of([])));
|
||||
}
|
||||
|
||||
getMeeting(meetingId: number): Observable<any> {
|
||||
return this.http.get<any>(`/election/committee-meetings/${meetingId}`);
|
||||
}
|
||||
|
||||
scheduleMeeting(committeeId: number, data: any): Observable<any> {
|
||||
return this.http.post(`/election/committee-meetings/committee/${committeeId}`, data);
|
||||
}
|
||||
|
||||
updateMeeting(meetingId: number, data: any): Observable<any> {
|
||||
return this.http.put(`/election/committee-meetings/${meetingId}`, data);
|
||||
}
|
||||
|
||||
patchMeetingStatus(meetingId: number, status: string): Observable<any> {
|
||||
return this.http.patch(`/election/committee-meetings/${meetingId}/status`, { status });
|
||||
}
|
||||
|
||||
deleteMeeting(meetingId: number): Observable<any> {
|
||||
return this.http.delete(`/election/committee-meetings/${meetingId}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user