Mails etc. in Lead finish
This commit is contained in:
parent
66ca252bfa
commit
b362b93bca
45 changed files with 1460 additions and 418 deletions
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\BookingNotice;
|
||||
use App\Models\LeadNotice;
|
||||
use App\Models\SfGuardUser;
|
||||
use App\Models\TravelUserBookingFewoNotice;
|
||||
use App\User;
|
||||
|
|
@ -45,10 +46,14 @@ class HomeController extends Controller
|
|||
|
||||
$last_booking_notices = BookingNotice::orderBy('edit_at', 'DESC')->orderBy('created_at', 'DESC')->limit(10)->get();
|
||||
$last_booking_fewo_notices = TravelUserBookingFewoNotice::orderBy('edit_at', 'DESC')->orderBy('created_at', 'DESC')->limit(10)->get();
|
||||
$last_lead_notices = LeadNotice::orderBy('edit_at', 'DESC')->orderBy('created_at', 'DESC')->limit(10)->get();
|
||||
|
||||
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'last_booking_notices' => $last_booking_notices,
|
||||
'last_booking_fewo_notices' => $last_booking_fewo_notices
|
||||
'last_booking_fewo_notices' => $last_booking_fewo_notices,
|
||||
'last_lead_notices' => $last_lead_notices
|
||||
];
|
||||
return view('home', $data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use Request;
|
|||
use App\Models\Lead;
|
||||
use App\Models\LeadFile;
|
||||
use App\Models\LeadNotice;
|
||||
use App\Models\StatusHistory;
|
||||
use App\Repositories\LeadRepository;
|
||||
use App\Repositories\CustomerRepository;
|
||||
use App\Repositories\LeadFileRepository;
|
||||
|
|
@ -88,6 +89,26 @@ class LeadController extends Controller
|
|||
return back();
|
||||
}
|
||||
|
||||
public function getAjaxRequests(){
|
||||
|
||||
$data = Request::all();
|
||||
if(Request::ajax()) {
|
||||
if(isset($data['action']) && $data['action'] === "get_popover_lead_notice"){
|
||||
$lead = Lead::findOrFail($data['lead_id']);
|
||||
$ret = "";
|
||||
|
||||
if($lead->lead_notices->count()){
|
||||
$lead_notice = $lead->lead_notices->first();
|
||||
return $lead_notice->getSmallerMessage(500);
|
||||
}
|
||||
if($ret === ""){
|
||||
return 'keine Notiz';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function loadModal(){
|
||||
$data = Request::all();
|
||||
$ret = "";
|
||||
|
|
@ -100,12 +121,10 @@ class LeadController extends Controller
|
|||
return response()->json(['response' => $data, 'html'=>$ret]);
|
||||
}
|
||||
|
||||
public function delete($id, $del="lead"){
|
||||
public function delete($id, $del=false){
|
||||
|
||||
if($del === 'lead') {
|
||||
$lead = Lead::findOrFail($id);
|
||||
dump($lead);
|
||||
dd('TODO check delete');
|
||||
//Files
|
||||
$leadFiles = LeadFile::where('lead_id', $lead->id)->get();
|
||||
foreach ($leadFiles as $leadFile) {
|
||||
|
|
@ -114,12 +133,16 @@ class LeadController extends Controller
|
|||
$fileRepo->delete();
|
||||
$leadFile->delete();
|
||||
}
|
||||
//history
|
||||
$leadHistories = StatusHistory::where('lead_id', $lead->id)->get();
|
||||
foreach ($leadHistories as $leadHistory) {
|
||||
$leadHistory->delete();
|
||||
}
|
||||
//Mails Files CASCADE
|
||||
$lead->delete();
|
||||
\Session()->flash('alert-success', __('Anfrage gelöscht'));
|
||||
}
|
||||
|
||||
|
||||
if($del === 'lead_notice'){
|
||||
$leadNotice = LeadNotice::findOrFail($id);
|
||||
$lead = $leadNotice->lead;
|
||||
|
|
@ -160,7 +183,22 @@ class LeadController extends Controller
|
|||
})
|
||||
->addColumn('status', function (Lead $lead) {
|
||||
//umbuchen
|
||||
return $lead->getStatusBadge();
|
||||
return $lead->getStatusBadge();
|
||||
})
|
||||
->addColumn('lead_notice', function (Lead $lead) {
|
||||
return $lead->lead_notices->count() ? '<span data-order="1" class="badge badge-pill badge-success" data-lead_id="'.$lead->id.'" data-action="get_popover_lead_notice" data-placement="top" data-toggle="popover" title="letzte Notiz"><i class="fa fa-check"></i></span>' :
|
||||
'<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 '<span data-order="">-</span>';
|
||||
})
|
||||
->addColumn('action_delete', function (Lead $lead) {
|
||||
return '<a href="' . route('lead_delete', [$lead->id, 'lead']) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="fa fa-trash"></span></a>';
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('customer_id', 'customer_id $1')
|
||||
|
|
@ -176,7 +214,7 @@ class LeadController extends Controller
|
|||
$query->where('customer_id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'customer_id', 'sf_guard_user_id', 'id', 'status'])
|
||||
->rawColumns(['action_edit', 'customer_id', 'sf_guard_user_id', 'id', 'status', 'last_lead_email', 'lead_notice', 'action_delete'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ namespace App\Http\Controllers;
|
|||
use Carbon;
|
||||
use Request;
|
||||
use Response;
|
||||
use App\Models\Lead;
|
||||
use App\Services\Util;
|
||||
use App\Models\LeadFile;
|
||||
use App\Models\LeadMail;
|
||||
|
||||
use App\Models\EmailTemplate;
|
||||
use App\Models\CustomerFewoFile;
|
||||
use App\Models\CustomerFewoMail;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use App\Models\TravelUserBookingFewo;
|
||||
use App\Models\TravelUserBookingFile;
|
||||
use App\Repositories\LeadFileRepository;
|
||||
use App\Repositories\LeadMailRepository;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
|
@ -23,15 +23,15 @@ use App\Repositories\CustomerFewoMailRepository;
|
|||
class LeadMailController extends Controller
|
||||
{
|
||||
|
||||
protected $customerMailRepo;
|
||||
protected $leadMailRepo;
|
||||
|
||||
public function __construct(LeadMailRepository $customerMailRepo)
|
||||
public function __construct(LeadMailRepository $leadMailRepo)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
$this->customerMailRepo = $customerMailRepo;
|
||||
$this->leadMailRepo = $leadMailRepo;
|
||||
}
|
||||
|
||||
/* public function index()
|
||||
/*public function index()
|
||||
{
|
||||
$data = [
|
||||
|
||||
|
|
@ -42,48 +42,59 @@ class LeadMailController extends Controller
|
|||
public function detail($id)
|
||||
{
|
||||
if($id === "new") {
|
||||
$customer_mail = new CustomerFewoMail();
|
||||
$lead_mail = new LeadMail();
|
||||
$id = 'new';
|
||||
|
||||
}else{
|
||||
$customer_mail = CustomerFewoMail::findOrFail($id);
|
||||
$id = $customer_mail->id;
|
||||
$lead_mail = LeadMail::findOrFail($id);
|
||||
$id = $lead_mail->id;
|
||||
}
|
||||
|
||||
|
||||
$data = [
|
||||
'customer_mail' => $customer_mail,
|
||||
'lead_mail' => $lead_mail,
|
||||
'id' => $id,
|
||||
'back' => URL::previous(),
|
||||
];
|
||||
return view('customer.mail.detail', $data);
|
||||
|
||||
}
|
||||
}*/
|
||||
|
||||
public function store($id, $action=false)
|
||||
{
|
||||
$data = Request::all();
|
||||
$customer_mail = CustomerFewoMail::findOrFail($id);
|
||||
$lead_mail = LeadMail::findOrFail($id);
|
||||
|
||||
if($action === 'move-mail'){
|
||||
|
||||
if($action === 'move-mail-lead'){
|
||||
$lead_mail = LeadMail::findOrFail($id);
|
||||
$data['subdir'] = isset($data['subdir']) && $data['subdir'] ? $data['subdir'] : null;
|
||||
$customer_mail->dir = $data['dir'];
|
||||
$customer_mail->subdir = $data['subdir'];
|
||||
$customer_mail->save();
|
||||
$lead_mail->dir = $data['dir'];
|
||||
$lead_mail->subdir = $data['subdir'];
|
||||
$lead_mail->save();
|
||||
}
|
||||
|
||||
if($action === 'forward-mail-lead'){
|
||||
$lead_mail = LeadMail::findOrFail($id);
|
||||
$customerMailFewoRepo = new LeadMailRepository($lead_mail);
|
||||
$customerMailFewoRepo->forwardMail($lead_mail, $data);
|
||||
\Session()->flash('alert-success', __('E-Mail weitergeleitet'));
|
||||
|
||||
}
|
||||
|
||||
|
||||
return back();
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
$customer_mail = CustomerFewoMail::find($id);
|
||||
$customer_mail->dir = 12;
|
||||
$customer_mail->subdir = 0;
|
||||
$customer_mail->save();
|
||||
$lead_mail = LeadMail::find($id);
|
||||
$lead_mail->dir = 12;
|
||||
$lead_mail->subdir = 0;
|
||||
$lead_mail->save();
|
||||
|
||||
\Session()->flash('alert-success', __('Mail gelöscht'));
|
||||
return back();
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
public function loadModal(){
|
||||
|
|
@ -91,17 +102,16 @@ class LeadMailController extends Controller
|
|||
$ret = "";
|
||||
|
||||
if(Request::ajax()) {
|
||||
/* if ($data['action'] === "new-customer-mail" || $data['action'] === "reply-customer-mail" || $data['action'] === "show-customer-mail" || $data['action'] === "edit-customer-mail"){
|
||||
if ($data['action'] === "new-lead-mail" || $data['action'] === "reply-lead-mail" || $data['action'] === "show-lead-mail" || $data['action'] === "edit-lead-mail"){
|
||||
$data['customers'] = [];
|
||||
if ($data['action'] === "new-customer-mail" && isset($data['travel_user_booking_fewo_id']) && $TravelUserBookingFewo = TravelUserBookingFewo::find($data['travel_user_booking_fewo_id'])) {
|
||||
if ($data['action'] === "new-lead-mail" && isset($data['lead_id']) && $lead = Lead::find($data['lead_id'])) {
|
||||
$tmp = [];
|
||||
$tmp['email'] = $TravelUserBookingFewo->travel_user ? $TravelUserBookingFewo->travel_user->email : "";
|
||||
$tmp['name'] = $TravelUserBookingFewo->travel_user ? $TravelUserBookingFewo->travel_user->first_name . " " . $TravelUserBookingFewo->travel_user->last_name . " | " : "- | ";
|
||||
$tmp['name'] .= $TravelUserBookingFewo->fewo_lodging_id ? $TravelUserBookingFewo->fewo_lodging->name . " | " : "- | ";
|
||||
$data['customers'][$TravelUserBookingFewo->id] = $tmp;
|
||||
$tmp['email'] = $lead->customer ? $lead->customer->email : "";
|
||||
$tmp['name'] = $lead->customer ? $lead->customer->firstname . " " . $lead->customer->name . " | " : "- | ";
|
||||
$data['customers'][$lead->id] = $tmp;
|
||||
}
|
||||
$ret = CustomerFewoMailRepository::loadModal($data);
|
||||
}*/
|
||||
$ret = LeadMailRepository::loadModal($data);
|
||||
}
|
||||
|
||||
if($data['action'] === "modal-upload-lead-file") {
|
||||
$ret = view("lead.upload_modal", compact('data'))->render();
|
||||
|
|
@ -122,9 +132,9 @@ class LeadMailController extends Controller
|
|||
}
|
||||
|
||||
|
||||
public function sendMail(CustomerFewoMailRepository $customerFewoMailRepository){
|
||||
public function sendMail(LeadMailRepository $leadMailRepository){
|
||||
$data = Request::all();
|
||||
$customerFewoMailRepository->sendAndStore($data);
|
||||
$leadMailRepository->sendAndStore($data);
|
||||
if($data['action'] == 'draft'){
|
||||
\Session()->flash('alert-success', "Entwurf gespeichert!");
|
||||
}else{
|
||||
|
|
@ -133,62 +143,14 @@ class LeadMailController extends Controller
|
|||
return back();
|
||||
}
|
||||
|
||||
public function replyMail(CustomerFewoMailRepository $customerFewoMailRepository){
|
||||
public function replyMail(LeadMailRepository $LeadMailRepository){
|
||||
$data = Request::all();
|
||||
$customerFewoMailRepository->replyStore($data);
|
||||
$LeadMailRepository->replyStore($data);
|
||||
\Session()->flash('alert-success', "Mail gespeichert!");
|
||||
return back();
|
||||
}
|
||||
|
||||
/*public function getCustomerFewoMails()
|
||||
{
|
||||
$query = CustomerFewoMail::with('booking')->with('customer')->select('customer_mails.*');
|
||||
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('action_edit', function (CustomerFewoMail $customer_mail) {
|
||||
return '<a href="'.route('customer_mail_detail', [$customer_mail->id]).'" class="btn icon-btn btn-sm btn-primary"><span class="fa fa-edit"></span></a>';
|
||||
})
|
||||
->addColumn('id', function (CustomerFewoMail $customer_mail) {
|
||||
return '<a data-order="'.$customer_mail->id.'" href="'.route('customer_mail_detail', [$customer_mail->id]).'" data-id="'.$customer_mail->id.'">'.$customer_mail->id.'</a>';
|
||||
})
|
||||
->addColumn('booking', function (CustomerFewoMail $customer_mail) {
|
||||
$out = $customer_mail->booking->travel_country_id ? $customer_mail->booking->travel_country->name." | " : "- | ";
|
||||
$out .= $customer_mail->booking->travelagenda_id ? $customer_mail->booking->travel_agenda->name."" : "-";
|
||||
return $out;
|
||||
})
|
||||
->addColumn('travel_user_booking_fewo_id', function (CustomerFewoMail $customer_mail) {
|
||||
return '<a data-order="'.$customer_mail->travel_user_booking_fewo_id.'" href="'.route('booking_detail', [$customer_mail->travel_user_booking_fewo_id]).'">'.$customer_mail->travel_user_booking_fewo_id.'</a>';
|
||||
})
|
||||
->addColumn('customer_id', function (CustomerFewoMail $customer_mail) {
|
||||
return '<a data-order="'.$customer_mail->customer_id.'" href="'.route('customer_detail', [$customer_mail->customer_id]).'">'.$customer_mail->customer_id.'</a>';
|
||||
})
|
||||
->addColumn('send', function (CustomerFewoMail $customer_mail) {
|
||||
return $customer_mail->send ? '<span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>' : '<span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('travel_user_booking_fewo_id', 'travel_user_booking_fewo_id $1')
|
||||
->orderColumn('customer_id', 'customer_id $1')
|
||||
->orderColumn('send', 'send $1')
|
||||
|
||||
->filterColumn('id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('customer_id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('customer_id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->filterColumn('travel_user_booking_fewo_id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
$query->where('travel_user_booking_fewo_id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'send', 'customer_id', 'travel_user_booking_fewo_id', 'id'])
|
||||
->make(true);
|
||||
}*/
|
||||
|
||||
|
||||
public function getEmailTemplates()
|
||||
{
|
||||
$query = EmailTemplate::with('email_template_dir')->select('email_templates.*')->where('active', '=', true);
|
||||
|
|
@ -230,12 +192,12 @@ class LeadMailController extends Controller
|
|||
|
||||
public function uploadAttachment($id){
|
||||
|
||||
$fileRepo = new CustomerFewoFileRepository(new CustomerFewoFile());
|
||||
$fileRepo = new LeadFileRepository(new LeadFile());
|
||||
if($id === 'tmp'){
|
||||
$fileRepo->_set('disk', 'travel_user');
|
||||
$fileRepo->_set('disk', 'lead');
|
||||
$fileRepo->_set('dir', '/attachment/'.date('Y/m').'/');
|
||||
$fileRepo->_set('travel_user_id', NULL);
|
||||
$fileRepo->_set('customer_fewo_mail_id', NULL);
|
||||
$fileRepo->_set('lead_id', NULL);
|
||||
$fileRepo->_set('lead_mail_id', NULL);
|
||||
$fileRepo->_set('identifier', 'tmp');
|
||||
return $fileRepo->uploadFile(Request::all());
|
||||
}
|
||||
|
|
@ -252,9 +214,9 @@ class LeadMailController extends Controller
|
|||
$status = false;
|
||||
if(Request::ajax()){
|
||||
if($data['action'] === 'toggle_important'){
|
||||
$customer_mail = CustomerFewoMail::find($data['id']);
|
||||
$customer_mail->important = ($customer_mail->important ? false : true);
|
||||
$customer_mail->save();
|
||||
$lead_mail = LeadMail::find($data['id']);
|
||||
$lead_mail->important = ($lead_mail->important ? false : true);
|
||||
$lead_mail->save();
|
||||
$status = 'success';
|
||||
}
|
||||
if($data['action'] === 'load_email_template'){
|
||||
|
|
@ -264,9 +226,9 @@ class LeadMailController extends Controller
|
|||
$status = 'success';
|
||||
}
|
||||
if($data['action'] === 'delete_mail_attachment'){
|
||||
$customer_file = CustomerFewoFile::find($data['id']);
|
||||
$fileRepo = new CustomerFewoFileRepository($customer_file);
|
||||
$fileRepo->_set('disk', 'travel_user');
|
||||
$lead_file = LeadFile::find($data['id']);
|
||||
$fileRepo = new LeadFileRepository($lead_file);
|
||||
$fileRepo->_set('disk', 'lead');
|
||||
$ret = $fileRepo->delete();
|
||||
$status = 'success';
|
||||
}
|
||||
|
|
@ -281,11 +243,11 @@ class LeadMailController extends Controller
|
|||
$contents = file_get_contents($data['target'], false, stream_context_create($arrContextOptions));
|
||||
$mine = Util::getMimeFromHeader($http_response_header);
|
||||
$extension = Util::getExtensionFromMime($mine);
|
||||
$fileRepo = new CustomerFewoFileRepository(new CustomerFewoFile());
|
||||
$fileRepo->_set('disk', 'travel_user');
|
||||
$fileRepo = new LeadFileRepository(new LeadFile());
|
||||
$fileRepo->_set('disk', 'lead');
|
||||
$fileRepo->_set('dir', '/attachment/'.date('Y/m').'/');
|
||||
$fileRepo->_set('travel_user_id', NULL);
|
||||
$fileRepo->_set('customer_fewo_mail_id', NULL);
|
||||
$fileRepo->_set('lead_id', NULL);
|
||||
$fileRepo->_set('lead_mail_id', NULL);
|
||||
$fileRepo->_set('identifier', 'tmp');
|
||||
$fileRepo->_set('originalName', $data['name']);
|
||||
$fileRepo->_set('mine', $mine);
|
||||
|
|
@ -298,17 +260,17 @@ class LeadMailController extends Controller
|
|||
|
||||
private function getSearchRequests()
|
||||
{
|
||||
if (!Request::get('travel_user_booking_fewo_id')) {
|
||||
if (!Request::get('lead_id')) {
|
||||
return false;
|
||||
}
|
||||
$query = CustomerFewoMail::where('travel_user_booking_fewo_id', '=', Request::get('travel_user_booking_fewo_id'));
|
||||
if (Request::get('customer_mail_dir') == 11) { //draft
|
||||
$query = LeadMail::where('lead_id', '=', Request::get('lead_id'));
|
||||
if (Request::get('lead_mail_dir') == 11) { //draft
|
||||
$query->where('draft', '=', true)->where('dir', '!=', 12);
|
||||
}else{
|
||||
$query->where('dir', '=', Request::get('customer_mail_dir')); //with('lead'
|
||||
$query->where('dir', '=', Request::get('lead_mail_dir')); //with('lead'
|
||||
}
|
||||
if (Request::get('customer_mail_subdir')) {
|
||||
$query->where('subdir', '=', Request::get('customer_mail_subdir'));
|
||||
if (Request::get('lead_mail_subdir')) {
|
||||
$query->where('subdir', '=', Request::get('lead_mail_subdir'));
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
|
@ -317,7 +279,7 @@ class LeadMailController extends Controller
|
|||
|
||||
$query = $this->getSearchRequests();
|
||||
return \DataTables::eloquent($query)
|
||||
->addColumn('checkbox', function (CustomerFewoMail $customer_mail) {
|
||||
->addColumn('checkbox', function (LeadMail $lead_mail) {
|
||||
return '<div class="message-checkbox mr-1">
|
||||
<label class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input">
|
||||
|
|
@ -325,54 +287,54 @@ class LeadMailController extends Controller
|
|||
</label>
|
||||
</div>';
|
||||
})
|
||||
->addColumn('important', function (CustomerFewoMail $customer_mail) {
|
||||
$icon = ($customer_mail->important ? 'ion-md-star' : 'ion-md-star-outline');
|
||||
->addColumn('important', function (LeadMail $lead_mail) {
|
||||
$icon = ($lead_mail->important ? 'ion-md-star' : 'ion-md-star-outline');
|
||||
return '<a href="javascript:void(0)" class="ion '.$icon.' d-block text-secondary text-big mr-3 customer-mail-ajax-action"
|
||||
data-url="'.route('customer_fewo_mail_ajax').'" data-id="'.$customer_mail->id.'" data-important="'.$customer_mail->important.'" data-action="toggle_important"></a>';
|
||||
data-url="'.route('lead_mail_ajax').'" data-id="'.$lead_mail->id.'" data-important="'.$lead_mail->important.'" data-action="toggle_important"></a>';
|
||||
})
|
||||
->addColumn('subject', function (CustomerFewoMail $customer_mail) {
|
||||
->addColumn('subject', function (LeadMail $lead_mail) {
|
||||
|
||||
$icon = $customer_mail->reply_id ? 'ion-ios-redo' : 'ion-ios-mail';
|
||||
$badge = $customer_mail->is_answer ? 'badge-next' : 'badge-secondary';
|
||||
$badge = $customer_mail->draft ? 'badge-default' : $badge;
|
||||
$to_icon = $customer_mail->draft ? '<i class="ion ion-ios-warning" style="opacity: 0.7"></i>' : '';
|
||||
$action = $customer_mail->draft ? 'edit-customer-mail' : 'show-customer-mail';
|
||||
$id = $customer_mail->draft ? $customer_mail->id : 'new';
|
||||
$url = $customer_mail->draft ? route('customer_fewo_mail_send_mail') : '';
|
||||
$icon = $lead_mail->reply_id ? 'ion-ios-redo' : 'ion-ios-mail';
|
||||
$badge = $lead_mail->is_answer ? 'badge-next' : 'badge-secondary';
|
||||
$badge = $lead_mail->draft ? 'badge-default' : $badge;
|
||||
$to_icon = $lead_mail->draft ? '<i class="ion ion-ios-warning" style="opacity: 0.7"></i>' : '';
|
||||
$action = $lead_mail->draft ? 'edit-lead-mail' : 'show-lead-mail';
|
||||
$id = $lead_mail->draft ? $lead_mail->id : 'new';
|
||||
$url = $lead_mail->draft ? route('lead_mail_send_mail') : '';
|
||||
|
||||
return '<a href="javascript:void(0)" class="badge '.$badge.'" data-toggle="modal"
|
||||
data-target="#modals-load-content" data-id="'.$id.'" data-model="CustomerFewoMail"
|
||||
data-target="#modals-load-content" data-id="'.$id.'" data-model="LeadMail"
|
||||
data-action="'.$action.'" data-url="'.$url.'" data-redirect="back"
|
||||
data-customer_mail_id="'.$customer_mail->id.'" data-route="'.route('customer_fewo_modal_load').'">
|
||||
'.$to_icon.'<i class="ion '.$icon.' ui-w-30 text-center" style="opacity: 0.7"></i>'.$customer_mail->subject.'
|
||||
'.($customer_mail->customer_fewo_files->count() ? ' <i class="ion ion-md-attach"> <span class="badge badge-primary indicator">'.$customer_mail->customer_fewo_files->count().'</span></i>' : '');
|
||||
data-lead_mail_id="'.$lead_mail->id.'" data-route="'.route('lead_mail_modal_load').'">
|
||||
'.$to_icon.'<i class="ion '.$icon.' ui-w-30 text-center" style="opacity: 0.7"></i>'.$lead_mail->subject.'
|
||||
'.($lead_mail->lead_files->count() ? ' <i class="ion ion-md-attach"> <span class="badge badge-primary indicator">'.$lead_mail->lead_files->count().'</span></i>' : '');
|
||||
|
||||
})
|
||||
->addColumn('date', function (CustomerFewoMail $customer_mail) {
|
||||
if($customer_mail->send){
|
||||
return '<span class="badge badge-success" style="background-color: #94ae59"><i class="fa fa-check-circle"></i> '.$customer_mail->sent_at.'</span>';
|
||||
->addColumn('date', function (LeadMail $lead_mail) {
|
||||
if($lead_mail->send){
|
||||
return '<span class="badge badge-success" style="background-color: #94ae59"><i class="fa fa-check-circle"></i> '.$lead_mail->sent_at.'</span>';
|
||||
}
|
||||
return '<span class="badge badge-default"><i class="fa fa-times-circle"></i> '.$customer_mail->sent_at.'</span>';
|
||||
return '<span class="badge badge-default"><i class="fa fa-times-circle"></i> '.$lead_mail->sent_at.'</span>';
|
||||
})
|
||||
->addColumn('action', function (CustomerFewoMail $customer_mail) {
|
||||
->addColumn('action', function (LeadMail $lead_mail) {
|
||||
$ret = '';
|
||||
if(!$customer_mail->draft){
|
||||
if(!$lead_mail->draft){
|
||||
$ret = '<a href="javascript:void(0)" class="btn btn-xs btn-secondary" data-toggle="modal"
|
||||
data-target="#modals-load-content" data-id="reply-send" data-model="customerMail" data-action="new-customer-mail"
|
||||
data-url="'.route('customer_fewo_mail_send_mail').'" data-redirect="back" data-customer_mail_id="'.$customer_mail->id.'"
|
||||
data-travel_user_booking_fewo_id="'.$customer_mail->travel_user_booking_fewo_id.'" data-route="'.route('customer_fewo_modal_load').'" data-customer_mail_dir="'.$customer_mail->dir.'" data-customer_subdir="'.$customer_mail->subdir.'">
|
||||
data-target="#modals-load-content" data-id="reply-send" data-model="LeadMail" data-action="new-lead-mail"
|
||||
data-url="'.route('lead_mail_send_mail').'" data-redirect="back" data-lead_mail_id="'.$lead_mail->id.'"
|
||||
data-lead_id="'.$lead_mail->lead_id.'" data-route="'.route('lead_mail_modal_load').'" data-lead_mail_dir="'.$lead_mail->dir.'" data-customer_subdir="'.$lead_mail->subdir.'">
|
||||
<span title="Antwort auf E-Mail senden" data-placement="left" rel="tooltip"><i class="ion ion-ios-redo"></i> <i class="ion ion-md-mail-open"></i></span>
|
||||
</a>
|
||||
|
||||
<a href="javascript:void(0)" class="btn btn-xs btn-default" data-toggle="modal"
|
||||
data-target="#modals-load-content" data-id="reply-save" data-model="customerMail" data-action="reply-customer-mail"
|
||||
data-url="'.route('customer_fewo_mail_reply_mail').'" data-redirect="back" data-customer_mail_id="'.$customer_mail->id.'"
|
||||
data-travel_user_booking_fewo_id="'.$customer_mail->travel_user_booking_fewo_id.'" data-route="'.route('customer_fewo_modal_load').'" data-customer_mail_dir="'.$customer_mail->dir.'" data-customer_mail_subdir="'.$customer_mail->subdir.'">
|
||||
data-target="#modals-load-content" data-id="reply-save" data-model="LeadMail" data-action="reply-lead-mail"
|
||||
data-url="'.route('lead_mail_reply_mail').'" data-redirect="back" data-lead_mail_id="'.$lead_mail->id.'"
|
||||
data-lead_id="'.$lead_mail->lead_id.'" data-route="'.route('lead_mail_modal_load').'" data-lead_mail_dir="'.$lead_mail->dir.'" data-lead_mail_subdir="'.$lead_mail->subdir.'">
|
||||
<span title="Antwort auf E-Mail speichern" data-placement="left" rel="tooltip"><i class="ion ion-ios-redo"></i> <i class="ion ion-md-mail-unread"></i></span>
|
||||
</a>
|
||||
';
|
||||
}
|
||||
$ret .= '<a href="'.route('customer_fewo_mail_delete', [$customer_mail->id]).'" class="btn btn-xs btn-default text-danger" onclick="return confirm(\'In den Papierkorb verschieben?\');"><i class="ion ion-md-trash"></i></a>';
|
||||
$ret .= '<a href="'.route('lead_mail_delete', [$lead_mail->id]).'" class="btn btn-xs btn-default text-danger" onclick="return confirm(\'In den Papierkorb verschieben?\');"><i class="ion ion-md-trash"></i></a>';
|
||||
return '<div style="white-space: nowrap;">'.$ret.'</div>';
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -195,6 +195,26 @@ class TravelUserBookingFewoController extends Controller
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getAjaxRequests(){
|
||||
|
||||
$data = Request::all();
|
||||
if(Request::ajax()) {
|
||||
if(isset($data['action']) && $data['action'] === "get_popover_fewo_notice"){
|
||||
$TravelUserBookingFewo = TravelUserBookingFewo::findOrFail($data['travel_user_booking_fewo_id']);
|
||||
$ret = "";
|
||||
if($TravelUserBookingFewo->booking_fewo_notices->count()){
|
||||
$booking_fewo_notice = $TravelUserBookingFewo->booking_fewo_notices->first();
|
||||
return $booking_fewo_notice->getSmallerMessage(500);
|
||||
}
|
||||
if($ret === ""){
|
||||
return 'keine Notiz';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function loadModal(){
|
||||
$data = Request::all();
|
||||
|
|
@ -296,6 +316,10 @@ class TravelUserBookingFewoController extends Controller
|
|||
$back .= "</div>";
|
||||
return $back;
|
||||
})
|
||||
->addColumn('booking_fewo_notice', function (TravelUserBookingFewo $travel_user_booking_fewo) {
|
||||
return $travel_user_booking_fewo->booking_fewo_notices->count() ? '<span data-order="1" class="badge badge-pill badge-success" data-travel_user_booking_fewo_id="'.$travel_user_booking_fewo->id.'" data-action="get_popover_fewo_notice" data-placement="top" data-toggle="popover" title="letzte Notiz"><i class="fa fa-check"></i></span>' :
|
||||
'<span data-order="0" class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('action_delete', function (TravelUserBookingFewo $travel_user_booking_fewo) {
|
||||
return '<a href="' . route('travel_user_booking_fewo_delete', [$travel_user_booking_fewo->id]) . '" class="btn icon-btn btn-sm btn-danger" onclick="return confirm(\''.__('Really delete entry?').'\');"><span class="fa fa-trash"></span></a>';
|
||||
})
|
||||
|
|
@ -307,7 +331,7 @@ class TravelUserBookingFewoController extends Controller
|
|||
});
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'travel_user', 'is_calendar', 'is_mail', 'action_delete'])
|
||||
->rawColumns(['action_edit', 'travel_user', 'is_calendar', 'is_mail', 'booking_fewo_notice', 'action_delete'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue