2026-05-22 20:21:54 +02:00
< ? php
require_once ( $_SERVER [ 'DOCUMENT_ROOT' ] . " /config.php " );
$pdo = new MysqlPdo ( hst , ndb , user , pass );
$sql = " SET NAMES 'utf8' " ;
$pdo -> query ( $sql );
if ( $_SESSION [ 'id' ] && $_GET [ 'object_id' ] && is_numeric ( $_GET [ 'object_id' ])) {
$gmtmsk = get_time_zone_user ();
$time_zone = '' ;
if ( $gmtmsk >= 0 ){
$time_zone = '+' . $gmtmsk . ' hour' ;
} else {
$time_zone = '-' . $gmtmsk . ' hour' ;
}
$get = clearInputData ( $_GET );
// обновляем метку у меню календаря
// считаем события объектов
$sql = " SELECT count(id) FROM user_object_events WHERE user_id = $_SESSION[id] and calendar_view = 0
and schedule_date is not null and DATE ( schedule_date ) <= '".date("Y-m-d")."' " ;
$rez = mysql_query ( $sql );
$objectEventCount = mysql_result ( $rez , 0 );
// считаем события клиентов
$sql = " SELECT count(id) FROM user_client_events WHERE user_id = $_SESSION[id] and calendar_view = 0
and schedule_date is not null and DATE ( schedule_date ) <= '".date("Y-m-d")."' " ;
$rez = mysql_query ( $sql );
$clientEventCount = mysql_result ( $rez , 0 );
// суммарное количество событий по объектам и пользователям
$sumCount = intval ( $objectEventCount ) + intval ( $clientEventCount );
echo " <script> $ ('#calendarCounter').html(' " . $sumCount . " ');</script> " ;
$sqlObj = " SELECT objects.*, DATE_FORMAT(objects.date_add,'%d.%m.%Y %H:%i') as date_add
FROM objects
WHERE objects . id = $_GET [ object_id ] " ;
$rezObj = mysql_query ( $sqlObj );
$obj = mysql_fetch_assoc ( $rezObj );
$user = new User ;
$user -> get ( $_SESSION [ 'id' ]);
$agency_id = $user -> agencyId ;
$usersIds = array ();
$usersIds [] = $agency_id ;
$sql_users = " SELECT id FROM users WHERE id in (select id from users where id= $agency_id or id_manager= $agency_id or id_manager in
( select id from users where id_manager = $agency_id or id_manager in
( select id from users where id_manager = $agency_id ))) " ;
$q_users = mysql_query ( $sql_users );
while ( $r_users = mysql_fetch_assoc ( $q_users )){
$usersIds [] = ( int ) $r_users [ 'id' ];
}
$usersIds = array_unique ( $usersIds );
$sql_users2 = " SELECT id, user_logo, CONCAT(last_name, ' ', first_name, ' ', middle_name) as user_fio FROM users WHERE id in ( " . implode ( ',' , $usersIds ) . " ) " ;
$q_users2 = mysql_query ( $sql_users2 );
while ( $r_users2 = mysql_fetch_assoc ( $q_users2 )){
$users [ $r_users2 [ 'id' ]] = $r_users2 ;
}
//Доступ к задаче
$user_access = $_SESSION [ 'id' ];
if ( $user -> users_admin == 1 ){
$user_access = $user -> agencyId ;
}
$req = new Requisitions ( null , true );
$usersCanEdit = $req -> getIdsUsers ( $user_access );
/* if ( $_SESSION [ 'id' ] == 5238 ){
var_dump ( $usersCanEdit );
} */
if ( $_SESSION [ 'agency' ] or $_SESSION [ 'manager' ] or $_SESSION [ 'users_admin' ] or $obj [ 'id_add_user' ] == $_SESSION [ 'id' ]) {
$searchUserId = $_SESSION [ 'id' ];
$agentIds = array ();
if ( $_SESSION [ 'users_admin' ] or $obj [ 'id_add_user' ] == $_SESSION [ 'id' ]) {
$searchUserId = $user -> agencyId ;
$agentIds [] = $user -> agencyId ;
}
$agentsOfAgency = User :: getAllAgents ( $searchUserId );
$agentIds [] = $_SESSION [ 'id' ];
foreach ( $agentsOfAgency as $agent ) {
if ( ! in_array ( $agent [ 'id' ], $agentIds )) {
$agentIds [] = $agent [ 'id' ];
}
}
if ( $_SESSION [ 'agency' ] or $_SESSION [ 'users_admin' ]) {
$agentsOfManager = User :: getAllManagers ( $searchUserId );
foreach ( $agentsOfManager as $agent ) {
if ( ! in_array ( $agent [ 'id' ], $agentIds )) {
$agentIds [] = $agent [ 'id' ];
}
}
}
$sql = " SELECT e.*,
IF ( IFNULL ( s . id , '' ) = '' , 0 , s . id ) AS sub_id ,
IF ( IFNULL ( s . sub_comment , '' ) = '' , NULL , s . sub_comment ) AS sub_comment ,
IF ( s . created_by <> 0 , (
SELECT CONCAT ( u . last_name , ' ' , u . first_name , ' ' , u . middle_name )
FROM users as u WHERE u . id = s . created_by
), NULL
) as sub_comment_author ,
IF ( s . user_for <> 0 , (
SELECT CONCAT ( u . last_name , ' ' , u . first_name , ' ' , u . middle_name )
FROM users as u WHERE u . id = s . user_for
), NULL
) as sub_comment_user_for
FROM user_object_events AS e
LEFT JOIN user_sub_comments AS s ON s . event_id = e . id AND s . section_id = 1
WHERE ( e . user_id IN ( " . implode( " , " , $agentIds ) . " ) or e . from_id IN ( " . implode( " , " , $agentIds ) . " )) AND e . object_id = '$get[object_id]'
GROUP BY e . id
ORDER BY e . create_date ASC ; " ;
//echo $sql;
} else {
$sql = " SELECT e.*,
IF ( IFNULL ( s . id , '' ) = '' , 0 , s . id ) AS sub_id ,
IF ( IFNULL ( s . sub_comment , '' ) = '' , NULL , s . sub_comment ) AS sub_comment ,
IF ( s . created_by <> 0 , (
SELECT CONCAT ( u . last_name , ' ' , u . first_name , ' ' , u . middle_name )
FROM users as u WHERE u . id = s . created_by
), NULL
) as sub_comment_author ,
IF ( s . user_for <> 0 , (
SELECT CONCAT ( u . last_name , ' ' , u . first_name , ' ' , u . middle_name )
FROM users as u WHERE u . id = s . user_for
), NULL
) as sub_comment_user_for
FROM user_object_events AS e
LEFT JOIN user_sub_comments AS s ON s . event_id = e . id AND s . section_id = 1
WHERE ( e . user_id = '$_SESSION[id]' or e . from_id = '$_SESSION[id]' ) AND e . object_id = '$get[object_id]'
GROUP BY e . id
ORDER BY e . create_date ASC ; " ;
}
//echo $sql;
$rez = mysql_query ( $sql );
$date = null ;
$is_who_work = false ;
$createDate = null ;
if ( $obj [ 'archive' ]) {
echo '<div class="chat-status archive"><span>Объект в архиве</span></div>' ;
}
while ( $event = mysql_fetch_assoc ( $rez )) {
if ( $obj [ 'id_add_user' ] == $_SESSION [ 'id' ] || in_array ( $_SESSION [ 'id' ], $agentIds ))
$is_who_work = true ;
// $event['user_fio'] = trim($event['last_name'] . ' ' . $event['first_name'] . ' ' . $event['middle_name']);
if ( $createDate == null || $createDate != date ( " d.m.Y " , strtotime ( $event [ 'create_date' ]))) {
$createDate = date ( " d.m.Y " , strtotime ( $event [ 'create_date' ]));
list ( $d , $m , $y ) = explode ( " . " , $createDate );
if ( $y == date ( " Y " )) {
$y = " " ;
}
echo '<div class="chat-date"><span>' . $d . " " . getRusMonth ( $m ) . " " . $y . '</span></div>' ;
}
$class_ev = " is__right " ;
$from_id = $event [ 'user_id' ];
if ( ! empty ( $event [ 'from_id' ])) $from_id = $event [ 'from_id' ];
if ( $_SESSION [ 'id' ] == $from_id ){
$class_ev = " is__left " ;
}
$sql_user = " SELECT user_logo, CONCAT(last_name, ' ', first_name, ' ', middle_name) as user_fio FROM users WHERE id = { $from_id }
UNION SELECT user_logo , CONCAT ( last_name , ' ' , first_name , ' ' , middle_name , ' (удален)' ) as user_fio FROM users_delete WHERE user_id = { $from_id } " ;
$from_user = mysql_fetch_assoc ( mysql_query ( $sql_user ));
$event [ 'user_logo' ] = $from_user [ 'user_logo' ];
$event [ 'user_fio' ] = $from_user [ 'user_fio' ];
if ( $event [ 'type' ] == 'file' ) {
$file_list = '' ;
$docs_q = mysql_query ( " SELECT * FROM clients_files WHERE event_id = ' " . $event [ 'id' ] . " ' " );
$name_files = '' ;
while ( $file = mysql_fetch_assoc ( $docs_q )) {
if ( $file [ 'name_id' ] > 0 && $name_files == '' ){
$sql_n = " SELECT * FROM names_client_files WHERE id= { $file [ 'name_id' ] } " ;
$q_n = mysql_query ( $sql_n );
if ( mysql_num_rows ( $q_n ) > 0 ){
$r_n = mysql_fetch_assoc ( $q_n );
$name_files = $r_n [ 'name' ];
}
}
$name_doc = $_SERVER [ 'DOCUMENT_ROOT' ] . '/upload/objects/' . $file [ 'object_id' ] . '/' . $file [ 'guid' ] . '.' . $file [ 'type' ];
$file_path = '' ;
if ( $file [ 'object_id' ] > 0 )
$file_path = '/upload/objects/' . $file [ 'object_id' ] . '/' . $file [ 'guid' ] . '.' . $file [ 'type' ];
if ( ! empty ( $file_path ) && ! empty ( $file [ 'name' ])) {
$file_list .= '<li><a title="Скачать файл" target="_blank" href="/download_file.php?id=' . $file [ 'id' ] . ' & preview = 1 " >
< span class = " file-span ti-file " ></ span >
< span class = " file-name " > ' . $file[' name '] . ' </ span >
</ a ></ li > ' ;
}
}
if ( ! empty ( $file_list )) { ?>
< div class = " chat-block<?= $class_ev ?> " >
< div class = " chat-author " >
< div class = " pic " >
< ? php if ( empty ( $event [ 'user_logo' ])) { ?>
< img src = " /images/user-pic.svg " />
< ? php } else { ?>
< img src = " /photos/agency/<?= $event['user_logo'] ?> " >
< ? php } ?>
< div class = " fio_user " title = " <?= $event['user_fio'] ?> " >< ? = $event [ 'user_fio' ] ?> </div>
</ div >
</ div >
< div class = " chat-message " >
< div class = " chat-content " id = " chat_content_<?= $event['id'] ?> " >
< div class = " head " >< span > Примечание </ span ></ div >
< div class = " message " > < ? = $name_files ?> <?= (!empty($file_list)) ? '<br/><ul>' . $file_list . '</ul>' : ''; ?><?= $event['comment']; ?></div>
< span class = " time " >< ? = date ( " H:i " , strtotime ( $time_zone , strtotime ( $event [ 'create_date' ]))) ?> </span>
< ? php if ( $from_id == $_SESSION [ 'id' ] || $_SESSION [ 'id' ] == $agencyId || $_SESSION [ 'superadmin' ] == 1 ){ ?>
< div class = " message " style = " margin-top: 10px; " >
<!--< a href = " javascript: { } " class = " no-border " onclick = " sendEventFilesWin('<?= $event['id'] ?>', 'object') " title = " Отправить " >
< span class = " simple-button send " >< i class = " ti-email " ></ i ></ span >
</ a >-->
< a href = " javascript: { } " class = " no-border " onclick = " deleteEvent('<?= $event['id'] ?>', 'objects') " title = " Удалить " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
</ div >
< ? php } ?>
</ div >
</ div >
< div class = " clear " ></ div >
</ div >
< ? php }
}
if ( $event [ 'type' ] == 'even' ) {
$date = date ( " d.m.Y " , strtotime ( $event [ 'schedule_date' ]));
list ( $d , $m , $y ) = explode ( " . " , $date );
?>
< div class = " chat-block<?= $class_ev ?> " >
< div class = " chat-author " >
< div class = " pic " >
< ? php
if ( empty ( $event [ 'user_logo' ])){
?>
< img src = " /images/user-pic.svg " />
< ? php
} else {
?>
< img src = " /photos/agency/<?= $event['user_logo'] ?> " >
< ? php
}
?>
< div class = " fio_user " title = " <?= $event['user_fio'] ?> " >< ? = $event [ 'user_fio' ] ?> </div>
</ div >
</ div >
< div class = " chat-message even " >
< div class = " chat-complete<?=!in_array( $event['user_id'] , $usersCanEdit ) ? ' hidden' : '' ?> " >
< div class = " complete-button " data - id = " <?= $event['id'] ?> " >
< input type = " checkbox " />
< div class = " complete-action-button-obj<?=( $event['calendar_view'] == 1) ? ' active' : ''?> " id = " groupAB__<?= $event['id'] ?> " title = " Выполнено " >
< span class = " check-button-box " ></ span >
< svg xmlns = " http://www.w3.org/2000/svg " xmlns : xlink = " http://www.w3.org/1999/xlink " version = " 1.1 " id = " Layer_1 " x = " 0px " y = " 0px " viewBox = " 0 0 512 512 " style = " enable-background:new 0 0 512 512; " xml : space = " preserve " width = " 512px " height = " 512px " >
< g >
< g >
< path d = " M505.943,79.594c-8.077-8.077-21.172-8.077-29.249,0L167.755,388.532L35.306,256.083c-8.076-8.077-21.172-8.077-29.248,0 c-8.077,8.077-8.077,21.172,0,29.249l147.074,147.074c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.625-6.059 l323.562-323.562C514.019,100.767,514.019,87.672,505.943,79.594z " fill = " #388e3c " />
</ g >
</ g >
</ svg >
</ div >
</ div >
</ div >
< div class = " chat-content " id = " chat_content_<?= $event['id'] ?> " >
< div class = " head " >< span >< ? = $event [ 'name' ] ?> </span></div>
< div class = " message " > Мероприятие состоится < ? = $d ?> <?=getRusMonth($m)?> <?=$y?> в <?=date("H:i", strtotime($event['schedule_date']))?></div>
< div class = " message " >< ? = $event [ 'comment' ] ?> </div>
< ? php {
if ( $event [ 'user_id' ] > 0 && isset ( $users [ $event [ 'user_id' ]])){ ?>
< br >< span class = " time " >< i title = " Ответственный " class = " ti-user " style = " margin-right: 5px " ></ i >
< ? = $users [ $event [ 'user_id' ]][ 'user_fio' ] ?>
</ span >
< ? php
}
} ?>
< span class = " time " >< ? = date ( " H:i " , strtotime ( $time_zone , strtotime ( $event [ 'create_date' ]))) ?> </span>
< ? php if ( $from_id == $_SESSION [ 'id' ] || $_SESSION [ 'id' ] == $agencyId || $_SESSION [ 'superadmin' ] == 1 ){ ?>
< div class = " message " style = " margin-top: 10px; " >
< a href = " javascript: { } " class = " no-border " onclick = " editEventObj('<?= $event['id'] ?>', '<?= $event['type'] ?>') " title = " Редактировать " >
< span class = " simple-button settings " >< i class = " jw-action-icon-settings " ></ i ></ span >
</ a >
< a href = " javascript: { } " class = " no-border " onclick = " deleteEvent('<?= $event['id'] ?>', 'objects') " title = " Удалить " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
</ div >
< ? php } ?>
</ div >
</ div >
< div class = " clear " ></ div >
</ div >
< ? php
}
if ( $event [ 'type' ] == 'comment' ) {
?>
< div class = " chat-block<?= $class_ev ?> " >
< div class = " chat-author " >
< div class = " pic " >
< ? php
if ( empty ( $event [ 'user_logo' ])){
?>
< img src = " /images/user-pic.svg " />
< ? php
} else {
?>
< img src = " /photos/agency/<?= $event['user_logo'] ?> " >
< ? php
}
?>
< div class = " fio_user " title = " <?= $event['user_fio'] ?> " >< ? = $event [ 'user_fio' ] ?> </div>
</ div >
</ div >
< div class = " chat-message " >
< div class = " chat-content " id = " chat_content_<?= $event['id'] ?> " >
< div class = " head " >< span > Примечание </ span ></ div >
< div class = " message " >< ? = $event [ 'comment' ] ?> </div>
< span class = " time " >< ? = date ( " H:i " , strtotime ( $time_zone , strtotime ( $event [ 'create_date' ]))) ?> </span>
< ? php if ( $from_id == $_SESSION [ 'id' ] || $_SESSION [ 'id' ] == $agencyId || $_SESSION [ 'superadmin' ] == 1 ){ ?>
< div class = " message " style = " margin-top: 10px; " >
< a href = " javascript: { } " class = " no-border " onclick = " editEventObj('<?= $event['id'] ?>', '<?= $event['type'] ?>') " title = " Редактировать " >
< span class = " simple-button settings " >< i class = " jw-action-icon-settings " ></ i ></ span >
</ a >
< a href = " javascript: { } " class = " no-border " onclick = " deleteEvent('<?= $event['id'] ?>', 'objects') " title = " Удалить " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
</ div >
< ? php } ?>
</ div >
</ div >
< div class = " clear " ></ div >
</ div >
< ? php
}
if ( $event [ 'type' ] == 'comment_moderation' ) {
?>
< div class = " chat-block<?= $class_ev ?> " >
< div class = " chat-author " >
< div class = " pic " >
< ? php
if ( empty ( $event [ 'user_logo' ])){
?>
< img src = " /images/user-pic.svg " />
< ? php
} else {
?>
< img src = " /photos/agency/<?= $event['user_logo'] ?> " >
< ? php
}
?>
< div class = " fio_user " title = " <?= $event['user_fio'] ?> " >< ? = $event [ 'user_fio' ] ?> </div>
</ div >
</ div >
< div class = " chat-message " >
< div class = " chat-content " id = " chat_content_<?= $event['id'] ?> " >
< div class = " head " >< span > Модератор подтвердил рекламу </ span ></ div >
< div class = " message " >< ? = $event [ 'comment' ] ?> </div>
< span class = " time " >< ? = date ( " H:i " , strtotime ( $time_zone , strtotime ( $event [ 'create_date' ]))) ?> </span>
<!--< ? php if ( $event [ 'user_id' ] == $_SESSION [ 'id' ]){ ?>
< div class = " message " style = " margin-top: 10px; " >
< a href = " javascript: { } " class = " no-border " onclick = " editEventObj('<?= $event['id'] ?>', '<?= $event['type'] ?>') " title = " Редактировать " >
< span class = " simple-button settings " >< i class = " jw-action-icon-settings " ></ i ></ span >
</ a >
< a href = " javascript: { } " class = " no-border " onclick = " deleteEvent('<?= $event['id'] ?>', 'objects') " title = " Удалить " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
</ div >
< ? php } ?> -->
</ div >
</ div >
< div class = " clear " ></ div >
</ div >
< ? php
}
if ( $event [ 'type' ] == 'call' ) {
$date = date ( " d.m.Y " , strtotime ( $event [ 'schedule_date' ]));
list ( $d , $m , $y ) = explode ( " . " , $date );
?>
< div class = " chat-block<?= $class_ev ?> " >
< div class = " chat-author " >
< div class = " pic " >
< ? php
if ( empty ( $event [ 'user_logo' ])){
?>
< img src = " /images/user-pic.svg " />
< ? php
} else {
?>
< img src = " /photos/agency/<?= $event['user_logo'] ?> " >
< ? php
}
?>
< div class = " fio_user " title = " <?= $event['user_fio'] ?> " >< ? = $event [ 'user_fio' ] ?> </div>
</ div >
</ div >
< div class = " chat-message call " >
< div class = " chat-complete<?=!in_array( $event['user_id'] , $usersCanEdit ) ? ' hidden' : '' ?> " >
< div class = " complete-button " data - id = " <?= $event['id'] ?> " >
< input type = " checkbox " />
< div class = " complete-action-button-obj<?=( $event['calendar_view'] == 1) ? ' active' : ''?> " id = " groupAB__<?= $event['id'] ?> " title = " Выполнено " >
< span class = " check-button-box " ></ span >
< svg xmlns = " http://www.w3.org/2000/svg " xmlns : xlink = " http://www.w3.org/1999/xlink " version = " 1.1 " id = " Layer_1 " x = " 0px " y = " 0px " viewBox = " 0 0 512 512 " style = " enable-background:new 0 0 512 512; " xml : space = " preserve " width = " 512px " height = " 512px " >
< g >
< g >
< path d = " M505.943,79.594c-8.077-8.077-21.172-8.077-29.249,0L167.755,388.532L35.306,256.083c-8.076-8.077-21.172-8.077-29.248,0 c-8.077,8.077-8.077,21.172,0,29.249l147.074,147.074c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.625-6.059 l323.562-323.562C514.019,100.767,514.019,87.672,505.943,79.594z " fill = " #388e3c " />
</ g >
</ g >
</ svg >
</ div >
</ div >
</ div >
< 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 ( $event [ 'comment' ]){ ?>
< div class = " message " > Комментарий : < ? = $event [ 'comment' ] ?> </div>
< ? php } ?>
< ? php if ( $event [ 'sub_comment' ]) { ?>
< div class = " message " > Комментарий к задаче :
< ? = $event [ 'sub_comment' ] ?> <span class="author">(<?= $event['sub_comment_author'] ?>)</span>
< ? php if ( $is_who_work ) { ?>
< a href = " javascript: { } "
class = " no-border "
onclick = " showEventSubComment('<?= $event['id'] ?>', 'objects', '<?= $event['object_id'] ?>') "
title = " Редактировать комментарий к задаче " >
< span class = " simple-button edit " >< i class = " jw-action-icon-edit-text " ></ i ></ span >
</ a >
< a href = " javascript: { } "
class = " no-border "
onclick = " deleteEventSubComment('<?= $event['id'] ?>', 'objects', '<?= $event['object_id'] ?>') "
title = " Удалить комментарий к задаче " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
< ? php } ?>
</ div >
< ? php } ?>
< ? php {
if ( $event [ 'user_id' ] > 0 && isset ( $users [ $event [ 'user_id' ]])){ ?>
< br >< span class = " time " >< i title = " Ответственный " class = " ti-user " style = " margin-right: 5px " ></ i >
< ? = $users [ $event [ 'user_id' ]][ 'user_fio' ] ?>
</ span >
< ? php
}
} ?>
< span class = " time " >< ? = date ( " H:i " , strtotime ( $time_zone , strtotime ( $event [ 'create_date' ]))) ?> </span>
< div class = " message " style = " margin-top: 10px; " >
< ? php if ( $from_id == $_SESSION [ 'id' ] || $_SESSION [ 'id' ] == $agencyId || $_SESSION [ 'superadmin' ] == 1 ){ ?>
< a href = " javascript: { } " class = " no-border " onclick = " editEventObj('<?= $event['id'] ?>', '<?= $event['type'] ?>') " title = " Редактировать " >
< span class = " simple-button settings " >< i class = " jw-action-icon-settings " ></ i ></ span >
</ a >
< a href = " javascript: { } " class = " no-border " onclick = " deleteEvent('<?= $event['id'] ?>', 'objects') " title = " Удалить " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
< ? php } ?>
< ? php if ( $is_who_work && empty ( $event [ 'sub_comment' ])) { ?>
< a href = " javascript: { } "
class = " no-border "
onclick = " showEventSubComment('<?= $event['id'] ?>', 'objects') "
title = " Добавить комментарий к задаче " >
< span class = " simple-button plus " >< i class = " jw-action-icon-plus " ></ i ></ span >
</ a >
< ? php } ?>
</ div >
</ div >
</ div >
< div class = " clear " ></ div >
</ div >
< ? php
}
if ( $event [ 'type' ] == 'meet' ) {
$date = date ( " d.m.Y " , strtotime ( $event [ 'schedule_date' ]));
list ( $d , $m , $y ) = explode ( " . " , $date );
?>
< div class = " chat-block<?= $class_ev ?> " >
< div class = " chat-author " >
< div class = " pic " >
< ? php
if ( empty ( $event [ 'user_logo' ])){
?>
< img src = " /images/user-pic.svg " />
< ? php
} else {
?>
< img src = " /photos/agency/<?= $event['user_logo'] ?> " >
< ? php
}
?>
< div class = " fio_user " title = " <?= $event['user_fio'] ?> " >< ? = $event [ 'user_fio' ] ?> </div>
</ div >
</ div >
< div class = " chat-message meeting " >
< div class = " chat-complete<?=!in_array( $event['user_id'] , $usersCanEdit ) ? ' hidden' : '' ?> " >
< div class = " complete-button " data - id = " <?= $event['id'] ?> " >
< input type = " checkbox " />
< div class = " complete-action-button-obj<?=( $event['calendar_view'] == 1) ? ' active' : ''?> " id = " groupAB__<?= $event['id'] ?> " title = " Выполнено " >
< span class = " check-button-box " ></ span >
< svg xmlns = " http://www.w3.org/2000/svg " xmlns : xlink = " http://www.w3.org/1999/xlink " version = " 1.1 " id = " Layer_1 " x = " 0px " y = " 0px " viewBox = " 0 0 512 512 " style = " enable-background:new 0 0 512 512; " xml : space = " preserve " width = " 512px " height = " 512px " >
< g >
< g >
< path d = " M505.943,79.594c-8.077-8.077-21.172-8.077-29.249,0L167.755,388.532L35.306,256.083c-8.076-8.077-21.172-8.077-29.248,0 c-8.077,8.077-8.077,21.172,0,29.249l147.074,147.074c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.625-6.059 l323.562-323.562C514.019,100.767,514.019,87.672,505.943,79.594z " fill = " #388e3c " />
</ g >
</ g >
</ svg >
</ div >
</ div >
</ div >
< 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 ( $event [ 'address' ]) { ?>
< div class = " message " > Адрес : < ? = $event [ 'address' ] ?> </div>
< ? php } if ( $event [ 'comment' ]) { ?>
< div class = " message " > Комментарий : < ? = $event [ 'comment' ] ?> </div>
< ? php } ?>
< ? php if ( $event [ 'sub_comment' ]) { ?>
< div class = " message " > Комментарий к задаче :
< ? = $event [ 'sub_comment' ] ?> <span class="author">(<?= $event['sub_comment_author'] ?>)</span>
< ? php if ( $is_who_work ) { ?>
< a href = " javascript: { } "
class = " no-border "
onclick = " showEventSubComment('<?= $event['id'] ?>', 'objects', '<?= $event['object_id'] ?>') "
title = " Редактировать комментарий к задаче " >
< span class = " simple-button edit " >< i class = " jw-action-icon-edit-text " ></ i ></ span >
</ a >
< a href = " javascript: { } "
class = " no-border "
onclick = " deleteEventSubComment('<?= $event['id'] ?>', 'objects', '<?= $event['object_id'] ?>') "
title = " Удалить комментарий к задаче " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
< ? php } ?>
</ div >
< ? php } ?>
< ? php {
if ( $event [ 'user_id' ] > 0 && isset ( $users [ $event [ 'user_id' ]])){ ?>
< br >< span class = " time " >< i title = " Ответственный " class = " ti-user " style = " margin-right: 5px " ></ i >
< ? = $users [ $event [ 'user_id' ]][ 'user_fio' ] ?>
</ span >
< ? php
}
} ?>
< span class = " time " >< ? = date ( " H:i " , strtotime ( $time_zone , strtotime ( $event [ 'create_date' ]))) ?> </span>
< div class = " message " style = " margin-top: 10px; " >
< ? php if ( $from_id == $_SESSION [ 'id' ] || $_SESSION [ 'id' ] == $agencyId || $_SESSION [ 'superadmin' ] == 1 ){ ?>
< a href = " javascript: { } " class = " no-border " onclick = " editEventObj('<?= $event['id'] ?>', '<?= $event['type'] ?>') " title = " Редактировать " >
< span class = " simple-button settings " >< i class = " jw-action-icon-settings " ></ i ></ span >
</ a >
< a href = " javascript: { } " class = " no-border " onclick = " deleteEvent('<?= $event['id'] ?>', 'objects') " title = " Удалить " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
< ? php } ?>
< ? php if ( $is_who_work && empty ( $event [ 'sub_comment' ])) { ?>
< a href = " javascript: { } "
class = " no-border "
onclick = " showEventSubComment('<?= $event['id'] ?>', 'objects') "
title = " Добавить комментарий к задаче " >
< span class = " simple-button plus " >< i class = " jw-action-icon-plus " ></ i ></ span >
</ a >
< ? php } ?>
</ div >
</ div >
</ div >
< div class = " clear " ></ div >
</ div >
< ? php
}
if ( $event [ 'type' ] == 'moderation' ) {
$date = date ( " d.m.Y " , strtotime ( $event [ 'schedule_date' ]));
list ( $d , $m , $y ) = explode ( " . " , $date );
?>
< div class = " chat-block<?= $class_ev ?> " >
< div class = " chat-author " >
< div class = " pic " >
< ? php
if ( empty ( $event [ 'user_logo' ])){
?>
< img src = " /images/user-pic.svg " />
< ? php
} else {
?>
< img src = " /photos/agency/<?= $event['user_logo'] ?> " >
< ? php
}
?>
< div class = " fio_user " title = " <?= $event['user_fio'] ?> " >< ? = $event [ 'user_fio' ] ?> </div>
</ div >
</ div >
< div class = " chat-message meeting " >
< div class = " chat-complete " >
< div class = " complete-button " data - id = " <?= $event['id'] ?> " >
< input type = " checkbox " />
< div class = " complete-action-button-obj<?=( $event['calendar_view'] == 1) ? ' active' : ''?> " id = " groupAB__<?= $event['id'] ?> " title = " Выполнено " >
< span class = " check-button-box " ></ span >
< svg xmlns = " http://www.w3.org/2000/svg " xmlns : xlink = " http://www.w3.org/1999/xlink " version = " 1.1 " id = " Layer_1 " x = " 0px " y = " 0px " viewBox = " 0 0 512 512 " style = " enable-background:new 0 0 512 512; " xml : space = " preserve " width = " 512px " height = " 512px " >
< g >
< g >
< path d = " M505.943,79.594c-8.077-8.077-21.172-8.077-29.249,0L167.755,388.532L35.306,256.083c-8.076-8.077-21.172-8.077-29.248,0 c-8.077,8.077-8.077,21.172,0,29.249l147.074,147.074c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.625-6.059 l323.562-323.562C514.019,100.767,514.019,87.672,505.943,79.594z " fill = " #388e3c " />
</ g >
</ g >
</ svg >
</ div >
</ div >
</ div >
< div class = " chat-content " id = " chat_content_<?= $event['id'] ?> " >
< div class = " head " >< span > Отправлен на модерацию </ span ></ div >
< ? php
$who_user = null ;
$sql_who = " SELECT CONCAT(last_name, ' ', first_name, ' ', middle_name) as who_fio FROM users WHERE id = { $event [ 'user_id' ] } " ;
$who_user = mysql_fetch_assoc ( mysql_query ( $sql_who ));
if ( $who_user ){ ?>
< div class = " message " >< span class = " author " > Ответственный : < ? = $who_user [ 'who_fio' ] ?> </span></div>
< ? php
}
?>
< div class = " message " > Провести модерацию < ? = $d ?> <?=getRusMonth($m)?> <?=$y?> в <?=date("H:i", strtotime($event['schedule_date']))?></div>
< ? php
if ( ! empty ( $event [ 'platforms_advert' ])){
$platforms_advert = json_decode ( $event [ 'platforms_advert' ]);
//var_dump($platforms_advert);
?>
< div class = " message " > Выбранные площадки :
< ? php
foreach ( $platforms_advert as $p_a ){
// var_dump($p_a->platform);
if ( $p_a -> platform == 'add_to_yandex_feed' ){ ?>
< br > Бесплатные
< ? php
if ( $p_a -> days ) echo ' ' . $p_a -> days ;
}
if ( $p_a -> platform == 'add_to_avito_feed' ){ ?>
< br > Авито
< ? php
if ( $p_a -> days ) echo ' ' . $p_a -> days ;
}
if ( $p_a -> platform == 'add_to_cian_feed' ){ ?>
< br > Циан
< ? php
if ( $p_a -> days ) echo ' ' . $p_a -> days ;
}
if ( $p_a -> platform == 'add_to_domclick_feed' ){ ?>
< br > ДомКлик
< ? php
if ( $p_a -> days ) echo ' ' . $p_a -> days ;
}
if ( $p_a -> platform == 'add_to_emls_feed' ){ ?>
< br > Jcat
< ? php
if ( $p_a -> days ) echo ' ' . $p_a -> days ;
}
if ( $p_a -> platform == 'add_to_bn_feed' ){ ?>
< br > Яндекс
< ? php
if ( $p_a -> days ) echo ' ' . $p_a -> days ;
}
}
?>
< div class = " clear " ></ div >
</ div >
< ? php
} else {
$sql_moderation = " SELECT * FROM objects_moderation_advert WHERE object_id = { $event [ 'object_id' ] } " ;
$q_moderation = mysql_query ( $sql_moderation );
$r_moderation = mysql_fetch_assoc ( $q_moderation );
if ( ! empty ( $r_moderation )){ ?>
< div class = " message " > Выбранные площадки :< br >
< ? php
if ( $r_moderation [ 'add_to_yandex_feed' ] > 0 ){ ?>
Бесплатные .
< ? php
}
if ( $r_moderation [ 'add_to_avito_feed' ] > 0 ){ ?>
Авито .
< ? php
}
if ( $r_moderation [ 'add_to_cian_feed' ] > 0 ){ ?>
Циан .
< ? php
}
if ( $r_moderation [ 'add_to_domclick_feed' ] > 0 ){ ?>
ДомКлик .
< ? php
}
if ( $r_moderation [ 'add_to_emls_feed' ] > 0 ){ ?>
Jcat .
< ? php
}
if ( $r_moderation [ 'add_to_bn_feed' ] > 0 ){ ?>
Яндекс .
< ? php
}
?>
< div class = " clear " ></ div >
</ div >
< ? php
}
}
?>
< ? php if ( $event [ 'comment' ]) { ?>
< div class = " message " > Комментарий : < ? = $event [ 'comment' ] ?> </div>
< ? php } ?>
< ? php if ( $event [ 'sub_comment' ]) { ?>
< div class = " message " > Комментарий к задаче :
< ? = $event [ 'sub_comment' ] ?> <span class="author">(<?= $event['sub_comment_author'] ?>)</span>
< ? php
if ( ! empty ( $event [ 'sub_comment_user_for' ])){
?>
Ответственный : < span class = " author " > ( < ? = $event [ 'sub_comment_user_for' ] ?> )</span>
< ? php
}
?>
< ? php if ( $is_who_work ) { ?>
< a href = " javascript: { } "
class = " no-border "
onclick = " showEventSubComment('<?= $event['id'] ?>', 'objects', 'moderation', '<?= $event['sub_id'] ?>') "
title = " Редактировать комментарий к задаче " >
< span class = " simple-button edit " >< i class = " jw-action-icon-edit-text " ></ i ></ span >
</ a >
< a href = " javascript: { } "
class = " no-border "
onclick = " deleteEventSubComment('<?= $event['id'] ?>', 'objects', '<?= $event['object_id'] ?>', '<?= $event['sub_id'] ?>') "
title = " Удалить комментарий к задаче " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
< ? php } ?>
</ div >
< ? php
//Для модераций проверяем есть ли ещё комментарии
$sql_sub = " SELECT id as sub_id, sub_comment,
IF ( s . created_by <> 0 , (
SELECT CONCAT ( u . last_name , ' ' , u . first_name , ' ' , u . middle_name )
FROM users as u WHERE u . id = s . created_by
), NULL
) as sub_comment_author ,
IF ( s . user_for <> 0 , (
SELECT CONCAT ( u . last_name , ' ' , u . first_name , ' ' , u . middle_name )
FROM users as u WHERE u . id = s . user_for
), NULL
) as sub_comment_user_for
FROM user_sub_comments as s WHERE
event_id = { $event [ 'id' ]} AND section_id = 1 AND id != { $event [ 'sub_id' ]} " ;
$q_sub = mysql_query ( $sql_sub );
while ( $sub_comment = mysql_fetch_assoc ( $q_sub )){
?>
< div class = " message " > Комментарий к задаче :
< ? = $sub_comment [ 'sub_comment' ] ?> <span class="author">(<?= $sub_comment['sub_comment_author'] ?>)</span>
< ? php
if ( ! empty ( $sub_comment [ 'sub_comment_user_for' ])){
?>
Ответственный : < span class = " author " > ( < ? = $sub_comment [ 'sub_comment_user_for' ] ?> )</span>
< ? php
}
?>
< ? php if ( $is_who_work ) { ?>
< a href = " javascript: { } "
class = " no-border "
onclick = " showEventSubComment('<?= $event['id'] ?>', 'objects', 'moderation', '<?= $sub_comment['sub_id'] ?>') "
title = " Редактировать комментарий к задаче " >
< span class = " simple-button edit " >< i class = " jw-action-icon-edit-text " ></ i ></ span >
</ a >
< a href = " javascript: { } "
class = " no-border "
onclick = " deleteEventSubComment('<?= $event['id'] ?>', 'objects', '<?= $event['object_id'] ?>' , '<?= $sub_comment['sub_id'] ?>') "
title = " Удалить комментарий к задаче " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
< ? php } ?>
</ div >
< ? php
}
}
?>
< span class = " time " >< ? = date ( " H:i " , strtotime ( $time_zone , strtotime ( $event [ 'create_date' ]))) ?> </span>
< div class = " message " style = " margin-top: 10px; " >
< ? php if ( $from_id == $_SESSION [ 'id' ] || $_SESSION [ 'id' ] == $agencyId || $_SESSION [ 'superadmin' ] == 1 ){ ?>
< a href = " javascript: { } " class = " no-border " onclick = " editEventObj('<?= $event['id'] ?>', '<?= $event['type'] ?>', '<?= $event['sub_id'] ?>') " title = " Редактировать " >
< span class = " simple-button settings " >< i class = " jw-action-icon-settings " ></ i ></ span >
</ a >
< a href = " javascript: { } " class = " no-border " onclick = " deleteEvent('<?= $event['id'] ?>', 'objects', '<?= $event['sub_id'] ?>') " title = " Удалить " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
< ? php } ?>
< ? php if ( $is_who_work ) { ?>
< a href = " javascript: { } "
class = " no-border "
onclick = " showEventSubComment('<?= $event['id'] ?>', 'objects', 'moderation') "
title = " Добавить комментарий к задаче " >
< span class = " simple-button plus " >< i class = " jw-action-icon-plus " ></ i ></ span >
</ a >
< ? php } ?>
</ div >
</ div >
</ div >
< div class = " clear " ></ div >
</ div >
< ? php
}
if ( $event [ 'type' ] == 'show' ) {
$date = date ( " d.m.Y " , strtotime ( $event [ 'schedule_date' ]));
list ( $d , $m , $y ) = explode ( " . " , $date );
if ( $event [ 'req_id' ] > 0 ){
$name_req = $pdo -> result ( $pdo -> query ( " SELECT name FROM requisitions WHERE id = { $event [ 'req_id' ] } " ));
}
?>
< div class = " chat-block<?= $class_ev ?> " >
< div class = " chat-author " >
< div class = " pic " >
< ? php
if ( empty ( $event [ 'user_logo' ])){
?>
< img src = " /images/user-pic.svg " />
< ? php
} else {
?>
< img src = " /photos/agency/<?= $event['user_logo'] ?> " >
< ? php
}
?>
< div class = " fio_user " title = " <?= $event['user_fio'] ?> " >< ? = $event [ 'user_fio' ] ?> </div>
</ div >
< div ></ div >
</ div >
< div class = " chat-message showing " >
< div class = " chat-complete<?=!in_array( $event['user_id'] , $usersCanEdit ) ? ' hidden' : '' ?> " >
< div class = " complete-button " data - id = " <?= $event['id'] ?> " >
< input type = " checkbox " />
< div class = " complete-action-button-obj<?=( $event['calendar_view'] == 1) ? ' active' : ''?> " id = " groupAB__<?= $event['id'] ?> " title = " Выполнено " >
< span class = " check-button-box " ></ span >
< svg xmlns = " http://www.w3.org/2000/svg " xmlns : xlink = " http://www.w3.org/1999/xlink " version = " 1.1 " id = " Layer_1 " x = " 0px " y = " 0px " viewBox = " 0 0 512 512 " style = " enable-background:new 0 0 512 512; " xml : space = " preserve " width = " 512px " height = " 512px " >
< g >
< g >
< path d = " M505.943,79.594c-8.077-8.077-21.172-8.077-29.249,0L167.755,388.532L35.306,256.083c-8.076-8.077-21.172-8.077-29.248,0 c-8.077,8.077-8.077,21.172,0,29.249l147.074,147.074c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.625-6.059 l323.562-323.562C514.019,100.767,514.019,87.672,505.943,79.594z " fill = " #388e3c " />
</ g >
</ g >
</ svg >
</ div >
</ div >
</ div >
< 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 ( $event [ 'address' ]) { ?>
< div class = " message " > Адрес : < ? = $event [ 'address' ] ?> </div>
< ? php } if ( $event [ 'req_id' ] > 0 && isset ( $name_req )){ ?>
< div class = " message " > Подключена заявка : < a href = " javascript: { } " onclick = " openClientEventsWindowNew(0, 0, 0, <?= $event['req_id'] ?>); " >< ? = $name_req ?> </a></div>
< ? php }
if ( $event [ 'comment' ]) { ?>
< div class = " message " > Комментарий : < ? = $event [ 'comment' ] ?> </div>
< ? php } ?>
< ? php if ( $event [ 'sub_comment' ]) { ?>
< div class = " message " > Комментарий к задаче :
< ? = $event [ 'sub_comment' ] ?> <span class="author">(<?= $event['sub_comment_author'] ?>)</span>
< ? php if ( $is_who_work ) { ?>
< a href = " javascript: { } "
class = " no-border "
onclick = " showEventSubComment('<?= $event['id'] ?>', 'objects', '<?= $event['object_id'] ?>') "
title = " Редактировать комментарий к задаче " >
< span class = " simple-button edit " >< i class = " jw-action-icon-edit-text " ></ i ></ span >
</ a >
< a href = " javascript: { } "
class = " no-border "
onclick = " deleteEventSubComment('<?= $event['id'] ?>', 'objects', '<?= $event['object_id'] ?>') "
title = " Удалить комментарий к задаче " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
< ? php } ?>
</ div >
< ? php } ?>
< ? php {
if ( $event [ 'user_id' ] > 0 && isset ( $users [ $event [ 'user_id' ]])){ ?>
< br >< span class = " time " >< i title = " Ответственный " class = " ti-user " style = " margin-right: 5px " ></ i >
< ? = $users [ $event [ 'user_id' ]][ 'user_fio' ] ?>
</ span >
< ? php
}
} ?>
< span class = " time " >< ? = date ( " H:i " , strtotime ( $time_zone , strtotime ( $event [ 'create_date' ]))) ?> </span>
< div class = " message " style = " margin-top: 10px; " >
< ? php if ( $from_id == $_SESSION [ 'id' ] || $_SESSION [ 'id' ] == $agencyId || $_SESSION [ 'superadmin' ] == 1 ){ ?>
< a href = " javascript: { } " class = " no-border " onclick = " editEventObj('<?= $event['id'] ?>', '<?= $event['type'] ?>') " title = " Редактировать " >
< span class = " simple-button settings " >< i class = " jw-action-icon-settings " ></ i ></ span >
</ a >
< a href = " javascript: { } " class = " no-border " onclick = " deleteEvent('<?= $event['id'] ?>', 'objects') " title = " Удалить " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
< ? php } ?>
< ? php if ( $is_who_work && empty ( $event [ 'sub_comment' ])) { ?>
< a href = " javascript: { } "
class = " no-border "
onclick = " showEventSubComment('<?= $event['id'] ?>', 'objects') "
title = " Добавить комментарий к задаче " >
< span class = " simple-button plus " >< i class = " jw-action-icon-plus " ></ i ></ span >
</ a >
< ? php } ?>
</ div >
</ div >
</ div >
< div class = " clear " ></ div >
</ div >
< ? php
}
if ( $event [ 'type' ] == 'deal' ) {
$date = date ( " d.m.Y " , strtotime ( $event [ 'schedule_date' ]));
list ( $d , $m , $y ) = explode ( " . " , $date );
2026-06-22 13:01:56 +02:00
$deal_id_for_edit = ! empty ( $event [ 'deal_id' ]) ? intval ( $event [ 'deal_id' ]) : null ;
2026-05-22 20:21:54 +02:00
?>
< div class = " chat-block<?= $class_ev ?> " >
2026-06-22 13:01:56 +02:00
< div class = " chat-author " >
2026-05-22 20:21:54 +02:00
< div class = " pic " >
< ? php
if ( empty ( $event [ 'user_logo' ])){
?>
< img src = " /images/user-pic.svg " />
< ? php
} else {
?>
< img src = " /photos/agency/<?= $event['user_logo'] ?> " >
< ? php
}
?>
< div class = " fio_user " title = " <?= $event['user_fio'] ?> " >< ? = $event [ 'user_fio' ] ?> </div>
</ div >
</ div >
2026-06-22 13:01:56 +02:00
< div class = " chat-message deal <?=( $event['cancel'] ==1) ? 'cancel' : ''?> " >
< ? php if ( ! $deal_id_for_edit ) { ?>
2026-05-22 20:21:54 +02:00
< div class = " chat-complete<?=!in_array( $event['user_id'] , $usersCanEdit ) ? ' hidden' : '' ?> " >
< div class = " complete-button " data - id = " <?= $event['id'] ?> " >
< input type = " checkbox " />
< div class = " complete-action-button-obj<?=( $event['calendar_view'] == 1) ? ' active' : ''?> " id = " groupAB__<?= $event['id'] ?> " title = " Выполнено " >
< span class = " check-button-box " ></ span >
< svg xmlns = " http://www.w3.org/2000/svg " xmlns : xlink = " http://www.w3.org/1999/xlink " version = " 1.1 " id = " Layer_1 " x = " 0px " y = " 0px " viewBox = " 0 0 512 512 " style = " enable-background:new 0 0 512 512; " xml : space = " preserve " width = " 512px " height = " 512px " >
< g >
< g >
< path d = " M505.943,79.594c-8.077-8.077-21.172-8.077-29.249,0L167.755,388.532L35.306,256.083c-8.076-8.077-21.172-8.077-29.248,0 c-8.077,8.077-8.077,21.172,0,29.249l147.074,147.074c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.625-6.059 l323.562-323.562C514.019,100.767,514.019,87.672,505.943,79.594z " fill = " #388e3c " />
</ g >
</ g >
</ svg >
</ div >
</ div >
</ div >
2026-06-22 13:01:56 +02:00
< ? php } ?>
2026-05-22 20:21:54 +02:00
< 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>
2026-06-22 13:01:56 +02:00
< ? 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 } ?>
2026-05-22 20:21:54 +02:00
< ? php } if ( $event [ 'comment' ]) { ?>
< div class = " message " > Комментарий : < ? = $event [ 'comment' ] ?> </div>
< ? php } if ( $event [ 'sub_comment' ]) { ?>
< div class = " message " > Комментарий к задаче :
< ? = $event [ 'sub_comment' ] ?> <span class="author">(<?= $event['sub_comment_author'] ?>)</span>
< ? php if ( $is_who_work ) { ?>
< a href = " javascript: { } "
class = " no-border "
onclick = " showEventSubComment('<?= $event['id'] ?>', 'objects', '<?= $event['object_id'] ?>') "
title = " Редактировать комментарий к задаче " >
< span class = " simple-button edit " >< i class = " jw-action-icon-edit-text " ></ i ></ span >
</ a >
< a href = " javascript: { } "
class = " no-border "
onclick = " deleteEventSubComment('<?= $event['id'] ?>', 'objects', '<?= $event['object_id'] ?>') "
title = " Удалить комментарий к задаче " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
< ? php } ?>
</ div >
< ? php } if ( $event [ 'document_id' ]) {
$doc_id = $event [ 'document_id' ];
$doc = Docs :: getInnerDoc ( null , $doc_id );
if ( isset ( $doc [ 'params' ])) {
if ( $params = json_decode ( $doc [ 'params' ], true )) {
if (( $params [ 'client_id' ] || isset ( $params [ 'client_ids' ])) && $params [ 'object_id' ]) {
$doc_parties = '' ;
if ( isset ( $params [ 'client_ids' ])) {
//var_dump($params['client_ids']);
$client_ids = json_decode ( html_entity_decode ( $params [ 'client_ids' ]));
$sql_cls = " SELECT id, fio, phone, email FROM `clients` WHERE `id` in ( " . implode ( ',' , $client_ids ) . " ) " ;
$rez_cls = mysql_query ( $sql_cls );
while ( $doc_cls = mysql_fetch_assoc ( $rez_cls )) {
mask_client_contacts_inplace ( $doc_cls );
$cls_contacts = [];
if ( $doc_cls [ 'email' ])
$cls_contacts [] = $doc_cls [ 'email' ];
if ( $doc_cl [ 'phone' ])
$cls_contacts [] = $doc_cls [ 'phone' ];
$doc_parties .= '<li>Клиент: <a href="javascript:{}" data-id="' . $doc_cls [ 'id' ] . '" class="neweditClient">' . $doc_cls [ 'fio' ] . (( ! empty ( $cls_contacts )) ? ' (' . implode ( ', ' , $cls_contacts ) . ')' : '' ) . '</a><li/>' ;
}
}
if ( isset ( $params [ 'client_id' ]) && ( ! isset ( $client_ids ) || empty ( $client_ids ))) {
$sql_cl = " SELECT id, fio, phone, email FROM `clients` WHERE `id` = ' $params[client_id] ' LIMIT 1 " ;
$rez_cl = mysql_query ( $sql_cl );
if ( $doc_cl = mysql_fetch_assoc ( $rez_cl )) {
mask_client_contacts_inplace ( $doc_cl );
$cl_contacts = [];
if ( $doc_cl [ 'email' ])
$cl_contacts [] = $doc_cl [ 'email' ];
if ( $doc_cl [ 'phone' ])
$cl_contacts [] = $doc_cl [ 'phone' ];
$doc_parties .= '<li>Клиент: <a href="javascript:{}" data-id="' . $doc_cl [ 'id' ] . '" data-object="' . $params [ 'object_id' ] . '" class="show_client">' . $doc_cl [ 'fio' ] . (( ! empty ( $cl_contacts )) ? ' (' . implode ( ', ' , $cl_contacts ) . ')' : '' ) . '</a><li/>' ;
}
}
if ( isset ( $params [ 'object_id' ])) {
$sql_obj = " SELECT id, nazv, adres FROM `objects` WHERE `id` = ' $params[object_id] ' LIMIT 1 " ;
$rez_obj = mysql_query ( $sql_obj );
if ( $doc_obj = mysql_fetch_assoc ( $rez_obj )) {
$doc_parties .= '<li>Объект: <a href="javascript:{}" data-id="' . $doc_obj [ 'id' ] . '" data-client="' . $params [ 'client_id' ] . '" class="show_object">' . $doc_obj [ 'nazv' ] . ' (' . $doc_obj [ 'adres' ] . ')</a><li/>' ;
}
}
if ( ! empty ( $doc_parties )) { ?>
< div class = " message parties " > Стороны сделки :< br />< ul >< ? = $doc_parties ; ?> </ul></div>
< ? php }
}
}
}
if ( isset ( $doc [ 'id' ]) && isset ( $doc [ 'name' ])) {
?>
< div class = " document " data - id = " <?= $doc['id'] ; ?> " >
Документ :
< a href = " javascript: { } " class = " no-border pull-right " >
< span class = " jw__small-popup ti-more " data - id = " document_<?= $doc['id'] ; ?> " ></ span >
< div class = " jw__popup actions-document " id = " popup__document_<?= $doc['id'] ; ?> " >
< div class = " actions-document__inner " >
< a href = " javascript: { } " onclick = " previewInnerDoc(<?= $doc['id'] ; ?>) " > Предпросмотр </ a >
< a href = " javascript: { } " onclick = " editInnerDoc(<?= $doc['id'] ; ?>) " > Редактировать </ a >
< a href = " javascript: { } " onclick = " sendInnerDocWin(<?= $doc['id'] ; ?>) " > Отправить </ a >
< a href = " javascript: { } " onclick = " confirmDeleteInnerDoc(<?= $doc['id'] ; ?>) " > Удалить </ a >
</ div >
</ div >
</ a >< br />
< ul >
< li >
< a title = " Скачать файл " download = " " href = " /ajax/getInnerDoc.php?id=<?= $doc['id'] ; ?>&download_pdf=true&t=<?= time(); ?> " >
< span class = " file-span ti-file " ></ span >
< span class = " file-name " data - id = " <?= $doc['id'] ; ?> " >< ? = $doc [ 'name' ]; ?> .pdf</span>
</ a >
</ li >
</ ul >
</ div >
< ? php }
} ?>
< ? php {
if ( $event [ 'user_id' ] > 0 && isset ( $users [ $event [ 'user_id' ]])){ ?>
< br >< span class = " time " >< i title = " Ответственный " class = " ti-user " style = " margin-right: 5px " ></ i >
< ? = $users [ $event [ 'user_id' ]][ 'user_fio' ] ?>
</ span >
< ? php
}
} ?>
< span class = " time " >< ? = date ( " H:i " , strtotime ( $time_zone , strtotime ( $event [ 'create_date' ]))) ?> </span>
< div class = " message " style = " margin-top: 10px; " >
< ? php if ( $from_id == $_SESSION [ 'id' ] || $_SESSION [ 'id' ] == $agencyId || $_SESSION [ 'superadmin' ] == 1 ) { ?>
< a href = " javascript: { } " class = " no-border " onclick = " editEventObj('<?= $event['id'] ?>', '<?= $event['type'] ?>') " title = " Редактировать " >
< span class = " simple-button settings " >< i class = " jw-action-icon-settings " ></ i ></ span >
</ a >
< a href = " javascript: { } " class = " no-border " onclick = " deleteEvent('<?= $event['id'] ?>', 'objects') " title = " Удалить " >
< span class = " simple-button delete " >< i class = " jw-action-icon-delete " ></ i ></ span >
</ a >
< ? php } ?>
< ? php if ( $is_who_work && empty ( $event [ 'sub_comment' ])) { ?>
< a href = " javascript: { } "
class = " no-border "
onclick = " showEventSubComment('<?= $event['id'] ?>', 'objects') "
title = " Добавить комментарий к задаче " >
< span class = " simple-button plus " >< i class = " jw-action-icon-plus " ></ i ></ span >
</ a >
< ? php } ?>
</ div >
</ div >
</ div >
< div class = " clear " ></ div >
</ div >
< ? php }
if ( $is_who_work && in_array ( $event [ 'type' ], [ 'meet' , 'show' , 'call' , 'deal' , 'moderation' ])) { ?>
< div class = " hidden_opis " id = " addEventSubComment_<?php echo $event['id'] ; ?> " style = " right: 1.5rem; bottom: 1.5rem;height:auto;z-index:1111; " >
< div class = " sub_comment_who_work " style = " display:none; " >
< label style = " display: inline-block; font-size: 1rem; margin-bottom: 0.5rem; " > Ответственные </ label >
< div id = " sub_comment_who_work_input_<?= $event['id'] ?> " >
< img src = " ../images/rocket-spinner.svg " width = " 45px " >
</ div >
</ div >
< label style = " display: inline-block; font-size: 1rem; margin-bottom: 0.5rem; " >
Комментарий к задаче
< span >
< ? php switch ( $event [ 'type' ]) {
case 'show' ;
echo " о Показе " ;
break ;
case 'deal' ;
echo " о Сделке " ;
break ;
case 'meet' ;
echo " о Встрече " ;
break ;
case 'call' ;
echo " о Звонке " ;
break ;
case 'moderation' ;
echo " о Модерации " ;
break ;
} ?>
</ span >
</ label >
< textarea id = " sub_comment_<?php echo $event['id'] ; ?> " style = " overflow-y: auto; height: 106px; min-height: 106px; " >< ? php echo $event [ 'sub_comment' ]; ?> </textarea>
< button class = " fr-btn edit-btn steel close " style = " line-height: normal; " onclick = " showEventSubComment('<?= $event['id'] ?>', 'objects') " > Закрыть </ button >
< button class = " fr-btn edit-btn steel save " style = " line-height: normal; margin-right: 0.5rem; " onclick = " addEventSubComment('<?= $event['id'] ?>', 'objects', '<?= $event['object_id'] ?>', '<?= $event['req_id'] ?>', '<?= $event['type'] ?>') " data - sub = " " data - id = " <?php echo $event['id'] ; ?> " > Сохранить </ button >
</ div >
< ? php }
}
}