feat: add database export, welcome kit dialog, and DIP/sanctions updates
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,26 @@
|
||||
>
|
||||
{{ address.isActive ? 'Active' : 'Inactive' }}
|
||||
</span>
|
||||
<!-- Only shown on the address a welcome kit was actually posted to. -->
|
||||
@if (verificationOf(address); as verification) {
|
||||
<span
|
||||
class="addr-panel__verify"
|
||||
[class.addr-panel__verify--yes]="verification === 'VERIFIED'"
|
||||
[class.addr-panel__verify--no]="verification === 'NOT_VERIFIED'"
|
||||
[matTooltip]="
|
||||
verification === 'VERIFIED'
|
||||
? 'Welcome kit was delivered to this address'
|
||||
: 'Welcome kit sent here was returned undelivered'
|
||||
"
|
||||
>
|
||||
<i
|
||||
class="fa"
|
||||
[class.fa-check-circle]="verification === 'VERIFIED'"
|
||||
[class.fa-times-circle]="verification === 'NOT_VERIFIED'"
|
||||
></i>
|
||||
{{ verification === 'VERIFIED' ? 'Verified' : 'Not Verified' }}
|
||||
</span>
|
||||
}
|
||||
</mat-panel-title>
|
||||
<mat-panel-description class="addr-panel__desc">
|
||||
{{ address.city || '' }}{{ address.city && (address.countyDistrict || address.addressLine3) ? ', ' : ''
|
||||
|
||||
@@ -148,6 +148,32 @@ $red-light: #fce8e6;
|
||||
}
|
||||
}
|
||||
|
||||
/* Welcome kit outcome — only present on the address a kit was posted to. */
|
||||
&__verify {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
padding: 2px 10px;
|
||||
border-radius: 10px;
|
||||
white-space: nowrap;
|
||||
|
||||
i {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
&--yes {
|
||||
background: $green-light;
|
||||
color: $green;
|
||||
}
|
||||
|
||||
&--no {
|
||||
background: $red-light;
|
||||
color: $red;
|
||||
}
|
||||
}
|
||||
|
||||
&__desc {
|
||||
font-size: 12px;
|
||||
color: $gray-500 !important;
|
||||
|
||||
@@ -33,6 +33,7 @@ import {
|
||||
} from '@angular/material/expansion';
|
||||
import { MatDivider } from '@angular/material/divider';
|
||||
import { MatSlideToggle } from '@angular/material/slide-toggle';
|
||||
import { MatTooltip } from '@angular/material/tooltip';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
/**
|
||||
@@ -51,7 +52,8 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
MatExpansionPanelTitle,
|
||||
MatExpansionPanelDescription,
|
||||
MatDivider,
|
||||
MatSlideToggle
|
||||
MatSlideToggle,
|
||||
MatTooltip
|
||||
]
|
||||
})
|
||||
export class AddressTabComponent {
|
||||
@@ -68,6 +70,11 @@ export class AddressTabComponent {
|
||||
clientAddressTemplate: any;
|
||||
/** Client Id */
|
||||
clientId: string;
|
||||
/**
|
||||
* Welcome kit outcome per address id. Only addresses a kit was actually posted to appear here: delivery
|
||||
* proves the address is real, a returned kit proves it is not, and an address with no kit stays unmarked.
|
||||
*/
|
||||
addressVerification: Record<string, 'VERIFIED' | 'NOT_VERIFIED'> = {};
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
@@ -82,10 +89,48 @@ export class AddressTabComponent {
|
||||
this.clientAddressFieldConfig = data.clientAddressFieldConfig;
|
||||
this.clientAddressTemplate = data.clientAddressTemplateData;
|
||||
this.clientId = this.route.parent.snapshot.paramMap.get('clientId');
|
||||
this.loadWelcomeKitVerification();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks addresses a welcome kit was posted to with the outcome of that delivery. The kit is the physical
|
||||
* check on the address, so a delivered kit reads as verified and a returned one as not verified.
|
||||
*/
|
||||
private loadWelcomeKitVerification(): void {
|
||||
if (!this.clientId) {
|
||||
return;
|
||||
}
|
||||
this.clientService.getWelcomeKits(this.clientId).subscribe({
|
||||
next: (response: any) => {
|
||||
const map: Record<string, 'VERIFIED' | 'NOT_VERIFIED'> = {};
|
||||
// Oldest first, so that when an address was posted to more than once the newest outcome wins.
|
||||
const dispatches = [...(response?.dispatches || [])].reverse();
|
||||
for (const dispatch of dispatches) {
|
||||
if (dispatch?.addressId == null) {
|
||||
continue;
|
||||
}
|
||||
if (dispatch.status === 'DELIVERED') {
|
||||
map[dispatch.addressId] = 'VERIFIED';
|
||||
} else if (dispatch.status === 'RETURNED') {
|
||||
map[dispatch.addressId] = 'NOT_VERIFIED';
|
||||
}
|
||||
}
|
||||
this.addressVerification = map;
|
||||
},
|
||||
// A client with no welcome kit permission or no kit yet simply shows no badge.
|
||||
error: () => {
|
||||
this.addressVerification = {};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** Verification badge for an address, or null when no kit has been posted to it. */
|
||||
verificationOf(address: any): 'VERIFIED' | 'NOT_VERIFIED' | null {
|
||||
return this.addressVerification[address?.addressId] || null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a client address.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user