diff --git a/core/__pycache__/forms.cpython-311.pyc b/core/__pycache__/forms.cpython-311.pyc index 1b9f2f5..516fd2e 100644 Binary files a/core/__pycache__/forms.cpython-311.pyc and b/core/__pycache__/forms.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 44c51ca..956a043 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index a072fe6..2b8987d 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index ff36ed9..37788ab 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/forms.py b/core/forms.py index 3a149ed..860b65c 100644 --- a/core/forms.py +++ b/core/forms.py @@ -22,9 +22,17 @@ class WorkLogForm(forms.ModelForm): ) team = forms.ModelChoiceField(queryset=Team.objects.none(), required=False, empty_label="Select Team", widget=forms.Select(attrs={'class': 'form-control'})) + # Explicitly defining overtime to ensure it's not required and has correct widget + overtime = forms.ChoiceField( + choices=WorkLog.OT_CHOICES, + required=False, + initial=0, + widget=forms.Select(attrs={'class': 'form-control'}) + ) + class Meta: model = WorkLog - fields = ['date', 'project', 'workers', 'notes'] + fields = ['date', 'project', 'workers', 'notes', 'overtime'] widgets = { 'date': forms.DateInput(attrs={'type': 'date', 'class': 'form-control'}), 'project': forms.Select(attrs={'class': 'form-control'}), @@ -80,4 +88,4 @@ ExpenseLineItemFormSet = inlineformset_factory( 'product': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Item Name'}), 'amount': forms.NumberInput(attrs={'class': 'form-control item-amount', 'step': '0.01'}), } -) +) \ No newline at end of file diff --git a/core/migrations/0013_worklog_overtime_worklog_overtime_priced.py b/core/migrations/0013_worklog_overtime_worklog_overtime_priced.py new file mode 100644 index 0000000..1652d31 --- /dev/null +++ b/core/migrations/0013_worklog_overtime_worklog_overtime_priced.py @@ -0,0 +1,24 @@ +# Generated by Django 5.2.7 on 2026-02-10 09:14 + +from decimal import Decimal +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0012_add_team_to_worklog'), + ] + + operations = [ + migrations.AddField( + model_name='worklog', + name='overtime', + field=models.DecimalField(choices=[(Decimal('0'), 'None'), (Decimal('0.25'), '1/4 Day'), (Decimal('0.5'), '1/2 Day'), (Decimal('0.75'), '3/4 Day'), (Decimal('1.0'), 'Full Day')], decimal_places=2, default=0, max_digits=3), + ), + migrations.AddField( + model_name='worklog', + name='overtime_priced', + field=models.BooleanField(default=False), + ), + ] diff --git a/core/migrations/__pycache__/0013_worklog_overtime_worklog_overtime_priced.cpython-311.pyc b/core/migrations/__pycache__/0013_worklog_overtime_worklog_overtime_priced.cpython-311.pyc new file mode 100644 index 0000000..37ea97f Binary files /dev/null and b/core/migrations/__pycache__/0013_worklog_overtime_worklog_overtime_priced.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index b7d56a2..aafdec0 100644 --- a/core/models.py +++ b/core/models.py @@ -74,12 +74,23 @@ class Team(models.Model): return self.name class WorkLog(models.Model): + OT_CHOICES = [ + (Decimal('0'), 'None'), + (Decimal('0.25'), '1/4 Day'), + (Decimal('0.5'), '1/2 Day'), + (Decimal('0.75'), '3/4 Day'), + (Decimal('1.0'), 'Full Day'), + ] + date = models.DateField() project = models.ForeignKey(Project, on_delete=models.CASCADE, related_name='logs') team = models.ForeignKey(Team, on_delete=models.SET_NULL, null=True, blank=True, related_name='work_logs') workers = models.ManyToManyField(Worker, related_name='work_logs') supervisor = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True) notes = models.TextField(blank=True) + + overtime = models.DecimalField(max_digits=3, decimal_places=2, default=0, choices=OT_CHOICES) + overtime_priced = models.BooleanField(default=False) class Meta: verbose_name = "Work Log / Attendance" diff --git a/core/templates/core/log_attendance.html b/core/templates/core/log_attendance.html index 83b13b4..0328b9e 100644 --- a/core/templates/core/log_attendance.html +++ b/core/templates/core/log_attendance.html @@ -56,6 +56,18 @@ + +