···
@state() isLoading = true;
@state() searchTerm = "";
@state() activeTab: "classes" | "waitlist" = "classes";
@state() approvingEntry: WaitlistEntry | null = null;
+
@state() showModal = false;
@state() meetingTimes: MeetingTime[] = [];
@state() editingClass = {
···
private handleCreateClass() {
+
// Set empty form for creating new class
+
this.approvingEntry = null;
+
year: new Date().getFullYear(),
+
this.meetingTimes = [];
private getFilteredClasses() {
···
+
${this.showModal ? this.renderApprovalModal() : ""}
···
private handleMeetingTimesChange(e: CustomEvent) {
···
private cancelApproval() {
+
this.showModal = false;
this.approvingEntry = null;
···
private async submitApproval() {
if (this.meetingTimes.length === 0) {
this.error = "Please add at least one meeting time";
···
throw new Error(data.error || "Failed to create class");
+
// If approving from waitlist, delete the waitlist entry
+
if (this.approvingEntry) {
+
await fetch(`/api/admin/waitlist/${this.approvingEntry.id}`, {
this.activeTab = "classes";
+
this.showModal = false;
this.approvingEntry = null;
···
+
: "Failed to create class. Please try again.";
private renderApprovalModal() {
+
const isApproving = !!this.approvingEntry;
+
const title = isApproving ? "Review & Create Class" : "Create New Class";
+
const description = isApproving
+
? "Review the class details and make any edits before creating"
+
: "Enter the class details below";
<div class="modal-overlay" @click=${this.cancelApproval}>
<div class="modal" @click=${(e: Event) => e.stopPropagation()}>
+
<h2 class="modal-title">${title}</h2>
<p style="margin-bottom: 1.5rem; color: var(--paynes-gray);">
${this.error ? html`<div class="error-message">${this.error}</div>` : ""}