2026-05-22 20:21:54 +02:00
< ? php
require_once ( $_SERVER [ 'DOCUMENT_ROOT' ] . " /config.php " );
if ( ! $_SESSION [ 'id' ]) { header ( " location:index.php " ); die ( " Доступ запрещён! " );}
$get = clearInputData ( $_GET );
require ( $_SERVER [ 'DOCUMENT_ROOT' ] . " /templates/new-header.php " );
$cl = new Clients ;
if ( ! $_SESSION [ 'clients_list_view' ] && ! $_SESSION [ 'kanban' ] && ! $_SESSION [ 'clients_table_view' ]) {
$_SESSION [ 'clients_list_view' ] = 1 ;
}
if ( ! $_SESSION [ 'clients_table_view' ]) {
unset ( $_SESSION [ 'clients_table_fields' ]);
}
$user_view = null ;
$idAgentForView = null ;
$idManagerForView = null ;
$_SESSION [ 'event_id_temp' ] = rand ( 10000000 , 99999999 );
$_SESSION [ 'event_id_temp' ] *= - 1 ;
if ( $get [ 'filter_partner' ])
$_SESSION [ 'filter_partner' ] = json_encode ( explode ( ',' , trim ( $get [ 'filter_partner' ])));
else
unset ( $_SESSION [ 'filter_partner' ]);
?>
< script type = " text/javascript " src = " /js/vue-multiselect.min.js " ></ script >
< script type = " text/javascript " src = " /js/vue-simple-progress.min.js " ></ script >
< script type = " text/javascript " src = " /js/vuejs-datepicker.min.js " ></ script >
< script src = " /js/locale/translations/ru.js " ></ script >
< link rel = " stylesheet " href = " /css/vue-multiselect.min.css " >
< link rel = " stylesheet " href = " /css/funnel.css?v=<?=filemtime( $_SERVER['DOCUMENT_ROOT'] .'/css/funnel.css')?> " >
< link rel = " stylesheet " href = " /css/all.min.css " >
< script type = " text/javascript " src = " /js/vue-select.js?v=21 " ></ script >
< link rel = " stylesheet " href = " /css/vue-select.css?v=21 " >
< style >
. completed {
border : 2 px solid #43a047;
font - size : 12 px ;
padding : 2 px 6 px 3 px ;
border - radius : 4 px ;
}
. deleted {
border : 2 px solid #EE6161;
font - size : 12 px ;
padding : 2 px 6 px 3 px ;
border - radius : 4 px ;
}
. modal - warning - already - in - work {
position : fixed ;
top : 0 ;
left : 0 ;
width : 100 % ;
height : 100 % ;
background - color : rgba ( 0 , 0 , 0 , 0.7 );
z - index : 10000 ;
display : flex ;
justify - content : center ;
align - items : center ;
}
. modal - warning - already - in - work . modal - content {
background : white ;
padding : 50 px ;
border - radius : 5 px ;
max - width : 1000 px ;
text - align : center ;
position : relative ;
font - size : 20 px ;
}
. modal - warning - already - in - work . close - modal {
position : absolute ;
top : 5 px ;
right : 10 px ;
font - size : 20 px ;
cursor : pointer ;
}
. modal - warning - already - in - work . ok - button {
margin - top : 15 px ;
padding : 10 px 25 px ;
background : #4CAF50;
color : white ;
border : none ;
border - radius : 3 px ;
cursor : pointer ;
font - size : 20 px ;
}
</ style >
< div class = " content-right " style = " min-height: 100%; " >
< div class = " inner " >
< div class = " main-title " >
< input type = " hidden " value = " <?= $_SESSION['to_send'] ?> " id = " session_to_send " />
< h1 > Клиенты </ h1 >
</ div >
< div class = " crm new " >
< div class = " crm__filters " >
< div class = " crm__filters-inner " >
< div class = " search-query " >
< div class = " search-query-item crm_clients " >
< span > 0 опций </ span >
< i class = " ti-close " ></ i >
</ div >
</ div >
< div class = " search-filter client_filter " >
< ? php
if ( isset ( $_GET [ 'id_agent' ])) unset ( $_SESSION [ 'client_search' ]);
$search = " " ; if ( isset ( $_SESSION [ 'client_search' ]) && ! empty ( $_SESSION [ 'client_search' ])) $search = $_SESSION [ 'client_search' ]; ?>
< input type = " text " tabindex = " 1 " value = " <?= $search ?> " name = " search " placeholder = " Фильтр и поиск " class = " search-filter__filter " id = " search_filter_input " autocomplete = " off " >
< div class = " search-filter__icons " >
< i class = " filtrClient ti-search " title = " Искать по всем воронкам " ></ i >
< i class = " filtrClient ti-close " title = " Очистить " ></ i >
</ div >
</ div >
< div class = " crm__new-client " >
< button class = " jw__g-button add_client_new " > Добавить </ button >
</ div >
< ? php
$searchUserId = $_SESSION [ 'id' ];
$sql_check_permissions = " SELECT `menu_all_clients_export` FROM user_permissions WHERE user_id = ' $searchUserId ' " ;
$q_check_permissions = mysql_query ( $sql_check_permissions );
$r_check_permissions = mysql_fetch_assoc ( $q_check_permissions );
?>
< ? php if ( $_SESSION [ 'agency' ] || $r_check_permissions [ 'menu_all_clients_export' ] == 1 || ( $_SESSION [ 'users_admin' ] && $r_check_permissions [ 'menu_all_clients_export' ] != 1 )) { ?>
< div style = " margin-left: 20px; margin-top: 3px; " class = " crm__new-client " >
< a href = " /get_excel.php " target = " _blank " class = " jw__g-button " > Экспорт в Excel </ a >
</ div >
< ? php }
$viewPage = $viewPageMain = 'list' ;
$sql_view = " SELECT * FROM user_views_page WHERE user_id = { $_SESSION [ 'id' ] } " ;
$q_view = mysql_query ( $sql_view );
if ( mysql_num_rows ( $q_view ) > 0 ){
$r_view = mysql_fetch_assoc ( $q_view );
$viewPage = ( ! empty ( $r_view [ 'view_client' ])) ? $r_view [ 'view_client' ] : 'list' ;
$viewPageMain = ( ! empty ( $r_view [ 'view_client' ])) ? $r_view [ 'view_client' ] : 'list' ;
} else {
if ( isset ( $_SESSION [ 'clients_table_view' ])){
$viewPage = 'table' ;
$viewPageMain = 'table' ;
} else if ( isset ( $_SESSION [ 'clients_list_view' ])){
$viewPage = 'list' ;
} else if ( isset ( $_SESSION [ 'kanban' ])){
$viewPage = 'kanban' ;
$viewPageMain = 'kanban' ;
}
}
//формируем данные по воронке
$isStage = true ;
$funnelId = isset ( $_GET [ 'funnelId' ]) ? $_GET [ 'funnelId' ] : null ;
if ( $user -> agencyId != 6841 && $user -> agencyId != 6426 && $user -> agencyId != 7384 && $user -> agencyId != 7478 && $user -> agencyId != 8353 && $user -> agencyId != 8867 && $user -> agencyId != 9588 ) {
$useCustomFunnel = true ;
} else {
$useCustomFunnel = false ;
}
$sqlCastom = " SELECT id, is_client, is_stage FROM funnel_default WHERE agency_id = { $user -> agencyId } " ;
$qCastom = mysql_query ( $sqlCastom );
if ( mysql_num_rows ( $qCastom ) > 0 ){
$rCastom = mysql_fetch_assoc ( $qCastom );
if ( $rCastom [ 'is_stage' ] == 0 ) $isStage = false ;
if ( $rCastom [ 'is_client' ] == 0 ) $useCustomFunnel = false ;
}
if ( $funnelId == null ) {
if ( $useCustomFunnel ) {
$funnelId = 0 ;
} else {
$funnelsData = mysql_query ( " select * from funnel WHERE agency_id = { $user -> agencyId } and is_client = 1 and deleted=0 order by order_number desc, id " );
while ( $funnel = mysql_fetch_assoc ( $funnelsData )){
$funnelId = $funnel [ 'id' ];
break ;
}
}
}
if ( $funnelId == null ) {
$funnelId = 0 ;
}
if ( $funnelId == 0 && ! $isStage && $viewPage == 'kanban' ){
$viewPageMain = 'list' ;
}
?>
< div class = " view-changer " >
< div class = " view-list <?= ( $viewPageMain == 'list') ? 'active' : '' ?> " >
< div title = " Выбрать вид отображения по умолчанию " class = " jw__group-action-button " onclick = " view_changer_client('list') " >
< input type = " checkbox " id = " view_changer_client_list " class = " view_changer_client " data - view = " list " < ? = ( $viewPage == 'list' ) ? 'checked' : '' ?> >
< div class = " group-action-button item-for-check <?= ( $viewPage == 'list') ? 'active' : '' ?> " id = " view_checked_client_list " >
< span class = " check-button-box " ></ span >
< span class = " check " ></ span >
</ div >
</ div >
< a href = " javascript: { } " >
< 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 " xml : space = " preserve " >< g >< g >< path d = " M0,74.672V224h512V74.672H0z M496,208H16V90.672h480V208z " fill = " #757575 " /></ g ></ g >< g >< g >< path d = " M0,288v149.328h512V288H0z M496,421.328H16V304h480V421.328z " fill = " #757575 " /></ g ></ g ></ svg >
< span > Список </ span >
</ a >
</ div >
< div class = " view-kanban <?=( $funnelId == 0 && ! $isStage ) ? 'hidden' : ''?> <?= ( $viewPageMain == 'kanban') ? 'active' : '' ?> " >
< div title = " Выбрать вид отображения по умолчанию " class = " jw__group-action-button " onclick = " view_changer_client('kanban') " >
< input type = " checkbox " id = " view_changer_client_kanban " class = " view_changer_client " data - view = " kanban " < ? = ( $viewPage == 'kanban' ) ? 'checked' : '' ?> >
< div class = " group-action-button item-for-check <?= ( $viewPage == 'kanban') ? 'active' : '' ?> " id = " view_checked_client_kanban " >
< span class = " check-button-box " ></ span >
< span class = " check " ></ span >
</ div >
</ div >
< a href = " javascript: { } " >
< 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 " xml : space = " preserve " >< g >< g >< path d = " M0,96v128h128V96H0z M112,208H16v-96h96V208z " fill = " #757575 " /></ g ></ g >< g >< g >< path d = " M192,96v128h128V96H192z M304,208h-96v-96h96V208z " fill = " #757575 " /></ g ></ g >< g >< g >< path d = " M384,96v128h128V96H384z M496,208h-96v-96h96V208z " fill = " #757575 " /></ g ></ g >< g >< g >< path d = " M0,288v128h128V288H0z M112,400H16v-96h96V400z " fill = " #757575 " /></ g ></ g >< g >< g >< path d = " M192,288v128h128V288H192z M304,400h-96v-96h96V400z " fill = " #757575 " /></ g ></ g >< g >< g >< path d = " M384,288v128h128V288H384z M496,400h-96v-96h96V400z " fill = " #757575 " /></ g ></ g ></ svg >
< span > Канбан </ span >
</ a >
</ div >
< div class = " view-table <?= ( $viewPageMain == 'table') ? 'active' : '' ?> " >
< div title = " Выбрать вид отображения по умолчанию " class = " jw__group-action-button " onclick = " view_changer_client('table') " data - view = " table " >
< input type = " checkbox " id = " view_changer_client_table " class = " view_changer_client " < ? = ( $viewPage == 'table' ) ? 'checked' : '' ?> >
< div class = " group-action-button item-for-check <?= ( $viewPage == 'table') ? 'active' : '' ?> " id = " view_checked_client_table " >
< span class = " check-button-box " ></ span >
< span class = " check " ></ span >
</ div >
</ div >
< a href = " javascript: { } " >
< 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 " xml : space = " preserve " >< g >< g >< path d = " M0,74.672V224h512V74.672H0z M496,208H16V90.672h480V208z " fill = " #757575 " /></ g ></ g >< g >< g >< path d = " M0,288v128h128V288H0z M112,400H16v-96h96V400z " fill = " #757575 " /></ g ></ g >< g >< g >< path d = " M192,288v128h128V288H192z M304,400h-96v-96h96V400z " fill = " #757575 " /></ g ></ g >< g >< g >< path d = " M384,288v128h128V288H384z M496,400h-96v-96h96V400z " fill = " #757575 " /></ g ></ g ></ svg >
< span > Таблица </ span >
</ a >
</ div >
</ div >
</ div >
< div class = " crm__filter-popup " >
< span class = " pseudo-link closer " >< i class = " ti-close " ></ i ></ span >
< div class = " filter-popup-items " >
< div class = " filter-popup__left " id = " crm_filter_left " >
< ? php
// if(!isset($_GET['page'])){
if ( isset ( $_GET [ 'id_agent' ])){
$_SESSION [ 'filter_stage_work' ] = 1 ;
unset ( $_SESSION [ 'filter_stage_hot' ]);
unset ( $_SESSION [ 'filter_stage_close' ]);
unset ( $_SESSION [ 'filter_stage_hit' ]);
unset ( $_SESSION [ 'filter_confirm' ]);
unset ( $_SESSION [ 'filter_stage_send' ]);
unset ( $_SESSION [ 'filter_work_ahency' ]);
}
if ( isset ( $_GET [ 'filter_stage' ])){
unset ( $_SESSION [ 'filter_stage_work' ]);
unset ( $_SESSION [ 'filter_stage_hot' ]);
unset ( $_SESSION [ 'filter_stage_close' ]);
unset ( $_SESSION [ 'filter_stage_hit' ]);
unset ( $_SESSION [ 'filter_confirm' ]);
unset ( $_SESSION [ 'filter_stage_send' ]);
unset ( $_SESSION [ 'filter_work_ahency' ]);
if ( $_GET [ 'filter_stage' ] != 'filter_work_all' && $_GET [ 'filter_stage' ] != 'filter_work_all_do' && $_GET [ 'filter_stage' ] != 'filter_work_add' ) {
$_SESSION [ $_GET [ 'filter_stage' ]] = 1 ;
if ( $_GET [ 'filter_stage' ] == 'filter_stage_work' ){
$_SESSION [ 'filter_confirm' ] = 1 ;
$_SESSION [ 'filter_stage_send' ] = 1 ;
}
}
} else if ( $_SESSION [ 'id' ] == 7945 || $user -> agencyId == 7945 ){
unset ( $_SESSION [ 'filter_stage_work' ]);
unset ( $_SESSION [ 'filter_stage_hot' ]);
unset ( $_SESSION [ 'filter_stage_close' ]);
unset ( $_SESSION [ 'filter_stage_hit' ]);
unset ( $_SESSION [ 'filter_confirm' ]);
unset ( $_SESSION [ 'filter_stage_send' ]);
unset ( $_SESSION [ 'filter_work_ahency' ]);
} else
if ( ! isset ( $_SESSION [ 'filter_stage_work' ]) &&
! isset ( $_SESSION [ 'filter_stage_hot' ]) &&
! isset ( $_SESSION [ 'filter_stage_close' ]) &&
! isset ( $_SESSION [ 'filter_stage_hit' ]) &&
! isset ( $_SESSION [ 'filter_confirm' ]) &&
! isset ( $_SESSION [ 'filter_stage_send' ]) &&
! isset ( $_SESSION [ 'filter_work_ahency' ]) && ! isset ( $_GET [ 'of_objects' ])){
$_SESSION [ 'filter_stage_work' ] = 1 ;
}
// }
?>
< div class = " filter-popup-type <?=isset( $_SESSION['filter_stage_work'] ) ? 'active' : ''?> " id = " filter_stage_work " >
< a href = " javascript: { } " >< span > В работе </ span ></ a >
</ div >
< div class = " filter-popup-type hot <?=isset( $_SESSION['filter_stage_hot'] ) ? 'active' : ''?> " id = " filter_stage_hot " >
< a href = " javascript: { } " >
< svg xmlns = " http://www.w3.org/2000/svg " xmlns : xlink = " http://www.w3.org/1999/xlink " version = " 1.1 " id = " Capa_1 " x = " 0px " y = " 0px " viewBox = " 0 0 512 512 " style = " enable-background:new 0 0 512 512; " xml : space = " preserve " width = " 19px " height = " 19px " class = " " >< g >< g transform = " matrix(1.25 0 0 -1.25 0 45) " >
< path style = " fill:#F4511E " d = " M398.448-179.952c0,23.5-4.18,46.008-11.847,66.843c-5.24-61.375-37.967-92.917-72.162-78.234 c-32.043,13.761-10.445,67.401-8.851,92.996C308.277-54.958,305.451-5.293,226.637,36c32.749-62.651,3.793-101.563-26.586-103.943 c-33.683-2.62-64.542,28.956-53.151,80.216c-36.884-27.179-37.967-72.925-26.586-102.52c11.869-30.847-0.467-56.477-29.423-59.325 c-32.339-3.189-50.314,34.641-33.74,94.922c-28.683-33.775-45.997-77.516-45.997-125.302C11.152-286.902,97.85-373.6,204.8-373.6 S398.448-286.902,398.448-179.952z " data - original = " #F4900C " class = " active-path " data - old_color = " #FF7043 " />
< path style = " fill:#FFB74D " d = " M277.418-279.146c-23.978,9.603-17.554,26.097-23.728,60.27 c-6.174,34.173-29.902,57.912-65.031,68.346c25.63-72.14-14.204-98.726-35.084-103.476c-21.324-4.853-42.751,0.012-45.2,45.644 c-24.867-24.764-40.267-59.028-40.267-96.893c0-4.186,0.199-8.325,0.567-12.415C103.652-352.245,151.729-373.6,204.8-373.6 s101.148,21.355,136.126,55.932c0.369,4.09,0.567,8.229,0.567,12.415c0,24.901-6.652,48.253-18.283,68.358 C324.885-272.026,294.026-285.798,277.418-279.146z " data - original = " #FFCC4D " class = " " data - old_color = " #FFCC4D " />
</ g ></ g ></ svg >
< span > Горячие </ span >
</ a >
</ div >
< div class = " filter-popup-type <?=isset( $_SESSION['filter_stage_close'] ) ? 'active' : ''?> " id = " filter_stage_close " >
< a href = " javascript: { } " >< span > Закрытые </ span ></ a >
</ div >
< div class = " filter-popup-type <?=isset( $_SESSION['filter_stage_hit'] ) ? 'active' : ''?> " id = " filter_stage_hit " >
< a href = " javascript: { } " >< span > Успешные </ span ></ a >
</ div >
< ? php
$sqlt = " SELECT count(*) as total from clients WHERE 1 AND funnel_id= $funnelId AND deleted=0 AND (who_work = " . $_SESSION [ 'id' ] . " ) AND `date_add` > '1970-01-01' AND `confirm` = 0 " ;
$qt = mysql_query ( $sqlt );
$totalt = ( int ) mysql_fetch_assoc ( $qt )[ 'total' ];
?>
< div class = " filter-popup-type <?=isset( $_SESSION['filter_confirm'] ) ? 'active' : ''?> " id = " filter_confirm " >
< a href = " javascript: { } " >< span > Переданные </ span ></ a >< ? php if ( $totalt > 0 ){ ?> <span class="counter"><?=$totalt?></span> <?php } ?>
</ div >
< ? php
//$cl_send = $cl -> getCountAllClientsSend($funnelId);
?>
<!--< div class = " filter-popup-type <?/*=isset( $_SESSION['filter_stage_send'] ) ? 'active' : ''*/?> " id = " filter_stage_send " >
< a href = " javascript: { } " >< span > Н е назначенные </ span ></ a >< ? php /*if($cl_send > 0){*/ ?> <span class="counter"><?/*=$cl_send*/?></span> <?php /*} */?>
</ div >-->
< div class = " filter-popup-type <?=isset( $_SESSION['filter_work_ahency'] ) ? 'active' : ''?> " id = " filter_work_ahency " >
< a href = " javascript: { } " >< span > Общие </ span ></ a >
</ div >
</ div >
< div class = " filter-popup__right " >
< div class = " filter-popup-header-inputs " >
< h3 style = " display:inline-flex; " > Параметры </ h3 >
< button class = " top-line__button button-fl-right " onclick = " applyChangesForFilter(); " type = " button " style = " margin-right: 50px;font-size: 14px;font-weight: normal;padding: 5px 13px;margin-top: -3px; " > Применить </ button >
</ div >
< ? php
$id_select = 'filter_emp' ;
$id_select_input = 'crm_filter_emp' ;
if ( isset ( $_SESSION [ 'filter_emp' ])){
$filter_emp = $_SESSION [ 'filter_emp' ];
}
$showBlocked = true ;
// if($_SESSION['id'] == 5238 || $_SESSION['id'] == 5455){
require ( $_SERVER [ 'DOCUMENT_ROOT' ] . " /templates/filter_emp.php " );
?>
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< ? php
if ( isset ( $_GET [ 'id_agent' ])) unset ( $_SESSION [ 'filter_client_type' ]);
$arr_client_type = array ();
if ( isset ( $_SESSION [ 'filter_client_type' ])){
$arr_client_type = json_decode ( html_entity_decode ( $_SESSION [ 'filter_client_type' ]), ENT_QUOTES );
}
?>
< select id = " filter-client-type " multiple >
< ? php
if ( $user -> agencyId == 12482 && ! in_array ( " Кадастр " , $WORK_TYPES )){
$WORK_TYPES [] = " Кадастр " ;
$WORK_TYPES [] = " Соискатель " ;
}
if ( $user -> agencyId == 12061 && ! in_array ( " Партнёр " , $WORK_TYPES )){
$WORK_TYPES [] = " Партнёр " ;
}
foreach ( $WORK_TYPES as $key => $val ){
if ( $key > 0 ){
?>
< option data - op = " <?= $key ?> " value = " <?= $val ?> " < ? = in_array ( $val , $arr_client_type ) ? 'selected' : '' ?> ><?=$val?></option>
< ? php
}
}
?>
</ select >
</ div >
</ div >
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< select id = " filter_activities " multiple = " " >
< ? php
$arr_source = array ();
if ( isset ( $_GET [ 'id_agent' ])) unset ( $_SESSION [ 'filter_activities' ]);
if ( isset ( $_SESSION [ 'filter_activities' ])){
$arr_source = json_decode ( html_entity_decode ( $_SESSION [ 'filter_activities' ]), ENT_QUOTES );
}
$sql_adv = " SELECT * FROM `activities` WHERE `user_id` = ' " . $user -> id . " ' or `manager_id` = ' " . $user -> id . " ' " ;
if ( $user -> id_manager ){
$sql_adv .= " or `manager_id` = ' " . $user -> id_manager . " ' or `user_id` = ' " . $user -> id_manager . " ' " ;
}
if ( $user -> agencyId ){
$sql_adv .= " or `manager_id` = ' " . $user -> agencyId . " ' or `user_id` = ' " . $user -> agencyId . " ' " ;
}
$sql_adv .= ' order by `name`' ;
$q_adv = mysql_query ( $sql_adv );
$rows_adv = mysql_num_rows ( $q_adv );
if ( $rows_adv > 0 ){
while ( $r_adv = mysql_fetch_assoc ( $q_adv )){
?>
< option value = " <?= $r_adv['id'] ?> " < ? = in_array ( $r_adv [ 'id' ], $arr_source ) ? ' selected' : '' ?> ><?=$r_adv['name']?></option>
< ? php
}
}
?>
</ select >
</ div >
</ div >
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< ? php
$arr_type = array ();
if ( isset ( $_GET [ 'id_agent' ])) unset ( $_SESSION [ 'filter_client_objects_type' ]);
if ( isset ( $_SESSION [ 'filter_client_objects_type' ])){
$arr_type = json_decode ( html_entity_decode ( $_SESSION [ 'filter_client_objects_type' ]), ENT_QUOTES );
}
?>
< select id = " filter-client-objects-type " multiple >
< option data - op = " 1 " value = " 1к_кв " < ? = in_array ( '1к_кв' , $arr_type ) ? 'selected' : '' ?> >1к.кв.</option>
< option data - op = " 2 " value = " 2к_кв " < ? = in_array ( '2к_кв' , $arr_type ) ? 'selected' : '' ?> >2к.кв.</option>
< option data - op = " 3 " value = " 3к_кв " < ? = in_array ( '3к_кв' , $arr_type ) ? 'selected' : '' ?> >3к.кв.</option>
< option data - op = " 4 " value = " 4к_кв " < ? = in_array ( '4к_кв' , $arr_type ) ? 'selected' : '' ?> >4к.кв.</option>
< option data - op = " 5 " value = " 5к_кв " < ? = in_array ( '5к_кв' , $arr_type ) ? 'selected' : '' ?> >5к.кв.</option>
< option data - op = " 6 " value = " 6к_кв " < ? = in_array ( '6к_кв' , $arr_type ) ? 'selected' : '' ?> >6к.кв.</option>
< option data - op = " 7 " value = " 7к_кв " < ? = in_array ( '7к_кв' , $arr_type ) ? 'selected' : '' ?> >7к.кв.</option>
< option data - op = " 8 " value = " 8к_кв " < ? = in_array ( '8к_кв' , $arr_type ) ? 'selected' : '' ?> >8к.кв.</option>
< option data - op = " 9 " value = " 9к_кв " < ? = in_array ( '9к_кв' , $arr_type ) ? 'selected' : '' ?> >9к.кв.</option>
< option data - op = " 10 " value = " Бо ле е _9_ко мна т " < ? = in_array ( 'Бо ле е _9_ко мна т' , $arr_type ) ? 'selected' : '' ?> >Более 9 комнат</option>
< option data - op = " 16 " value = " Студия " < ? = in_array ( 'Студия' , $arr_type ) ? 'selected' : '' ?> >Студия</option>
< option data - op = " 11 " value = " Комната " < ? = in_array ( 'Комната' , $arr_type ) ? 'selected' : '' ?> >Комната</option>
< option data - op = " 12 " value = " Дом " < ? = in_array ( 'Дом' , $arr_type ) ? 'selected' : '' ?> >Дом</option>
< option data - op = " 13 " value = " Помещение " < ? = in_array ( 'Помещение' , $arr_type ) ? 'selected' : '' ?> >Помещение</option>
< option data - op = " 14 " value = " Ча с ть__до ма " < ? = in_array ( 'Ча с ть__до ма ' , $arr_type ) ? 'selected' : '' ?> >Часть дома</option>
< option data - op = " 15 " value = " К о мпле кс __до мо в" < ? = in_array ( 'К о мпле кс __до мо в' , $arr_type ) ? 'selected' : '' ?> >Комплекс домов</option>
< option data - op = " 17 " value = " Апартаменты " < ? = in_array ( 'Апартаменты' , $arr_type ) ? 'selected' : '' ?> >Апартаменты</option>
< option data - op = " 18 " value = " З е ме льный__у ча с то к" < ? = in_array ( 'З е ме льный__у ча с то к' , $arr_type ) ? 'selected' : '' ?> >Земельный участок</option>
</ select >
</ div >
</ div >
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< ? php
if ( $user -> agencyId == 7911 ){
$ROLES_CLIENTS [] = " Страхование " ;
$ROLES_CLIENTS [] = " Путевки " ;
$ROLES_CLIENTS [] = " Юр.услуги " ;
} else if ( $user -> agencyId == 12482 && ! in_array ( " Заказчик " , $ROLES_CLIENTS )){
$ROLES_CLIENTS [] = " Заказчик " ;
} else if ( $user -> agencyId == 12061 && ! in_array ( " Другое " , $ROLES_CLIENTS )){
$ROLES_CLIENTS [] = " Другое " ;
}
$arr_role = array ();
if ( isset ( $_GET [ 'id_agent' ])) unset ( $_SESSION [ 'filter_client_rol' ]);
if ( isset ( $_SESSION [ 'filter_client_rol' ])){
$arr_role = json_decode ( html_entity_decode ( $_SESSION [ 'filter_client_rol' ]), ENT_QUOTES );
}
?>
< select id = " filter_client_rol " multiple = " multiple " >
< ? php
foreach ( $ROLES_CLIENTS as $key => $val ){
if ( $key > 0 ){
?>
< option data - op = " <?= $key ?> " value = " <?= $val ?> " < ? = in_array ( $val , $arr_role ) ? 'selected' : '' ?> ><?=$val?></option>
< ? php
}
}
?>
<!--< option data - op = " 1 " value = " Арендатор " < ? = in_array ( 'Арендатор' , $arr_role ) ? 'selected' : '' ?> >Арендатор</option>
< option data - op = " 2 " value = " Арендодатель " < ? = in_array ( 'Арендодатель' , $arr_role ) ? 'selected' : '' ?> >Арендодатель</option>
< option data - op = " 3 " value = " Покупатель " < ? = in_array ( 'Покупатель' , $arr_role ) ? 'selected' : '' ?> >Покупатель</option>
< option data - op = " 4 " value = " Продавец " < ? = in_array ( 'Продавец' , $arr_role ) ? 'selected' : '' ?> >Продавец</option>-->
</ select >
</ div >
</ div >
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< select id = " filter_source " multiple = " " >
< option value = " 0 " > Без источника </ option >
< option value = " 10000 " > Объекты нашей компании </ option >
< ? php
$sql_advg = " SELECT * FROM `advertising_sources_groups` WHERE `user_id` = ' " . $user -> id . " ' or `manager_id` = ' " . $user -> id . " ' " ;
if ( $user -> id_manager ){
$sql_advg .= " or `manager_id` = ' " . $user -> id_manager . " ' or `user_id` = ' " . $user -> id_manager . " ' " ;
}
if ( $user -> agencyId || $_SESSION [ 'users_admin' ]){
$sql_advg .= " or `manager_id` = ' " . $user -> agencyId . " ' or `user_id` = ' " . $user -> agencyId . " ' " ;
$sql_advg .= " or `user_id` in (select id from users where id= { $user -> agencyId } or id_manager= { $user -> agencyId } or id_manager in
( select id from users where id_manager = { $user -> agencyId } or id_manager in
( select id from users where id_manager = { $user -> agencyId }))) " ;
}
// echo $sql_adv;
$q_advg = mysql_query ( $sql_advg );
while ( $r_advg = mysql_fetch_assoc ( $q_advg )){ ?>
< option class = " bolt " value = " all_<?= $r_advg['id'] ?> " >< ? = $r_advg [ 'name' ] ?> </option>
< ? php
$sql_adv = " SELECT * FROM `advertising_sources` WHERE group_id= " . $r_advg [ 'id' ] . " and (`user_id` = ' " . $user -> id . " ' or `manager_id` = ' " . $user -> id . " ' " ;
if ( $user -> id_manager ){
$sql_adv .= " or `manager_id` = ' " . $user -> id_manager . " ' or `user_id` = ' " . $user -> id_manager . " ' " ;
}
if ( $user -> agencyId || $_SESSION [ 'users_admin' ]){
$sql_adv .= " or `manager_id` = ' " . $user -> agencyId . " ' or `user_id` = ' " . $user -> agencyId . " ' " ;
}
$sql_adv .= " ) order by source " ;
$q_adv = mysql_query ( $sql_adv );
$rows_adv = mysql_num_rows ( $q_adv );
if ( $rows_adv > 0 ){
while ( $r_adv = mysql_fetch_assoc ( $q_adv )){
if ( is_see ( $r_adv [ 'is_no_see' ], $r_adv [ 'users_no_see' ])) {
?>
< option value = " <?= $r_adv['id'] ?> " >< ? = $r_adv [ 'source' ] ?> </option>
< ? php
}
}
}
?>
< ? php
}
?>
< option class = " bolt " value = " all_0 " > Без группы </ option >
< ? php
$sql_adv = " SELECT * FROM `advertising_sources` WHERE group_id=0 and (`user_id` = ' " . $user -> id . " ' or `manager_id` = ' " . $user -> id . " ' " ;
if ( $user -> id_manager ){
$sql_adv .= " or `manager_id` = ' " . $user -> id_manager . " ' or `user_id` = ' " . $user -> id_manager . " ' " ;
}
if ( $user -> agencyId || $_SESSION [ 'users_admin' ]){
$sql_adv .= " or `manager_id` = ' " . $user -> agencyId . " ' or `user_id` = ' " . $user -> agencyId . " ' " ;
}
$sql_adv .= " ) order by source " ;
$q_adv = mysql_query ( $sql_adv );
$rows_adv = mysql_num_rows ( $q_adv );
if ( $rows_adv > 0 ){
while ( $r_adv = mysql_fetch_assoc ( $q_adv )){
if ( is_see ( $r_adv [ 'is_no_see' ], $r_adv [ 'users_no_see' ])) {
?>
< option value = " <?= $r_adv['id'] ?> " >< ? = $r_adv [ 'source' ] ?> </option>
< ? php
}}
}
?>
</ select >
</ div >
</ div >
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< select id = " filter_partner " multiple = " " >
< ? php $partners = new Partners ();
$partners_list = $partners -> getPartners ( false , false , true );
$sel_employees = [];
if ( isset ( $_SESSION [ 'filter_partner' ]))
$sel_employees = json_decode ( html_entity_decode ( $_SESSION [ 'filter_partner' ]), ENT_QUOTES );
foreach ( $partners_list as $partner ) { ?>
< optgroup label = " <?= $partner['name'] ; ?> " >
< option value = " all_<?= $partner['id'] ; ?> " < ? = in_array ( 'all_' . $partner [ 'id' ], $sel_employees ) ? ' selected' : '' ?> data-label="<?= $partner['name'] . " (все сотрудники)"; ?>">
В с е сотрудники партнёра
</ option >
< ? php $employees_list = $partners -> getEmployees ( $partner [ 'id' ], true , false , true ); ?>
< ? php foreach ( $employees_list as $employee ) {
if ( $partner [ 'id' ] == $employee [ 'partner_id' ]) { ?>
< option value = " <?= $employee['id'] ; ?> " < ? = in_array ( $employee [ 'id' ], $sel_employees ) ? ' selected' : '' ?> data-label="<?= $partner['name'] . " (" . $employee['name'] . (($employee['position']) ? ", " . mb_strtolower($employee['position'], "UTF-8") : ""). ")"; ?>">
< ? = $employee [ 'name' ] . (( $employee [ 'position' ]) ? " , " . mb_strtolower ( $employee [ 'position' ], " UTF-8 " ) : " " ); ?>
</ option >
< ? php }
} ?>
</ optgroup >
< ? php
} ?>
<!-- optgroup >
< option value = " 0 " < ? = in_array ( 0 , $partners ) ? ' selected' : '' ? >> Без привязки к партнёру </ option >
</ optgroup -->
</ select >
</ div >
</ div >
< div class = " filter-popup-input " >
< div class = " crm__filter-input " id = " clientsFilterEtap " >
< ? php
$arr_etap = array ();
if ( isset ( $_GET [ 'id_agent' ])) unset ( $_SESSION [ 'filter_etap' ]);
if ( isset ( $_SESSION [ 'filter_etap' ])){
$arr_etap = json_decode ( html_entity_decode ( $_SESSION [ 'filter_etap' ]), ENT_QUOTES );
}
?>
< select id = " filter_etap " multiple = " " >
< ? php
if ( $funnelId == 0 ) {
?>
< option value = " 1 " < ? = in_array ( '1' , $arr_etap ) ? 'selected' : '' ?> >Новый</option>
< option value = " 2 " < ? = in_array ( '2' , $arr_etap ) ? 'selected' : '' ?> >В работе</option>
< option value = " 3 " < ? = in_array ( '3' , $arr_etap ) ? 'selected' : '' ?> >Презентация</option>
< option value = " 4 " < ? = in_array ( '4' , $arr_etap ) ? 'selected' : '' ?> >Показ</option>
< option value = " 5 " < ? = in_array ( '5' , $arr_etap ) ? 'selected' : '' ?> >Бронь</option>
< option value = " 6 " < ? = in_array ( '6' , $arr_etap ) ? 'selected' : '' ?> >Подаем на ипотеку</option>
< option value = " 7 " < ? = in_array ( '7' , $arr_etap ) ? 'selected' : '' ?> >Сделка</option>
< option value = " 8 " < ? = in_array ( '8' , $arr_etap ) ? 'selected' : '' ?> >Закрыт</option>
< ? php
} else {
$funnelStepsData = mysql_query ( " select * from funnel_steps WHERE funnel_id = $funnelId order by id " );
while ( $funnelStep = mysql_fetch_assoc ( $funnelStepsData )) {
?>
< option value = " <?php echo $funnelStep['id'] ?> " < ? = in_array ( $funnelStep [ 'id' ], $arr_etap ) ? 'selected' : '' ?> ><?php echo $funnelStep['name']; ?></option>
< ? php
}
}
?>
</ select >
</ div >
</ div >
< ? php
$denialWork = null ;
$denialWork = array ();
if ( isset ( $_GET [ 'id_agent' ])) unset ( $_SESSION [ 'filter_denial_works' ]);
if ( isset ( $_SESSION [ 'filter_denial_works' ])){
$denialWork = json_decode ( html_entity_decode ( $_SESSION [ 'filter_denial_works' ]), ENT_QUOTES );
}
$sql_d = " SELECT * FROM denial_work WHERE (agency_id = 0 or agency_id= { $user -> agencyId } ) " ;
if ( $user -> agencyId == 19895 ){
$sql_d = " SELECT * FROM denial_work WHERE agency_id= { $user -> agencyId } AND del = 0 " ;
}
$q_d = mysql_query ( $sql_d );
$row_d = mysql_num_rows ( $q_d );
?>
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< select id = " filter_denial_work " multiple = " " >
< ? php
while ( $r_d = mysql_fetch_assoc ( $q_d )){ ?>
< option value = " <?= $r_d['id'] ?> " < ? = in_array ( $r_d [ 'id' ], $denialWork ) ? 'selected' : '' ?> >
< ? = $r_d [ 'name' ] ?>
</ option >
< ? php } ?>
< option value = " 0 " > Другое </ option >
</ select >
</ div >
</ div >
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< ? php
$period = 'all' ;
if ( isset ( $_GET [ 'id_agent' ])) unset ( $_SESSION [ 'client_period' ]);
if ( isset ( $_SESSION [ 'client_period' ]))
$period = $_SESSION [ 'client_period' ];
if ( isset ( $_GET [ 'period' ])){
$period = $_GET [ 'period' ];
if ( $period == 'dates' ) $period = 'period' ;
}
?>
< select class = " ms-crm-client-period " >
< option value = " today " < ? = ( $period == 'today' ) ? 'selected' : '' ?> >Сегодня</option>
< option value = " week " < ? = ( $period == 'week' ) ? 'selected' : '' ?> >Неделя</option>
< option value = " month " < ? = ( $period == 'month' ) ? 'selected' : '' ?> >Месяц</option>
< option value = " 30days " < ? = ( $period == '30days' ) ? 'selected' : '' ?> >Последние 30 дней</option>
< option value = " quarter " < ? = ( $period == 'quarter' ) ? 'selected' : '' ?> >Квартал</option>
< option value = " 90days " < ? = ( $period == '90days' ) ? 'selected' : '' ?> >Последние 90 дней</option>
< option value = " year " < ? = ( $period == 'year' ) ? 'selected' : '' ?> >Год</option>
< option value = " all " < ? = ( $period == 'all' ) ? 'selected' : '' ?> >В с е время</option>
< option value = " period " < ? = ( $period == 'period' ) ? 'selected' : '' ?> >Период</option>
</ select >
</ div >
< div class = " filter-popup-type period <?=( $period != 'period' ) ? 'hidden' : ''?> " style = " padding: 0px; " id = " dates " >
< div id = " dates_period " style = " padding: 16px 5px 16px; " >
с & nbsp ; < input type = " text " id = " onDate " class = " text datepicker-filter " value = " <?= $_SESSION['on_date'] ?> " >& nbsp ;
по & nbsp ; < input type = " text " id = " offDate " class = " text datepicker-filter " value = " <?= $_SESSION['off_date'] ?> " >
</ div >
</ div >
</ div >
< div id = " date_tasks " class = " <?=( $_SESSION['filter_stage_close'] ) ? '' : 'hidden'?> " >
< ? php
$checked10 = 'checked' ;
$checked11 = '' ;
if ( isset ( $_GET [ 'date_closer' ]) && ( int ) $_GET [ 'date_closer' ] == 11 ){
$checked10 = '' ;
$checked11 = 'checked' ;
}
?>
< div class = " filter-popup-input " >
< div class = " checkbox " >
< input name = " date_tasks " id = " date_closer " value = " 10 " type = " radio " < ? = $checked10 ?> > <label for="date_closer">По дате закрытия</label>
</ div >
</ div >
< div class = " filter-popup-input " >
< div class = " checkbox " >
< input name = " date_tasks " id = " date_no_closer " value = " 11 " type = " radio " < ? = $checked11 ?> >
< label for = " date_no_closer " > По дате создания </ label >
</ div >
</ div >
</ div >
< ? php
if ( isset ( $_GET [ 'of_objects' ])) {
$_SESSION [ 'of_objects' ] = $_GET [ 'of_objects' ];
} else {
unset ( $_SESSION [ 'of_objects' ]);
}
?>
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< input type = " text " style = " width: 382px; height: 18px; font-size: 18px; padding: 9px; " name = " of_objects " id = " of_objects " class = " text medium-input no-mrg-left " placeholder = " ID объекта по заявке " value = " <?php if (isset( $_SESSION['of_objects'] )) { echo $_SESSION['of_objects'] ; } ?> " >
</ div >
</ div >
< div id = " client_fields_filtr " class = " hidden " >
< template v - if = " !isEmpty(clientFields) " >
< div v - for = " (field, index) in clientFields " >
< template v - if = " field.is_podgroup > 0 " >
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< v - select v - model = " fieldModels['model_'+field.id] " multiple @ input = " checkFields " class = " text medium-input no-mrg-left vue_select " : components = " { OpenIndicator} " transition = " " : placeholder = " field.title " : options = " field.podgroups_select " : reduce = " title => title.id " label = " title " />
</ div >
</ div >
< template v - if = " !isEmpty(field.podgroups) " >
< div v - show = " !isEmpty(fieldModels['model_'+field.id]) && fieldModels['model_'+field.id].indexOf(pg.id) != -1 " class = " filter-popup-input " v - for = " (pg, in_pd) in field.podgroups " >
< template v - if = " pg.type==0 || pg.type==5 " >
< div class = " crm__filter-input " >
< input @ change = " checkFields " type = " text " class = " text medium-input no-mrg-left " v - model = " fieldModels['modelp_'+pg.id] " style = " width: 382px; height: 18px; font-size: 18px; padding: 9px; " : placeholder = " pg.title " />
</ div >
</ template >
< template v - else - if = " pg.type==1 " >
< div class = " crm__filter-input " >
< input @ change = " checkFields " type = " number " class = " text medium-input no-mrg-left " v - model = " fieldModels['modelp_'+pg.id] " style = " width: 382px; height: 18px; font-size: 18px; padding: 9px; " : placeholder = " pg.title " />
</ div >
</ template >
< template v - else - if = " pg.type==3 || pg.type==2 " >
< div class = " crm__filter-input " >
< v - select : components = " { OpenIndicator} " @ input = " checkFields " v - model = " fieldModels['modelp_'+pg.id] " : placeholder = " pg.title " transition = " " class = " vue_select " multiple : options = " pg.params.items " : reduce = " name => name.value " label = " name " />
</ div >
</ template >
< template v - else - if = " pg.type==4 " >
< div class = " checkbox " >
< input @ change = " checkFields " v - model = " fieldModels['modelp_'+pg.id] " : id = " 'custom_client_filtr_'+pg.id " type = " checkbox " >
< label : for = " 'custom_client_filtr_'+pg.id " v - html = " pg.title " ></ label >
</ div >
</ template >
</ div >
< div class = " clear " ></ div >
</ template >
</ template >
< template v - else - if = " field.type==0 || field.type == 5 " >
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< input @ change = " checkFields " type = " text " class = " text medium-input no-mrg-left " style = " width: 382px; height: 18px; font-size: 18px; padding: 9px; " : placeholder = " field.title " v - model = " fieldModels['model_'+field.id] " />
</ div >
</ div >
< div class = " clear " ></ div >
</ template >
< template v - else - if = " field.type==1 " >
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< input @ change = " checkFields " type = " number " class = " text medium-input no-mrg-left " style = " width: 382px; height: 18px; font-size: 18px; padding: 9px; " : placeholder = " field.title " v - model = " fieldModels['model_'+field.id] " />
</ div >
</ div >
< div class = " clear " ></ div >
</ template >
< template v - else - if = " field.type==3 || field.type==2 " >
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< v - select : components = " { OpenIndicator} " @ input = " checkFields " : placeholder = " field.title " v - model = " fieldModels['model_'+field.id] " transition = " " class = " vue_select " : options = " field.params.items " : reduce = " name => name.value " multiple label = " name " />
</ div >
</ div >
< div class = " clear " ></ div >
</ template >
< template v - else - if = " field.type==4 " >
< div class = " filter-popup-input " >
< div class = " checkbox " >
< input @ change = " checkFields " v - model = " fieldModels['model_'+field.id] " : id = " 'custom_client_filtr_'+field.id " type = " checkbox " >
< label : for = " 'custom_client_filtr_'+field.id " v - html = " field.title " ></ label >
</ div >
</ div >
< div class = " clear " ></ div >
</ template >
</ div >
</ template >
< div class = " filter-popup-input " >
< div class = " checkbox " >
< input @ change = " checkFields " name = " is_contract " v - model = " filtr.is_contract " id = " is_contract " type = " checkbox " >
< label for = " is_contract " > Договоры </ label >
</ div >
</ div >
< div v - show = " filtr.is_contract " >
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< v - select : components = " { OpenIndicator} " @ input = " checkFields " : placeholder = " 'Тип договора' " v - model = " filtr.type_contract " transition = " " class = " vue_select " : options = " types_contract " : reduce = " type => type.code " multiple label = " type " />
</ div >
</ div >
< div class = " clear " ></ div >
< div class = " filter-popup-input " >
< div class = " crm__filter-input " >
< input @ change = " checkFields " type = " text " style = " width: 382px; height: 18px; font-size: 18px; padding: 9px; " v - model . trim = " filtr.numder_contract " class = " text medium-input no-mrg-left " placeholder = " Номер договора " >
</ div >
</ div >
< div class = " filter-popup-type " style = " padding: 0px; " >
< p > Период окончания договора </ p >
< div id = " dates_contract_client " style = " padding: 10px 5px 10px; " >
От & nbsp ; < input style = " width:100px " type = " text " id = " contractClientOnDate " class = " text datepicker-filter " value = " " >& nbsp ;
до & nbsp ; < input style = " width:100px " type = " text " id = " contractClientOffDate " class = " text datepicker-filter " value = " " >
</ div >
</ div >
</ div >
</ div >
< div class = " filter-priority1 " title = " Категория клиентов " >
< svg x = " 0px " y = " 0px " viewBox = " 0 0 512 512 " style = " enable-background:new 0 0 512 512; " xml : space = " preserve " width = " 24px " height = " 24px " class = " " >
< ellipse cx = " 256 " cy = " 256 " rx = " 240 " ry = " 240 " class = " priority1 " /></ svg >
</ div >
< div class = " filter-priority2 " title = " Категория клиентов " >
< svg x = " 0px " y = " 0px " viewBox = " 0 0 512 512 " style = " enable-background:new 0 0 512 512; " xml : space = " preserve " width = " 24px " height = " 24px " class = " " >
< ellipse cx = " 256 " cy = " 256 " rx = " 240 " ry = " 240 " class = " priority2 " /></ svg >
</ div >
< div class = " filter-priority3 " title = " Категория клиентов " >
< svg x = " 0px " y = " 0px " viewBox = " 0 0 512 512 " style = " enable-background:new 0 0 512 512; " xml : space = " preserve " width = " 24px " height = " 24px " class = " " >
< ellipse cx = " 256 " cy = " 256 " rx = " 240 " ry = " 240 " class = " priority3 " /></ svg >
</ div >
< div class = " filter-priority4 " title = " Категория клиентов " >
< svg x = " 0px " y = " 0px " viewBox = " 0 0 512 512 " style = " enable-background:new 0 0 512 512; " xml : space = " preserve " width = " 24px " height = " 24px " class = " " >
< ellipse cx = " 256 " cy = " 256 " rx = " 240 " ry = " 240 " class = " priority4 " /></ svg >
</ div >
< div class = " filter-popup-input " >
<!-- -->< ? php //if(isset($_GET['id_agent'])) unset($_SESSION['order']); ?>
< div class = " checkbox " >
< input name = " order " id = " order " type = " checkbox " < ? = ( isset ( $_SESSION [ 'order' ])) ? 'checked' : '' ?> >
< label for = " order " > С задачами </ label >
</ div >
</ div >
< div class = " filter-popup-input " >
< div class = " checkbox " >
< input name = " noTasks " id = " noTasks " type = " checkbox " < ? = ( isset ( $_SESSION [ 'noTasks' ])) ? 'checked' : '' ?> >
< label for = " noTasks " > Клиенты без задач </ label >
</ div >
</ div >
< div class = " filter-popup-input " >
< div class = " checkbox " >
< input name = " todayTasks " id = " todayTasks " type = " checkbox " < ? = ( isset ( $_SESSION [ 'todayTasks' ])) ? 'checked' : '' ?> >
< label for = " todayTasks " > Задачи на сегодня </ label >
</ div >
</ div >
< div class = " filter-popup-input " >
< div class = " checkbox " >
< input name = " overTasks " id = " overTasks " type = " checkbox " < ? = ( isset ( $_SESSION [ 'overTasks' ])) ? 'checked' : '' ?> >
< label for = " overTasks " > С просроченными задачами </ label >
</ div >
</ div >
< div class = " filter-popup-input " >
< div class = " checkbox " >
< input name = " isPartner " id = " isPartner " type = " checkbox " < ? = ( isset ( $_GET [ 'isPartner' ])) ? 'checked' : '' ?> value="cena">
< label for = " isPartner " > Совместные клиенты </ label >
</ div >
</ div >
<!--< div class = " filter-popup-submit " >
< button class = " medium-button " > Закрыть </ button >
</ div >-->
</ div >
</ div >
</ div >
</ div >
< ? php
$searchUserId = ( int ) $_SESSION [ 'id' ];
$depClass = new Department ;
$departments = $depClass -> getDepartments ();
$dep_user = $depClass -> getDepartment ( $searchUserId );
$user_allow_edit_all = 0 ;
$r_check_permissions = $user -> checkMenuPermissions ();
if ( $user -> agency == 1 || $user -> users_admin == 1 || $r_check_permissions [ 'menu_all_clients_edit' ] == 1 ) {
$user_allow_edit_all = 1 ;
} elseif ( $dep_user [ 'role' ] == 'admin_department' || $dep_user [ 'role' ] == 'manager_office' || $dep_user [ 'role' ] == 'manager' || $dep_user [ 'role' ] == 'manager_office_menager' ) {
$user_allow_edit_all = 1 ;
} elseif ( ! ( $dep_user [ 'role' ]) && $_SESSION [ 'manager' ] > 0 ) {
$user_allow_edit_all = 1 ;
}
?>
< div id = " app_clients " >
< div class = " funnels_client isNoLoadPage " >
<!-- agencyID для js -->
< input type = " hidden " id = " agencyIdClients " value = " <?= $user->agencyId ?> " />
< input type = " hidden " id = " funnelIdClients " value = " <?= $funnelId ?> " />
< input type = " hidden " id = " useCustomFunnel " value = " <?= $useCustomFunnel ?> " />
< input type = " hidden " id = " user_allow_edit_all " value = " <?= $user_allow_edit_all ?> " />
< ul class = " funnels_list " style = " display: inline-block; margin: 0px 0 5px 16px; " ></ ul >
< div id = " groupClients " class = " jw__objects " >
< div style = " float:left;margin:0px 0px 0px 0px; width:max-content; border: none; background: none; box-shadow: none; " class = " f-system_pagination jw__object item " >
< div class = " object-content__actions " style = " padding: 7px 5px 5px 0px; " >
< div class = " actions-menu__icons " >
< span class = " jw__small-popup jw-action-icon-more " data - id = " clients " ></ span >
< div class = " jw__popup actions-menu " style = " right:auto; width:200px " id = " popup__clients " >
< div class = " actions-menu__inner " >
< a href = " javascript: { }; " class = " confirm__clients " data - id = " <?= $_SESSION['id'] ?> " >< span > Передать сотруднику </ span ></ a >
< a href = " javascript: { }; " class = " funnel__clients " >< span > Переместить в воронку </ span ></ a >
< a href = " javascript: { }; " class = " closed_all " >< span > Закрыть </ span ></ a >
< a href = " javascript: { }; " class = " renew_all " >< span > Открыть </ span ></ a >
< a href = " javascript: { }; " class = " confirm_on_clients " data - id = " <?= $_SESSION['id'] ?> " >< span > Принять в работу </ span ></ a >
< ? php
$unisender = new UnisenderClass ( null , $user -> agencyId );
$key = $unisender -> get_key ();
if ( ! empty ( $key )) { ?>
< a href = " javascript: { }; " class = " campaign__create " >< span > Создать рассылку Unisender </ span ></ a >
< ? php } ?>
< ? php
$wazzap = new Wazzap ( $user -> agencyId );
$key = $wazzap -> get_key ();
if ( ! empty ( $key ) && $user -> added_to_wazzap ) { ?>
< a href = " javascript: { }; " class = " campaign__create_wazzap " >< span > Создать рассылку Whatsapp </ span ></ a >
< ? php } ?>
</ div >
</ div >
</ div >
< div style = " top: 3px; margin-right: 0px; " class = " jw__group-action-button " onclick = " to_check_client_all(); " >
< input type = " checkbox " id = " changeClientAll " class = " changeClientInput " >
< div class = " tooltip tooltip-effect " style = " z-index: 750; " >
< em style = " font-style:normal; " class = " tooltip-content tt-client clear " >
< b id = " client_toltip_text " class = " tooltip-text " > Выделить всех клиентов на странице </ b >
</ em >
< div id = " changeClientAllDiv " class = " group-action-button item-for-check " style = " position: relative; " >
< span class = " check-button-box " ></ span >
< span class = " check " ></ span >
</ div >
</ div >
</ div >
< div style = " top: 3px; margin-left: 15px; " class = " jw__group-action-button " onclick = " to_check_client_all_filter(); " >
< input type = " checkbox " id = " changeClientAllFilter " class = " changeClientInputFilter " >
< div class = " tooltip tooltip-effect " style = " z-index: 750; " >
< em style = " font-style:normal; " class = " tooltip-content tt-client clear " >
< b id = " client_toltip_text2 " class = " tooltip-text " > Выделить всех клиентов по фильтру </ b >
</ em >
< div id = " changeClientAllFilterDiv " class = " group-action-button item-for-check " style = " position: relative; " >
< span class = " check-button-box " ></ span >
< span class = " check " ></ span >
</ div >
</ div >
</ div >
< div class = " clear " ></ div >
</ div >
</ div >
</ div >
< div style = " position:relative;display:inline-block;float:right;margin-top:10px; " >
< div id = " totalCount " class = " form-block " style = " display:block;float:left;width:auto;min-width:30px;margin-right:30px; " >
< div class = " label " style = " width: 50px; " > В с е г о :</ div >
< div class = " text " > 0 </ div >
</ div >
< div id = " sortOrder " class = " form-block " style = " float: right; width: 360px; " >
< ? php
$sort_order = false ;
if ( isset ( $_SESSION [ 'clients_sort_order' ])) {
$sort_order = $_SESSION [ 'clients_sort_order' ];
}
?>
< div class = " label " style = " width: 120px; " > Сортировка :</ div >
< div class = " inputs " >
< select name = " sort_order " style = " width:100%;margin-top:3px; " >
< option value = " 0 " < ? php echo (( ! $sort_order ) ? " selected " : " " ) ?> >По умолчанию </option>
< option value = " 1 " < ? php echo (( $sort_order == " 1 " ) ? " selected " : " " ) ?> >От старого к новому</option>
< option value = " 2 " < ? php echo (( $sort_order == " 2 " ) ? " selected " : " " ) ?> >От нового к старому</option>
</ select >
</ div >
</ div >
</ div >
< div class = " clear " ></ div >
</ div >
< div id = " clients_list " ></ div >
< div class = " object-content__preloader " style = " display: block; " >
< img src = " ../images/rocket-spinner.svg " width = " 96px " >
</ div >
</ div >
</ div >
</ div >
< style >
. tab {
position : relative ;
display : inline - block ;
padding : 5 px 0 10 px ;
cursor : pointer ;
border : 0 ;
font - size : 17 px ;
}
</ style >
< script >
function getCalendar (){
var events = {
url : '/ajax/calendarEvents.php' ,
type : 'POST' ,
error : function () {
alert ( 'there was an error while fetching events!' );
}
}
if ( $ ( '#calendar ' ) . hasClass ( 'fc' )){
$ ( '#calendar' ) . fullCalendar ( 'removeEventSource' , events );
$ ( '#calendar' ) . fullCalendar ( 'addEventSource' , events );
}
}
$ ( document ) . ready ( function () {
let sort_order = $ ( 'select[name=sort_order]' ) . val ();
show_options_search ();
let preloaderDisabled = false ;
if ( $ ( '.view-changer .view-kanban.active' ) . length ) {
preloaderDisabled = true ;
$ ( '.object-content__preloader' ) . hide ();
}
get_list ( null , sort_order , ! ( preloaderDisabled ));
$ ( '.datepicker-filter' ) . datepicker ({
autoClose : 'true' ,
onSelect : function (){
show_options_search ();
page_kanban = 1 ;
add_knban = true ;
//get_list(null, sort_order);
}
});
$ ( 'body' ) . delegate ( 'select[name=sort_order]' , 'change' , function () {
let page = $ ( '.pagination li.active' ) . text ();
get_list ( page , this . value );
});
});
2026-06-20 11:54:22 +02:00
function openClientDeal ( clientId ) {
$ . ajax ({
url : '/ajax/ajax_vue_requisitions.php' ,
type : 'POST' ,
contentType : 'application/json' ,
data : JSON . stringify ({ request : 'get_deal_by_client' , client_id : clientId }),
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 ]);
}
}
});
}
2026-05-22 20:21:54 +02:00
</ script >
< ? php require ( $_SERVER [ 'DOCUMENT_ROOT' ] . " /templates/footer.php " ); ?>
< ? php require ( $_SERVER [ 'DOCUMENT_ROOT' ] . " /templates/modals/req_info.php " ); ?>
2026-06-20 11:54:22 +02:00
< ? 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">' ;
}
?>
2026-05-22 20:21:54 +02:00
< script type = " text/javascript " src = " /js/crm_vue.js?v=<?=filemtime( $_SERVER['DOCUMENT_ROOT'] .'/js/crm_vue.js')?> " ></ script >
< script type = " text/javascript " src = " /js/clients_vue.js?v=<?=filemtime( $_SERVER['DOCUMENT_ROOT'] .'/js/clients_vue.js')?> " ></ script >