Skip to content

Commit

Permalink
Spons logo issue resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
varshaan committed Dec 20, 2012
1 parent 3b0dae0 commit 798ce5e
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 11 deletions.
40 changes: 40 additions & 0 deletions controlroom/ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
from dajax.core import Dajax
from django.utils import simplejson
from django.template import loader, Context, RequestContext, Template
from users.models import UserProfile
from controlroom.models import *
from controlroom.forms import *
from dajaxice.decorators import dajaxice_register
from django.core.cache import cache
from django.contrib.sitemaps import ping_google
from operator import attrgetter
from datetime import datetime

@dajaxice_register
def save_individual_checkin(request,form):
Expand Down Expand Up @@ -44,3 +46,41 @@ def save_individual_checkout(request,form,shaastraid):
dajax.alert(msg)
return dajax.json()

@dajaxice_register
def send_participants(request,form):
dajax = Dajax()
try:
for s_id in form['sub_checklist']:
profile = UserProfile.objects.get(shaastra_id = s_id)
rm = form['room']
new_guest = IndividualCheckIn(room__id = rm,
shaastra_ID = s_id,
first_name = profile.user.first_name,
last_name = profile.user.last_name,
phone_no = profile.mobile_number,
check_in_control_room = form['checkin'],
comments = form['comments'],
)
new_guest.save()
room = AvailableRooms.objects.get(id = rm)
room.already_checkedin = room.already_checkedin + 1
room.save()
msg = "Checked In successfully!"
except:
s_id = form['sub_checklist']
profile = UserProfile.objects.get(shaastra_id = s_id)
rm = form['room']
#new = IndividualCheckIn.objects.get(check_in_control_room = form['checkin'])
#print rm
#print new.shaastra_ID
#print "Hello"
new = IndividualCheckIn(room__id=rm, shaastra_ID=s_id, first_name=profile.user.first_name, last_name=profile.user.last_name, phone_no=profile.mobile_number, check_in_control_room=form['checkin'], comments = form['comments'] )
#print "Hello"
new.save()
print "Hello"
room = AvailableRooms.objects.get(id = rm)
room.already_checkedin = room.already_checkedin + 1
room.save()
msg = "Checked In successfully!"
dajax.alert(msg)
return dajax.json
10 changes: 8 additions & 2 deletions controlroom/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ class IndividualCheckIn(models.Model):
first_name = models.CharField(max_length = 50)
last_name = models.CharField(max_length = 50)
phone_no = models.CharField(max_length = 15)
check_in_control_room = models.CharField(max_length = 20,choices = HOSTEL_CHOICES)
check_in_control_room = models.CharField(max_length = 20,choices = HOSTEL_CHOICES,blank=True)
check_out_control_room = models.CharField(max_length = 20,choices = HOSTEL_CHOICES, blank = True)
check_in_date = models.DateTimeField(default = datetime.now)
check_in_date = models.DateTimeField(default = datetime.now,blank = True)
check_out_date = models.DateTimeField(null = True, blank=True)
comments = models.CharField(max_length = 1000, blank=True)

def __unicode__(self):
return self.first_name

class Admin:
pass

2 changes: 2 additions & 0 deletions controlroom/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ def team(request):
if request.user.get_profile().is_hospi is False:
return HttpResponseRedirect(settings.SITE_URL)
msg = "Enter Shaastra ID of Team leader"
rooms = AvailableRooms.objects.all().order_by('hostel')
hostels = HOSTEL_CHOICES
if request.method == 'POST':
form = ShaastraIDForm(request.POST)
if form.is_valid():
Expand Down
1 change: 0 additions & 1 deletion core/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class Meta:
'team_size_max',
'begin_registration',
'has_tdp',
'sponsor_logo',
)
widgets = {'lock_status': forms.HiddenInput(),
'unlock_reason': forms.HiddenInput(),
Expand Down
51 changes: 45 additions & 6 deletions templates/controlroom/team.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% load dajaxice_templatetags %}
<html>
<head>
<title>Shaastra 2013 Control Room</title>
{% dajaxice_js_import %}
<link rel="stylesheet" type="text/css" href="{{site_url}}static/css/stylemain.css" />
<style type="text/css">
body{background:rgb(240,240,240);}
Expand All @@ -9,17 +11,38 @@
label{font-size:15px;}
span.helptext{font-size:12px;font-style: italic;}
</style>
<script language = 'JavaScript' type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" charset = "utf-8"></script>
<script language = 'JavaScript' type="text/javascript" src="{{site_url}}static/js/jquery.dajax.core.js" charset = "utf-8"></script>
<script language = 'JavaScript' type="text/javascript" src="{{site_url}}static/js/jquery.ba-serializeobject.min.js" charset = "utf-8"></script>
<script type="text/javascript" charset = "utf-8">
function send_participants(){
data = $('#Form').serializeObject();
if(data.room=='0'){alert('Please select a room');return false;}
if(data.checkin=='0'){alert('Please select a check-in control room');return false;}
if(!data.sub_checklist){alert('Select a participant!');return false;}
$(".bbq-item").prepend("Processing please wait..<br><img src='{{site_url}}static/img/loading.gif'>");
Dajaxice.controlroom.send_participants(Dajax.process,{'form':data})
return false;
}
function toggleChecked(status){
$(".checkbox").each( function(){
$(this).attr("checked", status);
})
}

