add deal icon in objects
This commit is contained in:
parent
9a28c36296
commit
fe2860dd0b
@ -2832,6 +2832,24 @@ if ($_SESSION['id']) {
|
||||
}
|
||||
// LEFT JOIN rayon rayon on objects.rayon = rayon.id
|
||||
|
||||
// Формируем список сделок объектов
|
||||
$objectDealsArray = [];
|
||||
$objIds = array_column($objSphinx, 'id');
|
||||
if (!empty($objIds)) {
|
||||
$objIdsStr = implode(',', array_map('intval', $objIds));
|
||||
$dealsRes = mysql_query("SELECT side_one_object_id, side_two_object_id FROM deals WHERE status != 2 AND (side_one_object_id IN ($objIdsStr) OR side_two_object_id IN ($objIdsStr))");
|
||||
if ($dealsRes && mysql_num_rows($dealsRes) > 0) {
|
||||
while ($dealRow = mysql_fetch_assoc($dealsRes)) {
|
||||
if (in_array((int)$dealRow['side_one_object_id'], $objIds)) {
|
||||
$objectDealsArray[$dealRow['side_one_object_id']] = 1;
|
||||
}
|
||||
if (in_array((int)$dealRow['side_two_object_id'], $objIds)) {
|
||||
$objectDealsArray[$dealRow['side_two_object_id']] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$objectsFound = [];
|
||||
if($post['view'] == 'table'){
|
||||
foreach($objSphinx as $obj){
|
||||
|
||||
@ -1065,6 +1065,21 @@ if($_SESSION['id'] == 5238){
|
||||
return sort_order;
|
||||
}
|
||||
|
||||
function openObjectDealFromList(objectId) {
|
||||
$.ajax({
|
||||
url: '/ajax/ajax_vue_requisitions.php',
|
||||
type: 'POST',
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({ request: 'get_deal_by_object', object_id: objectId }),
|
||||
success: function(response) {
|
||||
var res = typeof response === 'string' ? JSON.parse(response) : response;
|
||||
if (res.deals && res.deals.length > 0) {
|
||||
window.editDeal(0, res.deals[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function checkDealType() {
|
||||
$('.crm__filters .crm__filter-popup .filter-popup__left .filter-popup-type').each(function() {
|
||||
if($(this).attr("data-id") == 'sale') {
|
||||
@ -1187,6 +1202,13 @@ if($_SESSION['id'] == 5238){
|
||||
</script>
|
||||
|
||||
<?php require($_SERVER['DOCUMENT_ROOT']."/templates/footer.php"); ?>
|
||||
<?php
|
||||
$allowed_users_deal = [18388];
|
||||
if (in_array((int)$_SESSION['id'], $allowed_users_deal)) {
|
||||
echo '<script type="module" src="/deal/assets/app.js"></script>';
|
||||
echo '<link rel="stylesheet" href="/deal/assets/app.css">';
|
||||
}
|
||||
?>
|
||||
<link href="/css/bootstrap-table.min.css" rel="stylesheet">
|
||||
<link href="/css/jquery.treegrid.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/css/bootstrap.css?v=3" type="text/css">
|
||||
|
||||
@ -547,6 +547,11 @@ if (isset($fromArchList) && $fromArchList && $obj['archive'] == 0) { echo " acti
|
||||
</label>
|
||||
<?php else : ?>
|
||||
<label>
|
||||
<?php if (!empty($objectDealsArray[$obj['id']])) : ?>
|
||||
<a href="javascript:{};" class="no-border" title="Сделка" onclick="openObjectDealFromList(<?=$obj['id']?>)">
|
||||
<span style="color: #43A047 !important; font-size: 16px; margin-right: 3px;"><i class="fas fa-handshake"></i></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<input type="checkbox" onclick="to_favor(<?php echo $obj['id']; ?>);" id="favorite<?php echo $obj['id']; ?>" class="favorite-input" <?php if($favor) if(in_array($obj['id'],$favor)) echo 'checked'; ?>>
|
||||
<span class="ti-heart <?php if($favor) if(in_array($obj['id'],$favor)) echo 'active'; ?>" id="favorite-star<?php echo $obj['id']; ?>"></span>
|
||||
</label>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user