diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php index f6ce2ad4..4a6e8781 100644 --- a/includes/controller/shifts_controller.php +++ b/includes/controller/shifts_controller.php @@ -195,7 +195,9 @@ function shift_edit_controller() $angel_types_spinner .= form_spinner( 'angeltype_count_' . $angeltype_id, $angeltype_name, - $needed_angel_types[$angeltype_id] + $needed_angel_types[$angeltype_id], + [], + ScheduleShift::whereShiftId($shift->id)->first() ? true : false, ); } diff --git a/includes/sys_form.php b/includes/sys_form.php index 2ef208a5..53967a2d 100644 --- a/includes/sys_form.php +++ b/includes/sys_form.php @@ -24,21 +24,22 @@ function form_hidden($name, $value) * @param array $data_attributes * @return string */ -function form_spinner(string $name, string $label, int $value, array $data_attributes = []) +function form_spinner(string $name, string $label, int $value, array $data_attributes = [], bool $isDisabled = false) { $id = 'spinner-' . $name; $attr = ''; foreach ($data_attributes as $attr_key => $attr_value) { $attr .= ' data-' . $attr_key . '="' . $attr_value . '"'; } + $disabled = $isDisabled ? ' disabled' : ''; return form_element($label, '