<?php
/************************************/
?>
<div>
<article class="mav" id="mav_task" style="text-align:left;">
<p><a class="btn btn-default" href="/user/rtask">Список заданий</a></p>
<h1><?php echo $Title ?></h1>
<?php if(!$GLOBALS['uid']) { ?>
<?php /*include HTML.'no_auth.php';*/ ?>
<?php } elseif($ChBlok){ ?>
<div class="panel panel-default">
<div class="panel-body">
<div class="alert alert-danger"><strong>Вы заблокированны!</strong><br />
<?php echo empty($ChBlokComm) ? 'Это могло случится если вы нарушали правила сервиса. Пожалуйста, свяжитесь с администрацией сайта.' : 'Причина блокировки: '.$ChBlokComm; ?>
</div>
</div>
</div>
<?php } else { ?>
<?php echo $feed; ?>
<div class="panel panel-default">
<?php if(empty($items) || empty($items->data)) { ?>
<div class="panel-body" style="text-align: center;">
<em>Нет данных</em>
</div>
<?php } else { ?>
<div class="table-responsive">
<table class="table r-table table-striped table-hover table-condensed">
<thead>
<tr>
<th><button onclick="return sortitem('Id',this);" class="btn-link btn_sort">№ <?php if($sort == 'Id') echo '<i class="fa fa-caret-down"></i>'; elseif($sort == 'Id DESC') echo '<i class="fa fa-caret-up"></i>'; ?></button></th>
<th><button onclick="return sortitem('Login',this);" class="btn-link btn_sort">Исполнитель <?php if($sort == 'Login') echo '<i class="fa fa-caret-down"></i>'; elseif($sort == 'Login DESC') echo '<i class="fa fa-caret-up"></i>'; ?></button></th>
<th><button onclick="return sortitem('Amount',this);" class="btn-link btn_sort">Стоимость <?php if($sort == 'Amount') echo '<i class="fa fa-caret-down"></i>'; elseif($sort == 'Amount DESC') echo '<i class="fa fa-caret-up"></i>'; ?></button></th>
<th><button onclick="return sortitem('AddDate',this);" class="btn-link btn_sort">Начало <?php if($sort == 'AddDate') echo '<i class="fa fa-caret-down"></i>'; elseif($sort == 'AddDate DESC') echo '<i class="fa fa-caret-up"></i>'; ?></button></th>
<th><button onclick="return sortitem('EndDate',this);" class="btn-link btn_sort">Окончание <?php if($sort == 'EndDate') echo '<i class="fa fa-caret-down"></i>'; elseif($sort == 'EndDate DESC') echo '<i class="fa fa-caret-up"></i>'; ?></button></th>
<th><button onclick="return sortitem('Status',this);" class="btn-link btn_sort">Статус <?php if($sort == 'Status') echo '<i class="fa fa-caret-down"></i>'; elseif($sort == 'Status DESC') echo '<i class="fa fa-caret-up"></i>'; ?></button></th>
</tr>
</thead>
<tbody>
<?php foreach($items->data as $val){
$classstaus = $trclass = '';
$ts = (int)$val['Status'];
if($ts === 1){
$trclass = "success";
$classstaus = 'text-danger';
}
elseif($ts === 2){
$trclass = '';//"warning";
$classstaus = 'text-warning';
}
elseif($ts === 3 || $ts === 7){
$trclass = "danger";
//$classstaus = 'text-success';
}
elseif($ts === 4){
$trclass = "";
$classstaus = 'text-success';
}
else
$classstaus = 'text-muted';
?>
<tr class="<?php echo $trclass; ?>">
<td><?php echo $val['Id']; ?></td>
<td>
<strong><?php echo $val['Login']; ?></strong>
</td>
<td>
<?php echo number_format ($val['Amount'], 2,","," " ); ?> руб.
</td>
<td style="text-align: center; font-size: 12px;"><?php echo date('d.m.Y H:i', $val['AddDate']); ?></td>
<td style="text-align: center; font-size: 12px;"><?php echo date('d.m.Y H:i', $val['EndDate']); ?></td>
<td style="text-align: center;" class="<?php echo $classstaus; ?>">
<strong><?php echo $r_m->status[$ts]; ?></strong>
<?php if($ts === 4) { $val['Rat'] = (int)$val['Rat']; ?>
<?php if($val['Rat'] === 0){ ?>
<div class="form-group">
<em>Нет оценки</em>
</div>
<?php } else { ?>
<div style="font-size: 13px; color:#000;"><strong>Оценка:</strong> <?php echo ($val['Rat'] === 1) ? '<label class="text-success"><i class="fa fa-plus"></i></label>' : '<label class="text-danger"><i class="fa fa-minus"></i></label>'; ?></div>
<?php } ?>
<?php } ?>
</td>
<td style="width: 40px;">
<button style="margin:3px;" title="Просмотр" data-toggle="tooltip" data-placement="bottom" class="btn btn-sm btn-info" onclick="show_item(<?php echo $val['Id']; ?>);"><i class="fa fa-eye"></i></button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="panel-footer"><?php echo $pager; ?></div>
<?php } ?>
</div>
<input type="hidden" id="startpag" data-dataform="" name="startpag" value="<?php echo $startpag; ?>">
<input type="hidden" id="sort" data-dataform="" name="sort" value="<?php echo $sort; ?>">
<input type="hidden" id="url_build" name="url_build" value="<?php echo $url_build; ?>">
<?php } ?>
<div id="show_item"></div>
</article>
</div>
<script src="/assets/mav/js/start.js"></script>
<script>
function show_item(id){
$('#ajaxProgress').show();
$('#show_item').load(document.location.href,{show_item_stat:id,aj:1},function(){$('#ajaxProgress').hide();});
return false;
}
function dataload(formData){
$('#ajaxProgress').show();
formData.append('aj',1);
$.ajax({
url: document.location.href,
type: "POST",
cache: false,
contentType: false,
processData: false,
data: formData,
success: function(content){
$('#mav_task').html($(content).find('#mav_task').html());
$('#ajaxProgress').hide();
window.history.pushState(null, null, $('#url_build').val());
}
});
return false;
}
function pager(pag){
$('#startpag').val(pag);
var formData = getFormData_el('[data-dataform]');
dataload(formData);
return false;
}
function sortitem(el,e){
if($('#sort').val() == el)
el += ' DESC';
$('#sort').val(el);
$('#startpag').val(1);
var formData = getFormData_el('[data-dataform]');
dataload(formData);
return false;
}
</script>