From 82fa06d83201ec102ae684940313ab0ac83b19c1 Mon Sep 17 00:00:00 2001 From: Daeng Deni Mardaeni Date: Mon, 15 May 2023 17:03:46 +0700 Subject: [PATCH] Module Cetak Label --- Config/.gitkeep | 0 Config/config.php | 5 + Config/database.php | 112 +++++ Console/.gitkeep | 0 DataTables/DirectoratDataTable.php | 91 ++++ DataTables/DocumentDataTable.php | 125 ++++++ DataTables/DocumentTypeDataTable.php | 86 ++++ DataTables/JobDataTable.php | 96 +++++ DataTables/SpecialCodeDataTable.php | 86 ++++ DataTables/SubDirectoratDataTable.php | 91 ++++ DataTables/SubJobDataTable.php | 101 +++++ DataTables/SubSubJobDataTable.php | 106 +++++ Database/Migrations/.gitkeep | 0 ..._04_10_024720_create_directorats_table.php | 34 ++ ...10_024731_create_sub_directorats_table.php | 35 ++ .../2023_04_10_024809_create_jobs_table.php | 36 ++ ...023_04_10_024820_create_sub_jobs_table.php | 37 ++ ...04_14_034926_create_sub_sub_jobs_table.php | 38 ++ ..._17_130450_create_document_types_table.php | 34 ++ ...4_17_130450_create_special_codes_table.php | 34 ++ ...23_04_17_135901_create_documents_table.php | 52 +++ ...7_135930_create_document_details_table.php | 54 +++ Database/Seeders/.gitkeep | 0 Database/Seeders/CetakLabelDatabaseSeeder.php | 23 ++ Database/Seeders/CetakLabelSeeder.php | 68 +++ Database/factories/.gitkeep | 0 Entities/.gitkeep | 0 Entities/BaseModel.php | 34 ++ Entities/Directorat.php | 14 + Entities/Document.php | 55 +++ Entities/DocumentDetail.php | 36 ++ Entities/DocumentType.php | 16 + Entities/Job.php | 30 ++ Entities/SpecialCode.php | 17 + Entities/SubDirectorat.php | 27 ++ Entities/SubJob.php | 35 ++ Entities/SubSubJob.php | 36 ++ Http/Controllers/.gitkeep | 0 Http/Controllers/Api/DirectoratController.php | 84 ++++ Http/Controllers/Api/JobController.php | 84 ++++ .../Controllers/Api/SpecialCodeController.php | 84 ++++ .../Api/SubDirectoratController.php | 84 ++++ Http/Controllers/Api/SubJobController.php | 84 ++++ Http/Controllers/Api/SubSubJobController.php | 84 ++++ Http/Controllers/DirectoratController.php | 160 ++++++++ Http/Controllers/DocumentController.php | 191 +++++++++ Http/Controllers/DocumentTypeController.php | 143 +++++++ Http/Controllers/JobController.php | 186 +++++++++ Http/Controllers/SpecialCodeController.php | 142 +++++++ Http/Controllers/SubDirectoratController.php | 179 ++++++++ Http/Controllers/SubJobController.php | 187 +++++++++ Http/Controllers/SubSubjobController.php | 169 ++++++++ Http/Middleware/.gitkeep | 0 Http/Requests/.gitkeep | 0 .../Directorat/StoreDirectoratRequest.php | 63 +++ .../Directorat/UpdateDirectoratRequest.php | 64 +++ .../Document/StoreDocumentRequest.php | 71 ++++ .../Document/UpdateDocumentRequest.php | 71 ++++ .../DocumentType/StoreDocumentTypeRequest.php | 61 +++ .../UpdateDocumentTypeRequest.php | 61 +++ Http/Requests/Job/StoreJobRequest.php | 63 +++ Http/Requests/Job/UpdateJobRequest.php | 63 +++ .../SpecialCode/StoreSpecialCodeRequest.php | 61 +++ .../SpecialCode/UpdateSpecialCodeRequest.php | 61 +++ .../StoreSubDirectoratRequest.php | 62 +++ .../UpdateSubDirectoratRequest.php | 62 +++ Http/Requests/SubJob/StoreSubJobRequest.php | 64 +++ Http/Requests/SubJob/UpdateSubJobRequest.php | 64 +++ .../SubSubJob/StoreSubSubJobRequest.php | 66 +++ .../SubSubJob/UpdateSubSubJobRequest.php | 66 +++ Providers/.gitkeep | 0 Providers/CetakLabelServiceProvider.php | 128 ++++++ Providers/RouteServiceProvider.php | 69 ++++ Resources/lang/.gitkeep | 0 Resources/views/.gitkeep | 0 .../views/app/document/_action.blade.php | 13 + Resources/views/app/document/_edit.blade.php | 223 ++++++++++ Resources/views/app/document/_form.blade.php | 388 ++++++++++++++++++ Resources/views/app/document/_table.blade.php | 100 +++++ Resources/views/app/document/create.blade.php | 16 + Resources/views/app/document/edit.blade.php | 16 + Resources/views/app/document/index.blade.php | 91 ++++ .../masters/directorat/_action.blade.php | 13 + .../views/masters/directorat/_form.blade.php | 70 ++++ .../views/masters/directorat/_table.blade.php | 116 ++++++ .../views/masters/directorat/index.blade.php | 131 ++++++ .../masters/document-type/_action.blade.php | 13 + .../masters/document-type/_form.blade.php | 71 ++++ .../masters/document-type/_table.blade.php | 117 ++++++ .../masters/document-type/index.blade.php | 136 ++++++ Resources/views/masters/job/_action.blade.php | 13 + Resources/views/masters/job/_form.blade.php | 102 +++++ Resources/views/masters/job/_table.blade.php | 118 ++++++ Resources/views/masters/job/index.blade.php | 137 +++++++ .../masters/special-code/_action.blade.php | 13 + .../masters/special-code/_form.blade.php | 71 ++++ .../masters/special-code/_table.blade.php | 117 ++++++ .../masters/special-code/index.blade.php | 136 ++++++ .../masters/sub-directorat/_action.blade.php | 13 + .../masters/sub-directorat/_form.blade.php | 87 ++++ .../masters/sub-directorat/_table.blade.php | 118 ++++++ .../masters/sub-directorat/index.blade.php | 136 ++++++ .../views/masters/sub-job/_action.blade.php | 13 + .../views/masters/sub-job/_form.blade.php | 116 ++++++ .../views/masters/sub-job/_table.blade.php | 119 ++++++ .../views/masters/sub-job/index.blade.php | 143 +++++++ .../masters/sub-sub-job/_action.blade.php | 13 + .../views/masters/sub-sub-job/_form.blade.php | 130 ++++++ .../masters/sub-sub-job/_table.blade.php | 120 ++++++ .../views/masters/sub-sub-job/index.blade.php | 149 +++++++ Routes/.gitkeep | 0 Routes/api.php | 34 ++ Routes/web.php | 31 ++ Tests/Feature/.gitkeep | 0 Tests/Unit/.gitkeep | 0 composer.json | 24 ++ module.json | 14 + package.json | 16 + vite.config.js | 24 ++ 119 files changed, 8246 insertions(+) create mode 100644 Config/.gitkeep create mode 100644 Config/config.php create mode 100644 Config/database.php create mode 100644 Console/.gitkeep create mode 100644 DataTables/DirectoratDataTable.php create mode 100644 DataTables/DocumentDataTable.php create mode 100644 DataTables/DocumentTypeDataTable.php create mode 100644 DataTables/JobDataTable.php create mode 100644 DataTables/SpecialCodeDataTable.php create mode 100644 DataTables/SubDirectoratDataTable.php create mode 100644 DataTables/SubJobDataTable.php create mode 100644 DataTables/SubSubJobDataTable.php create mode 100644 Database/Migrations/.gitkeep create mode 100644 Database/Migrations/2023_04_10_024720_create_directorats_table.php create mode 100644 Database/Migrations/2023_04_10_024731_create_sub_directorats_table.php create mode 100644 Database/Migrations/2023_04_10_024809_create_jobs_table.php create mode 100644 Database/Migrations/2023_04_10_024820_create_sub_jobs_table.php create mode 100644 Database/Migrations/2023_04_14_034926_create_sub_sub_jobs_table.php create mode 100644 Database/Migrations/2023_04_17_130450_create_document_types_table.php create mode 100644 Database/Migrations/2023_04_17_130450_create_special_codes_table.php create mode 100644 Database/Migrations/2023_04_17_135901_create_documents_table.php create mode 100644 Database/Migrations/2023_04_17_135930_create_document_details_table.php create mode 100644 Database/Seeders/.gitkeep create mode 100644 Database/Seeders/CetakLabelDatabaseSeeder.php create mode 100644 Database/Seeders/CetakLabelSeeder.php create mode 100644 Database/factories/.gitkeep create mode 100644 Entities/.gitkeep create mode 100644 Entities/BaseModel.php create mode 100644 Entities/Directorat.php create mode 100644 Entities/Document.php create mode 100644 Entities/DocumentDetail.php create mode 100644 Entities/DocumentType.php create mode 100644 Entities/Job.php create mode 100644 Entities/SpecialCode.php create mode 100644 Entities/SubDirectorat.php create mode 100644 Entities/SubJob.php create mode 100644 Entities/SubSubJob.php create mode 100644 Http/Controllers/.gitkeep create mode 100644 Http/Controllers/Api/DirectoratController.php create mode 100644 Http/Controllers/Api/JobController.php create mode 100644 Http/Controllers/Api/SpecialCodeController.php create mode 100644 Http/Controllers/Api/SubDirectoratController.php create mode 100644 Http/Controllers/Api/SubJobController.php create mode 100644 Http/Controllers/Api/SubSubJobController.php create mode 100644 Http/Controllers/DirectoratController.php create mode 100644 Http/Controllers/DocumentController.php create mode 100644 Http/Controllers/DocumentTypeController.php create mode 100644 Http/Controllers/JobController.php create mode 100644 Http/Controllers/SpecialCodeController.php create mode 100644 Http/Controllers/SubDirectoratController.php create mode 100644 Http/Controllers/SubJobController.php create mode 100644 Http/Controllers/SubSubjobController.php create mode 100644 Http/Middleware/.gitkeep create mode 100644 Http/Requests/.gitkeep create mode 100644 Http/Requests/Directorat/StoreDirectoratRequest.php create mode 100644 Http/Requests/Directorat/UpdateDirectoratRequest.php create mode 100644 Http/Requests/Document/StoreDocumentRequest.php create mode 100644 Http/Requests/Document/UpdateDocumentRequest.php create mode 100644 Http/Requests/DocumentType/StoreDocumentTypeRequest.php create mode 100644 Http/Requests/DocumentType/UpdateDocumentTypeRequest.php create mode 100644 Http/Requests/Job/StoreJobRequest.php create mode 100644 Http/Requests/Job/UpdateJobRequest.php create mode 100644 Http/Requests/SpecialCode/StoreSpecialCodeRequest.php create mode 100644 Http/Requests/SpecialCode/UpdateSpecialCodeRequest.php create mode 100644 Http/Requests/SubDirectorat/StoreSubDirectoratRequest.php create mode 100644 Http/Requests/SubDirectorat/UpdateSubDirectoratRequest.php create mode 100644 Http/Requests/SubJob/StoreSubJobRequest.php create mode 100644 Http/Requests/SubJob/UpdateSubJobRequest.php create mode 100644 Http/Requests/SubSubJob/StoreSubSubJobRequest.php create mode 100644 Http/Requests/SubSubJob/UpdateSubSubJobRequest.php create mode 100644 Providers/.gitkeep create mode 100644 Providers/CetakLabelServiceProvider.php create mode 100644 Providers/RouteServiceProvider.php create mode 100644 Resources/lang/.gitkeep create mode 100644 Resources/views/.gitkeep create mode 100644 Resources/views/app/document/_action.blade.php create mode 100644 Resources/views/app/document/_edit.blade.php create mode 100644 Resources/views/app/document/_form.blade.php create mode 100644 Resources/views/app/document/_table.blade.php create mode 100644 Resources/views/app/document/create.blade.php create mode 100644 Resources/views/app/document/edit.blade.php create mode 100644 Resources/views/app/document/index.blade.php create mode 100644 Resources/views/masters/directorat/_action.blade.php create mode 100644 Resources/views/masters/directorat/_form.blade.php create mode 100644 Resources/views/masters/directorat/_table.blade.php create mode 100644 Resources/views/masters/directorat/index.blade.php create mode 100644 Resources/views/masters/document-type/_action.blade.php create mode 100644 Resources/views/masters/document-type/_form.blade.php create mode 100644 Resources/views/masters/document-type/_table.blade.php create mode 100644 Resources/views/masters/document-type/index.blade.php create mode 100644 Resources/views/masters/job/_action.blade.php create mode 100644 Resources/views/masters/job/_form.blade.php create mode 100644 Resources/views/masters/job/_table.blade.php create mode 100644 Resources/views/masters/job/index.blade.php create mode 100644 Resources/views/masters/special-code/_action.blade.php create mode 100644 Resources/views/masters/special-code/_form.blade.php create mode 100644 Resources/views/masters/special-code/_table.blade.php create mode 100644 Resources/views/masters/special-code/index.blade.php create mode 100644 Resources/views/masters/sub-directorat/_action.blade.php create mode 100644 Resources/views/masters/sub-directorat/_form.blade.php create mode 100644 Resources/views/masters/sub-directorat/_table.blade.php create mode 100644 Resources/views/masters/sub-directorat/index.blade.php create mode 100644 Resources/views/masters/sub-job/_action.blade.php create mode 100644 Resources/views/masters/sub-job/_form.blade.php create mode 100644 Resources/views/masters/sub-job/_table.blade.php create mode 100644 Resources/views/masters/sub-job/index.blade.php create mode 100644 Resources/views/masters/sub-sub-job/_action.blade.php create mode 100644 Resources/views/masters/sub-sub-job/_form.blade.php create mode 100644 Resources/views/masters/sub-sub-job/_table.blade.php create mode 100644 Resources/views/masters/sub-sub-job/index.blade.php create mode 100644 Routes/.gitkeep create mode 100644 Routes/api.php create mode 100644 Routes/web.php create mode 100644 Tests/Feature/.gitkeep create mode 100644 Tests/Unit/.gitkeep create mode 100644 composer.json create mode 100644 module.json create mode 100644 package.json create mode 100644 vite.config.js diff --git a/Config/.gitkeep b/Config/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Config/config.php b/Config/config.php new file mode 100644 index 0000000..1fb708a --- /dev/null +++ b/Config/config.php @@ -0,0 +1,5 @@ + 'CetakLabel' +]; diff --git a/Config/database.php b/Config/database.php new file mode 100644 index 0000000..efd4e79 --- /dev/null +++ b/Config/database.php @@ -0,0 +1,112 @@ + env('DB_CONNECTION', 'mysql'), + + /* + |-------------------------------------------------------------------------- + | Database Connections + |-------------------------------------------------------------------------- + | + | Here are each of the database connections setup for your application. + | Of course, examples of configuring each database platform that is + | supported by Laravel is shown below to make development simple. + | + | + | All database work in Laravel is done through the PHP PDO facilities + | so make sure you have the driver for your particular database of + | choice installed on your machine before you begin development. + | + */ + + 'connections' => [ + 'cetaklabel' => [ + 'driver' => 'mysql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => 'cetak', + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) : [], + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Migration Repository Table + |-------------------------------------------------------------------------- + | + | This table keeps track of all the migrations that have already run for + | your application. Using this information, we can determine which of + | the migrations on disk haven't actually been run in the database. + | + */ + + 'migrations' => 'migrations', + + /* + |-------------------------------------------------------------------------- + | Redis Databases + |-------------------------------------------------------------------------- + | + | Redis is an open source, fast, and advanced key-value store that also + | provides a richer body of commands than a typical key-value system + | such as APC or Memcached. Laravel makes it easy to dig right in. + | + */ + + 'redis' => [ + + 'client' => env('REDIS_CLIENT', 'phpredis'), + + 'options' => [ + 'cluster' => env('REDIS_CLUSTER', 'redis'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + ], + + 'default' => [ + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), + 'port' => env('REDIS_PORT', '6379'), + 'database' => env('REDIS_DB', '0'), + ], + + 'cache' => [ + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), + 'port' => env('REDIS_PORT', '6379'), + 'database' => env('REDIS_CACHE_DB', '1'), + ], + + ], + +]; diff --git a/Console/.gitkeep b/Console/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/DataTables/DirectoratDataTable.php b/DataTables/DirectoratDataTable.php new file mode 100644 index 0000000..295c79c --- /dev/null +++ b/DataTables/DirectoratDataTable.php @@ -0,0 +1,91 @@ +filter(function ($query) { + if (request()->has('search')) { + $search = request()->get('search'); + $query->where('kode', 'like', "%" . $search['value'] . "%") + ->orWhere('name', 'like', "%" . $search['value'] . "%"); + } + }) + ->addIndexColumn() + ->addColumn('action', 'cetaklabel::masters.directorat._action') + ->setRowId('id'); + } + + /** + * Get the query source of dataTable. + */ + public function query(Directorat $model) + : QueryBuilder + { + return $model->newQuery(); + } + + /** + * Optional method if you want to use the html builder. + */ + public function html() + : HtmlBuilder + { + return $this->builder() + ->setTableId('directorat-table') + ->columns($this->getColumns()) + ->minifiedAjax() + ->stateSave(false) + ->responsive() + ->autoWidth(true) + ->orderBy(1) + ->parameters([ + 'scrollX' => true, + 'drawCallback' => 'function() { KTMenu.createInstances(); }', + ]) + ->addTableClass('align-middle table-row-dashed fs-6 gy-5'); + } + + /** + * Get the dataTable columns definition. + */ + public function getColumns() + : array + { + return [ + Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false), + Column::make('kode'), + Column::make('name'), + Column::computed('action') + ->exportable(false) + ->printable(false) + ->width(60) + ->addClass('text-center'), + ]; + } + + /** + * Get the filename for export. + */ + protected function filename() + : string + { + return 'Directorat_' . date('YmdHis'); + } + } diff --git a/DataTables/DocumentDataTable.php b/DataTables/DocumentDataTable.php new file mode 100644 index 0000000..b5244b9 --- /dev/null +++ b/DataTables/DocumentDataTable.php @@ -0,0 +1,125 @@ +filter(function ($query) { + if (request()->has('search')) { + $search = request()->get('search'); + $query->where('kode', 'like', "%" . $search['value'] . "%"); + } + }) + ->addColumn('kode_directorat',function($model){ + return $model->directorat->kode; + }) + ->addColumn('name_directorat',function($model){ + return $model->directorat->name; + }) + ->addColumn('kode_sub_directorat',function($model){ + return $model->sub_directorat->kode; + }) + ->addColumn('name_sub_directorat',function($model){ + return $model->sub_directorat->name; + }) + ->addColumn('kode_pekerjaan',function($model){ + return $model->job->kode; + }) + ->addColumn('name_pekerjaan',function($model){ + return $model->job->name; + }) + ->addColumn('kode_sub_pekerjaan',function($model){ + return $model->sub_job->kode; + }) + ->addColumn('name_sub_pekerjaan',function($model){ + return $model->sub_job->name; + }) + ->addColumn('kode_sub_sub_pekerjaan',function($model){ + return $model->sub_sub_job->kode; + }) + ->addColumn('name_sub_sub_pekerjaan',function($model){ + return $model->sub_sub_job->name; + }) + ->addIndexColumn() + ->addColumn('action', 'cetaklabel::app.document._action') + ->setRowId('id'); + } + + /** + * Get the query source of dataTable. + */ + public function query(Document $model): QueryBuilder + { + return $model->newQuery(); + } + + /** + * Optional method if you want to use the html builder. + */ + public function html(): HtmlBuilder + { + return $this->builder() + ->setTableId('document-table') + ->columns($this->getColumns()) + ->minifiedAjax() + ->stateSave(false) + ->responsive() + ->autoWidth(true) + ->orderBy(1) + ->parameters([ + 'scrollX' => true, + 'drawCallback' => 'function() { KTMenu.createInstances(); }', + ]) + ->addTableClass('align-middle table-row-dashed fs-6 gy-5'); + } + + /** + * Get the dataTable columns definition. + */ + public function getColumns(): array + { + return [ + Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false), + Column::make('kode'), + Column::make('kode_directorat')->title('Kode Direktorat'), + Column::make('name_directorat')->title('Nama Direktorat'), + Column::make('kode_sub_directorat')->title('Kode Sub Direktorat'), + Column::make('name_sub_directorat')->title('Nama Sub Direktorat'), + Column::make('kode_pekerjaan')->title('Kode Pekerjaan'), + Column::make('name_pekerjaan')->title('Nama Pekerjaan'), + Column::make('kode_sub_pekerjaan')->title('Kode Sub Pekerjaan'), + Column::make('name_sub_pekerjaan')->title('Nama Sub Pekerjaan'), + Column::make('kode_sub_sub_pekerjaan')->title('Kode Sub Sub Pekerjaan'), + Column::make('name_sub_sub_pekerjaan')->title('Nama Sub Sub Pekerjaan'), + Column::make('status'), + Column::computed('action') + ->exportable(false) + ->printable(false) + ->width(60) + ->addClass('text-center'), + ]; + } + + /** + * Get the filename for export. + */ + protected function filename(): string + { + return 'Document_' . date('YmdHis'); + } +} diff --git a/DataTables/DocumentTypeDataTable.php b/DataTables/DocumentTypeDataTable.php new file mode 100644 index 0000000..9a04245 --- /dev/null +++ b/DataTables/DocumentTypeDataTable.php @@ -0,0 +1,86 @@ +filter(function ($query) { + if (request()->has('search')) { + $search = request()->get('search'); + $query->where('kode', 'like', "%" . $search['value'] . "%") + ->orWhere('name', 'like', "%" . $search['value'] . "%"); + } + }) + ->addIndexColumn() + ->addColumn('action', 'cetaklabel::masters.document-type._action') + ->setRowId('id'); + } + + /** + * Get the query source of dataTable. + */ + public function query(DocumentType $model): QueryBuilder + { + return $model->newQuery(); + } + + /** + * Optional method if you want to use the html builder. + */ + public function html(): HtmlBuilder + { + return $this->builder() + ->setTableId('document-type-table') + ->columns($this->getColumns()) + ->minifiedAjax() + ->stateSave(false) + ->responsive() + ->autoWidth(true) + ->orderBy(1) + ->parameters([ + 'scrollX' => true, + 'drawCallback' => 'function() { KTMenu.createInstances(); }', + ]) + ->addTableClass('align-middle table-row-dashed fs-6 gy-5'); + } + + /** + * Get the dataTable columns definition. + */ + public function getColumns(): array + { + return [ + Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false), + Column::make('kode'), + Column::make('name'), + Column::computed('action') + ->exportable(false) + ->printable(false) + ->width(60) + ->addClass('text-center'), + ]; + } + + /** + * Get the filename for export. + */ + protected function filename(): string + { + return 'Document_Type_' . date('YmdHis'); + } +} diff --git a/DataTables/JobDataTable.php b/DataTables/JobDataTable.php new file mode 100644 index 0000000..8596c11 --- /dev/null +++ b/DataTables/JobDataTable.php @@ -0,0 +1,96 @@ +filter(function ($query) { + if (request()->has('search')) { + $search = request()->get('search'); + $query->where('kode', 'like', "%" . $search['value'] . "%") + ->orWhere('name', 'like', "%" . $search['value'] . "%") + ->orWhereRelation('directorat', 'name', 'like', '%'.$search['value'].'%') + ->orWhereRelation('subDirectorat', 'name', 'like', '%'.$search['value'].'%'); + } + }) + ->addIndexColumn() + ->addColumn('directorat', function ($job) { + return $job->directorat->name; + }) + ->addColumn('sub_directorat', function ($job) { + return $job->subDirectorat->name; + }) + ->addColumn('action', 'cetaklabel::masters.job._action') + ->setRowId('id'); + } + + /** + * Get the query source of dataTable. + */ + public function query(Job $model): QueryBuilder + { + return $model->newQuery(); + } + + /** + * Optional method if you want to use the html builder. + */ + public function html(): HtmlBuilder + { + return $this->builder() + ->setTableId('job-table') + ->columns($this->getColumns()) + ->minifiedAjax() + ->stateSave(false) + ->responsive() + ->autoWidth(true) + ->orderBy(1) + ->parameters([ + 'scrollX' => true, + 'drawCallback' => 'function() { KTMenu.createInstances(); }', + ]) + ->addTableClass('align-middle table-row-dashed fs-6 gy-5'); + } + + /** + * Get the dataTable columns definition. + */ + public function getColumns(): array + { + return [ + Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false), + Column::make('directorat'), + Column::make('sub_directorat'), + Column::make('kode'), + Column::make('name'), + Column::computed('action') + ->exportable(false) + ->printable(false) + ->width(60) + ->addClass('text-center'), + ]; + } + + /** + * Get the filename for export. + */ + protected function filename(): string + { + return 'Job_' . date('YmdHis'); + } +} diff --git a/DataTables/SpecialCodeDataTable.php b/DataTables/SpecialCodeDataTable.php new file mode 100644 index 0000000..695c24a --- /dev/null +++ b/DataTables/SpecialCodeDataTable.php @@ -0,0 +1,86 @@ +filter(function ($query) { + if (request()->has('search')) { + $search = request()->get('search'); + $query->where('kode', 'like', "%" . $search['value'] . "%") + ->orWhere('name', 'like', "%" . $search['value'] . "%"); + } + }) + ->addIndexColumn() + ->addColumn('action', 'cetaklabel::masters.special-code._action') + ->setRowId('id'); + } + + /** + * Get the query source of dataTable. + */ + public function query(SpecialCode $model): QueryBuilder + { + return $model->newQuery(); + } + + /** + * Optional method if you want to use the html builder. + */ + public function html(): HtmlBuilder + { + return $this->builder() + ->setTableId('special-code-table') + ->columns($this->getColumns()) + ->minifiedAjax() + ->stateSave(false) + ->responsive() + ->autoWidth(true) + ->orderBy(1) + ->parameters([ + 'scrollX' => true, + 'drawCallback' => 'function() { KTMenu.createInstances(); }', + ]) + ->addTableClass('align-middle table-row-dashed fs-6 gy-5'); + } + + /** + * Get the dataTable columns definition. + */ + public function getColumns(): array + { + return [ + Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false), + Column::make('kode'), + Column::make('name'), + Column::computed('action') + ->exportable(false) + ->printable(false) + ->width(60) + ->addClass('text-center'), + ]; + } + + /** + * Get the filename for export. + */ + protected function filename(): string + { + return 'Special_Code_' . date('YmdHis'); + } +} diff --git a/DataTables/SubDirectoratDataTable.php b/DataTables/SubDirectoratDataTable.php new file mode 100644 index 0000000..5eb4559 --- /dev/null +++ b/DataTables/SubDirectoratDataTable.php @@ -0,0 +1,91 @@ +filter(function ($query) { + if (request()->has('search')) { + $search = request()->get('search'); + $query->where('kode', 'like', "%" . $search['value'] . "%") + ->orWhere('name', 'like', "%" . $search['value'] . "%") + ->orWhereRelation('directorat', 'name', 'like', '%'.$search['value'].'%'); + } + }) + ->addIndexColumn() + ->addColumn('directorat', function ($subDirectorat) { + return $subDirectorat->directorat->name; + }) + ->addColumn('action', 'cetaklabel::masters.sub-directorat._action') + ->setRowId('id'); + } + + /** + * Get the query source of dataTable. + */ + public function query(SubDirectorat $model): QueryBuilder + { + return $model->newQuery(); + } + + /** + * Optional method if you want to use the html builder. + */ + public function html(): HtmlBuilder + { + return $this->builder() + ->setTableId('sub-directorat-table') + ->columns($this->getColumns()) + ->minifiedAjax() + ->stateSave(false) + ->responsive() + ->autoWidth(true) + ->orderBy(1) + ->parameters([ + 'scrollX' => true, + 'drawCallback' => 'function() { KTMenu.createInstances(); }', + ]) + ->addTableClass('align-middle table-row-dashed fs-6 gy-5'); + } + + /** + * Get the dataTable columns definition. + */ + public function getColumns(): array + { + return [ + Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false), + Column::make('directorat'), + Column::make('kode'), + Column::make('name'), + Column::computed('action') + ->exportable(false) + ->printable(false) + ->width(60) + ->addClass('text-center'), + ]; + } + + /** + * Get the filename for export. + */ + protected function filename(): string + { + return 'Sub_Directorat_' . date('YmdHis'); + } +} diff --git a/DataTables/SubJobDataTable.php b/DataTables/SubJobDataTable.php new file mode 100644 index 0000000..39737f0 --- /dev/null +++ b/DataTables/SubJobDataTable.php @@ -0,0 +1,101 @@ +filter(function ($query) { + if (request()->has('search')) { + $search = request()->get('search'); + $query->where('kode', 'like', "%" . $search['value'] . "%") + ->orWhere('name', 'like', "%" . $search['value'] . "%") + ->orWhereRelation('directorat', 'name', 'like', '%'.$search['value'].'%') + ->orWhereRelation('sub_directorat', 'name', 'like', '%'.$search['value'].'%') + ->orWhereRelation('job', 'name', 'like', '%'.$search['value'].'%'); + } + }) + ->addIndexColumn() + ->addColumn('directorat', function ($subJob) { + return $subJob->directorat->name; + }) + ->addColumn('sub_directorat', function ($subJob) { + return $subJob->subDirectorat->name; + }) + ->addColumn('job', function ($subJob) { + return $subJob->job->name; + }) + ->addColumn('action', 'cetaklabel::masters.sub-job._action') + ->setRowId('id'); + } + + /** + * Get the query source of dataTable. + */ + public function query(SubJob $model): QueryBuilder + { + return $model->newQuery(); + } + + /** + * Optional method if you want to use the html builder. + */ + public function html(): HtmlBuilder + { + return $this->builder() + ->setTableId('sub-job-table') + ->columns($this->getColumns()) + ->minifiedAjax() + ->stateSave(false) + ->responsive() + ->autoWidth(true) + ->orderBy(1) + ->parameters([ + 'scrollX' => true, + 'drawCallback' => 'function() { KTMenu.createInstances(); }', + ]) + ->addTableClass('align-middle table-row-dashed fs-6 gy-5'); + } + + /** + * Get the dataTable columns definition. + */ + public function getColumns(): array + { + return [ + Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false), + Column::make('directorat'), + Column::make('sub_directorat'), + Column::make('job'), + Column::make('kode'), + Column::make('name'), + Column::computed('action') + ->exportable(false) + ->printable(false) + ->width(60) + ->addClass('text-center'), + ]; + } + + /** + * Get the filename for export. + */ + protected function filename(): string + { + return 'Sub_Job_' . date('YmdHis'); + } +} diff --git a/DataTables/SubSubJobDataTable.php b/DataTables/SubSubJobDataTable.php new file mode 100644 index 0000000..b1787ed --- /dev/null +++ b/DataTables/SubSubJobDataTable.php @@ -0,0 +1,106 @@ +filter(function ($query) { + if (request()->has('search')) { + $search = request()->get('search'); + $query->where('kode', 'like', "%" . $search['value'] . "%") + ->orWhere('name', 'like', "%" . $search['value'] . "%") + ->orWhereRelation('directorat', 'name', 'like', '%'.$search['value'].'%') + ->orWhereRelation('sub_directorat', 'name', 'like', '%'.$search['value'].'%') + ->orWhereRelation('job', 'name', 'like', '%'.$search['value'].'%') + ->orWhereRelation('subJob', 'name', 'like', '%'.$search['value'].'%'); + } + }) + ->addIndexColumn() + ->addColumn('directorat', function ($subJob) { + return $subJob->directorat->name; + }) + ->addColumn('sub_directorat', function ($subJob) { + return $subJob->subDirectorat->name; + }) + ->addColumn('job', function ($subJob) { + return $subJob->job->name; + }) + ->addColumn('sub_job', function ($subJob) { + return $subJob->subJob->name; + }) + ->addColumn('action', 'cetaklabel::masters.sub-sub-job._action') + ->setRowId('id'); + } + + /** + * Get the query source of dataTable. + */ + public function query(SubSubJob $model): QueryBuilder + { + return $model->newQuery(); + } + + /** + * Optional method if you want to use the html builder. + */ + public function html(): HtmlBuilder + { + return $this->builder() + ->setTableId('sub-sub-job-table') + ->columns($this->getColumns()) + ->minifiedAjax() + ->stateSave(false) + ->responsive() + ->autoWidth(true) + ->orderBy(1) + ->parameters([ + 'scrollX' => true, + 'drawCallback' => 'function() { KTMenu.createInstances(); }', + ]) + ->addTableClass('align-middle table-row-dashed fs-6 gy-5'); + } + + /** + * Get the dataTable columns definition. + */ + public function getColumns(): array + { + return [ + Column::make('DT_RowIndex')->title('No')->orderable(false)->searchable(false), + Column::make('directorat'), + Column::make('sub_directorat'), + Column::make('job'), + Column::make('sub_job'), + Column::make('kode'), + Column::make('name'), + Column::computed('action') + ->exportable(false) + ->printable(false) + ->width(60) + ->addClass('text-center'), + ]; + } + + /** + * Get the filename for export. + */ + protected function filename(): string + { + return 'Sub_Sub_Job_' . date('YmdHis'); + } +} diff --git a/Database/Migrations/.gitkeep b/Database/Migrations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Database/Migrations/2023_04_10_024720_create_directorats_table.php b/Database/Migrations/2023_04_10_024720_create_directorats_table.php new file mode 100644 index 0000000..b13f980 --- /dev/null +++ b/Database/Migrations/2023_04_10_024720_create_directorats_table.php @@ -0,0 +1,34 @@ +id(); + $table->string('kode',2); + $table->string('name',50); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('directorats'); + } +}; diff --git a/Database/Migrations/2023_04_10_024731_create_sub_directorats_table.php b/Database/Migrations/2023_04_10_024731_create_sub_directorats_table.php new file mode 100644 index 0000000..85b84a0 --- /dev/null +++ b/Database/Migrations/2023_04_10_024731_create_sub_directorats_table.php @@ -0,0 +1,35 @@ +id(); + $table->foreignId('directorat_id')->constrained('directorats')->onDelete('cascade'); + $table->string('kode',2); + $table->string('name',50); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('sub_directorats'); + } +}; diff --git a/Database/Migrations/2023_04_10_024809_create_jobs_table.php b/Database/Migrations/2023_04_10_024809_create_jobs_table.php new file mode 100644 index 0000000..2ab00aa --- /dev/null +++ b/Database/Migrations/2023_04_10_024809_create_jobs_table.php @@ -0,0 +1,36 @@ +id(); + $table->foreignId('directorat_id')->constrained('directorats')->onDelete('cascade'); + $table->foreignId('sub_directorat_id')->constrained('sub_directorats')->onDelete('cascade'); + $table->string('kode',2); + $table->string('name',50); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('jobs'); + } +}; diff --git a/Database/Migrations/2023_04_10_024820_create_sub_jobs_table.php b/Database/Migrations/2023_04_10_024820_create_sub_jobs_table.php new file mode 100644 index 0000000..5fef9ca --- /dev/null +++ b/Database/Migrations/2023_04_10_024820_create_sub_jobs_table.php @@ -0,0 +1,37 @@ +id(); + $table->foreignId('directorat_id')->constrained('directorats')->onDelete('cascade'); + $table->foreignId('sub_directorat_id')->constrained('sub_directorats')->onDelete('cascade'); + $table->foreignId('job_id')->constrained('jobs')->onDelete('cascade'); + $table->string('kode',2); + $table->string('name',50); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('sub_jobs'); + } +}; diff --git a/Database/Migrations/2023_04_14_034926_create_sub_sub_jobs_table.php b/Database/Migrations/2023_04_14_034926_create_sub_sub_jobs_table.php new file mode 100644 index 0000000..6a0ff14 --- /dev/null +++ b/Database/Migrations/2023_04_14_034926_create_sub_sub_jobs_table.php @@ -0,0 +1,38 @@ +id(); + $table->foreignId('sub_job_id')->constrained('sub_jobs')->onDelete('cascade'); + $table->foreignId('job_id')->constrained('jobs')->onDelete('cascade'); + $table->foreignId('sub_directorat_id')->constrained('sub_directorats')->onDelete('cascade'); + $table->foreignId('directorat_id')->constrained('directorats')->onDelete('cascade'); + $table->string('kode'); + $table->string('name'); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('sub_sub_jobs'); + } +}; diff --git a/Database/Migrations/2023_04_17_130450_create_document_types_table.php b/Database/Migrations/2023_04_17_130450_create_document_types_table.php new file mode 100644 index 0000000..d81cfa5 --- /dev/null +++ b/Database/Migrations/2023_04_17_130450_create_document_types_table.php @@ -0,0 +1,34 @@ +id(); + $table->string('kode', 2); + $table->string('name'); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('special_codes'); + } +}; diff --git a/Database/Migrations/2023_04_17_130450_create_special_codes_table.php b/Database/Migrations/2023_04_17_130450_create_special_codes_table.php new file mode 100644 index 0000000..6f33529 --- /dev/null +++ b/Database/Migrations/2023_04_17_130450_create_special_codes_table.php @@ -0,0 +1,34 @@ +id(); + $table->string('kode', 2); + $table->string('name'); + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('special_codes'); + } +}; diff --git a/Database/Migrations/2023_04_17_135901_create_documents_table.php b/Database/Migrations/2023_04_17_135901_create_documents_table.php new file mode 100644 index 0000000..c8a9ec1 --- /dev/null +++ b/Database/Migrations/2023_04_17_135901_create_documents_table.php @@ -0,0 +1,52 @@ +id(); + $table->foreignIdFor(Directorat::class)->constrained()->onDelete('cascade'); + $table->foreignIdFor(SubDirectorat::class)->constrained()->onDelete('cascade'); + $table->foreignIdFor(Job::class)->constrained()->onDelete('cascade'); + $table->foreignIdFor(SubJob::class)->constrained()->onDelete('cascade'); + $table->foreignIdFor(SubSubJob::class)->constrained()->onDelete('cascade'); + $table->foreignIdFor(SpecialCode::class)->nullable()->constrained()->onDelete('cascade'); + $table->string('no_urut',3)->nullable(); + $table->string('sequence',100)->nullable(); + $table->string('kode', 15); + $table->string('status')->nullable(); + $table->string('keterangan')->nullable(); + $table->enum('jenis_dokumen',['nasabah','non nasabah'])->nullable(); + + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('documents'); + } +}; diff --git a/Database/Migrations/2023_04_17_135930_create_document_details_table.php b/Database/Migrations/2023_04_17_135930_create_document_details_table.php new file mode 100644 index 0000000..1f57db8 --- /dev/null +++ b/Database/Migrations/2023_04_17_135930_create_document_details_table.php @@ -0,0 +1,54 @@ +id(); + $table->foreignId('document_id')->constrained('documents')->onDelete('cascade'); + $table->foreignId('document_type_id')->nullable()->constrained('document_types')->onDelete('cascade'); + + $table->string('nama_nasabah')->nullable(); + $table->string('no_rekening')->nullable(); + $table->string('no_cif')->nullable(); + $table->string('group')->nullable(); + + $table->date('tanggal_upload')->nullable(); + $table->date('tanggal_dokumen')->nullable(); + $table->string('nomor_dokumen')->nullable(); + $table->string('perihal')->nullable(); + $table->string('kode_cabang')->nullable(); + $table->string('jumlah_halaman')->nullable(); + $table->string('custom_field_1')->nullable(); + $table->string('custom_field_2')->nullable(); + $table->string('custom_field_3')->nullable(); + $table->string('custom_field_4')->nullable(); + $table->string('status')->nullable(); + $table->string('keterangan')->nullable(); + + $table->timestamps(); + $table->softDeletes(); + + $table->unsignedBigInteger('created_by')->nullable(); + $table->unsignedBigInteger('updated_by')->nullable(); + $table->unsignedBigInteger('deleted_by')->nullable(); + + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('document_details'); + } +}; diff --git a/Database/Seeders/.gitkeep b/Database/Seeders/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Database/Seeders/CetakLabelDatabaseSeeder.php b/Database/Seeders/CetakLabelDatabaseSeeder.php new file mode 100644 index 0000000..797cfc7 --- /dev/null +++ b/Database/Seeders/CetakLabelDatabaseSeeder.php @@ -0,0 +1,23 @@ +call([ + CetakLabelSeeder::class + ]); + } +} diff --git a/Database/Seeders/CetakLabelSeeder.php b/Database/Seeders/CetakLabelSeeder.php new file mode 100644 index 0000000..aa28080 --- /dev/null +++ b/Database/Seeders/CetakLabelSeeder.php @@ -0,0 +1,68 @@ + '01', + 'name' => 'Direktorat Jenderal Perhubungan Darat', + ]); + + $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, + ]); + + $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, + ]); + + $SpecialCode = SpecialCode::create ([ + 'kode' => '00', + 'name' => 'Archive' + ]); + + $SpecialCode = SpecialCode::create ([ + 'kode' => '98', + 'name' => 'Softcopy' + ]); + } + } diff --git a/Database/factories/.gitkeep b/Database/factories/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Entities/.gitkeep b/Entities/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Entities/BaseModel.php b/Entities/BaseModel.php new file mode 100644 index 0000000..5bcf0c3 --- /dev/null +++ b/Entities/BaseModel.php @@ -0,0 +1,34 @@ +connection = $module->database; + } + + public function getActivitylogOptions() + : LogOptions + { + return LogOptions::defaults()->logAll() + ->useLogName('Cetak Label : '); + } + + } diff --git a/Entities/Directorat.php b/Entities/Directorat.php new file mode 100644 index 0000000..5f5068f --- /dev/null +++ b/Entities/Directorat.php @@ -0,0 +1,14 @@ +hasMany (SubDirectorat::class); + } + } diff --git a/Entities/Document.php b/Entities/Document.php new file mode 100644 index 0000000..5da45c5 --- /dev/null +++ b/Entities/Document.php @@ -0,0 +1,55 @@ +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); + } + } diff --git a/Entities/DocumentDetail.php b/Entities/DocumentDetail.php new file mode 100644 index 0000000..240c74e --- /dev/null +++ b/Entities/DocumentDetail.php @@ -0,0 +1,36 @@ +belongsTo (Document::class); + } + + public function document_type() + { + return $this->belongsTo (DocumentType::class); + } + } diff --git a/Entities/DocumentType.php b/Entities/DocumentType.php new file mode 100644 index 0000000..481091a --- /dev/null +++ b/Entities/DocumentType.php @@ -0,0 +1,16 @@ +hasMany (DocumentDetail::class); + } + } diff --git a/Entities/Job.php b/Entities/Job.php new file mode 100644 index 0000000..5d7fbc4 --- /dev/null +++ b/Entities/Job.php @@ -0,0 +1,30 @@ +belongsTo (Directorat::class); + } + + public function sub_directorat() + { + return $this->belongsTo (SubDirectorat::class); + } + + public function sub_job() + { + return $this->hasMany (SubJob::class); + } + } diff --git a/Entities/SpecialCode.php b/Entities/SpecialCode.php new file mode 100644 index 0000000..00c00f5 --- /dev/null +++ b/Entities/SpecialCode.php @@ -0,0 +1,17 @@ +hasMany (Document::class); + } + + } diff --git a/Entities/SubDirectorat.php b/Entities/SubDirectorat.php new file mode 100644 index 0000000..798beb2 --- /dev/null +++ b/Entities/SubDirectorat.php @@ -0,0 +1,27 @@ +belongsTo (Directorat::class); + } + + public function sub_jobs() + { + return $this->hasMany (SubJob::class); + } + + public function jobs() + { + return $this->hasManyThrough (Job::class, SubJob::class); + } + } diff --git a/Entities/SubJob.php b/Entities/SubJob.php new file mode 100644 index 0000000..bb7d1f3 --- /dev/null +++ b/Entities/SubJob.php @@ -0,0 +1,35 @@ +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); + } + } diff --git a/Entities/SubSubJob.php b/Entities/SubSubJob.php new file mode 100644 index 0000000..97a0cd4 --- /dev/null +++ b/Entities/SubSubJob.php @@ -0,0 +1,36 @@ +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); + } + } diff --git a/Http/Controllers/.gitkeep b/Http/Controllers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Http/Controllers/Api/DirectoratController.php b/Http/Controllers/Api/DirectoratController.php new file mode 100644 index 0000000..5e94461 --- /dev/null +++ b/Http/Controllers/Api/DirectoratController.php @@ -0,0 +1,84 @@ +sendResponse($directorats, 'Directorats retrieved successfully.'); + } + + public function show($directorat): JsonResponse + { + $directorat = Directorat::find($directorat); + if (is_null($directorat)) { + return $this->sendError('Directorat not found.'); + } + + return $this->sendResponse($directorat, 'Directorat retrieved successfully.'); + } + + public function store(StoreDirectoratRequest $request): JsonResponse + { + // Validate the request... + $validated = $request->validated(); + + // Store the Directorat... + if ($validated) { + try { + $data = Directorat::create($validated); + + return $this->sendResponse($data, 'Directorat created successfully.'); + } catch (Exception $e) { + return $this->sendError($e->getMessage(), $e->getCode()); + } + } + + return $this->sendError('Directorat created failed.', 400); + } + + public function update(UpdateDirectoratRequest $request, Directorat $directorat): JsonResponse + { + // Validate the request... + $validated = $request->validated(); + + // Store the Directorat... + if ($validated) { + try { + $data = $directorat->update($validated); + + return $this->sendResponse($data, 'Directorat updated successfully.'); + } catch (Exception $e) { + return $this->sendError($e->getMessage(), $e->getCode()); + } + } + + return $this->sendError('Directorat created failed.', 400); + } + + public function destroy($id): JsonResponse + { + $directorat = Directorat::find($id); + if (is_null($directorat)) { + return $this->sendError('Directorat not found.'); + } + + try { + $directorat->delete(); + + return $this->sendResponse($directorat, 'Directorat deleted successfully.'); + } catch (Exception $e) { + return $this->sendError($e->getMessage(), $e->getCode()); + } + } + } diff --git a/Http/Controllers/Api/JobController.php b/Http/Controllers/Api/JobController.php new file mode 100644 index 0000000..3dca47a --- /dev/null +++ b/Http/Controllers/Api/JobController.php @@ -0,0 +1,84 @@ +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()); + } + } + } diff --git a/Http/Controllers/Api/SpecialCodeController.php b/Http/Controllers/Api/SpecialCodeController.php new file mode 100644 index 0000000..ad0aafe --- /dev/null +++ b/Http/Controllers/Api/SpecialCodeController.php @@ -0,0 +1,84 @@ +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()); + } + } + } diff --git a/Http/Controllers/Api/SubDirectoratController.php b/Http/Controllers/Api/SubDirectoratController.php new file mode 100644 index 0000000..df00d3f --- /dev/null +++ b/Http/Controllers/Api/SubDirectoratController.php @@ -0,0 +1,84 @@ +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()); + } + } + } diff --git a/Http/Controllers/Api/SubJobController.php b/Http/Controllers/Api/SubJobController.php new file mode 100644 index 0000000..8e403ff --- /dev/null +++ b/Http/Controllers/Api/SubJobController.php @@ -0,0 +1,84 @@ +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()); + } + } + } diff --git a/Http/Controllers/Api/SubSubJobController.php b/Http/Controllers/Api/SubSubJobController.php new file mode 100644 index 0000000..66c2750 --- /dev/null +++ b/Http/Controllers/Api/SubSubJobController.php @@ -0,0 +1,84 @@ +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()); + } + } + } diff --git a/Http/Controllers/DirectoratController.php b/Http/Controllers/DirectoratController.php new file mode 100644 index 0000000..615a45e --- /dev/null +++ b/Http/Controllers/DirectoratController.php @@ -0,0 +1,160 @@ +middleware(function ($request, $next) { + $this->user = Auth::guard('web')->user(); + return $next($request); + }); + } + + /** + * Display a listing of the Directorats. + * + * @param \App\DataTables\DirectoratDataTable $dataTable + * + * @return mixed + */ + public function index(DirectoratDataTable $dataTable, Request $request) + { + 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.directorat.index'); + } + + /** + * Store a newly created Directorat in storage. + * + * @param \App\Http\Requests\StoreDirectoratRequest $request + * + * @return mixed + */ + public function store(StoreDirectoratRequest $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 Directorat... + if ($validated) { + try { + Directorat::create($validated); + echo json_encode(['status' => 'success', 'message' => 'Directorat created successfully.']); + } catch (Exception $e) { + echo json_encode(['status' => 'error', 'message' => 'Directorat created failed.']); + } + return; + } + + echo json_encode(['status' => 'error', 'message' => 'Directorat created failed.']); + } + + /** + * Show the form for creating a new Directorat. + */ + 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 Directorat. + * + * @param \Modules\CetakLabel\Entities\Directorat $directorat + */ + public function show(Directorat $directorat) + { + if (is_null($this->user) || !$this->user->can('masters.read')) { + abort(403, 'Sorry !! You are Unauthorized to view any master data !'); + } + } + + /** + * Show the form for editing the specified Directorat. + * + * @param $id + */ + 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 !'); + } + + $directorat = Directorat::find($id); + echo json_encode($directorat); + } + + /** + * Update the specified Directorat in storage. + * + * @param \App\Http\Requests\UpdateDirectoratRequest $request + * @param \Modules\CetakLabel\Entities\Directorat $directorat + * + * @return mixed + */ + public function update(UpdateDirectoratRequest $request, Directorat $directorat) + { + 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 { + $directorat->update($validated); + + echo json_encode(['status' => 'success', 'message' => 'Directorat updated successfully.']); + } catch (Exception $e) { + echo json_encode(['status' => 'error', 'message' => 'Directorat updated failed.']); + } + + return; + } + + echo json_encode(['status' => 'error', 'message' => 'Directorat updated failed.']); + } + + /** + * Remove the specified Directorat from storage. + * + * @param \Modules\CetakLabel\Entities\Directorat $directorat + * + * @return void + */ + public function destroy(Directorat $directorat) + { + if (is_null($this->user) || !$this->user->can('masters.delete')) { + abort(403, 'Sorry !! You are Unauthorized to delete any master data !'); + } + + $directorat->delete(); + echo json_encode(['status' => 'success', 'message' => 'Directorat deleted successfully.']); + } + } diff --git a/Http/Controllers/DocumentController.php b/Http/Controllers/DocumentController.php new file mode 100644 index 0000000..af719a6 --- /dev/null +++ b/Http/Controllers/DocumentController.php @@ -0,0 +1,191 @@ +middleware(function ($request, $next) { + $this->user = Auth::guard('web')->user(); + return $next($request); + }); + + } + + /** + * Display a listing of the resource. + */ + public function index(DocumentDataTable $dataTable) + { + if (is_null($this->user) || !$this->user->can('app.read')) { + abort(403, 'Sorry !! You are Unauthorized to view any master data !'); + } + + return $dataTable->render('cetaklabel::app.document.index'); + } + + /** + * Store a newly created resource in storage. + */ + public function store(StoreDocumentRequest $request) + { + if (is_null($this->user) || !$this->user->can('app.create')) { + abort(403, 'Sorry !! You are Unauthorized to create any master data !'); + } + + + // Validate the request... + $validated = $request->validated(); + + // Store the Document... + if ($validated) { + $validated['sequence'] = 1; + try { + $created = Document::create($validated); + + if ($created) { + $detail = [ + 'document_id' => $created->id, + 'document_type_id' => $request->document_type_id, + 'tanggal_upload' => date('Y-m-d'), + 'tanggal_dokumen' => $request->tanggal_dokumen, + 'nomor_dokumen' => $request->nomor_dokumen, + 'perihal' => $request->perihal, + 'kode_cabang' => $request->kode_cabang, + 'jumlah_halaman' => $request->jumlah_halaman, + 'custom_field_1' => $request->custom_field_1, + 'custom_field_2' => $request->custom_field_2, + 'custom_field_3' => $request->custom_field_3, + 'custom_field_4' => $request->custom_field_4, + + 'nama_nasabah' => $request->nama_nasabah, + 'no_rekening' => $request->no_rekening, + 'no_cif' => $request->no_cif, + 'group' => $request->group, + ]; + + + DocumentDetail::create($detail); + } + + return redirect()->route('document.index')->with('success', 'Document created successfully.'); + } catch (Exception $e) { + return redirect()->route('document.index')->with('error', 'Document created failed.'); + } + } + + 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 !'); + } + + /** + * Show the form for editing the specified resource. + */ + 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(); + $job = Job::where('sub_directorat_id', $document->sub_directorat_id)->get(); + $sub_job = SubJob::where('job_id', $document->job_id)->get(); + $sub_sub_job = SubSubJob::where('sub_job_id', $document->sub_job_id)->get(); + $special_code = SpecialCode::all(); + $document_type = DocumentType::all(); + + return view('cetaklabel::app.document.edit', compact('document', 'directorat', 'sub_directorat', 'job', 'sub_job', 'sub_sub_job', 'special_code', 'document_type')); + + } + + /** + * Update the specified resource in storage. + */ + public function update(UpdateDocumentRequest $request, Document $documents) + { + 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(); + + // Update the Document... + if ($validated) { + try { + $document = Document::find($request->id); + $update = $document->update($validated); + + + return redirect()->route('document.index')->with('success', 'Document updated successfully.'); + } catch (Exception $e) { + return redirect()->route('document.index')->with('error', 'Document updated failed.'); + } + } + + return false; + } + + /** + * Remove the specified resource from storage. + */ + 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.']); + } + } diff --git a/Http/Controllers/DocumentTypeController.php b/Http/Controllers/DocumentTypeController.php new file mode 100644 index 0000000..20cf08e --- /dev/null +++ b/Http/Controllers/DocumentTypeController.php @@ -0,0 +1,143 @@ +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.']); + } + } diff --git a/Http/Controllers/JobController.php b/Http/Controllers/JobController.php new file mode 100644 index 0000000..eaab663 --- /dev/null +++ b/Http/Controllers/JobController.php @@ -0,0 +1,186 @@ +middleware(function ($request, $next) { + $this->user = Auth::guard('web')->user(); + return $next($request); + }); + } + + /** + * Display a listing of the Jobs. + * + * @param \Modules\CetakLabel\DataTables\JobDataTable $dataTable + * @param \Illuminate\Http\Request $request + * + * @return mixed|void + */ + public function index(JobDataTable $dataTable, Request $request) + { + if (is_null($this->user) || !$this->user->can('masters.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; + } + + $directorat = Directorat::all(); + return $dataTable->render('cetaklabel::masters.job.index', compact('directorat')); + } + + /** + * Lists the specified Job by Sub Directorat ID. + * + * @param \Illuminate\Http\Request $request + * + * @return void + */ + 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 !'); + } + + $jobs = Job::where('sub_directorat_id', $request->sub_directorat_id)->get(); + + $data = []; + foreach ($jobs as $row) { + $result = [ + $row->id => $row->name, + ]; + + $data[] = $result; + } + + echo json_encode($data); + } + + /** + * Store a newly created Job in storage. + * + * @param \Modules\CetakLabel\Http\Requests\Job\StoreJobRequest $request + * + * @return void + */ + public function store(StoreJobRequest $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 Job... + if ($validated) { + try { + Job::create($validated); + echo json_encode(['status' => 'success', 'message' => 'Job created successfully.']); + } catch (Exception $e) { + echo json_encode(['status' => 'error', 'message' => 'Job created failed.']); + } + return; + } + + echo json_encode(['status' => 'error', 'message' => 'Job created failed.']); + } + + /** + * Show the form for creating a new Job. + */ + 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 Job. + * + * @param $id + * + * @return void + */ + 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 !'); + } + + $job = Job::find($id); + echo json_encode($job); + } + + /** + * Update the specified Job in storage. + * + * @param \Modules\CetakLabel\Http\Requests\Job\UpdateJobRequest $request + * @param \Modules\CetakLabel\Entities\Job $job + * + * @return void + */ + public function update(UpdateJobRequest $request, Job $job) + { + 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 Job... + if ($validated) { + try { + $job->update($validated); + echo json_encode(['status' => 'success', 'message' => 'Job updated successfully.']); + } catch (Exception $e) { + echo json_encode(['status' => 'error', 'message' => 'Job updated failed.']); + } + return; + } + + echo json_encode(['status' => 'error', 'message' => 'Job updated failed.']); + } + + /** + * Remove the specified Job from storage. + * + * @param \Modules\CetakLabel\Entities\Job $job + * + * @return void + */ + public function destroy(Job $job) + { + if (is_null($this->user) || !$this->user->can('masters.delete')) { + abort(403, 'Sorry !! You are Unauthorized to delete any master data !'); + } + + $job->delete(); + echo json_encode(['status' => 'success', 'message' => 'Job deleted successfully.']); + } + } diff --git a/Http/Controllers/SpecialCodeController.php b/Http/Controllers/SpecialCodeController.php new file mode 100644 index 0000000..135e837 --- /dev/null +++ b/Http/Controllers/SpecialCodeController.php @@ -0,0 +1,142 @@ +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.']); + } + } diff --git a/Http/Controllers/SubDirectoratController.php b/Http/Controllers/SubDirectoratController.php new file mode 100644 index 0000000..3944fe1 --- /dev/null +++ b/Http/Controllers/SubDirectoratController.php @@ -0,0 +1,179 @@ +middleware(function ($request, $next) { + $this->user = Auth::guard('web')->user(); + return $next($request); + }); + } + + /** + * Display a listing of the Sub Directorats. + * + * @param \Modules\CetakLabel\DataTables\SubDirectoratDataTable $dataTable + * @param \Illuminate\Http\Request $request + * + * @return mixed|void + */ + public function index(SubDirectoratDataTable $dataTable, Request $request) + { + if (is_null($this->user) || !$this->user->can('masters.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; + } + + $directorat = Directorat::all(); + return $dataTable->render('cetaklabel::masters.sub-directorat.index', compact('directorat')); + } + + /** + * Lists the specified Sub Directorat by Directorat ID. + * + * @param \Illuminate\Http\Request $request + * + * @return void + */ + public function show(Request $request) + { + $subdirectorats = SubDirectorat::where('directorat_id', $request->directorat_id)->get(); + + $data = []; + foreach ($subdirectorats as $row) { + $result = [ + $row->id => $row->name, + ]; + + $data[] = $result; + } + + echo json_encode($data); + } + + /** + * Store a newly created Sub Directorat in storage. + * + * @param \Modules\CetakLabel\Http\Requests\SubDirectorat\StoreSubDirectoratRequest $request + * + * @return void + */ + public function store(StoreSubDirectoratRequest $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 SubDirectorat... + if ($validated) { + try { + SubDirectorat::create($validated); + echo json_encode(['status' => 'success', 'message' => 'Sub Directorat created successfully.']); + } catch (Exception $e) { + echo json_encode(['status' => 'error', 'message' => 'Sub Directorat created failed.']); + } + return; + } + + echo json_encode(['status' => 'error', 'message' => 'Sub Directorat created failed.']); + } + + /** + * Show the form for creating a new Sub Directorat. + */ + 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 Sub Directorat. + * + * @param $id + * + * @return void + */ + 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 !'); + } + + $subDirectorat = SubDirectorat::find($id); + echo json_encode($subDirectorat); + } + + /** + * Update the specified Sub Directorat in storage. + * + * @param \Modules\CetakLabel\Http\Requests\SubDirectorat\UpdateSubDirectoratRequest $request + * @param \Modules\CetakLabel\Entities\SubDirectorat $subDirectorat + * + * @return void + */ + public function update(UpdateSubDirectoratRequest $request, SubDirectorat $subDirectorat) + { + 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 SubDirectorat... + if ($validated) { + try { + $subDirectorat->update($validated); + echo json_encode(['status' => 'success', 'message' => 'Sub Directorat updated successfully.']); + } catch (Exception $e) { + echo json_encode(['status' => 'error', 'message' => 'Sub Directorat updated failed.']); + } + return; + } + + echo json_encode(['status' => 'error', 'message' => 'Sub Directorat updated failed.']); + } + + /** + * Remove the specified Sub Directorat from storage. + * + * @param \Modules\CetakLabel\Entities\SubDirectorat $subDirectorat + * + * @return void + */ + public function destroy(SubDirectorat $subDirectorat) + { + if (is_null($this->user) || !$this->user->can('masters.delete')) { + abort(403, 'Sorry !! You are Unauthorized to delete any master data !'); + } + + $subDirectorat->delete(); + echo json_encode(['status' => 'success', 'message' => 'Sub Directorat deleted successfully.']); + } + } diff --git a/Http/Controllers/SubJobController.php b/Http/Controllers/SubJobController.php new file mode 100644 index 0000000..e455557 --- /dev/null +++ b/Http/Controllers/SubJobController.php @@ -0,0 +1,187 @@ +middleware(function ($request, $next) { + $this->user = Auth::guard('web')->user(); + return $next($request); + }); + } + + /** + * Display a listing of the Sub Jobs. + * + * @param \Modules\CetakLabel\DataTables\SubJobDataTable $dataTable + * @param \Illuminate\Http\Request $request + * + * @return mixed|void + */ + public function index(SubJobDataTable $dataTable, Request $request) + { + if (is_null($this->user) || !$this->user->can('masters.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')); + } + + /** + * Lists the specified Sub Job by Job ID. + * + * @param \Illuminate\Http\Request $request + * + * @return void + */ + 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 = []; + foreach ($subJob as $row) { + $result = [ + $row->id => $row->name, + ]; + + $data[] = $result; + } + + echo json_encode($data); + } + + /** + * Store a newly created Sub Job in storage. + * + * @param \Modules\CetakLabel\Http\Requests\SubJob\StoreSubJobRequest $request + * + * @return void + */ + public function store(StoreSubJobRequest $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 SubJob... + if ($validated) { + try { + SubJob::create($validated); + echo json_encode(['status' => 'success', 'message' => 'Sub Job created successfully.']); + } catch (Exception $e) { + echo json_encode(['status' => 'error', 'message' => 'Sub Job created failed.']); + } + return; + } + + echo json_encode(['status' => 'error', 'message' => 'Sub Job created failed.']); + } + + /** + * Show the form for creating a new Sub Job. + * + * @return void + */ + 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 Sub Job. + * + * @param $id + * + * @return void + */ + 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 = SubJob::find($id); + echo json_encode($subJob); + } + + /** + * Update the specified Sub Job in storage. + * + * @param \Modules\CetakLabel\Http\Requests\SubJob\UpdateSubJobRequest $request + * @param \Modules\CetakLabel\Entities\SubJob $subJob + * + * @return false + */ + public function update(UpdateSubJobRequest $request, SubJob $subJob) + { + 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 SubJob... + if ($validated) { + try { + $subJob->update($validated); + echo json_encode(['status' => 'success', 'message' => 'Sub Job updated successfully.']); + } catch (Exception $e) { + echo json_encode(['status' => 'error', 'message' => 'Sub Job updated failed.']); + } + return; + } + + echo json_encode(['status' => 'error', 'message' => 'Sub Job updated failed.']); + } + + /** + * Remove the specified Sub Job from storage. + * + * @param \Modules\CetakLabel\Entities\SubJob $subJob + * + * @return void + */ + public function destroy(SubJob $subJob) + { + if (is_null($this->user) || !$this->user->can('masters.delete')) { + abort(403, 'Sorry !! You are Unauthorized to delete any master data !'); + } + + $subJob->delete(); + echo json_encode(['status' => 'success', 'message' => 'Sub Job deleted successfully.']); + } + } diff --git a/Http/Controllers/SubSubjobController.php b/Http/Controllers/SubSubjobController.php new file mode 100644 index 0000000..f56b4fb --- /dev/null +++ b/Http/Controllers/SubSubjobController.php @@ -0,0 +1,169 @@ +middleware(function ($request, $next) { + $this->user = Auth::guard('web')->user(); + return $next($request); + }); + } + + /** + * Display a listing of the Sub Sub Jobs. + * + * @param \Modules\CetakLabel\DataTables\SubSubJobDataTable $dataTable + * @param \Illuminate\Http\Request $request + * + * @return mixed|void + */ + public function index(SubSubJobDataTable $dataTable, Request $request) + { + if (is_null($this->user) || !$this->user->can('masters.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; + } + + addVendor('chained-select'); + + $directorat = Directorat::all(); + return $dataTable->render('cetaklabel::masters.sub-sub-job.index', compact('directorat')); + } + + /** + * Lists the specified Sub Sub Job by Sub Job ID. + * + * @param \Illuminate\Http\Request $request + * + * @return void + */ + 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 = []; + foreach ($subSubJob as $row) { + $result = [ + $row->id => $row->name, + ]; + + $data[] = $result; + } + + echo json_encode($data); + } + + /** + * Store a newly created Sub Sub Job in storage. + * + * @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')) { + abort(403, 'Sorry !! You are Unauthorized to create any master data !'); + } + + + // Validate the request... + $validated = $request->validated(); + + // Store the SubSubJob... + if ($validated) { + try { + SubSubJob::create($validated); + 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.']); + } + return; + } + + echo json_encode(['status' => 'error', 'message' => 'Sub Sub Job 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); + } + + /** + * 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); + } + + /** + * Update the specified resource in storage. + */ + public function update(UpdateSubSubJobRequest $request, SubSubJob $subSubJob) + { + 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 SubSubJob... + if ($validated) { + try { + $subSubJob->update($validated); + //return redirect()->route('job.index')->with('success', 'SubSubJob updated successfully.'); + echo json_encode(['status' => 'success', 'message' => 'Sub Sub Job updated successfully.']); + } catch (Exception $e) { + //return redirect()->route('job.index')->with('error', 'SubSubJob updated failed.'); + echo json_encode(['status' => 'error', 'message' => 'Sub Sub Job updated failed.']); + } + } + + return false; + } + + /** + * Remove the specified resource from storage. + */ + public function destroy(SubSubJob $subSubJob) + { + $subSubJob->delete(); + echo json_encode(['status' => 'success', 'message' => 'Sub Sub Job deleted successfully.']); + } + } diff --git a/Http/Middleware/.gitkeep b/Http/Middleware/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Http/Requests/.gitkeep b/Http/Requests/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Http/Requests/Directorat/StoreDirectoratRequest.php b/Http/Requests/Directorat/StoreDirectoratRequest.php new file mode 100644 index 0000000..25ee3c2 --- /dev/null +++ b/Http/Requests/Directorat/StoreDirectoratRequest.php @@ -0,0 +1,63 @@ + + */ + public function rules(): array + { + return [ + 'kode' => 'required|string|max:2|min:2|unique:directorats,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 ()) { + $errors = json_decode ($validator->errors ()->toJson (), true); + + + foreach ($errors as $key => $value) { + flash ($value[0]); + } + return redirect ()->route ('directorat.index')->with ('error', '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' => 'Directorat created failed.' + ], JsonResponse::HTTP_UNPROCESSABLE_ENTITY)); + } + } diff --git a/Http/Requests/Directorat/UpdateDirectoratRequest.php b/Http/Requests/Directorat/UpdateDirectoratRequest.php new file mode 100644 index 0000000..0bca10e --- /dev/null +++ b/Http/Requests/Directorat/UpdateDirectoratRequest.php @@ -0,0 +1,64 @@ + + */ + public function rules() + : array + { + return [ + 'kode' => 'required|string|max:2|min:2|unique:directorats,kode,' . $this->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('directorat.index')->with('error', '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' => 'Directorat updated failed.' + ], JsonResponse::HTTP_UNPROCESSABLE_ENTITY)); + } + } diff --git a/Http/Requests/Document/StoreDocumentRequest.php b/Http/Requests/Document/StoreDocumentRequest.php new file mode 100644 index 0000000..40a5284 --- /dev/null +++ b/Http/Requests/Document/StoreDocumentRequest.php @@ -0,0 +1,71 @@ + + */ + public function rules(): array + { + return [ + 'kode' => 'required|string|unique:documents,kode', + 'directorat_id' => 'required|integer|exists:directorats,id', + 'sub_directorat_id' => 'required|integer|exists:sub_directorats,id', + 'job_id' => 'required|integer|exists:jobs,id', + 'sub_job_id' => 'required|integer|exists:sub_jobs,id', + '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', + 'status' => 'nullable|integer', + 'keterangan' => 'nullable|string|max:255', + 'jenis_dokumen' => 'nullable|string|max:255', + ]; + } + + /** + * 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.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)); + } + } diff --git a/Http/Requests/Document/UpdateDocumentRequest.php b/Http/Requests/Document/UpdateDocumentRequest.php new file mode 100644 index 0000000..643b959 --- /dev/null +++ b/Http/Requests/Document/UpdateDocumentRequest.php @@ -0,0 +1,71 @@ + + */ + public function rules(): array + { + return [ + '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', + 'sub_job_id' => 'required|integer|exists:sub_jobs,id', + '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', + 'status' => 'nullable|integer', + 'keterangan' => 'nullable|string|max:255', + 'jenis_dokumen' => 'nullable|string|max:255', + ]; + } + + /** + * 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.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)); + } + } diff --git a/Http/Requests/DocumentType/StoreDocumentTypeRequest.php b/Http/Requests/DocumentType/StoreDocumentTypeRequest.php new file mode 100644 index 0000000..37e6865 --- /dev/null +++ b/Http/Requests/DocumentType/StoreDocumentTypeRequest.php @@ -0,0 +1,61 @@ + + */ + 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)); + } + } diff --git a/Http/Requests/DocumentType/UpdateDocumentTypeRequest.php b/Http/Requests/DocumentType/UpdateDocumentTypeRequest.php new file mode 100644 index 0000000..1e64d37 --- /dev/null +++ b/Http/Requests/DocumentType/UpdateDocumentTypeRequest.php @@ -0,0 +1,61 @@ + + */ + 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)); + } + } diff --git a/Http/Requests/Job/StoreJobRequest.php b/Http/Requests/Job/StoreJobRequest.php new file mode 100644 index 0000000..a9b3c03 --- /dev/null +++ b/Http/Requests/Job/StoreJobRequest.php @@ -0,0 +1,63 @@ + + */ + 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)); + } + } diff --git a/Http/Requests/Job/UpdateJobRequest.php b/Http/Requests/Job/UpdateJobRequest.php new file mode 100644 index 0000000..cc90190 --- /dev/null +++ b/Http/Requests/Job/UpdateJobRequest.php @@ -0,0 +1,63 @@ + + */ + 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)); + } + } diff --git a/Http/Requests/SpecialCode/StoreSpecialCodeRequest.php b/Http/Requests/SpecialCode/StoreSpecialCodeRequest.php new file mode 100644 index 0000000..bfe6a18 --- /dev/null +++ b/Http/Requests/SpecialCode/StoreSpecialCodeRequest.php @@ -0,0 +1,61 @@ + + */ + 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)); + } + } diff --git a/Http/Requests/SpecialCode/UpdateSpecialCodeRequest.php b/Http/Requests/SpecialCode/UpdateSpecialCodeRequest.php new file mode 100644 index 0000000..3253563 --- /dev/null +++ b/Http/Requests/SpecialCode/UpdateSpecialCodeRequest.php @@ -0,0 +1,61 @@ + + */ + 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)); + } + } diff --git a/Http/Requests/SubDirectorat/StoreSubDirectoratRequest.php b/Http/Requests/SubDirectorat/StoreSubDirectoratRequest.php new file mode 100644 index 0000000..7911c27 --- /dev/null +++ b/Http/Requests/SubDirectorat/StoreSubDirectoratRequest.php @@ -0,0 +1,62 @@ + + */ + 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)); + } + } diff --git a/Http/Requests/SubDirectorat/UpdateSubDirectoratRequest.php b/Http/Requests/SubDirectorat/UpdateSubDirectoratRequest.php new file mode 100644 index 0000000..4eb3e0b --- /dev/null +++ b/Http/Requests/SubDirectorat/UpdateSubDirectoratRequest.php @@ -0,0 +1,62 @@ + + */ + 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)); + } + } diff --git a/Http/Requests/SubJob/StoreSubJobRequest.php b/Http/Requests/SubJob/StoreSubJobRequest.php new file mode 100644 index 0000000..6b20277 --- /dev/null +++ b/Http/Requests/SubJob/StoreSubJobRequest.php @@ -0,0 +1,64 @@ + + */ + 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)); + } + } diff --git a/Http/Requests/SubJob/UpdateSubJobRequest.php b/Http/Requests/SubJob/UpdateSubJobRequest.php new file mode 100644 index 0000000..4c7594f --- /dev/null +++ b/Http/Requests/SubJob/UpdateSubJobRequest.php @@ -0,0 +1,64 @@ + + */ + 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)); + } + } diff --git a/Http/Requests/SubSubJob/StoreSubSubJobRequest.php b/Http/Requests/SubSubJob/StoreSubSubJobRequest.php new file mode 100644 index 0000000..541629e --- /dev/null +++ b/Http/Requests/SubSubJob/StoreSubSubJobRequest.php @@ -0,0 +1,66 @@ + + */ + 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)); + } + } diff --git a/Http/Requests/SubSubJob/UpdateSubSubJobRequest.php b/Http/Requests/SubSubJob/UpdateSubSubJobRequest.php new file mode 100644 index 0000000..5831ec2 --- /dev/null +++ b/Http/Requests/SubSubJob/UpdateSubSubJobRequest.php @@ -0,0 +1,66 @@ + + */ + 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)); + } + } diff --git a/Providers/.gitkeep b/Providers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Providers/CetakLabelServiceProvider.php b/Providers/CetakLabelServiceProvider.php new file mode 100644 index 0000000..5f83d20 --- /dev/null +++ b/Providers/CetakLabelServiceProvider.php @@ -0,0 +1,128 @@ +registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + $this->registerDatabase(); + $this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations')); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->register(RouteServiceProvider::class); + } + + /** + * Register config. + * + * @return void + */ + protected function registerConfig() + { + $this->publishes([ + module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'), + ], 'config'); + $this->mergeConfigFrom( + module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower + ); + } + + protected function registerDatabase() + { + $this->publishes([ + module_path($this->moduleName, 'Config/database.php') => config_path($this->moduleNameLower . '.php'), + ], 'database'); + + + array_merge( + require base_path().'/config/database.php', + require base_path().'/Modules/CetakLabel/Config/database.php' + ); + } + + /** + * Register views. + * + * @return void + */ + public function registerViews() + { + $viewPath = resource_path('views/modules/' . $this->moduleNameLower); + + $sourcePath = module_path($this->moduleName, 'Resources/views'); + + $this->publishes([ + $sourcePath => $viewPath + ], ['views', $this->moduleNameLower . '-module-views']); + + $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower); + } + + /** + * Register translations. + * + * @return void + */ + public function registerTranslations() + { + $langPath = resource_path('lang/modules/' . $this->moduleNameLower); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, $this->moduleNameLower); + $this->loadJsonTranslationsFrom($langPath); + } else { + $this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower); + $this->loadJsonTranslationsFrom(module_path($this->moduleName, 'Resources/lang')); + } + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return []; + } + + private function getPublishableViewPaths(): array + { + $paths = []; + foreach (\Config::get('view.paths') as $path) { + if (is_dir($path . '/modules/' . $this->moduleNameLower)) { + $paths[] = $path . '/modules/' . $this->moduleNameLower; + } + } + return $paths; + } +} diff --git a/Providers/RouteServiceProvider.php b/Providers/RouteServiceProvider.php new file mode 100644 index 0000000..6eab28b --- /dev/null +++ b/Providers/RouteServiceProvider.php @@ -0,0 +1,69 @@ +mapApiRoutes(); + + $this->mapWebRoutes(); + } + + /** + * Define the "web" routes for the application. + * + * These routes all receive session state, CSRF protection, etc. + * + * @return void + */ + protected function mapWebRoutes() + { + Route::middleware('web') + ->namespace($this->moduleNamespace) + ->group(module_path('CetakLabel', '/Routes/web.php')); + } + + /** + * Define the "api" routes for the application. + * + * These routes are typically stateless. + * + * @return void + */ + protected function mapApiRoutes() + { + Route::prefix('api') + ->middleware('api') + ->namespace($this->moduleNamespace) + ->group(module_path('CetakLabel', '/Routes/api.php')); + } +} diff --git a/Resources/lang/.gitkeep b/Resources/lang/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Resources/views/.gitkeep b/Resources/views/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Resources/views/app/document/_action.blade.php b/Resources/views/app/document/_action.blade.php new file mode 100644 index 0000000..1f17e37 --- /dev/null +++ b/Resources/views/app/document/_action.blade.php @@ -0,0 +1,13 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp +
+ + {!! getIcon("pencil", "fs-1 text-info","duotune") !!} + + + {!! 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() !!} +
diff --git a/Resources/views/app/document/_edit.blade.php b/Resources/views/app/document/_edit.blade.php new file mode 100644 index 0000000..c42e866 --- /dev/null +++ b/Resources/views/app/document/_edit.blade.php @@ -0,0 +1,223 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp + +
+ @method('PUT') + @csrf + +
+ + + + + +
+ + +
+
+ +
+ + + + +
+ +
+
+ +
+ + + + +
+ +
+
+ +
+ + + + +
+ +
+
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+
+ + +
+ + +
+ +
+ + +@push('customscript') + +@endpush + diff --git a/Resources/views/app/document/_form.blade.php b/Resources/views/app/document/_form.blade.php new file mode 100644 index 0000000..89e4781 --- /dev/null +++ b/Resources/views/app/document/_form.blade.php @@ -0,0 +1,388 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp + +
+ @csrf + +
+ + + + + +
+ + +
+
+ +
+ + + + +
+ +
+
+ +
+ + + + +
+ +
+
+ +
+ + + + +
+ +
+
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + +
+ +
+
+ + +
+ + +
+ +
+ + +@push('customscript') + +@endpush + diff --git a/Resources/views/app/document/_table.blade.php b/Resources/views/app/document/_table.blade.php new file mode 100644 index 0000000..f1b454c --- /dev/null +++ b/Resources/views/app/document/_table.blade.php @@ -0,0 +1,100 @@ + +{{ $dataTable->table() }} + + +{{-- Inject Scripts --}} +@section('scripts') + {{ $dataTable->scripts() }} +@endsection + +@push('customscript') + @php + $route = explode('.', Route::currentRouteName()); + @endphp + + +@endpush + +@section('styles') + +@endsection diff --git a/Resources/views/app/document/create.blade.php b/Resources/views/app/document/create.blade.php new file mode 100644 index 0000000..b30acb4 --- /dev/null +++ b/Resources/views/app/document/create.blade.php @@ -0,0 +1,16 @@ + + +
+ +
+

+ Upload New Document +

+
+
+ @include('cetaklabel::app.document._form') +
+ +
+ +
diff --git a/Resources/views/app/document/edit.blade.php b/Resources/views/app/document/edit.blade.php new file mode 100644 index 0000000..306c356 --- /dev/null +++ b/Resources/views/app/document/edit.blade.php @@ -0,0 +1,16 @@ + + +
+ +
+

+ Edit Document {{ $document->kode }} +

+
+
+ @include('app.document._edit') +
+ +
+ +
diff --git a/Resources/views/app/document/index.blade.php b/Resources/views/app/document/index.blade.php new file mode 100644 index 0000000..2b99046 --- /dev/null +++ b/Resources/views/app/document/index.blade.php @@ -0,0 +1,91 @@ + + +
+ +
+
+
+ + + + + + + + + +
+ + +
+ + +
+ +
+ + + + + + + +
+ + +
+
+
+ @include('cetaklabel::app.document._table') +
+ +
+ +
diff --git a/Resources/views/masters/directorat/_action.blade.php b/Resources/views/masters/directorat/_action.blade.php new file mode 100644 index 0000000..a763751 --- /dev/null +++ b/Resources/views/masters/directorat/_action.blade.php @@ -0,0 +1,13 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp +
+ + {!! getIcon("pencil", "fs-1 text-info","duotune") !!} + + + {!! 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() !!} +
diff --git a/Resources/views/masters/directorat/_form.blade.php b/Resources/views/masters/directorat/_form.blade.php new file mode 100644 index 0000000..98c7455 --- /dev/null +++ b/Resources/views/masters/directorat/_form.blade.php @@ -0,0 +1,70 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp + + + + diff --git a/Resources/views/masters/directorat/_table.blade.php b/Resources/views/masters/directorat/_table.blade.php new file mode 100644 index 0000000..0d3f296 --- /dev/null +++ b/Resources/views/masters/directorat/_table.blade.php @@ -0,0 +1,116 @@ + +{{ $dataTable->table() }} + + +{{-- Inject Scripts --}} +@section('scripts') + {{ $dataTable->scripts() }} +@endsection + +@push('customscript') + @php + $route = explode('.', Route::currentRouteName()); + @endphp + + +@endpush + +@section('styles') + +@endsection diff --git a/Resources/views/masters/directorat/index.blade.php b/Resources/views/masters/directorat/index.blade.php new file mode 100644 index 0000000..46dcb7b --- /dev/null +++ b/Resources/views/masters/directorat/index.blade.php @@ -0,0 +1,131 @@ + + +
+ +
+
+
+ + + + + + + + + +
+ + +
+ + +
+ +
+ + + + + + + +
+ + +
+
+
+ @include('cetaklabel::masters.directorat._table') + @include('cetaklabel::masters.directorat._form') +
+ +
+ + @push('customscript') + + @endpush +
diff --git a/Resources/views/masters/document-type/_action.blade.php b/Resources/views/masters/document-type/_action.blade.php new file mode 100644 index 0000000..c90e6d7 --- /dev/null +++ b/Resources/views/masters/document-type/_action.blade.php @@ -0,0 +1,13 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp +
+ + {!! getIcon("pencil", "fs-1 text-info","duotune") !!} + + + {!! 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() !!} +
diff --git a/Resources/views/masters/document-type/_form.blade.php b/Resources/views/masters/document-type/_form.blade.php new file mode 100644 index 0000000..6c5616e --- /dev/null +++ b/Resources/views/masters/document-type/_form.blade.php @@ -0,0 +1,71 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp + + + + diff --git a/Resources/views/masters/document-type/_table.blade.php b/Resources/views/masters/document-type/_table.blade.php new file mode 100644 index 0000000..da5f014 --- /dev/null +++ b/Resources/views/masters/document-type/_table.blade.php @@ -0,0 +1,117 @@ + +{{ $dataTable->table() }} + + +{{-- Inject Scripts --}} +@section('scripts') + {{ $dataTable->scripts() }} +@endsection + +@push('customscript') + @php + $route = explode('.', Route::currentRouteName()); + @endphp + + +@endpush + +@section('styles') + +@endsection diff --git a/Resources/views/masters/document-type/index.blade.php b/Resources/views/masters/document-type/index.blade.php new file mode 100644 index 0000000..753aad0 --- /dev/null +++ b/Resources/views/masters/document-type/index.blade.php @@ -0,0 +1,136 @@ + + + @php + $route = explode('.', Route::currentRouteName()); + @endphp + + +
+ +
+
+
+ + + + + + + + + +
+ + +
+ + +
+ +
+ + + + + + + +
+ + +
+
+
+ @include('cetaklabel::masters.document-type._table') + @include('cetaklabel::masters.document-type._form') +
+ +
+ + @push('customscript') + + @endpush +
diff --git a/Resources/views/masters/job/_action.blade.php b/Resources/views/masters/job/_action.blade.php new file mode 100644 index 0000000..36cc14f --- /dev/null +++ b/Resources/views/masters/job/_action.blade.php @@ -0,0 +1,13 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp +
+ + {!! getIcon("pencil", "fs-1 text-info","duotune") !!} + + + {!! 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() !!} +
diff --git a/Resources/views/masters/job/_form.blade.php b/Resources/views/masters/job/_form.blade.php new file mode 100644 index 0000000..e1d666a --- /dev/null +++ b/Resources/views/masters/job/_form.blade.php @@ -0,0 +1,102 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp + + + + diff --git a/Resources/views/masters/job/_table.blade.php b/Resources/views/masters/job/_table.blade.php new file mode 100644 index 0000000..a687d4f --- /dev/null +++ b/Resources/views/masters/job/_table.blade.php @@ -0,0 +1,118 @@ + +{{ $dataTable->table() }} + + +{{-- Inject Scripts --}} +@section('scripts') + {{ $dataTable->scripts() }} +@endsection + +@push('customscript') + @php + $route = explode('.', Route::currentRouteName()); + @endphp + + +@endpush + +@section('styles') + +@endsection diff --git a/Resources/views/masters/job/index.blade.php b/Resources/views/masters/job/index.blade.php new file mode 100644 index 0000000..ebe236c --- /dev/null +++ b/Resources/views/masters/job/index.blade.php @@ -0,0 +1,137 @@ + + +
+ +
+
+
+ + + + + + + + + +
+ + +
+ + +
+ +
+ + + + + + + +
+ + +
+
+
+ @include('cetaklabel::masters.job._table') + @include('cetaklabel::masters.job._form') +
+ +
+ + @push('customscript') + + @endpush +
diff --git a/Resources/views/masters/special-code/_action.blade.php b/Resources/views/masters/special-code/_action.blade.php new file mode 100644 index 0000000..57031f0 --- /dev/null +++ b/Resources/views/masters/special-code/_action.blade.php @@ -0,0 +1,13 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp +
+ + {!! getIcon("pencil", "fs-1 text-info","duotune") !!} + + + {!! 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() !!} +
diff --git a/Resources/views/masters/special-code/_form.blade.php b/Resources/views/masters/special-code/_form.blade.php new file mode 100644 index 0000000..3ca5be8 --- /dev/null +++ b/Resources/views/masters/special-code/_form.blade.php @@ -0,0 +1,71 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp + + + + diff --git a/Resources/views/masters/special-code/_table.blade.php b/Resources/views/masters/special-code/_table.blade.php new file mode 100644 index 0000000..da5f014 --- /dev/null +++ b/Resources/views/masters/special-code/_table.blade.php @@ -0,0 +1,117 @@ + +{{ $dataTable->table() }} + + +{{-- Inject Scripts --}} +@section('scripts') + {{ $dataTable->scripts() }} +@endsection + +@push('customscript') + @php + $route = explode('.', Route::currentRouteName()); + @endphp + + +@endpush + +@section('styles') + +@endsection diff --git a/Resources/views/masters/special-code/index.blade.php b/Resources/views/masters/special-code/index.blade.php new file mode 100644 index 0000000..9ddbb00 --- /dev/null +++ b/Resources/views/masters/special-code/index.blade.php @@ -0,0 +1,136 @@ + + + @php + $route = explode('.', Route::currentRouteName()); + @endphp + + +
+ +
+
+
+ + + + + + + + + +
+ + +
+ + +
+ +
+ + + + + + + +
+ + +
+
+
+ @include('cetaklabel::masters.special-code._table') + @include('cetaklabel::masters.special-code._form') +
+ +
+ + @push('customscript') + + @endpush +
diff --git a/Resources/views/masters/sub-directorat/_action.blade.php b/Resources/views/masters/sub-directorat/_action.blade.php new file mode 100644 index 0000000..fbdb4ad --- /dev/null +++ b/Resources/views/masters/sub-directorat/_action.blade.php @@ -0,0 +1,13 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp +
+ + {!! getIcon("pencil", "fs-1 text-info","duotune") !!} + + + {!! 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() !!} +
diff --git a/Resources/views/masters/sub-directorat/_form.blade.php b/Resources/views/masters/sub-directorat/_form.blade.php new file mode 100644 index 0000000..f05b74d --- /dev/null +++ b/Resources/views/masters/sub-directorat/_form.blade.php @@ -0,0 +1,87 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp + + + + diff --git a/Resources/views/masters/sub-directorat/_table.blade.php b/Resources/views/masters/sub-directorat/_table.blade.php new file mode 100644 index 0000000..b03865c --- /dev/null +++ b/Resources/views/masters/sub-directorat/_table.blade.php @@ -0,0 +1,118 @@ + +{{ $dataTable->table() }} + + +{{-- Inject Scripts --}} +@section('scripts') + {{ $dataTable->scripts() }} +@endsection + +@push('customscript') + @php + $route = explode('.', Route::currentRouteName()); + @endphp + + +@endpush + +@section('styles') + +@endsection diff --git a/Resources/views/masters/sub-directorat/index.blade.php b/Resources/views/masters/sub-directorat/index.blade.php new file mode 100644 index 0000000..0ae6658 --- /dev/null +++ b/Resources/views/masters/sub-directorat/index.blade.php @@ -0,0 +1,136 @@ + + + @php + $route = explode('.', Route::currentRouteName()); + @endphp + + +
+ +
+
+
+ + + + + + + + + +
+ + +
+ + +
+ +
+ + + + + + + +
+ + +
+
+
+ @include('cetaklabel::masters.sub-directorat._table') + @include('cetaklabel::masters.sub-directorat._form') +
+ +
+ + @push('customscript') + + @endpush +
diff --git a/Resources/views/masters/sub-job/_action.blade.php b/Resources/views/masters/sub-job/_action.blade.php new file mode 100644 index 0000000..dd197cb --- /dev/null +++ b/Resources/views/masters/sub-job/_action.blade.php @@ -0,0 +1,13 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp +
+ + {!! getIcon("pencil", "fs-1 text-info","duotune") !!} + + + {!! 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() !!} +
diff --git a/Resources/views/masters/sub-job/_form.blade.php b/Resources/views/masters/sub-job/_form.blade.php new file mode 100644 index 0000000..7b6dfe5 --- /dev/null +++ b/Resources/views/masters/sub-job/_form.blade.php @@ -0,0 +1,116 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp + + + + diff --git a/Resources/views/masters/sub-job/_table.blade.php b/Resources/views/masters/sub-job/_table.blade.php new file mode 100644 index 0000000..683d068 --- /dev/null +++ b/Resources/views/masters/sub-job/_table.blade.php @@ -0,0 +1,119 @@ + +{{ $dataTable->table() }} + + +{{-- Inject Scripts --}} +@section('scripts') + {{ $dataTable->scripts() }} +@endsection + +@push('customscript') + @php + $route = explode('.', Route::currentRouteName()); + @endphp + + +@endpush + +@section('styles') + +@endsection diff --git a/Resources/views/masters/sub-job/index.blade.php b/Resources/views/masters/sub-job/index.blade.php new file mode 100644 index 0000000..d58dd35 --- /dev/null +++ b/Resources/views/masters/sub-job/index.blade.php @@ -0,0 +1,143 @@ + + +
+ +
+
+
+ + + + + + + + + +
+ + +
+ + +
+ +
+ + + + + + + +
+ + +
+
+
+ @include('cetaklabel::masters.sub-job._table') + @include('cetaklabel::masters.sub-job._form') +
+ +
+ + @push('customscript') + + @endpush +
diff --git a/Resources/views/masters/sub-sub-job/_action.blade.php b/Resources/views/masters/sub-sub-job/_action.blade.php new file mode 100644 index 0000000..dc4ac01 --- /dev/null +++ b/Resources/views/masters/sub-sub-job/_action.blade.php @@ -0,0 +1,13 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp +
+ + {!! getIcon("pencil", "fs-1 text-info","duotune") !!} + + + {!! 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() !!} +
diff --git a/Resources/views/masters/sub-sub-job/_form.blade.php b/Resources/views/masters/sub-sub-job/_form.blade.php new file mode 100644 index 0000000..f432285 --- /dev/null +++ b/Resources/views/masters/sub-sub-job/_form.blade.php @@ -0,0 +1,130 @@ +@php + $route = explode('.', Route::currentRouteName()); +@endphp + + + + diff --git a/Resources/views/masters/sub-sub-job/_table.blade.php b/Resources/views/masters/sub-sub-job/_table.blade.php new file mode 100644 index 0000000..39bab35 --- /dev/null +++ b/Resources/views/masters/sub-sub-job/_table.blade.php @@ -0,0 +1,120 @@ + +{{ $dataTable->table() }} + + +{{-- Inject Scripts --}} +@section('scripts') + {{ $dataTable->scripts() }} +@endsection + +@push('customscript') + @php + $route = explode('.', Route::currentRouteName()); + @endphp + + +@endpush + +@section('styles') + +@endsection diff --git a/Resources/views/masters/sub-sub-job/index.blade.php b/Resources/views/masters/sub-sub-job/index.blade.php new file mode 100644 index 0000000..c0d2872 --- /dev/null +++ b/Resources/views/masters/sub-sub-job/index.blade.php @@ -0,0 +1,149 @@ + + +
+ +
+
+
+ + + + + + + + + +
+ + +
+ + +
+ +
+ + + + + + + +
+ + +
+
+
+ @include('cetaklabel::masters.sub-sub-job._table') + @include('cetaklabel::masters.sub-sub-job._form') +
+ +
+ + @push('customscript') + + @endpush +
diff --git a/Routes/.gitkeep b/Routes/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Routes/api.php b/Routes/api.php new file mode 100644 index 0000000..ad65f4b --- /dev/null +++ b/Routes/api.php @@ -0,0 +1,34 @@ +domain)->group(function (){ + Route::middleware('auth:sanctum')->group(function (){ + Route::resource('directorats', DirectoratController::class); + 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); + }); + }); diff --git a/Routes/web.php b/Routes/web.php new file mode 100644 index 0000000..d207928 --- /dev/null +++ b/Routes/web.php @@ -0,0 +1,31 @@ +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); + }); +}); + + diff --git a/Tests/Feature/.gitkeep b/Tests/Feature/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/Tests/Unit/.gitkeep b/Tests/Unit/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..8154cb8 --- /dev/null +++ b/composer.json @@ -0,0 +1,24 @@ +{ + "name": "putrakuningan/cetaklabel", + "type": "laravel-module", + "description": "", + "authors": [ + { + "name": "Daeng Deni Mardaeni", + "email": "ddeni05@gmail.com" + } + ], + "extra": { + "laravel": { + "providers": [], + "aliases": { + + } + } + }, + "autoload": { + "psr-4": { + "Modules\\CetakLabel\\": "" + } + } +} diff --git a/module.json b/module.json new file mode 100644 index 0000000..d40b486 --- /dev/null +++ b/module.json @@ -0,0 +1,14 @@ +{ + "name": "CetakLabel", + "version": "1.0.0", + "alias": "cetaklabel", + "domain": "cetaklabel.io", + "database": "", + "description": "", + "keywords": [], + "priority": 1, + "providers": [ + "Modules\\CetakLabel\\Providers\\CetakLabelServiceProvider" + ], + "files": [] +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..30c1a80 --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "private": true, + "scripts": { + "dev": "vite", + "build": "vite build" + }, + "devDependencies": { + "axios": "^0.21.4", + "dotenv": "^10.0.0", + "dotenv-expand": "^5.1.0", + "laravel-vite-plugin": "^0.6.0", + "lodash": "^4.17.21", + "postcss": "^8.3.7", + "vite": "^3.0.9" + } +} diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..3541234 --- /dev/null +++ b/vite.config.js @@ -0,0 +1,24 @@ +const dotenvExpand = require('dotenv-expand'); +dotenvExpand(require('dotenv').config({ path: '../../.env'/*, debug: true*/})); + +import { defineConfig } from 'vite'; +import laravel from 'laravel-vite-plugin'; + +export default defineConfig({ + build: { + outDir: '../../public/build-cetaklabel', + emptyOutDir: true, + manifest: true, + }, + plugins: [ + laravel({ + publicDirectory: '../../public', + buildDirectory: 'build-cetaklabel', + input: [ + __dirname + '/Resources/assets/sass/app.scss', + __dirname + '/Resources/assets/js/app.js' + ], + refresh: true, + }), + ], +});