WIP
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
||||
import { InputsModule } from '@progress/kendo-angular-inputs';
|
||||
import { DisbursementApiService } from '../../services/disbursement-api.service';
|
||||
import { ChurchProfileDto } from '../../models/disbursement.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-church-profile-page',
|
||||
standalone: true,
|
||||
imports: [CommonModule, FormsModule, ButtonsModule, InputsModule],
|
||||
templateUrl: './church-profile-page.component.html',
|
||||
})
|
||||
export class ChurchProfilePageComponent implements OnInit {
|
||||
model: ChurchProfileDto | null = null;
|
||||
saving = false;
|
||||
savedMsg = '';
|
||||
|
||||
constructor(private api: DisbursementApiService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.api.getChurchProfile().subscribe(p => (this.model = p));
|
||||
}
|
||||
|
||||
save(): void {
|
||||
if (!this.model || this.saving) return;
|
||||
this.saving = true;
|
||||
this.savedMsg = '';
|
||||
const { id, ...req } = this.model;
|
||||
this.api.updateChurchProfile(req).subscribe({
|
||||
next: () => { this.saving = false; this.savedMsg = 'Saved / 已儲存'; },
|
||||
error: () => {
|
||||
// Error message is shown globally by httpErrorInterceptor.
|
||||
this.saving = false;
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user