Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/features/api/schemas/user.schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export const UserPreferenceSchema: z.ZodType<IPreference> = z.object({
burnDaysYellow: z.number(),
burnResupplyDays: z.number(),
burnOrigin: z.string(),
supplyCartDays: z.number(),
layoutNavigationStyle: z.enum(["full", "collapsed"]),
planOverrides: z.record(
z.string(),
Expand Down
4 changes: 2 additions & 2 deletions src/features/planning/components/tools/PlanSupplyCart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

// Composables
import { useFIOStorage } from "@/features/fio/useFIOStorage";
import { usePreferences } from "@/features/preferences/usePreferences";

// Types & Interfaces
import { IMaterialIO } from "@/features/planning/usePlanCalculation.types";
Expand Down Expand Up @@ -72,8 +73,7 @@

const { hasStorage, storageOptions, findStorageValueFromOptions } =
useFIOStorage();

const refStockRequirement: Ref<number> = ref(20);
const { supplyCartDays: refStockRequirement } = usePreferences();
const refSelectedStorage: Ref<string | undefined> = ref(
hasStorage.value
? storageOptions.value.filter(
Expand Down
7 changes: 7 additions & 0 deletions src/features/preferences/usePreferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ export function usePreferences() {
set: (v) => userStore.setPreference("burnOrigin", v),
});

const supplyCartDays: WritableComputedRef<number, number> =
computed({
get: () => userStore.preferences.supplyCartDays ?? 20,
set: (v) => userStore.setPreference("supplyCartDays", v),
});

const planSettings: ComputedRef<
Record<string, Partial<IPreferencePerPlan>>
> = computed(() => {
Expand Down Expand Up @@ -234,6 +240,7 @@ export function usePreferences() {
burnDaysYellow,
burnResupplyDays,
burnOrigin,
supplyCartDays,
planSettings,
planSettingsOverview,
layoutNavigationStyle,
Expand Down
1 change: 1 addition & 0 deletions src/features/preferences/userDefaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const preferenceDefaults: IPreferenceDefault = {
burnDaysYellow: 10,
burnResupplyDays: 20,
burnOrigin: "Configure on Execution",
supplyCartDays: 20,
layoutNavigationStyle: "full",

planOverrides: {},
Expand Down
1 change: 1 addition & 0 deletions src/features/preferences/userPreferences.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface IPreference {
burnDaysYellow: number;
burnResupplyDays: number;
burnOrigin: string;
supplyCartDays: number;
layoutNavigationStyle: "full" | "collapsed";

// seeding per plan defaults
Expand Down