From 4cb7ce0b6769fd57bde5927fc65b8ebbcea71c06 Mon Sep 17 00:00:00 2001 From: Divyansh Khetan Date: Tue, 11 Apr 2023 15:42:04 +0530 Subject: [PATCH 1/2] fixed the ambulance use cases --- .../migrations/0003_merge_20230411_1341.py | 14 +++++++++++ .../migrations/0004_auto_20230411_1342.py | 18 ++++++++++++++ .../applications/health_center/models.py | 2 +- .../templates/phcModule/appointment.html | 24 +++++++++---------- 4 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 FusionIIIT/applications/health_center/migrations/0003_merge_20230411_1341.py create mode 100644 FusionIIIT/applications/health_center/migrations/0004_auto_20230411_1342.py diff --git a/FusionIIIT/applications/health_center/migrations/0003_merge_20230411_1341.py b/FusionIIIT/applications/health_center/migrations/0003_merge_20230411_1341.py new file mode 100644 index 000000000..ec86d32d1 --- /dev/null +++ b/FusionIIIT/applications/health_center/migrations/0003_merge_20230411_1341.py @@ -0,0 +1,14 @@ +# Generated by Django 3.1.5 on 2023-04-11 13:41 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('health_center', '0002_auto_20230406_1140'), + ('health_center', '0002_doctor_contact_no'), + ] + + operations = [ + ] diff --git a/FusionIIIT/applications/health_center/migrations/0004_auto_20230411_1342.py b/FusionIIIT/applications/health_center/migrations/0004_auto_20230411_1342.py new file mode 100644 index 000000000..5b9429da9 --- /dev/null +++ b/FusionIIIT/applications/health_center/migrations/0004_auto_20230411_1342.py @@ -0,0 +1,18 @@ +# Generated by Django 3.1.5 on 2023-04-11 13:42 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('health_center', '0003_merge_20230411_1341'), + ] + + operations = [ + migrations.AlterField( + model_name='ambulance_request', + name='reason', + field=models.CharField(max_length=500), + ), + ] diff --git a/FusionIIIT/applications/health_center/models.py b/FusionIIIT/applications/health_center/models.py index 81fa3402f..3cd945d43 100644 --- a/FusionIIIT/applications/health_center/models.py +++ b/FusionIIIT/applications/health_center/models.py @@ -158,7 +158,7 @@ class Ambulance_request(models.Model): date_request = models.DateTimeField() start_date = models.DateField() end_date = models.DateField(null=True, blank=True) - reason = models.CharField(max_length=50) + reason = models.CharField(max_length=500) class Hospital_admit(models.Model): user_id = models.ForeignKey(ExtraInfo,on_delete=models.CASCADE) diff --git a/FusionIIIT/templates/phcModule/appointment.html b/FusionIIIT/templates/phcModule/appointment.html index e0a9a52d5..53c803622 100755 --- a/FusionIIIT/templates/phcModule/appointment.html +++ b/FusionIIIT/templates/phcModule/appointment.html @@ -144,7 +144,7 @@ $('#inputdate1').attr('min', maxDate); }); -

+
@@ -163,21 +163,21 @@ $('#inputdate2').attr('min', maxDate); }); -

+
-

+
- +
@@ -190,12 +190,12 @@ $('#amb_submit').click(function(e) { - var startDate = document.getElementById('start_date').value; - var endDate = document.getElementById('end_date').value; + var startDate = document.getElementById('inputdate1').value; + var endDate = document.getElementById('inputdate2').value; var start = new Date(startDate); var end=new Date(endDate); var today = new Date(new Date().setHours(0, 0, 0, 0)); - + console.log("Was here:::") $('#stdt').html(''); $('#endt').html(''); @@ -216,23 +216,21 @@ $('#reas').html('*Please fill out the details!'); document.getElementById("reason").focus(); } - + else{ + console.log("Requesting ambulance..."); $.ajax({ type:'post', url:'/healthcenter/student/', data: { csrfmiddlewaretoken: '{{ csrf_token }}', - start_date:$("#start_date").val(), - end_date:$("#end_date").val(), + start_date:$("#inputdate1").val(), + end_date:$("#inputdate2").val(), reason:$("#reason").val(), amb_submit:$("#amb_submit").val() }, success: function(data){ alert("Ambulance requested."); - document.getElementById("start_date").value=""; - document.getElementById("end_date").value=""; - document.getElementById("reason").value=""; window.location.reload(); $('#reas').html(''); From 9b3190dd3c61d2cb3e64411d899738dfb75c8d03 Mon Sep 17 00:00:00 2001 From: Divyansh Khetan Date: Sun, 16 Apr 2023 04:24:24 +0530 Subject: [PATCH 2/2] model fixes and removed some comments --- .../health_center/migrations/0004_auto_20230411_1342.py | 2 +- FusionIIIT/applications/health_center/models.py | 2 +- FusionIIIT/templates/phcModule/appointment.html | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/FusionIIIT/applications/health_center/migrations/0004_auto_20230411_1342.py b/FusionIIIT/applications/health_center/migrations/0004_auto_20230411_1342.py index 5b9429da9..579fb2744 100644 --- a/FusionIIIT/applications/health_center/migrations/0004_auto_20230411_1342.py +++ b/FusionIIIT/applications/health_center/migrations/0004_auto_20230411_1342.py @@ -13,6 +13,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='ambulance_request', name='reason', - field=models.CharField(max_length=500), + field=models.CharField(max_length=255), ), ] diff --git a/FusionIIIT/applications/health_center/models.py b/FusionIIIT/applications/health_center/models.py index 3cd945d43..63fc3a261 100644 --- a/FusionIIIT/applications/health_center/models.py +++ b/FusionIIIT/applications/health_center/models.py @@ -158,7 +158,7 @@ class Ambulance_request(models.Model): date_request = models.DateTimeField() start_date = models.DateField() end_date = models.DateField(null=True, blank=True) - reason = models.CharField(max_length=500) + reason = models.CharField(max_length=255) class Hospital_admit(models.Model): user_id = models.ForeignKey(ExtraInfo,on_delete=models.CASCADE) diff --git a/FusionIIIT/templates/phcModule/appointment.html b/FusionIIIT/templates/phcModule/appointment.html index 53c803622..37bf2c5d3 100755 --- a/FusionIIIT/templates/phcModule/appointment.html +++ b/FusionIIIT/templates/phcModule/appointment.html @@ -144,7 +144,6 @@ $('#inputdate1').attr('min', maxDate); }); -
@@ -163,14 +162,12 @@ $('#inputdate2').attr('min', maxDate); }); -
-
@@ -195,7 +192,6 @@ var start = new Date(startDate); var end=new Date(endDate); var today = new Date(new Date().setHours(0, 0, 0, 0)); - console.log("Was here:::") $('#stdt').html(''); $('#endt').html(''); @@ -218,7 +214,6 @@ } else{ - console.log("Requesting ambulance..."); $.ajax({ type:'post', url:'/healthcenter/student/',