application status draft
This commit is contained in:
parent
cd2262bc75
commit
8a8ffcc90c
|
|
@ -177,10 +177,10 @@ public function upload(DocumentUploadRequest $request,$attachment_id)
|
|||
return response()->json(['success' => false, 'message' =>trans('app.application.upload_max_size')],422);
|
||||
}
|
||||
|
||||
if($attachment->file){
|
||||
//todo delete or replace old file
|
||||
// Stor
|
||||
}
|
||||
// if($attachment->file){
|
||||
// //todo delete or replace old file
|
||||
//// Stor
|
||||
// }
|
||||
|
||||
$filename = Str::snake($attachment->name).'.'.$uploadedFile->getClientOriginalExtension();
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
use Carbon\Carbon;
|
||||
|
||||
class ApplicationController{
|
||||
public function accept($id){
|
||||
$entry = Application::find($id);
|
||||
$entry->accepted_by = backpack_user()->email;
|
||||
$entry->accepted_date = Carbon::now();
|
||||
$entry->save();
|
||||
return redirect()->back();
|
||||
}
|
||||
// public function accept($id){
|
||||
// $entry = Application::find($id);
|
||||
// $entry->accepted_by = backpack_user()->email;
|
||||
// $entry->accepted_date = Carbon::now();
|
||||
// $entry->save();
|
||||
// return redirect()->back();
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
use App\Models\Application;
|
||||
use Backpack\CRUD\app\Http\Controllers\CrudController;
|
||||
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
|
||||
use Carbon\Carbon;
|
||||
|
||||
/**
|
||||
* Class ApplicationCrudController
|
||||
|
|
@ -16,7 +17,7 @@ class ApplicationCrudController 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\UpdateOperation;
|
||||
use \Backpack\CRUD\app\Http\Controllers\Operations\DeleteOperation;
|
||||
|
||||
/**
|
||||
|
|
@ -43,8 +44,8 @@ public function setup()
|
|||
'label' => trans('app.application.state')
|
||||
], [
|
||||
'new' => trans('app.application.new'),
|
||||
'applied' => trans('app.application.applied'),
|
||||
// 'accepted' => trans('app.application.accepted'),
|
||||
// 'applied' => trans('app.application.applied'),
|
||||
'accepted' => trans('app.application.accepted'),
|
||||
'refine' => trans('app.application.refine'),
|
||||
'approved' => trans('app.application.approved'),
|
||||
'archive' => trans('app.application.archived')
|
||||
|
|
@ -132,10 +133,17 @@ protected function setupListOperation()
|
|||
]);
|
||||
|
||||
$this->crud->addButtonFromModelFunction('line', 'preview_button', 'preview', 'beginning');
|
||||
$this->crud->addButtonFromModelFunction('line', 'accept_button', 'accept', 'beginning');
|
||||
// $this->crud->addButtonFromModelFunction('line', 'accept_button', 'accept', 'beginning');
|
||||
|
||||
}
|
||||
|
||||
public function accept($id){
|
||||
$entry = Application::find($id);
|
||||
$entry->accepted_by = backpack_user()->email;
|
||||
$entry->accepted_date = Carbon::now();
|
||||
$entry->save();
|
||||
return redirect()->back();
|
||||
}
|
||||
/**
|
||||
* Define what happens when the Create operation is loaded.
|
||||
*
|
||||
|
|
@ -176,22 +184,22 @@ protected function setupListOperation()
|
|||
* @see https://backpackforlaravel.com/docs/crud-operation-update
|
||||
* @return void
|
||||
*/
|
||||
protected function setupUpdateOperation()
|
||||
{
|
||||
CRUD::setValidation(ApplicationRequest::class);
|
||||
$this->crud->addFields([
|
||||
[
|
||||
'name' => 'state',
|
||||
'label' => 'State',
|
||||
'type' => 'select_from_array',
|
||||
'options' => [
|
||||
'new' => trans('app.application.new'),
|
||||
'applied' => trans('app.application.applied'),
|
||||
'refine' => trans('app.application.refine'),
|
||||
'approved' => trans('app.application.approved'),
|
||||
'archive' => trans('app.application.archived')
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
// protected function setupUpdateOperation()
|
||||
// {
|
||||
// CRUD::setValidation(ApplicationRequest::class);
|
||||
// $this->crud->addFields([
|
||||
// [
|
||||
// 'name' => 'state',
|
||||
// 'label' => 'State',
|
||||
// 'type' => 'select_from_array',
|
||||
// 'options' => [
|
||||
// 'new' => trans('app.application.new'),
|
||||
// 'applied' => trans('app.application.applied'),
|
||||
// 'refine' => trans('app.application.refine'),
|
||||
// 'approved' => trans('app.application.approved'),
|
||||
// 'archive' => trans('app.application.archived')
|
||||
// ]
|
||||
// ]
|
||||
// ]);
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
<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"><a href="/howpsuzlyk">Admin</a></li>
|
||||
<li class="breadcrumb-item"><a href="/howpsuzlyk/application">Application</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ $application->id }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
|
@ -28,7 +28,22 @@
|
|||
<div class="col-lg-4">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@if ($application->state == 'applied')
|
||||
@if ($application->state == 'new')
|
||||
<form class="form-horizontal" action="{{ route('accepted_application',['id'=>$application->id] }}"
|
||||
method="post">
|
||||
@csrf
|
||||
<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>
|
||||
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">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\Admin\ApplicationController;
|
||||
use App\Http\Controllers\Admin\ApplicationCrudController;
|
||||
use App\Http\Controllers\API\ResourceController;
|
||||
use App\Http\Controllers\API\TicketController;
|
||||
use App\Http\Controllers\ExportController;
|
||||
|
|
@ -49,4 +50,5 @@
|
|||
Route::post('/client/custom-create', [ResourceController::class, 'createClient']);
|
||||
Route::crud('contract', 'ContractCrudController');
|
||||
Route::get('/accept/{id}', [ApplicationController::class, 'accept']);
|
||||
Route::get('application/accept/{id}', [ApplicationCrudController::class, 'accept'])->name('accepted_application');
|
||||
}); // this should be the absolute last line of this file
|
||||
|
|
|
|||
Loading…
Reference in New Issue