Skip to content

Commit e567fec

Browse files
committed
Add select all days to create restriction
1 parent 7393306 commit e567fec

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

course-matrix/frontend/src/pages/TimetableBuilder/CreateCustomSetting.tsx

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ const CreateCustomSetting = ({
102102
const val = form
103103
?.getValues("restrictions")
104104
.some((r) => r.type === "Days Off");
105-
console.log(val);
105+
// console.log(val);
106106
return val;
107107
};
108108

109109
const isMaxGapRestrictionApplied = () => {
110110
const val = form
111111
?.getValues("restrictions")
112112
.some((r) => r.type === "Max Gap");
113-
console.log(val);
113+
// console.log(val);
114114
return val;
115115
};
116116

@@ -255,6 +255,31 @@ const CreateCustomSetting = ({
255255
}}
256256
/>
257257
))}
258+
<FormField
259+
control={restrictionForm.control}
260+
name="days"
261+
render={({ field }) => {
262+
return (
263+
<FormItem
264+
className="flex flex-row items-start space-x-3 space-y-0"
265+
>
266+
<FormControl>
267+
<Checkbox
268+
checked={field.value?.length === daysOfWeek.length}
269+
onCheckedChange={(checked) => {
270+
return checked
271+
? field.onChange(daysOfWeek.map(item => item.id))
272+
: field.onChange([]);
273+
}}
274+
/>
275+
</FormControl>
276+
<FormLabel className="font-normal">
277+
All Days
278+
</FormLabel>
279+
</FormItem>
280+
);
281+
}}
282+
/>
258283
</div>
259284
<FormMessage />
260285
</FormItem>

0 commit comments

Comments
 (0)