Mehrere Tickets 49, 50, 51, 52, 53
This commit is contained in:
parent
ae70577289
commit
e3495be8b8
61 changed files with 1904 additions and 344 deletions
|
|
@ -6,9 +6,10 @@ use Carbon;
|
|||
use Request;
|
||||
use App\Models\Lead;
|
||||
use App\Models\LeadFile;
|
||||
use App\Models\LeadMail;
|
||||
use App\Models\LeadNotice;
|
||||
use App\Models\LeadParticipant;
|
||||
use App\Models\StatusHistory;
|
||||
use App\Models\LeadParticipant;
|
||||
use App\Repositories\LeadRepository;
|
||||
use App\Repositories\CustomerRepository;
|
||||
use App\Repositories\LeadFileRepository;
|
||||
|
|
@ -132,6 +133,19 @@ class LeadController extends Controller
|
|||
}
|
||||
return $ret;
|
||||
}
|
||||
if(isset($data['action']) && $data['action'] === "get_popover_lead_last_email"){
|
||||
$lead = Lead::findOrFail($data['lead_id']);
|
||||
$ret = "";
|
||||
if($lead->lead_mails->count()){
|
||||
$lead_mail = $lead->lead_mails_sent_at->last();
|
||||
return "<h6>".$lead_mail->subject."</h6>".$lead_mail->message;
|
||||
}
|
||||
if($ret === ""){
|
||||
return 'keine E-Mail';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -214,7 +228,6 @@ class LeadController extends Controller
|
|||
return Carbon::parse($lead->request_date)->format(\Util::formatDateDB());
|
||||
})
|
||||
->addColumn('status', function (Lead $lead) {
|
||||
//umbuchen
|
||||
return $lead->getStatusBadge();
|
||||
})
|
||||
->addColumn('lead_notice', function (Lead $lead) {
|
||||
|
|
@ -222,10 +235,21 @@ class LeadController extends Controller
|
|||
'<span data-order="0" class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('last_lead_email', function (Lead $lead) {
|
||||
//umbuchen
|
||||
|
||||
if($lead->lead_mails->count()){
|
||||
$lead_mail = $lead->lead_mails_sent_at->last();
|
||||
return '<a data-order="'.$lead_mail->getSentAtRaw().'" href="'.route('lead_detail', [$lead->id]).'#collapseLeadMails" data-order="'.$lead_mail->sent_at.'"><span class="badge '.($lead_mail->is_answer ? 'badge-default' : 'badge-secondary').'">'.$lead_mail->sent_at.'</span></a>';
|
||||
return '<a data-order="'.$lead_mail->getSentAtRaw().'" href="#" data-toggle="modal"
|
||||
data-target="#modals-load-content"
|
||||
data-id="show-mail"
|
||||
data-url="mail"
|
||||
data-preview="true"
|
||||
data-lead_id="'.$lead->id.'"
|
||||
data-lead_mail_id="'.$lead_mail->id.'"
|
||||
data-action="show-lead-mail"
|
||||
data-redirect="back"
|
||||
data-route="'.route('lead_mail_modal_load').'">
|
||||
<span class="badge '.($lead_mail->is_answer ? 'badge-default' : 'badge-secondary').'">'.$lead_mail->sent_at.'</span>
|
||||
</a>';
|
||||
}
|
||||
return '<span data-order="">-</span>';
|
||||
})
|
||||
|
|
@ -236,6 +260,19 @@ class LeadController extends Controller
|
|||
->orderColumn('customer_id', 'customer_id $1')
|
||||
->orderColumn('status', 'status_id $1')
|
||||
|
||||
->orderColumn('last_lead_email', function ($query, $order) {
|
||||
|
||||
$query->whereHas('lead_mails',
|
||||
function ($q) use ($order) {
|
||||
// $q->select('sent_at')->where('sent_at', DB::raw("(select max('sent_at') customer_mails)")); //)
|
||||
})->orderBy(
|
||||
LeadMail::select('sent_at')
|
||||
->whereColumn('lead_id', 'lead.id')
|
||||
->orderBy('sent_at', 'DESC')
|
||||
->limit(1)
|
||||
, $order);
|
||||
})
|
||||
|
||||
->filterColumn('id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('id', 'LIKE', '%'.$keyword.'%');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue