Mail Weiterleitung / verlauf / Notizen Buchnungen
This commit is contained in:
parent
f1a1baa913
commit
644ec93c53
47 changed files with 663 additions and 59 deletions
71
app/Http/Controllers/API/LeadController.php
Normal file
71
app/Http/Controllers/API/LeadController.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\API;
|
||||
|
||||
use Request;
|
||||
use Validator;
|
||||
use App\Models\Lead;
|
||||
use App\Models\Customer;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class LeadController extends Controller
|
||||
{
|
||||
public $successStatus = 200;
|
||||
public $errorStatus = 500;
|
||||
public $data = "";
|
||||
public $room_str = "";
|
||||
public $room_name = "";
|
||||
public $className = "";
|
||||
public $option = "";
|
||||
|
||||
public function action($action)
|
||||
{
|
||||
|
||||
if ($action == "create_lead") {
|
||||
$data = Request::all();
|
||||
|
||||
if(!isset($data['lead']) && !is_array($data['lead'])) {
|
||||
return response()->json(['error' => 'lead not exist, but need'], $this->errorStatus);
|
||||
}
|
||||
if(!isset($data['lead']['customerForm'])){
|
||||
return response()->json(['error' => 'lead customerForm not exist, but need'], $this->errorStatus);
|
||||
}
|
||||
|
||||
//customer
|
||||
/* $rules = array(
|
||||
'name' => 'required',
|
||||
'email' => 'requird'
|
||||
|
||||
);
|
||||
$validator = Validator::make($data['lead']['customerForm'], $rules);
|
||||
if ($validator->fails()) {
|
||||
return response()->json($validator->messages(), $this->errorStatus);
|
||||
|
||||
}
|
||||
|
||||
//lead
|
||||
$rules = array(
|
||||
'sf_guard_user_id' => 'required',
|
||||
'status_id' => 'requird',
|
||||
'request_date' => 'requird'
|
||||
);
|
||||
$validator = Validator::make($data['lead'], $rules);
|
||||
if ($validator->fails()) {
|
||||
return response()->json($validator->messages(), $this->errorStatus);
|
||||
|
||||
}*/
|
||||
|
||||
$customer = Customer::create($data['lead']['customerForm']);
|
||||
unset($data['lead']['customerForm']);
|
||||
$data['lead']['customer_id'] = $customer->id;
|
||||
$lead = Lead::create($data['lead']);
|
||||
$ret= [
|
||||
'url_v1' => make_old_url('/index.php/leads/'.$lead->id.'/edit'),
|
||||
'url_v3' => route('lead_detail', $lead->id),
|
||||
'lead_id' => $lead->id
|
||||
];
|
||||
|
||||
return response()->json(['success' => $ret], $this->successStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -58,6 +58,12 @@ class BookingController extends Controller
|
|||
|
||||
$data = Request::all();
|
||||
|
||||
if($data['action'] === 'save_notice'){
|
||||
$booking = $this->bookingRepo->updateNotice($id, $data);
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('booking_detail', [$booking->id])."#collapseBookingNotice");
|
||||
}
|
||||
|
||||
if($data['action'] === 'update_booking'){
|
||||
$booking = $this->bookingRepo->updateBooking($id, $data);
|
||||
\Session()->flash('alert-save', '1');
|
||||
|
|
@ -268,6 +274,12 @@ class BookingController extends Controller
|
|||
\Session()->flash('alert-success', 'Datei gelöscht');
|
||||
return redirect(route('booking_detail', [$booking->id]));
|
||||
}
|
||||
if($del === 'passolution_file'){
|
||||
$booking = Booking::findOrFail($id);
|
||||
$booking->resyncPassolutionPDF();
|
||||
\Session()->flash('alert-success', 'Passolution erneuert');
|
||||
return redirect(route('booking_detail', [$booking->id]));
|
||||
}
|
||||
return redirect(route('requests'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ class CustomerFewoMailController extends Controller
|
|||
public function loadModal(){
|
||||
$data = Request::all();
|
||||
$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"){
|
||||
$data['customers'] = [];
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use App\Models\CustomerFewoMail;
|
|||
use App\Models\CustomerFile;
|
||||
use App\Models\CustomerMail;
|
||||
use App\Models\EmailTemplate;
|
||||
use App\Repositories\CustomerFewoMailRepository;
|
||||
use App\Repositories\CustomerMailRepository;
|
||||
use App\Repositories\CustomerFileRepository;
|
||||
use App\Services\Util;
|
||||
|
|
@ -72,6 +73,22 @@ class CustomerMailController extends Controller
|
|||
$customer_mail->subdir = $data['subdir'];
|
||||
$customer_mail->save();
|
||||
}
|
||||
|
||||
if($action === 'forward_fewo-email'){
|
||||
$customer_mail = CustomerFewoMail::findOrFail($id);
|
||||
$customerMailFewoRepo = new CustomerFewoMailRepository($customer_mail);
|
||||
$customerMailFewoRepo->forwardMail($customer_mail, $data);
|
||||
\Session()->flash('alert-success', __('E-Mail weitergeleitet'));
|
||||
|
||||
}
|
||||
|
||||
if($action === 'forward_email'){
|
||||
$customer_mail = CustomerMail::findOrFail($id);
|
||||
$this->customerMailRepo->forwardMail($customer_mail, $data);
|
||||
\Session()->flash('alert-success', __('E-Mail weitergeleitet'));
|
||||
|
||||
|
||||
}
|
||||
return back();
|
||||
}
|
||||
|
||||
|
|
@ -164,10 +181,17 @@ class CustomerMailController extends Controller
|
|||
->addColumn('send', function (CustomerMail $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>';
|
||||
})
|
||||
->addColumn('date', function (CustomerMail $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>';
|
||||
}
|
||||
return '<span class="badge badge-default"><i class="fa fa-times-circle"></i> '.$customer_mail->sent_at.'</span>';
|
||||
})
|
||||
->orderColumn('id', 'id $1')
|
||||
->orderColumn('booking_id', 'booking_id $1')
|
||||
->orderColumn('customer_id', 'customer_id $1')
|
||||
->orderColumn('send', 'send $1')
|
||||
->orderColumn('date', 'sent_at $1')
|
||||
|
||||
->filterColumn('id', function($query, $keyword) {
|
||||
if($keyword != ""){
|
||||
|
|
@ -184,7 +208,7 @@ class CustomerMailController extends Controller
|
|||
$query->where('booking_id', 'LIKE', '%'.$keyword.'%');
|
||||
}
|
||||
})
|
||||
->rawColumns(['action_edit', 'send', 'customer_id', 'booking_id', 'id'])
|
||||
->rawColumns(['action_edit', 'send', 'date', 'customer_id', 'booking_id', 'id'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
|
@ -331,7 +355,8 @@ class CustomerMailController extends Controller
|
|||
})
|
||||
->addColumn('subject', function (CustomerMail $customer_mail) {
|
||||
|
||||
$icon = $customer_mail->reply_id ? 'ion-ios-redo' : 'ion-ios-mail';
|
||||
|
||||
$icon = $customer_mail->reply_id ? '<i class="ion ion-ios-redo ui-w-20 text-center" style="opacity: 0.7"></i>' : '<i class="ion ion-ios-mail ui-w-20 text-center" style="opacity: 0.7"></i>';
|
||||
$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>' : '';
|
||||
|
|
@ -339,11 +364,16 @@ class CustomerMailController extends Controller
|
|||
$id = $customer_mail->draft ? $customer_mail->id : 'new';
|
||||
$url = $customer_mail->draft ? route('customer_mail_send_mail') : '';
|
||||
|
||||
$deep = $customer_mail->customer_mail_deep();
|
||||
for ($i=1; $i < $deep; $i++) {
|
||||
$icon .= '<i class="ion ion-ios-redo ui-w-20 text-center" style="opacity: 0.7"></i>';
|
||||
}
|
||||
|
||||
return '<a href="javascript:void(0)" class="badge '.$badge.'" data-toggle="modal"
|
||||
data-target="#modals-load-content" data-id="'.$id.'" data-model="customerMail"
|
||||
data-action="'.$action.'" data-url="'.$url.'" data-redirect="back"
|
||||
data-customer_mail_id="'.$customer_mail->id.'" data-route="'.route('booking_modal_load').'">
|
||||
'.$to_icon.'<i class="ion '.$icon.' ui-w-30 text-center" style="opacity: 0.7"></i>'.$customer_mail->subject.'
|
||||
'.$to_icon.''.$icon.' '.$customer_mail->subject.'
|
||||
'.($customer_mail->customer_files->count() ? ' <i class="ion ion-md-attach"> <span class="badge badge-primary indicator">'.$customer_mail->customer_files->count().'</span></i>' : '');
|
||||
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\BookingNotice;
|
||||
use App\Models\SfGuardUser;
|
||||
use App\User;
|
||||
use Auth;
|
||||
|
|
@ -40,8 +41,11 @@ class HomeController extends Controller
|
|||
if(!Auth::check()){
|
||||
return redirect('login');
|
||||
}
|
||||
|
||||
$last_booking_notices = BookingNotice::orderBy('created_at', 'DESC')->limit(10)->get();
|
||||
$data = [
|
||||
'user' => Auth::user(),
|
||||
'last_booking_notices' => $last_booking_notices,
|
||||
];
|
||||
return view('home', $data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,7 +233,6 @@ class RequestController extends Controller
|
|||
if(isset($data['action']) && $data['action'] === "get_popover_booking_services") {
|
||||
$booking = Booking::findOrFail($data['booking_id']);
|
||||
$ret = "";
|
||||
|
||||
$count = false;
|
||||
foreach($booking->travel_country->getContactLandsModels() as $TravelCountry){
|
||||
if($TravelCountry->stern_travel_country){
|
||||
|
|
@ -291,6 +290,20 @@ class RequestController extends Controller
|
|||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if(isset($data['action']) && $data['action'] === "get_popover_booking_notice"){
|
||||
$booking = Booking::findOrFail($data['booking_id']);
|
||||
$ret = "";
|
||||
|
||||
if($booking->booking_notices->count()){
|
||||
$booking_notice = $booking->booking_notices->first();
|
||||
return $booking_notice->getSmallerMessage(500);
|
||||
}
|
||||
if($ret === ""){
|
||||
return 'keine Notiz';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
$query = $this->getSearchRequests();
|
||||
$ret = $query->get()->pluck('travelagenda_id', 'id')->unique()->toArray();
|
||||
return TravelAgenda::whereIn('id', $ret)->get()->pluck('name', 'id');
|
||||
|
|
@ -363,9 +376,15 @@ class RequestController extends Controller
|
|||
return $booking->travel_documents ? '<span data-order="1" class="badge badge-pill badge-success" title="Reiseunterlagen" data-placement="top" rel="tooltip"><i class="fa fa-check"></i></span>' : '<span data-order="0" class="badge badge-pill badge-danger" title="Reiseunterlagen" data-placement="top" rel="tooltip"><i class="fa fa-times"></i></span>';
|
||||
})
|
||||
->addColumn('booking_services', function (Booking $booking) {
|
||||
return $booking->hasBookingServicesUnchecked() ? '<span data-order="1" class="badge badge-pill badge-success" data-booking_id="'.$booking->id.'" data-placement="top" data-toggle="popover" title="ServiceLeistungen"><i class="fa fa-check"></i></span>' :
|
||||
'<span data-order="0" class="badge badge-pill badge-danger" data-booking_id="'.$booking->id.'" data-placement="top" data-toggle="popover" title="ServiceLeistungen"><i class="fa fa-times"></i></span>';
|
||||
return $booking->hasBookingServicesUnchecked() ? '<span data-order="1" class="badge badge-pill badge-success" data-booking_id="'.$booking->id.'" data-action="get_popover_booking_services" data-placement="top" data-toggle="popover" title="ServiceLeistungen"><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('booking_notice', function (Booking $booking) {
|
||||
return $booking->booking_notices->count() ? '<span data-order="1" class="badge badge-pill badge-success" data-booking_id="'.$booking->id.'" data-action="get_popover_booking_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('sf_guard_user_id', function (Booking $booking) {
|
||||
return '<span data-order="'.($booking->sf_guard_user_id ? $booking->sf_guard_user_id : 0).'">'.($booking->sf_guard_user_id? $booking->sf_guard_user->first_name." ".$booking->sf_guard_user->last_name : "-").'</span>';
|
||||
|
|
@ -467,7 +486,7 @@ class RequestController extends Controller
|
|||
->orderColumn('xx_tkt', 'xx_tkt_date $1')
|
||||
->orderColumn('comfort', 'comfort $1')
|
||||
//->orderColumn('travel_documents', 'travel_documents $1')
|
||||
->rawColumns(['action_lead_edit', 'comfort', 'lead_id', 'participant_firstname', 'participant_name', 'action_booking_edit', 'travel_country_id', 'travelagenda_id', 'travel_company_id', 'sf_guard_user_id', 'lead.status_id', 'last_customer_email', 'id', 'travel_documents', 'booking_services', 'paying_out', 'paying_out_status', 'airline_id', 'refund', 'hold', 'xx_tkt'])
|
||||
->rawColumns(['action_lead_edit', 'comfort', 'lead_id', 'participant_firstname', 'participant_name', 'action_booking_edit', 'travel_country_id', 'travelagenda_id', 'travel_company_id', 'sf_guard_user_id', 'lead.status_id', 'last_customer_email', 'id', 'travel_documents', 'booking_services', 'booking_notice', 'paying_out', 'paying_out_status', 'airline_id', 'refund', 'hold', 'xx_tkt'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue