Skip to content

Commit

Permalink
feat: make ticket and timesheet audit fields read only
Browse files Browse the repository at this point in the history
This paves way for approval/resolve actions.

Permissions for those actions have been added.
  • Loading branch information
ngurenyaga committed Aug 11, 2021
1 parent 60a87eb commit 7afb8ad
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 1 deletion.
11 changes: 10 additions & 1 deletion fahari/ops/forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.forms.widgets import DateTimeInput, TextInput
from django.forms.widgets import DateTimeInput, Select, TextInput

from fahari.common.dashboard import get_fahari_facilities_queryset
from fahari.common.forms import BaseModelForm
Expand Down Expand Up @@ -70,6 +70,7 @@ class Meta(BaseModelForm.Meta):
),
"resolved": DateTimeInput(
attrs={
"readonly": "readonly",
"disabled": True,
}
),
Expand Down Expand Up @@ -256,6 +257,14 @@ class Meta(BaseModelForm.Meta):
"approved_at": TextInput(
attrs={
"type": "datetime-local",
"readonly": "readonly",
"disabled": "disabled",
}
),
"approved_by": Select(
attrs={
"readonly": "readonly",
"disabled": "disabled",
}
),
}
Expand Down
19 changes: 19 additions & 0 deletions fahari/ops/migrations/0013_alter_weeklyprogramupdate_attendees.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.6 on 2021-08-11 17:54

import django.contrib.postgres.fields
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('ops', '0012_auto_20210728_2115'),
]

operations = [
migrations.AlterField(
model_name='weeklyprogramupdate',
name='attendees',
field=django.contrib.postgres.fields.ArrayField(base_field=models.TextField(), help_text='Use commas to separate attendees names', size=None),
),
]
21 changes: 21 additions & 0 deletions fahari/ops/migrations/0014_auto_20210811_2104.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.2.6 on 2021-08-11 18:04

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('ops', '0013_alter_weeklyprogramupdate_attendees'),
]

operations = [
migrations.AlterModelOptions(
name='facilitysystemticket',
options={'ordering': ('facility_system__facility__name', 'facility_system__system__name', '-raised', '-resolved'), 'permissions': [('can_resolve_ticket', 'Can Resolve Ticket')]},
),
migrations.AlterModelOptions(
name='timesheet',
options={'ordering': ('-date', '-approved_at', 'staff__name'), 'permissions': [('can_approve_timesheet', 'Can Approve Timesheet')]},
),
]
6 changes: 6 additions & 0 deletions fahari/ops/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class Meta:
"staff",
"date",
)
permissions = [
("can_approve_timesheet", "Can Approve Timesheet"),
]


class FacilitySystem(AbstractBase):
Expand Down Expand Up @@ -151,6 +154,9 @@ class Meta:
"-raised",
"-resolved",
)
permissions = [
("can_resolve_ticket", "Can Resolve Ticket"),
]


class ActivityLog(AbstractBase):
Expand Down
18 changes: 18 additions & 0 deletions fahari/users/migrations/0009_alter_user_email.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.6 on 2021-08-11 17:54

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('users', '0008_user_phone'),
]

operations = [
migrations.AlterField(
model_name='user',
name='email',
field=models.EmailField(blank=True, max_length=254, verbose_name='email address'),
),
]

0 comments on commit 7afb8ad

Please sign in to comment.