feat(web): functional-class override on the expense form
This commit is contained in:
+13
@@ -59,6 +59,19 @@
|
||||
</kendo-dropdownlist>
|
||||
</label>
|
||||
|
||||
<!-- Functional Class override -->
|
||||
<label class="flex flex-col gap-1">
|
||||
<span>Functional Class / 功能別</span>
|
||||
<kendo-dropdownlist
|
||||
[data]="functionalClassOptions"
|
||||
textField="label"
|
||||
valueField="value"
|
||||
[valuePrimitive]="true"
|
||||
[defaultItem]="{ value: null, label: '(Inherit ministry / 沿用事工)' }"
|
||||
[(ngModel)]="form.functionalClass">
|
||||
</kendo-dropdownlist>
|
||||
</label>
|
||||
|
||||
<!-- Amount -->
|
||||
<label class="flex flex-col gap-1">Amount
|
||||
<kendo-numerictextbox
|
||||
|
||||
+10
-2
@@ -12,7 +12,7 @@ import { MemberApiService } from '../../../members/services/member-api.service';
|
||||
import { MemberListItemDto, memberDisplayName } from '../../../members/models/member.model';
|
||||
import {
|
||||
MinistryDto, ExpenseCategoryGroupDto, ExpenseSubCategoryDto, ExpenseType, CreateExpenseRequest,
|
||||
ExpenseListItemDto,
|
||||
ExpenseListItemDto, FunctionalClass,
|
||||
} from '../../models/expense.model';
|
||||
|
||||
export interface ExpenseFormResult {
|
||||
@@ -52,6 +52,12 @@ export class ExpenseFormDialogComponent implements OnInit {
|
||||
/** Continuous-entry toggle: keep member/ministry/category/date and the dialog open after each save. */
|
||||
continueEntry = false;
|
||||
|
||||
readonly functionalClassOptions: { value: FunctionalClass; label: string }[] = [
|
||||
{ value: 'Program', label: 'Program / 事工服務' },
|
||||
{ value: 'ManagementGeneral', label: 'Management & General / 管理' },
|
||||
{ value: 'Fundraising', label: 'Fundraising / 募款' },
|
||||
];
|
||||
|
||||
/** The on-behalf reimbursement create flow is the only place continuous entry applies. */
|
||||
get showContinueEntry(): boolean {
|
||||
return this.mode === 'reimbursement' && this.allowMemberPick && !this.expense;
|
||||
@@ -67,6 +73,7 @@ export class ExpenseFormDialogComponent implements OnInit {
|
||||
checkNumber: '',
|
||||
memberId: null as number | null,
|
||||
expenseDate: new Date(),
|
||||
functionalClass: null as FunctionalClass | null,
|
||||
};
|
||||
receipt: File | null = null;
|
||||
|
||||
@@ -101,6 +108,7 @@ export class ExpenseFormDialogComponent implements OnInit {
|
||||
checkNumber: expense.checkNumber ?? '',
|
||||
memberId: expense.memberId,
|
||||
expenseDate: new Date(year, month - 1, day),
|
||||
functionalClass: expense.functionalClass ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -146,7 +154,7 @@ export class ExpenseFormDialogComponent implements OnInit {
|
||||
checkNumber: this.mode === 'vendor' ? (this.form.checkNumber || null) : null,
|
||||
expenseDate,
|
||||
notes: null,
|
||||
functionalClass: null,
|
||||
functionalClass: this.form.functionalClass,
|
||||
};
|
||||
// The request and receipt are snapshotted here, so resetting the form right
|
||||
// after emitting is safe even though the parent saves asynchronously.
|
||||
|
||||
Reference in New Issue
Block a user