parent
6897e97217
commit
414a99720e
@ -0,0 +1,106 @@ |
||||
<header id="cm-header"> |
||||
<!-- Topbar --> |
||||
<div class="container"> |
||||
<div class="row"> |
||||
<div class="col-xs-12 col-md-3"> |
||||
<div class="logo"> |
||||
<a href="<?php echo api_get_path(WEB_PATH); ?>"><?php echo return_logo(); ?></a>
|
||||
</div> |
||||
</div> |
||||
<div class="col-xs-12 col-md-9"> |
||||
<div class="row"> |
||||
<div class="col-sm-4"> |
||||
</div> |
||||
<div class="col-sm-3"> |
||||
</div> |
||||
<div class="col-sm-5"> |
||||
<ol class="header-ol"> |
||||
<?php echo returnNotificationMenu(); ?> |
||||
</ol> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<!-- Fixed navbar --> |
||||
<nav class="navbar navbar-default"></nav> |
||||
<div class="nav-tools"> |
||||
|
||||
</div> |
||||
</header> |
||||
|
||||
<div class="container-fluid"> |
||||
|
||||
<h2><?php echo Display::page_header(get_lang('AttendanceSheetReport')); ?></h2>
|
||||
|
||||
<h3><?php echo $attendanceName; ?> <span class="label label-default"><?php echo $attendanceCalendar['date']; ?></span></h3>
|
||||
|
||||
<div class="well mt-2"><?php echo get_lang('Trainer').' : '.$trainer; ?></div>
|
||||
|
||||
<?php if (!empty($users_in_course)) { ?> |
||||
|
||||
<div class="input-group"> |
||||
<input type="text" id="search-user" onkeyup="searchUser()" placeholder="<?php echo get_lang('SearchUser'); ?>">
|
||||
</div> |
||||
|
||||
<form method="post" action="index.php?action=attendance_sheet_add&<?php echo api_get_cidreq().$param_filter; ?>&attendance_id=<?php echo $attendance_id; ?>" >
|
||||
|
||||
<table id="table-user-calendar" class="table table-hover"> |
||||
<thead> |
||||
<tr> |
||||
<th></th> |
||||
<th></th> |
||||
<th></th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<?php foreach ($users_in_course as $user) { |
||||
$attendance = new Attendance(); |
||||
$signature = $attendance->getSignature($user['user_id'], $calendarId); |
||||
$signed = !empty($signature); ?> |
||||
<tr> |
||||
<td> |
||||
<?php |
||||
if ($signed) { |
||||
echo Display::return_icon('checkbox_on.png', get_lang('Presence'), null, ICON_SIZE_TINY); |
||||
} else { |
||||
echo Display::return_icon('checkbox_off.png', get_lang('Presence'), null, ICON_SIZE_TINY); |
||||
} ?> |
||||
</td> |
||||
<td><?php echo api_get_person_name($user['firstname'], $user['lastname']); ?></td>
|
||||
<td> |
||||
|
||||
<?php |
||||
|
||||
if ($signed) { |
||||
echo '<div class="list-data"> |
||||
<span class="item"></span> |
||||
<a id="sign-'.$user['user_id'].'-'.$calendarId.'" class="btn btn-primary attendance-sign-view" href="javascript:void(0)"> |
||||
<em class="fa fa-search"></em> '.get_lang('SignView').' |
||||
</a> |
||||
</div>'; |
||||
} else { |
||||
echo '<input type="hidden" name="check_presence['.$calendarId.'][]" value="'.$user['user_id'].'" />'; |
||||
echo '<div class="list-data"> |
||||
<span class="item"></span> |
||||
<a id="sign-'.$user['user_id'].'-'.$calendarId.'" class="btn btn-primary attendance-sign" href="javascript:void(0)"> |
||||
<em class="fa fa-pencil"></em> '.get_lang('Sign').' |
||||
</a> |
||||
</div>'; |
||||
} ?> |
||||
|
||||
</td> |
||||
</tr> |
||||
<?php |
||||
} ?> |
||||
</tbody> |
||||
</table> |
||||
|
||||
</form> |
||||
<?php } ?> |
||||
|
||||
</div> |
||||
<?php |
||||
if ($allowSignature) { |
||||
include_once 'attendance_signature.inc.php'; |
||||
} |
||||
@ -0,0 +1,165 @@ |
||||
<div id="sign_popup" style="display: none"> |
||||
<div id="signature_area" class="well"> |
||||
<canvas width="400px"></canvas> |
||||
</div> |
||||
<span id="save_controls"> |
||||
<button id="sign_popup_save" class="btn btn-primary" type="submit"> |
||||
<em class="fa fa-save"></em> <?php echo get_lang('Save'); ?> |
||||
</button> |
||||
<button id="sign_popup_clean" class="btn btn-default" type="submit"> |
||||
<em class="fa fa-eraser"></em> <?php echo get_lang('Clean'); ?> |
||||
</button> |
||||
</span> |
||||
<span id="remove_controls" clase="hidden"> |
||||
<button id="sign_popup_remove" class="btn btn-danger" type="submit"> |
||||
<em class="fa fa-remove"></em> <?php echo get_lang('Remove'); ?> |
||||
</button> |
||||
</span> |
||||
<span id="close_controls" style="display: none"> |
||||
<span id="sign_results"></span> |
||||
<hr /> |
||||
<button id="sign_popup_close" class="btn btn-default" type="submit"> |
||||
<?php echo get_lang('Close'); ?> |
||||
</button> |
||||
</span> |
||||
<span class="loading" style="display: none"><em class="fa fa-spinner"></em></span> |
||||
<input type="hidden" id="sign-selected" /> |
||||
</div> |
||||
|
||||
<script> |
||||
var imageFormat = 'image/png'; |
||||
var canvas = document.querySelector("#signature_area canvas"); |
||||
var signaturePad = new SignaturePad(canvas); |
||||
var urlAjax = "<?php echo api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php?'.api_get_cidreq(); ?>";
|
||||
var attendance_id = "<?php echo $attendance_id; ?>";
|
||||
|
||||
$(function() { |
||||
$("#sign_popup_close").on("click", function() { |
||||
$("#sign_popup").dialog("close"); |
||||
$('#loading').hide(); |
||||
$('#save_controls').show(); |
||||
$('#close_controls').hide(); |
||||
$('#signature_area').show(); |
||||
}); |
||||
|
||||
$("#sign_popup_clean").on("click", function() { |
||||
signaturePad.clear(); |
||||
}); |
||||
|
||||
$("#sign_popup_remove").on("click", function() { |
||||
var selected = $("#sign-selected").val(); |
||||
$.ajax({ |
||||
beforeSend: function(result) { |
||||
$('#loading').show(); |
||||
}, |
||||
type: "POST", |
||||
url: urlAjax, |
||||
data: "a=remove_attendance_sign&selected="+selected+"&attendance_id="+attendance_id, |
||||
success: function(data) { |
||||
location.reload(); |
||||
}, |
||||
}); |
||||
}); |
||||
|
||||
$("#sign_popup_save").on("click", function() { |
||||
if (signaturePad.isEmpty()) { |
||||
alert('<?php echo get_lang('ProvideASignatureFirst'); ?>');
|
||||
return false; |
||||
} |
||||
var selected = $("#sign-selected").val(); |
||||
var dataURL = signaturePad.toDataURL(imageFormat); |
||||
$.ajax({ |
||||
beforeSend: function(result) { |
||||
$('#loading').show(); |
||||
}, |
||||
type: "POST", |
||||
url: urlAjax, |
||||
data: "a=sign_attendance&selected="+selected+"&file="+dataURL+"&attendance_id="+attendance_id, |
||||
success: function(data) { |
||||
$('#loading').hide(); |
||||
$('#save_controls').hide(); |
||||
$('#close_controls').show(); |
||||
$('#signature_area').hide(); |
||||
|
||||
signaturePad.clear(); |
||||
if (1 == data) { |
||||
$('#sign_results').html('<?php echo get_lang('Saved'); ?>');
|
||||
} else { |
||||
$('#sign_results').html('<?php echo get_lang('Error'); ?>');
|
||||
} |
||||
$('#sign_popup_close').hide(); |
||||
location.reload(); |
||||
}, |
||||
}); |
||||
}); |
||||
|
||||
$(".attendance-sign").on("click", function() { |
||||
$("#sign-selected").val($(this).attr("id")); |
||||
$("#sign_popup").dialog({ |
||||
autoOpen: false, |
||||
width: 500, |
||||
height: 'auto', |
||||
close: function(){ |
||||
} |
||||
}); |
||||
$("#sign_popup").dialog("open"); |
||||
$("#save_controls").show(); |
||||
$("#remove_controls").hide(); |
||||
$('#signature_area').show(); |
||||
$('#signature_area').html("<canvas width='400px'></canvas>"); |
||||
canvas = document.querySelector("#signature_area canvas"); |
||||
signaturePad = new SignaturePad(canvas); |
||||
}); |
||||
|
||||
$(".attendance-sign-view").on("click", function() { |
||||
var selected = $(this).attr("id"); |
||||
$('#loading').show(); |
||||
$.ajax({ |
||||
beforeSend: function(result) { |
||||
$('#signature_area').html("<em class='fa fa-spinner'></em>"); |
||||
}, |
||||
type: "POST", |
||||
url: urlAjax, |
||||
data: "a=get_attendance_sign&selected="+selected, |
||||
success: function(sign) { |
||||
$('#loading').hide(); |
||||
$('#signature_area').show(); |
||||
$('#signature_area').html("<img src='"+sign+"' />"); |
||||
}, |
||||
}); |
||||
$("#sign_popup").dialog({ |
||||
autoOpen: false, |
||||
width: 500, |
||||
height: 'auto', |
||||
close: function(){ |
||||
} |
||||
}); |
||||
$("#sign-selected").val(selected); |
||||
$("#sign_popup").dialog("open"); |
||||
$("#save_controls").hide(); |
||||
$("#remove_controls").show(); |
||||
}); |
||||
}); |
||||
|
||||
function searchUser() { |
||||
// Declare variables |
||||
var input, filter, table, tr, td, i, txtValue; |
||||
input = document.getElementById("search-user"); |
||||
filter = input.value.toUpperCase(); |
||||
table = document.getElementById("table-user-calendar"); |
||||
tr = table.getElementsByTagName("tr"); |
||||
|
||||
// Loop through all table rows, and hide those who don\'t match the search query |
||||
for (i = 0; i < tr.length; i++) { |
||||
td = tr[i].getElementsByTagName("td")[1]; |
||||
if (td) { |
||||
txtValue = td.textContent || td.innerText; |
||||
if (txtValue.toUpperCase().indexOf(filter) > -1) { |
||||
tr[i].style.display = ""; |
||||
} else { |
||||
tr[i].style.display = "none"; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
Loading…
Reference in new issue