summaryrefslogtreecommitdiff
path: root/templates/slot
diff options
context:
space:
mode:
authorttt2017-05-13 00:29:47 +0530
committerttt2017-05-13 00:29:47 +0530
commit4336f5f06f61de30ae3fa54650fce63a9d5ef5be (patch)
tree23b4ee9b8e8f24bf732acf2f7ad22ed50cdd5670 /templates/slot
downloadSBHS-2018-Rpi-4336f5f06f61de30ae3fa54650fce63a9d5ef5be.tar.gz
SBHS-2018-Rpi-4336f5f06f61de30ae3fa54650fce63a9d5ef5be.tar.bz2
SBHS-2018-Rpi-4336f5f06f61de30ae3fa54650fce63a9d5ef5be.zip
added all server files
Diffstat (limited to 'templates/slot')
-rw-r--r--templates/slot/index.html37
-rw-r--r--templates/slot/new.html72
-rw-r--r--templates/slot/show.html6
3 files changed, 115 insertions, 0 deletions
diff --git a/templates/slot/index.html b/templates/slot/index.html
new file mode 100644
index 0000000..1a25a1f
--- /dev/null
+++ b/templates/slot/index.html
@@ -0,0 +1,37 @@
+{% extends "layout.html" %}
+
+{% block content %}
+<div class="container">
+ <div class="row">
+ {% include "account/sub_nav.html" %}
+ <script>
+ document.getElementById("view-slot-nav").classList.add("active");
+ </script>
+ <div class="span12">
+ <h3>Your booked slots</h3>
+ <table class="table table-condensed">
+ <thead>
+ <tr>
+ <th>Date</th>
+ <th>Slot timings</th>
+ <th>Delete</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for b in bookings %}
+ <tr>
+ <td>{{ b.booking_date|date:"M d, Y" }}</td>
+ <td>{{ b.slot }}</td>
+ {% if now_time < b.start_time %}
+ <td><a class="btn btn-danger" href="{% url 'sbhs_server.slot.views.delete' b.id %}" onclick="return confirm('Are you sure you want to delete booking for slot {{b.slot}} ?');">Delete</a></td>
+ {% else %}
+ <td><a class="btn btn-disabled" disabled="disabled">Delete</a></td>
+ {% endif %}
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
+ </div>
+</div>
+{% endblock %} \ No newline at end of file
diff --git a/templates/slot/new.html b/templates/slot/new.html
new file mode 100644
index 0000000..c0a8b21
--- /dev/null
+++ b/templates/slot/new.html
@@ -0,0 +1,72 @@
+{% extends "layout.html" %}
+{% load staticfiles %}
+
+{% block headerfiles %}
+<script src="{% static "js/bootstrap-datepicker.js" %}"></script>
+<link rel="stylesheet" href="{% static "css/datepicker.css" %}">
+{% endblock %}
+
+{% block content %}
+<div class="container">
+ <div class="row">
+ {% include "account/sub_nav.html" %}
+ <script>
+ document.getElementById("book-slot-nav").classList.add("active");
+ </script>
+ <div class="span12">
+ <h3>Book slot</h3>
+ {% if cur_slots|length > 0 %}
+ <h4>Current slot {{ cur_slots.0 }} is vacant</h4>
+ <form action="{% url 'sbhs_server.slot.views.create' %}" method="POST">
+ {% csrf_token %}
+ <input type="hidden" name="slot" value="{{ cur_slots.0.id }}">
+ <input type="hidden" name="date" value="CURRENT">
+ <input type="submit" value="Book now" class="btn btn-primary">
+ </form>
+ {% endif %}
+ <br><br>
+ <h4>Book future slots</h4>
+ <form action="{% url 'sbhs_server.slot.views.create' %}" method="POST">
+ {% csrf_token %}
+ <label for="date">Booking date</label> <br>
+ <div class="input-append date" id="dp1" data-date="{{ nowdate }}" data-date-format="yyyy-mm-dd">
+ <input name="date" id="date" class="span2" size="16" type="text" value="{{ nowdate }}" readonly>
+ <span class="add-on"><i class="icon-calendar"></i></span>
+ </div>
+ <div id="slotTimingWrap">
+ <label for="slot">Free slot timings</label>
+ <select name="slot" id="slot">
+ {% for s in all_slots %}
+ <option value="{{ s.id }}">{{ s }}</option>
+ {% endfor %}
+ </select>
+ </div>
+ <br>
+ <input type="submit" value="Book this slot" class="btn">
+ </form>
+ </div>
+ </div>
+</div>
+<script>
+(function(){
+ $("#date").val("{{ nowdate }}");
+ var nowTemp = new Date();
+ var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);
+
+ var DP1 = $('#dp1').datepicker({
+ onRender: function(date) {
+ return date.valueOf() < now.valueOf() ? 'disabled' : '';
+ }
+ }).on('changeDate', function(ev) {
+ var newDate = new Date(ev.date);
+ var string = newDate.getFullYear() + "-" + (newDate.getMonth() + 1) + "-" + newDate.getDate();
+ $.ajax({
+ url: "{% url 'sbhs_server.slot.views.show' '' %}" + string,
+ success: function(msg) {
+ $("#slotTimingWrap").html(msg);
+ }
+ })
+ }).data('datepicker');
+})();
+</script>
+{% endblock %} \ No newline at end of file
diff --git a/templates/slot/show.html b/templates/slot/show.html
new file mode 100644
index 0000000..1777e31
--- /dev/null
+++ b/templates/slot/show.html
@@ -0,0 +1,6 @@
+<label for="future_slot">Free slot timings</label>
+<select name="slot" id="future_slot">
+{% for s in all_slots %}
+ <option value="{{ s.id }}">{{ s }}</option>
+{% endfor %}
+</select> \ No newline at end of file