broker-attachments admin + api ready
This commit is contained in:
parent
6f553cb1b5
commit
430f2dfac2
|
|
@ -17,7 +17,7 @@ public function __construct()
|
|||
{
|
||||
$this->middleware(function ($request, $next) {
|
||||
|
||||
$this->account = Auth::user()
|
||||
$this->account = auth()->user()
|
||||
->account()
|
||||
->with('profile')
|
||||
->first();
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public function __construct()
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new Legalization Application
|
||||
* @return ApplicationResource|\Illuminate\Http\Response
|
||||
|
|
@ -129,15 +130,6 @@ public function apply()
|
|||
|
||||
if( $app )
|
||||
{
|
||||
// $unAttachedDocumentsCount = $app->attachments->whereNull('file')->count();
|
||||
//
|
||||
// if($unAttachedDocumentsCount >0)
|
||||
// {
|
||||
// return response([
|
||||
// 'success' => false,
|
||||
// 'message' => trans('app.application.required_docs_message')
|
||||
// ],422);
|
||||
// }
|
||||
|
||||
$app->state = 'new';
|
||||
$app->save();
|
||||
|
|
@ -169,18 +161,12 @@ public function upload(DocumentUploadRequest $request,$attachment_id)
|
|||
|
||||
$uploadedFile = $request->file('file');
|
||||
|
||||
// Log::info($uploadedFile->getSize());
|
||||
|
||||
if($attachment->document->max_size != 0
|
||||
&& $uploadedFile->getSize() > $attachment->document->max_size * 1024){//max size in kilobytes
|
||||
return response()->json(['success' => false, 'message' =>trans('app.application.upload_max_size')],422);
|
||||
}
|
||||
|
||||
// if($attachment->file){
|
||||
// //todo delete or replace old file
|
||||
//// Stor
|
||||
// }
|
||||
|
||||
$filename = Str::snake($attachment->name).'.'.$uploadedFile->getClientOriginalExtension();
|
||||
|
||||
$directory = 'documents/'.Carbon::today()->year.'/'.$this->account->id;
|
||||
|
|
@ -201,7 +187,8 @@ public function upload(DocumentUploadRequest $request,$attachment_id)
|
|||
//todo make attachment relation
|
||||
}
|
||||
|
||||
public function downloadQuestionaire(){
|
||||
public function downloadQuestionaire()
|
||||
{
|
||||
$headers = [
|
||||
"Content-type"=>"text/html",
|
||||
"Content-Disposition"=>"attachment;Filename=myGeneratefile.doc"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,189 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\API;
|
||||
use App\Http\Requests\API\DocumentUploadRequest;
|
||||
use App\Http\Resources\BrokerApplicationResource;
|
||||
use App\Models\BrokerApplication;
|
||||
use App\Models\BrokerAttachment;
|
||||
use App\Models\BrokerDocument;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Str;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BrokerApplicationController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware(function ($request, $next) {
|
||||
$this->account = auth()->guard('api')->user()
|
||||
->account()
|
||||
->with('profile')
|
||||
->with('broker_applications')
|
||||
->first();
|
||||
return $next($request);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new Legalization Application
|
||||
* @return BrokerApplicationResource|\Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//validate if profile is filled
|
||||
if(is_null($this->account) || is_null($this->account->profile))
|
||||
{
|
||||
return response([
|
||||
'success' => false,
|
||||
'message' => trans('app.application.fill_profile_message'),
|
||||
],422);
|
||||
}
|
||||
//validate legalization number exists
|
||||
elseif(!$this->account->can_apply_broker && !$this->account->can_extend_broker){
|
||||
$month = Config::get('settings.legalization_extend') ?? 1;
|
||||
return response([
|
||||
'success' => false,
|
||||
'message' => trans('app.application.expire_message',['one'=>$month])
|
||||
],422);
|
||||
}
|
||||
|
||||
//delete old application??? Should we replace it???
|
||||
if($app = $this->account->last_broker_application())
|
||||
{
|
||||
if($app->state != 'approved')
|
||||
return BrokerApplicationResource::make($app);
|
||||
else{
|
||||
$app->state = 'archive';
|
||||
$app->save();
|
||||
}
|
||||
}
|
||||
|
||||
//upload etmeli dokumentlaryn spisogy
|
||||
$documents = BrokerDocument::where($this->account->type,true)->get();
|
||||
|
||||
if($documents->count() == 0)
|
||||
{
|
||||
return response([
|
||||
'success' => false,
|
||||
'message' => trans('application.list_not_found')
|
||||
],404);
|
||||
}
|
||||
|
||||
|
||||
$application = BrokerApplication::create([
|
||||
'account_id' => $this->account->id,
|
||||
'state' => 'draft' //default mysql value is new
|
||||
]);
|
||||
|
||||
foreach ($documents as $document){
|
||||
$attachment = new BrokerAttachment([
|
||||
'name' => $document->name,
|
||||
'document_id' => $document->id
|
||||
]);
|
||||
$application->broker_attachments()->save($attachment);
|
||||
}
|
||||
|
||||
return BrokerApplicationResource::make($application);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function get()
|
||||
{
|
||||
$application = $this->account
|
||||
->broker_applications()
|
||||
->latest()
|
||||
->with('broker_attachments')->first();
|
||||
|
||||
if($application){
|
||||
return BrokerApplicationResource::make($application);
|
||||
}
|
||||
|
||||
return response()->json(['success' => false, 'message' => 'Not Found'], 404);
|
||||
|
||||
}
|
||||
|
||||
public function apply()
|
||||
{
|
||||
$app = $this->account
|
||||
->broker_applications()
|
||||
->whereIn('state',['draft','refine'])
|
||||
->with('broker_attachments')
|
||||
->latest()
|
||||
->first();
|
||||
|
||||
if( $app )
|
||||
{
|
||||
$app->state = 'new';
|
||||
$app->save();
|
||||
|
||||
//todo send email to operators
|
||||
return response([
|
||||
'success' => true,
|
||||
'message' => trans('app.application.app_success_message')
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
return response([
|
||||
'success' => false,
|
||||
'message' => trans('app.application.app_error_message')
|
||||
],400);
|
||||
|
||||
}
|
||||
|
||||
public function upload(DocumentUploadRequest $request,$attachment_id)
|
||||
{
|
||||
|
||||
$attachment = BrokerAttachment::with(['broker_application','document'])->find($attachment_id);
|
||||
|
||||
if(!$attachment || !$attachment->broker_application || $attachment->broker_application->account_id != $this->account->id ){
|
||||
|
||||
return response()->json(['success' => false, 'message' =>'Bad request'],400);
|
||||
}
|
||||
|
||||
$uploadedFile = $request->file('file');
|
||||
|
||||
|
||||
if($attachment->document->max_size != 0
|
||||
&& $uploadedFile->getSize() > $attachment->document->max_size * 1024){//max size in kilobytes
|
||||
return response()->json(['success' => false, 'message' =>trans('app.application.upload_max_size')],422);
|
||||
}
|
||||
|
||||
$filename = Str::snake($attachment->name).'.'.$uploadedFile->getClientOriginalExtension();
|
||||
|
||||
$directory = 'documents/'.Carbon::today()->year.'/'.$this->account->id;
|
||||
|
||||
$path = $uploadedFile->storePubliclyAs($directory,$filename);
|
||||
|
||||
if(!$path){
|
||||
return response()->json(['success' => false, 'message' =>trans('app.application.upload_failure')],400);
|
||||
}
|
||||
|
||||
$attachment->file = $directory.'/'.$filename;
|
||||
$attachment->size = number_format($uploadedFile->getSize()/1024, 2, '.', '');
|
||||
$attachment->type = $uploadedFile->getClientOriginalExtension();
|
||||
$attachment->save();
|
||||
|
||||
return response()->json(['success' => true, 'message' =>trans('app.app.application.upload_success')]);
|
||||
|
||||
//todo make attachment relation
|
||||
}
|
||||
|
||||
public function downloadQuestionaire()
|
||||
{
|
||||
$headers = [
|
||||
"Content-type"=>"text/html",
|
||||
"Content-Disposition"=>"attachment;Filename=myGeneratefile.doc"
|
||||
];
|
||||
|
||||
$content = view('oprosniki.'.$this->account->type,$this->account->profile)->render();
|
||||
|
||||
return \Response::make($content,200, $headers);
|
||||
}
|
||||
}
|
||||
|
|
@ -22,31 +22,32 @@ public function contract(ContractRequest $request){
|
|||
}
|
||||
|
||||
public function import(Request $request){
|
||||
foreach($request->all() as $item){
|
||||
$contract['foreign_ID'] = $item['ID'];
|
||||
$contract['InputNumber'] = $item['InputNumber'];
|
||||
$contract['InputDate'] = $item['InputDate'];
|
||||
$contract['RegDate'] = $item['RegDate'];
|
||||
$contract['MarkerSpec'] = $item['MarkerSpec'];
|
||||
$contract['Workflow_ID'] = $item['Workflow_ID'];
|
||||
$contract['Note'] = $item['Note'];
|
||||
$contract['Remark'] = $item['Remark'];
|
||||
Log::info($request->all());
|
||||
// foreach($request->all() as $item){
|
||||
// $contract['foreign_ID'] = $item['ID'];
|
||||
// $contract['InputNumber'] = $item['InputNumber'];
|
||||
// $contract['InputDate'] = $item['InputDate'];
|
||||
// $contract['RegDate'] = $item['RegDate'];
|
||||
// $contract['MarkerSpec'] = $item['MarkerSpec'];
|
||||
// $contract['Workflow_ID'] = $item['Workflow_ID'];
|
||||
// $contract['Note'] = $item['Note'];
|
||||
// $contract['Remark'] = $item['Remark'];
|
||||
|
||||
$record = Contract::where('foreign_ID', $contract['foreign_ID'])->first();
|
||||
if($record != null){
|
||||
$record['InputNumber'] = $item['InputNumber'];
|
||||
$record['InputDate'] = $item['InputDate'];
|
||||
$record['RegDate'] = $item['RegDate'];
|
||||
$record['MarkerSpec'] = $item['MarkerSpec'];
|
||||
$record['Workflow_ID'] = $item['Workflow_ID'];
|
||||
$record['Note'] = $item['Note'];
|
||||
$record['Remark'] = $item['Remark'];
|
||||
$record->save();
|
||||
}
|
||||
else{
|
||||
Contract::create($contract);
|
||||
}
|
||||
}
|
||||
// $record = Contract::where('foreign_ID', $contract['foreign_ID'])->first();
|
||||
// if($record != null){
|
||||
// $record['InputNumber'] = $item['InputNumber'];
|
||||
// $record['InputDate'] = $item['InputDate'];
|
||||
// $record['RegDate'] = $item['RegDate'];
|
||||
// $record['MarkerSpec'] = $item['MarkerSpec'];
|
||||
// $record['Workflow_ID'] = $item['Workflow_ID'];
|
||||
// $record['Note'] = $item['Note'];
|
||||
// $record['Remark'] = $item['Remark'];
|
||||
// $record->save();
|
||||
// }
|
||||
// else{
|
||||
// Contract::create($contract);
|
||||
// }
|
||||
// }
|
||||
return 'ok';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
use App\Http\Resources\QuestionResource;
|
||||
use App\Models\Account;
|
||||
use App\Models\Application;
|
||||
use App\Models\BrokerApplication;
|
||||
use App\Models\Client;
|
||||
use App\Models\Question;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -46,11 +47,16 @@ public function previewAccountAdmin($id)
|
|||
|
||||
public function previewApplicationAdmin($id){
|
||||
$application = Application::with(['account', 'attachments', 'ticket'])->find($id);
|
||||
//dd($application->tickets);
|
||||
return view('admin.application_preview',[
|
||||
'application' => $application
|
||||
]);
|
||||
}
|
||||
public function previewBrokerApplicationAdmin($id){
|
||||
$application = BrokerApplication::with(['account', 'broker_attachments', 'ticket'])->find($id);
|
||||
return view('admin.broker_application_preview',[
|
||||
'application' => $application
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function createAccountClient($account_id){
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ protected function setupListOperation()
|
|||
]);
|
||||
// CRUD::addColumn(['name'=>'country_id', 'type'=>'select','label'=> trans('app.account.country'), 'entity' => 'country' ,'model' => 'App\Model\Country','attribute' => 'name']);
|
||||
$this->crud->addButtonFromModelFunction('line', 'preview_button', 'preview', 'beginning');
|
||||
// $this->crud->addButtonFromModelFunction('line', 'accept_button', 'accept', 'beginning');
|
||||
}
|
||||
|
||||
public function accept($id){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,163 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Requests\BrokerApplicationRequest;
|
||||
use Backpack\CRUD\app\Http\Controllers\CrudController;
|
||||
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
|
||||
use App\Models\BrokerApplication;
|
||||
|
||||
/**
|
||||
* Class BrokerApplicationCrudController
|
||||
* @package App\Http\Controllers\Admin
|
||||
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
|
||||
*/
|
||||
class BrokerApplicationCrudController extends CrudController
|
||||
{
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
|
||||
|
||||
/**
|
||||
* Configure the CrudPanel object. Apply settings to all operations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setup()
|
||||
{
|
||||
if(!(backpack_user()->hasPermissionTo('applications'))){
|
||||
$this->crud->denyAccess(['update']);
|
||||
}
|
||||
if(!(backpack_user()->hasRole('Super Admin'))){
|
||||
$this->crud->denyAccess(['delete']);
|
||||
}
|
||||
CRUD::setModel(BrokerApplication::class);
|
||||
CRUD::setRoute(config('backpack.base.route_prefix') . '/broker-application');
|
||||
CRUD::setEntityNameStrings('broker application', 'broker applications');
|
||||
BrokerApplication::updating(function($entry) {
|
||||
$entry->modified_by = backpack_user()->name;
|
||||
});
|
||||
|
||||
$this->crud->addClause('where', 'state', '!=', 'Draft');
|
||||
|
||||
$this->crud->addFilter([
|
||||
'name' => 'state',
|
||||
'type' => 'dropdown',
|
||||
'label' => trans('app.application.state')
|
||||
], [
|
||||
'new' => trans('app.application.new'),
|
||||
'accepted' => trans('app.application.accepted'),
|
||||
'refine' => trans('app.application.refine'),
|
||||
'approved' => trans('app.application.approved'),
|
||||
'archive' => trans('app.application.archived')
|
||||
], function ($value) {
|
||||
$this->crud->addClause('where', 'state', $value);
|
||||
});
|
||||
|
||||
$this->crud->addFilter([
|
||||
'type' => 'date_range',
|
||||
'name' => 'from_to',
|
||||
'label' => trans('app.application.date_filter'),
|
||||
],
|
||||
false,
|
||||
function ($value) {
|
||||
$dates = json_decode($value);
|
||||
$this->crud->addClause('where', 'created_at', '>=', $dates->from);
|
||||
$this->crud->addClause('where', 'created_at', '<=', $dates->to . ' 23:59:59');
|
||||
});
|
||||
|
||||
$this->crud->addFilter([
|
||||
'type' => 'text',
|
||||
'name' => 'accepted_by',
|
||||
'label' => trans('app.last_updates.accepted_by'),
|
||||
],
|
||||
false,
|
||||
function ($value) {
|
||||
$this->crud->addClause('where', 'accepted_by', 'LIKE', '%' . $value . '%');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Define what happens when the List operation is loaded.
|
||||
*
|
||||
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
|
||||
* @return void
|
||||
*/
|
||||
protected function setupListOperation()
|
||||
{
|
||||
//$this->crud->addClause('where', 'state', '!=', 'new');
|
||||
$this->crud->addColumns([
|
||||
|
||||
[
|
||||
'label' => trans('app.application.name'),
|
||||
'type' => 'select',
|
||||
'name' => 'account_type',
|
||||
'entity' => 'account',
|
||||
'model' => "App\Models\Account",
|
||||
'attribute' => 'type_and_name',
|
||||
],
|
||||
[
|
||||
'label' => trans('app.application.leg_number'),
|
||||
'type' => 'select',
|
||||
'name' => 'account_legnumber',
|
||||
'entity' => 'account',
|
||||
'model' => "App\Models\Account",
|
||||
'attribute' => 'legalization_number',
|
||||
],
|
||||
[
|
||||
'label' => trans('app.application.expires_at'),
|
||||
'type' => 'select',
|
||||
'name' => 'account_exp_date',
|
||||
'entity' => 'account',
|
||||
'model' => "App\Models\Account",
|
||||
'attribute' => 'expires_at',
|
||||
],
|
||||
[
|
||||
'name' => 'state',
|
||||
'label' => trans('app.application.state'),
|
||||
'type' => 'badge',
|
||||
],
|
||||
[
|
||||
'name' => 'accepted_by',
|
||||
'label' => trans('app.last_updates.accepted_by'),
|
||||
'type' => 'text',
|
||||
],
|
||||
[
|
||||
'name' => 'created_at',
|
||||
'label' => trans('app.application.created_at'),
|
||||
]
|
||||
]);
|
||||
// CRUD::addColumn(['name'=>'country_id', 'type'=>'select','label'=> trans('app.account.country'), 'entity' => 'country' ,'model' => 'App\Model\Country','attribute' => 'name']);
|
||||
$this->crud->addButtonFromModelFunction('line', 'preview_button', 'preview', 'beginning');
|
||||
}
|
||||
|
||||
/**
|
||||
* Define what happens when the Create operation is loaded.
|
||||
*
|
||||
* @see https://backpackforlaravel.com/docs/crud-operation-create
|
||||
* @return void
|
||||
*/
|
||||
protected function setupCreateOperation()
|
||||
{
|
||||
CRUD::setValidation(BrokerApplicationRequest::class);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Fields can be defined using the fluent syntax or array syntax:
|
||||
* - CRUD::field('price')->type('number');
|
||||
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Define what happens when the Update operation is loaded.
|
||||
*
|
||||
* @see https://backpackforlaravel.com/docs/crud-operation-update
|
||||
* @return void
|
||||
*/
|
||||
protected function setupUpdateOperation()
|
||||
{
|
||||
$this->setupCreateOperation();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Requests\BrokerAttachmentRequest;
|
||||
use Backpack\CRUD\app\Http\Controllers\CrudController;
|
||||
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
|
||||
|
||||
/**
|
||||
* Class BrokerAttachmentCrudController
|
||||
* @package App\Http\Controllers\Admin
|
||||
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
|
||||
*/
|
||||
class BrokerAttachmentCrudController extends CrudController
|
||||
{
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\ShowOperation;
|
||||
|
||||
/**
|
||||
* Configure the CrudPanel object. Apply settings to all operations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setup()
|
||||
{
|
||||
CRUD::setModel(\App\Models\BrokerAttachment::class);
|
||||
CRUD::setRoute(config('backpack.base.route_prefix') . '/broker-attachment');
|
||||
CRUD::setEntityNameStrings('broker attachment', 'broker attachments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Define what happens when the List operation is loaded.
|
||||
*
|
||||
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
|
||||
* @return void
|
||||
*/
|
||||
protected function setupListOperation()
|
||||
{
|
||||
|
||||
$this->crud->setFromDb();
|
||||
/**
|
||||
* Columns can be defined using the fluent syntax or array syntax:
|
||||
* - CRUD::column('price')->type('number');
|
||||
* - CRUD::addColumn(['name' => 'price', 'type' => 'number']);
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Define what happens when the Create operation is loaded.
|
||||
*
|
||||
* @see https://backpackforlaravel.com/docs/crud-operation-create
|
||||
* @return void
|
||||
*/
|
||||
protected function setupCreateOperation()
|
||||
{
|
||||
CRUD::setValidation(BrokerAttachmentRequest::class);
|
||||
|
||||
CRUD::addFields([
|
||||
[
|
||||
'name' => 'name',
|
||||
'type' => 'text'
|
||||
],
|
||||
[
|
||||
'name' => 'size',
|
||||
'type' => 'text'
|
||||
],
|
||||
[
|
||||
'name' => 'type',
|
||||
'label' => "Type",
|
||||
'type' => 'select2_from_array',
|
||||
'options' => ['docx' => 'docx', 'xls' => 'xls', 'pdf' => 'pdf'],
|
||||
'allows_null' => true,
|
||||
],
|
||||
[ // Upload
|
||||
'name' => 'file',
|
||||
'label' => 'File',
|
||||
'type' => 'upload',
|
||||
'upload' => true,
|
||||
'disk' => 'uploads', // if you store files in the /public folder, please ommit this; if you store them in /storage or S3, please specify it;
|
||||
],
|
||||
[
|
||||
'name' => 'document_id',
|
||||
'type' => 'select',
|
||||
'label' => 'Document',
|
||||
'entity' => 'document',
|
||||
'model' => "App\Models\Document",
|
||||
'attribute' => 'name_ru'
|
||||
],
|
||||
[
|
||||
'name' => 'application_id',
|
||||
'type' => 'select',
|
||||
'label' => 'Application',
|
||||
'entity' => 'application',
|
||||
'model' => "App\Models\Application",
|
||||
'attribute' => 'account_id'
|
||||
],
|
||||
]);
|
||||
|
||||
/**
|
||||
* Fields can be defined using the fluent syntax or array syntax:
|
||||
* - CRUD::field('price')->type('number');
|
||||
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Define what happens when the Update operation is loaded.
|
||||
*
|
||||
* @see https://backpackforlaravel.com/docs/crud-operation-update
|
||||
* @return void
|
||||
*/
|
||||
protected function setupUpdateOperation()
|
||||
{
|
||||
$this->setupCreateOperation();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,177 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Requests\BrokerDocumentRequest;
|
||||
use Backpack\CRUD\app\Http\Controllers\CrudController;
|
||||
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
|
||||
|
||||
/**
|
||||
* Class BrokerDocumentCrudController
|
||||
* @package App\Http\Controllers\Admin
|
||||
* @property-read \Backpack\CRUD\app\Library\CrudPanel\CrudPanel $crud
|
||||
*/
|
||||
class BrokerDocumentCrudController extends CrudController
|
||||
{
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation;
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation;
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
|
||||
|
||||
/**
|
||||
* Configure the CrudPanel object. Apply settings to all operations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setup()
|
||||
{
|
||||
if(!(backpack_user()->hasPermissionTo('broker-documents'))){
|
||||
$this->crud->denyAccess(['delete', 'update']);
|
||||
}
|
||||
CRUD::setModel(\App\Models\BrokerDocument::class);
|
||||
CRUD::setRoute(config('backpack.base.route_prefix') . '/broker-document');
|
||||
CRUD::setEntityNameStrings('broker document', 'broker documents');
|
||||
$this->crud->addFilter([
|
||||
'name' => 'business',
|
||||
'type' => 'dropdown',
|
||||
'label' => trans('app.resource.business')
|
||||
], [
|
||||
1 => trans('app.resource.yes'),
|
||||
0 => trans('app.resource.no')
|
||||
], function ($value) { // if the filter is active
|
||||
$this->crud->addClause('where', 'business', $value);
|
||||
});
|
||||
|
||||
$this->crud->addFilter([
|
||||
'name' => 'company',
|
||||
'type' => 'dropdown',
|
||||
'label' => trans('app.resource.company')
|
||||
], [
|
||||
1 => trans('app.resource.yes'),
|
||||
0 => trans('app.resource.no')
|
||||
], function ($value) { // if the filter is active
|
||||
$this->crud->addClause('where', 'company', $value);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Define what happens when the List operation is loaded.
|
||||
*
|
||||
* @see https://backpackforlaravel.com/docs/crud-operation-list-entries
|
||||
* @return void
|
||||
*/
|
||||
protected function setupListOperation()
|
||||
{
|
||||
$this->crud->addColumns([
|
||||
[
|
||||
'name' => 'name',
|
||||
'type' => 'text',
|
||||
'label' => trans('app.resource.name')
|
||||
],
|
||||
[
|
||||
'name' => 'max_size',
|
||||
'type' => 'number',
|
||||
'label' => trans('app.resource.max_size'),
|
||||
'default' => 0
|
||||
],
|
||||
[
|
||||
'name' => 'order',
|
||||
'type' => 'number',
|
||||
'label' => trans('app.resource.position'),
|
||||
'default' => 0
|
||||
],
|
||||
[
|
||||
'name' => 'business',
|
||||
'type' => 'radio',
|
||||
'label' => trans('app.resource.enterpreneurs'),
|
||||
'options' => [
|
||||
1 => trans('app.resource.yes'),
|
||||
0 => trans('app.resource.no')
|
||||
]
|
||||
],
|
||||
[
|
||||
'name' => 'company',
|
||||
'type' => 'radio',
|
||||
'label' => trans('app.resource.companies'),
|
||||
'options' => [
|
||||
1 => trans('app.resource.yes'),
|
||||
0 => trans('app.resource.no')
|
||||
]
|
||||
],
|
||||
]);
|
||||
|
||||
/**
|
||||
* Columns can be defined using the fluent syntax or array syntax:
|
||||
* - CRUD::column('price')->type('number');
|
||||
* - CRUD::addColumn(['name' => 'price', 'type' => 'number']);
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Define what happens when the Create operation is loaded.
|
||||
*
|
||||
* @see https://backpackforlaravel.com/docs/crud-operation-create
|
||||
* @return void
|
||||
*/
|
||||
protected function setupCreateOperation()
|
||||
{
|
||||
CRUD::setValidation(BrokerDocumentRequest::class);
|
||||
$this->crud->addFields([
|
||||
[
|
||||
'name' => 'name',
|
||||
'type' => 'text',
|
||||
'label' => 'Name'
|
||||
],
|
||||
[
|
||||
'name' => 'description',
|
||||
'type' => 'textarea',
|
||||
'label' => 'Description'
|
||||
],
|
||||
[
|
||||
'name' => 'max_size',
|
||||
'type' => 'number',
|
||||
'label' => 'Max size (KBytes)',
|
||||
'default' => 0
|
||||
],
|
||||
[
|
||||
'name' => 'order',
|
||||
'type' => 'number',
|
||||
'label' => 'Position',
|
||||
'default' => 0
|
||||
],
|
||||
[
|
||||
'name' => 'business',
|
||||
'label' => 'Enterpreneurs',
|
||||
'type' => 'checkbox'
|
||||
],
|
||||
[
|
||||
'name' => 'company',
|
||||
'label' => 'Companies',
|
||||
'type' => 'checkbox'
|
||||
],
|
||||
[ // Checkbox
|
||||
'name' => 'is_required',
|
||||
'label' => 'Is required?',
|
||||
'type' => 'checkbox'
|
||||
],
|
||||
]);
|
||||
|
||||
|
||||
/**
|
||||
* Fields can be defined using the fluent syntax or array syntax:
|
||||
* - CRUD::field('price')->type('number');
|
||||
* - CRUD::addField(['name' => 'price', 'type' => 'number']));
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Define what happens when the Update operation is loaded.
|
||||
*
|
||||
* @see https://backpackforlaravel.com/docs/crud-operation-update
|
||||
* @return void
|
||||
*/
|
||||
protected function setupUpdateOperation()
|
||||
{
|
||||
$this->setupCreateOperation();
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ClientUserProvider
|
||||
{
|
||||
|
|
@ -14,8 +15,13 @@ class ClientUserProvider
|
|||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle($request, Closure $next){
|
||||
config(['auth.guards.api.provider' => 'clients']);
|
||||
|
||||
public function handle($request, Closure $next, $guard = 'api')
|
||||
{
|
||||
if (!Auth::guard($guard)->check()) {
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class BrokerApplicationRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'name' => 'required|min:5|max:255'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class BrokerAttachmentRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'name' => 'required|min:5|max:255'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class BrokerDocumentRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
// only allow updates if the user is logged in
|
||||
return backpack_auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
// 'name' => 'required|min:5|max:255'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation attributes that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class BrokerApplicationResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'broker_application_id' => $this->id,
|
||||
'state' => $this->state,
|
||||
'accepted_by' => $this->accepted_by,
|
||||
'accepted_date' => $this->accepted_date,
|
||||
'approved_by' => $this->approved_by,
|
||||
'refine_note' => $this->refine_note,
|
||||
'approved_date' => $this->approved_date,
|
||||
'questionnaire_path' => $this->questionnaire_path,
|
||||
'receipt_path' => $this->receipt_path,
|
||||
'broker_attachments' => BrokerAttachmentResource::collection($this->broker_attachments),
|
||||
'ticket' => TicketResource::make($this->ticket),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class BrokerAttachmentResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return [
|
||||
'attachment_id' => $this->id,
|
||||
'attachment_name' => $this->document->name ?: $this->name,
|
||||
'attachment_size' => $this->size,
|
||||
'attachment_file_type' => $this->type,
|
||||
'attachment_file_path' => is_null($this->file) ? null:Storage::url($this->file),
|
||||
'document_name' => $this->document->name,
|
||||
'document_description' => $this->document->description,
|
||||
'document_max_size' => $this->document->max_size,
|
||||
'is_required' => $this->document->is_required,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -86,6 +86,15 @@ public function last_application(){
|
|||
return $this->applications()->latest()->first();
|
||||
}
|
||||
|
||||
public function broker_applications():HasMany
|
||||
{
|
||||
return $this->hasMany(BrokerApplication::class);
|
||||
}
|
||||
|
||||
public function last_broker_application(){
|
||||
return $this->broker_applications()->latest()->first();
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|
|
@ -117,11 +126,6 @@ public function getCanExtendAttribute()
|
|||
if($application = $this->last_application()){
|
||||
return $application->state == 'approved' && $this->expires_at->lte(Carbon::now()->subMonths($month));
|
||||
}
|
||||
// if($this->expires_at->gte(Carbon::now()->subMonths($month))){
|
||||
// Log::info($this->expires_at);
|
||||
// }else{
|
||||
// Log::info(Carbon::now()->subMonths($month));
|
||||
// }
|
||||
|
||||
return !empty($this->legalization_number) && !empty( $this->expires_at) && $this->expires_at->gte(Carbon::now()->subMonths($month));
|
||||
}
|
||||
|
|
@ -136,6 +140,28 @@ public function getCountryNameAttribute(){
|
|||
return $this->country->name;
|
||||
}
|
||||
|
||||
|
||||
public function getCanApplyBrokerAttribute(){
|
||||
return is_null($this->last_application());
|
||||
}
|
||||
|
||||
public function getCanExtendBrokerAttribute()
|
||||
{
|
||||
$month = Config::get('settings.legalization_extend') ?? 1;
|
||||
|
||||
if($application = $this->last_application()){
|
||||
return $application->state == 'approved' && $this->expires_at->lte(Carbon::now()->subMonths($month));
|
||||
}
|
||||
|
||||
return !empty($this->legalization_number) && !empty( $this->expires_at) && $this->expires_at->gte(Carbon::now()->subMonths($month));
|
||||
}
|
||||
|
||||
public function getApplicationBrokerStatusAttribute(){
|
||||
$application = $this->last_application();
|
||||
|
||||
return $application->state ?? null;
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
class BrokerApplication extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'broker_applications';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
// protected $guarded = ['id'];
|
||||
protected $fillable = [
|
||||
'account_id', 'status','state','accepted_by','approved_by'
|
||||
];
|
||||
// protected $hidden = [];
|
||||
protected $dates = ['accepted_date','approved_date','created_at','updated_at'];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function preview(){
|
||||
return '<a class="btn btn-sm btn-link" href="'. backpack_url('preview-broker-application/'.$this->id) .'" data-toggle="tooltip">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16">
|
||||
<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/>
|
||||
<path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
|
||||
</svg>
|
||||
' . trans('app.last_updates.preview') . '</a>';
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function account(){
|
||||
return $this->belongsTo(Account::class, 'account_id');
|
||||
}
|
||||
|
||||
public function broker_attachments(){
|
||||
return $this->hasMany(BrokerAttachment::class)
|
||||
->leftJoin('broker_documents','broker_attachments.broker_document_id','=','broker_documents.id')
|
||||
->select('broker_attachments.*','order')
|
||||
->orderBy('broker_documents.order');
|
||||
}
|
||||
|
||||
public function ticket():HasOne{
|
||||
return $this->hasOne(Ticket::class);
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BrokerAttachment extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'broker_attachments';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
// protected $guarded = ['id'];
|
||||
protected $fillable = [
|
||||
'name', 'size', 'type', 'file', 'broker_document_id', 'broker_application_id'
|
||||
];
|
||||
// protected $hidden = [];
|
||||
// protected $dates = [];
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function broker_application(){
|
||||
return $this->belongsTo(BrokerApplication::class, 'broker_application_id');
|
||||
}
|
||||
|
||||
public function document(){
|
||||
return $this->belongsTo(BrokerDocument::class, 'broker_document_id');
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function setFileAttribute($value)
|
||||
{
|
||||
$attribute_name = 'file';
|
||||
$disk = 'public';
|
||||
$destination_path = 'uploads/broker_attachments';
|
||||
|
||||
$this->uploadFileToDisk($value, $attribute_name, $disk, $destination_path);
|
||||
|
||||
// return $this->attributes[{$attribute_name}]; // uncomment if this is a translatable field
|
||||
}
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
static::deleting(function($obj) {
|
||||
\Storage::disk('public')->delete($obj->file);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Backpack\CRUD\app\Models\Traits\CrudTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Backpack\CRUD\app\Models\Traits\SpatieTranslatable\HasTranslations;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class BrokerDocument extends Model
|
||||
{
|
||||
use CrudTrait;
|
||||
use HasTranslations;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GLOBAL VARIABLES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
protected $table = 'broker_documents';
|
||||
// protected $primaryKey = 'id';
|
||||
// public $timestamps = false;
|
||||
// protected $guarded = ['id'];
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description',
|
||||
'max_size',
|
||||
'business',
|
||||
'company',
|
||||
'all_country',
|
||||
'order',
|
||||
'is_required'
|
||||
];
|
||||
// protected $hidden = [];
|
||||
// protected $dates = [];
|
||||
protected $translatable = ['name', 'description'];
|
||||
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FUNCTIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function broker_attachments(): BelongsToMany{
|
||||
return $this->belongsToMany(BrokerAttachment::class);
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| SCOPES
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ACCESSORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MUTATORS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
}
|
||||
|
|
@ -72,6 +72,7 @@
|
|||
'clients' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => App\Models\Client::class,
|
||||
'table'=>'clients'
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('broker_documents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->text('name')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->double('max_size')->nullable();
|
||||
$table->boolean('business')->default(0);
|
||||
$table->boolean('company')->default(0);
|
||||
$table->integer('order')->default(0);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('broker_documents');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('broker_applications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->boolean('status')->default(0);
|
||||
$table->foreignId('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
||||
$table->string('state')->default('new');
|
||||
$table->string('accepted_by')->nullable();
|
||||
$table->string('modified_by')->nullable();
|
||||
$table->string('approved_by')->nullable();
|
||||
$table->string('accepted_date')->nullable();
|
||||
$table->string('approved_date')->nullable();
|
||||
$table->text('refine_note')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('broker_applications');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('broker_attachments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name')->nullable();
|
||||
$table->string('size')->nullable();
|
||||
$table->string('type')->nullable();
|
||||
$table->string('file')->nullable();
|
||||
$table->foreignId('broker_document_id')->onDelete('cascade');
|
||||
$table->foreignId('broker_application_id')->references('id')->on('applications')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('broker_attachments');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tickets', function (Blueprint $table) {
|
||||
$table->foreignId('broker_application_id')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tickets', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('broker_documents', function (Blueprint $table) {
|
||||
$table->boolean('is_required')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('broker_documents', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,313 @@
|
|||
@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="{{backpack_url()}}">@lang('app.dashboard.title')</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{backpack_url('application')}}">@lang('app.application.list_title')</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ $application->id }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@if ($application->state == 'new')
|
||||
<form class="form-horizontal" action="{{ route('accepted_application',['id'=>$application->id]) }}"
|
||||
method="get">
|
||||
@csrf
|
||||
<button class="btn btn-primary mb-4" type="submit" 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>
|
||||
@lang('app.application.accept_application')
|
||||
</button>
|
||||
</form>
|
||||
@elseif ($application->state == 'accepted')
|
||||
<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>
|
||||
@lang('app.application.approve')
|
||||
</button>
|
||||
<button class="btn btn-warning mb-4" type="button" data-toggle="modal" data-target="#refineModal">
|
||||
|
||||
@lang('app.application.refine')
|
||||
</button>
|
||||
<div class="modal fade" id="refineModal" 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">{{ trans('app.last_updates.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="{{route('refine_application',['id'=>$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 col-sm-12" element="div" bp-field-wrapper="true"
|
||||
bp-field-name="title" bp-field-type="text">
|
||||
<label>{{ trans('app.last_updates.note') }}</label>
|
||||
|
||||
<textarea name="note" value="" class="form-control"></textarea>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-secondary" type="button" data-dismiss="modal">{{ trans('app.last_updates.close') }}</button>
|
||||
<button class="btn btn-success" type="submit">{{ trans('app.last_updates.save') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- /.modal-content-->
|
||||
</div>
|
||||
<!-- /.modal-dialog-->
|
||||
</div>
|
||||
<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">{{ trans('app.last_updates.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="{{route('approve_application',['id'=>$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">{{ trans('app.account.legalization_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">{{ trans('app.account.expires_at') }}</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">{{ trans('app.last_updates.close') }}</button>
|
||||
<button class="btn btn-success" type="submit">{{ trans('app.last_updates.save') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- /.modal-content-->
|
||||
</div>
|
||||
<!-- /.modal-dialog-->
|
||||
</div>
|
||||
@endif
|
||||
@if($application->ticket)
|
||||
<a class="btn btn-success mb-4" href="{{backpack_url('chat')}}?ticket_id={{ $application->ticket->id }}">{{ trans('app.last_updates.go_to_ticket') }}</a>
|
||||
@else
|
||||
<button class="btn btn-success mb-4" type="button" data-toggle="modal" data-target="#ticketModal">
|
||||
<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>
|
||||
@lang('app.ticket.create')
|
||||
</button>
|
||||
<div class="modal fade" id="ticketModal" tabindex="-1" aria-labelledby="myModalLabel"
|
||||
style="display: none;" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg modal-success" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">{{ trans('app.last_updates.create_ticket_for_application') }}</h4>
|
||||
<button class="close" type="button" data-dismiss="modal" aria-label="Close"><span
|
||||
aria-hidden="true">×</span></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form method="post" action="{{backpack_url('create-application-ticket')}}" method="POST">
|
||||
@csrf
|
||||
<input type="hidden" name="application_id" value="{{ $application->id }}">
|
||||
<input type="hidden" name="account_id" value={{ $application->account_id }}>
|
||||
<input type="hidden" name="status_id" value="1">
|
||||
<input type="hidden" name="category_id" value="2">
|
||||
<input type="hidden" name="last_sender" value="admin">
|
||||
<div class="card">
|
||||
<div class="card-body row">
|
||||
<!-- text input -->
|
||||
|
||||
<div class="form-group col-sm-12" element="div" bp-field-wrapper="true"
|
||||
bp-field-name="title" bp-field-type="text">
|
||||
<label>{{ trans('app.last_updates.title') }}</label>
|
||||
|
||||
<input type="text" name="title" value="" class="form-control">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-12" element="div" bp-field-wrapper="true"
|
||||
bp-field-name="title" bp-field-type="text">
|
||||
<label>{{ trans('app.last_updates.content') }}</label>
|
||||
|
||||
<textarea name="content" value="" class="form-control"></textarea>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="saveActions" class="form-group">
|
||||
<div class="btn-group" role="group">
|
||||
<button type="submit" class="btn btn-success">
|
||||
<span class="la la-save" role="presentation" aria-hidden="true"></span>
|
||||
|
||||
<span data-value="save_and_back">{{ trans('app.last_updates.save') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.modal-content-->
|
||||
</div>
|
||||
<!-- /.modal-dialog-->
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-4">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{{ trans('app.last_updates.application') }}</h5>
|
||||
<div class="form-group">
|
||||
<label for="company"><small>{{ trans('app.ticket.status') }}</small></label>
|
||||
<h6><strong>{{ trans('app.application.'.$application->state) }}</strong></h6>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="company"><small>{{ trans('app.last_updates.accepted_by') }}</small></label>
|
||||
<h6><strong>{{ $application->accepted_by }}</strong></h6>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="company"><small>{{ trans('app.last_updates.accepted_date') }}</small></label>
|
||||
<h6><strong>{{ $application->accepted_date }}</strong></h6>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="company"><small>{{ trans('app.last_updates.approved_by') }}</small></label>
|
||||
<h6><strong>{{ $application->approved_by }}</strong></h6>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="company"><small>{{ trans('app.last_updates.approved_date') }}</small></label>
|
||||
<h6><strong>{{ $application->approved_date }}</strong></h6>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="company"><small>{{ trans('app.last_updates.last_modified_by') }}</small></label>
|
||||
<h6><strong>{{ $application->modified_by }}</strong></h6>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="company"><small>{{ trans('app.last_updates.last_modified_date') }}</small></label>
|
||||
<h6><strong>{{ $application->updated_at }}</strong></h6>
|
||||
</div>
|
||||
|
||||
</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="#profile" role="tab" aria-controls="profile" aria-selected="true">
|
||||
@lang('app.application.profile') @lang('app.'.$application->account->type.'.title')
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" 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>
|
||||
@lang('app.application.attachments')
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="profile" role="tabpanel">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@include('admin.account.'.$application->account->type,['account'=>$application->account])
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="attachments" role="tabpanel">
|
||||
<table class="table table-responsive-sm table-striped mb-0">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>@lang('app.application.name')</th>
|
||||
<th>@lang('app.application.size')</th>
|
||||
<th>@lang('app.application.type')</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($application->broker_attachments as $attachment)
|
||||
|
||||
<tr>
|
||||
@if ($attachment->file)
|
||||
<td>
|
||||
<a class="nav-link" href="/storage/{{ $attachment->file }}" target="_blank">
|
||||
{{ $attachment->name }}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
{{ $attachment->size }} Kb
|
||||
</td>
|
||||
<td>
|
||||
{{ $application->type }}
|
||||
</td>
|
||||
@else
|
||||
<td>{{ $attachment->name }}</td><td></td><td></td>
|
||||
@endif
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@endsection
|
||||
|
|
@ -64,3 +64,7 @@
|
|||
<li class="nav-item"><a class="nav-link" href="{{ backpack_url('contract') }}"><i class="nav-icon la la-question"></i> @lang('app.contract.list_title')</a></li>
|
||||
|
||||
@endif
|
||||
|
||||
<li class="nav-item"><a class="nav-link" href="{{ backpack_url('broker-document') }}"><i class="nav-icon la la-question"></i> Broker documents</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="{{ backpack_url('broker-application') }}"><i class="nav-icon la la-question"></i> Broker applications</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="{{ backpack_url('broker-attachment') }}"><i class="nav-icon la la-question"></i> Broker attachments</a></li>
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\API\ApplicationController;
|
||||
use App\Http\Controllers\API\BrokerApplicationController;
|
||||
use App\Http\Controllers\API\ClientController;
|
||||
use App\Http\Controllers\API\ContractController;
|
||||
use App\Http\Controllers\API\ResourceController;
|
||||
|
|
@ -31,7 +32,7 @@
|
|||
Route::post('resolution-import', [ContractController::class, 'resolutionBasis']);
|
||||
});
|
||||
|
||||
// Route::post('/prof',[AccountController::class,'storeProfileInfo']);
|
||||
|
||||
Route::middleware(['auth.client', 'auth:api', 'auth:sanctum'])->group(function () {
|
||||
/**
|
||||
* Client endpoints
|
||||
|
|
@ -80,6 +81,17 @@
|
|||
|
||||
});
|
||||
|
||||
/**
|
||||
* Broker-Application endpoints
|
||||
*/
|
||||
Route::group(['prefix' => 'broker-application'], function () {
|
||||
Route::get('/',[BrokerApplicationController::class,'get']);
|
||||
Route::get('/oprosnik',[BrokerApplicationController::class,'downloadQuestionaire']);
|
||||
Route::get('new',[BrokerApplicationController::class,'create']);
|
||||
Route::post('upload/{attachment_id}',[BrokerApplicationController::class,'upload']);
|
||||
Route::post('apply',[BrokerApplicationController::class,'apply']);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
Route::get('/chat', [TicketController::class, 'chat'])->name('chat');
|
||||
Route::get('/preview/{id}', [ResourceController::class, 'previewAccountAdmin']);
|
||||
Route::get('/preview-application/{id}',[ResourceController::class, 'previewApplicationAdmin']);
|
||||
Route::get('/preview-broker-application/{id}',[ResourceController::class, 'previewBrokerApplicationAdmin']);
|
||||
Route::get('/export-account-admin/{id}', [ExportController::class, 'export']);
|
||||
Route::post('/create-application-ticket', [TicketController::class, 'createAppTicket']);
|
||||
Route::get('/create-account-client/{id}', [ResourceController::class, 'createAccountClient']);
|
||||
|
|
@ -55,4 +56,7 @@
|
|||
Route::crud('department', 'DepartmentCrudController');
|
||||
Route::crud('resolution', 'ResolutionCrudController');
|
||||
Route::crud('resolutionbasis', 'ResolutionbasisCrudController');
|
||||
Route::crud('broker-document', 'BrokerDocumentCrudController');
|
||||
Route::crud('broker-application', 'BrokerApplicationCrudController');
|
||||
Route::crud('broker-attachment', 'BrokerAttachmentCrudController');
|
||||
}); // this should be the absolute last line of this file
|
||||
|
|
|
|||
|
|
@ -1817,6 +1817,250 @@
|
|||
]
|
||||
}
|
||||
},
|
||||
"/api/broker-application": {
|
||||
"get": {
|
||||
"tags": ["Broker-Application"],
|
||||
"summary": "Get accounts Legalization application",
|
||||
"parameters": [{
|
||||
"name": "X-Localization",
|
||||
"in": "header",
|
||||
"description": "Localization",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"examples": {
|
||||
"ru": {
|
||||
"summary": "Russian localization",
|
||||
"value": "ru"
|
||||
},
|
||||
"en": {
|
||||
"summary": "English localization",
|
||||
"value": "en"
|
||||
},
|
||||
"tm": {
|
||||
"summary": "Turkmen localization",
|
||||
"value": "tm"
|
||||
}
|
||||
}
|
||||
}],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"security":[
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/broker-application/new": {
|
||||
"get": {
|
||||
"tags": ["Broker-Application"],
|
||||
"summary": "Create,make new Legalization application",
|
||||
"parameters": [{
|
||||
"name": "X-Localization",
|
||||
"in": "header",
|
||||
"description": "Localization",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"examples": {
|
||||
"ru": {
|
||||
"summary": "Russian localization",
|
||||
"value": "ru"
|
||||
},
|
||||
"en": {
|
||||
"summary": "English localization",
|
||||
"value": "en"
|
||||
},
|
||||
"tm": {
|
||||
"summary": "Turkmen localization",
|
||||
"value": "tm"
|
||||
}
|
||||
}
|
||||
}],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"security":[
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/broker-application/upload/{attachment_id}": {
|
||||
"post": {
|
||||
"tags": ["Broker-Application"],
|
||||
"summary": "Upload document to application",
|
||||
"parameters": [{
|
||||
"name": "attachment_id",
|
||||
"in": "path",
|
||||
"description": "Attachment id",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer"
|
||||
}
|
||||
}],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"multipart/form-data:": {
|
||||
"schema": {
|
||||
"properties": {
|
||||
"file": {
|
||||
"type": "string",
|
||||
"format": "binary",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"security":[
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/broker-application/apply": {
|
||||
"post": {
|
||||
"tags": ["Broker-Application"],
|
||||
"summary": "Commit,apply application. send to review ",
|
||||
"parameters": [{
|
||||
"name": "X-Localization",
|
||||
"in": "header",
|
||||
"description": "Localization",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"examples": {
|
||||
"ru": {
|
||||
"summary": "Russian localization",
|
||||
"value": "ru"
|
||||
},
|
||||
"en": {
|
||||
"summary": "English localization",
|
||||
"value": "en"
|
||||
},
|
||||
"tm": {
|
||||
"summary": "Turkmen localization",
|
||||
"value": "tm"
|
||||
}
|
||||
}
|
||||
}],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"example": {
|
||||
"data": {
|
||||
"attachment_id": 1,
|
||||
"attachment_name": "Pasport Kopia",
|
||||
"attachment_size": "10",
|
||||
"attachment_file_type": "pdf",
|
||||
"attachment_file_path": "/storage/mtorage/gdeto/tam",
|
||||
"document_name": "Pasport Kopia",
|
||||
"document_description": "Pasport kopialay",
|
||||
"document_max_size": "10"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized"
|
||||
}
|
||||
},
|
||||
"security":[
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/broker-application/oprosnik": {
|
||||
"get": {
|
||||
"tags": ["Broker-Application"],
|
||||
"summary": "Download oprosnik",
|
||||
"parameters": [{
|
||||
"name": "X-Localization",
|
||||
"in": "header",
|
||||
"description": "Localization",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"examples": {
|
||||
"ru": {
|
||||
"summary": "Russian localization",
|
||||
"value": "ru"
|
||||
},
|
||||
"en": {
|
||||
"summary": "English localization",
|
||||
"value": "en"
|
||||
},
|
||||
"tm": {
|
||||
"summary": "Turkmen localization",
|
||||
"value": "tm"
|
||||
}
|
||||
}
|
||||
}],
|
||||
"security":[
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/contract": {
|
||||
"post": {
|
||||
"tags": ["Contract"],
|
||||
|
|
|
|||
Loading…
Reference in New Issue