Skip to content

Commit

Permalink
added all pages related task
Browse files Browse the repository at this point in the history
  • Loading branch information
anurag6569201 committed Jul 28, 2024
1 parent 24d4dfb commit 6a2d532
Show file tree
Hide file tree
Showing 27 changed files with 515 additions and 32 deletions.
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
GOOGLE_API_KEY=AIzaSyAh5HbTtCHsO_ZWAtCtn_q5h2_Jw7tEfe8
HUGGING_FACE_API_KEY=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

SMS_ACCOUNT_SSID_API_KEY=AC954136eee66cc8ba187c7722f5840d13
SMS_ACCOUNT_AUTH_API_KEY=d1501d7b07f1625cce8b4c46c1d5a8f1
SMS_FROM_NUMBER=+12085516281
Binary file modified core/__pycache__/admin.cpython-312.pyc
Binary file not shown.
Binary file modified core/__pycache__/forms.cpython-312.pyc
Binary file not shown.
Binary file modified core/__pycache__/models.cpython-312.pyc
Binary file not shown.
Binary file modified core/__pycache__/urls.cpython-312.pyc
Binary file not shown.
Binary file modified core/__pycache__/views.cpython-312.pyc
Binary file not shown.
24 changes: 22 additions & 2 deletions core/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.contrib import admin
from .models import Problem,BedsInventory,O2Inventory,Ambulance,StaffMember
from .models import Problem,BedsInventory,O2Inventory,Ambulance,StaffMember,Labor,Attendance,Task,TaskAssignment
from import_export.admin import ImportExportModelAdmin


Expand All @@ -21,4 +21,24 @@ class AmbuAdmin(ImportExportModelAdmin):

class StaffAdmin(ImportExportModelAdmin):
list_display=['name','role','department']
admin.site.register(StaffMember,StaffAdmin)
admin.site.register(StaffMember,StaffAdmin)


# workforce admin
class labourAdmin(ImportExportModelAdmin):
list_display=['name']
admin.site.register(Labor,labourAdmin)

class AttendenceAdmin(ImportExportModelAdmin):
list_display=['labor','date','status']
admin.site.register(Attendance,AttendenceAdmin)


# task assignment admin
class TaskAdmin(ImportExportModelAdmin):
list_display=['title','description']
admin.site.register(Task,TaskAdmin)

class TaskAssignAdmin(ImportExportModelAdmin):
list_display=['labor','status']
admin.site.register(TaskAssignment,TaskAssignAdmin)
20 changes: 19 additions & 1 deletion core/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .models import Problem
from django import forms
from .models import BedsInventory, Ambulance, StaffMember, O2Inventory
from .models import BedsInventory, Ambulance, StaffMember, O2Inventory,TaskAssignment

class ProblemForm(forms.ModelForm):
class Meta:
Expand Down Expand Up @@ -31,3 +31,21 @@ class O2InventoryForm(forms.ModelForm):
class Meta:
model = O2Inventory
fields = '__all__'


# attendence form
from .models import Attendance

class AttendanceForm(forms.ModelForm):
class Meta:
model = Attendance
fields = ['labor', 'status']

# assignment list
class TaskAssignmentForm(forms.ModelForm):
class Meta:
model = TaskAssignment
fields = ['labor', 'task', 'date_assigned', 'status']
widgets = {
'date_assigned': forms.DateInput(attrs={'type': 'date'}),
}
30 changes: 30 additions & 0 deletions core/migrations/0004_labor_attendance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Generated by Django 5.0.7 on 2024-07-28 02:21

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0003_ambulance_bedsinventory_o2inventory_staffmember'),
]

operations = [
migrations.CreateModel(
name='Labor',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
],
),
migrations.CreateModel(
name='Attendance',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateField()),
('status', models.CharField(choices=[('Present', 'Present'), ('Absent', 'Absent')], max_length=10)),
('labor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.labor')),
],
),
]
32 changes: 32 additions & 0 deletions core/migrations/0005_task_taskassignment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 5.0.7 on 2024-07-28 03:21

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0004_labor_attendance'),
]

operations = [
migrations.CreateModel(
name='Task',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=100)),
('description', models.TextField()),
],
),
migrations.CreateModel(
name='TaskAssignment',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date_assigned', models.DateField()),
('status', models.CharField(max_length=10)),
('labor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.labor')),
('task', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.task')),
],
),
]
18 changes: 18 additions & 0 deletions core/migrations/0006_alter_task_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.7 on 2024-07-28 03:54

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0005_task_taskassignment'),
]

operations = [
migrations.AlterField(
model_name='task',
name='description',
field=models.CharField(choices=[('Sewage & Drainage', 'Sewage & Drainage'), ('Waste Management', 'Waste Management'), ('Public Transport', 'Public Transport'), ('Public Health Services', 'Public Health Services'), ('Education and Cultural', 'Education and Cultral'), ('Services', 'Services'), ('Water Treatment and Supplies', 'Water Treatment and Supplies')], max_length=60),
),
]
Binary file not shown.
Binary file not shown.
Binary file not shown.
37 changes: 36 additions & 1 deletion core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,39 @@ class StaffMember(models.Model):
last_updated = models.DateField()

def __str__(self):
return f"ID: {self.id} - Name: {self.name} - Role: {self.role}"
return f"ID: {self.id} - Name: {self.name} - Role: {self.role}"


# attendence systems

class Labor(models.Model):
name = models.CharField(max_length=255)

def __str__(self):
return self.name

class Attendance(models.Model):
labor = models.ForeignKey(Labor, on_delete=models.CASCADE)
date = models.DateField()
status = models.CharField(max_length=10, choices=[('Present', 'Present'), ('Absent', 'Absent')])

def __str__(self):
return f'{self.labor} - {self.date} - {self.status}'


# task assign
class Task(models.Model):
title = models.CharField(max_length=100)
description = models.CharField(max_length=60, choices=Problem.PROBLEM_TYPE_CHOICES)

def __str__(self):
return self.title

class TaskAssignment(models.Model):
labor = models.ForeignKey(Labor, on_delete=models.CASCADE)
task = models.ForeignKey(Task, on_delete=models.CASCADE)
date_assigned = models.DateField()
status = models.CharField(max_length=10) # e.g., 'Completed', 'Pending'

def __str__(self):
return f'{self.labor.name} - {self.task.title} - {self.date_assigned} - {self.status}'
54 changes: 54 additions & 0 deletions core/static/core/image/workforce.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions core/templates/core/app/add_workforce.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{% extends 'maintain/partial/base.html' %}
{% load static %}
{% block index %}

<div class="container">
<div class="col-md-12">
<div style="display: flex;align-items: center;justify-content: center;height: 70vh;">
<form method="post" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
{% csrf_token %}
<h2>Add Labor</h2>
<img style="width: 10em;" src="../../../static/core/image/workforce.svg" alt="">
<input style="width: 100%;border: 1px solid grey; background-color: transparent;padding: 5px 10px;border-radius: 5px;margin-bottom: 10px;" type="text" name="name" placeholder="Enter labor name" required>
<button class="add_vehicle" type="submit">Add Labor</button>
</form>
</div>
</div>
</div>

{% endblock index %}
30 changes: 30 additions & 0 deletions core/templates/core/app/assign_task.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% extends 'core/partial/base.html' %}
{% load static %}

{% block index %}
<style>
#id_date_assigned,
#id_status,
#id_task,
#id_labor{
width: 100%;
border: 1px solid grey;
background-color: transparent;
padding: 5px 10px;
border-radius: 5px;
margin-bottom: 10px;
margin-top: 10px;
}
</style>
<div class="container">
<div class="col-md-12" style="min-height: 70vh;">
<h1>Assign Task</h1>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button class="add_vehicle" type="submit">Assign Task</button>
</form>
</div>
</div>

{% endblock index %}
27 changes: 27 additions & 0 deletions core/templates/core/app/mark_attendance.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% extends 'maintain/partial/base.html' %}
{% load static %}
{% block index %}
<style>
#id_status,
#id_labor{
width: 100%;
border: 1px solid grey;
background-color: transparent;
padding: 5px 10px;
border-radius: 5px;
margin-bottom: 10px;
margin-top: 10px;
}
</style>
<div class="container" style="min-height: 70vh;">
<div class="col-md-12">
<h2>Mark Attendance</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button class="add_vehicle" type="submit">Submit</button>
</form>
</div>
</div>

{% endblock index %}
Loading

0 comments on commit 6a2d532

Please sign in to comment.