mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix eslint issues and add ts interfaces for typing
This commit is contained in:
parent
4cea678e93
commit
bd4c34cc1d
@ -204,4 +204,6 @@ export interface WorkflowAttachment {
|
|||||||
genericDoc: null | GenericDoc;
|
genericDoc: null | GenericDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PrivateCommentEmbeddable = any;
|
export interface PrivateCommentEmbeddable {
|
||||||
|
comments: Record<number, string>;
|
||||||
|
}
|
||||||
|
@ -16,7 +16,7 @@ const appMessages = {
|
|||||||
user_one: "Utilisateur",
|
user_one: "Utilisateur",
|
||||||
thirdparty_one: "Tiers",
|
thirdparty_one: "Tiers",
|
||||||
person_one: "Usager",
|
person_one: "Usager",
|
||||||
acpw_one: "Action d'accompagnement"
|
acpw_one: "Action d'accompagnement",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from "vue";
|
||||||
import AccompanyingPeriodWorkSelectorModal from "../../vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkSelectorModal.vue";
|
import AccompanyingPeriodWorkSelectorModal from "../../vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkSelectorModal.vue";
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
const el = document.getElementById('linked-acpw-selector');
|
const el = document.getElementById("linked-acpw-selector");
|
||||||
if (el) {
|
if (el) {
|
||||||
const accompanyingPeriodId = el.dataset.accompanyingPeriod;
|
const accompanyingPeriodId = el.dataset.accompanyingPeriod;
|
||||||
createApp(AccompanyingPeriodWorkSelectorModal, { accompanyingPeriodId }).mount(el);
|
createApp(AccompanyingPeriodWorkSelectorModal, {
|
||||||
|
accompanyingPeriodId,
|
||||||
|
}).mount(el);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -7,6 +7,7 @@ import {
|
|||||||
User,
|
User,
|
||||||
WorkflowAvailable,
|
WorkflowAvailable,
|
||||||
Job,
|
Job,
|
||||||
|
PrivateCommentEmbeddable,
|
||||||
} from "ChillMainAssets/types";
|
} from "ChillMainAssets/types";
|
||||||
import { StoredObject } from "ChillDocStoreAssets/types";
|
import { StoredObject } from "ChillDocStoreAssets/types";
|
||||||
import { Thirdparty } from "../../../ChillThirdPartyBundle/Resources/public/types";
|
import { Thirdparty } from "../../../ChillThirdPartyBundle/Resources/public/types";
|
||||||
@ -45,7 +46,7 @@ export interface AccompanyingPeriod {
|
|||||||
createdAt?: Date | null;
|
createdAt?: Date | null;
|
||||||
createdBy?: User | null;
|
createdBy?: User | null;
|
||||||
emergency: boolean;
|
emergency: boolean;
|
||||||
intensity?: 'occasional' | 'regular';
|
intensity?: "occasional" | "regular";
|
||||||
job?: Job | null;
|
job?: Job | null;
|
||||||
locationHistories: AccompanyingPeriodLocationHistory[];
|
locationHistories: AccompanyingPeriodLocationHistory[];
|
||||||
openingDate?: Date | null;
|
openingDate?: Date | null;
|
||||||
@ -61,7 +62,12 @@ export interface AccompanyingPeriod {
|
|||||||
resources: AccompanyingPeriodResource[];
|
resources: AccompanyingPeriodResource[];
|
||||||
scopes: Scope[];
|
scopes: Scope[];
|
||||||
socialIssues: SocialIssue[];
|
socialIssues: SocialIssue[];
|
||||||
step?: 'CLOSED' | 'CONFIRMED' | 'CONFIRMED_INACTIVE_SHORT' | 'CONFIRMED_INACTIVE_LONG' | 'DRAFT';
|
step?:
|
||||||
|
| "CLOSED"
|
||||||
|
| "CONFIRMED"
|
||||||
|
| "CONFIRMED_INACTIVE_SHORT"
|
||||||
|
| "CONFIRMED_INACTIVE_LONG"
|
||||||
|
| "DRAFT";
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AccompanyingPeriodWorkEvaluationDocument {
|
export interface AccompanyingPeriodWorkEvaluationDocument {
|
||||||
@ -102,7 +108,7 @@ export interface AccompanyingPeriodWork {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface SocialAction {
|
interface SocialAction {
|
||||||
id?: number;
|
id: number;
|
||||||
parent?: SocialAction | null;
|
parent?: SocialAction | null;
|
||||||
children: SocialAction[];
|
children: SocialAction[];
|
||||||
issue?: SocialIssue | null;
|
issue?: SocialIssue | null;
|
||||||
@ -162,11 +168,86 @@ export interface AccompanyingPeriodLocationHistory {
|
|||||||
personLocation?: Person | null;
|
personLocation?: Person | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
type SocialIssue = any;
|
export interface SocialIssue {
|
||||||
type Goal = any;
|
id: number;
|
||||||
type Result = any;
|
parent?: SocialIssue | null;
|
||||||
type Evaluation = any;
|
children: SocialIssue[];
|
||||||
type AccompanyingPeriodWorkEvaluation = any;
|
socialActions?: SocialAction[] | null;
|
||||||
type AccompanyingPeriodWorkGoal = any;
|
ordering: number;
|
||||||
type PrivateCommentEmbeddable = any;
|
title: {
|
||||||
type AccompanyingPeriodWorkReferrerHistory = any;
|
fr: string;
|
||||||
|
};
|
||||||
|
desactivationDate?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Goal {
|
||||||
|
id: number;
|
||||||
|
results: Result[];
|
||||||
|
socialActions?: SocialAction[] | null;
|
||||||
|
title: {
|
||||||
|
fr: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Result {
|
||||||
|
id: number;
|
||||||
|
accompanyingPeriodWorks: AccompanyingPeriodWork[];
|
||||||
|
accompanyingPeriodWorkGoals: AccompanyingPeriodWorkGoal[];
|
||||||
|
goals: Goal[];
|
||||||
|
socialActions: SocialAction[];
|
||||||
|
title: {
|
||||||
|
fr: string;
|
||||||
|
};
|
||||||
|
desactivationDate?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AccompanyingPeriodWorkGoal {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Evaluation {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
@ -34,19 +34,26 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ACCOMPANYING_COURSE_WORK_END_DATE, ACCOMPANYING_COURSE_WORK_START_DATE, trans} from "translator";
|
import {
|
||||||
|
ACCOMPANYING_COURSE_WORK_END_DATE,
|
||||||
|
ACCOMPANYING_COURSE_WORK_START_DATE,
|
||||||
|
trans,
|
||||||
|
} from "translator";
|
||||||
import { ISOToDate } from "ChillMainAssets/chill/js/date";
|
import { ISOToDate } from "ChillMainAssets/chill/js/date";
|
||||||
import { DateTime } from "ChillMainAssets/types";
|
import { DateTime } from "ChillMainAssets/types";
|
||||||
import { AccompanyingPeriodWork } from "../../../types";
|
import { AccompanyingPeriodWork } from "../../../types";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const props = defineProps<{ acpw: AccompanyingPeriodWork }>();
|
const props = defineProps<{ acpw: AccompanyingPeriodWork }>();
|
||||||
const formatDate = (dateObject: DateTime) => {
|
const formatDate = (dateObject: DateTime) => {
|
||||||
if (dateObject) {
|
if (dateObject) {
|
||||||
const parsedDate = ISOToDate(dateObject.datetime);
|
const parsedDate = ISOToDate(dateObject.datetime);
|
||||||
if (parsedDate) {
|
if (parsedDate) {
|
||||||
return new Intl.DateTimeFormat('default', { dateStyle: 'short' }).format(parsedDate);
|
return new Intl.DateTimeFormat("default", { dateStyle: "short" }).format(
|
||||||
|
parsedDate,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,34 +1,43 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="results">
|
<div class="results">
|
||||||
<div v-for="acpw in accompanyingPeriodWorks" :key="acpw.id" class="list-item">
|
<div
|
||||||
|
v-for="acpw in accompanyingPeriodWorks"
|
||||||
|
:key="acpw.id"
|
||||||
|
class="list-item"
|
||||||
|
>
|
||||||
<label class="acpw-item">
|
<label class="acpw-item">
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<input type="radio" :value="acpw" v-model="selectedAcpw" name="item"/>
|
<input
|
||||||
|
type="radio"
|
||||||
|
:value="acpw"
|
||||||
|
v-model="selectedAcpw"
|
||||||
|
name="item"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<accompanying-period-work-item :acpw="acpw" />
|
<accompanying-period-work-item :acpw="acpw" />
|
||||||
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import AccompanyingPeriodWorkItem
|
import AccompanyingPeriodWorkItem from "./AccompanyingPeriodWorkItem.vue";
|
||||||
from "./AccompanyingPeriodWorkItem.vue";
|
|
||||||
import { AccompanyingPeriodWork } from "../../../types";
|
import { AccompanyingPeriodWork } from "../../../types";
|
||||||
import { defineProps, ref, watch } from "vue";
|
import { defineProps, ref, watch } from "vue";
|
||||||
|
|
||||||
const props = defineProps<{ accompanyingPeriodWorks: AccompanyingPeriodWork[] }>()
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
const props = defineProps<{
|
||||||
|
accompanyingPeriodWorks: AccompanyingPeriodWork[];
|
||||||
|
}>();
|
||||||
const selectedAcpw = ref<AccompanyingPeriodWork | null>(null);
|
const selectedAcpw = ref<AccompanyingPeriodWork | null>(null);
|
||||||
|
|
||||||
|
// eslint-disable-next-line vue/valid-define-emits
|
||||||
const emit = defineEmits();
|
const emit = defineEmits();
|
||||||
|
|
||||||
watch(selectedAcpw, (newValue) => {
|
watch(selectedAcpw, (newValue) => {
|
||||||
emit('update:selectedAcpw', newValue);
|
emit("update:selectedAcpw", newValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
<div class="col-md-6 col-sm-10" v-if="selectedAcpw">
|
<div class="col-md-6 col-sm-10" v-if="selectedAcpw">
|
||||||
<ul class="list-suggest remove-items">
|
<ul class="list-suggest remove-items">
|
||||||
<li>
|
<li>
|
||||||
<span @click="selectedAcpw = null" class="chill-denomination">{{ selectedAcpw?.socialAction?.title.fr }}</span>
|
<span @click="selectedAcpw = null" class="chill-denomination">{{
|
||||||
|
selectedAcpw?.socialAction?.title.fr
|
||||||
|
}}</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -19,7 +21,11 @@
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<teleport to="body">
|
<teleport to="body">
|
||||||
<modal v-if="showModal" @close="closeModal" modal-dialog-class="modal-dialog-scrollable modal-xl">
|
<modal
|
||||||
|
v-if="showModal"
|
||||||
|
@close="closeModal"
|
||||||
|
modal-dialog-class="modal-dialog-scrollable modal-xl"
|
||||||
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<h3>{{ trans(ACPW_DUPLICATE_SELECT_ACCOMPANYING_PERIOD_WORK) }}</h3>
|
<h3>{{ trans(ACPW_DUPLICATE_SELECT_ACCOMPANYING_PERIOD_WORK) }}</h3>
|
||||||
</template>
|
</template>
|
||||||
@ -32,23 +38,26 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<button type="button" class="btn btn-save" @click="confirmSelection">{{ trans(CONFIRM) }}</button>
|
<button type="button" class="btn btn-save" @click="confirmSelection">
|
||||||
|
{{ trans(CONFIRM) }}
|
||||||
|
</button>
|
||||||
</template>
|
</template>
|
||||||
</modal>
|
</modal>
|
||||||
</teleport>
|
</teleport>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, watch, onMounted, Ref} from "vue";
|
import { ref, watch, onMounted } from "vue";
|
||||||
import Modal from "ChillMainAssets/vuejs/_components/Modal.vue"
|
import Modal from "ChillMainAssets/vuejs/_components/Modal.vue";
|
||||||
import AccompanyingPeriodWorkList from "./AccompanyingPeriodWorkList.vue";
|
import AccompanyingPeriodWorkList from "./AccompanyingPeriodWorkList.vue";
|
||||||
import { AccompanyingPeriodWork } from "../../../types";
|
import { AccompanyingPeriodWork } from "../../../types";
|
||||||
import { trans, ACPW_DUPLICATE_SELECT_ACCOMPANYING_PERIOD_WORK, SOCIAL_ACTION, CONFIRM } from "translator";
|
import {
|
||||||
|
trans,
|
||||||
|
ACPW_DUPLICATE_SELECT_ACCOMPANYING_PERIOD_WORK,
|
||||||
|
CONFIRM,
|
||||||
|
} from "translator";
|
||||||
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
||||||
import {DateTime} from "ChillMainAssets/types";
|
|
||||||
import {ISOToDate} from "ChillMainAssets/chill/js/date";
|
|
||||||
|
|
||||||
const selectedAcpw = ref<AccompanyingPeriodWork | null>(null);
|
const selectedAcpw = ref<AccompanyingPeriodWork | null>(null);
|
||||||
const showModal = ref(false);
|
const showModal = ref(false);
|
||||||
@ -61,7 +70,7 @@ onMounted(() => {
|
|||||||
if (props.accompanyingPeriodId) {
|
if (props.accompanyingPeriodId) {
|
||||||
getAccompanyingPeriodWorks(parseInt(props.accompanyingPeriodId));
|
getAccompanyingPeriodWorks(parseInt(props.accompanyingPeriodId));
|
||||||
} else {
|
} else {
|
||||||
console.error("No accompanyingperiod id was given")
|
console.error("No accompanyingperiod id was given");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const getAccompanyingPeriodWorks = (periodId: number) => {
|
const getAccompanyingPeriodWorks = (periodId: number) => {
|
||||||
@ -72,28 +81,19 @@ const getAccompanyingPeriodWorks = (periodId: number) => {
|
|||||||
accompanyingPeriodWorks.value = response;
|
accompanyingPeriodWorks.value = response;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error)
|
console.log(error);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(selectedAcpw, (newValue) => {
|
watch(selectedAcpw, (newValue) => {
|
||||||
const inputField = document.getElementById('find_accompanying_period_work_acpw') as HTMLInputElement;
|
const inputField = document.getElementById(
|
||||||
|
"find_accompanying_period_work_acpw",
|
||||||
|
) as HTMLInputElement;
|
||||||
if (inputField) {
|
if (inputField) {
|
||||||
inputField.value = String(newValue?.id);
|
inputField.value = String(newValue?.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const formatDate = (dateObject: DateTime) => {
|
|
||||||
if(dateObject) {
|
|
||||||
const parsedDate = ISOToDate(dateObject.datetime);
|
|
||||||
if (parsedDate) {
|
|
||||||
return new Intl.DateTimeFormat('default', { dateStyle: 'short' }).format(parsedDate);
|
|
||||||
} else {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const openModal = () => (showModal.value = true);
|
const openModal = () => (showModal.value = true);
|
||||||
const closeModal = () => (showModal.value = false);
|
const closeModal = () => (showModal.value = false);
|
||||||
const confirmSelection = () => {
|
const confirmSelection = () => {
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="item-row">
|
|
||||||
<div class="item-col">
|
|
||||||
<h4 class="badge-title">
|
|
||||||
<span class="title_action">
|
|
||||||
{{ accompanyingPeriodWork.socialAction.title.fr }}
|
|
||||||
</span>
|
|
||||||
</h4>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import TypeAccompanyingPeriodWork from "ChillPersonAssets/vuejs/_components/AddPersons/TypeAccompanyingPeriodWork.vue";
|
|
||||||
|
|
||||||
const props = defineProps({
|
|
||||||
accompanyingPeriodWork: TypeAccompanyingPeriodWork
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
@ -1 +1,47 @@
|
|||||||
export type Thirdparty = any;
|
import {
|
||||||
|
Address,
|
||||||
|
Center,
|
||||||
|
Civility,
|
||||||
|
DateTime,
|
||||||
|
User,
|
||||||
|
} from "ChillMainAssets/types";
|
||||||
|
|
||||||
|
export interface Thirdparty {
|
||||||
|
acronym: string | null;
|
||||||
|
active: boolean;
|
||||||
|
address: Address | null;
|
||||||
|
canonicalized: string | null;
|
||||||
|
categories: ThirdpartyCategory[];
|
||||||
|
centers: Center[];
|
||||||
|
children: Thirdparty[];
|
||||||
|
civility: Civility | null;
|
||||||
|
comment: string | null;
|
||||||
|
contactDataAnonymous: boolean;
|
||||||
|
createdAt: DateTime;
|
||||||
|
createdBy: User | null;
|
||||||
|
email: string | null;
|
||||||
|
firstname: string | null;
|
||||||
|
id: number | null;
|
||||||
|
kind: string;
|
||||||
|
name: string;
|
||||||
|
nameCompany: string | null;
|
||||||
|
parent: Thirdparty | null;
|
||||||
|
profession: string;
|
||||||
|
telephone: string | null;
|
||||||
|
thirdPartyTypes: ThirdpartyType[] | null;
|
||||||
|
updatedAt: DateTime | null;
|
||||||
|
updatedBy: User | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ThirdpartyType {
|
||||||
|
key: string;
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ThirdpartyCategory {
|
||||||
|
id: number;
|
||||||
|
active: boolean;
|
||||||
|
name: {
|
||||||
|
fr: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
export type ThirdParty = any;
|
|
Loading…
x
Reference in New Issue
Block a user