diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..222861c34 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "tabWidth": 2, + "useTabs": false +} diff --git a/src/Bundle/ChillMainBundle/Resources/public/types.ts b/src/Bundle/ChillMainBundle/Resources/public/types.ts index 5af22147b..f642eb95f 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/types.ts +++ b/src/Bundle/ChillMainBundle/Resources/public/types.ts @@ -1,287 +1,269 @@ import { GenericDoc } from "ChillDocStoreAssets/types/generic_doc"; export interface DateTime { - datetime: string; - datetime8601: string; + datetime: string; + datetime8601: string; } export interface Civility { - id: number; - // TODO + id: number; + // TODO } export interface Household { - type: "household"; - id: number; + type: "household"; + id: number; } export interface Job { - id: number; - type: "user_job"; - label: { - fr: string; // could have other key. How to do that in ts ? - }; + id: number; + type: "user_job"; + label: { + fr: string; // could have other key. How to do that in ts ? + }; } export interface Center { - id: number; - type: "center"; - name: string; + id: number; + type: "center"; + name: string; } export interface Scope { - id: number; - type: "scope"; - name: { - fr: string; - }; + id: number; + type: "scope"; + name: { + fr: string; + }; } export interface ResultItem { - result: T; - relevance: number; + result: T; + relevance: number; } export interface User { - type: "user"; - id: number; - username: string; - text: string; - text_without_absence: string; - email: string; - user_job: Job; - label: string; - // todo: mainCenter; mainJob; etc.. -} -export interface ThirdParty { - type: "thirdparty"; - id: number; - text: string; - firstname: string; - name: string; - email: string; - telephone: string; - telephone2: string; - address: { - address_id: number; - text: string; - postcode: { - name: string; - }; - id: number; - }; + type: "user"; + id: number; + username: string; + text: string; + text_without_absence: string; + email: string; + user_job: Job; + label: string; + // todo: mainCenter; mainJob; etc.. } export interface UserGroup { - type: "user_group"; - id: number; - label: TranslatableString; - backgroundColor: string; - foregroundColor: string; - excludeKey: string; - text: string; + type: "user_group"; + id: number; + label: TranslatableString; + backgroundColor: string; + foregroundColor: string; + excludeKey: string; + text: string; } export type UserGroupOrUser = User | UserGroup; export interface UserAssociatedInterface { - type: "user"; - id: number; + type: "user"; + id: number; } export type TranslatableString = Record; export interface Postcode { - id: number; - name: string; - code: string; - center: Point; + id: number; + name: string; + code: string; + center: Point; } export interface Point { - type: "Point"; - coordinates: [lat: number, lon: number]; + type: "Point"; + coordinates: [lat: number, lon: number]; } export interface Country { - id: number; - name: TranslatableString; - code: string; + id: number; + name: TranslatableString; + code: string; } export type AddressRefStatus = "match" | "to_review" | "reviewed"; export interface Address { - type: "address"; - address_id: number; - text: string; - street: string; - streetNumber: string; - postcode: Postcode; - country: Country; - floor: string | null; - corridor: string | null; - steps: string | null; - flat: string | null; - buildingName: string | null; - distribution: string | null; - extra: string | null; - confidential: boolean; - lines: string[]; - addressReference: AddressReference | null; - validFrom: DateTime; - validTo: DateTime | null; - point: Point | null; - refStatus: AddressRefStatus; - isNoAddress: boolean; + type: "address"; + address_id: number; + text: string; + street: string; + streetNumber: string; + postcode: Postcode; + country: Country; + floor: string | null; + corridor: string | null; + steps: string | null; + flat: string | null; + buildingName: string | null; + distribution: string | null; + extra: string | null; + confidential: boolean; + lines: string[]; + addressReference: AddressReference | null; + validFrom: DateTime; + validTo: DateTime | null; + point: Point | null; + refStatus: AddressRefStatus; + isNoAddress: boolean; } export interface AddressWithPoint extends Address { - point: Point; + point: Point; } export interface AddressReference { - id: number; - createdAt: DateTime | null; - deletedAt: DateTime | null; - municipalityCode: string; - point: Point; - postcode: Postcode; - refId: string; - source: string; - street: string; - streetNumber: string; - updatedAt: DateTime | null; + id: number; + createdAt: DateTime | null; + deletedAt: DateTime | null; + municipalityCode: string; + point: Point; + postcode: Postcode; + refId: string; + source: string; + street: string; + streetNumber: string; + updatedAt: DateTime | null; } export interface SimpleGeographicalUnit { - id: number; - layerId: number; - unitName: string; - unitRefId: string; + id: number; + layerId: number; + unitName: string; + unitRefId: string; } export interface GeographicalUnitLayer { - id: number; - name: TranslatableString; - refId: string; + id: number; + name: TranslatableString; + refId: string; } export interface Location { - type: "location"; - id: number; - active: boolean; - address: Address | null; - availableForUsers: boolean; - createdAt: DateTime | null; - createdBy: User | null; - updatedAt: DateTime | null; - updatedBy: User | null; - email: string | null; - name: string; - phonenumber1: string | null; - phonenumber2: string | null; - locationType: LocationType; + type: "location"; + id: number; + active: boolean; + address: Address | null; + availableForUsers: boolean; + createdAt: DateTime | null; + createdBy: User | null; + updatedAt: DateTime | null; + updatedBy: User | null; + email: string | null; + name: string; + phonenumber1: string | null; + phonenumber2: string | null; + locationType: LocationType; } export interface LocationAssociated { - type: "location"; - id: number; + type: "location"; + id: number; } export interface LocationType { - type: "location-type"; - id: number; - active: boolean; - addressRequired: "optional" | "required"; - availableForUsers: boolean; - editableByUsers: boolean; - contactData: "optional" | "required"; - title: TranslatableString; + type: "location-type"; + id: number; + active: boolean; + addressRequired: "optional" | "required"; + availableForUsers: boolean; + editableByUsers: boolean; + contactData: "optional" | "required"; + title: TranslatableString; } export interface NewsItemType { - id: number; - title: string; - content: string; - startDate: DateTime; - endDate: DateTime | null; + id: number; + title: string; + content: string; + startDate: DateTime; + endDate: DateTime | null; } export interface WorkflowAvailable { - name: string; - text: string; + name: string; + text: string; } export interface WorkflowAttachment { - id: number; - relatedGenericDocKey: string; - relatedGenericDocIdentifiers: object; - createdAt: DateTime | null; - createdBy: User | null; - updatedAt: DateTime | null; - updatedBy: User | null; - genericDoc: null | GenericDoc; + id: number; + relatedGenericDocKey: string; + relatedGenericDocIdentifiers: object; + createdAt: DateTime | null; + createdBy: User | null; + updatedAt: DateTime | null; + updatedBy: User | null; + genericDoc: null | GenericDoc; } export interface PrivateCommentEmbeddable { - comments: Record; + comments: Record; } // API Exception types export interface TransportExceptionInterface { - name: string; + name: string; } export interface ValidationExceptionInterface - extends TransportExceptionInterface { - name: "ValidationException"; - error: object; - violations: string[]; - titles: string[]; - propertyPaths: string[]; + extends TransportExceptionInterface { + name: "ValidationException"; + error: object; + violations: string[]; + titles: string[]; + propertyPaths: string[]; } export interface AccessExceptionInterface extends TransportExceptionInterface { - name: "AccessException"; - violations: string[]; + name: "AccessException"; + violations: string[]; } export interface NotFoundExceptionInterface - extends TransportExceptionInterface { - name: "NotFoundException"; + extends TransportExceptionInterface { + name: "NotFoundException"; } export interface ServerExceptionInterface extends TransportExceptionInterface { - name: "ServerException"; - message: string; - code: number; - body: string; + name: "ServerException"; + message: string; + code: number; + body: string; } export interface ConflictHttpExceptionInterface - extends TransportExceptionInterface { - name: "ConflictHttpException"; - violations: string[]; + extends TransportExceptionInterface { + name: "ConflictHttpException"; + violations: string[]; } export type ApiException = - | ValidationExceptionInterface - | AccessExceptionInterface - | NotFoundExceptionInterface - | ServerExceptionInterface - | ConflictHttpExceptionInterface; + | ValidationExceptionInterface + | AccessExceptionInterface + | NotFoundExceptionInterface + | ServerExceptionInterface + | ConflictHttpExceptionInterface; export interface Modal { - showModal: boolean; - modalDialogClass: string; + showModal: boolean; + modalDialogClass: string; } export interface Selected { - result: UserGroupOrUser; + result: UserGroupOrUser; } export interface addNewEntities { - selected: Selected[]; - modal: Modal; + selected: Selected[]; + modal: Modal; } diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue index 700f71e48..dc66a0000 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue @@ -1,97 +1,97 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/types.ts b/src/Bundle/ChillPersonBundle/Resources/public/types.ts index 18ce72046..1788e585f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/types.ts +++ b/src/Bundle/ChillPersonBundle/Resources/public/types.ts @@ -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); + } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypePerson.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypePerson.vue index e9ef26d37..98119bd8e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypePerson.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypePerson.vue @@ -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 }; }>(); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue index 3f99e5d11..28be7c119 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue @@ -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; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue index 36be069b6..10302ee30 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue @@ -23,22 +23,7 @@ diff --git a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/BannerComponent.vue b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/BannerComponent.vue index 12489f91a..cb8c33201 100644 --- a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/BannerComponent.vue +++ b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/BannerComponent.vue @@ -1,109 +1,97 @@ @@ -121,26 +109,26 @@ import { ISOToDatetime } from "../../../../../../../ChillMainBundle/Resources/pu // Translations import { - trans, - CHILL_TICKET_TICKET_BANNER_NO_MOTIVE, - CHILL_TICKET_TICKET_BANNER_OPEN, - CHILL_TICKET_TICKET_BANNER_CLOSED, - CHILL_TICKET_TICKET_BANNER_SINCE, - CHILL_TICKET_TICKET_BANNER_CONCERNED_USAGER, - CHILL_TICKET_TICKET_BANNER_SPEAKER, - CHILL_TICKET_TICKET_BANNER_DAYS, - CHILL_TICKET_TICKET_BANNER_HOURS, - CHILL_TICKET_TICKET_BANNER_MINUTES, - CHILL_TICKET_TICKET_BANNER_SECONDS, - CHILL_TICKET_TICKET_BANNER_AND, - CHILL_TICKET_TICKET_BANNER_CALLER, + trans, + CHILL_TICKET_TICKET_BANNER_NO_MOTIVE, + CHILL_TICKET_TICKET_BANNER_OPEN, + CHILL_TICKET_TICKET_BANNER_CLOSED, + CHILL_TICKET_TICKET_BANNER_SINCE, + CHILL_TICKET_TICKET_BANNER_CONCERNED_USAGER, + CHILL_TICKET_TICKET_BANNER_SPEAKER, + CHILL_TICKET_TICKET_BANNER_DAYS, + CHILL_TICKET_TICKET_BANNER_HOURS, + CHILL_TICKET_TICKET_BANNER_MINUTES, + CHILL_TICKET_TICKET_BANNER_SECONDS, + CHILL_TICKET_TICKET_BANNER_AND, + CHILL_TICKET_TICKET_BANNER_CALLER, } from "translator"; // Store import { useStore } from "vuex"; const props = defineProps<{ - ticket: Ticket; + ticket: Ticket; }>(); const store = useStore(); @@ -148,59 +136,55 @@ const today = ref(new Date()); const createdAt = ref(props.ticket.createdAt); setInterval(() => { - today.value = new Date(); + today.value = new Date(); }, 5000); const isOpen = computed(() => store.getters.isOpen); const since = computed(() => { - if (createdAt.value == null) { - return ""; - } - const date = ISOToDatetime(createdAt.value.datetime); + if (createdAt.value == null) { + return ""; + } + const date = ISOToDatetime(createdAt.value.datetime); - if (date == null) { - return ""; - } + if (date == null) { + return ""; + } - const timeDiff = Math.abs(today.value.getTime() - date.getTime()); - const daysDiff = Math.floor(timeDiff / (1000 * 3600 * 24)); - const hoursDiff = Math.floor( - (timeDiff % (1000 * 3600 * 24)) / (1000 * 3600), + const timeDiff = Math.abs(today.value.getTime() - date.getTime()); + const daysDiff = Math.floor(timeDiff / (1000 * 3600 * 24)); + const hoursDiff = Math.floor((timeDiff % (1000 * 3600 * 24)) / (1000 * 3600)); + const minutesDiff = Math.floor((timeDiff % (1000 * 3600)) / (1000 * 60)); + const secondsDiff = Math.floor((timeDiff % (1000 * 60)) / 1000); + + // On construit la liste des parties à afficher + const parts: string[] = []; + if (daysDiff > 0) { + parts.push(trans(CHILL_TICKET_TICKET_BANNER_DAYS, { count: daysDiff })); + } + if (hoursDiff > 0 || daysDiff > 0) { + parts.push(trans(CHILL_TICKET_TICKET_BANNER_HOURS, { count: hoursDiff })); + } + if (minutesDiff > 0 || hoursDiff > 0 || daysDiff > 0) { + parts.push( + trans(CHILL_TICKET_TICKET_BANNER_MINUTES, { count: minutesDiff }), ); - const minutesDiff = Math.floor((timeDiff % (1000 * 3600)) / (1000 * 60)); - const secondsDiff = Math.floor((timeDiff % (1000 * 60)) / 1000); - - // On construit la liste des parties à afficher - const parts: string[] = []; - if (daysDiff > 0) { - parts.push(trans(CHILL_TICKET_TICKET_BANNER_DAYS, { count: daysDiff })); - } - if (hoursDiff > 0 || daysDiff > 0) { - parts.push( - trans(CHILL_TICKET_TICKET_BANNER_HOURS, { count: hoursDiff }), - ); - } - if (minutesDiff > 0 || hoursDiff > 0 || daysDiff > 0) { - parts.push( - trans(CHILL_TICKET_TICKET_BANNER_MINUTES, { count: minutesDiff }), - ); - } - if (parts.length === 0) { - return trans(CHILL_TICKET_TICKET_BANNER_SECONDS, { - count: secondsDiff, - }); - } - if (parts.length > 1) { - const last = parts.pop(); - return ( - parts.join(", ") + - " " + - trans(CHILL_TICKET_TICKET_BANNER_AND) + - " " + - last - ); - } - return parts[0]; + } + if (parts.length === 0) { + return trans(CHILL_TICKET_TICKET_BANNER_SECONDS, { + count: secondsDiff, + }); + } + if (parts.length > 1) { + const last = parts.pop(); + return ( + parts.join(", ") + + " " + + trans(CHILL_TICKET_TICKET_BANNER_AND) + + " " + + last + ); + } + return parts[0]; }); diff --git a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/CallerSelectorComponent.vue b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/CallerSelectorComponent.vue index 1afa0691f..86655a05b 100644 --- a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/CallerSelectorComponent.vue +++ b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/CallerSelectorComponent.vue @@ -1,16 +1,16 @@ diff --git a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/TicketHistoryListComponent.vue b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/TicketHistoryListComponent.vue index 71761b7b3..9d32d36dd 100644 --- a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/TicketHistoryListComponent.vue +++ b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/TicketHistoryListComponent.vue @@ -1,79 +1,75 @@ diff --git a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/TicketHistoryPersonComponent.vue b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/TicketHistoryPersonComponent.vue index d8fc7fa94..c4b296eb4 100644 --- a/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/TicketHistoryPersonComponent.vue +++ b/src/Bundle/ChillTicketBundle/src/Resources/public/vuejs/TicketApp/components/TicketHistoryPersonComponent.vue @@ -1,18 +1,18 @@