Update Metronic Version to 8.2.1 #1

Merged
putrakuningan merged 77 commits from dev into master 2024-05-04 09:46:45 +00:00
148 changed files with 2567 additions and 1692 deletions
Showing only changes of commit bd3233494e - Show all commits

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "Modules/CetakLabel/cetaklabel-module"]
path = Modules/CetakLabel/cetaklabel-module
url = https://git.putrakuningan.com/putrakuningan/cetaklabel-module

View File

@ -1,15 +1,12 @@
<?php
namespace App\DataTables;
namespace Modules\CetakLabel\DataTables;
use App\Models\Document;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Modules\CetakLabel\Entities\Document;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class DocumentDataTable extends DataTable
@ -59,7 +56,7 @@ class DocumentDataTable extends DataTable
return $model->sub_sub_job->name;
})
->addIndexColumn()
->addColumn('action', 'pages.app.document._action')
->addColumn('action', 'cetaklabel::app.document._action')
->setRowId('id');
}

View File

@ -1,15 +1,12 @@
<?php
namespace App\DataTables;
namespace Modules\CetakLabel\DataTables;
use App\Models\DocumentType;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Modules\CetakLabel\Entities\DocumentType;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class DocumentTypeDataTable extends DataTable
@ -30,7 +27,7 @@ class DocumentTypeDataTable extends DataTable
}
})
->addIndexColumn()
->addColumn('action', 'pages.app.document-type._action')
->addColumn('action', 'cetaklabel::masters.document-type._action')
->setRowId('id');
}

View File

@ -1,15 +1,12 @@
<?php
namespace App\DataTables;
namespace Modules\CetakLabel\DataTables;
use App\Models\Job;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Modules\CetakLabel\Entities\Job;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class JobDataTable extends DataTable
@ -38,7 +35,7 @@ class JobDataTable extends DataTable
->addColumn('sub_directorat', function ($job) {
return $job->subDirectorat->name;
})
->addColumn('action', 'pages.masters.job._action')
->addColumn('action', 'cetaklabel::masters.job._action')
->setRowId('id');
}

View File

@ -1,15 +1,12 @@
<?php
namespace App\DataTables;
namespace Modules\CetakLabel\DataTables;
use App\Models\SpecialCode;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Modules\CetakLabel\Entities\SpecialCode;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class SpecialCodeDataTable extends DataTable
@ -30,7 +27,7 @@ class SpecialCodeDataTable extends DataTable
}
})
->addIndexColumn()
->addColumn('action', 'pages.masters.special-code._action')
->addColumn('action', 'cetaklabel::masters.special-code._action')
->setRowId('id');
}

View File

@ -1,15 +1,12 @@
<?php
namespace App\DataTables;
namespace Modules\CetakLabel\DataTables;
use App\Models\SubDirectorat;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Modules\CetakLabel\Entities\SubDirectorat;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class SubDirectoratDataTable extends DataTable
@ -34,7 +31,7 @@ class SubDirectoratDataTable extends DataTable
->addColumn('directorat', function ($subDirectorat) {
return $subDirectorat->directorat->name;
})
->addColumn('action', 'pages.masters.sub-directorat._action')
->addColumn('action', 'cetaklabel::masters.sub-directorat._action')
->setRowId('id');
}

View File

@ -1,15 +1,12 @@
<?php
namespace App\DataTables;
namespace Modules\CetakLabel\DataTables;
use App\Models\SubJob;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Modules\CetakLabel\Entities\SubJob;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class SubJobDataTable extends DataTable
@ -28,7 +25,7 @@ class SubJobDataTable extends DataTable
$query->where('kode', 'like', "%" . $search['value'] . "%")
->orWhere('name', 'like', "%" . $search['value'] . "%")
->orWhereRelation('directorat', 'name', 'like', '%'.$search['value'].'%')
->orWhereRelation('subDirectorat', 'name', 'like', '%'.$search['value'].'%')
->orWhereRelation('sub_directorat', 'name', 'like', '%'.$search['value'].'%')
->orWhereRelation('job', 'name', 'like', '%'.$search['value'].'%');
}
})
@ -42,7 +39,7 @@ class SubJobDataTable extends DataTable
->addColumn('job', function ($subJob) {
return $subJob->job->name;
})
->addColumn('action', 'pages.masters.sub-job._action')
->addColumn('action', 'cetaklabel::masters.sub-job._action')
->setRowId('id');
}

View File

@ -1,15 +1,12 @@
<?php
namespace App\DataTables;
namespace Modules\CetakLabel\DataTables;
use App\Models\SubSubJob;
use Illuminate\Database\Eloquent\Builder as QueryBuilder;
use Modules\CetakLabel\Entities\SubSubJob;
use Yajra\DataTables\EloquentDataTable;
use Yajra\DataTables\Html\Builder as HtmlBuilder;
use Yajra\DataTables\Html\Button;
use Yajra\DataTables\Html\Column;
use Yajra\DataTables\Html\Editor\Editor;
use Yajra\DataTables\Html\Editor\Fields;
use Yajra\DataTables\Services\DataTable;
class SubSubJobDataTable extends DataTable
@ -28,7 +25,7 @@ class SubSubJobDataTable extends DataTable
$query->where('kode', 'like', "%" . $search['value'] . "%")
->orWhere('name', 'like', "%" . $search['value'] . "%")
->orWhereRelation('directorat', 'name', 'like', '%'.$search['value'].'%')
->orWhereRelation('subDirectorat', 'name', 'like', '%'.$search['value'].'%')
->orWhereRelation('sub_directorat', 'name', 'like', '%'.$search['value'].'%')
->orWhereRelation('job', 'name', 'like', '%'.$search['value'].'%')
->orWhereRelation('subJob', 'name', 'like', '%'.$search['value'].'%');
}
@ -46,7 +43,7 @@ class SubSubJobDataTable extends DataTable
->addColumn('sub_job', function ($subJob) {
return $subJob->subJob->name;
})
->addColumn('action', 'pages.masters.sub-sub-job._action')
->addColumn('action', 'cetaklabel::masters.sub-sub-job._action')
->setRowId('id');
}

View File

