@@ -3,16 +3,19 @@ | |||||
namespace App\Http\Controllers; | namespace App\Http\Controllers; | ||||
use Illuminate\Http\Request; | use Illuminate\Http\Request; | ||||
use Illuminate\Support\Facades\Auth; | |||||
use Mail; | use Mail; | ||||
use Illuminate\Support\Facades\Log; | |||||
use App\Models\Ticket; | |||||
use App\Models; | |||||
use App\Mail\SupportTicket; | |||||
class Ticket extends Controller | class Ticket extends Controller | ||||
{ | { | ||||
public function send(Request $request){ | public function send(Request $request){ | ||||
$validated = $request->validate([ | $validated = $request->validate([ | ||||
'topic' => 'required', | 'topic' => 'required', | ||||
'message' = 'required' | |||||
'message' => 'required' | |||||
]); | ]); | ||||
$ticket = $this->create($request->topic); | $ticket = $this->create($request->topic); | ||||
@@ -23,7 +26,7 @@ class Ticket extends Controller | |||||
//Should probably have a minimum character restriction later | //Should probably have a minimum character restriction later | ||||
public function create(String $type){ | public function create(String $type){ | ||||
$ticket = new Ticket; | |||||
$ticket = new Models\Ticket; | |||||
$ticket->user_id = Auth::user()->id; | $ticket->user_id = Auth::user()->id; | ||||
$ticket->type = $type; | $ticket->type = $type; | ||||
$ticket->status = 'processing'; | $ticket->status = 'processing'; | ||||
@@ -6,6 +6,7 @@ use Illuminate\Bus\Queueable; | |||||
use Illuminate\Contracts\Queue\ShouldQueue; | use Illuminate\Contracts\Queue\ShouldQueue; | ||||
use Illuminate\Mail\Mailable; | use Illuminate\Mail\Mailable; | ||||
use Illuminate\Queue\SerializesModels; | use Illuminate\Queue\SerializesModels; | ||||
use Illuminate\Support\Facades\Log; | |||||
use App\Models\Ticket; | use App\Models\Ticket; | ||||
@@ -20,17 +21,18 @@ class SupportTicket extends Mailable | |||||
*/ | */ | ||||
public $name; | public $name; | ||||
public $email; | public $email; | ||||
public $message; | |||||
public $user_message; | |||||
public $type; | public $type; | ||||
public $id; | public $id; | ||||
public function __construct(Ticket $ticket, String $message) | |||||
public function __construct(Ticket $ticket, String $user_message) | |||||
{ | { | ||||
$this->name = $ticket->user->name; | $this->name = $ticket->user->name; | ||||
$this->email = $ticket->user->email; | $this->email = $ticket->user->email; | ||||
$this->message = $message; | |||||
$this->user_message = $user_message; | |||||
$this->type = $ticket->type; | $this->type = $ticket->type; | ||||
$this->id = $ticket->id; | $this->id = $ticket->id; | ||||
Log::debug($this->user_message); | |||||
} | } | ||||
/** | /** | ||||
@@ -40,8 +42,9 @@ class SupportTicket extends Mailable | |||||
*/ | */ | ||||
public function build() | public function build() | ||||
{ | { | ||||
return $this->view('support-ticket') | |||||
->from('donotreply@trendplays.com') | |||||
->subject("Ticket: $this->id, $this->type"); | |||||
$this->view('support-ticket'); | |||||
$this->from('donotreply@trendplays.com'); | |||||
$this->subject("Ticket: $this->id, $this->type"); | |||||
return $this; | |||||
} | } | ||||
} | } |
@@ -5,6 +5,11 @@ | |||||
<loading v-if="loading"></loading> | <loading v-if="loading"></loading> | ||||
<div v-if="!loading && complete" class="dialog"> | |||||
<img class="icon" src="../../images/checked2.svg" alt=""> | |||||
<h3>Ticket sent. An administrator will contact you soon.</h3> | |||||
</div> | |||||
<div v-if="!loading && !complete" id="support-form"> | <div v-if="!loading && !complete" id="support-form"> | ||||
<label for="">Topic</label> | <label for="">Topic</label> | ||||
@@ -1424,3 +1424,8 @@ main.terms { | |||||
margin-bottom: 1em; | margin-bottom: 1em; | ||||
} | } | ||||
//Maybe this should have a max width | |||||
.dialog { | |||||
text-align: center; | |||||
} | |||||
@@ -15,7 +15,7 @@ | |||||
<h3>Email: {{$email}}</h3> | <h3>Email: {{$email}}</h3> | ||||
<h3>Message:</h3> | <h3>Message:</h3> | ||||
<p>{{$message}}</p> | |||||
<p> {{$user_message}} </p> | |||||
</main> | </main> | ||||
@endsection | @endsection | ||||
@@ -5,6 +5,8 @@ use App\Http\Controllers\UserController; | |||||
use App\Http\Controllers\ServiceController; | use App\Http\Controllers\ServiceController; | ||||
use App\Http\Controllers\OrderController; | use App\Http\Controllers\OrderController; | ||||
use App\Http\Controllers\BillingController; | use App\Http\Controllers\BillingController; | ||||
use App\Http\Controllers\Ticket; | |||||
use Illuminate\Foundation\Auth\EmailVerificationRequest; | use Illuminate\Foundation\Auth\EmailVerificationRequest; | ||||
use Illuminate\Http\Request; | use Illuminate\Http\Request; | ||||
use Illuminate\Support\Facades\Auth; | use Illuminate\Support\Facades\Auth; | ||||