feat(web): functional-class override on the expense form
This commit is contained in:
+13
@@ -59,6 +59,19 @@
|
|||||||
</kendo-dropdownlist>
|
</kendo-dropdownlist>
|
||||||
</label>
|
</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 -->
|
<!-- Amount -->
|
||||||
<label class="flex flex-col gap-1">Amount
|
<label class="flex flex-col gap-1">Amount
|
||||||
<kendo-numerictextbox
|
<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 { MemberListItemDto, memberDisplayName } from '../../../members/models/member.model';
|
||||||
import {
|
import {
|
||||||
MinistryDto, ExpenseCategoryGroupDto, ExpenseSubCategoryDto, ExpenseType, CreateExpenseRequest,
|
MinistryDto, ExpenseCategoryGroupDto, ExpenseSubCategoryDto, ExpenseType, CreateExpenseRequest,
|
||||||
ExpenseListItemDto,
|
ExpenseListItemDto, FunctionalClass,
|
||||||
} from '../../models/expense.model';
|
} from '../../models/expense.model';
|
||||||
|
|
||||||
export interface ExpenseFormResult {
|
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. */
|
/** Continuous-entry toggle: keep member/ministry/category/date and the dialog open after each save. */
|
||||||
continueEntry = false;
|
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. */
|
/** The on-behalf reimbursement create flow is the only place continuous entry applies. */
|
||||||
get showContinueEntry(): boolean {
|
get showContinueEntry(): boolean {
|
||||||
return this.mode === 'reimbursement' && this.allowMemberPick && !this.expense;
|
return this.mode === 'reimbursement' && this.allowMemberPick && !this.expense;
|
||||||
@@ -67,6 +73,7 @@ export class ExpenseFormDialogComponent implements OnInit {
|
|||||||
checkNumber: '',
|
checkNumber: '',
|
||||||
memberId: null as number | null,
|
memberId: null as number | null,
|
||||||
expenseDate: new Date(),
|
expenseDate: new Date(),
|
||||||
|
functionalClass: null as FunctionalClass | null,
|
||||||
};
|
};
|
||||||
receipt: File | null = null;
|
receipt: File | null = null;
|
||||||
|
|
||||||
@@ -101,6 +108,7 @@ export class ExpenseFormDialogComponent implements OnInit {
|
|||||||
checkNumber: expense.checkNumber ?? '',
|
checkNumber: expense.checkNumber ?? '',
|
||||||
memberId: expense.memberId,
|
memberId: expense.memberId,
|
||||||
expenseDate: new Date(year, month - 1, day),
|
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,
|
checkNumber: this.mode === 'vendor' ? (this.form.checkNumber || null) : null,
|
||||||
expenseDate,
|
expenseDate,
|
||||||
notes: null,
|
notes: null,
|
||||||
functionalClass: null,
|
functionalClass: this.form.functionalClass,
|
||||||
};
|
};
|
||||||
// The request and receipt are snapshotted here, so resetting the form right
|
// The request and receipt are snapshotted here, so resetting the form right
|
||||||
// after emitting is safe even though the parent saves asynchronously.
|
// after emitting is safe even though the parent saves asynchronously.
|
||||||
|
|||||||
Reference in New Issue
Block a user