-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Pancham1603/production
Production merge with hostel status view and improvements
- Loading branch information
Showing
34 changed files
with
881 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from django.contrib import admin | ||
from .models import Settings | ||
|
||
# Register your models here. | ||
admin.site.register(Settings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class GlobalSettingsConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'apps.global_settings' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 4.2.7 on 2023-12-11 22:17 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Settings', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('enable_hostel_timers', models.BooleanField(default=False)), | ||
('frontend_checkin_timer', models.IntegerField(blank=True, default=0, null=True)), | ||
('backend_checkin_timer', models.IntegerField(blank=True, default=0, null=True)), | ||
('last_entry_without_hostel_checkout', models.TimeField(blank=True, null=True)), | ||
('valid_entry_without_hostel_checkout', models.TimeField(blank=True, null=True)), | ||
], | ||
), | ||
] |
28 changes: 28 additions & 0 deletions
28
...l_settings/migrations/0002_settings_enable_gender_ratio_settings_female_ratio_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 4.2.7 on 2023-12-11 22:38 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('global_settings', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='settings', | ||
name='enable_gender_ratio', | ||
field=models.BooleanField(default=False), | ||
), | ||
migrations.AddField( | ||
model_name='settings', | ||
name='female_ratio', | ||
field=models.FloatField(blank=True, default=0.5, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='settings', | ||
name='male_ratio', | ||
field=models.FloatField(blank=True, default=0.5, null=True), | ||
), | ||
] |
22 changes: 22 additions & 0 deletions
22
apps/global_settings/migrations/0003_alter_settings_options_settings_max_violation_count.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 4.2.7 on 2023-12-13 01:37 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('global_settings', '0002_settings_enable_gender_ratio_settings_female_ratio_and_more'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='settings', | ||
options={'verbose_name_plural': 'Settings'}, | ||
), | ||
migrations.AddField( | ||
model_name='settings', | ||
name='max_violation_count', | ||
field=models.IntegerField(blank=True, default=3, null=True), | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from django.db import models | ||
|
||
class Settings(models.Model): | ||
|
||
enable_hostel_timers = models.BooleanField(default=False) | ||
frontend_checkin_timer = models.IntegerField(blank=True, null=True, default=0) | ||
backend_checkin_timer = models.IntegerField(blank=True, null=True, default=0) | ||
|
||
last_entry_without_hostel_checkout = models.TimeField(blank=True, null=True) | ||
valid_entry_without_hostel_checkout = models.TimeField(blank=True, null=True) | ||
|
||
enable_gender_ratio = models.BooleanField(default=False) | ||
male_ratio = models.FloatField(blank=True, null=True, default=0.5) | ||
female_ratio = models.FloatField(blank=True, null=True, default=0.5) | ||
|
||
max_violation_count = models.IntegerField(blank=True, null=True, default=3) | ||
|
||
class Meta: | ||
verbose_name_plural = 'Settings' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.shortcuts import render | ||
|
||
# Create your views here. |
23 changes: 23 additions & 0 deletions
23
apps/nightpass/migrations/0003_hostel_backend_checkin_timer_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated by Django 4.2.7 on 2023-12-11 22:17 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('nightpass', '0002_alter_campusresource_slots_booked'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='hostel', | ||
name='backend_checkin_timer', | ||
field=models.IntegerField(blank=True, default=0, null=True), | ||
), | ||
migrations.AddField( | ||
model_name='hostel', | ||
name='frontend_checkin_timer', | ||
field=models.IntegerField(blank=True, default=0, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var staticCacheName = 'thapar-nightpass'; | ||
|
||
self.addEventListener('install', function(event) { | ||
event.waitUntil( | ||
caches.open(staticCacheName).then(function(cache) { | ||
return cache.addAll([ | ||
'', | ||
]); | ||
}) | ||
); | ||
}); | ||
|
||
self.addEventListener('fetch', function(event) { | ||
var requestUrl = new URL(event.request.url); | ||
if (requestUrl.origin === location.origin) { | ||
if ((requestUrl.pathname === '/')) { | ||
event.respondWith(caches.match('')); | ||
return; | ||
} | ||
} | ||
event.respondWith( | ||
caches.match(event.request).then(function(response) { | ||
return response || fetch(event.request); | ||
}) | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Thapar NightPass</title> | ||
<script src="https://cdn.jsdelivr.net/npm/jsbarcode@3.11.6/dist/barcodes/JsBarcode.code128.min.js"></script> | ||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css"> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script> | ||
<link rel="stylesheet" href="../static/styles.css"> | ||
</head> | ||
<body> | ||
|
||
<div class="header"> | ||
<img class="header-logo" src="https://i.imgur.com/gnAYCgT.png" alt="College Logo"> | ||
<h1>Thapar NightPass</h1> | ||
<button class="logout-button" onclick="window.location.href = '/logout';">Logout</button> | ||
</div> | ||
{% block content %} | ||
{% endblock %} | ||
|
||
<footer> | ||
Made with ♥ by <a href="https://www.linkedin.com/in/pancham1603/" target="_blank" style="text-decoration: underline; color: white;">Pancham Agarwal</a> | ||
</footer> | ||
|
||
|
||
<script> | ||
toastr.options = { | ||
"closeButton": false, | ||
"newestOnTop": true, | ||
"progressBar": false, | ||
"positionClass": "toast-top-right", | ||
"preventDuplicates": true, | ||
"onclick": null, | ||
"showDuration": "300", | ||
"hideDuration": "1000", | ||
"timeOut": "3000", | ||
"extendedTimeOut": "1000", | ||
"showEasing": "swing", | ||
"hideEasing": "linear", | ||
"showMethod": "fadeIn", | ||
"hideMethod": "fadeOut" | ||
} | ||
</script> | ||
|
||
{% if messages %} | ||
{% for message in messages %} | ||
<script> | ||
toastr.info("{{ message }}") | ||
</script> | ||
{% endfor %} | ||
{% endif %} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{% extends 'base.html' %} | ||
|
||
{% block content %} | ||
<div class="table-container"> | ||
<div class="table-responsive"> | ||
<table class="custom-table"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Room No</th> | ||
<th>Status</th> | ||
<th>Action</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for pass in hostel_passes %} | ||
<tr> | ||
<td>{{ pass.user.student.name }}</td> | ||
<td>{{ pass.user.student.room_number }}</td> | ||
{% if pass.user.student.is_checked_in %} | ||
<td><span class="badge green">Checked In</span></td> | ||
{% else %} | ||
{% if pass %} | ||
{% if pass.check_in and not pass.check_out %} | ||
<td><span class="badge yellow">{{ pass.campus_resource }}</span></td> | ||
{% else %} | ||
<td><span class="badge red">Outside</span></td> | ||
{% endif %} | ||
{% else %} | ||
<td><span class="badge red">Outside</span></td> | ||
{% endif %} | ||
{% endif %} | ||
<td><a href="tel:{{ pass.user.student.contact_number }}"><button>Call</button></td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
|
||
</div> | ||
</div> | ||
{% endblock %} |
Oops, something went wrong.