Update Permission Action Button on Master
This commit is contained in:
parent
ce57951bfd
commit
d4bedafefe
@ -4,7 +4,6 @@
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Modules\Cetaklabel\Entities\Cardboard;
|
||||
use Modules\Cetaklabel\Entities\CardboardDetail;
|
||||
use Yajra\DataTables\EloquentDataTable;
|
||||
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
||||
|
@ -2,8 +2,11 @@
|
||||
|
||||
namespace Modules\Cetaklabel\DataTables;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Modules\Cetaklabel\Entities\Directorat;
|
||||
use Modules\Usermanager\Entities\User;
|
||||
use Yajra\DataTables\EloquentDataTable;
|
||||
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
@ -23,11 +26,27 @@
|
||||
->filter(function ($query) {
|
||||
if (request()->has('search')) {
|
||||
$search = request()->get('search');
|
||||
|
||||
if(Auth::user()->hasRole('otorisator')) {
|
||||
$query->whereIn('status', [0, 4, 6, 9]);
|
||||
}
|
||||
$query->where('kode', 'like', "%" . $search['value'] . "%")
|
||||
->orWhere('name', 'like', "%" . $search['value'] . "%");
|
||||
}
|
||||
})
|
||||
->addIndexColumn()
|
||||
->addColumn('craeted_at', function ($model) {
|
||||
return $model->created_at !== null ? Carbon::parse($model->created_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('created_by', function ($model) {
|
||||
return $model->created_by ? $model->creator->name : '-';
|
||||
})
|
||||
->addColumn('approved_at', function ($model) {
|
||||
return $model->approved_at !== null ? Carbon::parse($model->approved_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('approved_by', function ($model) {
|
||||
return $model->approved_by ? User::find($model->approved_by)->name : '-';
|
||||
})
|
||||
->addColumn('status', 'cetaklabel::masters.directorat._status')
|
||||
->addColumn('action', 'cetaklabel::masters.directorat._action')
|
||||
->rawColumns(['status', 'action'])
|
||||
@ -74,6 +93,10 @@
|
||||
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
|
||||
Column::make('kode'),
|
||||
Column::make('name'),
|
||||
Column::make('craeted_at')->className('none'),
|
||||
Column::make('created_by')->className('none'),
|
||||
Column::make('approved_at')->className('none'),
|
||||
Column::make('approved_by')->className('none'),
|
||||
Column::computed('status')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
namespace Modules\Cetaklabel\DataTables;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Modules\Cetaklabel\Entities\DocumentType;
|
||||
use Modules\Usermanager\Entities\User;
|
||||
use Yajra\DataTables\EloquentDataTable;
|
||||
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
@ -28,7 +30,21 @@
|
||||
}
|
||||
})
|
||||
->addIndexColumn()
|
||||
->addColumn('craeted_at', function ($model) {
|
||||
return $model->created_at !== null ? Carbon::parse($model->created_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('created_by', function ($model) {
|
||||
return $model->created_by ? $model->creator->name : '-';
|
||||
})
|
||||
->addColumn('approved_at', function ($model) {
|
||||
return $model->approved_at !== null ? Carbon::parse($model->approved_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('approved_by', function ($model) {
|
||||
return $model->approved_by ? User::find($model->approved_by)->name : '-';
|
||||
})
|
||||
->addColumn('status', 'cetaklabel::masters.document-type._status')
|
||||
->addColumn('action', 'cetaklabel::masters.document-type._action')
|
||||
->rawColumns(['status', 'action'])
|
||||
->setRowId('id');
|
||||
}
|
||||
|
||||
@ -72,11 +88,20 @@
|
||||
Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false),
|
||||
Column::make('kode'),
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
Column::make('craeted_at')->className('none'),
|
||||
Column::make('created_by')->className('none'),
|
||||
Column::make('approved_at')->className('none'),
|
||||
Column::make('approved_by')->title('Approved By')->className('none'),
|
||||
Column::computed('status')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(60)
|
||||
->addClass('text-center'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(250)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
namespace Modules\Cetaklabel\DataTables;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Modules\Cetaklabel\Entities\Job;
|
||||
use Modules\Usermanager\Entities\User;
|
||||
use Yajra\DataTables\EloquentDataTable;
|
||||
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
@ -36,7 +38,21 @@
|
||||
->addColumn('sub_directorat', function ($job) {
|
||||
return $job->sub_directorat->name;
|
||||
})
|
||||
->addColumn('craeted_at', function ($model) {
|
||||
return $model->created_at !== null ? Carbon::parse($model->created_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('created_by', function ($model) {
|
||||
return $model->created_by ? $model->creator->name : '-';
|
||||
})
|
||||
->addColumn('approved_at', function ($model) {
|
||||
return $model->approved_at !== null ? Carbon::parse($model->approved_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('approved_by', function ($model) {
|
||||
return $model->approved_by ? User::find($model->approved_by)->name : '-';
|
||||
})
|
||||
->addColumn('status', 'cetaklabel::masters.directorat._status')
|
||||
->addColumn('action', 'cetaklabel::masters.job._action')
|
||||
->rawColumns(['status', 'action'])
|
||||
->setRowId('id');
|
||||
}
|
||||
|
||||
@ -82,11 +98,20 @@
|
||||
Column::make('sub_directorat'),
|
||||
Column::make('kode'),
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
Column::make('craeted_at')->className('none'),
|
||||
Column::make('created_by')->className('none'),
|
||||
Column::make('approved_at')->className('none'),
|
||||
Column::make('approved_by')->className('none'),
|
||||
Column::computed('status')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(60)
|
||||
->addClass('text-center'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(250)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
namespace Modules\Cetaklabel\DataTables;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Modules\Cetaklabel\Entities\SpecialCode;
|
||||
use Modules\Usermanager\Entities\User;
|
||||
use Yajra\DataTables\EloquentDataTable;
|
||||
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
@ -28,7 +30,21 @@
|
||||
}
|
||||
})
|
||||
->addIndexColumn()
|
||||
->addColumn('craeted_at', function ($model) {
|
||||
return $model->created_at !== null ? Carbon::parse($model->created_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('created_by', function ($model) {
|
||||
return $model->created_by ? $model->creator->name : '-';
|
||||
})
|
||||
->addColumn('approved_at', function ($model) {
|
||||
return $model->approved_at !== null ? Carbon::parse($model->approved_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('approved_by', function ($model) {
|
||||
return $model->approved_by ? User::find($model->approved_by)->name : '-';
|
||||
})
|
||||
->addColumn('status', 'cetaklabel::masters.directorat._status')
|
||||
->addColumn('action', 'cetaklabel::masters.special-code._action')
|
||||
->rawColumns(['status', 'action'])
|
||||
->setRowId('id');
|
||||
}
|
||||
|
||||
@ -73,11 +89,20 @@
|
||||
Column::make('kode'),
|
||||
Column::make('name'),
|
||||
Column::make('description'),
|
||||
Column::computed('action')
|
||||
Column::make('craeted_at')->className('none'),
|
||||
Column::make('created_by')->className('none'),
|
||||
Column::make('approved_at')->className('none'),
|
||||
Column::make('approved_by')->title('Approved By')->className('none'),
|
||||
Column::computed('status')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(60)
|
||||
->addClass('text-center'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(250)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
namespace Modules\Cetaklabel\DataTables;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Modules\Cetaklabel\Entities\SubDirectorat;
|
||||
use Modules\Usermanager\Entities\User;
|
||||
use Yajra\DataTables\EloquentDataTable;
|
||||
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
@ -32,7 +34,21 @@
|
||||
->addColumn('directorat', function ($subDirectorat) {
|
||||
return $subDirectorat->directorat->name;
|
||||
})
|
||||
->addColumn('craeted_at', function ($model) {
|
||||
return $model->created_at !== null ? Carbon::parse($model->created_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('created_by', function ($model) {
|
||||
return $model->created_by ? $model->creator->name : '-';
|
||||
})
|
||||
->addColumn('approved_at', function ($model) {
|
||||
return $model->approved_at !== null ? Carbon::parse($model->approved_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('approved_by', function ($model) {
|
||||
return $model->approved_by ? User::find($model->approved_by)->name : '-';
|
||||
})
|
||||
->addColumn('status', 'cetaklabel::masters.directorat._status')
|
||||
->addColumn('action', 'cetaklabel::masters.sub-directorat._action')
|
||||
->rawColumns(['status', 'action'])
|
||||
->setRowId('id');
|
||||
}
|
||||
|
||||
@ -77,11 +93,20 @@
|
||||
Column::make('directorat'),
|
||||
Column::make('kode'),
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
Column::make('craeted_at')->className('none'),
|
||||
Column::make('created_by')->className('none'),
|
||||
Column::make('approved_at')->className('none'),
|
||||
Column::make('approved_by')->title('Approved By')->className('none'),
|
||||
Column::computed('status')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(60)
|
||||
->addClass('text-center'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(250)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
namespace Modules\Cetaklabel\DataTables;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Modules\Cetaklabel\Entities\SubJob;
|
||||
use Modules\Usermanager\Entities\User;
|
||||
use Yajra\DataTables\EloquentDataTable;
|
||||
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
@ -40,7 +42,21 @@
|
||||
->addColumn('job', function ($subJob) {
|
||||
return $subJob->job->name;
|
||||
})
|
||||
->addColumn('craeted_at', function ($model) {
|
||||
return $model->created_at !== null ? Carbon::parse($model->created_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('created_by', function ($model) {
|
||||
return $model->created_by ? $model->creator->name : '-';
|
||||
})
|
||||
->addColumn('approved_at', function ($model) {
|
||||
return $model->approved_at !== null ? Carbon::parse($model->approved_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('approved_by', function ($model) {
|
||||
return $model->approved_by ? User::find($model->approved_by)->name : '-';
|
||||
})
|
||||
->addColumn('status', 'cetaklabel::masters.directorat._status')
|
||||
->addColumn('action', 'cetaklabel::masters.sub-job._action')
|
||||
->rawColumns(['status', 'action'])
|
||||
->setRowId('id');
|
||||
}
|
||||
|
||||
@ -87,11 +103,20 @@
|
||||
Column::make('job'),
|
||||
Column::make('kode'),
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
Column::make('craeted_at')->className('none'),
|
||||
Column::make('created_by')->className('none'),
|
||||
Column::make('approved_at')->className('none'),
|
||||
Column::make('approved_by')->title('Approved By')->className('none'),
|
||||
Column::computed('status')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(60)
|
||||
->addClass('text-center'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(250)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
namespace Modules\Cetaklabel\DataTables;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
|
||||
use Modules\Cetaklabel\Entities\SubSubJob;
|
||||
use Modules\Usermanager\Entities\User;
|
||||
use Yajra\DataTables\EloquentDataTable;
|
||||
use Yajra\DataTables\Html\Builder as HtmlBuilder;
|
||||
use Yajra\DataTables\Html\Column;
|
||||
@ -44,7 +46,21 @@
|
||||
->addColumn('sub_job', function ($subJob) {
|
||||
return $subJob->sub_job->name;
|
||||
})
|
||||
->addColumn('craeted_at', function ($model) {
|
||||
return $model->created_at !== null ? Carbon::parse($model->created_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('created_by', function ($model) {
|
||||
return $model->created_by ? $model->creator->name : '-';
|
||||
})
|
||||
->addColumn('approved_at', function ($model) {
|
||||
return $model->approved_at !== null ? Carbon::parse($model->approved_at)->format('d F Y H:i:s') : '-';
|
||||
})
|
||||
->addColumn('approved_by', function ($model) {
|
||||
return $model->approved_by ? User::find($model->approved_by)->name : '-';
|
||||
})
|
||||
->addColumn('status', 'cetaklabel::masters.directorat._status')
|
||||
->addColumn('action', 'cetaklabel::masters.sub-sub-job._action')
|
||||
->rawColumns(['status', 'action'])
|
||||
->setRowId('id');
|
||||
}
|
||||
|
||||
@ -92,11 +108,20 @@
|
||||
Column::make('sub_job'),
|
||||
Column::make('kode'),
|
||||
Column::make('name'),
|
||||
Column::computed('action')
|
||||
Column::make('craeted_at')->className('none'),
|
||||
Column::make('created_by')->className('none'),
|
||||
Column::make('approved_at')->className('none'),
|
||||
Column::make('approved_by')->title('Approved By')->className('none'),
|
||||
Column::computed('status')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(60)
|
||||
->addClass('text-center'),
|
||||
Column::computed('action')
|
||||
->exportable(false)
|
||||
->printable(false)
|
||||
->width(250)
|
||||
->addClass('text-center'),
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -4,10 +4,7 @@
|
||||
|
||||
class DocumentType extends BaseModel
|
||||
{
|
||||
protected $fillable = [
|
||||
'kode',
|
||||
'name'
|
||||
];
|
||||
protected $fillable = ['kode', 'name', 'status', 'approved_by', 'approved_at'];
|
||||
|
||||
public function document_detail()
|
||||
{
|
||||
|
@ -5,12 +5,7 @@
|
||||
class Job extends BaseModel
|
||||
{
|
||||
|
||||
protected $fillable = [
|
||||
'directorat_id',
|
||||
'sub_directorat_id',
|
||||
'kode',
|
||||
'name'
|
||||
];
|
||||
protected $fillable = ['directorat_id', 'sub_directorat_id', 'kode', 'name', 'status', 'approved_by', 'approved_at'];
|
||||
|
||||
|
||||
public function directorat()
|
||||
|
@ -7,8 +7,7 @@
|
||||
protected $fillable = [
|
||||
'kode',
|
||||
'name',
|
||||
'description'
|
||||
];
|
||||
'description', 'status','approved_by','approved_at'];
|
||||
|
||||
public function document()
|
||||
{
|
||||
|
@ -7,8 +7,7 @@
|
||||
protected $fillable = [
|
||||
'directorat_id',
|
||||
'kode',
|
||||
'name'
|
||||
];
|
||||
'name', 'status','approved_by','approved_at'];
|
||||
|
||||
public function directorat()
|
||||
{
|
||||
|
@ -9,8 +9,7 @@
|
||||
'sub_directorat_id',
|
||||
'job_id',
|
||||
'kode',
|
||||
'name'
|
||||
];
|
||||
'name', 'status','approved_by','approved_at'];
|
||||
|
||||
|
||||
public function directorat()
|
||||
|
@ -10,8 +10,7 @@
|
||||
'job_id',
|
||||
'sub_job_id',
|
||||
'kode',
|
||||
'name'
|
||||
];
|
||||
'name', 'status','approved_by','approved_at'];
|
||||
|
||||
|
||||
public function directorat()
|
||||
|
@ -68,6 +68,7 @@
|
||||
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
if(isset($this->status) && $this->status == 1) {
|
||||
if (isset($this->approval) && $this->approval == 1) {
|
||||
$this->merge([
|
||||
'approved_at' => now(),
|
||||
@ -76,3 +77,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,10 @@
|
||||
{
|
||||
return [
|
||||
'kode' => 'required|string|max:2|min:2|unique:document_types,kode,' . $this->document_type->id,
|
||||
'name' => 'required|string|max:50'
|
||||
'name' => 'required|string|max:50',
|
||||
'status' => 'nullable|integer',
|
||||
'approved_at' => 'nullable|date',
|
||||
'approved_by' => 'nullable|integer',
|
||||
];
|
||||
}
|
||||
|
||||
@ -62,4 +65,16 @@
|
||||
'messages' => 'Document Type updated failed.'
|
||||
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
if(isset($this->status) && $this->status == 1) {
|
||||
if (isset($this->approval) && $this->approval == 1) {
|
||||
$this->merge([
|
||||
'approved_at' => now(),
|
||||
'approved_by' => auth()->user()->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,10 @@
|
||||
'directorat_id' => 'required|exists:directorats,id',
|
||||
'sub_directorat_id' => 'required|exists:sub_directorats,id',
|
||||
'kode' => 'required|string|max:2|min:2|unique:jobs,kode,' . $this->job->id,
|
||||
'name' => 'required|string|max:50'
|
||||
'name' => 'required|string|max:50',
|
||||
'status' => 'nullable|integer',
|
||||
'approved_at' => 'nullable|date',
|
||||
'approved_by' => 'nullable|integer',
|
||||
];
|
||||
}
|
||||
|
||||
@ -64,4 +67,16 @@
|
||||
'messages' => 'Job updated failed.'
|
||||
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
if(isset($this->status) && $this->status == 1) {
|
||||
if (isset($this->approval) && $this->approval == 1) {
|
||||
$this->merge([
|
||||
'approved_at' => now(),
|
||||
'approved_by' => auth()->user()->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,10 @@
|
||||
return [
|
||||
'kode' => 'required|string|max:2|min:2|unique:special_codes,kode,' . $this->special_code->id,
|
||||
'name' => 'required|string|max:50',
|
||||
'description' => 'nullable|string|max:255'
|
||||
'description' => 'nullable|string|max:255',
|
||||
'status' => 'nullable|integer',
|
||||
'approved_at' => 'nullable|date',
|
||||
'approved_by' => 'nullable|integer'
|
||||
];
|
||||
}
|
||||
|
||||
@ -63,4 +66,16 @@
|
||||
'messages' => 'Special Code updated failed.'
|
||||
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
if(isset($this->status) && $this->status == 1) {
|
||||
if (isset($this->approval) && $this->approval == 1) {
|
||||
$this->merge([
|
||||
'approved_at' => now(),
|
||||
'approved_by' => auth()->user()->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,10 @@
|
||||
return [
|
||||
'directorat_id' => 'required|exists:directorats,id',
|
||||
'kode' => 'required|string|max:2|min:2|unique:sub_directorats,kode,' . $this->sub_directorat->id,
|
||||
'name' => 'required|string|max:50'
|
||||
'name' => 'required|string|max:50',
|
||||
'status' => 'nullable|integer',
|
||||
'approved_at' => 'nullable|date',
|
||||
'approved_by' => 'nullable|integer'
|
||||
];
|
||||
}
|
||||
|
||||
@ -63,4 +66,16 @@
|
||||
'messages' => 'Sub Directorat updated failed.'
|
||||
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
if(isset($this->status) && $this->status == 1) {
|
||||
if (isset($this->approval) && $this->approval == 1) {
|
||||
$this->merge([
|
||||
'approved_at' => now(),
|
||||
'approved_by' => auth()->user()->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,10 @@
|
||||
'sub_directorat_id' => 'required|exists:sub_directorats,id',
|
||||
'job_id' => 'required|exists:jobs,id',
|
||||
'kode' => 'required|string|max:2|min:2|unique:sub_jobs,kode,' . $this->sub_job->id,
|
||||
'name' => 'required|string|max:50'
|
||||
'name' => 'required|string|max:50',
|
||||
'status' => 'nullable|integer',
|
||||
'approved_at' => 'nullable|date',
|
||||
'approved_by' => 'nullable|integer'
|
||||
];
|
||||
}
|
||||
|
||||
@ -65,4 +68,16 @@
|
||||
'messages' => 'Sub Job updated failed.'
|
||||
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
if(isset($this->status) && $this->status == 1) {
|
||||
if (isset($this->approval) && $this->approval == 1) {
|
||||
$this->merge([
|
||||
'approved_at' => now(),
|
||||
'approved_by' => auth()->user()->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,10 @@
|
||||
'job_id' => 'required|exists:jobs,id',
|
||||
'sub_job_id' => 'required|exists:sub_jobs,id',
|
||||
'kode' => 'required|string|max:2|min:2|unique:sub_sub_jobs,kode,' . $this->sub_sub_job->id,
|
||||
'name' => 'required|string|max:50'
|
||||
'name' => 'required|string|max:50',
|
||||
'status' => 'nullable|integer',
|
||||
'approved_at' => 'nullable|date',
|
||||
'approved_by' => 'nullable|integer',
|
||||
];
|
||||
}
|
||||
|
||||
@ -67,4 +70,16 @@
|
||||
'messages' => 'Sub Sub Job updated failed.'
|
||||
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
if(isset($this->status) && $this->status == 1) {
|
||||
if (isset($this->approval) && $this->approval == 1) {
|
||||
$this->merge([
|
||||
'approved_at' => now(),
|
||||
'approved_by' => auth()->user()->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
@endphp
|
||||
@if( Auth::user()->hasRole('operator'))
|
||||
<div class="d-flex flex-row flex-center">
|
||||
<a href="{{ route($route[0].'.edit',['directorat' => $model->id]) }}"
|
||||
<a href="{{ route($route[0].'.edit',[str_replace('-','_',$route[0]) => $model->id]) }}"
|
||||
class="kt_edit_form btn btn-icon btn-bg-light btn-active-light-primary btn-sm me-1">
|
||||
{!! getIcon("pencil", "fs-1 text-info","duotune") !!}
|
||||
</a>
|
||||
@ -16,7 +16,6 @@
|
||||
|
||||
@if(Auth::user()->hasRole('otorisator'))
|
||||
@if($model->status == 0)
|
||||
|
||||
{!! Form::open(['method' => 'PUT','route' => [$route[0].'.update', $model->id],'class'=>'d-inline-block']) !!}
|
||||
<input type="hidden" value="{{$model->kode}}" name="kode">
|
||||
<input type="hidden" value="{{$model->name}}" name="name">
|
||||
|
@ -12,4 +12,6 @@
|
||||
<span class="badge badge-light-primary">Waiting Approval</span>
|
||||
@elseif($model->status == 1)
|
||||
<span class="badge badge-light-success">Approved</span>
|
||||
@elseif($model->status == 3)
|
||||
<span class="badge badge-light-danger">Rejected</span>
|
||||
@endif
|
||||
|
@ -1,8 +1,9 @@
|
||||
@php
|
||||
$route = explode('.', Route::currentRouteName());
|
||||
@endphp
|
||||
@if( Auth::user()->hasRole('operator'))
|
||||
<div class="d-flex flex-row flex-center">
|
||||
<a href="{{ route($route[0].'.edit',['document_type' => $model->id]) }}"
|
||||
<a href="{{ route($route[0].'.edit',[str_replace('-','_',$route[0]) => $model->id]) }}"
|
||||
class="kt_edit_form btn btn-icon btn-bg-light btn-active-light-primary btn-sm me-1">
|
||||
{!! getIcon("pencil", "fs-1 text-info","duotune") !!}
|
||||
</a>
|
||||
@ -11,3 +12,34 @@
|
||||
{{ Form::button(getIcon("trash", "fs-1 text-danger","duotune"), ['type' => 'submit', 'class' => 'delete btn btn-icon btn-bg-light btn-active-light-danger btn-sm'] ) }}
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(Auth::user()->hasRole('otorisator'))
|
||||
@if($model->status == 0)
|
||||
{!! Form::open(['method' => 'PUT','route' => [$route[0].'.update', $model->id],'class'=>'d-inline-block']) !!}
|
||||
<input type="hidden" value="{{$model->kode}}" name="kode">
|
||||
<input type="hidden" value="{{$model->name}}" name="name">
|
||||
<input type="hidden" value="1" name="status">
|
||||
<input type="hidden" value="1" name="approval">
|
||||
<button type="submit" value="1" class="kt_approve_form btn btn-light-success btn-active-success btn-sm " style="--bs-btn-padding-y: .25rem !important; --bs-btn-padding-x: .5rem !important; --bs-btn-font-size: .75rem !important;">
|
||||
<i class="ki-duotone ki-double-check">
|
||||
<i class="path1"></i>
|
||||
<i class="path2"></i>
|
||||
</i> Approve
|
||||
</button>
|
||||
{!! Form::close() !!}
|
||||
|
||||
{!! Form::open(['method' => 'PUT','route' => [$route[0].'.update', $model->id],'class'=>'d-inline-block']) !!}
|
||||
<input type="hidden" value="{{$model->kode}}" name="kode">
|
||||
<input type="hidden" value="{{$model->name}}" name="name">
|
||||
<input type="hidden" value="3" name="status">
|
||||
<input type="hidden" value="1" name="approval">
|
||||
<button type="submit" value="1" class="kt_reject_form btn btn-light-danger btn-active-danger btn-sm" style="--bs-btn-padding-y: .25rem !important; --bs-btn-padding-x: .5rem !important; --bs-btn-font-size: .75rem !important;">
|
||||
<i class="ki-duotone ki-cross">
|
||||
<i class="path1"></i>
|
||||
<i class="path2"></i>
|
||||
</i> Reject
|
||||
</button>
|
||||
{!! Form::close() !!}
|
||||
@endif
|
||||
@endif
|
||||
|
17
Resources/views/masters/document-type/_status.blade.php
Normal file
17
Resources/views/masters/document-type/_status.blade.php
Normal file
@ -0,0 +1,17 @@
|
||||
{{--
|
||||
<span class="badge badge-light-primary">New</span>
|
||||
<span class="badge badge-light-secondary">New</span>
|
||||
<span class="badge badge-light-success">New</span>
|
||||
<span class="badge badge-light-info">New</span>
|
||||
<span class="badge badge-light-warning">New</span>
|
||||
<span class="badge badge-light-danger">New</span>
|
||||
<span class="badge badge-light-dark">New</span>--}}
|
||||
|
||||
|
||||
@if($model->status == 0)
|
||||
<span class="badge badge-light-primary">Waiting Approval</span>
|
||||
@elseif($model->status == 1)
|
||||
<span class="badge badge-light-success">Approved</span>
|
||||
@elseif($model->status == 3)
|
||||
<span class="badge badge-light-danger">Rejected</span>
|
||||
@endif
|
@ -100,6 +100,60 @@
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
LaravelDataTables["{{$route[0]}}-table"].on('click', '.kt_approve_form', function (event) {
|
||||
var form = $(this).closest("form");
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Approve This Data!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, Approve it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: form.attr('action'),
|
||||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function (data) {
|
||||
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
|
||||
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
LaravelDataTables["{{$route[0]}}-table"].on('click', '.kt_reject_form', function (event) {
|
||||
var form = $(this).closest("form");
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Reject This Data!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, Reject it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: form.attr('action'),
|
||||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function (data) {
|
||||
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
|
||||
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -1,8 +1,9 @@
|
||||
@php
|
||||
$route = explode('.', Route::currentRouteName());
|
||||
@endphp
|
||||
@if( Auth::user()->hasRole('operator'))
|
||||
<div class="d-flex flex-row flex-center">
|
||||
<a href="{{ route($route[0].'.edit',['job' => $model->id]) }}"
|
||||
<a href="{{ route($route[0].'.edit',[str_replace('-','_',$route[0]) => $model->id]) }}"
|
||||
class="kt_edit_form btn btn-icon btn-bg-light btn-active-light-primary btn-sm me-1">
|
||||
{!! getIcon("pencil", "fs-1 text-info","duotune") !!}
|
||||
</a>
|
||||
@ -11,3 +12,38 @@
|
||||
{{ Form::button(getIcon("trash", "fs-1 text-danger","duotune"), ['type' => 'submit', 'class' => 'delete btn btn-icon btn-bg-light btn-active-light-danger btn-sm'] ) }}
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(Auth::user()->hasRole('otorisator'))
|
||||
@if($model->status == 0)
|
||||
{!! Form::open(['method' => 'PUT','route' => [$route[0].'.update', $model->id],'class'=>'d-inline-block']) !!}
|
||||
<input type="hidden" value="{{$model->directorat_id}}" name="directorat_id">
|
||||
<input type="hidden" value="{{$model->sub_directorat_id}}" name="sub_directorat_id">
|
||||
<input type="hidden" value="{{$model->kode}}" name="kode">
|
||||
<input type="hidden" value="{{$model->name}}" name="name">
|
||||
<input type="hidden" value="1" name="status">
|
||||
<input type="hidden" value="1" name="approval">
|
||||
<button type="submit" value="1" class="kt_approve_form btn btn-light-success btn-active-success btn-sm " style="--bs-btn-padding-y: .25rem !important; --bs-btn-padding-x: .5rem !important; --bs-btn-font-size: .75rem !important;">
|
||||
<i class="ki-duotone ki-double-check">
|
||||
<i class="path1"></i>
|
||||
<i class="path2"></i>
|
||||
</i> Approve
|
||||
</button>
|
||||
{!! Form::close() !!}
|
||||
|
||||
{!! Form::open(['method' => 'PUT','route' => [$route[0].'.update', $model->id],'class'=>'d-inline-block']) !!}
|
||||
<input type="hidden" value="{{$model->directorat_id}}" name="directorat_id">
|
||||
<input type="hidden" value="{{$model->sub_directorat_id}}" name="sub_directorat_id">
|
||||
<input type="hidden" value="{{$model->kode}}" name="kode">
|
||||
<input type="hidden" value="{{$model->name}}" name="name">
|
||||
<input type="hidden" value="3" name="status">
|
||||
<input type="hidden" value="1" name="approval">
|
||||
<button type="submit" value="1" class="kt_reject_form btn btn-light-danger btn-active-danger btn-sm" style="--bs-btn-padding-y: .25rem !important; --bs-btn-padding-x: .5rem !important; --bs-btn-font-size: .75rem !important;">
|
||||
<i class="ki-duotone ki-cross">
|
||||
<i class="path1"></i>
|
||||
<i class="path2"></i>
|
||||
</i> Reject
|
||||
</button>
|
||||
{!! Form::close() !!}
|
||||
@endif
|
||||
@endif
|
||||
|
17
Resources/views/masters/job/_status.blade.php
Normal file
17
Resources/views/masters/job/_status.blade.php
Normal file
@ -0,0 +1,17 @@
|
||||
{{--
|
||||
<span class="badge badge-light-primary">New</span>
|
||||
<span class="badge badge-light-secondary">New</span>
|
||||
<span class="badge badge-light-success">New</span>
|
||||
<span class="badge badge-light-info">New</span>
|
||||
<span class="badge badge-light-warning">New</span>
|
||||
<span class="badge badge-light-danger">New</span>
|
||||
<span class="badge badge-light-dark">New</span>--}}
|
||||
|
||||
|
||||
@if($model->status == 0)
|
||||
<span class="badge badge-light-primary">Waiting Approval</span>
|
||||
@elseif($model->status == 1)
|
||||
<span class="badge badge-light-success">Approved</span>
|
||||
@elseif($model->status == 3)
|
||||
<span class="badge badge-light-danger">Rejected</span>
|
||||
@endif
|
@ -104,6 +104,60 @@
|
||||
}
|
||||
})
|
||||
})
|
||||
LaravelDataTables["{{$route[0]}}-table"].on('click', '.kt_approve_form', function (event) {
|
||||
var form = $(this).closest("form");
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Approve This Data!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, Approve it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: form.attr('action'),
|
||||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function (data) {
|
||||
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
|
||||
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
LaravelDataTables["{{$route[0]}}-table"].on('click', '.kt_reject_form', function (event) {
|
||||
var form = $(this).closest("form");
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Reject This Data!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, Reject it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: form.attr('action'),
|
||||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function (data) {
|
||||
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
|
||||
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
|
@ -1,8 +1,9 @@
|
||||
@php
|
||||
$route = explode('.', Route::currentRouteName());
|
||||
@endphp
|
||||
@if( Auth::user()->hasRole('operator'))
|
||||
<div class="d-flex flex-row flex-center">
|
||||
<a href="{{ route($route[0].'.edit',['special_code' => $model->id]) }}"
|
||||
<a href="{{ route($route[0].'.edit',[str_replace('-','_',$route[0]) => $model->id]) }}"
|
||||
class="kt_edit_form btn btn-icon btn-bg-light btn-active-light-primary btn-sm me-1">
|
||||
{!! getIcon("pencil", "fs-1 text-info","duotune") !!}
|
||||
</a>
|
||||
@ -11,3 +12,34 @@
|
||||
{{ Form::button(getIcon("trash", "fs-1 text-danger","duotune"), ['type' => 'submit', 'class' => 'delete btn btn-icon btn-bg-light btn-active-light-danger btn-sm'] ) }}
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(Auth::user()->hasRole('otorisator'))
|
||||
@if($model->status == 0)
|
||||
{!! Form::open(['method' => 'PUT','route' => [$route[0].'.update', $model->id],'class'=>'d-inline-block']) !!}
|
||||
<input type="hidden" value="{{$model->kode}}" name="kode">
|
||||
<input type="hidden" value="{{$model->name}}" name="name">
|
||||
<input type="hidden" value="1" name="status">
|
||||
<input type="hidden" value="1" name="approval">
|
||||
<button type="submit" value="1" class="kt_approve_form btn btn-light-success btn-active-success btn-sm " style="--bs-btn-padding-y: .25rem !important; --bs-btn-padding-x: .5rem !important; --bs-btn-font-size: .75rem !important;">
|
||||
<i class="ki-duotone ki-double-check">
|
||||
<i class="path1"></i>
|
||||
<i class="path2"></i>
|
||||
</i> Approve
|
||||
</button>
|
||||
{!! Form::close() !!}
|
||||
|
||||
{!! Form::open(['method' => 'PUT','route' => [$route[0].'.update', $model->id],'class'=>'d-inline-block']) !!}
|
||||
<input type="hidden" value="{{$model->kode}}" name="kode">
|
||||
<input type="hidden" value="{{$model->name}}" name="name">
|
||||
<input type="hidden" value="3" name="status">
|
||||
<input type="hidden" value="1" name="approval">
|
||||
<button type="submit" value="1" class="kt_reject_form btn btn-light-danger btn-active-danger btn-sm" style="--bs-btn-padding-y: .25rem !important; --bs-btn-padding-x: .5rem !important; --bs-btn-font-size: .75rem !important;">
|
||||
<i class="ki-duotone ki-cross">
|
||||
<i class="path1"></i>
|
||||
<i class="path2"></i>
|
||||
</i> Reject
|
||||
</button>
|
||||
{!! Form::close() !!}
|
||||
@endif
|
||||
@endif
|
||||
|
17
Resources/views/masters/special-code/_status.blade.php
Normal file
17
Resources/views/masters/special-code/_status.blade.php
Normal file
@ -0,0 +1,17 @@
|
||||
{{--
|
||||
<span class="badge badge-light-primary">New</span>
|
||||
<span class="badge badge-light-secondary">New</span>
|
||||
<span class="badge badge-light-success">New</span>
|
||||
<span class="badge badge-light-info">New</span>
|
||||
<span class="badge badge-light-warning">New</span>
|
||||
<span class="badge badge-light-danger">New</span>
|
||||
<span class="badge badge-light-dark">New</span>--}}
|
||||
|
||||
|
||||
@if($model->status == 0)
|
||||
<span class="badge badge-light-primary">Waiting Approval</span>
|
||||
@elseif($model->status == 1)
|
||||
<span class="badge badge-light-success">Approved</span>
|
||||
@elseif($model->status == 3)
|
||||
<span class="badge badge-light-danger">Rejected</span>
|
||||
@endif
|
@ -104,6 +104,60 @@
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
LaravelDataTables["{{$route[0]}}-table"].on('click', '.kt_approve_form', function (event) {
|
||||
var form = $(this).closest("form");
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Approve This Data!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, Approve it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: form.attr('action'),
|
||||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function (data) {
|
||||
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
|
||||
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
LaravelDataTables["{{$route[0]}}-table"].on('click', '.kt_reject_form', function (event) {
|
||||
var form = $(this).closest("form");
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Reject This Data!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, Reject it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: form.attr('action'),
|
||||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function (data) {
|
||||
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
|
||||
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
|
@ -1,8 +1,9 @@
|
||||
@php
|
||||
$route = explode('.', Route::currentRouteName());
|
||||
@endphp
|
||||
@if( Auth::user()->hasRole('operator'))
|
||||
<div class="d-flex flex-row flex-center">
|
||||
<a href="{{ route($route[0].'.edit',['sub_directorat' => $model->id]) }}"
|
||||
<a href="{{ route($route[0].'.edit',[str_replace('-','_',$route[0]) => $model->id]) }}"
|
||||
class="kt_edit_form btn btn-icon btn-bg-light btn-active-light-primary btn-sm me-1">
|
||||
{!! getIcon("pencil", "fs-1 text-info","duotune") !!}
|
||||
</a>
|
||||
@ -11,3 +12,36 @@
|
||||
{{ Form::button(getIcon("trash", "fs-1 text-danger","duotune"), ['type' => 'submit', 'class' => 'delete btn btn-icon btn-bg-light btn-active-light-danger btn-sm'] ) }}
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(Auth::user()->hasRole('otorisator'))
|
||||
@if($model->status == 0)
|
||||
{!! Form::open(['method' => 'PUT','route' => [$route[0].'.update', $model->id],'class'=>'d-inline-block']) !!}
|
||||
<input type="hidden" value="{{$model->directorat_id}}" name="directorat_id">
|
||||
<input type="hidden" value="{{$model->kode}}" name="kode">
|
||||
<input type="hidden" value="{{$model->name}}" name="name">
|
||||
<input type="hidden" value="1" name="status">
|
||||
<input type="hidden" value="1" name="approval">
|
||||
<button type="submit" value="1" class="kt_approve_form btn btn-light-success btn-active-success btn-sm " style="--bs-btn-padding-y: .25rem !important; --bs-btn-padding-x: .5rem !important; --bs-btn-font-size: .75rem !important;">
|
||||
<i class="ki-duotone ki-double-check">
|
||||
<i class="path1"></i>
|
||||
<i class="path2"></i>
|
||||
</i> Approve
|
||||
</button>
|
||||
{!! Form::close() !!}
|
||||
|
||||
{!! Form::open(['method' => 'PUT','route' => [$route[0].'.update', $model->id],'class'=>'d-inline-block']) !!}
|
||||
<input type="hidden" value="{{$model->directorat_id}}" name="directorat_id">
|
||||
<input type="hidden" value="{{$model->kode}}" name="kode">
|
||||
<input type="hidden" value="{{$model->name}}" name="name">
|
||||
<input type="hidden" value="3" name="status">
|
||||
<input type="hidden" value="1" name="approval">
|
||||
<button type="submit" value="1" class="kt_reject_form btn btn-light-danger btn-active-danger btn-sm" style="--bs-btn-padding-y: .25rem !important; --bs-btn-padding-x: .5rem !important; --bs-btn-font-size: .75rem !important;">
|
||||
<i class="ki-duotone ki-cross">
|
||||
<i class="path1"></i>
|
||||
<i class="path2"></i>
|
||||
</i> Reject
|
||||
</button>
|
||||
{!! Form::close() !!}
|
||||
@endif
|
||||
@endif
|
||||
|
17
Resources/views/masters/sub-directorat/_status.blade.php
Normal file
17
Resources/views/masters/sub-directorat/_status.blade.php
Normal file
@ -0,0 +1,17 @@
|
||||
{{--
|
||||
<span class="badge badge-light-primary">New</span>
|
||||
<span class="badge badge-light-secondary">New</span>
|
||||
<span class="badge badge-light-success">New</span>
|
||||
<span class="badge badge-light-info">New</span>
|
||||
<span class="badge badge-light-warning">New</span>
|
||||
<span class="badge badge-light-danger">New</span>
|
||||
<span class="badge badge-light-dark">New</span>--}}
|
||||
|
||||
|
||||
@if($model->status == 0)
|
||||
<span class="badge badge-light-primary">Waiting Approval</span>
|
||||
@elseif($model->status == 1)
|
||||
<span class="badge badge-light-success">Approved</span>
|
||||
@elseif($model->status == 3)
|
||||
<span class="badge badge-light-danger">Rejected</span>
|
||||
@endif
|
@ -104,6 +104,60 @@
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
LaravelDataTables["{{$route[0]}}-table"].on('click', '.kt_approve_form', function (event) {
|
||||
var form = $(this).closest("form");
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Approve This Data!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, Approve it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: form.attr('action'),
|
||||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function (data) {
|
||||
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
|
||||
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
LaravelDataTables["{{$route[0]}}-table"].on('click', '.kt_reject_form', function (event) {
|
||||
var form = $(this).closest("form");
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Reject This Data!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, Reject it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: form.attr('action'),
|
||||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function (data) {
|
||||
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
|
||||
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
|
@ -1,8 +1,9 @@
|
||||
@php
|
||||
$route = explode('.', Route::currentRouteName());
|
||||
@endphp
|
||||
@if( Auth::user()->hasRole('operator'))
|
||||
<div class="d-flex flex-row flex-center">
|
||||
<a href="{{ route($route[0].'.edit',['sub_job' => $model->id]) }}"
|
||||
<a href="{{ route($route[0].'.edit',[str_replace('-','_',$route[0]) => $model->id]) }}"
|
||||
class="kt_edit_form btn btn-icon btn-bg-light btn-active-light-primary btn-sm me-1">
|
||||
{!! getIcon("pencil", "fs-1 text-info","duotune") !!}
|
||||
</a>
|
||||
@ -11,3 +12,40 @@
|
||||
{{ Form::button(getIcon("trash", "fs-1 text-danger","duotune"), ['type' => 'submit', 'class' => 'delete btn btn-icon btn-bg-light btn-active-light-danger btn-sm'] ) }}
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(Auth::user()->hasRole('otorisator'))
|
||||
@if($model->status == 0)
|
||||
{!! Form::open(['method' => 'PUT','route' => [$route[0].'.update', $model->id],'class'=>'d-inline-block']) !!}
|
||||
<input type="hidden" value="{{$model->directorat_id}}" name="directorat_id">
|
||||
<input type="hidden" value="{{$model->sub_directorat_id}}" name="sub_directorat_id">
|
||||
<input type="hidden" value="{{$model->job_id}}" name="job_id">
|
||||
<input type="hidden" value="{{$model->kode}}" name="kode">
|
||||
<input type="hidden" value="{{$model->name}}" name="name">
|
||||
<input type="hidden" value="1" name="status">
|
||||
<input type="hidden" value="1" name="approval">
|
||||
<button type="submit" value="1" class="kt_approve_form btn btn-light-success btn-active-success btn-sm " style="--bs-btn-padding-y: .25rem !important; --bs-btn-padding-x: .5rem !important; --bs-btn-font-size: .75rem !important;">
|
||||
<i class="ki-duotone ki-double-check">
|
||||
<i class="path1"></i>
|
||||
<i class="path2"></i>
|
||||
</i> Approve
|
||||
</button>
|
||||
{!! Form::close() !!}
|
||||
|
||||
{!! Form::open(['method' => 'PUT','route' => [$route[0].'.update', $model->id],'class'=>'d-inline-block']) !!}
|
||||
<input type="hidden" value="{{$model->directorat_id}}" name="directorat_id">
|
||||
<input type="hidden" value="{{$model->sub_directorat_id}}" name="sub_directorat_id">
|
||||
<input type="hidden" value="{{$model->job_id}}" name="job_id">
|
||||
<input type="hidden" value="{{$model->kode}}" name="kode">
|
||||
<input type="hidden" value="{{$model->name}}" name="name">
|
||||
<input type="hidden" value="3" name="status">
|
||||
<input type="hidden" value="1" name="approval">
|
||||
<button type="submit" value="1" class="kt_reject_form btn btn-light-danger btn-active-danger btn-sm" style="--bs-btn-padding-y: .25rem !important; --bs-btn-padding-x: .5rem !important; --bs-btn-font-size: .75rem !important;">
|
||||
<i class="ki-duotone ki-cross">
|
||||
<i class="path1"></i>
|
||||
<i class="path2"></i>
|
||||
</i> Reject
|
||||
</button>
|
||||
{!! Form::close() !!}
|
||||
@endif
|
||||
@endif
|
||||
|
17
Resources/views/masters/sub-job/_status.blade.php
Normal file
17
Resources/views/masters/sub-job/_status.blade.php
Normal file
@ -0,0 +1,17 @@
|
||||
{{--
|
||||
<span class="badge badge-light-primary">New</span>
|
||||
<span class="badge badge-light-secondary">New</span>
|
||||
<span class="badge badge-light-success">New</span>
|
||||
<span class="badge badge-light-info">New</span>
|
||||
<span class="badge badge-light-warning">New</span>
|
||||
<span class="badge badge-light-danger">New</span>
|
||||
<span class="badge badge-light-dark">New</span>--}}
|
||||
|
||||
|
||||
@if($model->status == 0)
|
||||
<span class="badge badge-light-primary">Waiting Approval</span>
|
||||
@elseif($model->status == 1)
|
||||
<span class="badge badge-light-success">Approved</span>
|
||||
@elseif($model->status == 3)
|
||||
<span class="badge badge-light-danger">Rejected</span>
|
||||
@endif
|
@ -105,6 +105,60 @@
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
LaravelDataTables["{{$route[0]}}-table"].on('click', '.kt_approve_form', function (event) {
|
||||
var form = $(this).closest("form");
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Approve This Data!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, Approve it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: form.attr('action'),
|
||||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function (data) {
|
||||
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
|
||||
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
LaravelDataTables["{{$route[0]}}-table"].on('click', '.kt_reject_form', function (event) {
|
||||
var form = $(this).closest("form");
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Reject This Data!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, Reject it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: form.attr('action'),
|
||||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function (data) {
|
||||
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
|
||||
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
|
@ -1,8 +1,9 @@
|
||||
@php
|
||||
$route = explode('.', Route::currentRouteName());
|
||||
@endphp
|
||||
@if( Auth::user()->hasRole('operator'))
|
||||
<div class="d-flex flex-row flex-center">
|
||||
<a href="{{ route($route[0].'.edit',['sub_sub_job' => $model->id]) }}"
|
||||
<a href="{{ route($route[0].'.edit',[str_replace('-','_',$route[0]) => $model->id]) }}"
|
||||
class="kt_edit_form btn btn-icon btn-bg-light btn-active-light-primary btn-sm me-1">
|
||||
{!! getIcon("pencil", "fs-1 text-info","duotune") !!}
|
||||
</a>
|
||||
@ -11,3 +12,42 @@
|
||||
{{ Form::button(getIcon("trash", "fs-1 text-danger","duotune"), ['type' => 'submit', 'class' => 'delete btn btn-icon btn-bg-light btn-active-light-danger btn-sm'] ) }}
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(Auth::user()->hasRole('otorisator'))
|
||||
@if($model->status == 0)
|
||||
{!! Form::open(['method' => 'PUT','route' => [$route[0].'.update', $model->id],'class'=>'d-inline-block']) !!}
|
||||
<input type="hidden" value="{{$model->directorat_id}}" name="directorat_id">
|
||||
<input type="hidden" value="{{$model->sub_directorat_id}}" name="sub_directorat_id">
|
||||
<input type="hidden" value="{{$model->job_id}}" name="job_id">
|
||||
<input type="hidden" value="{{$model->sub_job_id}}" name="sub_job_id">
|
||||
<input type="hidden" value="{{$model->kode}}" name="kode">
|
||||
<input type="hidden" value="{{$model->name}}" name="name">
|
||||
<input type="hidden" value="1" name="status">
|
||||
<input type="hidden" value="1" name="approval">
|
||||
<button type="submit" value="1" class="kt_approve_form btn btn-light-success btn-active-success btn-sm " style="--bs-btn-padding-y: .25rem !important; --bs-btn-padding-x: .5rem !important; --bs-btn-font-size: .75rem !important;">
|
||||
<i class="ki-duotone ki-double-check">
|
||||
<i class="path1"></i>
|
||||
<i class="path2"></i>
|
||||
</i> Approve
|
||||
</button>
|
||||
{!! Form::close() !!}
|
||||
|
||||
{!! Form::open(['method' => 'PUT','route' => [$route[0].'.update', $model->id],'class'=>'d-inline-block']) !!}
|
||||
<input type="hidden" value="{{$model->directorat_id}}" name="directorat_id">
|
||||
<input type="hidden" value="{{$model->sub_directorat_id}}" name="sub_directorat_id">
|
||||
<input type="hidden" value="{{$model->job_id}}" name="job_id">
|
||||
<input type="hidden" value="{{$model->sub_job_id}}" name="sub_job_id">
|
||||
<input type="hidden" value="{{$model->kode}}" name="kode">
|
||||
<input type="hidden" value="{{$model->name}}" name="name">
|
||||
<input type="hidden" value="3" name="status">
|
||||
<input type="hidden" value="1" name="approval">
|
||||
<button type="submit" value="1" class="kt_reject_form btn btn-light-danger btn-active-danger btn-sm" style="--bs-btn-padding-y: .25rem !important; --bs-btn-padding-x: .5rem !important; --bs-btn-font-size: .75rem !important;">
|
||||
<i class="ki-duotone ki-cross">
|
||||
<i class="path1"></i>
|
||||
<i class="path2"></i>
|
||||
</i> Reject
|
||||
</button>
|
||||
{!! Form::close() !!}
|
||||
@endif
|
||||
@endif
|
||||
|
17
Resources/views/masters/sub-sub-job/_status.blade.php
Normal file
17
Resources/views/masters/sub-sub-job/_status.blade.php
Normal file
@ -0,0 +1,17 @@
|
||||
{{--
|
||||
<span class="badge badge-light-primary">New</span>
|
||||
<span class="badge badge-light-secondary">New</span>
|
||||
<span class="badge badge-light-success">New</span>
|
||||
<span class="badge badge-light-info">New</span>
|
||||
<span class="badge badge-light-warning">New</span>
|
||||
<span class="badge badge-light-danger">New</span>
|
||||
<span class="badge badge-light-dark">New</span>--}}
|
||||
|
||||
|
||||
@if($model->status == 0)
|
||||
<span class="badge badge-light-primary">Waiting Approval</span>
|
||||
@elseif($model->status == 1)
|
||||
<span class="badge badge-light-success">Approved</span>
|
||||
@elseif($model->status == 3)
|
||||
<span class="badge badge-light-danger">Rejected</span>
|
||||
@endif
|
@ -106,6 +106,60 @@
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
LaravelDataTables["{{$route[0]}}-table"].on('click', '.kt_approve_form', function (event) {
|
||||
var form = $(this).closest("form");
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Approve This Data!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, Approve it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: form.attr('action'),
|
||||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function (data) {
|
||||
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
|
||||
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
LaravelDataTables["{{$route[0]}}-table"].on('click', '.kt_reject_form', function (event) {
|
||||
var form = $(this).closest("form");
|
||||
event.preventDefault();
|
||||
Swal.fire({
|
||||
title: 'Are you sure?',
|
||||
text: "Reject This Data!",
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: 'Yes, Reject it!'
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: form.attr('action'),
|
||||
data: form.serialize(), // serializes the form's elements.
|
||||
success: function (data) {
|
||||
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
|
||||
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@endpush
|
||||
|
Loading…
Reference in New Issue
Block a user