feat(web): default functional class on the ministry form
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ export interface MinistryDto {
|
||||
description_zh: string | null;
|
||||
isActive: boolean;
|
||||
sortOrder: number;
|
||||
defaultFunctionalClass: string;
|
||||
/** Display-only bilingual label, computed in the API service. */
|
||||
label?: string;
|
||||
}
|
||||
@@ -16,6 +17,7 @@ export interface CreateMinistryRequest {
|
||||
description_en: string | null;
|
||||
description_zh: string | null;
|
||||
sortOrder: number;
|
||||
defaultFunctionalClass: string | null;
|
||||
}
|
||||
export interface UpdateMinistryRequest extends CreateMinistryRequest {
|
||||
isActive: boolean;
|
||||
|
||||
@@ -43,6 +43,14 @@
|
||||
Sort order
|
||||
<kendo-numerictextbox [(ngModel)]="form.sortOrder" [format]="'n0'" [decimals]="0" [min]="0"></kendo-numerictextbox>
|
||||
</label>
|
||||
<label class="flex flex-col gap-1">
|
||||
<span>Default Functional Class / 預設功能別</span>
|
||||
<kendo-dropdownlist
|
||||
[data]="functionalClassOptions"
|
||||
textField="label" valueField="value" [valuePrimitive]="true"
|
||||
[(ngModel)]="form.defaultFunctionalClass">
|
||||
</kendo-dropdownlist>
|
||||
</label>
|
||||
<label *ngIf="editing" class="flex items-center gap-2 md:col-span-2">
|
||||
<input type="checkbox" [(ngModel)]="form.isActive" /> Active
|
||||
</label>
|
||||
|
||||
@@ -5,6 +5,7 @@ import { GridModule } from '@progress/kendo-angular-grid';
|
||||
import { InputsModule } from '@progress/kendo-angular-inputs';
|
||||
import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
||||
import { DialogsModule } from '@progress/kendo-angular-dialog';
|
||||
import { DropDownsModule } from '@progress/kendo-angular-dropdowns';
|
||||
import { MinistryApiService } from '../../services/ministry-api.service';
|
||||
import {
|
||||
MinistryDto, CreateMinistryRequest, UpdateMinistryRequest,
|
||||
@@ -14,7 +15,7 @@ import { PageHeaderActionsDirective } from '../../../../shared/directives/page-h
|
||||
@Component({
|
||||
selector: 'app-ministries-page',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule, GridModule, InputsModule, ButtonsModule, DialogsModule, PageHeaderActionsDirective],
|
||||
imports: [CommonModule, FormsModule, GridModule, InputsModule, ButtonsModule, DialogsModule, DropDownsModule, PageHeaderActionsDirective],
|
||||
templateUrl: './ministries-page.component.html',
|
||||
styleUrls: ['./ministries-page.component.scss'],
|
||||
})
|
||||
@@ -23,6 +24,12 @@ export class MinistriesPageComponent implements OnInit {
|
||||
isLoading = false;
|
||||
includeInactive = false;
|
||||
|
||||
readonly functionalClassOptions = [
|
||||
{ value: 'Program', label: 'Program / 事工服務' },
|
||||
{ value: 'ManagementGeneral', label: 'Management & General / 管理' },
|
||||
{ value: 'Fundraising', label: 'Fundraising / 募款' },
|
||||
];
|
||||
|
||||
showDialog = false;
|
||||
editing: MinistryDto | null = null;
|
||||
form: UpdateMinistryRequest = this.blankForm();
|
||||
@@ -47,6 +54,7 @@ export class MinistriesPageComponent implements OnInit {
|
||||
name_en: m.name_en, name_zh: m.name_zh,
|
||||
description_en: m.description_en, description_zh: m.description_zh,
|
||||
isActive: m.isActive, sortOrder: m.sortOrder,
|
||||
defaultFunctionalClass: m.defaultFunctionalClass || 'Program',
|
||||
};
|
||||
this.showDialog = true;
|
||||
}
|
||||
@@ -59,6 +67,7 @@ export class MinistriesPageComponent implements OnInit {
|
||||
name_en: this.form.name_en, name_zh: this.form.name_zh,
|
||||
description_en: this.form.description_en, description_zh: this.form.description_zh,
|
||||
sortOrder: this.form.sortOrder,
|
||||
defaultFunctionalClass: this.form.defaultFunctionalClass,
|
||||
};
|
||||
this.api.create(create).subscribe(() => { this.showDialog = false; this.load(); });
|
||||
}
|
||||
@@ -70,6 +79,6 @@ export class MinistriesPageComponent implements OnInit {
|
||||
}
|
||||
|
||||
private blankForm(): UpdateMinistryRequest {
|
||||
return { name_en: '', name_zh: null, description_en: null, description_zh: null, isActive: true, sortOrder: 0 };
|
||||
return { name_en: '', name_zh: null, description_en: null, description_zh: null, isActive: true, sortOrder: 0, defaultFunctionalClass: 'Program' };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user