Fix Eslint issues

This commit is contained in:
Julien Fastré 2025-07-08 13:38:51 +00:00
parent e592b89c94
commit aed114c75c
15 changed files with 379 additions and 348 deletions

View File

@ -2,7 +2,7 @@ import "es6-promise/auto";
import { createStore } from "vuex"; import { createStore } from "vuex";
import { postLocation } from "./api"; import { postLocation } from "./api";
import prepareLocations from "./store.locations.js"; import prepareLocations from "./store.locations.js";
import {fetchResults, makeFetch} from "ChillMainAssets/lib/api/apiMethods"; import { fetchResults, makeFetch } from "ChillMainAssets/lib/api/apiMethods";
const debug = process.env.NODE_ENV !== "production"; const debug = process.env.NODE_ENV !== "production";
//console.log('window.activity', window.activity); //console.log('window.activity', window.activity);
@ -369,7 +369,7 @@ const store = createStore({
// console.log('works', works); // console.log('works', works);
commit("setAccompanyingPeriodWorks", works); commit("setAccompanyingPeriodWorks", works);
} catch (error) { } catch (error) {
console.error('Failed to fetch works:', error); console.error("Failed to fetch works:", error);
} }
}, },
getWhoAmI({ commit }) { getWhoAmI({ commit }) {

View File

@ -18,7 +18,6 @@ use Symfony\Component\Form\Extension\Core\Type\FormType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
use function count;
/** /**
* Command to get the report with curl: * Command to get the report with curl:

View File

@ -17,7 +17,6 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
use function count;
// command to get the report with curl : curl --user "center a_social:password" "http://localhost:8000/fr/exports/generate/count_person?export[filters][person_gender_filter][enabled]=&export[filters][person_nationality_filter][enabled]=&export[filters][person_nationality_filter][form][nationalities]=&export[aggregators][person_nationality_aggregator][order]=1&export[aggregators][person_nationality_aggregator][form][group_by_level]=country&export[submit]=&export[_token]=RHpjHl389GrK-bd6iY5NsEqrD5UKOTHH40QKE9J1edU" --globoff // command to get the report with curl : curl --user "center a_social:password" "http://localhost:8000/fr/exports/generate/count_person?export[filters][person_gender_filter][enabled]=&export[filters][person_nationality_filter][enabled]=&export[filters][person_nationality_filter][form][nationalities]=&export[aggregators][person_nationality_aggregator][order]=1&export[aggregators][person_nationality_aggregator][form][group_by_level]=country&export[submit]=&export[_token]=RHpjHl389GrK-bd6iY5NsEqrD5UKOTHH40QKE9J1edU" --globoff

View File

@ -21,7 +21,6 @@ use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Contracts\Translation\TranslatorInterface; use Symfony\Contracts\Translation\TranslatorInterface;
use function count;
// command to get the report with curl : curl --user "center a_social:password" "http://localhost:8000/fr/exports/generate/count_person?export[filters][person_gender_filter][enabled]=&export[filters][person_nationality_filter][enabled]=&export[filters][person_nationality_filter][form][nationalities]=&export[aggregators][person_nationality_aggregator][order]=1&export[aggregators][person_nationality_aggregator][form][group_by_level]=country&export[submit]=&export[_token]=RHpjHl389GrK-bd6iY5NsEqrD5UKOTHH40QKE9J1edU" --globoff // command to get the report with curl : curl --user "center a_social:password" "http://localhost:8000/fr/exports/generate/count_person?export[filters][person_gender_filter][enabled]=&export[filters][person_nationality_filter][enabled]=&export[filters][person_nationality_filter][form][nationalities]=&export[aggregators][person_nationality_aggregator][order]=1&export[aggregators][person_nationality_aggregator][form][group_by_level]=country&export[submit]=&export[_token]=RHpjHl389GrK-bd6iY5NsEqrD5UKOTHH40QKE9J1edU" --globoff

View File

@ -98,7 +98,7 @@ class CancelStaleWorkflowHandlerTest extends TestCase
$em = $this->prophesize(EntityManagerInterface::class); $em = $this->prophesize(EntityManagerInterface::class);
$em->flush()->shouldBeCalled(); $em->flush()->shouldBeCalled();
$em->remove($workflow)->shouldBeCalled(); $em->remove($workflow)->shouldNotBeCalled();
$handler = $this->buildHandler($workflow, $em->reveal(), $clock); $handler = $this->buildHandler($workflow, $em->reveal(), $clock);

View File

@ -3,47 +3,49 @@ import AccompanyingPeriodWorkSelectorModal from "../../vuejs/_components/Accompa
import { AccompanyingPeriodWork } from "../../types"; import { AccompanyingPeriodWork } from "../../types";
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", () => {
const elements = document.querySelectorAll<HTMLDivElement>( const elements = document.querySelectorAll<HTMLDivElement>(
'div[data-pick-entities-type="acpw"]', 'div[data-pick-entities-type="acpw"]',
);
elements.forEach((el) => {
const uniqid = el.dataset.inputUniqid;
if (undefined === uniqid) {
throw "Uniqid not found on this element";
}
const input = document.querySelector<HTMLInputElement>(
`input[data-input-uniqid="${uniqid}"]`,
); );
elements.forEach((el) => {
const uniqid = el.dataset.inputUniqid;
if (null === input) { if (undefined === uniqid) {
throw "Element with uniqid not found: " + uniqid; throw "Uniqid not found on this element";
} }
const accompanyingPeriodIdAsString = input.dataset.accompanyingPeriodId; const input = document.querySelector<HTMLInputElement>(
`input[data-input-uniqid="${uniqid}"]`,
);
if (undefined === accompanyingPeriodIdAsString) { if (null === input) {
throw "accompanying period id not found"; throw "Element with uniqid not found: " + uniqid;
} }
const accompanyingPeriodId = Number.parseInt(accompanyingPeriodIdAsString); const accompanyingPeriodIdAsString = input.dataset.accompanyingPeriodId;
const app = createApp({ if (undefined === accompanyingPeriodIdAsString) {
template: throw "accompanying period id not found";
'<accompanying-period-work-selector-modal :accompanying-period-id="accompanyingPeriodId" @pickWork="pickWork"></accompanying-period-work-selector-modal>', }
components: { AccompanyingPeriodWorkSelectorModal },
data() { const accompanyingPeriodId = Number.parseInt(
return { accompanyingPeriodId }; accompanyingPeriodIdAsString,
}, );
methods: {
pickWork: function (payload: { work: AccompanyingPeriodWork }) { const app = createApp({
console.log("payload", payload); template:
input.value = payload.work.id.toString(); '<accompanying-period-work-selector-modal :accompanying-period-id="accompanyingPeriodId" @pickWork="pickWork"></accompanying-period-work-selector-modal>',
}, components: { AccompanyingPeriodWorkSelectorModal },
}, data() {
return { accompanyingPeriodId };
},
methods: {
pickWork: function (payload: { work: AccompanyingPeriodWork }) {
console.log("payload", payload);
input.value = payload.work.id.toString();
},
},
});
app.mount(el);
}); });
app.mount(el);
});
}); });

View File

@ -1,13 +1,13 @@
import { import {
Address, Address,
Scope, Scope,
Center, Center,
Civility, Civility,
DateTime, DateTime,
User, User,
WorkflowAvailable, WorkflowAvailable,
Job, Job,
PrivateCommentEmbeddable, 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";
@ -35,39 +35,39 @@ export interface Person {
} }
export interface AccompanyingPeriod { export interface AccompanyingPeriod {
id: number; id: number;
addressLocation?: Address | null; addressLocation?: Address | null;
administrativeLocation?: Location | null; administrativeLocation?: Location | null;
calendars: Calendar[]; calendars: Calendar[];
closingDate?: Date | null; closingDate?: Date | null;
closingMotive?: ClosingMotive | null; closingMotive?: ClosingMotive | null;
comments: Comment[]; comments: Comment[];
confidential: boolean; confidential: boolean;
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;
origin?: Origin | null; origin?: Origin | null;
participations: AccompanyingPeriodParticipation[]; participations: AccompanyingPeriodParticipation[];
personLocation?: Person | null; personLocation?: Person | null;
pinnedComment?: Comment | null; pinnedComment?: Comment | null;
preventUserIsChangedNotification: boolean; preventUserIsChangedNotification: boolean;
remark: string; remark: string;
requestorAnonymous: boolean; requestorAnonymous: boolean;
requestorPerson?: Person | null; requestorPerson?: Person | null;
requestorThirdParty?: Thirdparty | null; requestorThirdParty?: Thirdparty | null;
resources: AccompanyingPeriodResource[]; resources: AccompanyingPeriodResource[];
scopes: Scope[]; scopes: Scope[];
socialIssues: SocialIssue[]; socialIssues: SocialIssue[];
step?: step?:
| "CLOSED" | "CLOSED"
| "CONFIRMED" | "CONFIRMED"
| "CONFIRMED_INACTIVE_SHORT" | "CONFIRMED_INACTIVE_SHORT"
| "CONFIRMED_INACTIVE_LONG" | "CONFIRMED_INACTIVE_LONG"
| "DRAFT"; | "DRAFT";
} }
export interface AccompanyingPeriodWorkEvaluationDocument { export interface AccompanyingPeriodWorkEvaluationDocument {
@ -84,170 +84,170 @@ export interface AccompanyingPeriodWorkEvaluationDocument {
} }
export interface AccompanyingPeriodWork { export interface AccompanyingPeriodWork {
id: number; id: number;
accompanyingPeriod?: AccompanyingPeriod; accompanyingPeriod?: AccompanyingPeriod;
accompanyingPeriodWorkEvaluations: AccompanyingPeriodWorkEvaluation[]; accompanyingPeriodWorkEvaluations: AccompanyingPeriodWorkEvaluation[];
createdAt?: string; createdAt?: string;
createdAutomatically: boolean; createdAutomatically: boolean;
createdAutomaticallyReason: string; createdAutomaticallyReason: string;
createdBy: User; createdBy: User;
endDate?: string; endDate?: string;
goals: AccompanyingPeriodWorkGoal[]; goals: AccompanyingPeriodWorkGoal[];
handlingThierParty?: Thirdparty; handlingThierParty?: Thirdparty;
note: string; note: string;
persons: Person[]; persons: Person[];
privateComment: PrivateCommentEmbeddable; privateComment: PrivateCommentEmbeddable;
referrersHistory: AccompanyingPeriodWorkReferrerHistory[]; referrersHistory: AccompanyingPeriodWorkReferrerHistory[];
results: Result[]; results: Result[];
socialAction?: SocialAction; socialAction?: SocialAction;
startDate?: string; startDate?: string;
thirdParties: Thirdparty[]; thirdParties: Thirdparty[];
updatedAt?: string; updatedAt?: string;
updatedBy: User; updatedBy: User;
version: number; version: number;
} }
interface SocialAction { interface SocialAction {
id: number; id: number;
parent?: SocialAction | null; parent?: SocialAction | null;
children: SocialAction[]; children: SocialAction[];
issue?: SocialIssue | null; issue?: SocialIssue | null;
ordering: number; ordering: number;
title: { title: {
fr: string; fr: string;
}; };
defaultNotificationDelay?: string | null; defaultNotificationDelay?: string | null;
desactivationDate?: string | null; desactivationDate?: string | null;
evaluations: Evaluation[]; evaluations: Evaluation[];
goals: Goal[]; goals: Goal[];
results: Result[]; results: Result[];
} }
export interface AccompanyingPeriodResource { export interface AccompanyingPeriodResource {
id: number; id: number;
accompanyingPeriod: AccompanyingPeriod; accompanyingPeriod: AccompanyingPeriod;
comment?: string | null; comment?: string | null;
person?: Person | null; person?: Person | null;
thirdParty?: Thirdparty | null; thirdParty?: Thirdparty | null;
} }
export interface Origin { export interface Origin {
id: number; id: number;
label: { label: {
fr: string; fr: string;
}; };
noActiveAfter: DateTime; noActiveAfter: DateTime;
} }
export interface ClosingMotive { export interface ClosingMotive {
id: number; id: number;
active: boolean; active: boolean;
name: { name: {
fr: string; fr: string;
}; };
ordering: number; ordering: number;
isCanceledAccompanyingPeriod: boolean; isCanceledAccompanyingPeriod: boolean;
parent?: ClosingMotive | null; parent?: ClosingMotive | null;
children: ClosingMotive[]; children: ClosingMotive[];
} }
export interface AccompanyingPeriodParticipation { export interface AccompanyingPeriodParticipation {
id: number; id: number;
startDate: DateTime; startDate: DateTime;
endDate?: DateTime | null; endDate?: DateTime | null;
accompanyingPeriod: AccompanyingPeriod; accompanyingPeriod: AccompanyingPeriod;
person: Person; person: Person;
} }
export interface AccompanyingPeriodLocationHistory { export interface AccompanyingPeriodLocationHistory {
id: number; id: number;
startDate: DateTime; startDate: DateTime;
endDate?: DateTime | null; endDate?: DateTime | null;
addressLocation?: Address | null; addressLocation?: Address | null;
period: AccompanyingPeriod; period: AccompanyingPeriod;
personLocation?: Person | null; personLocation?: Person | null;
} }
export interface SocialIssue { export interface SocialIssue {
id: number; id: number;
parent?: SocialIssue | null; parent?: SocialIssue | null;
children: SocialIssue[]; children: SocialIssue[];
socialActions?: SocialAction[] | null; socialActions?: SocialAction[] | null;
ordering: number; ordering: number;
title: { title: {
fr: string; fr: string;
}; };
desactivationDate?: string | null; desactivationDate?: string | null;
} }
export interface Goal { export interface Goal {
id: number; id: number;
results: Result[]; results: Result[];
socialActions?: SocialAction[] | null; socialActions?: SocialAction[] | null;
title: { title: {
fr: string; fr: string;
}; };
} }
export interface Result { export interface Result {
id: number; id: number;
accompanyingPeriodWorks: AccompanyingPeriodWork[]; accompanyingPeriodWorks: AccompanyingPeriodWork[];
accompanyingPeriodWorkGoals: AccompanyingPeriodWorkGoal[]; accompanyingPeriodWorkGoals: AccompanyingPeriodWorkGoal[];
goals: Goal[]; goals: Goal[];
socialActions: SocialAction[]; socialActions: SocialAction[];
title: { title: {
fr: string; fr: string;
}; };
desactivationDate?: string | null; desactivationDate?: string | null;
} }
export interface AccompanyingPeriodWorkGoal { export interface AccompanyingPeriodWorkGoal {
id: number; id: number;
accompanyingPeriodWork: AccompanyingPeriodWork; accompanyingPeriodWork: AccompanyingPeriodWork;
goal: Goal; goal: Goal;
note: string; note: string;
results: Result[]; results: Result[];
} }
export interface AccompanyingPeriodWorkEvaluation { export interface AccompanyingPeriodWorkEvaluation {
accompanyingPeriodWork: AccompanyingPeriodWork | null; accompanyingPeriodWork: AccompanyingPeriodWork | null;
comment: string; comment: string;
createdAt: DateTime | null; createdAt: DateTime | null;
createdBy: User | null; createdBy: User | null;
documents: AccompanyingPeriodWorkEvaluationDocument[]; documents: AccompanyingPeriodWorkEvaluationDocument[];
endDate: DateTime | null; endDate: DateTime | null;
evaluation: Evaluation | null; evaluation: Evaluation | null;
id: number | null; id: number | null;
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
key: any; key: any;
maxDate: DateTime | null; maxDate: DateTime | null;
startDate: DateTime | null; startDate: DateTime | null;
updatedAt: DateTime | null; updatedAt: DateTime | null;
updatedBy: User | null; updatedBy: User | null;
warningInterval: string | null; warningInterval: string | null;
timeSpent: number | null; timeSpent: number | null;
} }
export interface Evaluation { export interface Evaluation {
id: number; id: number;
url: string; url: string;
socialActions: SocialAction[]; socialActions: SocialAction[];
title: { title: {
fr: string; fr: string;
}; };
active: boolean; active: boolean;
delay: string; delay: string;
notificationDelay: string; notificationDelay: string;
} }
export interface AccompanyingPeriodWorkReferrerHistory { export interface AccompanyingPeriodWorkReferrerHistory {
id: number; id: number;
accompanyingPeriodWork: AccompanyingPeriodWork; accompanyingPeriodWork: AccompanyingPeriodWork;
user: User; user: User;
startDate: DateTime; startDate: DateTime;
endDate: DateTime | null; endDate: DateTime | null;
createdAt: DateTime; createdAt: DateTime;
updatedAt: DateTime | null; updatedAt: DateTime | null;
createdBy: User; createdBy: User;
updatedBy: User | null; updatedBy: User | null;
} }

View File

@ -279,7 +279,7 @@ export default {
(results) => (results) =>
([this.results.options, this.results.value] = ([this.results.options, this.results.value] =
this.removeElementInData("results", results)), this.removeElementInData("results", results)),
).catch; );
}, },
// selectResult(value) { // selectResult(value) {

View File

@ -294,10 +294,13 @@ export default {
refreshNetwork() { refreshNetwork() {
//console.log('--- refresh network') //console.log('--- refresh network')
window.network.setData(this.visgraph_data); window.network.setData(this.visgraph_data);
return 1;
}, },
legendLayers() { legendLayers() {
//console.log('--- refresh legend and rebuild checked Layers') //console.log('--- refresh legend and rebuild checked Layers')
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
this.checkedLayers = []; this.checkedLayers = [];
let layersDisplayed = [ let layersDisplayed = [
...this.nodes.filter((n) => n.id.startsWith("household")), ...this.nodes.filter((n) => n.id.startsWith("household")),
@ -309,6 +312,7 @@ export default {
return [...this.households, ...this.courses]; return [...this.households, ...this.courses];
}, },
// eslint-disable-next-line vue/no-dupe-keys
checkedLayers() { checkedLayers() {
// required to refresh data checkedLayers // required to refresh data checkedLayers
//console.log('--- checkedLayers') //console.log('--- checkedLayers')
@ -386,6 +390,7 @@ export default {
}, },
forceUpdateComponent() { forceUpdateComponent() {
//console.log('!! forceUpdateComponent !!') //console.log('!! forceUpdateComponent !!')
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
this.refreshNetwork; this.refreshNetwork;
this.$forceUpdate(); this.$forceUpdate();
}, },

View File

@ -164,7 +164,8 @@ const store = createStore({
return; return;
} }
let age = getAge(person); let age = getAge(person);
age = age === "" ? "" : " - " + age; let separator = person.gender === null ? "" : " - ";
age = age === "" ? "" : separator + age;
let debug = ""; let debug = "";
/// Debug mode: uncomment to display person_id on visgraph /// Debug mode: uncomment to display person_id on visgraph
@ -173,7 +174,7 @@ const store = createStore({
person.group = person.type; person.group = person.type;
person._id = person.id; person._id = person.id;
person.id = `person_${person.id}`; person.id = `person_${person.id}`;
person.label = `*${person.text}${person.deathdate ? " (‡)" : ""}*\n_${person.gender.label}${age}_${debug}`; person.label = `*${person.text}${person.deathdate ? " (‡)" : ""}*\n_${person.gender === null ? "" : person.gender?.label}${age}_${debug}`;
person.folded = false; person.folded = false;
// folded is used for missing persons // folded is used for missing persons
if (options.folded) { if (options.folded) {

View File

@ -1,43 +1,51 @@
<template> <template>
<div class="container"> <div class="container">
<div class="item-bloc"> <div class="item-bloc">
<div class="item-row"> <div class="item-row">
<h2 class="badge-title"> <h2 class="badge-title">
<span class="title_label"></span> <span class="title_label"></span>
<span class="title_action"> <span class="title_action">
<span class="chill-entity entity-social-action"> <span class="chill-entity entity-social-action">
<span class="badge bg-light text-dark"> <span class="badge bg-light text-dark">
{{ acpw?.socialAction?.title.fr }} {{ acpw?.socialAction?.title.fr }}
</span> </span>
</span> </span>
<ul class="small_in_title columns mt-1"> <ul class="small_in_title columns mt-1">
<li> <li>
<span class="item-key"> <span class="item-key">
{{ trans(ACCOMPANYING_COURSE_WORK_START_DATE) }} : {{
</span> trans(
<b>{{ formatDate(acpw.startDate) }}</b> ACCOMPANYING_COURSE_WORK_START_DATE,
</li> )
}}
:
</span>
<b>{{ formatDate(acpw.startDate) }}</b>
</li>
<li v-if="acpw.endDate"> <li v-if="acpw.endDate">
<span class="item-key"> <span class="item-key">
{{ trans(ACCOMPANYING_COURSE_WORK_END_DATE) }} : {{
</span> trans(ACCOMPANYING_COURSE_WORK_END_DATE)
<b>{{ formatDate(acpw.endDate) }}</b> }}
</li> :
</ul> </span>
</span> <b>{{ formatDate(acpw.endDate) }}</b>
</h2> </li>
</div> </ul>
</span>
</h2>
</div>
</div>
</div> </div>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { import {
ACCOMPANYING_COURSE_WORK_END_DATE, ACCOMPANYING_COURSE_WORK_END_DATE,
ACCOMPANYING_COURSE_WORK_START_DATE, ACCOMPANYING_COURSE_WORK_START_DATE,
trans, trans,
} from "translator"; } 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";
@ -46,15 +54,15 @@ import { AccompanyingPeriodWork } from "../../../types";
// eslint-disable-next-line @typescript-eslint/no-unused-vars // 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( return new Intl.DateTimeFormat("default", {
parsedDate, dateStyle: "short",
); }).format(parsedDate);
} else { } else {
return ""; return "";
}
} }
}
}; };
</script> </script>

View File

@ -1,24 +1,24 @@
<template> <template>
<div class="results"> <div class="results">
<div <div
v-for="acpw in accompanyingPeriodWorks" v-for="acpw in accompanyingPeriodWorks"
:key="acpw.id" :key="acpw.id"
class="list-item" class="list-item"
> >
<label class="acpw-item"> <label class="acpw-item">
<div> <div>
<input <input
type="radio" type="radio"
:value="acpw" :value="acpw"
v-model="selectedAcpw" v-model="selectedAcpw"
name="item" 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">
@ -28,7 +28,7 @@ import { defineProps, ref, watch } from "vue";
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
const props = defineProps<{ const props = defineProps<{
accompanyingPeriodWorks: AccompanyingPeriodWork[]; accompanyingPeriodWorks: AccompanyingPeriodWork[];
}>(); }>();
const selectedAcpw = ref<AccompanyingPeriodWork | null>(null); const selectedAcpw = ref<AccompanyingPeriodWork | null>(null);
@ -36,12 +36,12 @@ const selectedAcpw = ref<AccompanyingPeriodWork | null>(null);
const emit = defineEmits(); const emit = defineEmits();
watch(selectedAcpw, (newValue) => { watch(selectedAcpw, (newValue) => {
emit("update:selectedAcpw", newValue); emit("update:selectedAcpw", newValue);
}); });
</script> </script>
<style> <style>
.acpw-item { .acpw-item {
display: flex; display: flex;
} }
</style> </style>

View File

@ -1,62 +1,78 @@
<template> <template>
<div> <div>
<div class="row justify-content-end"> <div class="row justify-content-end">
<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">{{ <span
selectedAcpw?.socialAction?.title.fr @click="selectedAcpw = null"
}}</span> class="chill-denomination"
</li> >{{ selectedAcpw?.socialAction?.title.fr }}</span
>
</li>
</ul>
</div>
</div>
<ul class="record_actions">
<li>
<a class="btn btn-sm btn-create mt-3" @click="openModal">
{{ trans(ACPW_DUPLICATE_SELECT_ACCOMPANYING_PERIOD_WORK) }}
</a>
</li>
</ul> </ul>
</div>
<teleport to="body">
<modal
v-if="showModal"
@close="closeModal"
modal-dialog-class="modal-dialog-scrollable modal-xl"
>
<template #header>
<h3>
{{
trans(
ACPW_DUPLICATE_SELECT_ACCOMPANYING_PERIOD_WORK,
)
}}
</h3>
</template>
<template #body>
<accompanying-period-work-list
:accompanying-period-works="accompanyingPeriodWorks"
v-model:selectedAcpw="selectedAcpw"
/>
</template>
<template #footer>
<button
type="button"
class="btn btn-save"
@click="confirmSelection"
>
{{ trans(CONFIRM) }}
</button>
</template>
</modal>
</teleport>
</div> </div>
<ul class="record_actions">
<li>
<a class="btn btn-sm btn-create mt-3" @click="openModal">
{{ trans(ACPW_DUPLICATE_SELECT_ACCOMPANYING_PERIOD_WORK) }}
</a>
</li>
</ul>
<teleport to="body">
<modal
v-if="showModal"
@close="closeModal"
modal-dialog-class="modal-dialog-scrollable modal-xl"
>
<template #header>
<h3>{{ trans(ACPW_DUPLICATE_SELECT_ACCOMPANYING_PERIOD_WORK) }}</h3>
</template>
<template #body>
<accompanying-period-work-list
:accompanying-period-works="accompanyingPeriodWorks"
v-model:selectedAcpw="selectedAcpw"
/>
</template>
<template #footer>
<button type="button" class="btn btn-save" @click="confirmSelection">
{{ trans(CONFIRM) }}
</button>
</template>
</modal>
</teleport>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import {onMounted, ref} from "vue"; import { onMounted, ref } 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 {ACPW_DUPLICATE_SELECT_ACCOMPANYING_PERIOD_WORK, CONFIRM, trans,} from "translator"; import {
import {fetchResults} from "ChillMainAssets/lib/api/apiMethods"; ACPW_DUPLICATE_SELECT_ACCOMPANYING_PERIOD_WORK,
CONFIRM,
trans,
} from "translator";
import { fetchResults } from "ChillMainAssets/lib/api/apiMethods";
interface AccompanyingPeriodWorkSelectorModalProps { interface AccompanyingPeriodWorkSelectorModalProps {
accompanyingPeriodId: number; accompanyingPeriodId: number;
} }
const selectedAcpw = ref<AccompanyingPeriodWork | null>(null); const selectedAcpw = ref<AccompanyingPeriodWork | null>(null);
@ -65,25 +81,25 @@ const accompanyingPeriodWorks = ref<AccompanyingPeriodWork[]>([]);
const props = defineProps<AccompanyingPeriodWorkSelectorModalProps>(); const props = defineProps<AccompanyingPeriodWorkSelectorModalProps>();
const emit = defineEmits<{ const emit = defineEmits<{
pickWork: [payload: { work: AccompanyingPeriodWork | null }]; pickWork: [payload: { work: AccompanyingPeriodWork | null }];
}>(); }>();
onMounted(() => { onMounted(() => {
if (props.accompanyingPeriodId) { if (props.accompanyingPeriodId) {
getAccompanyingPeriodWorks(props.accompanyingPeriodId); getAccompanyingPeriodWorks(props.accompanyingPeriodId);
} else { } else {
console.error("No accompanyingperiod id was given"); console.error("No accompanyingperiod id was given");
} }
}); });
const getAccompanyingPeriodWorks = async (periodId: number) => { const getAccompanyingPeriodWorks = async (periodId: number) => {
const url = `/api/1.0/person/accompanying-course/${periodId}/works.json`; const url = `/api/1.0/person/accompanying-course/${periodId}/works.json`;
try { try {
accompanyingPeriodWorks.value = await fetchResults(url); accompanyingPeriodWorks.value = await fetchResults(url);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
/* makeFetch<number, AccompanyingPeriodWork[]>("GET", url) /* makeFetch<number, AccompanyingPeriodWork[]>("GET", url)
.then((response) => { .then((response) => {
accompanyingPeriodWorks.value = response; accompanyingPeriodWorks.value = response;
}) })
@ -95,7 +111,7 @@ const getAccompanyingPeriodWorks = async (periodId: number) => {
const openModal = () => (showModal.value = true); const openModal = () => (showModal.value = true);
const closeModal = () => (showModal.value = false); const closeModal = () => (showModal.value = false);
const confirmSelection = () => { const confirmSelection = () => {
emit("pickWork", { work: selectedAcpw.value }); emit("pickWork", { work: selectedAcpw.value });
closeModal(); closeModal();
}; };
</script> </script>

View File

@ -377,7 +377,7 @@ export default {
"/api/1.0/person/household/members/move.json", "/api/1.0/person/household/members/move.json",
member, member,
) )
.then((_response) => { .then(() => {
makeFetch( makeFetch(
"POST", "POST",
`/api/1.0/person/household/${responseHousehold.id}/address.json`, `/api/1.0/person/household/${responseHousehold.id}/address.json`,

View File

@ -1,7 +1,11 @@
import { is_object_ready } from "../../../../../../ChillDocStoreBundle/Resources/public/vuejs/StoredObjectButton/helpers"; import { is_object_ready } from "ChillDocStoreAssets/vuejs/StoredObjectButton/helpers";
import { import { StoredObject } from "ChillDocStoreAssets/types";
StoredObject,
} from "../../../../../../ChillDocStoreBundle/Resources/public/types"; declare global {
interface Window {
stored_object: string | undefined;
}
}
async function reload_if_needed( async function reload_if_needed(
stored_object: StoredObject, stored_object: StoredObject,
@ -25,14 +29,12 @@ function wait_before_reload(stored_object: StoredObject, i: number): void {
setTimeout(reload_if_needed, timeout, stored_object, i); setTimeout(reload_if_needed, timeout, stored_object, i);
} }
window.addEventListener("DOMContentLoaded", async function (e) { window.addEventListener("DOMContentLoaded", async function () {
if (undefined === (window as any).stored_object) { if (undefined === window.stored_object) {
console.error("window.stored_object is undefined"); console.error("window.stored_object is undefined");
throw Error("window.stored_object is undefined"); throw Error("window.stored_object is undefined");
} }
const stored_object = JSON.parse( const stored_object = JSON.parse(window.stored_object) as StoredObject;
(window as any).stored_object,
) as StoredObject;
reload_if_needed(stored_object, 0); reload_if_needed(stored_object, 0);
}); });