Mails, Strono, filter
This commit is contained in:
parent
f53f17f9c1
commit
62e84637b6
99 changed files with 2409 additions and 474 deletions
|
|
@ -3,10 +3,15 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Customer;
|
||||
use App\Models\CustomerFile;
|
||||
use App\Models\CustomerMail;
|
||||
use App\Repositories\CustomerMailRepository;
|
||||
use App\Repositories\FileRepository;
|
||||
use Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Request;
|
||||
use Response;
|
||||
|
||||
class CustomerMailController extends Controller
|
||||
{
|
||||
|
|
@ -37,9 +42,12 @@ class CustomerMailController extends Controller
|
|||
$customer_mail = CustomerMail::findOrFail($id);
|
||||
$id = $customer_mail->id;
|
||||
}
|
||||
|
||||
|
||||
$data = [
|
||||
'customer_mail' => $customer_mail,
|
||||
'id' => $id,
|
||||
'back' => URL::previous(),
|
||||
];
|
||||
return view('customer.mail.detail', $data);
|
||||
|
||||
|
|
@ -61,6 +69,56 @@ class CustomerMailController extends Controller
|
|||
return redirect(route('lead_detail', [$lead->id]));*/
|
||||
}
|
||||
|
||||
|
||||
/* public function loadModal(){
|
||||
$data = Request::all();
|
||||
$ret = "";
|
||||
if(Request::ajax()){
|
||||
|
||||
$customers = [];
|
||||
$query = $this->getSearchRequests();
|
||||
$bookings = $query->orderBy('id', 'DESC')->limit(50)->get();
|
||||
foreach ($bookings as $booking){
|
||||
$tmp = "";
|
||||
$tmp .= $booking->customer ? $booking->customer->email." | " : "- | ";
|
||||
$tmp .= $booking->customer ? $booking->customer->firstname." ".$booking->customer->name." | " : "- | ";
|
||||
$tmp .= $booking->travel_country_id ? $booking->travel_country->name." | " : "- | ";
|
||||
$tmp .= $booking->travelagenda_id ? $booking->travel_agenda->name."" : "-";
|
||||
|
||||
$customers[$booking->id] = $tmp;
|
||||
}
|
||||
|
||||
// return TravelAgenda::whereIn('id', $ret)->get()->pluck('name', 'id');
|
||||
|
||||
if($data['action'] === "send-customer-mail"){
|
||||
$value = new Collection();
|
||||
$value->id = "add";
|
||||
$value->customers = $customers;
|
||||
$value->message = "Sehr #geehrte/r# #Anrede# #Vorname# #Nachname#,\n\nText ....";
|
||||
$data['title'] = "E-Mail-Nachricht an Auswahl";
|
||||
$url = route('requests_send_customer_mail');
|
||||
$ret = view("customer.mail.modal-mail", compact('data','value', 'url') )->render();
|
||||
}
|
||||
|
||||
}
|
||||
return response()->json(['response' => $data, 'html'=>$ret]);
|
||||
}*/
|
||||
|
||||
|
||||
public function sendMail(CustomerMailRepository $customerMailRepository){
|
||||
$data = Request::all();
|
||||
$customerMailRepository->sendAndStore($data);
|
||||
\Session()->flash('alert-success', "Mails gesendet!");
|
||||
return back();
|
||||
}
|
||||
|
||||
public function replyMail(CustomerMailRepository $customerMailRepository){
|
||||
$data = Request::all();
|
||||
$customerMailRepository->replyStore($data);
|
||||
\Session()->flash('alert-success', "Mail gespeichert!");
|
||||
return back();
|
||||
}
|
||||
|
||||
public function getCustomerMails()
|
||||
{
|
||||
$query = CustomerMail::with('booking')->with('customer');
|
||||
|
|
@ -109,6 +167,25 @@ class CustomerMailController extends Controller
|
|||
->rawColumns(['action_edit', 'send', 'customer_id', 'booking_id', 'id'])
|
||||
->make(true);
|
||||
}
|
||||
|
||||
|
||||
public function uploadAttachment($id){
|
||||
|
||||
$fileRepo = new FileRepository(new CustomerFile());
|
||||
if($id === 'tmp'){
|
||||
$fileRepo->_set('disk', 'customer');
|
||||
$fileRepo->_set('dir', '/attachment/'.date('Y/m').'/');
|
||||
$fileRepo->_set('customer_id', NULL);
|
||||
$fileRepo->_set('customer_mail_id', NULL);
|
||||
$fileRepo->_set('identifier', 'tmp');
|
||||
return $fileRepo->uploadFile(Request::all());
|
||||
}
|
||||
|
||||
return Response::json([
|
||||
'error' => true,
|
||||
'code' => 200
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue