Skip to content

Commit dcc4eda

Browse files
authored
Kl/scrum 169 select all (#135)
Co-authored-by: kevin-lann <[email protected]>
1 parent 7393306 commit dcc4eda

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

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

Lines changed: 32 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,36 @@ const CreateCustomSetting = ({
255255
}}
256256
/>
257257
))}
258+
<FormField
259+
control={restrictionForm.control}
260+
name="days"
261+
render={({ field }) => {
262+
return (
263+
<FormItem className="flex flex-row items-start space-x-3 space-y-0">
264+
<FormControl>
265+
<Checkbox
266+
checked={
267+
field.value?.length ===
268+
daysOfWeek.length
269+
}
270+
onCheckedChange={(checked) => {
271+
return checked
272+
? field.onChange(
273+
daysOfWeek.map(
274+
(item) => item.id,
275+
),
276+
)
277+
: field.onChange([]);
278+
}}
279+
/>
280+
</FormControl>
281+
<FormLabel className="font-normal">
282+
All Days
283+
</FormLabel>
284+
</FormItem>
285+
);
286+
}}
287+
/>
258288
</div>
259289
<FormMessage />
260290
</FormItem>

0 commit comments

Comments
 (0)