diff --git a/app/Http/Controllers/API/ResourceController.php b/app/Http/Controllers/API/ResourceController.php index 8e51f90a..75118dc2 100755 --- a/app/Http/Controllers/API/ResourceController.php +++ b/app/Http/Controllers/API/ResourceController.php @@ -41,7 +41,7 @@ public function previewAccountAdmin($id) } public function previewApplicationAdmin($id){ - $application = Application::with(['account', 'attachments'])->find($id); + $application = Application::with(['account', 'attachments', 'ticket'])->find($id); return view('admin.application_preview',[ 'application' => $application ]); diff --git a/app/Http/Controllers/API/TicketController.php b/app/Http/Controllers/API/TicketController.php index dc20a6ff..07494e96 100755 --- a/app/Http/Controllers/API/TicketController.php +++ b/app/Http/Controllers/API/TicketController.php @@ -108,7 +108,9 @@ public function postTicket(TicketRequest $request) //create ticket inside application preview - admin panel public function createAppTicket(Request $request){ - $ticket = new Ticket($request->only('content', 'title','category_id', 'application_id')); + $ticket = new Ticket($request->only('content', 'title','category_id', 'client_id', 'account_id')); + $ticket->save(); + return redirect()->to('/admin/chat?ticket_id=' . $ticket->id); } } diff --git a/app/Http/Controllers/Admin/TicketCrudController.php b/app/Http/Controllers/Admin/TicketCrudController.php index 8b3aa757..f10c89e9 100755 --- a/app/Http/Controllers/Admin/TicketCrudController.php +++ b/app/Http/Controllers/Admin/TicketCrudController.php @@ -94,7 +94,7 @@ protected function setupCreateOperation() ], [ 'name' => 'content', - 'type' => 'summernote', + 'type' => 'textarea', 'label' => 'Content' ], [ // SelectMultiple = n-n relationship (with pivot table) diff --git a/app/Models/Application.php b/app/Models/Application.php index a9449754..cb142231 100755 --- a/app/Models/Application.php +++ b/app/Models/Application.php @@ -4,6 +4,7 @@ use Backpack\CRUD\app\Models\Traits\CrudTrait; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\HasOne; class Application extends Model { @@ -55,6 +56,10 @@ public function attachments(){ ->orderBy('documents.order'); } + public function ticket():HasOne{ + return $this->hasOne(Ticket::class); + } + /* |-------------------------------------------------------------------------- | SCOPES diff --git a/resources/views/admin/application_preview.blade.php b/resources/views/admin/application_preview.blade.php index 64577ac1..0a055a67 100644 --- a/resources/views/admin/application_preview.blade.php +++ b/resources/views/admin/application_preview.blade.php @@ -3,149 +3,233 @@ @section('content') -
+
-
- @if ($application->state == 'applied') - - diff --git a/resources/views/admin/application_ticket.blade.php b/resources/views/admin/application_ticket.blade.php deleted file mode 100644 index 1d0e6944..00000000 --- a/resources/views/admin/application_ticket.blade.php +++ /dev/null @@ -1,228 +0,0 @@ -@extends(backpack_view('blank')) - -@section('content') - - - - - -
-
-
-
- @if($application->state == 'applied') - - - @else - - @endif - - - - -   - Create ticket - - @if ($application->account->type == 'business') -
- -
Entreprenuer
-
-
- -
{{ $application->account->country->name ?? null }}
-
-
- -
{{ $application->account->profile->name ?? null }}
-
-
- -
{{ $application->account->profile->surname ?? null }}
-
-
- -
{{ $application->account->profile->patronomic_name ?? null }}
-
- @if (isset($application->account->profile->date_of_birth)) -
- -
{{ Carbon\Carbon::parse($application->account->profile->date_of_birth)->format('d.m.Y') }}
-
- @endif -
- -
{{ $application->account->profile->birth_place ?? null }}
-
-
- -
{{ $application->account->profile->registration_address ?? null }}
-
- @else -
- -
Company
-
-
- -
{{ $application->account->profile->name ?? null }}
-
-
- -
{{ $application->account->profile->short_name ?? null }}
-
-
- -
{{ $application->account->profile->registration_number ?? null }}
-
- @if (isset($application->account->profile->registration_date)) -
- -
{{ Carbon\Carbon::parse($application->account->profile->registration_date)->format('d.m.Y') }}
-
- @endif -
- -
{{ $application->account->profile->state_registration_agency ?? null }}
-
-
- -
{{ $application->account->profile->registration_place ?? null }}
-
-
- -
{{ $application->account->profile->registration_address ?? null }}
-
-
- -
{{ $application->account->profile->fond_capital ?? null }}
-
-
- -
{{ $application->account->profile->management_types ?? null }}
-
-
- -
{{ $application->account->profile->signers ?? null }}
-
-
- -
{{ $application->account->profile->share_holders ?? null }}
-
-
- -
{{ $application->account->profile->organizational_form ?? null }}
-
-
- -
{{ $application->account->profile->is_agent ?? false }}
-
- @endif -
-
-
- -
- -
-
- - - - - - - - - - @foreach ($application->attachments as $attachment) - @if ($attachment->file) - - - - - - @endif - @endforeach - -
NameSize (Kb)Type
- - {{ $attachment->name }} - - - {{ $attachment->size }} Kb - - {{ $application->type }} -
-
-
-
-
- - - -@endsection diff --git a/resources/views/admin/messages.blade.php b/resources/views/admin/messages.blade.php index 464ca1b9..d39641a3 100755 --- a/resources/views/admin/messages.blade.php +++ b/resources/views/admin/messages.blade.php @@ -71,9 +71,9 @@
- {{--

{{ $ticket->client->firstname ?? null }} {{ $ticket->client->lastname ?? null }} {{ Carbon\Carbon::parse($ticket->created_at)->format('d.m.Y h:i') }}

+

{{ $ticket->client->firstname ?? null }} {{ $ticket->client->lastname ?? null }} {{ Carbon\Carbon::parse($ticket->created_at)->format('d.m.Y h:i') }}

{{ $ticket->content }}

-
--}} +
diff --git a/routes/backpack/custom.php b/routes/backpack/custom.php index 050f4106..4820d459 100755 --- a/routes/backpack/custom.php +++ b/routes/backpack/custom.php @@ -43,6 +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']); + Route::post('/create-application-ticket', [TicketController::class, 'createAppTicket']); }); // this should be the absolute last line of this file