}
$out .= '

</tr></table>';
if ($await + $active == 0) {
    $perc_oper = 0;
} else {
    $perc_oper = round($active / ($await + $active) * 100);
}
$queue = '';
$active_calls = values("SELECT * FROM " . $conf_realtime_db . ".call_status WHERE queue LIKE '" . $current_queue . "' AND (status='ENTERQUEUE' OR status='CONNECT' OR status='inQue') ORDER BY callId");
if (count($active_calls) == 0) {
    $queue = '<i>' . __('нет') . '</i>';
}
for ($i = 0; $i < count($active_calls); $i++) {
    $out_usr_data = $active_calls[$i]['callerId'];
    if ($out_usr_data == '') {
        $out_usr_data = __('Unknown');
    }
    if (empty($active_calls[$i]['agent'])) {
        $active_calls[$i]['agent'] = __('ждет');
    }
    $queue .= '<a title=' . $active_calls[$i]['callerId'] . '>' . $out_usr_data . '</a> -> ' . $active_calls[$i]['agent'] . '<br>';
    //href="#" onClick="redirect('.$active_calls[$i]['callId'].', 0)"
}
$operators_statuses = '<br><table border=0><tr><td width=80><font color="#FFA500"><b>' . __('Готов') . ':</b></font></td><td><font color="#FFA500"><b>' . $ready . '</b></font></td></tr>
<tr><td><font color="green"><b>' . __('Разговор') . ':</b></font></td><td><font color="green"><b>' . $talk . '</b></font></td></tr>
<tr><td><font color="blue"><b>' . __('Пауза') . ':</b></font></td><td><font color="blue"><b>' . $paused . '</b></font></td></tr>
<tr><td><font color="#ACACAC"><b>' . __('Отключен') . ':</b></font></td><td><font color="#ACACAC"><b>' . $unready . '</b></font></td></tr></table>';
echo '' . status_bar($perc_oper) . ' <b>' . $perc_oper . '</b>%<br>' . $operators_statuses . '</td><td width=20>&nbsp;</td><td valign="top" width="620">' . $out . '</td>
	<td width=20>&nbsp;</td><td valign="top" width=170><b>' . __('Звонки в очереди') . ':</b><br><br>' . $queue . '</td></tr></table>';
/'+ID
    $.post(url,function(data) {
      $('#myModal_content').html(data);
    }, 'json');
} 

</script>
<?php 
echo count($draft_deals) < 1 ? '<tr><td style="text-align:center;" colspan="5">' . lang('no_deal_types') . '</td></tr>' : '';
$deal_coupon_html = '';
foreach ($draft_deals as $deal) {
    //echo "<pre>"; print_r($deal); die;
    $live_status = '';
    $coupon_button = 'none';
    $status_vars = array('is_approved' => $deal->is_approved, 'is_request_approve' => $deal->is_request_approve, 'payment_status' => $deal->payment_status);
    $status_info = status_bar($status_vars);
    if ($type == 'upcoming') {
        $live_deal = strstr($deal->dealDates, date(date("Y-m-d 00:00:00")));
        if ($live_deal) {
            $cancle_button = 'none';
            $live_status = '<span style="color:#12A707;float:right;">Live</span>';
            if ($deal->coupon_exist) {
                $deal_coupon_html[] = deal_coupon_html($deal, $deal_coupons[$deal->id]);
                $coupon_button = 'block';
            }
        } else {
            $cancle_button = 'block';
        }
    }
    $deal_data['deal_id'] = $deal->id;
    $deal_data['deal_title'] = $deal->title;