@ -1,16 +1,16 @@
<?php
use App\Models\Job;
use App\Models\SpecialCode;
use App\Models\SubDirectorat;
use App\Models\SubJob;
use App\Models\SubSubJob;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Modules\CetakLabel\Entities\Directorat;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Modules\CetakLabel\Entities\Directorat;
use Modules\CetakLabel\Entities\Job;
use Modules\CetakLabel\Entities\SpecialCode;
use Modules\CetakLabel\Entities\SubDirectorat;
use Modules\CetakLabel\Entities\SubJob;
use Modules\CetakLabel\Entities\SubSubJob;
return new class extends Migration
return new class extends Migration
{
/**
* Run the migrations.

View File

@ -1,68 +1,68 @@
<?php
namespace Modules\CetakLabel\Database\Seeders;
namespace Modules\CetakLabel\Database\Seeders;
use App\Models\Job;
use App\Models\SpecialCode;
use App\Models\SubDirectorat;
use App\Models\SubJob;
use App\Models\SubSubJob;
use Faker\Generator;
use Illuminate\Database\Seeder;
use Modules\CetakLabel\Entities\Directorat;
use Faker\Generator;
use Illuminate\Database\Seeder;
use Modules\CetakLabel\Entities\Directorat;
use Modules\CetakLabel\Entities\Job;
use Modules\CetakLabel\Entities\SpecialCode;
use Modules\CetakLabel\Entities\SubDirectorat;
use Modules\CetakLabel\Entities\SubJob;
use Modules\CetakLabel\Entities\SubSubJob;
class CetakLabelSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run(Generator $faker)
class CetakLabelSeeder extends Seeder
{
$direktorat = Directorat::create([
'kode' => '01',
'name' => 'Direktorat Jenderal Perhubungan Darat',
]);
/**
* Run the database seeds.
*
* @return void
*/
public function run(Generator $faker)
{
$direktorat = Directorat::create ([
'kode' => '01',
'name' => 'Direktorat Jenderal Perhubungan Darat',
]);
$subdirektorat = SubDirectorat::create([
'kode' => '01',
'name' => 'Subdirektorat Jenderal Perhubungan Darat',
'directorat_id' => $direktorat->id,
]);
$subdirektorat = SubDirectorat::create ([
'kode' => '01',
'name' => 'Subdirektorat Jenderal Perhubungan Darat',
'directorat_id' => $direktorat->id,
]);
$job = Job::create([
'kode' => '01',
'name' => 'Kepala Subdirektorat Jenderal Perhubungan Darat',
'sub_directorat_id' => $subdirektorat->id,
'directorat_id' => $direktorat->id,
]);
$job = Job::create ([
'kode' => '01',
'name' => 'Kepala Subdirektorat Jenderal Perhubungan Darat',
'sub_directorat_id' => $subdirektorat->id,
'directorat_id' => $direktorat->id,
]);
$subjob = SubJob::create([
'kode' => '01',
'name' => 'Kepala Subdirektorat Jenderal Perhubungan Darat',
'job_id' => $job->id,
'sub_directorat_id' => $subdirektorat->id,
'directorat_id' => $direktorat->id,
]);
$subjob = SubJob::create ([
'kode' => '01',
'name' => 'Kepala Subdirektorat Jenderal Perhubungan Darat',
'job_id' => $job->id,
'sub_directorat_id' => $subdirektorat->id,
'directorat_id' => $direktorat->id,
]);
$subsubjob = SubSubJob::create([
'kode' => '01',
'name' => 'Kepala Subdirektorat Jenderal Perhubungan Darat',
'sub_job_id' => $subjob->id,
'job_id' => $job->id,
'sub_directorat_id' => $subdirektorat->id,
'directorat_id' => $direktorat->id,
]);
$subsubjob = SubSubJob::create ([
'kode' => '01',
'name' => 'Kepala Subdirektorat Jenderal Perhubungan Darat',
'sub_job_id' => $subjob->id,
'job_id' => $job->id,
'sub_directorat_id' => $subdirektorat->id,
'directorat_id' => $direktorat->id,
]);
$SpecialCode = SpecialCode::create([
'kode' => '00',
'name' => 'Archive'
]);
$SpecialCode = SpecialCode::create ([
'kode' => '00',
'name' => 'Archive'
]);
$SpecialCode = SpecialCode::create([
'kode' => '98',
'name' => 'Softcopy'
]);
$SpecialCode = SpecialCode::create ([
'kode' => '98',
'name' => 'Softcopy'
]);
}
}
}

View File

@ -2,18 +2,13 @@
namespace Modules\CetakLabel\Entities;
use App\Models\SubDirectorat;
class Directorat extends BaseModel
{
protected $fillable = [
'kode',
'name'
];
protected $fillable = ['kode', 'name'];
public function subDirectorat()
public function sub_directorat()
{
return $this->hasMany(SubDirectorat::class);
return $this->hasMany (SubDirectorat::class);
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace Modules\CetakLabel\Entities;
class Document extends BaseModel
{
protected $fillable = [
'directorat_id',
'sub_directorat_id',
'job_id',
'sub_job_id',
'sub_sub_job_id',
'special_code_id',
'no_urut',
'kode',
'sequence',
'jenis_dokumen'
];
public function directorat()
{
return $this->belongsTo (Directorat::class);
}
public function sub_directorat()
{
return $this->belongsTo (SubDirectorat::class);
}
public function job()
{
return $this->belongsTo (Job::class);
}
public function sub_job()
{
return $this->belongsTo (SubJob::class);
}
public function sub_sub_job()
{
return $this->belongsTo (SubSubJob::class);
}
public function special_code()
{
return $this->belongsTo (SpecialCode::class);
}
public function document_details()
{
return $this->hasMany (DocumentDetail::class);
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace Modules\CetakLabel\Entities;
class DocumentDetail extends BaseModel
{
protected $fillable = [
'document_id',
'document_type_id',
'nama_nasabah',
'no_rekening',
'no_cif',
'group',
'group',
'tanggal_upload',
'tanggal_dokumen',
'nomor_dokumen',
'perihal',
'kode_cabang',
'jumlah_halaman',
'custom_field_1',
'custom_field_2',
'custom_field_3',
'custom_field_4'
];
public function document()
{
return $this->belongsTo (Document::class);
}
public function document_type()
{
return $this->belongsTo (DocumentType::class);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace Modules\CetakLabel\Entities;
class DocumentType extends BaseModel
{
protected $fillable = [
'kode',
'name'
];
public function document_detail()
{
return $this->hasMany (DocumentDetail::class);
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Modules\CetakLabel\Entities;
class Job extends BaseModel
{
protected $fillable = [
'directorat_id',
'sub_directorat_id',
'kode',
'name'
];
public function directorat()
{
return $this->belongsTo (Directorat::class);
}
public function sub_directorat()
{
return $this->belongsTo (SubDirectorat::class);
}
public function sub_job()
{
return $this->hasMany (SubJob::class);
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Modules\CetakLabel\Entities;
class SpecialCode extends BaseModel
{
protected $fillable = [
'kode',
'name'
];
public function document()
{
return $this->hasMany (Document::class);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace Modules\CetakLabel\Entities;
class SubDirectorat extends BaseModel
{
protected $fillable = [
'directorat_id',
'kode',
'name'
];
public function directorat()
{
return $this->belongsTo (Directorat::class);
}
public function sub_jobs()
{
return $this->hasMany (SubJob::class);
}
public function jobs()
{
return $this->hasManyThrough (Job::class, SubJob::class);
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace Modules\CetakLabel\Entities;
class SubJob extends BaseModel
{
protected $fillable = [
'directorat_id',
'sub_directorat_id',
'job_id',
'kode',
'name'
];
public function directorat()
{
return $this->belongsTo (Directorat::class);
}
public function sub_directorat()
{
return $this->belongsTo (SubDirectorat::class);
}
public function job()
{
return $this->belongsTo (Job::class);
}
public function sub_sub_job()
{
return $this->hasMany (SubSubJob::class);
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace Modules\CetakLabel\Entities;
class SubSubJob extends BaseModel
{
protected $fillable = [
'directorat_id',
'sub_directorat_id',
'job_id',
'sub_job_id',
'kode',
'name'
];
public function directorat()
{
return $this->belongsTo (Directorat::class);
}
public function sub_directorat()
{
return $this->belongsTo (SubDirectorat::class);
}
public function job()
{
return $this->belongsTo (Job::class);
}
public function sub_job()
{
return $this->belongsTo (SubJob::class);
}
}

View File

@ -11,16 +11,14 @@
class DirectoratController extends ApiController
{
public function index()
: JsonResponse
public function index(): JsonResponse
{
$directorats = Directorat::all();
return $this->sendResponse($directorats, 'Directorats retrieved successfully.');
}
public function show($directorat)
: JsonResponse
public function show($directorat): JsonResponse
{
$directorat = Directorat::find($directorat);
if (is_null($directorat)) {
@ -30,8 +28,7 @@
return $this->sendResponse($directorat, 'Directorat retrieved successfully.');
}
public function store(StoreDirectoratRequest $request)
: JsonResponse
public function store(StoreDirectoratRequest $request): JsonResponse
{
// Validate the request...
$validated = $request->validated();
@ -50,8 +47,7 @@
return $this->sendError('Directorat created failed.', 400);
}
public function update(UpdateDirectoratRequest $request, Directorat $directorat)
: JsonResponse
public function update(UpdateDirectoratRequest $request, Directorat $directorat): JsonResponse
{
// Validate the request...
$validated = $request->validated();
@ -70,8 +66,7 @@
return $this->sendError('Directorat created failed.', 400);
}
public function destroy($id)
: JsonResponse
public function destroy($id): JsonResponse
{
$directorat = Directorat::find($id);
if (is_null($directorat)) {

View File

@ -0,0 +1,84 @@
<?php
namespace Modules\CetakLabel\Http\Controllers\Api;
use App\Http\Controllers\ApiController;
use Exception;
use Modules\CetakLabel\Entities\Job;
use Modules\CetakLabel\Http\Requests\Job\StoreJobRequest;
use Modules\CetakLabel\Http\Requests\Job\UpdateJobRequest;
use Symfony\Component\HttpFoundation\JsonResponse;
class JobController extends ApiController
{
public function index(): JsonResponse
{
$jobs = Job::all();
return $this->sendResponse($jobs, 'Jobs retrieved successfully.');
}
public function show($job): JsonResponse
{
$job = Job::find($job);
if (is_null($job)) {
return $this->sendError('Job not found.');
}
return $this->sendResponse($job, 'Job retrieved successfully.');
}
public function store(StoreJobRequest $request): JsonResponse
{
// Validate the request...
$validated = $request->validated();
// Store the Job...
if ($validated) {
try {
$data = Job::create($validated);
return $this->sendResponse($data, 'Job created successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
return $this->sendError('Job created failed.', 400);
}
public function update(UpdateJobRequest $request, Job $job): JsonResponse
{
// Validate the request...
$validated = $request->validated();
// Store the Job...
if ($validated) {
try {
$data = $job->update($validated);
return $this->sendResponse($data, 'Job updated successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
return $this->sendError('Job created failed.', 400);
}
public function destroy($id): JsonResponse
{
$job = Job::find($id);
if (is_null($job)) {
return $this->sendError('Job not found.');
}
try {
$job->delete();
return $this->sendResponse($job, 'Job deleted successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace Modules\CetakLabel\Http\Controllers\Api;
use App\Http\Controllers\ApiController;
use Exception;
use Modules\CetakLabel\Entities\SpecialCode;
use Modules\CetakLabel\Http\Requests\SpecialCode\StoreSpecialCodeRequest;
use Modules\CetakLabel\Http\Requests\SpecialCode\UpdateSpecialCodeRequest;
use Symfony\Component\HttpFoundation\JsonResponse;
class SpecialCodeController extends ApiController
{
public function index(): JsonResponse
{
$special_codes = SpecialCode::all();
return $this->sendResponse($special_codes, 'Special Codes retrieved successfully.');
}
public function show($special_code): JsonResponse
{
$special_code = SpecialCode::find($special_code);
if (is_null($special_code)) {
return $this->sendError('Special Code not found.');
}
return $this->sendResponse($special_code, 'Special Code retrieved successfully.');
}
public function store(StoreSpecialCodeRequest $request): JsonResponse
{
// Validate the request...
$validated = $request->validated();
// Store the SpecialCode...
if ($validated) {
try {
$data = SpecialCode::create($validated);
return $this->sendResponse($data, 'Special Code created successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
return $this->sendError('Special Code created failed.', 400);
}
public function update(UpdateSpecialCodeRequest $request, SpecialCode $special_code): JsonResponse
{
// Validate the request...
$validated = $request->validated();
// Store the SpecialCode...
if ($validated) {
try {
$data = $special_code->update($validated);
return $this->sendResponse($data, 'Special Code updated successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
return $this->sendError('Special Code created failed.', 400);
}
public function destroy($id): JsonResponse
{
$special_code = SpecialCode::find($id);
if (is_null($special_code)) {
return $this->sendError('Special Code not found.');
}
try {
$special_code->delete();
return $this->sendResponse($special_code, 'Special Code deleted successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace Modules\CetakLabel\Http\Controllers\Api;
use App\Http\Controllers\ApiController;
use Exception;
use Modules\CetakLabel\Entities\SubDirectorat;
use Modules\CetakLabel\Http\Requests\SubDirectorat\StoreSubDirectoratRequest;
use Modules\CetakLabel\Http\Requests\SubDirectorat\UpdateSubDirectoratRequest;
use Symfony\Component\HttpFoundation\JsonResponse;
class SubDirectoratController extends ApiController
{
public function index(): JsonResponse
{
$sub_directorats = SubDirectorat::all();
return $this->sendResponse($sub_directorats, 'Sub Directorats retrieved successfully.');
}
public function show($sub_directorat): JsonResponse
{
$sub_directorat = SubDirectorat::find($sub_directorat);
if (is_null($sub_directorat)) {
return $this->sendError('Sub Directorat not found.');
}
return $this->sendResponse($sub_directorat, 'Sub Directorat retrieved successfully.');
}
public function store(StoreSubDirectoratRequest $request): JsonResponse
{
// Validate the request...
$validated = $request->validated();
// Store the SubDirectorat...
if ($validated) {
try {
$data = SubDirectorat::create($validated);
return $this->sendResponse($data, 'Sub Directorat created successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
return $this->sendError('Sub Directorat created failed.', 400);
}
public function update(UpdateSubDirectoratRequest $request, SubDirectorat $sub_directorat): JsonResponse
{
// Validate the request...
$validated = $request->validated();
// Store the SubDirectorat...
if ($validated) {
try {
$data = $sub_directorat->update($validated);
return $this->sendResponse($data, 'Sub Directorat updated successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
return $this->sendError('Sub Directorat created failed.', 400);
}
public function destroy($id): JsonResponse
{
$sub_directorat = SubDirectorat::find($id);
if (is_null($sub_directorat)) {
return $this->sendError('Sub Directorat not found.');
}
try {
$sub_directorat->delete();
return $this->sendResponse($sub_directorat, 'Sub Directorat deleted successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace Modules\CetakLabel\Http\Controllers\Api;
use App\Http\Controllers\ApiController;
use Exception;
use Modules\CetakLabel\Entities\SubJob;
use Modules\CetakLabel\Http\Requests\SubJob\StoreSubJobRequest;
use Modules\CetakLabel\Http\Requests\SubJob\UpdateSubJobRequest;
use Symfony\Component\HttpFoundation\JsonResponse;
class SubJobController extends ApiController
{
public function index(): JsonResponse
{
$sub_jobs = SubJob::all();
return $this->sendResponse($sub_jobs, 'Sub Jobs retrieved successfully.');
}
public function show($sub_job): JsonResponse
{
$sub_job = SubJob::find($sub_job);
if (is_null($sub_job)) {
return $this->sendError('Sub Job not found.');
}
return $this->sendResponse($sub_job, 'Sub Job retrieved successfully.');
}
public function store(StoreSubJobRequest $request): JsonResponse
{
// Validate the request...
$validated = $request->validated();
// Store the SubJob...
if ($validated) {
try {
$data = SubJob::create($validated);
return $this->sendResponse($data, 'Sub Job created successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
return $this->sendError('Sub Job created failed.', 400);
}
public function update(UpdateSubJobRequest $request, SubJob $sub_job): JsonResponse
{
// Validate the request...
$validated = $request->validated();
// Store the SubJob...
if ($validated) {
try {
$data = $sub_job->update($validated);
return $this->sendResponse($data, 'Sub Job updated successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
return $this->sendError('Sub Job created failed.', 400);
}
public function destroy($id): JsonResponse
{
$sub_job = SubJob::find($id);
if (is_null($sub_job)) {
return $this->sendError('Sub Job not found.');
}
try {
$sub_job->delete();
return $this->sendResponse($sub_job, 'Sub Job deleted successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace Modules\CetakLabel\Http\Controllers\Api;
use App\Http\Controllers\ApiController;
use Exception;
use Modules\CetakLabel\Entities\SubSubJob;
use Modules\CetakLabel\Http\Requests\SubSubJob\StoreSubSubJobRequest;
use Modules\CetakLabel\Http\Requests\SubSubJob\UpdateSubSubJobRequest;
use Symfony\Component\HttpFoundation\JsonResponse;
class SubSubJobController extends ApiController
{
public function index(): JsonResponse
{
$sub_sub_jobs = SubSubJob::all();
return $this->sendResponse($sub_sub_jobs, 'Sub Sub Jobs retrieved successfully.');
}
public function show($sub_sub_job): JsonResponse
{
$sub_sub_job = SubSubJob::find($sub_sub_job);
if (is_null($sub_sub_job)) {
return $this->sendError('Sub Sub Job not found.');
}
return $this->sendResponse($sub_sub_job, 'Sub Sub Job retrieved successfully.');
}
public function store(StoreSubSubJobRequest $request): JsonResponse
{
// Validate the request...
$validated = $request->validated();
// Store the SubSubJob...
if ($validated) {
try {
$data = SubSubJob::create($validated);
return $this->sendResponse($data, 'Sub Sub Job created successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
return $this->sendError('Sub Sub Job created failed.', 400);
}
public function update(UpdateSubSubJobRequest $request, SubSubJob $sub_sub_job): JsonResponse
{
// Validate the request...
$validated = $request->validated();
// Store the SubSubJob...
if ($validated) {
try {
$data = $sub_sub_job->update($validated);
return $this->sendResponse($data, 'Sub Sub Job updated successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
return $this->sendError('Sub Sub Job created failed.', 400);
}
public function destroy($id): JsonResponse
{
$sub_sub_job = SubSubJob::find($id);
if (is_null($sub_sub_job)) {
return $this->sendError('Sub Sub Job not found.');
}
try {
$sub_sub_job->delete();
return $this->sendResponse($sub_sub_job, 'Sub Sub Job deleted successfully.');
} catch (Exception $e) {
return $this->sendError($e->getMessage(), $e->getCode());
}
}
}

View File

@ -10,7 +10,6 @@
use Modules\CetakLabel\Entities\Directorat;
use Modules\CetakLabel\Http\Requests\Directorat\StoreDirectoratRequest;
use Modules\CetakLabel\Http\Requests\Directorat\UpdateDirectoratRequest;
use Spatie\Activitylog\Facades\CauserResolver;
class DirectoratController extends Controller
{
@ -79,7 +78,7 @@
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}
show_404();
abort(404);
}
/**

View File

@ -1,21 +1,23 @@
<?php
namespace App\Http\Controllers;
namespace Modules\CetakLabel\Http\Controllers;
use App\DataTables\DocumentDataTable;
use App\Http\Requests\StoreDocumentRequest;
use App\Http\Requests\UpdateDocumentRequest;
use App\Models\Document;
use App\Models\DocumentDetail;
use App\Models\DocumentType;
use App\Models\Job;
use App\Models\SpecialCode;
use App\Models\SubDirectorat;
use App\Models\SubJob;
use App\Models\SubSubJob;
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Modules\CetakLabel\DataTables\DocumentDataTable;
use Modules\CetakLabel\Entities\Directorat;
use Modules\CetakLabel\Entities\Document;
use Modules\CetakLabel\Entities\DocumentDetail;
use Modules\CetakLabel\Entities\DocumentType;
use Modules\CetakLabel\Entities\Job;
use Modules\CetakLabel\Entities\SpecialCode;
use Modules\CetakLabel\Entities\SubDirectorat;
use Modules\CetakLabel\Entities\SubJob;
use Modules\CetakLabel\Entities\SubSubJob;
use Modules\CetakLabel\Http\Requests\Document\StoreDocumentRequest;
use Modules\CetakLabel\Http\Requests\Document\UpdateDocumentRequest;
class DocumentController extends Controller
{
@ -24,11 +26,10 @@
public function __construct()
{
$this->middleware(function ($request, $next) {
//$this->user = Auth::guard('web')->user();
$this->user = Auth::guard('web')->user();
return $next($request);
});
//CauserResolver::setCauser($this->user);
}
/**
@ -36,27 +37,11 @@
*/
public function index(DocumentDataTable $dataTable)
{
/*if (is_null($this->user) || !$this->user->can('app.read')) {
if (is_null($this->user) || !$this->user->can('app.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}*/
}
return $dataTable->render('pages.app.document.index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
/*if (is_null($this->user) || !$this->user->can('app.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
addVendor('chained-select');
$directorat = Directorat::all();
$special_code = SpecialCode::all();
$document_type = DocumentType::all();
return view('pages.app.document.create', compact('directorat', 'special_code', 'document_type'));
return $dataTable->render('cetaklabel::app.document.index');
}
/**
@ -64,9 +49,9 @@
*/
public function store(StoreDocumentRequest $request)
{
/*if (is_null($this->user) || !$this->user->can('app.create')) {
if (is_null($this->user) || !$this->user->can('app.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
}
// Validate the request...
@ -112,12 +97,32 @@
return false;
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
if (is_null($this->user) || !$this->user->can('app.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}
addVendor('chained-select');
$directorat = Directorat::all();
$special_code = SpecialCode::all();
$document_type = DocumentType::all();
return view('cetaklabel::app.document.create', compact('directorat', 'special_code', 'document_type'));
}
/**
* Display the specified resource.
*/
public function show(Document $documents)
{
if (is_null($this->user) || !$this->user->can('app.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
abort(404, 'Page not found !');
}
/**
@ -125,6 +130,10 @@
*/
public function edit($id)
{
if (is_null($this->user) || !$this->user->can('app.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}
$document = Document::find($id);
$directorat = Directorat::all();
$sub_directorat = SubDirectorat::where('directorat_id', $document->directorat_id)->get();
@ -134,7 +143,7 @@
$special_code = SpecialCode::all();
$document_type = DocumentType::all();
return view('pages.app.document.edit', compact('document', 'directorat', 'sub_directorat', 'job', 'sub_job', 'sub_sub_job', 'special_code', 'document_type'));
return view('cetaklabel::app.document.edit', compact('document', 'directorat', 'sub_directorat', 'job', 'sub_job', 'sub_sub_job', 'special_code', 'document_type'));
}
@ -143,9 +152,9 @@
*/
public function update(UpdateDocumentRequest $request, Document $documents)
{
/*if (is_null($this->user) || !$this->user->can('app.update')) {
if (is_null($this->user) || !$this->user->can('app.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}*/
}
// Validate the request...
$validated = $request->validated();
@ -171,6 +180,10 @@
*/
public function destroy(Request $request)
{
if (is_null($this->user) || !$this->user->can('app.delete')) {
abort(403, 'Sorry !! You are Unauthorized to delete any master data !');
}
$documents = Document::find($request->document);
$documents->delete();
echo json_encode(['status' => 'success', 'message' => 'Document deleted successfully.']);

View File

@ -0,0 +1,143 @@
<?php
namespace Modules\CetakLabel\Http\Controllers;
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Support\Facades\Auth;
use Modules\CetakLabel\DataTables\DocumentTypeDataTable;
use Modules\CetakLabel\Entities\DocumentType;
use Modules\CetakLabel\Http\Requests\DocumentType\StoreDocumentTypeRequest;
use Modules\CetakLabel\Http\Requests\DocumentType\UpdateDocumentTypeRequest;
class DocumentTypeController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->user = Auth::guard('web')->user();
return $next($request);
});
}
/**
* Display a listing of the resource.
*/
public function index(DocumentTypeDataTable $dataTable)
{
if (is_null($this->user) || !$this->user->can('masters.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
return $dataTable->render('cetaklabel::masters.document-type.index');
}
/**
* Store a newly created resource in storage.
*/
public function store(StoreDocumentTypeRequest $request)
{
if (is_null($this->user) || !$this->user->can('masters.create')) {
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);
echo json_encode(['status' => 'success', 'message' => 'Document Type created successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Document Type created failed.']);
}
return;
}
echo json_encode(['status' => 'error', 'message' => 'Document Type created failed.']);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
/*if (is_null($this->user) || !$this->user->can('masters.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
abort(404);
}
/**
* Display the specified resource.
*/
public function show(DocumentType $document_type)
{
if (is_null($this->user) || !$this->user->can('masters.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
abort(404);
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
if (is_null($this->user) || !$this->user->can('masters.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}
$document_type = DocumentType::find($id);
echo json_encode($document_type);
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateDocumentTypeRequest $request, DocumentType $document_type)
{
if (is_null($this->user) || !$this->user->can('masters.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}
// Validate the request...
$validated = $request->validated();
// Update the Directorat...
if ($validated) {
try {
$document_type->update($validated);
echo json_encode(['status' => 'success', 'message' => 'Document Type updated successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Document Type updated failed.']);
}
return;
}
echo json_encode(['status' => 'error', 'message' => 'Document Type updated failed.']);
}
/**
* Remove the specified resource from storage.
*/
public function destroy(DocumentType $document_type)
{
if (is_null($this->user) || !$this->user->can('masters.delete')) {
abort(403, 'Sorry !! You are Unauthorized to delete any master data !');
}
$document_type->delete();
echo json_encode(['status' => 'success', 'message' => 'Document Type deleted successfully.']);
}
}

View File

@ -1,14 +1,16 @@
<?php
namespace App\Http\Controllers;
namespace Modules\CetakLabel\Http\Controllers;
use App\DataTables\JobDataTable;
use App\Http\Requests\StoreJobRequest;
use App\Http\Requests\UpdateJobRequest;
use App\Models\Job;
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Modules\CetakLabel\DataTables\JobDataTable;
use Modules\CetakLabel\Entities\Directorat;
use Modules\CetakLabel\Entities\Job;
use Modules\CetakLabel\Http\Requests\Job\StoreJobRequest;
use Modules\CetakLabel\Http\Requests\Job\UpdateJobRequest;
class JobController extends Controller
{
@ -25,8 +27,8 @@
/**
* Display a listing of the Jobs.
*
* @param \App\DataTables\JobDataTable $dataTable
* @param \Illuminate\Http\Request $request
* @param \Modules\CetakLabel\DataTables\JobDataTable $dataTable
* @param \Illuminate\Http\Request $request
*
* @return mixed|void
*/
@ -45,7 +47,7 @@
}
$directorat = Directorat::all();
return $dataTable->render('pages.masters.job.index', compact('directorat'));
return $dataTable->render('cetaklabel::masters.job.index', compact('directorat'));
}
/**
@ -78,7 +80,7 @@
/**
* Store a newly created Job in storage.
*
* @param \App\Http\Requests\StoreJobRequest $request
* @param \Modules\CetakLabel\Http\Requests\Job\StoreJobRequest $request
*
* @return void
*/
@ -99,6 +101,7 @@
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Job created failed.']);
}
return;
}
echo json_encode(['status' => 'error', 'message' => 'Job created failed.']);
@ -113,7 +116,7 @@
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}
show_404();
abort(404);
}
/**
@ -136,8 +139,8 @@
/**
* Update the specified Job in storage.
*
* @param \App\Http\Requests\UpdateJobRequest $request
* @param \App\Models\Job $job
* @param \Modules\CetakLabel\Http\Requests\Job\UpdateJobRequest $request
* @param \Modules\CetakLabel\Entities\Job $job
*
* @return void
*/
@ -158,6 +161,7 @@
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Job updated failed.']);
}
return;
}
echo json_encode(['status' => 'error', 'message' => 'Job updated failed.']);
@ -166,7 +170,7 @@
/**
* Remove the specified Job from storage.
*
* @param \App\Models\Job $job
* @param \Modules\CetakLabel\Entities\Job $job
*
* @return void
*/

View File

@ -0,0 +1,142 @@
<?php
namespace Modules\CetakLabel\Http\Controllers;
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Support\Facades\Auth;
use Modules\CetakLabel\DataTables\SpecialCodeDataTable;
use Modules\CetakLabel\Entities\SpecialCode;
use Modules\CetakLabel\Http\Requests\SpecialCode\StoreSpecialCodeRequest;
use Modules\CetakLabel\Http\Requests\SpecialCode\UpdateSpecialCodeRequest;
class SpecialCodeController extends Controller
{
public $user;
public function __construct()
{
$this->middleware(function ($request, $next) {
$this->user = Auth::guard('web')->user();
return $next($request);
});
}
/**
* Display a listing of the resource.
*/
public function index(SpecialCodeDataTable $dataTable)
{
if (is_null($this->user) || !$this->user->can('masters.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
return $dataTable->render('cetaklabel::masters.special-code.index');
}
/**
* Store a newly created resource in storage.
*/
public function store(StoreSpecialCodeRequest $request)
{
if (is_null($this->user) || !$this->user->can('masters.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}
// Validate the request...
$validated = $request->validated();
// Store the Special Code...
if ($validated) {
try {
SpecialCode::create($validated);
echo json_encode(['status' => 'success', 'message' => 'Special Code created successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Special Code created failed.']);
}
return;
}
echo json_encode(['status' => 'error', 'message' => 'Special Code created failed.']);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
if (is_null($this->user) || !$this->user->can('masters.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}
abort(404);
}
/**
* Display the specified resource.
*/
public function show(SpecialCode $special_code)
{
if (is_null($this->user) || !$this->user->can('masters.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
abort(404);
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
if (is_null($this->user) || !$this->user->can('masters.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}
$special_code = SpecialCode::find($id);
echo json_encode($special_code);
}
/**
* Update the specified resource in storage.
*/
public function update(UpdateSpecialCodeRequest $request, SpecialCode $special_code)
{
if (is_null($this->user) || !$this->user->can('masters.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}
// Validate the request...
$validated = $request->validated();
// Update the Directorat...
if ($validated) {
try {
$special_code->update($validated);
echo json_encode(['status' => 'success', 'message' => 'Special Code updated successfully.']);
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Special Code updated failed.']);
}
return;
}
echo json_encode(['status' => 'error', 'message' => 'Special Code updated failed.']);
}
/**
* Remove the specified resource from storage.
*/
public function destroy(SpecialCode $special_code)
{
if (is_null($this->user) || !$this->user->can('masters.delete')) {
abort(403, 'Sorry !! You are Unauthorized to delete any master data !');
}
$special_code->delete();
echo json_encode(['status' => 'success', 'message' => 'Special Code deleted successfully.']);
}
}

View File

@ -2,16 +2,15 @@
namespace Modules\CetakLabel\Http\Controllers;
use App\DataTables\SubDirectoratDataTable;
use App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\StoreSubDirectoratRequest;
use App\Http\Requests\UpdateSubDirectoratRequest;
use App\Models\SubDirectorat;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Modules\CetakLabel\DataTables\SubDirectoratDataTable;
use Modules\CetakLabel\Entities\Directorat;
use function App\Http\Controllers\show_404;
use Modules\CetakLabel\Entities\SubDirectorat;
use Modules\CetakLabel\Http\Requests\SubDirectorat\StoreSubDirectoratRequest;
use Modules\CetakLabel\Http\Requests\SubDirectorat\UpdateSubDirectoratRequest;
class SubDirectoratController extends Controller
{
@ -28,8 +27,8 @@
/**
* Display a listing of the Sub Directorats.
*
* @param \App\DataTables\SubDirectoratDataTable $dataTable
* @param \Illuminate\Http\Request $request
* @param \Modules\CetakLabel\DataTables\SubDirectoratDataTable $dataTable
* @param \Illuminate\Http\Request $request
*
* @return mixed|void
*/
@ -45,7 +44,7 @@
}
$directorat = Directorat::all();
return $dataTable->render('pages.masters.sub-directorat.index', compact('directorat'));
return $dataTable->render('cetaklabel::masters.sub-directorat.index', compact('directorat'));
}
/**
@ -74,7 +73,7 @@
/**
* Store a newly created Sub Directorat in storage.
*
* @param \App\Http\Requests\StoreSubDirectoratRequest $request
* @param \Modules\CetakLabel\Http\Requests\SubDirectorat\StoreSubDirectoratRequest $request
*
* @return void
*/
@ -95,6 +94,7 @@
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Sub Directorat created failed.']);
}
return;
}
echo json_encode(['status' => 'error', 'message' => 'Sub Directorat created failed.']);
@ -109,7 +109,7 @@
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}
show_404();
abort(404);
}
/**
@ -132,8 +132,8 @@
/**
* Update the specified Sub Directorat in storage.
*
* @param \App\Http\Requests\UpdateSubDirectoratRequest $request
* @param \App\Models\SubDirectorat $subDirectorat
* @param \Modules\CetakLabel\Http\Requests\SubDirectorat\UpdateSubDirectoratRequest $request
* @param \Modules\CetakLabel\Entities\SubDirectorat $subDirectorat
*
* @return void
*/
@ -154,6 +154,7 @@
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Sub Directorat updated failed.']);
}
return;
}
echo json_encode(['status' => 'error', 'message' => 'Sub Directorat updated failed.']);
@ -162,7 +163,7 @@
/**
* Remove the specified Sub Directorat from storage.
*
* @param \App\Models\SubDirectorat $subDirectorat
* @param \Modules\CetakLabel\Entities\SubDirectorat $subDirectorat
*
* @return void
*/

View File

@ -1,14 +1,16 @@
<?php
namespace App\Http\Controllers;
namespace Modules\CetakLabel\Http\Controllers;
use App\DataTables\SubJobDataTable;
use App\Http\Requests\StoreSubJobRequest;
use App\Http\Requests\UpdateSubJobRequest;
use App\Models\SubJob;
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Modules\CetakLabel\DataTables\SubJobDataTable;
use Modules\CetakLabel\Entities\Directorat;
use Modules\CetakLabel\Entities\SubJob;
use Modules\CetakLabel\Http\Requests\SubJob\StoreSubJobRequest;
use Modules\CetakLabel\Http\Requests\SubJob\UpdateSubJobRequest;
class SubJobController extends Controller
{
@ -25,8 +27,8 @@
/**
* Display a listing of the Sub Jobs.
*
* @param \App\DataTables\SubJobDataTable $dataTable
* @param \Illuminate\Http\Request $request
* @param \Modules\CetakLabel\DataTables\SubJobDataTable $dataTable
* @param \Illuminate\Http\Request $request
*
* @return mixed|void
*/
@ -44,7 +46,7 @@
}
$directorat = Directorat::all();
return $dataTable->render('pages.masters.sub-job.index', compact('directorat'));
return $dataTable->render('cetaklabel::masters.sub-job.index', compact('directorat'));
}
/**
@ -56,6 +58,10 @@
*/
public function show(Request $request)
{
if (is_null($this->user) || !$this->user->can('masters.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
$subJob = SubJob::where('job_id', $request->job_id)->get();
$data = [];
@ -73,7 +79,7 @@
/**
* Store a newly created Sub Job in storage.
*
* @param \App\Http\Requests\StoreSubJobRequest $request
* @param \Modules\CetakLabel\Http\Requests\SubJob\StoreSubJobRequest $request
*
* @return void
*/
@ -94,6 +100,7 @@
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Sub Job created failed.']);
}
return;
}
echo json_encode(['status' => 'error', 'message' => 'Sub Job created failed.']);
@ -110,7 +117,7 @@
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}
show_404();
abort(404);
}
/**
@ -133,8 +140,8 @@
/**
* Update the specified Sub Job in storage.
*
* @param \App\Http\Requests\UpdateSubJobRequest $request
* @param \App\Models\SubJob $subJob
* @param \Modules\CetakLabel\Http\Requests\SubJob\UpdateSubJobRequest $request
* @param \Modules\CetakLabel\Entities\SubJob $subJob
*
* @return false
*/
@ -155,6 +162,7 @@
} catch (Exception $e) {
echo json_encode(['status' => 'error', 'message' => 'Sub Job updated failed.']);
}
return;
}
echo json_encode(['status' => 'error', 'message' => 'Sub Job updated failed.']);
@ -163,7 +171,7 @@
/**
* Remove the specified Sub Job from storage.
*
* @param \App\Models\SubJob $subJob
* @param \Modules\CetakLabel\Entities\SubJob $subJob
*
* @return void
*/

View File

@ -1,14 +1,16 @@
<?php
namespace App\Http\Controllers;
namespace Modules\CetakLabel\Http\Controllers;
use App\DataTables\SubSubJobDataTable;
use App\Http\Requests\StoreSubSubJobRequest;
use App\Http\Requests\UpdateSubSubJobRequest;
use App\Models\SubSubJob;
use App\Http\Controllers\Controller;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Modules\CetakLabel\DataTables\SubSubJobDataTable;
use Modules\CetakLabel\Entities\Directorat;
use Modules\CetakLabel\Entities\SubSubJob;
use Modules\CetakLabel\Http\Requests\SubSubJob\StoreSubSubJobRequest;
use Modules\CetakLabel\Http\Requests\SubSubJob\UpdateSubSubJobRequest;
class SubSubJobController extends Controller
{
@ -25,8 +27,8 @@
/**
* Display a listing of the Sub Sub Jobs.
*
* @param \App\DataTables\SubSubJobDataTable $dataTable
* @param \Illuminate\Http\Request $request
* @param \Modules\CetakLabel\DataTables\SubSubJobDataTable $dataTable
* @param \Illuminate\Http\Request $request
*
* @return mixed|void
*/
@ -44,7 +46,7 @@
addVendor('chained-select');
$directorat = Directorat::all();
return $dataTable->render('pages.masters.sub-sub-job.index', compact('directorat'));
return $dataTable->render('cetaklabel::masters.sub-sub-job.index', compact('directorat'));
}
/**
@ -56,6 +58,10 @@
*/
public function show(Request $request)
{
if (is_null($this->user) || !$this->user->can('masters.read')) {
abort(403, 'Sorry !! You are Unauthorized to view any master data !');
}
$subSubJob = SubSubJob::where('sub_job_id', $request->sub_job_id)->get();
$data = [];
@ -73,15 +79,15 @@
/**
* Store a newly created Sub Sub Job in storage.
*
* @param \App\Http\Requests\StoreSubSubJobRequest $request
* @param \Modules\CetakLabel\Http\Requests\SubSubJob\StoreSubSubJobRequest $request
*
* @return false
*/
public function store(StoreSubSubJobRequest $request)
{
/*if (is_null($this->user) || !$this->user->can('masters.create')) {
if (is_null($this->user) || !$this->user->can('masters.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}*/
}
// Validate the request...
@ -91,27 +97,37 @@
if ($validated) {
try {
SubSubJob::create($validated);
//return redirect()->route('job.index')->with('success', 'SubSubJob created successfully.');
echo json_encode(['status' => 'success', 'message' => 'Sub Sub Job created successfully.']);
} catch (Exception $e) {
//return redirect()->route('job.index')->with('error', 'SubSubJob created failed.');
echo json_encode(['status' => 'error', 'message' => 'Sub Sub Job created failed.']);
}
return;
}
return false;
echo json_encode(['status' => 'error', 'message' => 'Sub Sub Job created failed.']);
}
/**
* Show the form for creating a new resource.
*/
public function create() { }
public function create()
{
if (is_null($this->user) || !$this->user->can('masters.create')) {
abort(403, 'Sorry !! You are Unauthorized to create any master data !');
}
abort(404);
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
if (is_null($this->user) || !$this->user->can('masters.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}
$subJob = SubSubJob::find($id);
echo json_encode($subJob);
}
@ -121,9 +137,9 @@
*/
public function update(UpdateSubSubJobRequest $request, SubSubJob $subSubJob)
{
/*if (is_null($this->user) || !$this->user->can('masters.update')) {
if (is_null($this->user) || !$this->user->can('masters.update')) {
abort(403, 'Sorry !! You are Unauthorized to update any master data !');
}*/
}
// Validate the request...
$validated = $request->validated();
@ -149,6 +165,5 @@
{
$subSubJob->delete();
echo json_encode(['status' => 'success', 'message' => 'Sub Sub Job deleted successfully.']);
//return redirect()->route('sub-job.index')->with('success', 'Sub Sub Job deleted successfully.');
}
}

View File

@ -13,8 +13,7 @@
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
public function authorize(): bool
{
return true;
}
@ -24,8 +23,7 @@
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules()
: array
public function rules(): array
{
return [
'kode' => 'required|string|max:2|min:2|unique:directorats,kode',
@ -36,30 +34,30 @@
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator)
: void
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if ($validator->errors()->any()) {
$errors = json_decode($validator->errors()->toJson(), true);
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$errors = json_decode ($validator->errors ()->toJson (), true);
foreach ($errors as $key => $value) {
flash($value[0]);
flash ($value[0]);
}
return redirect()->route('directorat.index')->with('error', 'Directorat created failed.');
return redirect ()->route ('directorat.index')->with ('error', 'Directorat created failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator)
: JsonResponse
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors();
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(
response()->json(['success' => false, 'errors' => $errors, 'messages' => 'Directorat created failed.'], JsonResponse::HTTP_UNPROCESSABLE_ENTITY)
);
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Directorat created failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -51,13 +51,14 @@
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator)
: JsonResponse
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors();
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(
response()->json(['success' => false, 'errors' => $errors, 'messages' => 'Directorat updated failed.'], JsonResponse::HTTP_UNPROCESSABLE_ENTITY)
);
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Directorat updated failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -1,17 +1,19 @@
<?php
namespace App\Http\Requests;
namespace Modules\CetakLabel\Http\Requests\Document;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
use Symfony\Component\HttpFoundation\JsonResponse;
class StoreDocumentRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
public function authorize(): bool
{
return true;
}
@ -21,8 +23,7 @@
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules()
: array
public function rules(): array
{
return [
'kode' => 'required|string|unique:documents,kode',
@ -33,7 +34,7 @@
'sub_sub_job_id' => 'required|integer|exists:sub_sub_jobs,id',
'special_code_id' => 'nullable|integer|exists:special_codes,id',
'no_urut' => 'nullable|integer|min:1|max:999',
'sequence' => 'nullable|integer|min:1|max:999',
'sequence' => 'nullable|integer|min:1|max:999',
'status' => 'nullable|integer',
'keterangan' => 'nullable|string|max:255',
'jenis_dokumen' => 'nullable|string|max:255',
@ -43,18 +44,28 @@
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator)
: void
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if ($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash($value[0]);
flash ($value[0]);
}
return redirect()->route('document.index')->with('error', 'Document created failed.');
return redirect ()->route ('document.index')->with ('error', 'Document created failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Document created failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -1,8 +1,11 @@
<?php
namespace App\Http\Requests;
namespace Modules\CetakLabel\Http\Requests\Document;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
class UpdateDocumentRequest extends FormRequest
@ -10,8 +13,7 @@
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
public function authorize(): bool
{
return true;
}
@ -21,11 +23,10 @@
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules()
: array
public function rules(): array
{
return [
'kode' => 'required|string|unique:documents,kode,' . $this->id,
'kode' => 'required|string|unique:documents,kode,' . $this->document->id,
'directorat_id' => 'required|integer|exists:directorats,id',
'sub_directorat_id' => 'required|integer|exists:sub_directorats,id',
'job_id' => 'required|integer|exists:jobs,id',
@ -43,18 +44,28 @@
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator)
: void
public function withValidator(Validator $validator): void
{
$validator->after(function (Validator $validator) {
if ($validator->errors()->any()) {
$error = json_decode($validator->errors()->toJson(), true);
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash($value[0]);
flash ($value[0]);
}
return redirect()->route('document.index')->with('error', 'Document updated failed.');
return redirect ()->route ('document.index')->with ('error', 'Document updated failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Document updated failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Modules\CetakLabel\Http\Requests\DocumentType;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
use Symfony\Component\HttpFoundation\JsonResponse;
class StoreDocumentTypeRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'kode' => 'required|string|max:2|min:2|unique:document_types,kode',
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash ($value[0]);
}
return redirect ()->route ('document-type.index')->with ('error', 'Document Type created failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Document Type created failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Modules\CetakLabel\Http\Requests\DocumentType;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
class UpdateDocumentTypeRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'kode' => 'required|string|max:2|min:2|unique:document_types,kode,' . $this->document_type->id,
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash ($value[0]);
}
return redirect ()->route ('document-type.index')->with ('error', 'Document Type updated failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Document Type updated failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace Modules\CetakLabel\Http\Requests\Job;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
use Symfony\Component\HttpFoundation\JsonResponse;
class StoreJobRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required|exists:directorats,id',
'sub_directorat_id' => 'required|exists:sub_directorats,id',
'kode' => 'required|string|max:2|min:2|unique:jobs,kode',
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash ($value[0]);
}
return redirect ()->route ('job.index')->with ('error', 'Job created failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Job created failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace Modules\CetakLabel\Http\Requests\Job;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
class UpdateJobRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'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'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash ($value[0]);
}
return redirect ()->route ('jobs.index')->with ('error', 'Job updated failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Job updated failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Modules\CetakLabel\Http\Requests\SpecialCode;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
use Symfony\Component\HttpFoundation\JsonResponse;
class StoreSpecialCodeRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'kode' => 'required|string|max:2|min:2|unique:special_codes,kode',
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash ($value[0]);
}
return redirect ()->route ('special-code.index')->with ('error', 'Special Code created failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Special Code created failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace Modules\CetakLabel\Http\Requests\SpecialCode;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
class UpdateSpecialCodeRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'kode' => 'required|string|max:2|min:2|unique:special_codes,kode,' . $this->special_code->id,
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash ($value[0]);
}
return redirect ()->route ('special-code.index')->with ('error', 'Special Code updated failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Special Code updated failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace Modules\CetakLabel\Http\Requests\SubDirectorat;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
use Symfony\Component\HttpFoundation\JsonResponse;
class StoreSubDirectoratRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required',
'kode' => 'required|string|max:2|min:2|unique:sub_directorats',
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash ($value[0]);
}
return redirect ()->route ('sub-directorat.index')->with ('error', 'Sub Directorat created failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Sub Directorat created failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace Modules\CetakLabel\Http\Requests\SubDirectorat;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
class UpdateSubDirectoratRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
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'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash ($value[0]);
}
return redirect ()->route ('sub-directorat.index')->with ('error', 'Sub Directorat updated failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Sub Directorat updated failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace Modules\CetakLabel\Http\Requests\SubJob;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
use Symfony\Component\HttpFoundation\JsonResponse;
class StoreSubJobRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required|exists:directorats,id',
'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',
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash ($value[0]);
}
return redirect ()->route ('job.index')->with ('error', 'Sub Job created failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Sub Job created failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -0,0 +1,64 @@
<?php
namespace Modules\CetakLabel\Http\Requests\SubJob;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
class UpdateSubJobRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required|exists:directorats,id',
'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'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash ($value[0]);
}
return redirect ()->route ('jobs.index')->with ('error', 'Sub Job updated failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Sub Job updated failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace Modules\CetakLabel\Http\Requests\SubSubJob;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
use Symfony\Component\HttpFoundation\JsonResponse;
class StoreSubSubJobRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required|exists:directorats,id',
'sub_directorat_id' => 'required|exists:sub_directorats,id',
'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',
'name' => 'required|string|max:50'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash ($value[0]);
}
return redirect ()->route ('job.index')->with ('error', 'Sub Sub Job created failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Sub Sub Job created failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace Modules\CetakLabel\Http\Requests\SubSubJob;
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\JsonResponse;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;
class UpdateSubSubJobRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, Rule|array|string>
*/
public function rules(): array
{
return [
'directorat_id' => 'required|exists:directorats,id',
'sub_directorat_id' => 'required|exists:sub_directorats,id',
'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'
];
}
/**
* Configure the validator instance.
*/
public function withValidator(Validator $validator): void
{
$validator->after (function (Validator $validator) {
if ($validator->errors ()->any ()) {
$error = json_decode ($validator->errors ()->toJson (), true);
foreach ($error as $key => $value) {
flash ($value[0]);
}
return redirect ()->route ('jobs.index')->with ('error', 'Sub Sub Job updated failed.');
}
});
}
protected function failedValidation(Validator|\Illuminate\Contracts\Validation\Validator $validator): JsonResponse
{
$errors = (new ValidationException($validator))->errors ();
throw new HttpResponseException(response ()->json ([
'success' => false,
'errors' => $errors,
'messages' => 'Sub Sub Job updated failed.'
], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
}
}

View File

@ -8,7 +8,7 @@
</h3>
</div>
<div class="card-body pt-6">
@include('pages.app.document._form')
@include('cetaklabel::app.document._form')
</div>
<!--end::Card body-->
</div>

View File

@ -8,7 +8,7 @@
</h3>
</div>
<div class="card-body pt-6">
@include('pages.app.document._edit')
@include('app.document._edit')
</div>
<!--end::Card body-->
</div>

View File

@ -83,7 +83,7 @@
</div>
</div>
<div class="card-body pt-6">
@include('pages.app.document._table')
@include('cetaklabel::app.document._table')
</div>
<!--end::Card body-->
</div>

View File

@ -16,8 +16,8 @@
<rect opacity="0.5" x="17.0365" y="15.1223" width="8.15546" height="2" rx="1"
transform="rotate(45 17.0365 15.1223)" fill="currentColor"></rect>
<path
d="M11 19C6.55556 19 3 15.4444 3 11C3 6.55556 6.55556 3 11 3C15.4444 3 19 6.55556 19 11C19 15.4444 15.4444 19 11 19ZM11 5C7.53333 5 5 7.53333 5 11C5 14.4667 7.53333 17 11 17C14.4667 17 17 14.4667 17 11C17 7.53333 14.4667 5 11 5Z"
fill="currentColor"></path>
d="M11 19C6.55556 19 3 15.4444 3 11C3 6.55556 6.55556 3 11 3C15.4444 3 19 6.55556 19 11C19 15.4444 15.4444 19 11 19ZM11 5C7.53333 5 5 7.53333 5 11C5 14.4667 7.53333 17 11 17C14.4667 17 17 14.4667 17 11C17 7.53333 14.4667 5 11 5Z"
fill="currentColor"></path>
</svg>
</span>
<!--end::Svg Icon-->
@ -88,8 +88,8 @@
</div>
</div>
<div class="card-body pt-6">
@include('pages.masters.document-type._table')
@include('pages.masters.document-type._form')
@include('cetaklabel::masters.document-type._table')
@include('cetaklabel::masters.document-type._form')
</div>
<!--end::Card body-->
</div>

View File

@ -83,8 +83,8 @@
</div>
</div>
<div class="card-body pt-6">
@include('pages.masters.job._table')
@include('pages.masters.job._form')
@include('cetaklabel::masters.job._table')
@include('cetaklabel::masters.job._form')
</div>
<!--end::Card body-->
</div>

View File

@ -88,8 +88,8 @@
</div>
</div>
<div class="card-body pt-6">
@include('pages.masters.special-code._table')
@include('pages.masters.special-code._form')
@include('cetaklabel::masters.special-code._table')
@include('cetaklabel::masters.special-code._form')
</div>
<!--end::Card body-->
</div>

View File

@ -88,8 +88,8 @@
</div>
</div>
<div class="card-body pt-6">
@include('pages.masters.sub-directorat._table')
@include('pages.masters.sub-directorat._form')
@include('cetaklabel::masters.sub-directorat._table')
@include('cetaklabel::masters.sub-directorat._form')
</div>
<!--end::Card body-->
</div>

View File

@ -83,8 +83,8 @@
</div>
</div>
<div class="card-body pt-6">
@include('pages.masters.sub-job._table')
@include('pages.masters.sub-job._form')
@include('cetaklabel::masters.sub-job._table')
@include('cetaklabel::masters.sub-job._form')
</div>
<!--end::Card body-->
</div>

View File

@ -83,8 +83,8 @@
</div>
</div>
<div class="card-body pt-6">
@include('pages.masters.sub-sub-job._table')
@include('pages.masters.sub-sub-job._form')
@include('cetaklabel::masters.sub-sub-job._table')
@include('cetaklabel::masters.sub-sub-job._form')
</div>
<!--end::Card body-->
</div>

View File

@ -1,6 +1,11 @@
<?php
use Modules\CetakLabel\Http\Controllers\Api\DirectoratController;
use Modules\CetakLabel\Http\Controllers\Api\JobController;
use Modules\CetakLabel\Http\Controllers\Api\SpecialCodeController;
use Modules\CetakLabel\Http\Controllers\Api\SubDirectoratController;
use Modules\CetakLabel\Http\Controllers\Api\SubJobController;
use Modules\CetakLabel\Http\Controllers\Api\SubSubJobController;
/*
|--------------------------------------------------------------------------
@ -20,9 +25,10 @@
Route::domain($module->domain)->group(function (){
Route::middleware('auth:sanctum')->group(function (){
Route::resource('directorats', DirectoratController::class);
Route::get('test-sama', function(){
return 'cetaklabel-api';
});
Route::resource('sub-directorats', SubDirectoratController::class);
Route::resource('jobs', JobController::class);
Route::resource('sub-jobs', SubJobController::class);
Route::resource('sub-sub-jobs', SubSubJobController::class);
Route::resource('special-codes', SpecialCodeController::class);
});
});

View File

@ -11,11 +11,20 @@
|
*/
use Modules\CetakLabel\Http\Controllers\DirectoratController;
use Modules\CetakLabel\Http\Controllers\DirectoratController;
Route::domain('cetaklabel.io')->group(function () {
Route::group(['middleware' => ['auth', 'verified']], function () {
Route::resource('directorat', DirectoratController::class);
Route::resource('sub-directorat', SubDirectoratController::class);
Route::resource('job', JobController::class);
Route::resource('sub-job', SubJobController::class);
Route::resource('sub-sub-job', SubSubJobController::class);
Route::resource('special-code', SpecialCodeController::class);
Route::resource('document-type', DocumentTypeController::class);
Route::resource('document', DocumentController::class);
//Route::resource('document-detail', DOcumentDetailController::class);
});
});

@ -0,0 +1 @@
Subproject commit b9b8b1853974b6bf7dfe3ecb8da9d8a410757f77

View File

View File

@ -0,0 +1,5 @@
<?php
return [
'name' => 'UserManager'
];

View File

View File

@ -0,0 +1,21 @@
<?php
namespace Modules\UserManager\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class UserManagerDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// $this->call("OthersTableSeeder");
}
}

View File

View File

@ -0,0 +1,79 @@
<?php
namespace Modules\UserManager\Http\Controllers;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
class UserManagerController extends Controller
{
/**
* Display a listing of the resource.
* @return Renderable
*/
public function index()
{
return view('usermanager::index');
}
/**
* Show the form for creating a new resource.
* @return Renderable
*/
public function create()
{
return view('usermanager::create');
}
/**
* Store a newly created resource in storage.
* @param Request $request
* @return Renderable
*/
public function store(Request $request)
{
//
}
/**
* Show the specified resource.
* @param int $id
* @return Renderable
*/
public function show($id)
{
return view('usermanager::show');
}
/**
* Show the form for editing the specified resource.
* @param int $id
* @return Renderable
*/
public function edit($id)
{
return view('usermanager::edit');
}
/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Renderable
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
* @param int $id
* @return Renderable
*/
public function destroy($id)
{
//
}
}

Some files were not shown because too many files have changed in this diff Show More