Joywork/ajax/client_task_badge.php
2026-05-22 21:21:54 +03:00

97 lines
5.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$badgeCount = 0;
$badgeColor = '';
if (!empty($client['events_res']) && $client['events_res'] > 0) {
$badgeCount = $client['events_res'];
$badgeColor = '#dd6360';
} elseif (!empty($client['events_res1']) && $client['events_res1'] > 0) {
$badgeCount = $client['events_res1'];
$badgeColor = '#efcd81';
} elseif (!empty($client['events_res2']) && $client['events_res2'] > 0) {
$badgeCount = $client['events_res2'];
$badgeColor = '#4CAF50';
}
?>
<a href="javascript:{}" class="client-events-new" style="border-bottom:none;" data-id="<?=$client['id']?>">
<?php if(!$onlyLast): ?>
<div class="custom-all-tasks" style="border-bottom: 1px dotted rgb(183, 188, 190);">Все задачи</div>
<?php if ($badgeCount > 0): ?>
<div class="tooltip-wrapper">
<span class="jw__tab__counter" style="background: <?=$badgeColor?>"><?=$badgeCount?></span>
<?php if (!empty($client['tasks_data'])): ?>
<div class="custom-tooltip">
<div class="modal-head-text">Задачи</div><br>
<div class="custom-ul">
<?php foreach ($client['tasks_data'] as $task): ?>
<?php
$typeMap = [
'call' => 'Звонок',
'deal' => 'Сделка',
'show' => 'Показ',
'meet' => 'Встреча'
];
$type = $task['type'];
if ($type === 'even') {
$taskName = $task['name'];
} elseif (isset($typeMap[$type])) {
$taskName = $typeMap[$type];
}
$date = date('H:i d.m.Y', strtotime($task['schedule_date']));
?>
<div class="custom-li">
<div class="custom-head"><div> <?=htmlspecialchars($taskName)?></div><div><?=htmlspecialchars($date)?></div></div>
<div class="custom-info"><div class="custom-resp">Ответственный:</div><div class="custom-info-text"> <?=htmlspecialchars($task['responsible'])?></div></div>
<div class="custom-info"><div class="custom-resp">Описание:</div> <div class="custom-info-text" ><?=htmlspecialchars($task['comment']) ?></div></div>
</div>
<?php endforeach;?>
</div>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php else:?>
<?php if ($badgeCount > 0): ?>
<div class="custom-task-all" >
<div class="custom-task">Последняя задача</div>
<div class="custom-ul">
<?php
$task = end($client['tasks_data']);
$typeMap = [
'call' => ['label' => 'Звонок', 'bg' => '#dbedc7', 'text' => '#458c46'],
'deal' => ['label' => 'Сделка', 'bg' => '#fcd9dd', 'text' => '#e57373'],
'show' => ['label' => 'Показ', 'bg' => '#fff9c4', 'text' => '#f9a825'],
'meet' => ['label' => 'Встреча', 'bg' => '#f3e4f5', 'text' => '#7c1fa3'],
];
if ($type === 'even') {
$taskName = $task['name'];
$bgColor = '#e2e9f5';
$textColor = '#76a7fa';
} elseif (isset($typeMap[$type])) {
$taskName = $typeMap[$type]['label'];
$bgColor = $typeMap[$type]['bg'];
$textColor = $typeMap[$type]['text'];
}
$date = date('d-m-Y H:i', strtotime($task['schedule_date']));
?>
<div class="kanban_task_foot" style="background: <?= $bgColor ?>;">
<div class="kanban_task_head">
<div style="color: <?= $textColor ?>"><?=htmlspecialchars($taskName)?></div>
<div><?=htmlspecialchars($date)?></div>
</div>
<!-- <div class="custom-info">
<div class="kanban_task_resp">Ответственный:</div>
<div class="kanban_task-text"> <?=htmlspecialchars($task['responsible'])?></div>
</div> -->
<div class="custom-info">
<div class="kanban_task_resp">Описание:</div>
<div class="kanban_task-text" ><?=htmlspecialchars($task['comment']) ?></div>
</div>
</div>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
</a>