update role and permission

This commit is contained in:
Daeng Deni Mardaeni 2023-07-20 09:42:53 +07:00
parent 83506cc173
commit 7078a5fb04
61 changed files with 842 additions and 195 deletions

View File

@ -3,6 +3,7 @@
namespace Modules\Cetaklabel\DataTables;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Illuminate\Support\Facades\Auth;
use Modules\Cetaklabel\Entities\Cardboard;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
@ -19,21 +20,30 @@
public function dataTable(QueryBuilder $query)
: EloquentDataTable
{
$query = $query->with(['directorat', 'sub_directorat']);
$query = $query->with(['directorat', 'sub_directorat','job']);
if (Auth::user()->hasRole('dd')) {
$query->where('directorat_id', Auth::user()->directorat_id);
} else if (Auth::user()->hasRole('eo')) {
$query->where('sub_directorat_id', Auth::user()->sub_directorat_id);
}
return (new EloquentDataTable($query))
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
$query->where('kode', 'like', "%" . $search['value'] . "%")
->orWhere('name', 'like', "%" . $search['value'] . "%")
->orWhere('sequence', 'like', "%" . $search['value'] . "%")
->orWhereRelation('directorat', 'name', 'like', "%" . $search['value'] . "%")
->orWhereRelation('sub_directorat', 'name', 'like', "%" . $search['value'] . "%");
$query->where(function($query) use ($search){
$query->where('kode', 'like', "%" . $search['value'] . "%")
->orWhere('name', 'like', "%" . $search['value'] . "%")
->orWhere('sequence', 'like', "%" . $search['value'] . "%")
->orWhereRelation('directorat', 'name', 'like', "%" . $search['value'] . "%")
->orWhereRelation('sub_directorat', 'name', 'like', "%" . $search['value'] . "%");
});
}
})
->addIndexColumn()
->addColumn('status', 'cetaklabel::app.cardboard._status')
->addColumn('action', 'cetaklabel::app.cardboard._action')
->rawColumns(['status', 'action'])
->setRowId('id');
}
@ -78,13 +88,13 @@
Column::make('kode'),
Column::make('directorat.name')->title('Direktorat'),
Column::make('sub_directorat.name')->title('Sub Direktorat'),
Column::make('job.name')->title('Job'),
Column::make('name'),
Column::make('sequence'),
Column::make('status'),
Column::computed('action')
->exportable(false)
->printable(false)
->width(60)
->addClass('text-center'),
];
}

View File

@ -46,6 +46,9 @@
->addColumn('sub_sub_job', function ($model) {
return $model->document->sub_sub_job->kode . ' - ' . $model->document->sub_sub_job->name;
})
->addColumn('sequence', function ($model) {
return $model->document->sequence_odner;
})
->addColumn('action', 'cetaklabel::app.cardboard-detail._action')
->setRowId('id');
}
@ -95,6 +98,7 @@
Column::make('job')->title('Jenis Pekerjaan'),
Column::make('sub_job')->title('Sub Jenis Pekerjaan'),
Column::make('sub_sub_job')->title('Sub Sub Jenis Pekerjaan'),
Column::make('sequence')->title('Sequence'),
Column::computed('action')
->exportable(false)
->printable(false)

View File

@ -22,9 +22,8 @@
: EloquentDataTable
{
$query = $query->with(['directorat', 'sub_directorat', 'job', 'job.sub_job', 'job.sub_job.sub_sub_job']);
$odners = CardboardDetail::where('cardboard_id',request()->get('id'))->pluck('document_id')->toArray();
// $query = $query->whereNotIn('id', $odners);
$odners = CardboardDetail::where('cardboard_id','!=',request()->get('id'))->pluck('document_id')->toArray();
$query = $query->whereNotIn('id', $odners);
return (new EloquentDataTable($query))
->filter(function ($query) {

View File

@ -27,7 +27,7 @@
if (request()->has('search')) {
$search = request()->get('search');
if(Auth::user()->hasRole('otorisator')) {
if(Auth::user()->hasRole('dd')) {
$query->whereIn('status', [0, 4, 6, 9]);
}
$query->where('kode', 'like', "%" . $search['value'] . "%")

View File

@ -22,17 +22,17 @@
: EloquentDataTable
{
$query = $query->with(['document']);
if (Auth::user()->hasRole('dd')) {
$query->WhereRelation('document', 'directorat_id', Auth::user()->directorat_id);
} else if (Auth::user()->hasRole('eo')) {
$query->WhereRelation('document', 'sub_directorat_id', Auth::user()->sub_directorat_id);
}
return (new EloquentDataTable($query))
->filter(function ($query) {
if (request()->has('search')) {
$search = request()->get('search');
if (Auth::user()->hasRole('otorisator')) {
$query->orWhereRelation('document', 'directorat_id', Auth::user()->directorat_id);
$query->whereIn('status', [0, 4, 6, 9]);
} else if (Auth::user()->hasRole('operator')) {
$query->orWhereRelation('document', 'sub_directorat_id', Auth::user()->sub_directorat_id);
}
$query->where(function ($query) use ($search) {
$query->where('kode', 'like', "%" . $search['value'] . "%");

View File

@ -27,10 +27,10 @@
if (request()->has('search')) {
$search = request()->get('search');
if (Auth::user()->hasRole('otorisator')) {
if (Auth::user()->hasRole('dd')) {
$query->orWhereRelation('document', 'directorat_id', Auth::user()->directorat_id);
$query->whereIn('status', [0, 4, 6, 9]);
} else if (Auth::user()->hasRole('operator')) {
} else if (Auth::user()->hasRole('eo')) {
$query->orWhereRelation('document', 'sub_directorat_id', Auth::user()->sub_directorat_id);
}

View File

@ -10,6 +10,7 @@
protected $fillable = [
'directorat_id',
'sub_directorat_id',
'job_id',
'kode',
'name',
'sequence',
@ -26,6 +27,11 @@
return $this->belongsTo(SubDirectorat::class);
}
public function job()
{
return $this->belongsTo(Job::class);
}
public function cardboard_detail()
{
return $this->hasMany(CardboardDetail::class);

View File

@ -3,12 +3,16 @@
namespace Modules\Cetaklabel\Http\Controllers;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Modules\Approval\Entities\Approval;
use Modules\Cetaklabel\DataTables\CardboardDataTable;
use Modules\Cetaklabel\Entities\Cardboard;
use Modules\Cetaklabel\Entities\Directorat;
use Modules\Cetaklabel\Entities\Document;
use Modules\Cetaklabel\Entities\DocumentDetail;
use Modules\Cetaklabel\Http\Requests\Cardboard\StoreCardboardRequest;
use Modules\Cetaklabel\Http\Requests\Cardboard\UpdateCardboardRequest;
@ -23,8 +27,6 @@
return $next($request);
});
addVendor('chained-select');
}
/**
@ -39,7 +41,7 @@
if (is_null($this->user) || !$this->user->can('document.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any document data !');
}
addVendor('chained-select');
$directorats = Directorat::all();
return $dataTable->render('cetaklabel::app.cardboard.index', compact('directorats'));
@ -64,7 +66,17 @@
// Store the Cardboard...
if ($validated) {
try {
Cardboard::create($validated);
$approval = [
'method' => 'create',
'model' => 'Cardboard',
'new_request' => json_encode($validated),
'description' => 'Create new Cardboard',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Cardboard created successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Cardboard created failed.']);
@ -136,7 +148,16 @@
// Update the Cardboard...
if ($validated) {
try {
$cardboard->update($validated);
$approval = [
'method' => 'update',
'model' => 'Cardboard',
'new_request' => json_encode($validated),
'old_request' => json_encode($cardboard),
'description' => 'Update Cardboard',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Cardboard updated successfully.']);
} catch (Exception $e) {
@ -162,7 +183,44 @@
abort(403, 'Sorry !! You are Unauthorized to delete any document data !');
}
$cardboard->delete();
$approval = [
'method' => 'delete',
'model' => 'Cardboard',
'old_request' => json_encode($cardboard),
'description' => 'Delete Cardboard',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Cardboard deleted successfully.']);
}
public function label(Request $request)
{
if (is_null($this->user) || !$this->user->can('document.read')) {
abort(403, 'Sorry !! You are Unauthorized to download any master data !');
}
$cardboard = Cardboard::with(['cardboard_detail'])->find($request->id);
$document_id = $cardboard->cardboard_detail->pluck('document_id')->toArray();
$start = DocumentDetail::whereIn('document_id', $document_id)->orderBy('tanggal_dokumen', 'asc')->first()->tanggal_dokumen;
$last = DocumentDetail::whereIn('document_id', $document_id)->orderBy('tanggal_dokumen', 'desc')->first()->tanggal_dokumen;
$start = Carbon::create($start);
$start = $start->isoFormat('DD MMMM Y');
$last = Carbon::create($last);
$last = $last->isoFormat('DD MMMM Y');
activity()
->performedOn($cardboard)
->causedBy(Auth::user())
->withProperties($document_id)
->log('Cetak Label Dus');
return view('cetaklabel::app.cardboard.label', compact('cardboard', 'start', 'last'));
}
}

View File

@ -6,6 +6,7 @@
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Modules\Approval\Entities\Approval;
use Modules\Cetaklabel\DataTables\CardboardDetailDataTable;
use Modules\Cetaklabel\DataTables\CardboardOdnerDataTable;
use Modules\Cetaklabel\Entities\CardboardDetail;
@ -37,10 +38,10 @@
$cardboard_id = $request->id;
$current_odner = CardboardDetail::where('cardboard_id', $cardboard_id)->count();
$odners = CardboardDetail::where('cardboard_id', $cardboard_id)->pluck('document_id')->toArray();
$odners = json_encode($odners);
$odners = CardboardDetail::where('cardboard_id', $cardboard_id)->pluck('document_id')->toArray();
$odners = json_encode($odners);
return $dataTable->render('cetaklabel::app.cardboard-detail.odner', compact('cardboard_id', 'current_odner','odners'));
return $dataTable->render('cetaklabel::app.cardboard-detail.odner', compact('cardboard_id', 'current_odner', 'odners'));
}
/**
@ -55,21 +56,32 @@
}
$documents = explode(',', $request->document_id);
$_old = CardboardDetail::where('cardboard_id', $request->cardboard_id)->pluck('document_id')->toArray();
print_r($documents);
$data = [
'cardboard_id' => $request->cardboard_id,
'document_id' => $documents
];
foreach ($documents as $document) {
$data = [
'cardboard_id' => $request->cardboard_id,
'document_id' => $document
$old = [
'cardboard_id' => $request->cardboard_id,
'document_id' => $_old
];
try {
$approval = [
'method' => 'create',
'model' => 'CardboardDetail',
'new_request' => json_encode($data),
'old_request' => json_encode($old),
'description' => 'Add or Update Odner Dus',
'status' => '0',
];
try {
CardboardDetail::updateOrCreate($data);
echo json_encode(['status' => 'success', 'message' => 'Cardboard created successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Cardboard created failed.']);
}
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Odner added successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Odner added failed.']);
}
}
@ -158,8 +170,19 @@
if (is_null($this->user) || !$this->user->can('document.delete')) {
abort(403, 'Sorry !! You are Unauthorized to delete any document data !');
}
//$cardboard_detail->delete();
$approval = [
'method' => 'delete',
'model' => 'CardboardDetail',
'new_request' => null,
'old_request' => json_encode($cardboard_detail),
'description' => 'Delete Odner Dus',
'status' => '0',
];
Approval::create($approval);
$cardboard_detail->delete();
echo json_encode(['status' => 'success', 'message' => 'Cardboard deleted successfully.']);
}
}

View File

@ -59,7 +59,6 @@
// Store the Directorat...
if ($validated) {
try {
//Directorat::create($validated);
$approval = [
'method' => 'create',
'model' => 'Directorat',
@ -139,7 +138,6 @@
// Update the Directorat...
if ($validated) {
try {
//$directorat->update($validated);
$approval = [
'method' => 'update',
@ -186,7 +184,6 @@
Approval::create($approval);
//$directorat->delete();
echo json_encode(['status' => 'success', 'message' => 'Directorat deleted successfully.']);
}
}

View File

@ -150,7 +150,7 @@
*/
public function update(Request $request)
{
if (is_null($this->user) || !$this->user->hasRole('otorisator')) {
if (is_null($this->user) || !$this->user->hasRole('dd')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}
@ -204,7 +204,7 @@
*/
public function edit($id)
{
if (is_null($this->user) || !$this->user->hasRole('otorisator')) {
if (is_null($this->user) || !$this->user->hasRole('dd')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}
@ -299,37 +299,6 @@
}
}
public function label(Request $request)
{
if (is_null($this->user) || !$this->user->can('document.read')) {
abort(403, 'Sorry !! You are Unauthorized to download any master data !');
}
$document_detail = DocumentDetail::with(['document'])->find($request->id);
$document = Document::with(['document_details'])->where(['kode_dus' => $document_detail->document->kode_dus,
'sequence_dus' => $document_detail->document->sequence_dus
])->first();
$start = DocumentDetail::where('document_id', $document_detail->document_id)->orderBy('tanggal_dokumen', 'asc')->first()->tanggal_dokumen;
$last = DocumentDetail::where('document_id', $document_detail->document_id)->orderBy('tanggal_dokumen', 'desc')->first()->tanggal_dokumen;
$start = Carbon::create($start);
$start = $start->isoFormat('DD MMMM Y');
$last = Carbon::create($last);
$last = $last->isoFormat('DD MMMM Y');
activity()
->performedOn($document)
->causedBy(Auth::user())
->withProperties($document)
->log('Cetak Label Dus');
return view('cetaklabel::app.document.label', compact('document_detail', 'start', 'last', 'document'));
}
public function odner(Request $request)
{
if (is_null($this->user) || !$this->user->can('document.read')) {

View File

@ -5,6 +5,7 @@
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Support\Facades\Auth;
use Modules\Approval\Entities\Approval;
use Modules\Cetaklabel\DataTables\DocumentTypeDataTable;
use Modules\Cetaklabel\Entities\DocumentType;
use Modules\Cetaklabel\Http\Requests\DocumentType\StoreDocumentTypeRequest;
@ -44,14 +45,22 @@
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}
// Validate the request...
$validated = $request->validated();
// Store the Document Type...
if ($validated) {
try {
DocumentType::create($validated);
$approval = [
'method' => 'create',
'model' => 'DocumentType',
'new_request' => json_encode($validated),
'description' => 'Create new Document Type',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Document Type created successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Document Type created failed.']);
@ -68,9 +77,9 @@
*/
public function create()
{
/*if (is_null($this->user) || !$this->user->can('master.create')) {
if (is_null($this->user) || !$this->user->can('master.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
}
abort(404);
}
@ -115,7 +124,16 @@
// Update the Directorat...
if ($validated) {
try {
$document_type->update($validated);
$approval = [
'method' => 'update',
'model' => 'DocumentType',
'new_request' => json_encode($validated),
'old_request' => json_encode($document_type),
'description' => 'Update Document Type',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Document Type updated successfully.']);
} catch (Exception $e) {
@ -137,7 +155,16 @@
abort(403, 'Sorry !! You are Unauthorized to delete any master data !');
}
$document_type->delete();
$approval = [
'method' => 'delete',
'model' => 'DocumentType',
'old_request' => json_encode($document_type),
'description' => 'Delete Document Type',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Document Type deleted successfully.']);
}
}

View File

@ -6,6 +6,7 @@
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Modules\Approval\Entities\Approval;
use Modules\Cetaklabel\DataTables\JobDataTable;
use Modules\Cetaklabel\Entities\Directorat;
use Modules\Cetaklabel\Entities\Job;
@ -34,18 +35,18 @@
*/
public function index(JobDataTable $dataTable, Request $request)
{
if (is_null($this->user) || !$this->user->can('master.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
// Add Vendor
addVendor('chained-select');
if (isset($request->sub_directorat_id) && !empty($request->sub_directorat_id)) {
$this->show($request);
return;
}
if (is_null($this->user) || !$this->user->can('master.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
// Add Vendor
addVendor('chained-select');
$directorat = Directorat::all();
return $dataTable->render('cetaklabel::masters.job.index', compact('directorat'));
}
@ -59,10 +60,6 @@
*/
public function show(Request $request)
{
if (is_null($this->user) || !$this->user->can('master.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
$jobs = Job::where('sub_directorat_id', $request->sub_directorat_id)->get();
$data = [];
@ -96,7 +93,16 @@
// Store the Job...
if ($validated) {
try {
Job::create($validated);
$approval = [
'method' => 'create',
'model' => 'Job',
'new_request' => json_encode($validated),
'description' => 'Create new Job',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Job created successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Job created failed.']);
@ -156,7 +162,18 @@
// Update the Job...
if ($validated) {
try {
$job->update($validated);
$approval = [
'method' => 'update',
'model' => 'Job',
'new_request' => json_encode($validated),
'old_request' => json_encode($job),
'description' => 'Update Job',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Job updated successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Job updated failed.']);
@ -180,7 +197,16 @@
abort(403, 'Sorry !! You are Unauthorized to delete any master data !');
}
$job->delete();
$approval = [
'method' => 'delete',
'model' => 'Job',
'old_request' => json_encode($job),
'description' => 'Delete Job',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Job deleted successfully.']);
}
}

View File

@ -5,6 +5,7 @@
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Support\Facades\Auth;
use Modules\Approval\Entities\Approval;
use Modules\Cetaklabel\DataTables\SpecialCodeDataTable;
use Modules\Cetaklabel\Entities\SpecialCode;
use Modules\Cetaklabel\Http\Requests\SpecialCode\StoreSpecialCodeRequest;
@ -50,7 +51,17 @@
// Store the Special Code...
if ($validated) {
try {
SpecialCode::create($validated);
$approval = [
'method' => 'create',
'model' => 'SpecialCode',
'new_request' => json_encode($validated),
'description' => 'Create new Special Code',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Special Code created successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Special Code created failed.']);
@ -114,7 +125,16 @@
// Update the Directorat...
if ($validated) {
try {
$special_code->update($validated);
$approval = [
'method' => 'update',
'model' => 'SpecialCode',
'new_request' => json_encode($validated),
'old_request' => json_encode($special_code),
'description' => 'Update Special Code',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Special Code updated successfully.']);
} catch (Exception $e) {
@ -136,7 +156,16 @@
abort(403, 'Sorry !! You are Unauthorized to delete any master data !');
}
$special_code->delete();
$approval = [
'method' => 'delete',
'model' => 'SpecialCode',
'old_request' => json_encode($special_code),
'description' => 'Delete Special Code',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Special Code deleted successfully.']);
}
}

View File

@ -6,6 +6,7 @@
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Modules\Approval\Entities\Approval;
use Modules\Cetaklabel\DataTables\SubDirectoratDataTable;
use Modules\Cetaklabel\Entities\Directorat;
use Modules\Cetaklabel\Entities\SubDirectorat;
@ -34,15 +35,15 @@
*/
public function index(SubDirectoratDataTable $dataTable, Request $request)
{
if (is_null($this->user) || !$this->user->can('master.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
if (isset($request->directorat_id) && !empty($request->directorat_id)) {
$this->show($request);
return;
}
if (is_null($this->user) || !$this->user->can('master.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
$directorat = Directorat::all();
return $dataTable->render('cetaklabel::masters.sub-directorat.index', compact('directorat'));
}
@ -89,7 +90,16 @@
// Store the SubDirectorat...
if ($validated) {
try {
SubDirectorat::create($validated);
$approval = [
'method' => 'create',
'model' => 'SubDirectorat',
'new_request' => json_encode($validated),
'description' => 'Create new Sub Directorat',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Sub Directorat created successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Sub Directorat created failed.']);
@ -149,7 +159,18 @@
// Update the SubDirectorat...
if ($validated) {
try {
$subDirectorat->update($validated);
$approval = [
'method' => 'update',
'model' => 'SubDirectorat',
'new_request' => json_encode($validated),
'old_request' => json_encode($subDirectorat),
'description' => 'Update Sub Directorat',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Sub Directorat updated successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Sub Directorat updated failed.']);
@ -173,7 +194,16 @@
abort(403, 'Sorry !! You are Unauthorized to delete any master data !');
}
$subDirectorat->delete();
$approval = [
'method' => 'delete',
'model' => 'SubDirectorat',
'old_request' => json_encode($subDirectorat),
'description' => 'Delete Sub Directorat',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Sub Directorat deleted successfully.']);
}
}

View File

@ -6,6 +6,7 @@
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Modules\Approval\Entities\Approval;
use Modules\Cetaklabel\DataTables\SubJobDataTable;
use Modules\Cetaklabel\Entities\Directorat;
use Modules\Cetaklabel\Entities\SubJob;
@ -34,17 +35,17 @@
*/
public function index(SubJobDataTable $dataTable, Request $request)
{
if (isset($request->job_id) && !empty($request->job_id)) {
$this->show($request);
return;
}
if (is_null($this->user) || !$this->user->can('master.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
addVendor('chained-select');
if (isset($request->job_id) && !empty($request->job_id)) {
$this->show($request);
return;
}
$directorat = Directorat::all();
return $dataTable->render('cetaklabel::masters.sub-job.index', compact('directorat'));
}
@ -58,10 +59,6 @@
*/
public function show(Request $request)
{
if (is_null($this->user) || !$this->user->can('master.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
$subJob = SubJob::where('job_id', $request->job_id)->get();
$data = [];
@ -95,7 +92,17 @@
// Store the SubJob...
if ($validated) {
try {
SubJob::create($validated);
$approval = [
'method' => 'create',
'model' => 'SubJob',
'new_request' => json_encode($validated),
'description' => 'Create new Sub Job',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Sub Job created successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Sub Job created failed.']);
@ -157,7 +164,18 @@
// Update the SubJob...
if ($validated) {
try {
$subJob->update($validated);
$approval = [
'method' => 'update',
'model' => 'SubJob',
'new_request' => json_encode($validated),
'old_request' => json_encode($subJob),
'description' => 'Update Sub Job',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Sub Job updated successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Sub Job updated failed.']);
@ -181,7 +199,16 @@
abort(403, 'Sorry !! You are Unauthorized to delete any master data !');
}
$subJob->delete();
$approval = [
'method' => 'delete',
'model' => 'SubJob',
'old_request' => json_encode($subJob),
'description' => 'Delete Sub Job',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Sub Job deleted successfully.']);
}
}

View File

@ -6,6 +6,7 @@
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Modules\Approval\Entities\Approval;
use Modules\Cetaklabel\DataTables\SubSubJobDataTable;
use Modules\Cetaklabel\Entities\Directorat;
use Modules\Cetaklabel\Entities\SubSubJob;
@ -34,15 +35,15 @@
*/
public function index(SubSubJobDataTable $dataTable, Request $request)
{
if (is_null($this->user) || !$this->user->can('master.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
if (isset($request->sub_job_id) && !empty($request->sub_job_id)) {
$this->show($request);
return;
}
if (is_null($this->user) || !$this->user->can('master.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
addVendor('chained-select');
$directorat = Directorat::all();
@ -58,9 +59,6 @@
*/
public function show(Request $request)
{
if (is_null($this->user) || !$this->user->can('master.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
$subSubJob = SubSubJob::where('sub_job_id', $request->sub_job_id)->get();
@ -96,7 +94,16 @@
// Store the SubSubJob...
if ($validated) {
try {
SubSubJob::create($validated);
$approval = [
'method' => 'create',
'model' => 'SubSubJob',
'new_request' => json_encode($validated),
'description' => 'Create new Sub Sub Job',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Sub Sub Job created successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Sub Sub Job created failed.']);
@ -146,8 +153,17 @@
// Update the SubSubJob...
if ($validated) {
try {
$subSubJob->update($validated);
//return redirect()->route('job.index')->with('success', 'SubSubJob updated successfully.');
$approval = [
'method' => 'update',
'model' => 'SubSubJob',
'new_request' => json_encode($validated),
'old_request' => json_encode($subSubJob),
'description' => 'Update Sub Sub Job',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Sub Sub Job updated successfully.']);
} catch (Exception $e) {
//return redirect()->route('job.index')->with('error', 'SubSubJob updated failed.');
@ -163,7 +179,20 @@
*/
public function destroy(SubSubJob $subSubJob)
{
$subSubJob->delete();
if (is_null($this->user) || !$this->user->can('master.delete')) {
abort(403, 'Sorry !! You are Unauthorized to delete any master data !');
}
$approval = [
'method' => 'delete',
'model' => 'SubSubJob',
'old_request' => json_encode($subSubJob),
'description' => 'Delete Sub Sub Job',
'status' => '0',
];
Approval::create($approval);
echo json_encode(['status' => 'success', 'message' => 'Sub Sub Job deleted successfully.']);
}
}

View File

@ -1,14 +1,10 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
@if(!Auth::user()->hasRole(['ad','dd']))
<div class="d-flex flex-row flex-center">
<a href="{{ route($route[0].'.edit',['cardboard_detail' => $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>
{!! Form::open(['method' => 'DELETE','route' => [$route[0].'.destroy', $model->id],'class'=>'']) !!}
{{ 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

View File

@ -1,4 +1,4 @@
<!--begin::Table-->
<!--begin::Table-->
{{ $dataTable->table() }}
<!--end::Table-->
@ -17,6 +17,8 @@
LaravelDataTables["cardboard-odner-table"].search(this.value).draw();
});
var selected = [];
function arrayCompare(a1, a2) {
if (a1.length != a2.length) return false;
var length = a2.length;
@ -99,7 +101,13 @@
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});
toastr.success(data.message, 'Success!', {timeOut: 5000});
Swal.fire({
title: 'Success!',
text: "Data berhasil di hapus, menunggu Approval",
icon: 'success',
confirmButtonText: 'Ok'
});
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
}
});
@ -108,17 +116,18 @@
})
})
var selected = [];
var current_odner = parseInt($("#current_odner").val());
LaravelDataTables["cardboard-odner-table"].on('click', '.form-check-input', function (event) {
if($(this).is(':checked')){
selected.push($(this).val());
current_odner = current_odner + 1;
}else{
selected.splice(selected.indexOf($(this).val()), 1);
current_odner = current_odner - 1;
}
if(selected.length > 0) {
if(current_odner + selected.length > 5) {
if(current_odner > 5) {
$("#save-odner").hide();
Swal.fire({
text: "Odner More Than 5, Please Select 5 Odner or Less",
@ -145,6 +154,12 @@
$(window).on('load', function(){
// Assuming the checkboxes have unique IDs and their values match the array elements
var selectedValues = JSON.parse($('#odners').val());
Object.keys(selectedValues).forEach(key => {
const value = selectedValues[key];
selected.push(`${value}`);
});
$("#document_id").val(selected);
// Get the checkboxes by class name
var checkboxes = document.getElementsByClassName('odner-check');
// Loop through the checkboxes

View File

@ -78,6 +78,12 @@
data: form.serialize(), // serializes the form's elements.
success: function (data) {
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
Swal.fire({
title: 'Success!',
text: "Data berhasil di hapus, menunggu Approval",
icon: 'success',
confirmButtonText: 'Ok'
});
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
}
});

View File

@ -29,12 +29,12 @@
<div class="card-toolbar">
<form action="{{ route('cardboard-detail.store') }}" method="POST">
<form action="{{ route('cardboard-detail.store') }}" method="POST" class="form_cardboard_odner">
@csrf
<!--begin::Export dropdown-->
<input type="hidden" name="cardboard_id" value="{{ $cardboard_id }}">
<input type="hidden" name="cardboard_id" id="cardboard_id" value="{{ $cardboard_id }}">
<input type="hidden" name="current_odner" id="current_odner" value="{{ $current_odner }}">
<input type="hidden" name="document_id" id="document_id">
<input type="hidden" name="document_id" id="document_id" value="{{ $odners }}">
<input type="hidden" id="odners" name="odners" value="{{ $odners }}">
<button type="submit" class="btn btn-light-success" id="save-odner" data-kt-menu-trigger="click"
data-kt-menu-placement="bottom-end" style="display: none">
@ -107,4 +107,55 @@
<!--end::Card body-->
</div>
<!--end::Card-->
@push('customscript')
<script>
$(function () {
$(".form_cardboard_odner").submit(function (e) {
e.preventDefault(); // avoid to execute the actual submit of the form.
var form = $(this);
var actionUrl = form.attr('action');
$.ajax({
type: "POST",
url: actionUrl,
data: form.serialize(), // serializes the form's elements.
success: function (data) {
var _data = JSON.parse(data);
toastr.success(_data.message);
var _message = _data.message;
var message = 'Data Berhasil Di Simpan, Menunggu Approval';
if(_message.includes("updated")){
message = 'Data Berhasil Di Update, Menunggu Approval';
}
Swal.fire({
title: 'Success!',
text: message,
icon: 'success',
confirmButtonText: 'Ok'
}).then(
function (result) {
if (result.isConfirmed) {
window.location.href = "{{ route('cardboard-detail.show',$cardboard_id) }}";
}
}
);
form[0].reset();
LaravelDataTables["cardboard-table"].ajax.reload();
$('#kt_modal_cardboard').modal('hide');
},
error: function (data, textStatus, errorThrown) {
var errors = data.responseJSON.errors;
$.each(errors, function (key, value) {
toastr.error(value);
});
}
});
});
});
</script>
@endpush
</x-default-layout>

View File

@ -2,18 +2,26 @@
$route = explode('.', Route::currentRouteName());
@endphp
<div class="d-flex flex-row flex-center">
@if(!Auth::user()->hasRole('ad'))
<a href="{{ route($route[0].'.label',$model->id) }}" target="_blank"
class="btn btn-bg-light btn-active-light-primary btn-sm me-1">
{!! getIcon("printer", "text-success","duotune") !!} Label Dus
</a>
@endif
<a href="{{ route('cardboard-detail.show',['cardboard_detail' => $model->id]) }}"
class="btn btn-icon btn-bg-light btn-active-light-primary btn-sm me-1">
{!! getIcon("cube-3", "fs-1 text-warning","duotune") !!}
</a>
<a href="{{ route($route[0].'.edit',['cardboard' => $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>
@if(!Auth::user()->hasRole(['ad','dd']))
<a href="{{ route($route[0].'.edit',['cardboard' => $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>
{!! Form::open(['method' => 'DELETE','route' => [$route[0].'.destroy', $model->id],'class'=>'']) !!}
{{ 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() !!}
{!! Form::open(['method' => 'DELETE','route' => [$route[0].'.destroy', $model->id],'class'=>'']) !!}
{{ 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() !!}
@endif
</div>

View File

@ -61,6 +61,21 @@
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="d-flex flex-column mb-8 fv-row">
<!--begin::Label-->
<label class="d-flex align-items-center fs-6 fw-semibold mb-2" for="cardboard_job_id">
<span class="required">Job</span>
<span class="ms-1" data-bs-toggle="tooltip"
title="Specify a target name for future usage and reference"></span>
</label>
<!--end::Label-->
<select class="form-select" name="job_id" id="cardboard_job_id" required="required">
<option>Job</option>
</select>
</div>
<!--end::Input group-->
<!--begin::Input group-->
<div class="d-flex flex-column mb-8 fv-row">
<!--begin::Label-->

View File

@ -0,0 +1,7 @@
@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

View File

@ -98,6 +98,12 @@
data: form.serialize(), // serializes the form's elements.
success: function (data) {
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
Swal.fire({
title: 'Success!',
text: "Data berhasil di hapus, menunggu Approval",
icon: 'success',
confirmButtonText: 'Ok'
});
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
}
});

View File

@ -105,10 +105,22 @@
success: function (data) {
var _data = JSON.parse(data);
toastr.success(_data.message);
var _message = _data.message;
var message = 'Data Berhasil Di Simpan, Menunggu Approval';
if(_message.includes("updated")){
message = 'Data Berhasil Di Update, Menunggu Approval';
}
form[0].reset();
LaravelDataTables["cardboard-table"].ajax.reload();
$('#kt_modal_cardboard').modal('hide');
Swal.fire({
title: 'Success!',
text: message,
icon: 'success',
confirmButtonText: 'Ok'
});
},
error: function (data, textStatus, errorThrown) {
var errors = data.responseJSON.errors;
@ -132,6 +144,11 @@
parents: "#cardboard_directorat_id",
url: "/sub-directorat"
});
$("#cardboard_job_id").remoteChained({
parents: "#cardboard_sub_directorat_id",
url: "/job"
});
});
</script>
@endpush

View File

@ -0,0 +1,145 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Label Dus</title>
<style>
table {
width: 24cm;
text-align: center;
margin: 10px auto;
border: 1px solid black;
font-family: Arial;
}
div.table {
border: 1px solid black;
border-radius: 2em;
width: 20cm;
margin: 0px auto;
}
.segel {
width: 758px;
border-collapse: collapse;
border-radius: 2em;
overflow: hidden;
border: 1px solid black;
padding: 0px;
margin: -1px;
}
.qrcode {
position: absolute;
top: 485px;
right: 810px;
}
@media print {
.pagebreak {
page-break-before: always;
}
/* page-break-after works, as well */
.qrcode {
position: absolute;
top: 485px;
right: 75px;
}
}
</style>
</head>
<body>
<table cellspacing="0" cellpadding="0" style="table-layout: fixed;">
<tbody>
<tr style="height:35mm;table-layout:fixed;">
<td style="width:120mm;background-color: #223d84;">
<img src="{{ url('storage/agi_old.png') }}" alt="" style="max-width:99%;">
</td>
<td style="width:120mm;background-color: #ffc000;">
<span style="font-size:32pt;font-weight:bold">FILE<br>MANAGEMENT</span>
</td>
</tr>
<tr style="height:112mm;table-layout:fixed;">
<td colspan="2">
<span style="font-size:80pt;font-weight:bold">{{ $cardboard->directorat->kode }}.{{ $cardboard->sub_directorat->kode }}</span><br>
<span style="font-size:54pt;font-weight:bold">{{ $cardboard->job->kode }}</span><br><br>
<span style="font-size:24pt;">{{ $cardboard->job->name }}</span><br><br><br><br>
<span style="font-size:24pt;">{{ $cardboard->sequence_dus }}</span><br><br><br><br><br>
<span style="font-size:14pt;font-weight:bold">PERIODE</span>
</td>
</tr>
<tr style="height:20mm;table-layout:fixed;background-color: #000066;">
<td colspan="2" style="font-size:16pt;color:white;line-height:30px;padding:0px;">
<span>Bln/Thn</span><br>
<span>{{ $start }} s.d {{ $last }}</span>
</td>
</tr>
</tbody>
</table>
<span class="qrcode">{!! QrCode::size(75)->generate($cardboard->job->kode) !!}</span>
<div class="pagebreak"></div>
<div class="table">
<table class="segel">
<tbody>
<tr style="height:30mm;">
<td colspan="2" style="width:100%;background-color: #223d84;">
<img src="{{ url('storage/agi_old.png') }}" alt="" style="height: 60px;margin-right:10px">
<img src="{{ url('storage/agi_new.png') }}" alt="" style="height: 60px;">
</td>
</tr>
<tr>
<td colspan="2" style="width:100%;text-align:left;padding:10px 20px">
<span style="font-size: 27pt;font-weight: bold;">DISEGEL OLEH PETUGAS DIREKTORAT</span><br>
<br>
<span style="font-size: 21pt;font-weight: bold;">Tanggal : <span style="width:300px; border-bottom:2px solid black;display:inline-block;">&nbsp;</span></span>
</td>
</tr>
<tr>
<td style="width:65%;text-align:left;padding:10px 0px 30px 20px">
<span style="font-size: 21pt;font-weight: bold;">Nama & Jabatan 1 : <span style="width:200px; border-bottom:2px solid black;display:inline-block;">&nbsp;</span></span>
</td>
<td style="width:35%;text-align:left;padding:10px 20px 30px 0px">
<span style="font-size: 21pt;font-weight: bold;">ttd : <span style="width:180px; border-bottom:2px solid black;display:inline-block;">&nbsp;</span></span>
</td>
</tr>
<tr>
<td style="width:65%;text-align:left;padding:10px 0px 30px 20px">
<span style="font-size: 21pt;font-weight: bold;">Nama & Jabatan 2 : <span style="width:200px; border-bottom:2px solid black;display:inline-block;">&nbsp;</span></span>
</td>
<td style="width:35%;text-align:left;padding:10px 20px 30px 0px">
<span style="font-size: 21pt;font-weight: bold;">ttd : <span style="width:180px; border-bottom:2px solid black;display:inline-block;">&nbsp;</span></span>
</td>
</tr>
<tr>
<td style="width:65%;text-align:left;padding:10px 0px 10px 20px">
<span style="font-size: 21pt;font-weight: bold;">Nama & Jabatan 3 : <span style="width:200px; border-bottom:2px solid black;display:inline-block;">&nbsp;</span></span>
</td>
<td style="width:35%;text-align:left;padding:10px 20px 10px 0px">
<span style="font-size: 21pt;font-weight: bold;">ttd : <span style="width:180px; border-bottom:2px solid black;display:inline-block;">&nbsp;</span></span>
</td>
</tr>
<tr>
<td colspan="2" style="padding:20px 20px 0px">
<span style="width:100%; border-top:5px solid black;display:inline-block;">&nbsp;</span>
</td>
</tr>
<tr>
<td colspan="2" style="width:100%;text-align:center;padding:10px 20px">
<span style="font-size: 29pt;font-weight: bold;text-transform:capitalize;">dilarang membuka / merobek segel</span><br>
<br>
<span style="font-size: 29pt;font-weight: bold;">TANPA IZIN PETUGAS DIREKTORAT</span><br>
</td>
</tr>
</tbody>
</table>
</div>
<script>
window.print();
</script>
</body>
</html>

View File

@ -2,27 +2,24 @@
$route = explode('.', Route::currentRouteName());
@endphp
<div class="d-flex flex-row flex-center">
@if(!Auth::user()->hasRole('ad'))
<a href="{{ route($route[0].'.odner',$model->id) }}" target="_blank"
class="btn btn-bg-light btn-active-light-primary btn-sm me-1">
{!! getIcon("printer", "text-primary","duotune") !!} Odner
</a>
@endif
@if(in_array($model->status,[1,4,5,6,7,9]) && Auth::user()->can($route[0].'.read'))
<a href="{{ route($route[0].'.label',$model->id) }}" target="_blank"
class="btn btn-bg-light btn-active-light-primary btn-sm me-1">
{!! getIcon("printer", "text-success","duotune") !!} Label Dus
</a>
<a href="{{ route($route[0].'.odner',$model->id) }}" target="_blank"
class="btn btn-bg-light btn-active-light-primary btn-sm me-1">
{!! getIcon("printer", "text-primary","duotune") !!} Odner
</a>
@if($model->status == 4 && Auth::user()->hasRole('otorisator') && $model->approval_flag==1)
@if($model->status == 4 && Auth::user()->hasRole('dd') && $model->approval_flag==1)
<a href="{{ route($route[0].'.download',$model->id) }}"
class="approve-download btn btn-bg-light btn-active-light-primary btn-sm me-1">
{!! getIcon("cloud-download", "text-info","duotune") !!} Approve Download
</a>
@elseif($model->status == 1 && Auth::user()->hasRole('operator') && $model->approval_flag==1)
@elseif($model->status == 1 && Auth::user()->hasRole('eo') && $model->approval_flag==1)
<a href="{{ route($route[0].'.download',$model->id) }}"
class="btn-download btn btn-bg-light btn-active-light-primary btn-sm me-1">
{!! getIcon("cloud-download", "text-info","duotune") !!} Request Download
</a>
@elseif($model->status == 5 || $model->approval_flag==1)
@elseif($model->status == 5 || $model->approval_flag!==1)
<a href="{{ route($route[0].'.download',$model->id) }}" target="_blank"
class="btn btn-bg-light btn-active-light-primary btn-sm me-1">
{!! getIcon("cloud-download", "text-success","duotune") !!} Download
@ -30,7 +27,7 @@
@endif
@if(Auth::user()->can($route[0].'.read'))
@if( Auth::user()->hasRole('operator'))
@if( Auth::user()->hasRole('eo'))
@if($model->aktif == 1)
<a href="{{ route($route[0].'.aktif',$model->id) }}"
class="btn-aktif btn btn-bg-light btn-active-light-primary btn-sm me-1">
@ -43,7 +40,7 @@
</span>
@endif
@elseif(Auth::user()->hasRole('otorisator') && $model->status == 9)
@elseif(Auth::user()->hasRole('dd') && $model->status == 9)
<a href="{{ route($route[0].'.aktif',$model->id) }}"
class="btn-approve-aktif btn btn-bg-light btn-active-light-primary btn-sm me-1">
{!! getIcon("check-square", "text-success","duotune") !!} Approve Non Aktif
@ -51,11 +48,11 @@
@endif
@endif
@if(Auth::user()->can($route[0].'.delete') || Auth::user()->can($route[0].'.authorize'))
@if(Auth::user()->can($route[0].'.delete'))
{!! Form::open(['method' => 'DELETE','route' => [$route[0].'.destroy', $model->id],'class'=>'']) !!}
@if( Auth::user()->hasRole('operator'))
{{ Form::button(getIcon("trash", "text-danger","duotune")." Reqeust Delete", ['type' => 'submit', 'class' => 'delete btn btn-bg-light btn-active-light-danger btn-sm'] ) }}
@elseif(Auth::user()->hasRole('otorisator') && $model->status == 6)
@if( Auth::user()->hasRole('eo'))
{{ Form::button(getIcon("trash", "text-danger","duotune")."Delete", ['type' => 'submit', 'class' => 'delete btn btn-bg-light btn-active-light-danger btn-sm'] ) }}
@elseif(Auth::user()->hasRole('dd') && $model->status == 6)
{{ Form::button(getIcon("trash", "text-danger","duotune")."Approve Delete", ['type' => 'submit', 'class' => 'approvedelete btn btn-bg-light btn-active-light-danger btn-sm'] ) }}
@elseif(Auth::user()->hasRole('administrator') && $model->status == 7)
{{ Form::button(getIcon("trash", "text-danger","duotune")."Approve Delete", ['type' => 'submit', 'class' => 'approveddelete btn btn-bg-light btn-active-light-danger btn-sm'] ) }}
@ -71,7 +68,7 @@
@endif
@elseif($model->status == 0)
@if(Auth::user()->hasRole('otorisator'))
@if(Auth::user()->hasRole('dd'))
<a href="{{ route($route[0].'.edit',['document' => $model->id]) }}"
class="kt_edit_form btn btn-bg-light btn-active-light-warning btn-sm me-1">
{!! getIcon("eye", "text-warning","duotune") !!} View

View File

@ -1,4 +1,4 @@
@php
@php
$route = explode('.', Route::currentRouteName());
@endphp
<!--begin:Form-->

View File

@ -288,6 +288,13 @@
data: {keterangan: this.keterangan}, // serializes the form's elements.
success: function (data) {
toastr.success('Menunggu Approval untuk menonaktifkan Dokumen.', 'Success!', {timeOut: 5000});
Swal.fire({
title: 'Success!',
text: "Data Berhasil Di Non-Aktifkan, Menunggu Approval",
icon: 'success',
confirmButtonText: 'Ok'
});
LaravelDataTables["{{$route[0]}}-table"].draw();
}
});
@ -378,6 +385,14 @@
data: form.serialize(), // serializes the form's elements.
success: function (data) {
toastr.success('{{ucfirst($route[0])}} Menunggu Approval untuk menghapus Dokumen.', 'Success!', {timeOut: 5000});
Swal.fire({
title: 'Success!',
text: "Data berhasil di hapus, menunggu Approval",
icon: 'success',
confirmButtonText: 'Ok'
});
LaravelDataTables["{{$route[0]}}-table"].draw();
}
});

View File

@ -96,4 +96,16 @@
<!--end::Card body-->
</div>
<!--end::Card-->
@push('customscript')
<script>
@if(Session::has('success'))
Swal.fire({
title: 'Success!',
text: "Data Berhasil Di Simpan, Menunggu Approval",
icon: 'success',
confirmButtonText: 'Ok'
});
@endif
</script>
@endpush
</x-default-layout>

View File

@ -1,7 +1,7 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
@if( Auth::user()->hasRole('operator') || Auth::user()->hasRole('administrator'))
@if( Auth::user()->hasRole('ad') || Auth::user()->hasRole('administrator'))
<div class="d-flex flex-row flex-center">
<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">
@ -14,7 +14,7 @@
</div>
@endif
@if(Auth::user()->hasRole('otorisator'))
@if(Auth::user()->hasRole('dd'))
@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">

View File

@ -23,7 +23,7 @@
<!--begin::Heading-->
<div class="mb-13 text-center">
<!--begin::Title-->
<h1 class="mb-3 text-capitalize" id="title_form">{{ str_replace('-',' ',$route[0]) }}</h1>
<h1 class="mb-3 text-capitalize" id="title_form">Create {{ str_replace('-',' ',$route[0]) }}</h1>
<!--end::Title-->
</div>
<!--end::Heading-->

View File

@ -95,6 +95,12 @@
data: form.serialize(), // serializes the form's elements.
success: function (data) {
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
Swal.fire({
title: 'Success!',
text: "Data berhasil di hapus, menunggu Approval",
icon: 'success',
confirmButtonText: 'Ok'
});
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
}
});

View File

@ -101,14 +101,26 @@
$.ajax({
type: "POST",
url: actionUrl,
data: form.serialize(), // serializes the form's elements.
data: form.serialize(),
success: function (data) {
var _data = JSON.parse(data);
toastr.success(_data.message);
var _message = _data.message;
var message = 'Data Berhasil Di Simpan, Menunggu Approval';
if(_message.includes("updated")){
message = 'Data Berhasil Di Update, Menunggu Approval';
}
Swal.fire({
title: 'Success!',
text: message,
icon: 'success',
confirmButtonText: 'Ok'
});
form[0].reset();
LaravelDataTables["directorat-table"].ajax.reload();
$('#kt_modal_directorat').modal('hide');
},
error: function (data, textStatus, errorThrown) {
var errors = data.responseJSON.errors;

View File

@ -1,7 +1,7 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
@if( Auth::user()->hasRole('operator'))
@if( Auth::user()->hasRole('ad') || Auth::user()->hasRole('administrator'))
<div class="d-flex flex-row flex-center">
<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">
@ -14,7 +14,7 @@
</div>
@endif
@if(Auth::user()->hasRole('otorisator'))
@if(Auth::user()->hasRole('dd'))
@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">

View File

@ -23,7 +23,7 @@
<!--begin::Heading-->
<div class="mb-13 text-center">
<!--begin::Title-->
<h1 class="mb-3 text-capitalize" id="title_form">{{ str_replace('-',' ',$route[0])}}</h1>
<h1 class="mb-3 text-capitalize" id="title_form">Create {{ str_replace('-',' ',$route[0])}}</h1>
<!--end::Title-->
</div>
<!--end::Heading-->

View File

@ -96,6 +96,12 @@
data: form.serialize(), // serializes the form's elements.
success: function (data) {
toastr.success('{{ucfirst(str_replace('-',' ',$route[0]))}} has been deleted.', 'Success!', {timeOut: 5000});
Swal.fire({
title: 'Success!',
text: "Data berhasil di hapus, menunggu Approval",
icon: 'success',
confirmButtonText: 'Ok'
});
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
}
});

View File

@ -110,6 +110,17 @@
success: function (data) {
var _data = JSON.parse(data);
toastr.success(_data.message);
var _message = _data.message;
var message = 'Data Berhasil Di Simpan, Menunggu Approval';
if(_message.includes("updated")){
message = 'Data Berhasil Di Update, Menunggu Approval';
}
Swal.fire({
title: 'Success!',
text: message,
icon: 'success',
confirmButtonText: 'Ok'
});
form[0].reset();
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
$('#kt_modal_{{$route[0]}}').modal('hide');

View File

@ -1,7 +1,7 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
@if( Auth::user()->hasRole('operator'))
@if( Auth::user()->hasRole('ad') || Auth::user()->hasRole('administrator'))
<div class="d-flex flex-row flex-center">
<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">
@ -14,7 +14,7 @@
</div>
@endif
@if(Auth::user()->hasRole('otorisator'))
@if(Auth::user()->hasRole('dd'))
@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">

View File

@ -23,7 +23,7 @@
<!--begin::Heading-->
<div class="mb-13 text-center">
<!--begin::Title-->
<h1 class="mb-3 text-capitalize" id="title_form">{{ str_replace('-',' ',$route[0]) }}</h1>
<h1 class="mb-3 text-capitalize" id="title_form">Create {{ str_replace('-',' ',$route[0]) }}</h1>
<!--end::Title-->
</div>
<!--end::Heading-->

View File

@ -97,6 +97,12 @@
data: form.serialize(), // serializes the form's elements.
success: function (data) {
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
Swal.fire({
title: 'Success!',
text: "Data berhasil di hapus, menunggu Approval",
icon: 'success',
confirmButtonText: 'Ok'
});
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
}
});

View File

@ -105,6 +105,17 @@
success: function (data) {
var _data = JSON.parse(data);
toastr.success(_data.message);
var _message = _data.message;
var message = 'Data Berhasil Di Simpan, Menunggu Approval';
if(_message.includes("updated")){
message = 'Data Berhasil Di Update, Menunggu Approval';
}
Swal.fire({
title: 'Success!',
text: message,
icon: 'success',
confirmButtonText: 'Ok'
});
form[0].reset();
LaravelDataTables["job-table"].ajax.reload();
$('#kt_modal_job').modal('hide');

View File

@ -1,7 +1,7 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
@if( Auth::user()->hasRole('operator'))
@if( Auth::user()->hasRole('ad') || Auth::user()->hasRole('administrator'))
<div class="d-flex flex-row flex-center">
<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">
@ -14,7 +14,7 @@
</div>
@endif
@if(Auth::user()->hasRole('otorisator'))
@if(Auth::user()->hasRole('dd'))
@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">

View File

@ -23,7 +23,7 @@
<!--begin::Heading-->
<div class="mb-13 text-center">
<!--begin::Title-->
<h1 class="mb-3 text-capitalize" id="title_form">{{ str_replace('-',' ',$route[0])}}</h1>
<h1 class="mb-3 text-capitalize" id="title_form">Create {{ str_replace('-',' ',$route[0])}}</h1>
<!--end::Title-->
</div>
<!--end::Heading-->

View File

@ -97,6 +97,12 @@
data: form.serialize(), // serializes the form's elements.
success: function (data) {
toastr.success('{{ucfirst(str_replace('-',' ',$route[0]))}} has been deleted.', 'Success!', {timeOut: 5000});
Swal.fire({
title: 'Success!',
text: "Data berhasil di hapus, menunggu Approval",
icon: 'success',
confirmButtonText: 'Ok'
});
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
}
});

View File

@ -110,6 +110,17 @@
success: function (data) {
var _data = JSON.parse(data);
toastr.success(_data.message);
var _message = _data.message;
var message = 'Data Berhasil Di Simpan, Menunggu Approval';
if(_message.includes("updated")){
message = 'Data Berhasil Di Update, Menunggu Approval';
}
Swal.fire({
title: 'Success!',
text: message,
icon: 'success',
confirmButtonText: 'Ok'
});
form[0].reset();
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
$('#kt_modal_{{$route[0]}}').modal('hide');

View File

@ -1,7 +1,7 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
@if( Auth::user()->hasRole('operator'))
@if( Auth::user()->hasRole('ad') || Auth::user()->hasRole('administrator'))
<div class="d-flex flex-row flex-center">
<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">
@ -14,7 +14,7 @@
</div>
@endif
@if(Auth::user()->hasRole('otorisator'))
@if(Auth::user()->hasRole('dd'))
@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">

View File

@ -23,7 +23,7 @@
<!--begin::Heading-->
<div class="mb-13 text-center">
<!--begin::Title-->
<h1 class="mb-3 text-capitalize" id="title_form">{{ str_replace('-',' ',$route[0])}}</h1>
<h1 class="mb-3 text-capitalize" id="title_form">Create {{ str_replace('-',' ',$route[0])}}</h1>
<!--end::Title-->
</div>
<!--end::Heading-->

View File

@ -97,6 +97,12 @@
data: form.serialize(), // serializes the form's elements.
success: function (data) {
toastr.success('{{ucfirst(str_replace('-',' ',$route[0]))}} has been deleted.', 'Success!', {timeOut: 5000});
Swal.fire({
title: 'Success!',
text: "Data berhasil di hapus, menunggu Approval",
icon: 'success',
confirmButtonText: 'Ok'
});
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
}
});

View File

@ -110,6 +110,18 @@
success: function (data) {
var _data = JSON.parse(data);
toastr.success(_data.message);
var _message = _data.message;
var message = 'Data Berhasil Di Simpan, Menunggu Approval';
if(_message.includes("updated")){
message = 'Data Berhasil Di Update, Menunggu Approval';
}
Swal.fire({
title: 'Success!',
text: message,
icon: 'success',
confirmButtonText: 'Ok'
});
form[0].reset();
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
$('#kt_modal_{{$route[0]}}').modal('hide');

View File

@ -1,7 +1,7 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
@if( Auth::user()->hasRole('operator'))
@if( Auth::user()->hasRole('ad') || Auth::user()->hasRole('administrator'))
<div class="d-flex flex-row flex-center">
<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">
@ -14,7 +14,7 @@
</div>
@endif
@if(Auth::user()->hasRole('otorisator'))
@if(Auth::user()->hasRole('dd'))
@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">

View File

@ -23,7 +23,7 @@
<!--begin::Heading-->
<div class="mb-13 text-center">
<!--begin::Title-->
<h1 class="mb-3 text-capitalize" id="title_form">{{ str_replace('-',' ',$route[0]) }}</h1>
<h1 class="mb-3 text-capitalize" id="title_form">Create {{ str_replace('-',' ',$route[0]) }}</h1>
<!--end::Title-->
</div>
<!--end::Heading-->

View File

@ -98,6 +98,12 @@
data: form.serialize(), // serializes the form's elements.
success: function (data) {
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
Swal.fire({
title: 'Success!',
text: "Data berhasil di hapus, menunggu Approval",
icon: 'success',
confirmButtonText: 'Ok'
});
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
}
});

View File

@ -105,6 +105,17 @@
success: function (data) {
var _data = JSON.parse(data);
toastr.success(_data.message);
var _message = _data.message;
var message = 'Data Berhasil Di Simpan, Menunggu Approval';
if(_message.includes("updated")){
message = 'Data Berhasil Di Update, Menunggu Approval';
}
Swal.fire({
title: 'Success!',
text: message,
icon: 'success',
confirmButtonText: 'Ok'
});
form[0].reset();
LaravelDataTables["sub-job-table"].ajax.reload();
$('#kt_modal_sub-job').modal('hide');

View File

@ -1,7 +1,7 @@
@php
$route = explode('.', Route::currentRouteName());
@endphp
@if( Auth::user()->hasRole('operator'))
@if( Auth::user()->hasRole('ad') || Auth::user()->hasRole('administrator'))
<div class="d-flex flex-row flex-center">
<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">
@ -14,7 +14,7 @@
</div>
@endif
@if(Auth::user()->hasRole('otorisator'))
@if(Auth::user()->hasRole('dd'))
@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">

View File

@ -23,7 +23,7 @@
<!--begin::Heading-->
<div class="mb-13 text-center">
<!--begin::Title-->
<h1 class="mb-3 text-capitalize" id="title_form">{{ str_replace('-',' ',$route[0]) }}</h1>
<h1 class="mb-3 text-capitalize" id="title_form">Create {{ str_replace('-',' ',$route[0]) }}</h1>
<!--end::Title-->
</div>
<!--end::Heading-->

View File

@ -99,6 +99,12 @@
data: form.serialize(), // serializes the form's elements.
success: function (data) {
toastr.success('{{ucfirst($route[0])}} has been deleted.', 'Success!', {timeOut: 5000});
Swal.fire({
title: 'Success!',
text: "Data berhasil di hapus, menunggu Approval",
icon: 'success',
confirmButtonText: 'Ok'
});
LaravelDataTables["{{$route[0]}}-table"].ajax.reload();
}
});

View File

@ -105,6 +105,17 @@
success: function (data) {
var _data = JSON.parse(data);
toastr.success(_data.message);
var _message = _data.message;
var message = 'Data Berhasil Di Simpan, Menunggu Approval';
if(_message.includes("updated")){
message = 'Data Berhasil Di Update, Menunggu Approval';
}
Swal.fire({
title: 'Success!',
text: message,
icon: 'success',
confirmButtonText: 'Ok'
});
form[0].reset();
LaravelDataTables["sub-sub-job-table"].ajax.reload();
$('#kt_modal_sub-sub-job').modal('hide');

View File

@ -1,6 +1,6 @@
@canany(['document.read','document.create','document.update','document.delete'])
<!--begin:Menu item-->
<div class="menu-item {{ $route[0] == 'cardboard' ? 'here' : '' }}">
<div class="menu-item {{ $route[0] == 'cardboard' || $route[0] == 'cardboard-detail' ? 'here' : '' }}">
<!--begin:Menu link-->
<a class="menu-link {{ $route[0] == 'cardboard' ? 'active' : '' }}" href="{{ route('cardboard.index') }}">
<span class="menu-icon">{!! getIcon('parcel', 'fs-2') !!}</span>
@ -32,7 +32,7 @@
<!--end:Menu item-->
@endcanany
@canany(['master.read','master.create','master.update','master.delete','setting.authorize'])
@canany(['master.read','master.create','master.update','master.delete'])
<!--begin:Menu item-->
<div data-kt-menu-trigger="click"
class="menu-item menu-accordion {{ $route[0] == 'directorat' || $route[0] == 'sub-directorat' || $route[0] == 'job' || $route[0] == 'sub-job' || $route[0] == 'sub-sub-job' || $route[0] == 'special-code' || $route[0] == 'document-type' ? 'show' : '' }}">

View File

@ -39,9 +39,11 @@
Route::resource('document', DocumentController::class);
Route::resource('cardboard', CardboardController::class);
Route::get('cardboard-label/{id}', [CardboardController::class, 'label'])->name('cardboard.label');
Route::resource('cardboard-detail', CardboardDetailController::class);
Route::get('document-download/{id}', [DocumentController::class, 'download'])->name('document.download');
Route::get('document-label/{id}', [DocumentController::class, 'label'])->name('document.label');
Route::get('document-odner/{id}', [DocumentController::class, 'odner'])->name('document.odner');
Route::get('document-aktif/{id}', [DocumentController::class, 'aktif'])->name('document.aktif');
//Route::resource('document-detail', DOcumentDetailController::class);