Fix populating water report from ID, make ContactSimple
ContactSimple is the replacement for ContactReporter, which was the simplified form of a contact from a report. I made the name more generic and use it in the general report structures for consistency.
This commit is contained in:
parent
75d0283453
commit
5e103f46a0
14 changed files with 103 additions and 108 deletions
|
|
@ -70,12 +70,12 @@
|
|||
}}</a>
|
||||
</label>
|
||||
<label
|
||||
v-if="report.reporter.phone.e164 != ''"
|
||||
v-if="report.reporter.phone.number != ''"
|
||||
class="form-label text-muted small mb-0"
|
||||
>
|
||||
<i class="bi bi-phone"></i>
|
||||
<a :href="'tel:+' + report.reporter.phone.e164">{{
|
||||
report.reporter.phone.e164
|
||||
<a :href="'tel:+' + report.reporter.phone.number">{{
|
||||
report.reporter.phone.number
|
||||
}}</a>
|
||||
</label>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@
|
|||
v-if="
|
||||
!(
|
||||
selectedReport?.reporter.email ||
|
||||
selectedReport?.reporter.phone.e164 != ''
|
||||
selectedReport?.reporter.phone.number != ''
|
||||
)
|
||||
"
|
||||
class="mb-3"
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
<div
|
||||
v-if="
|
||||
selectedReport?.reporter.email ||
|
||||
selectedReport?.reporter.phone.e164 != ''
|
||||
selectedReport?.reporter.phone.number != ''
|
||||
"
|
||||
class="mb-3"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -86,14 +86,11 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label
|
||||
v-if="report.owner.emails.length"
|
||||
class="form-label text-muted small mb-0"
|
||||
>
|
||||
<label v-if="report.owner.email" class="form-label text-muted small mb-0">
|
||||
<i class="bi bi-envelope"></i>
|
||||
</label>
|
||||
<label
|
||||
v-if="report.owner.phones.length"
|
||||
v-if="report.owner.phone.number"
|
||||
class="form-label text-muted small mb-0"
|
||||
>
|
||||
<i class="bi bi-phone"></i>
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ const hasCompleteResponse = computed(() => {
|
|||
r.images.length > 0 ||
|
||||
r.permission_type == PermissionType.GRANTED ||
|
||||
r.reporter.name ||
|
||||
r.reporter.phone.e164 != "" ||
|
||||
r.reporter.phone.number != "" ||
|
||||
r.reporter.email
|
||||
) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
id="contact-phone"
|
||||
name="phone"
|
||||
placeholder="(555) 123-4567"
|
||||
v-model="modelValue.reporter.phone.e164"
|
||||
v-model="modelValue.reporter.phone.number"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@
|
|||
class="summary-value"
|
||||
v-if="
|
||||
modelValue.reporter?.phone ||
|
||||
modelValue.reporter?.phone.e164 != ''
|
||||
modelValue.reporter?.phone.number != ''
|
||||
"
|
||||
>
|
||||
{{ modelValue.reporter.phone }}
|
||||
|
|
|
|||
|
|
@ -103,23 +103,23 @@ export interface ContactDTO {
|
|||
phones: Phone[];
|
||||
uri: string;
|
||||
}
|
||||
export interface ContactReporterOptions {
|
||||
export interface ContactSimpleOptions {
|
||||
email?: string;
|
||||
name?: string;
|
||||
phone?: Phone;
|
||||
phone?: PhoneSimple;
|
||||
uri?: string;
|
||||
}
|
||||
export class ContactReporter {
|
||||
export class ContactSimple {
|
||||
email: string;
|
||||
name: string;
|
||||
phone: Phone;
|
||||
phone: PhoneSimple;
|
||||
uri: string;
|
||||
constructor(options?: ContactReporterOptions) {
|
||||
constructor(options?: ContactSimpleOptions) {
|
||||
this.email = options?.email ?? "";
|
||||
this.name = options?.name ?? "";
|
||||
this.phone = options?.phone ?? {
|
||||
e164: "",
|
||||
can_sms: true,
|
||||
number: "",
|
||||
};
|
||||
this.uri = options?.uri ?? "";
|
||||
}
|
||||
|
|
@ -219,7 +219,7 @@ export interface ComplianceUpdate {
|
|||
//images?: Image[];
|
||||
location?: Location;
|
||||
permission_type?: string;
|
||||
reporter?: ContactReporter;
|
||||
reporter?: ContactSimple;
|
||||
submitted?: string;
|
||||
//uri: string;
|
||||
wants_scheduled?: boolean;
|
||||
|
|
@ -236,7 +236,7 @@ export interface PublicReportDTO {
|
|||
location: Location;
|
||||
log: LogEntryDTO[];
|
||||
public_id: string;
|
||||
reporter: ContactReporter;
|
||||
reporter: ContactSimple;
|
||||
status: string;
|
||||
type: string;
|
||||
uri: string;
|
||||
|
|
@ -248,7 +248,7 @@ export interface PublicReportUpdate {
|
|||
images?: Image[];
|
||||
location?: Location;
|
||||
public_id?: string;
|
||||
reporter?: ContactReporter;
|
||||
reporter?: ContactSimple;
|
||||
status?: string;
|
||||
type?: string;
|
||||
uri?: string;
|
||||
|
|
@ -266,7 +266,7 @@ export interface PublicReportOptions {
|
|||
location: Location;
|
||||
log: LogEntry[];
|
||||
public_id: string;
|
||||
reporter: ContactReporter;
|
||||
reporter: ContactSimple;
|
||||
status: string;
|
||||
type: string;
|
||||
uri: string;
|
||||
|
|
@ -278,7 +278,7 @@ export class PublicReport {
|
|||
images: Image[];
|
||||
log: LogEntry[];
|
||||
public_id: string;
|
||||
reporter: ContactReporter;
|
||||
reporter: ContactSimple;
|
||||
status: string;
|
||||
type: string;
|
||||
uri: string;
|
||||
|
|
@ -290,7 +290,7 @@ export class PublicReport {
|
|||
this.images = options?.images ?? [];
|
||||
this.log = options?.log ?? [];
|
||||
this.public_id = options?.public_id ?? "";
|
||||
this.reporter = options?.reporter ?? new ContactReporter();
|
||||
this.reporter = options?.reporter ?? new ContactSimple();
|
||||
this.status = options?.status ?? "";
|
||||
this.type = options?.type ?? "";
|
||||
this.uri = options?.uri ?? "";
|
||||
|
|
@ -469,7 +469,7 @@ export interface PublicReportWaterDTO extends PublicReportDTO {
|
|||
has_pupae: boolean;
|
||||
is_reporter_confidential: boolean;
|
||||
is_reporter_owner: boolean;
|
||||
owner: Contact;
|
||||
owner: ContactSimple;
|
||||
}
|
||||
export interface PublicReportWaterOptions extends PublicReportOptions {
|
||||
access_comments: string;
|
||||
|
|
@ -485,7 +485,7 @@ export interface PublicReportWaterOptions extends PublicReportOptions {
|
|||
has_pupae: boolean;
|
||||
is_reporter_confidential: boolean;
|
||||
is_reporter_owner: boolean;
|
||||
owner: Contact;
|
||||
owner: ContactSimple;
|
||||
}
|
||||
export class PublicReportWater extends PublicReport {
|
||||
access_comments: string;
|
||||
|
|
@ -501,7 +501,7 @@ export class PublicReportWater extends PublicReport {
|
|||
has_pupae: boolean;
|
||||
is_reporter_confidential: boolean;
|
||||
is_reporter_owner: boolean;
|
||||
owner: Contact;
|
||||
owner: ContactSimple;
|
||||
constructor(options: PublicReportWaterOptions) {
|
||||
super(options);
|
||||
this.access_comments = options.access_comments;
|
||||
|
|
@ -848,6 +848,10 @@ export interface Phone {
|
|||
can_sms: boolean;
|
||||
e164: string;
|
||||
}
|
||||
export interface PhoneSimple {
|
||||
can_sms: boolean;
|
||||
number: string;
|
||||
}
|
||||
export interface PhoneReporter {
|
||||
can_sms: boolean;
|
||||
number: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue