From d0acbf1191115264a21b1d040d455dca176be0aa Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 13 May 2026 17:32:59 +1000 Subject: [PATCH] [UI] Adjust week start date (#11934) * Adjust week start date Co-authored-by: Copilot * Change to global setting --------- Co-authored-by: Copilot --- docs/docs/settings/global.md | 13 +++- .../InvenTree/common/setting/system.py | 14 ++++ .../src/components/calendar/Calendar.tsx | 7 ++ .../pages/Index/Settings/SystemSettings.tsx | 68 +++++++++++-------- 4 files changed, 74 insertions(+), 28 deletions(-) diff --git a/docs/docs/settings/global.md b/docs/docs/settings/global.md index c1e4ad4379..5773e1f4cb 100644 --- a/docs/docs/settings/global.md +++ b/docs/docs/settings/global.md @@ -32,11 +32,22 @@ Configuration of basic server settings: {{ globalsetting("INVENTREE_RESTRICT_ABOUT") }} {{ globalsetting("DISPLAY_FULL_NAMES") }} {{ globalsetting("DISPLAY_PROFILE_INFO") }} -{{ globalsetting("INVENTREE_UPDATE_CHECK_INTERVAL") }} +{{ globalsetting("WEEK_STARTS_ON") }} + +Configuration of image download settings: + +| Name | Description | Default | Units | +| ---- | ----------- | ------- | ----- | {{ globalsetting("INVENTREE_DOWNLOAD_FROM_URL") }} {{ globalsetting("INVENTREE_DOWNLOAD_IMAGE_MAX_SIZE") }} {{ globalsetting("INVENTREE_DOWNLOAD_FROM_URL_USER_AGENT") }} {{ globalsetting("INVENTREE_STRICT_URLS") }} + +Configuration of various scheduled tasks: + +| Name | Description | Default | Units | +| ---- | ----------- | ------- | ----- | +{{ globalsetting("INVENTREE_UPDATE_CHECK_INTERVAL") }} {{ globalsetting("INVENTREE_BACKUP_ENABLE") }} {{ globalsetting("INVENTREE_BACKUP_DAYS") }} {{ globalsetting("INVENTREE_DELETE_TASKS_DAYS") }} diff --git a/src/backend/InvenTree/common/setting/system.py b/src/backend/InvenTree/common/setting/system.py index 513d579f78..880464d971 100644 --- a/src/backend/InvenTree/common/setting/system.py +++ b/src/backend/InvenTree/common/setting/system.py @@ -1210,6 +1210,20 @@ SYSTEM_SETTINGS: dict[str, InvenTreeSettingsKeyType] = { 'default': True, 'validator': bool, }, + 'WEEK_STARTS_ON': { + 'name': _('Week Starts On'), + 'description': _('Starting day of the week, for display in calendar views'), + 'default': '1', + 'choices': [ + ('0', _('Sunday')), + ('1', _('Monday')), + ('2', _('Tuesday')), + ('3', _('Wednesday')), + ('4', _('Thursday')), + ('5', _('Friday')), + ('6', _('Saturday')), + ], + }, 'TEST_STATION_DATA': { 'name': _('Enable Test Station Data'), 'description': _('Enable test station data collection for test results'), diff --git a/src/frontend/src/components/calendar/Calendar.tsx b/src/frontend/src/components/calendar/Calendar.tsx index a6cdb022f1..8b80347fce 100644 --- a/src/frontend/src/components/calendar/Calendar.tsx +++ b/src/frontend/src/components/calendar/Calendar.tsx @@ -37,6 +37,7 @@ import { } from '../../contexts/LanguageContext'; import type { CalendarState } from '../../hooks/UseCalendar'; import { useLocalState } from '../../states/LocalState'; +import { useGlobalSettingsState } from '../../states/SettingsStates'; import { FilterSelectDrawer } from '../../tables/FilterSelectDrawer'; export interface InvenTreeCalendarProps extends CalendarOptions { @@ -57,6 +58,8 @@ export default function Calendar({ state, ...calendarProps }: Readonly) { + const globalSettings = useGlobalSettingsState(); + const [monthSelectOpened, setMonthSelectOpened] = useState(false); const [filtersVisible, setFiltersVisible] = useState(false); @@ -206,6 +209,10 @@ export default function Calendar({ initialView='dayGridMonth' locales={allLocales} locale={calendarLocale} + firstDay={Number.parseInt( + globalSettings.getSetting('WEEK_STARTS_ON') ?? '1', + 10 + )} headerToolbar={false} footerToolbar={false} {...calendarProps} diff --git a/src/frontend/src/pages/Index/Settings/SystemSettings.tsx b/src/frontend/src/pages/Index/Settings/SystemSettings.tsx index e03660fe59..9c607d6830 100644 --- a/src/frontend/src/pages/Index/Settings/SystemSettings.tsx +++ b/src/frontend/src/pages/Index/Settings/SystemSettings.tsx @@ -44,33 +44,47 @@ export default function SystemSettings() { label: t`Server`, icon: , content: ( - + <> + + + + ) }, {