Fix of errors: automatic and some manual

This commit is contained in:
2024-11-04 19:56:03 +01:00
parent 90798b12e5
commit f05c25853c
41 changed files with 101 additions and 148 deletions

View File

@@ -46,7 +46,6 @@
<teleport to="#fullCalendar">
<div class="calendar-actives">
<template
class=""
v-for="u in getActiveUsers"
:key="u.id"
>

View File

@@ -17,16 +17,16 @@ export interface UserData {
}
export const addIdToValue = (string: string, id: number): string => {
let array = string ? string.split(',') : [];
const array = string ? string.split(',') : [];
array.push(id.toString());
let str = array.join();
const str = array.join();
return str;
};
export const removeIdFromValue = (string: string, id: number) => {
let array = string.split(',');
array = array.filter(el => el !== id.toString());
let str = array.join();
const str = array.join();
return str;
};
@@ -34,7 +34,7 @@ export const removeIdFromValue = (string: string, id: number) => {
* Assign missing keys for the ConcernedGroups component
*/
export const mapEntity = (entity: EventInput): EventInput => {
let calendar = { ...entity};
const calendar = { ...entity};
Object.assign(calendar, {thirdParties: entity.professionals});
if (entity.startDate !== null ) {

View File

@@ -40,11 +40,9 @@ import {
VNodeProps
} from 'vue'
const Teleport = teleport_ as {
new (): {
const Teleport = teleport_ as new () => {
$props: VNodeProps & TeleportProps
}
}
const store = useStore(key);

View File

@@ -16,7 +16,7 @@ export interface CalendarLocalsState {
type Context = ActionContext<CalendarLocalsState, State>;
export default <Module<CalendarLocalsState, State>> {
export default {
namespaced: true,
state: (): CalendarLocalsState => ({
locals: [],
@@ -26,7 +26,7 @@ export default <Module<CalendarLocalsState, State>> {
}),
getters: {
isLocalsLoaded: (state: CalendarLocalsState) => ({start, end}: {start: Date, end: Date}): boolean => {
for (let range of state.localsLoaded) {
for (const range of state.localsLoaded) {
if (start.getTime() === range.start && end.getTime() === range.end) {
return true;
}
@@ -92,4 +92,4 @@ export default <Module<CalendarLocalsState, State>> {
});
}
}
};
} as Module<CalendarLocalsState, State>;

View File

@@ -22,7 +22,7 @@ export interface CalendarRangesState {
type Context = ActionContext<CalendarRangesState, State>;
export default <Module<CalendarRangesState, State>>{
export default {
namespaced: true,
state: (): CalendarRangesState => ({
ranges: [],
@@ -32,7 +32,7 @@ export default <Module<CalendarRangesState, State>>{
}),
getters: {
isRangeLoaded: (state: CalendarRangesState) => ({start, end}: { start: Date, end: Date }): boolean => {
for (let range of state.rangesLoaded) {
for (const range of state.rangesLoaded) {
if (start.getTime() === range.start && end.getTime() === range.end) {
return true;
}
@@ -42,9 +42,9 @@ export default <Module<CalendarRangesState, State>>{
},
getRangesOnDate: (state: CalendarRangesState) => (date: Date): EventInputCalendarRange[] => {
const founds = [];
const dateStr = <string>dateToISO(date);
const dateStr = dateToISO(date) as string;
for (let range of state.ranges) {
for (const range of state.ranges) {
if (isEventInputCalendarRange(range)
&& range.start.startsWith(dateStr)
) {
@@ -56,11 +56,11 @@ export default <Module<CalendarRangesState, State>>{
},
getRangesOnWeek: (state: CalendarRangesState) => (mondayDate: Date): EventInputCalendarRange[] => {
const founds = [];
for (let d of Array.from(Array(7).keys())) {
for (const d of Array.from(Array(7).keys())) {
const dateOfWeek = new Date(mondayDate);
dateOfWeek.setDate(mondayDate.getDate() + d);
const dateStr = <string>dateToISO(dateOfWeek);
for (let range of state.ranges) {
const dateStr = dateToISO(dateOfWeek) as string;
for (const range of state.ranges) {
if (isEventInputCalendarRange(range)
&& range.start.startsWith(dateStr)
) {
@@ -253,12 +253,12 @@ export default <Module<CalendarRangesState, State>>{
const rangesToCopy: EventInputCalendarRange[] = ctx.getters['getRangesOnDate'](from);
const promises = [];
for (let r of rangesToCopy) {
let start = new Date(<Date>ISOToDatetime(r.start));
for (const r of rangesToCopy) {
const start = new Date((ISOToDatetime(r.start) as Date));
start.setFullYear(to.getFullYear(), to.getMonth(), to.getDate());
let end = new Date(<Date>ISOToDatetime(r.end));
const end = new Date((ISOToDatetime(r.end) as Date));
end.setFullYear(to.getFullYear(), to.getMonth(), to.getDate());
let location = ctx.rootGetters['locations/getLocationById'](r.locationId);
const location = ctx.rootGetters['locations/getLocationById'](r.locationId);
promises.push(ctx.dispatch('createRange', {start, end, location}));
}
@@ -270,12 +270,12 @@ export default <Module<CalendarRangesState, State>>{
const rangesToCopy: EventInputCalendarRange[] = ctx.getters['getRangesOnWeek'](fromMonday);
const promises = [];
const diffTime = toMonday.getTime() - fromMonday.getTime();
for (let r of rangesToCopy) {
let start = new Date(<Date>ISOToDatetime(r.start));
let end = new Date(<Date>ISOToDatetime(r.end));
for (const r of rangesToCopy) {
const start = new Date((ISOToDatetime(r.start) as Date));
const end = new Date((ISOToDatetime(r.end) as Date));
start.setTime(start.getTime() + diffTime);
end.setTime(end.getTime() + diffTime);
let location = ctx.rootGetters['locations/getLocationById'](r.locationId);
const location = ctx.rootGetters['locations/getLocationById'](r.locationId);
promises.push(ctx.dispatch('createRange', {start, end, location}));
}
@@ -283,4 +283,4 @@ export default <Module<CalendarRangesState, State>>{
return Promise.all(promises).then(_ => Promise.resolve(null));
}
}
};
} as Module<CalendarRangesState, State>;

View File

@@ -16,7 +16,7 @@ export interface CalendarRemotesState {
type Context = ActionContext<CalendarRemotesState, State>;
export default <Module<CalendarRemotesState, State>> {
export default {
namespaced: true,
state: (): CalendarRemotesState => ({
remotes: [],
@@ -26,7 +26,7 @@ export default <Module<CalendarRemotesState, State>> {
}),
getters: {
isRemotesLoaded: (state: CalendarRemotesState) => ({start, end}: {start: Date, end: Date}): boolean => {
for (let range of state.remotesLoaded) {
for (const range of state.remotesLoaded) {
if (start.getTime() === range.start && end.getTime() === range.end) {
return true;
}
@@ -92,4 +92,4 @@ export default <Module<CalendarRemotesState, State>> {
});
}
}
};
} as Module<CalendarRemotesState, State>;

View File

@@ -10,7 +10,7 @@ export interface LocationState {
currentLocation: Location | null;
}
export default <Module<LocationState, State>>{
export default {
namespaced: true,
state: (): LocationState => {
return {
@@ -58,5 +58,5 @@ export default <Module<LocationState, State>>{
})
}
}
}
} as Module<LocationState, State>