Created
September 8, 2013 23:00
-
-
Save csalajan/6489319 to your computer and use it in GitHub Desktop.
wtf
This file contains hidden or 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
function payroll_table(data, s_date) { | |
var html = '<table class="table table-striped table-bordered tablesorter" cellspacing="0" cellpadding="0" id="payrollTable">\ | |
<thead>\ | |
<tr>\ | |
<th width="175px">Employee</th>\ | |
<th colspan="7"></th>\ | |
</tr>\ | |
</thead>\ | |
<tbody>'; | |
for (i in data) { | |
html += '<tr>\ | |
<td>' + data[i].user.first_name + ' ' + data[i].user.last_name + '</td>\ | |
<td colspan="7">\ | |
<table class="table table-striped" id="payroll_dates">\ | |
<thead>\ | |
<tr>\ | |
<th width="6.5%"></th>\ | |
<th width="13.35%">Sat</th>\ | |
<th width="13.35%">Sun</th>\ | |
<th width="13.35%">Mon</th>\ | |
<th width="13.35%">Tue</th>\ | |
<th width="13.35%">Wed</th>\ | |
<th width="13.35%">Thur</th>\ | |
<th width="13.35%">Fri</th>\ | |
</tr>\ | |
</thead>\ | |
<tbody>\ | |
<tr>\ | |
<td>Week 1</td>'; | |
var events = data[i].events; | |
var y = 7; | |
var day = s_date; | |
while (y--) { | |
html += '<td>'; | |
for (x in events) { | |
var date = day.getFullYear() + '-' + ('0' + parseInt(day.getMonth() + 1)).slice(-2) + '-' + ('0' + day.getDate()).slice(-2); | |
console.log(date); | |
if (events[x].start_date == date) { | |
if (events[x].clocked_in != true) { | |
html += '<span class="highlight">'; | |
} else { | |
html += '<span>'; | |
} | |
//html += start_time['0'] + ':' + start_time['1'] + ' ' + stime + ' - ' + end['0'] + ':' + end['1'] + ' ' + etime + '</span><br />'; | |
html += events[x].start + ' - ' + events[x].end + '<br />'; | |
} | |
} | |
day.setDate(day.getDate()+1); | |
html += '</td>'; | |
} | |
html += '</tr><tr><td>Week 2</td>'; | |
y = 7; | |
while (y--) { | |
html += '<td>'; | |
for (x in events) { | |
var date = day.getFullYear() + '-' + ('0' + parseInt(day.getMonth() + 1)).slice(-2) + '-' + ('0' + day.getDate()).slice(-2); | |
if (events[x].start_date == date) { | |
if (events[x].clocked_in != true) { | |
html += '<span class="highlight">'; | |
} else { | |
html += '<span>'; | |
} | |
//html += start_time['0'] + ':' + start_time['1'] + ' ' + stime + ' - ' + end['0'] + ':' + end['1'] + ' ' + etime + '</span><br />'; | |
html += events[x].start + ' - ' + events[x].end + '<br />'; | |
} | |
} | |
day.setDate(day.getDate()+1); | |
html += '</td>'; | |
} | |
html += '</tr></table></td></tr>'; | |
console.log(s_date); | |
} | |
html += '</tbody><tfoot></tfoot></table>'; | |
return html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment