mail fixed for dynamic email from settings db

This commit is contained in:
Mahri Ilmedova 2022-10-04 01:38:38 +05:00
parent b2a0f99b43
commit 370243933c
7 changed files with 266 additions and 35 deletions

View File

@ -70,14 +70,14 @@ public function register(RegisterRequest $request){
{
$client->verification_token = rand(10000, 99999);
try{
//try{
Mail::to($request->email)
->queue(new EmailVerification($request->firstname, $client->verification_token));
}catch (\Exception $ex){
//eger email ugradyp bolmasa verification edip bolmaz
$client->is_verified = true;
Log::error($ex->getMessage());
}
// }catch (\Exception $ex){
// //eger email ugradyp bolmasa verification edip bolmaz
// $client->is_verified = true;
// Log::error($ex->getMessage());
// }
}

View File

@ -48,15 +48,10 @@ public function postMessage(MessageRequest $request)
{
try{
$message = new Message($request->only(['ticket_id', 'content']));
$message['is_client'] = true;
$message->save();
$ticket = Ticket::find($request->ticket_id);
$ticket['last_sender'] = 'client';
$ticket->save();
return MessageResource::make($message);
@ -70,15 +65,10 @@ public function postMessageAdmin(MessageRequest $request)
{
try{
$message = new Message($request->only(['ticket_id', 'content', 'admin_id', 'status_id']));
$message['is_client'] = false;
$message->save();
$ticket = Ticket::find($request->ticket_id);
$ticket['last_sender'] = 'admin';
$ticket->save();
return MessageResource::make($message);
@ -104,23 +94,21 @@ public function getTickets(Request $request)
public function postTicket(TicketRequest $request)
{
$ticket = new Ticket($request->only('content', 'title','category_id'));
$client = $request->user();
$account = Account::find($client->account_id);
$ticket['client_id'] = $account->id;
$status = Status::where('name', 'Open')->firstOrFail();
$ticket['status_id'] = $status->id;
$ticket['last_sender'] = 'client';
$ticket->save();
Message::create(['ticket_id' => $ticket->id, 'content' => $request->get("content"),'is_client' => true]);
return TicketResource::make($ticket);
}
//create ticket inside application preview - admin panel
public function createAppTicket(Request $request){
$ticket = new Ticket($request->only('content', 'title','category_id', 'application_id'));
}
}

View File

@ -101,7 +101,7 @@ protected function setupCreateOperation()
'label' => "Account",
'type' => 'custom_select_account',
'name' => 'client_id', // the method that defines the relationship in your Model
'entity' => 'client', // the method that defines the relationship in your Model
'entity' => 'account', // the method that defines the relationship in your Model
'model' => "App\Models\Account", // foreign key model
'attribute_1' => 'name', // foreign key attribute that is shown to user
'attribute_2' => 'surname',

View File

@ -6,16 +6,6 @@
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
@ -23,6 +13,29 @@ public function register()
*/
public function boot()
{
//
$this->overrideConfigValues();
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
}
protected function overrideConfigValues()
{
$config = [];
$config['mail.mailers.smtp.host'] = config('settings.smtp_host');
$config['mail.mailers.smtp.port'] = config('settings.smtp_port');
$config['mail.mailers.smtp.encryption'] = config('settings.smtp_encryption');
$config['mail.mailers.smtp.username'] = config('settings.smtp_username');
$config['mail.mailers.smtp.password'] = config('settings.smtp_password');
$config['mail.mailers.smtp.from.address'] = config('settings.smtp_username');
$config['mail.mailers.smtp.from.name'] = 'Birzha Legalizasia';
config($config);
}
}

View File

@ -0,0 +1,228 @@
@extends(backpack_view('blank'))
@section('content')
<style>
.btn.focus, .btn:focus, .dataTables_wrapper .dataTables_paginate .focus.paginate_button, .dataTables_wrapper .dataTables_paginate .paginate_button:focus{
box-shadow: none;
}
.modal-backdrop{
display: none;
}
</style>
<nav aria-label="breadcrumb" class="d-none d-lg-block">
<ol class="breadcrumb m-0 mb-3">
<li class="breadcrumb-item"><a href="/admin">Admin</a></li>
<li class="breadcrumb-item"><a href="/admin/application">Application</a></li>
<li class="breadcrumb-item active" aria-current="page">{{ $application->id }}</li>
</ol>
</nav>
<div class="row">
<div class="col-lg-4">
<div class="card">
<div class="card-body">
@if($application->state == 'applied')
<button class="btn btn-primary mb-4" type="button" data-toggle="modal" data-target="#successModal">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check2-square" viewBox="0 0 16 16">
<path d="M3 14.5A1.5 1.5 0 0 1 1.5 13V3A1.5 1.5 0 0 1 3 1.5h8a.5.5 0 0 1 0 1H3a.5.5 0 0 0-.5.5v10a.5.5 0 0 0 .5.5h10a.5.5 0 0 0 .5-.5V8a.5.5 0 0 1 1 0v5a1.5 1.5 0 0 1-1.5 1.5H3z"/>
<path d="m8.354 10.354 7-7a.5.5 0 0 0-.708-.708L8 9.293 5.354 6.646a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0z"/>
</svg> &nbsp;
Approve
</button>
<div class="modal fade" id="successModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-primary" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Fill the form</h4>
<button class="close" type="button" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
<form class="form-horizontal" action="/admin/approve-application/{{ $application->id }}" method="post">
@csrf
<div class="modal-body">
<div class="card-body">
<input type="hidden" name="id" value="{{ $application->id }}">
<div class="form-group row">
<label class="col-sm-5 col-form-label" for="input-normal">Legalizatnio number</label>
<div class="col-sm-6">
<input name="legalization_number" class="form-control" id="input-normal" type="text" name="input-normal" placeholder="Normal">
</div>
</div>
<div class="form-group row">
<label class="col-sm-5 col-form-label" for="input-normal">Expiration date</label>
<div class="col-sm-6">
<input name="expires_at" class="form-control" id="input-normal" type="date" name="input-normal" placeholder="Normal">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" type="button" data-dismiss="modal">Close</button>
<button class="btn btn-success" type="submit">Save</button>
</div>
</form>
</div>
<!-- /.modal-content-->
</div>
<!-- /.modal-dialog-->
</div>
@else
<button class="btn btn-secondary mb-4" type="button">Approved</button>
@endif
<a href="/admin/create-application-ticket" class="btn btn-success mb-4">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-ticket-perforated" viewBox="0 0 16 16">
<path d="M4 4.85v.9h1v-.9H4Zm7 0v.9h1v-.9h-1Zm-7 1.8v.9h1v-.9H4Zm7 0v.9h1v-.9h-1Zm-7 1.8v.9h1v-.9H4Zm7 0v.9h1v-.9h-1Zm-7 1.8v.9h1v-.9H4Zm7 0v.9h1v-.9h-1Z"/>
<path d="M1.5 3A1.5 1.5 0 0 0 0 4.5V6a.5.5 0 0 0 .5.5 1.5 1.5 0 1 1 0 3 .5.5 0 0 0-.5.5v1.5A1.5 1.5 0 0 0 1.5 13h13a1.5 1.5 0 0 0 1.5-1.5V10a.5.5 0 0 0-.5-.5 1.5 1.5 0 0 1 0-3A.5.5 0 0 0 16 6V4.5A1.5 1.5 0 0 0 14.5 3h-13ZM1 4.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 .5.5v1.05a2.5 2.5 0 0 0 0 4.9v1.05a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-1.05a2.5 2.5 0 0 0 0-4.9V4.5Z"/>
</svg> &nbsp;
Create ticket
</a>
@if ($application->account->type == 'business')
<div class="form-group">
<label for="company"><small>Profile type</small></label>
<h6><strong>Entreprenuer</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Country</small></label>
<h6><strong>{{ $application->account->country->name ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Name</small></label>
<h6><strong>{{ $application->account->profile->name ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Surname</small></label>
<h6><strong>{{ $application->account->profile->surname ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Patronomic</small></label>
<h6><strong>{{ $application->account->profile->patronomic_name ?? null }}</strong></h6>
</div>
@if (isset($application->account->profile->date_of_birth))
<div class="form-group">
<label for="company"><small>Date of birth</small></label>
<h6><strong>{{ Carbon\Carbon::parse($application->account->profile->date_of_birth)->format('d.m.Y') }}</strong></h6>
</div>
@endif
<div class="form-group">
<label for="company"><small>Birthplace</small></label>
<h6><strong>{{ $application->account->profile->birth_place ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Registration address</small></label>
<h6><strong>{{ $application->account->profile->registration_address ?? null }}</strong></h6>
</div>
@else
<div class="form-group">
<label for="company"><small>Profile type</small></label>
<h6><strong>Company</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Name</small></label>
<h6><strong>{{ $application->account->profile->name ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Short name</small></label>
<h6><strong>{{ $application->account->profile->short_name ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Registration number</small></label>
<h6><strong>{{ $application->account->profile->registration_number ?? null }}</strong></h6>
</div>
@if (isset($application->account->profile->registration_date))
<div class="form-group">
<label for="company"><small>Registration date</small></label>
<h6><strong>{{ Carbon\Carbon::parse($application->account->profile->registration_date)->format('d.m.Y') }}</strong></h6>
</div>
@endif
<div class="form-group">
<label for="company"><small>Registration agency</small></label>
<h6><strong>{{ $application->account->profile->state_registration_agency ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Registration place</small></label>
<h6><strong>{{ $application->account->profile->registration_place ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Registration address</small></label>
<h6><strong>{{ $application->account->profile->registration_address ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Fond capital</small></label>
<h6><strong>{{ $application->account->profile->fond_capital ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Management types</small></label>
<h6><strong>{{ $application->account->profile->management_types ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Signers</small></label>
<h6><strong>{{ $application->account->profile->signers ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Share holders</small></label>
<h6><strong>{{ $application->account->profile->share_holders ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Organizational form</small></label>
<h6><strong>{{ $application->account->profile->organizational_form ?? null }}</strong></h6>
</div>
<div class="form-group">
<label for="company"><small>Is agent?</small></label>
<h6><strong>{{ $application->account->profile->is_agent ?? false }}</strong></h6>
</div>
@endif
</div>
</div>
</div>
<div class="col-md-8 mb-4">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#attachments" role="tab" aria-controls="applications" aria-selected="true">
<svg style="width: 18px" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z" />
</svg> &nbsp;
Attachments
<span class="badge badge-pill badge-secondary">{{ count($application->attachments) }}</span>
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="attachments" role="tabpanel">
<table class="table table-responsive-sm table-striped mb-0">
<thead class="thead-light">
<tr>
<th>Name</th>
<th>Size (Kb)</th>
<th>Type</th>
</tr>
</thead>
<tbody>
@foreach ($application->attachments as $attachment)
@if ($attachment->file)
<tr>
<td>
<a class="nav-link" href="/storage/{{ $attachment->file }}" target="_blank">
{{ $attachment->name }}
</a>
</td>
<td>
{{ $attachment->size }} Kb
</td>
<td>
{{ $application->type }}
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection

View File

@ -43,5 +43,6 @@
Route::get('/preview-application/{id}',[ResourceController::class, 'previewApplicationAdmin']);
Route::post('/approve-application/{id}', [ResourceController::class, 'approveApplication']);
Route::get('/export-account-admin/{id}', [ExportController::class, 'export']);
Route::get('/create-application-ticket', [TicketController::class, 'createAppTicket']);
}); // this should be the absolute last line of this file

View File

@ -17,3 +17,4 @@
Route::get('/export-questionnaire/{token}',[ExportController::class, 'exportAccount']);
Route::get('/set-lang', [LocalizationController::class, 'setLang']);