EIOS/tpl/tpl_rejt2_anketa.html

170 lines
6.9 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<br>
<link href="/tpl/css/rejt_anketa.css" rel="stylesheet" />
<div class="row-fluid">
<div class="span6">
<h1>Индивидуальный план преподавателя</h1>
</div>
</div>
<hr>
<div id="page-wrap">
<div class="row-fluid">
<div class="span12">
<form method="POST" name="form_rejt" id="form_rejt" enctype="multipart/form-data">
<div class="widget blue">
<div class="widget-title">
<h4><i class="icon-reorder"></i>Заполнение</h4>
<span class="tools"><a href="javascript:;" class="icon-chevron-down"></a></span>
</div>
<div class="widget-body">
<form action="" class="form-vertical" method="POST" enctype="multipart/form-data">
<div class="row-fluid">
<div class="span4">
<div class="control-group">
Или выберите вид работы или напишите свой:
</div>
</div>
<div class="span8">
<div class="control-group">
<select id="itemsnprs" class="form-control" style="max-width: 100%;">
<option value="">Выбрать обязательные виды работ</option>
{foreach from=$itemsnprs item=it}
<option value="{$it.id}">{$it.name}</option>
{/foreach}
</select>
</div>
</div>
</div>
<div class="row-fluid">
<div class="span6">
<div class="control-group">
<textarea class="span12 tooltips" data-trigger="hover" data-original-title="Опишите вид работ" name="name" id="name" style="height: 70px;" placeholder="Опишите вид работ">{$item.name}</textarea>
</div>
</div>
<div class="span3">
<div class="control-group">
<input type="text" class="span12 tooltips" data-trigger="hover" data-original-title="Часы планируемые" placeholder="Часы планируемые" id="hour_plan" name="hour_plan" value="{$item.hour_plan}" /><br>
<input type="text" class="span12 tooltips" data-trigger="hover" data-original-title="Часы фактические" placeholder="Часы фактические" id="hour_fakt" name="hour_fakt" value="{$item.hour_fakt}" />
</div>
</div>
<div class="span3">
<div class="control-group">
<select class="span12 tooltips" data-trigger="hover" data-original-title="Статус" tabindex="1" name="status" id="status">
<option value="1"{if $item.status==1} SELECTED{/if}>Выполнено</option>
<option value="0"{if $item.status==0} SELECTED{/if}>Не выполнено</option>
</select>
<br>
<input type="hidden" id="item_id" value="0">
<a href="#" class="btn btn-warning save_item">Добавить запись</a>
<a href="#" class="btn btn-warning edit_item" style="display:none;">Редактировать запись</a>
</div>
</div>
</div>
{*<div class="form-actions">
<button type="submit" name="admin3_edit" class="btn btn-success">Сохранить</button>
</div>*}
<div>
<table class="table">
<thead><tr><th>вид работы</th><th>Часы</th><th>Действия</th></tr></thead>
<tbody class="rejt2_saves_items">
{foreach from=$items item=item}
<tr id="item_{$item.id}">
<td>{$item.name}</td>
<td><span class="label {if $item.status==0}label-important{else}label-success{/if}">{$item.hour_plan}/{$item.hour_fakt}</span></td>
<td><a href="#" class="btn_edit" id="be_{$item.id}">Ред.</a> <a href="#" class="btn_del" id="bd_{$item.id}">Удалить</a></td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</form>
</div>
</div>
</form>
</div>
</div>
</div>
{literal}<script>$(document).ready(function(){
$("#itemsnprs").change(function(){
$("#name").val($("#itemsnprs option:selected").text());
});
$(".save_item").click(function(){
var name = $("#name").val();
var hour_plan = $("#hour_plan").val();
var hour_fakt = $("#hour_fakt").val();
var status = $('#status option:selected').val();
var item_id = $('#item_id').val();
$.ajax({
url: '/json.php',dataType:'json',type:'POST',async:false,data:'ajdes=rejt2_save_item&name='+name+'&hour_plan='+hour_plan+'&hour_fakt='+hour_fakt+'&status='+status,
success: function(data){
if(data.err==0){
var label = 'label-success'; if(data.status==0) label = 'label-important';
var str='<tr id="item_'+data.id+'"><td>'+name+'</td><td><span class="label '+label+'">'+hour_plan+'/'+hour_fakt+'</span></td><td><a href="#" class="btn_edit" id="be_'+data.id+'">Ред.</a> <a href="#" class="btn_del" id="bd_'+data.id+'">Удалить</a></td></tr>';
$(".rejt2_saves_items").append(str);
}
}
});
return false;
});
$(".edit_item").click(function(){
var name = $("#name").val();
var hour_plan = $("#hour_plan").val();
var hour_fakt = $("#hour_fakt").val();
var status = $('#status option:selected').val();
var item_id = $('#item_id').val();
$.ajax({
url: '/json.php',dataType:'json',type:'POST',async:false,data:'ajdes=rejt2_editi_item&name='+name+'&hour_plan='+hour_plan+'&hour_fakt='+hour_fakt+'&status='+status+'&item_id='+item_id,
success: function(data){
if(data.err==0){
var label = 'label-success'; if(data.status==0) label = 'label-important';
var str='<tr id="item_'+data.id+'"><td>'+name+'</td><td><span class="label '+label+'">'+hour_plan+'/'+hour_fakt+'</span></td><td><a href="#" class="btn_edit" id="be_'+data.id+'">Ред.</a> <a href="#" class="btn_del" id="bd_'+data.id+'">Удалить</a></td></tr>';
$("#item_"+data.id).remove();
$(".rejt2_saves_items").append(str);
$('.save_item').show();
$('.edit_item').hide();
}
}
});
return false;
});
$(document).on("click", ".btn_edit", function(){
var id =$(this).attr("id").split("_");
$.ajax({
url: '/json.php',dataType:'json',type:'POST',async:false,data:'ajdes=rejt2_edit_item&id='+id[1],
success: function(data){
if(data.err==0){
$("#name").val(data.name);
$("#hour_plan").val(data.hour_plan);
$("#hour_fakt").val(data.hour_fakt);
$('#status option[value='+data.status+']').attr('selected','selected');
$('#item_id').val(data.id);
$('.save_item').hide();
$('.edit_item').show();
//$("#item_"+id[1]).remove();
}else alert("Ошибка редактирования!");
}
});
return false;
});
$(document).on("click", ".btn_del", function(){
var id =$(this).attr("id").split("_");
$.ajax({
url: '/json.php',dataType:'json',type:'POST',async:false,data:'ajdes=rejt2_dele_item&id='+id[1],
success: function(data){
if(data.err==0){
$("#item_"+id[1]).remove();
}else alert("Ошибка удаления!");
}
});
return false;
});
function f(){
$.ajax({url: '/json.php', dataType:'json', type:'POST', async:false, data: 'ajdes=empty_post',success: function(data){}});
}
setInterval(f, 150000);
});</script>{/literal}
{*<pre>{print_r($items)}</pre>*}