</script>
</head>
<body>
<div class="container">
<a class="btn btn-large btn-danger" href='{{site_url}}controlroom/home/'>Home</a>
<h2>Team Check In</h2><br>
<div class="TeamCheckIn">
<form id="TeamForm" action="" method="post">
<form id="Form" action="" method="post">
{% csrf_token %}
<table id = "TeamForm" class="table table-striped table-bordered table-condensed">
<thead>
<tr>

<th><input type="checkbox" value="toggle" id="toggle" onclick="toggleChecked(this.checked);"/></th>
<th width='120'>Shaastra ID</th>
<th width='120'>First Name</th>
<th width='120'>Last Name</th>
Expand All @@ -31,12 +54,13 @@ <h2>Team Check In</h2><br>
<th width='120'>Check In Date</th>
<th width='120'>Check Out Date</th>
<th width='120'>Comments</th>
<th width='120'></th>
<!--<th width='120'></th>-->
</thead>
<tbody>

{% for m in checkedin_profiles %}
<tr>
<td><input type="checkbox" name="sub_checklist" class="checkbox" value="{{m.shaastra_ID|safe}}" /></td>
<td width ='120'>{{m.shaastra_ID}}</td>
<td width ='120'>{{m.first_name}}</td>
<td width ='120'>{{m.last_name}}</td>
Expand All @@ -48,12 +72,13 @@ <h2>Team Check In</h2><br>
<td width ='120'>{{m.check_in_date}}</td>
<td width ='120'>{{m.check_out_date}}</td>
<td width ='120'>{{m.comments}}</td>
<td width ='120'></td>
<!--<td width ='120'></td>-->
</tr>
{% endfor %}

{% for m in new_profiles %}
<tr>
<td><input type="checkbox" name="sub_checklist" class="checkbox" value="{{m.shaastra_id|safe}}" /></td>
<td width ='120'>{{m.shaastra_id}}</td>
<td width ='120'>{{m.user.first_name}}</td>
<td width ='120'>{{m.user.last_name}}</td>
Expand All @@ -65,15 +90,29 @@ <h2>Team Check In</h2><br>
<td width ='120'></td>
<td width ='120'></td>
<td width ='120'></td>
<td width ='120'><a target ="_blank" href = "{{site_url}}controlroom/checkin/{{m.shaastra_id}}" class="btn btn-primary">Check In</a></td>
<!--<td width ='120'><a target ="_blank" href = "{{site_url}}controlroom/checkin/{{m.shaastra_id}}" class="btn btn-primary">Check In</a></td>-->

</tr>
{% endfor %}

</tbody>
</table>
</div>
<a class="btn btn-large btn-danger" href='{{site_url}}controlroom/home/'>Home</a>
<select id="room" name="room">
<option selected="selected" value="0">---------</option>
{% for r in rooms %}
<option value={{r.id|safe}}>{{r}}</option>
{% endfor %}
</select><br>
<select id="checkin" name="checkin">
<option selected="selected" value="0">---------</option>
{% for h in hostels %}
<option value={{h|cut:"("|cut:"'"|cut:","|safe}}>{{h}}</option>
{% endfor %}
</select><br>
<label>Comments</label><textarea id="comments" name="comments"></textarea>
<input type="button" onclick="send_participants();" value="Allot Room" class="btn btn-info"><br><br>
</form>
</div>

</body>
Expand Down
4 changes: 2 additions & 2 deletions templates/events/events.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
{% endfor %}
</div>
</div>
{% if event.sponsor_logo %}
<div id="sponslogo"><img src="{{event.sponsor_logo}}" id="sponslogoimg" /></div>
{% if event.events_logo %}
<div id="sponslogo"><img src="{{event.events_logo}}" id="sponslogoimg" /></div>
{% endif %}
<div id="updates">
<div id="textbox2">
Expand Down

0 comments on commit 798ce5e

Please sign in to comment.