feat: consolidar desenvolvimentos do portal InvestMoz
This commit is contained in:
@@ -69,7 +69,8 @@ final class AssistiveRules
|
||||
foreach (Lead::whereIn('data_classification', ['public', 'internal'])->whereNull('owner_user_id')->orderBy('id')->limit(20)->get(['id']) as $lead) {
|
||||
$alerts[] = ['record_type' => 'lead', 'record_id' => $lead->id, 'rule' => 'missing_owner', 'source_url' => '/management/crm/leads/'.$lead->id];
|
||||
}
|
||||
foreach (Lead::whereIn('data_classification', ['public', 'internal'])->whereIn('status', ['new', 'qualified'])->whereDoesntHave('tasks', fn ($q) => $q->whereIn('status', ['open', 'in_progress']))
|
||||
foreach (Lead::whereIn('data_classification', ['public', 'internal'])->whereIn('status', ['new', 'qualified'])
|
||||
->whereNotExists(CrmTask::availableForWork()->whereColumn('tasks.lead_id', 'leads.id')->selectRaw('1')->toBase())
|
||||
->orderBy('id')->limit(20)->get(['id']) as $lead) {
|
||||
$alerts[] = ['record_type' => 'lead', 'record_id' => $lead->id, 'rule' => 'missing_next_action', 'source_url' => '/management/crm/leads/'.$lead->id];
|
||||
}
|
||||
@@ -91,7 +92,7 @@ final class AssistiveRules
|
||||
/** @return list<array<string, mixed>> */
|
||||
public function sla(): array
|
||||
{
|
||||
return array_values(CrmTask::whereIn('data_classification', ['public', 'internal'])->whereIn('status', ['open', 'in_progress'])->where('due_at', '<', now())->orderBy('due_at')->limit(50)
|
||||
return array_values(CrmTask::whereIn('data_classification', ['public', 'internal'])->availableForWork()->where('due_at', '<', now())->orderBy('due_at')->limit(50)
|
||||
->get()->map(fn ($task) => [
|
||||
'record_type' => 'task', 'record_id' => $task->id, 'rule' => 'overdue_open_task',
|
||||
'due_at' => $task->getAttribute('due_at')?->toIso8601String(), 'lead_id' => $task->lead_id,
|
||||
|
||||
Reference in New Issue
Block a user