Mails etc. in Lead finish

This commit is contained in:
Kevin Adametz 2021-05-11 17:07:20 +02:00
parent 66ca252bfa
commit b362b93bca
45 changed files with 1460 additions and 418 deletions

View file

@ -154,6 +154,11 @@ class Lead extends Model
'participant_salutation_id'
];
public static $lead_mail_dirs = [
11 => ['name' => 'Entwürfe', 'icon'=>'ion-md-create'],
12 => ['name' => 'Papierkorb', 'icon'=>'ion-md-trash'],
];
public function updateNextDueDate($date = false){
if(!$date){
@ -325,4 +330,14 @@ class Lead extends Model
}
return '<span data-order="0">-</span>';
}
public function countLeadMailsBy($dir, $subdir=false){
if($dir === 11){
return $this->lead_mails->where('draft', true)->where('dir', '!=', 12)->count();
}
if($subdir){
return $this->lead_mails->where('dir', $dir)->where('subdir', $subdir)->count();
}
return $this->lead_mails->where('dir', $dir)->count();
}
}