mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 17:44:58 +00:00
Refactor third-party type imports and update related components
- Changed import path for ThirdParty type in TypeThirdParty.vue and updated its usage. - Refactored PersonText.vue to import Person and AltName types from ChillPersonAssets. - Updated types.ts in ChillThirdPartyBundle to include a new 'type' field in the Thirdparty interface. - Modified TicketBundle types to accommodate Thirdparty type in CallerState. - Adjusted AddresseeSelectorComponent.vue to use 'thirdparty' instead of 'third_party'. - Refined BannerComponent.vue to improve readability and maintainability. - Updated CallerSelectorComponent.vue to reflect changes in entity types. - Enhanced TicketHistoryListComponent.vue to handle both Person and Thirdparty types. - Refactored TicketHistoryPersonComponent.vue to accept both Person and Thirdparty entities.
This commit is contained in:
@@ -1,309 +1,315 @@
|
||||
import { StoredObject } from "ChillDocStoreAssets/types";
|
||||
import {
|
||||
Address,
|
||||
Center,
|
||||
Civility,
|
||||
DateTime,
|
||||
User,
|
||||
UserGroup,
|
||||
Household,
|
||||
ThirdParty,
|
||||
WorkflowAvailable,
|
||||
Scope,
|
||||
Job,
|
||||
PrivateCommentEmbeddable,
|
||||
Address,
|
||||
Center,
|
||||
Civility,
|
||||
DateTime,
|
||||
User,
|
||||
UserGroup,
|
||||
Household,
|
||||
WorkflowAvailable,
|
||||
Scope,
|
||||
Job,
|
||||
PrivateCommentEmbeddable,
|
||||
} from "../../../ChillMainBundle/Resources/public/types";
|
||||
import { Thirdparty } from "../../../ChillThirdPartyBundle/Resources/public/types";
|
||||
import { Calendar } from "../../../ChillCalendarBundle/Resources/public/types";
|
||||
|
||||
export interface AltName {
|
||||
label: string;
|
||||
key: string;
|
||||
}
|
||||
|
||||
export interface Person {
|
||||
id: number;
|
||||
type: "person";
|
||||
text: string;
|
||||
textAge: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
current_household_address: Address | null;
|
||||
birthdate: DateTime | null;
|
||||
deathdate: DateTime | null;
|
||||
age: number;
|
||||
phonenumber: string;
|
||||
mobilenumber: string;
|
||||
email: string;
|
||||
gender: "woman" | "man" | "other";
|
||||
centers: Center[];
|
||||
civility: Civility | null;
|
||||
current_household_id: number;
|
||||
current_residential_addresses: Address[];
|
||||
id: number;
|
||||
type: "person";
|
||||
text: string;
|
||||
textAge: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
altNames: AltName[];
|
||||
suffixText: string;
|
||||
current_household_address: Address | null;
|
||||
birthdate: DateTime | null;
|
||||
deathdate: DateTime | null;
|
||||
age: number;
|
||||
phonenumber: string;
|
||||
mobilenumber: string;
|
||||
email: string;
|
||||
gender: "woman" | "man" | "other";
|
||||
centers: Center[];
|
||||
civility: Civility | null;
|
||||
current_household_id: number;
|
||||
current_residential_addresses: Address[];
|
||||
}
|
||||
|
||||
export interface AccompanyingPeriod {
|
||||
id: number;
|
||||
addressLocation?: Address | null;
|
||||
administrativeLocation?: Location | null;
|
||||
calendars: Calendar[];
|
||||
closingDate?: Date | null;
|
||||
closingMotive?: ClosingMotive | null;
|
||||
comments: Comment[];
|
||||
confidential: boolean;
|
||||
createdAt?: Date | null;
|
||||
createdBy?: User | null;
|
||||
emergency: boolean;
|
||||
intensity?: "occasional" | "regular";
|
||||
job?: Job | null;
|
||||
locationHistories: AccompanyingPeriodLocationHistory[];
|
||||
openingDate?: Date | null;
|
||||
origin?: Origin | null;
|
||||
participations: AccompanyingPeriodParticipation[];
|
||||
personLocation?: Person | null;
|
||||
pinnedComment?: Comment | null;
|
||||
preventUserIsChangedNotification: boolean;
|
||||
remark: string;
|
||||
requestorAnonymous: boolean;
|
||||
requestorPerson?: Person | null;
|
||||
requestorThirdParty?: Thirdparty | null;
|
||||
resources: AccompanyingPeriodResource[];
|
||||
scopes: Scope[];
|
||||
socialIssues: SocialIssue[];
|
||||
step?:
|
||||
| "CLOSED"
|
||||
| "CONFIRMED"
|
||||
| "CONFIRMED_INACTIVE_SHORT"
|
||||
| "CONFIRMED_INACTIVE_LONG"
|
||||
| "DRAFT";
|
||||
id: number;
|
||||
addressLocation?: Address | null;
|
||||
administrativeLocation?: Location | null;
|
||||
calendars: Calendar[];
|
||||
closingDate?: Date | null;
|
||||
closingMotive?: ClosingMotive | null;
|
||||
comments: Comment[];
|
||||
confidential: boolean;
|
||||
createdAt?: Date | null;
|
||||
createdBy?: User | null;
|
||||
emergency: boolean;
|
||||
intensity?: "occasional" | "regular";
|
||||
job?: Job | null;
|
||||
locationHistories: AccompanyingPeriodLocationHistory[];
|
||||
openingDate?: Date | null;
|
||||
origin?: Origin | null;
|
||||
participations: AccompanyingPeriodParticipation[];
|
||||
personLocation?: Person | null;
|
||||
pinnedComment?: Comment | null;
|
||||
preventUserIsChangedNotification: boolean;
|
||||
remark: string;
|
||||
requestorAnonymous: boolean;
|
||||
requestorPerson?: Person | null;
|
||||
requestorThirdParty?: Thirdparty | null;
|
||||
resources: AccompanyingPeriodResource[];
|
||||
scopes: Scope[];
|
||||
socialIssues: SocialIssue[];
|
||||
step?:
|
||||
| "CLOSED"
|
||||
| "CONFIRMED"
|
||||
| "CONFIRMED_INACTIVE_SHORT"
|
||||
| "CONFIRMED_INACTIVE_LONG"
|
||||
| "DRAFT";
|
||||
}
|
||||
|
||||
export interface AccompanyingPeriodWork {
|
||||
id: number;
|
||||
accompanyingPeriod?: AccompanyingPeriod;
|
||||
accompanyingPeriodWorkEvaluations: AccompanyingPeriodWorkEvaluation[];
|
||||
createdAt?: string;
|
||||
createdAutomatically: boolean;
|
||||
createdAutomaticallyReason: string;
|
||||
createdBy: User;
|
||||
endDate?: string;
|
||||
goals: AccompanyingPeriodWorkGoal[];
|
||||
handlingThierParty?: Thirdparty;
|
||||
note: string;
|
||||
persons: Person[];
|
||||
privateComment: PrivateCommentEmbeddable;
|
||||
referrersHistory: AccompanyingPeriodWorkReferrerHistory[];
|
||||
results: Result[];
|
||||
socialAction?: SocialAction;
|
||||
startDate?: string;
|
||||
thirdParties: Thirdparty[];
|
||||
updatedAt?: string;
|
||||
updatedBy: User;
|
||||
version: number;
|
||||
id: number;
|
||||
accompanyingPeriod?: AccompanyingPeriod;
|
||||
accompanyingPeriodWorkEvaluations: AccompanyingPeriodWorkEvaluation[];
|
||||
createdAt?: string;
|
||||
createdAutomatically: boolean;
|
||||
createdAutomaticallyReason: string;
|
||||
createdBy: User;
|
||||
endDate?: string;
|
||||
goals: AccompanyingPeriodWorkGoal[];
|
||||
handlingThierParty?: Thirdparty;
|
||||
note: string;
|
||||
persons: Person[];
|
||||
privateComment: PrivateCommentEmbeddable;
|
||||
referrersHistory: AccompanyingPeriodWorkReferrerHistory[];
|
||||
results: Result[];
|
||||
socialAction?: SocialAction;
|
||||
startDate?: string;
|
||||
thirdParties: Thirdparty[];
|
||||
updatedAt?: string;
|
||||
updatedBy: User;
|
||||
version: number;
|
||||
}
|
||||
|
||||
export interface SocialAction {
|
||||
id: number;
|
||||
parent?: SocialAction | null;
|
||||
children: SocialAction[];
|
||||
issue?: SocialIssue | null;
|
||||
ordering: number;
|
||||
title: {
|
||||
fr: string;
|
||||
};
|
||||
defaultNotificationDelay?: string | null;
|
||||
desactivationDate?: string | null;
|
||||
evaluations: Evaluation[];
|
||||
goals: Goal[];
|
||||
results: Result[];
|
||||
id: number;
|
||||
parent?: SocialAction | null;
|
||||
children: SocialAction[];
|
||||
issue?: SocialIssue | null;
|
||||
ordering: number;
|
||||
title: {
|
||||
fr: string;
|
||||
};
|
||||
defaultNotificationDelay?: string | null;
|
||||
desactivationDate?: string | null;
|
||||
evaluations: Evaluation[];
|
||||
goals: Goal[];
|
||||
results: Result[];
|
||||
}
|
||||
|
||||
export interface AccompanyingPeriodResource {
|
||||
id: number;
|
||||
accompanyingPeriod: AccompanyingPeriod;
|
||||
comment?: string | null;
|
||||
person?: Person | null;
|
||||
thirdParty?: Thirdparty | null;
|
||||
id: number;
|
||||
accompanyingPeriod: AccompanyingPeriod;
|
||||
comment?: string | null;
|
||||
person?: Person | null;
|
||||
thirdParty?: Thirdparty | null;
|
||||
}
|
||||
|
||||
export interface Origin {
|
||||
id: number;
|
||||
label: {
|
||||
fr: string;
|
||||
};
|
||||
noActiveAfter: DateTime;
|
||||
id: number;
|
||||
label: {
|
||||
fr: string;
|
||||
};
|
||||
noActiveAfter: DateTime;
|
||||
}
|
||||
|
||||
export interface ClosingMotive {
|
||||
id: number;
|
||||
active: boolean;
|
||||
name: {
|
||||
fr: string;
|
||||
};
|
||||
ordering: number;
|
||||
isCanceledAccompanyingPeriod: boolean;
|
||||
parent?: ClosingMotive | null;
|
||||
children: ClosingMotive[];
|
||||
id: number;
|
||||
active: boolean;
|
||||
name: {
|
||||
fr: string;
|
||||
};
|
||||
ordering: number;
|
||||
isCanceledAccompanyingPeriod: boolean;
|
||||
parent?: ClosingMotive | null;
|
||||
children: ClosingMotive[];
|
||||
}
|
||||
|
||||
export interface AccompanyingPeriodParticipation {
|
||||
id: number;
|
||||
startDate: DateTime;
|
||||
endDate?: DateTime | null;
|
||||
accompanyingPeriod: AccompanyingPeriod;
|
||||
person: Person;
|
||||
id: number;
|
||||
startDate: DateTime;
|
||||
endDate?: DateTime | null;
|
||||
accompanyingPeriod: AccompanyingPeriod;
|
||||
person: Person;
|
||||
}
|
||||
|
||||
export interface AccompanyingPeriodLocationHistory {
|
||||
id: number;
|
||||
startDate: DateTime;
|
||||
endDate?: DateTime | null;
|
||||
addressLocation?: Address | null;
|
||||
period: AccompanyingPeriod;
|
||||
personLocation?: Person | null;
|
||||
id: number;
|
||||
startDate: DateTime;
|
||||
endDate?: DateTime | null;
|
||||
addressLocation?: Address | null;
|
||||
period: AccompanyingPeriod;
|
||||
personLocation?: Person | null;
|
||||
}
|
||||
|
||||
export interface SocialIssue {
|
||||
id: number;
|
||||
parent?: SocialIssue | null;
|
||||
children: SocialIssue[];
|
||||
socialActions?: SocialAction[] | null;
|
||||
ordering: number;
|
||||
title: {
|
||||
fr: string;
|
||||
};
|
||||
desactivationDate?: string | null;
|
||||
id: number;
|
||||
parent?: SocialIssue | null;
|
||||
children: SocialIssue[];
|
||||
socialActions?: SocialAction[] | null;
|
||||
ordering: number;
|
||||
title: {
|
||||
fr: string;
|
||||
};
|
||||
desactivationDate?: string | null;
|
||||
}
|
||||
|
||||
export interface Goal {
|
||||
id: number;
|
||||
results: Result[];
|
||||
socialActions?: SocialAction[] | null;
|
||||
title: {
|
||||
fr: string;
|
||||
};
|
||||
id: number;
|
||||
results: Result[];
|
||||
socialActions?: SocialAction[] | null;
|
||||
title: {
|
||||
fr: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface AccompanyingPeriodWorkGoal {
|
||||
id: number;
|
||||
accompanyingPeriodWork: AccompanyingPeriodWork;
|
||||
goal: Goal;
|
||||
note: string;
|
||||
results: Result[];
|
||||
id: number;
|
||||
accompanyingPeriodWork: AccompanyingPeriodWork;
|
||||
goal: Goal;
|
||||
note: string;
|
||||
results: Result[];
|
||||
}
|
||||
|
||||
export interface AccompanyingPeriodWorkEvaluation {
|
||||
accompanyingPeriodWork: AccompanyingPeriodWork | null;
|
||||
comment: string;
|
||||
createdAt: DateTime | null;
|
||||
createdBy: User | null;
|
||||
documents: AccompanyingPeriodWorkEvaluationDocument[];
|
||||
endDate: DateTime | null;
|
||||
evaluation: Evaluation | null;
|
||||
id: number | null;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
key: any;
|
||||
maxDate: DateTime | null;
|
||||
startDate: DateTime | null;
|
||||
updatedAt: DateTime | null;
|
||||
updatedBy: User | null;
|
||||
warningInterval: string | null;
|
||||
timeSpent: number | null;
|
||||
accompanyingPeriodWork: AccompanyingPeriodWork | null;
|
||||
comment: string;
|
||||
createdAt: DateTime | null;
|
||||
createdBy: User | null;
|
||||
documents: AccompanyingPeriodWorkEvaluationDocument[];
|
||||
endDate: DateTime | null;
|
||||
evaluation: Evaluation | null;
|
||||
id: number | null;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
key: any;
|
||||
maxDate: DateTime | null;
|
||||
startDate: DateTime | null;
|
||||
updatedAt: DateTime | null;
|
||||
updatedBy: User | null;
|
||||
warningInterval: string | null;
|
||||
timeSpent: number | null;
|
||||
}
|
||||
|
||||
export interface Evaluation {
|
||||
id: number;
|
||||
url: string;
|
||||
socialActions: SocialAction[];
|
||||
title: {
|
||||
fr: string;
|
||||
};
|
||||
active: boolean;
|
||||
delay: string;
|
||||
notificationDelay: string;
|
||||
id: number;
|
||||
url: string;
|
||||
socialActions: SocialAction[];
|
||||
title: {
|
||||
fr: string;
|
||||
};
|
||||
active: boolean;
|
||||
delay: string;
|
||||
notificationDelay: string;
|
||||
}
|
||||
|
||||
export interface AccompanyingPeriodWorkReferrerHistory {
|
||||
id: number;
|
||||
accompanyingPeriodWork: AccompanyingPeriodWork;
|
||||
user: User;
|
||||
startDate: DateTime;
|
||||
endDate: DateTime | null;
|
||||
createdAt: DateTime;
|
||||
updatedAt: DateTime | null;
|
||||
createdBy: User;
|
||||
updatedBy: User | null;
|
||||
id: number;
|
||||
accompanyingPeriodWork: AccompanyingPeriodWork;
|
||||
user: User;
|
||||
startDate: DateTime;
|
||||
endDate: DateTime | null;
|
||||
createdAt: DateTime;
|
||||
updatedAt: DateTime | null;
|
||||
createdBy: User;
|
||||
updatedBy: User | null;
|
||||
}
|
||||
|
||||
export interface AccompanyingPeriodWorkEvaluationDocument {
|
||||
id: number;
|
||||
type: "accompanying_period_work_evaluation_document";
|
||||
storedObject: StoredObject;
|
||||
title: string;
|
||||
createdAt: DateTime | null;
|
||||
createdBy: User | null;
|
||||
updatedAt: DateTime | null;
|
||||
updatedBy: User | null;
|
||||
workflows_availables: WorkflowAvailable[];
|
||||
workflows: object[];
|
||||
id: number;
|
||||
type: "accompanying_period_work_evaluation_document";
|
||||
storedObject: StoredObject;
|
||||
title: string;
|
||||
createdAt: DateTime | null;
|
||||
createdBy: User | null;
|
||||
updatedAt: DateTime | null;
|
||||
updatedBy: User | null;
|
||||
workflows_availables: WorkflowAvailable[];
|
||||
workflows: object[];
|
||||
}
|
||||
|
||||
export type EntityType =
|
||||
| "user_group"
|
||||
| "user"
|
||||
| "person"
|
||||
| "third_party"
|
||||
| "household";
|
||||
| "user_group"
|
||||
| "user"
|
||||
| "person"
|
||||
| "thirdparty"
|
||||
| "household";
|
||||
|
||||
export type Entities = (UserGroup | User | Person | ThirdParty | Household) & {
|
||||
address?: Address | null;
|
||||
kind?: string;
|
||||
text?: string;
|
||||
profession?: string;
|
||||
export type Entities = (UserGroup | User | Person | Thirdparty | Household) & {
|
||||
address?: Address | null;
|
||||
kind?: string;
|
||||
text?: string;
|
||||
profession?: string;
|
||||
};
|
||||
|
||||
export type Result = Entities & {
|
||||
parent?: Entities | null;
|
||||
parent?: Entities | null;
|
||||
};
|
||||
|
||||
export interface Suggestion {
|
||||
key: string;
|
||||
relevance: number;
|
||||
result: Result;
|
||||
key: string;
|
||||
relevance: number;
|
||||
result: Result;
|
||||
}
|
||||
|
||||
export interface SearchPagination {
|
||||
first: number;
|
||||
items_per_page: number;
|
||||
next: number | null;
|
||||
previous: number | null;
|
||||
more: boolean;
|
||||
first: number;
|
||||
items_per_page: number;
|
||||
next: number | null;
|
||||
previous: number | null;
|
||||
more: boolean;
|
||||
}
|
||||
|
||||
export interface Search {
|
||||
count: number;
|
||||
pagination: SearchPagination;
|
||||
results: Suggestion[];
|
||||
count: number;
|
||||
pagination: SearchPagination;
|
||||
results: Suggestion[];
|
||||
}
|
||||
|
||||
export interface SearchOptions {
|
||||
uniq: boolean;
|
||||
type: string[];
|
||||
priority: number | null;
|
||||
button: {
|
||||
size: string;
|
||||
class: string;
|
||||
type: string;
|
||||
display: string;
|
||||
};
|
||||
uniq: boolean;
|
||||
type: string[];
|
||||
priority: number | null;
|
||||
button: {
|
||||
size: string;
|
||||
class: string;
|
||||
type: string;
|
||||
display: string;
|
||||
};
|
||||
}
|
||||
|
||||
export class MakeFetchException extends Error {
|
||||
sta: number;
|
||||
txt: string;
|
||||
violations: unknown | null;
|
||||
sta: number;
|
||||
txt: string;
|
||||
violations: unknown | null;
|
||||
|
||||
constructor(txt: string, sta: number, violations: unknown | null = null) {
|
||||
super(txt);
|
||||
this.name = "ValidationException";
|
||||
this.sta = sta;
|
||||
this.txt = txt;
|
||||
this.violations = violations;
|
||||
Object.setPrototypeOf(this, MakeFetchException.prototype);
|
||||
}
|
||||
constructor(txt: string, sta: number, violations: unknown | null = null) {
|
||||
super(txt);
|
||||
this.name = "ValidationException";
|
||||
this.sta = sta;
|
||||
this.txt = txt;
|
||||
this.violations = violations;
|
||||
Object.setPrototypeOf(this, MakeFetchException.prototype);
|
||||
}
|
||||
}
|
||||
|
@@ -23,6 +23,7 @@ import { computed, defineProps } from "vue";
|
||||
import OnTheFly from "ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue";
|
||||
import BadgeEntity from "ChillMainAssets/vuejs/_components/BadgeEntity.vue";
|
||||
import PersonText from "ChillPersonAssets/vuejs/_components/Entity/PersonText.vue";
|
||||
import { Person } from "ChillPersonAssets/types";
|
||||
|
||||
function formatDate(dateString: string | undefined, format: string) {
|
||||
if (!dateString) return "";
|
||||
@@ -36,15 +37,7 @@ function formatDate(dateString: string | undefined, format: string) {
|
||||
|
||||
const props = defineProps<{
|
||||
item: {
|
||||
result: {
|
||||
id: number | string;
|
||||
birthdate: { datetime: string } | null;
|
||||
current_household_address: {
|
||||
text: string;
|
||||
postcode: { name: string };
|
||||
} | null;
|
||||
// add other fields as needed
|
||||
};
|
||||
result: Person; // add other fields as needed
|
||||
};
|
||||
}>();
|
||||
|
||||
|
@@ -36,8 +36,8 @@ import OnTheFly from "ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue";
|
||||
import BadgeEntity from "ChillMainAssets/vuejs/_components/BadgeEntity.vue";
|
||||
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
||||
import { useToast } from "vue-toast-notification";
|
||||
import { ThirdParty } from "ChillMainAssets/types";
|
||||
import { Result, Suggestion } from "ChillPersonAssets/types";
|
||||
import { Thirdparty } from "src/Bundle/ChillThirdPartyBundle/Resources/public/types";
|
||||
|
||||
interface TypeThirdPartyProps {
|
||||
item: Suggestion;
|
||||
@@ -76,7 +76,7 @@ const getAddress = computed(() => {
|
||||
return null;
|
||||
});
|
||||
|
||||
function saveFormOnTheFly({ data }: { data: ThirdParty }) {
|
||||
function saveFormOnTheFly({ data }: { data: Thirdparty }) {
|
||||
makeFetch("POST", "/api/1.0/thirdparty/thirdparty.json", data)
|
||||
.then((response: unknown) => {
|
||||
const result = response as Result;
|
||||
|
@@ -23,22 +23,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, toRefs } from "vue";
|
||||
import { trans, RENDERBOX_YEARS_OLD } from "translator";
|
||||
|
||||
interface AltName {
|
||||
label: string;
|
||||
key: string;
|
||||
}
|
||||
|
||||
interface Person {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
altNames: AltName[];
|
||||
suffixText?: string;
|
||||
birthdate: string | null;
|
||||
deathdate: string | null;
|
||||
age: number;
|
||||
text: string;
|
||||
}
|
||||
import { AltName, Person } from "ChillPersonAssets/types";
|
||||
|
||||
const props = defineProps<{
|
||||
person: Person;
|
||||
|
Reference in New Issue
Block a user