.
This commit is contained in:
@@ -92,6 +92,10 @@ class ShiftForm(forms.Form):
|
||||
days = forms.MultipleChoiceField(choices=DAYS, widget=forms.CheckboxSelectMultiple)
|
||||
workers_required = forms.IntegerField(min_value=1, initial=1)
|
||||
assign_as_block = forms.BooleanField(required=False, initial=False)
|
||||
balance_offset = forms.FloatField(
|
||||
required=False,
|
||||
help_text="Maximum allowed difference in allocated shifts for this shift (leave blank for default)",
|
||||
)
|
||||
|
||||
def clean_sites(self):
|
||||
val = self.cleaned_data["sites"]
|
||||
|
||||
@@ -326,6 +326,7 @@ def shift_add(request, rota_id):
|
||||
"days": data["days"],
|
||||
"workers_required": int(data["workers_required"]),
|
||||
"assign_as_block": bool(data["assign_as_block"]),
|
||||
"balance_offset": data.get("balance_offset"),
|
||||
}
|
||||
|
||||
current = rota.shifts or []
|
||||
@@ -401,6 +402,7 @@ def shift_edit(request, rota_id, idx):
|
||||
"days": shift.get("days"),
|
||||
"workers_required": shift.get("workers_required"),
|
||||
"assign_as_block": shift.get("assign_as_block", False),
|
||||
"balance_offset": shift.get("balance_offset", None),
|
||||
}
|
||||
form = ShiftForm(initial=initial)
|
||||
modal_html = render_to_string("rota/partials/shift_form_modal.html", {"form": form, "rota": rota, "form_action": request.path}, request=request)
|
||||
|
||||
Reference in New Issue
Block a user