Jelenlet alapfunkcio OK. Edzes torles OK.
This commit is contained in:
@@ -1,28 +1,85 @@
|
||||
<table>
|
||||
<input type="hidden" id="tr_id" value="{$tr_id}">
|
||||
|
||||
{foreach $users as $user}
|
||||
<tr>
|
||||
<td>{$user->get_uk_last_name()} {$user->get_uk_first_name()}</td>
|
||||
<td><input name="chk" type="checkbox" id="chk" value="{$user->get_uk_id()}" class="chk" {if $user->get_uk_presence($tr_id)}checked{/if}> </td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
<script>
|
||||
$('.chk').click(function() {
|
||||
var checked = $(this).is(':checked');
|
||||
var user_id = $(this).val();
|
||||
var tr_id = $("#tr_id").val();
|
||||
alert(checked);
|
||||
<input type="hidden" id="tr_id" value="{$tr_id}">
|
||||
|
||||
{foreach $users as $user}
|
||||
|
||||
<div class="{if $user->get_uk_presence($tr_id)}name_tag_checked{else}name_tag{/if}" id="{$user->get_uk_id()}">{$user->get_uk_name()}</div>
|
||||
|
||||
|
||||
|
||||
|
||||
{/foreach}
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
$('.name_tag').click(function() {
|
||||
//alert($(this).css('backgroundColor'));
|
||||
var user_id = $(this).attr('id');
|
||||
var x = $(this).css('backgroundColor');
|
||||
hexc(x);
|
||||
var checked = (color == '#e2edff');
|
||||
var tr_id = $("#tr_id").val();
|
||||
//ha kék, akkor zöldre változtatja, egyébként fordítva
|
||||
if (color == '#e2edff') {
|
||||
$(this).css('backgroundColor', '#1eea0b');
|
||||
}
|
||||
else {
|
||||
$(this).css('backgroundColor', '#e2edff');
|
||||
}
|
||||
//alert(checked);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/ajax/update_presence.php',
|
||||
url: '/_ajax/update_presence.php',
|
||||
data: { checked : checked, user_id : user_id, tr_id : tr_id },
|
||||
success: function(data) {
|
||||
//alert('it worked');
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
$('.name_tag_checked').click(function() {
|
||||
//alert($(this).css('backgroundColor'));
|
||||
var user_id = $(this).attr('id');
|
||||
var x = $(this).css('backgroundColor');
|
||||
hexc(x);
|
||||
var checked = (color == '#e2edff');
|
||||
var tr_id = $("#tr_id").val();
|
||||
//ha kék, akkor zöldre változtatja, egyébként fordítva
|
||||
if (color == '#e2edff') {
|
||||
$(this).css('backgroundColor', '#1eea0b');
|
||||
}
|
||||
else {
|
||||
$(this).css('backgroundColor', '#e2edff');
|
||||
}
|
||||
//alert(checked);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: '/_ajax/update_presence.php',
|
||||
data: { checked : checked, user_id : user_id, tr_id : tr_id },
|
||||
success: function(data) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
function hexc(colorval) {
|
||||
var parts = colorval.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
||||
delete(parts[0]);
|
||||
for (var i = 1; i <= 3; ++i) {
|
||||
parts[i] = parseInt(parts[i]).toString(16);
|
||||
if (parts[i].length == 1) parts[i] = '0' + parts[i];
|
||||
}
|
||||
color = '#' + parts.join('');
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user