feat: add bank accounts and branches management

- Implemented bank accounts management with form and list components.
- Added bank branches management with form and list components.
- Created services for bank accounts and branches to handle API interactions.
- Updated routing to include bank accounts and branches.
- Enhanced UI with new select fields for banks and branches.
- Added necessary models and constants for bank accounts and branches.
- Improved state management for banks using a store pattern.
- Updated menu items to include links for bank accounts and branches.
This commit is contained in:
2025-12-24 21:25:13 +03:30
parent 1373cc046d
commit f671e37b14
50 changed files with 885 additions and 9 deletions
@@ -0,0 +1,2 @@
export * from './list.component';
export * from './single.component';
@@ -0,0 +1,14 @@
<app-page-data-list
[pageTitle]="'مدیریت شعب بانک'"
[addNewCtaLabel]="'افزودن شعبه‌ی جدید'"
[columns]="columns"
[showAdd]="true"
emptyPlaceholderTitle="شعبه‌ای یافت نشد"
emptyPlaceholderDescription="برای افزودن شعبه جدید، روی دکمهٔ بالا کلیک کنید."
[items]="items()"
[loading]="loading()"
[showDetails]="true"
(onAdd)="openAddForm()"
/>
<bank-account-form [(visible)]="visibleForm" (onSubmit)="refresh()" />
@@ -0,0 +1,76 @@
import {
IColumn,
PageDataListComponent,
} from '@/shared/components/pageDataList/page-data-list.component';
import { Component, signal } from '@angular/core';
import { BankAccountFormComponent } from '../components/form.component';
import { IBankAccountsResponse } from '../models';
import { BankAccountsService } from '../services/main.service';
@Component({
selector: 'app-bank-accounts',
templateUrl: './list.component.html',
imports: [PageDataListComponent, BankAccountFormComponent],
})
export class BankAccountsComponent {
constructor(private service: BankAccountsService) {
this.getData();
}
columns = [
{ field: 'id', header: 'شناسه', width: '60px' },
{
field: 'name',
header: 'نام',
minWidth: '100px',
},
{
field: 'bank',
header: 'شعبه',
customDataModel(item) {
return `شعبه‌ی ${item.branch?.name} بانک ${item.branch?.bank?.name}`;
},
minWidth: '200px',
},
{
field: 'accountNumber',
header: 'شماره حساب بانکی',
canCopy: true,
minWidth: '160px',
},
{
field: 'iban',
header: 'شماره شبا',
canCopy: true,
minWidth: '200px',
},
{
field: 'cardNumber',
header: 'شماره کارت بانکی',
canCopy: true,
minWidth: '160px',
},
{ field: 'createdAt', header: 'تاریخ ایجاد', type: 'date' },
{ field: 'updatedAt', header: 'تاریخ به‌روزرسانی', type: 'date' },
] as IColumn[];
loading = signal(false);
items = signal<IBankAccountsResponse[]>([]);
visibleForm = signal(false);
refresh() {
this.getData();
}
getData() {
this.loading.set(true);
this.service.getAll().subscribe((res) => {
this.loading.set(false);
this.items.set(res.data);
});
}
openAddForm() {
this.visibleForm.set(true);
}
}
@@ -0,0 +1 @@
<div class=""></div>
@@ -0,0 +1,9 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-bank-account',
templateUrl: './single.component.html',
})
export class BankAccountComponent {
constructor() {}
}