fix object events
This commit is contained in:
parent
36a5986ab6
commit
26751d260d
@ -984,6 +984,7 @@ if ($_SESSION['id'] && $_GET['object_id'] && is_numeric($_GET['object_id'])) {
|
||||
if ($event['type'] == 'deal') {
|
||||
$date = date("d.m.Y", strtotime($event['schedule_date']));
|
||||
list($d, $m, $y) = explode(".", $date);
|
||||
$deal_id_for_edit = !empty($event['deal_id']) ? intval($event['deal_id']) : null;
|
||||
?>
|
||||
<div class="chat-block<?=$class_ev?>">
|
||||
<div class="chat-author">
|
||||
@ -1002,7 +1003,8 @@ if ($_SESSION['id'] && $_GET['object_id'] && is_numeric($_GET['object_id'])) {
|
||||
<div class="fio_user" title="<?=$event['user_fio']?>"><?=$event['user_fio']?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chat-message deal">
|
||||
<div class="chat-message deal <?=($event['cancel']==1) ? 'cancel' : ''?>">
|
||||
<?php if (!$deal_id_for_edit) { ?>
|
||||
<div class="chat-complete<?=!in_array($event['user_id'], $usersCanEdit) ? ' hidden' : '' ?>">
|
||||
<div class="complete-button" data-id="<?=$event['id']?>">
|
||||
<input type="checkbox" />
|
||||
@ -1018,11 +1020,103 @@ if ($_SESSION['id'] && $_GET['object_id'] && is_numeric($_GET['object_id'])) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="chat-content" id="chat_content_<?=$event['id']?>">
|
||||
<div class="head"><span>Сделка</span></div>
|
||||
<div class="message">Запланирована сделка на <?=$d?> <?=getRusMonth($m)?> <?=$y?> в <?=date("H:i", strtotime($event['schedule_date']))?></div>
|
||||
<?php
|
||||
if ($deal_id_for_edit) {
|
||||
$sql_deal_data = "SELECT * FROM deals WHERE id = " . intval($deal_id_for_edit) . " LIMIT 1";
|
||||
$rez_deal_data = mysql_query($sql_deal_data);
|
||||
$deal_data = mysql_fetch_assoc($rez_deal_data);
|
||||
}
|
||||
?>
|
||||
<?php if (!empty($deal_data)) { ?>
|
||||
<hr style="border:none;border-top:1px solid #e0e0e0;margin:6px 0;">
|
||||
<?php if ($deal_data['contract_price']) { ?>
|
||||
<div class="message" style="font-size:13px;">Сумма в договоре: <?=number_format($deal_data['contract_price'], 0, '', ' ')?><span class="rub"> руб.</span></div>
|
||||
<?php } ?>
|
||||
<?php if ($deal_data['agent_commission']) { ?>
|
||||
<div class="message" style="font-size:13px;">Комиссия агента: <?=number_format($deal_data['agent_commission'], 0, '', ' ')?><span class="rub"> руб.</span></div>
|
||||
<?php } ?>
|
||||
<div class="message" style="margin-top:5px;font-size:13px;">
|
||||
<b>Стороны сделки:</b><br/>
|
||||
<?php
|
||||
$side1_text = htmlspecialchars($deal_data['side_one']);
|
||||
if (!empty($deal_data['side_one_requisition_id'])) {
|
||||
$sql_req1 = "SELECT name, client_id FROM requisitions WHERE id = " . intval($deal_data['side_one_requisition_id']) . " LIMIT 1";
|
||||
$rez_req1 = mysql_query($sql_req1);
|
||||
if ($rez_req1 && mysql_num_rows($rez_req1) > 0) {
|
||||
$row_req1 = mysql_fetch_assoc($rez_req1);
|
||||
$side1_text .= ': Заявка «' . htmlspecialchars($row_req1['name']) . '»';
|
||||
if (!empty($row_req1['client_id'])) {
|
||||
$sql_cl1 = "SELECT id, fio FROM clients WHERE id = " . intval($row_req1['client_id']) . " LIMIT 1";
|
||||
$rez_cl1 = mysql_query($sql_cl1);
|
||||
if ($rez_cl1 && mysql_num_rows($rez_cl1) > 0) {
|
||||
$row_cl1 = mysql_fetch_assoc($rez_cl1);
|
||||
$side1_text .= ' — <a href="javascript:{}" data-id="' . intval($row_cl1['id']) . '" class="neweditClient" style="color:#1976d2;">' . htmlspecialchars($row_cl1['fio']) . '</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '<span style="color:#666;">' . $side1_text . '</span><br/>';
|
||||
|
||||
$side2_text = htmlspecialchars($deal_data['side_two']);
|
||||
if (!empty($deal_data['side_two_requisition_id'])) {
|
||||
$sql_req2 = "SELECT name, client_id FROM requisitions WHERE id = " . intval($deal_data['side_two_requisition_id']) . " LIMIT 1";
|
||||
$rez_req2 = mysql_query($sql_req2);
|
||||
if ($rez_req2 && mysql_num_rows($rez_req2) > 0) {
|
||||
$row_req2 = mysql_fetch_assoc($rez_req2);
|
||||
$side2_text .= ': Заявка «' . htmlspecialchars($row_req2['name']) . '»';
|
||||
if (!empty($row_req2['client_id'])) {
|
||||
$sql_cl2 = "SELECT id, fio FROM clients WHERE id = " . intval($row_req2['client_id']) . " LIMIT 1";
|
||||
$rez_cl2 = mysql_query($sql_cl2);
|
||||
if ($rez_cl2 && mysql_num_rows($rez_cl2) > 0) {
|
||||
$row_cl2 = mysql_fetch_assoc($rez_cl2);
|
||||
$side2_text .= ' — <a href="javascript:{}" data-id="' . intval($row_cl2['id']) . '" class="neweditClient" style="color:#1976d2;">' . htmlspecialchars($row_cl2['fio']) . '</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '<span style="color:#666;">' . $side2_text . '</span>';
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
$side_one_obj_id = intval($deal_data['side_one_object_id']);
|
||||
$side_two_obj_id = intval($deal_data['side_two_object_id']);
|
||||
if ($side_one_obj_id || $side_two_obj_id) {
|
||||
$obj_ids = array_filter([$side_one_obj_id, $side_two_obj_id]);
|
||||
$sql_objs = "SELECT id, nazv, adres FROM objects WHERE id IN (" . implode(',', $obj_ids) . ")";
|
||||
$rez_objs = mysql_query($sql_objs);
|
||||
if ($rez_objs && mysql_num_rows($rez_objs) > 0) {
|
||||
echo '<div class="message" style="margin-top:5px;font-size:13px;"><b>Объекты:</b><br/>';
|
||||
while ($obj_row = mysql_fetch_assoc($rez_objs)) {
|
||||
echo '<span style="color:#666;">' . htmlspecialchars($obj_row['nazv']) . ' (' . htmlspecialchars($obj_row['adres']) . ')</span><br/>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
$sql_inner_docs = "SELECT d.id, d.name FROM inner_docs d JOIN deal_inner_doc did ON did.inner_doc_id = d.id WHERE did.deal_id = " . intval($deal_id_for_edit);
|
||||
$rez_inner_docs = mysql_query($sql_inner_docs);
|
||||
if ($rez_inner_docs && mysql_num_rows($rez_inner_docs) > 0) {
|
||||
echo '<div class="message" style="margin-top:5px;font-size:13px;"><b>Документы:</b><br/>';
|
||||
while ($doc_row = mysql_fetch_assoc($rez_inner_docs)) {
|
||||
echo '<span style="color:#666;">' . htmlspecialchars($doc_row['name']) . '</span><br/>';
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
<?php if (!$event['cancel']) { ?>
|
||||
<div style="margin-top:8px;text-align:right;">
|
||||
<a href="javascript:{}" class="no-border" onclick="if(window.editDeal){window.editDeal(<?=intval($event['req_id'] ?: 0)?>, <?=$deal_id_for_edit?>)}" style="color:#43A047;font-size:13px;font-weight:500;">
|
||||
Подробнее
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<?php if ($event['sum']) { ?>
|
||||
<div class="message">Сумма сделки: <?=$event['sum']?><span class="rub">p</span></div>
|
||||
<?php } ?>
|
||||
<?php } if ($event['comment']) { ?>
|
||||
<div class="message">Комментарий: <?=$event['comment']?></div>
|
||||
<?php } if ($event['sub_comment']) { ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user