feat: implement cashier dashboard, dividend dashboards, share accounts views, and checker tasks
This commit is contained in:
@@ -14,6 +14,8 @@ import { MatDialog } from '@angular/material/dialog';
|
||||
/** Custom Dialogs */
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
import { ShareCertificateDialogComponent } from './share-certificate-dialog/share-certificate-dialog.component';
|
||||
import { ApplyCollectionDialogComponent } from './apply-collection-dialog/apply-collection-dialog.component';
|
||||
import { DebitFromSavingsDialogComponent } from './debit-from-savings-dialog/debit-from-savings-dialog.component';
|
||||
|
||||
/** Custom Services */
|
||||
import { SharesService } from '../shares.service';
|
||||
@@ -182,6 +184,12 @@ export class SharesAccountViewComponent implements OnInit {
|
||||
case 'Edit Details':
|
||||
this.router.navigate(['edit-details'], { relativeTo: this.route });
|
||||
break;
|
||||
case 'Apply Collection':
|
||||
this.applyCollection();
|
||||
break;
|
||||
case 'Debit from Savings':
|
||||
this.debitFromSavings();
|
||||
break;
|
||||
case 'Share Certificate':
|
||||
this.viewShareCertificate();
|
||||
break;
|
||||
@@ -191,6 +199,70 @@ export class SharesAccountViewComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Settles the member's Share Advance receipt against this account: the cash moves out of Share
|
||||
* Sundry into share capital, and the purchase entry becomes visible in the transactions and
|
||||
* passbook views.
|
||||
*/
|
||||
private applyCollection() {
|
||||
const dialogRef = this.dialog.open(ApplyCollectionDialogComponent, {
|
||||
width: '560px',
|
||||
data: {
|
||||
shareAccountId: this.sharesAccountData.id,
|
||||
clientId: this.sharesAccountData.clientId,
|
||||
accountNo: this.sharesAccountData.accountNo
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe((result: any) => {
|
||||
if (result) {
|
||||
// Account data comes from a route resolver, so re-running the route is what refreshes the
|
||||
// newly revealed transaction and the now-paid charges.
|
||||
this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => {
|
||||
this.router.navigate([
|
||||
'/clients',
|
||||
this.sharesAccountData.clientId,
|
||||
'shares-accounts',
|
||||
this.sharesAccountData.id
|
||||
]);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the member's money has actually been taken and the shares issued.
|
||||
*
|
||||
* Until then the account is only an application: nothing has been debited and the member holds
|
||||
* nothing. The Transactions, Passbook and Charges tabs all describe money that has moved, so
|
||||
* showing them at that point reads as though the member has paid and holds shares when they have
|
||||
* done neither.
|
||||
*
|
||||
* Neither the account's status nor the purchase transaction's status can stand in for this: an
|
||||
* account goes Approved then Activated before anything is settled, and the purchase reads
|
||||
* Approved from the moment the account is approved. Only `collectionApplied` marks the point at
|
||||
* which the money was actually taken — by cash collection or by debiting savings.
|
||||
*/
|
||||
get isSettled(): boolean {
|
||||
return !!this.sharesAccountData?.collectionApplied;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settles this account out of the member's linked savings instead of cash at the counter.
|
||||
*
|
||||
* Only records a request — a manager's approval is what debits the member and issues the shares —
|
||||
* so unlike Apply Collection there is nothing to refresh here until that approval happens.
|
||||
*/
|
||||
private debitFromSavings() {
|
||||
this.dialog.open(DebitFromSavingsDialogComponent, {
|
||||
width: '560px',
|
||||
data: {
|
||||
shareAccountId: this.sharesAccountData.id,
|
||||
clientId: this.sharesAccountData.clientId,
|
||||
accountNo: this.sharesAccountData.accountNo
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes Shares Account.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user