add classfication and fixing

pull/2/head
ajikamaludin 2 years ago
parent 31b274b81d
commit c37319588b
Signed by: ajikamaludin
GPG Key ID: 476C9A2B4B794EBB

@ -0,0 +1,63 @@
<?php
namespace App\Http\Controllers;
use App\Models\Classification;
use Illuminate\Http\Request;
class ClassificationController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return inertia('Classification/Index', [
'classifications' => Classification::paginate(),
]);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$request->validate([
'name' => 'required|string|max:255'
]);
Classification::create(['name' => $request->name]);
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Classification $classification)
{
$request->validate([
'name' => 'required|string|max:255'
]);
$classification->update(['name' => $request->name]);
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy(Classification $classification)
{
$classification->delete();
}
}

@ -18,7 +18,7 @@ class DocumentController extends Controller
{ {
public function index(Request $request) public function index(Request $request)
{ {
$query = Document::with(['variety', 'category']); $query = Document::with(['variety', 'category', 'company']);
if ($request->has('status')) { if ($request->has('status')) {
if($request->status == 1) { if($request->status == 1) {

@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Classification;
use App\Models\Type; use App\Models\Type;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -15,7 +16,8 @@ class TypeController extends Controller
public function index() public function index()
{ {
return inertia('Type/Index', [ return inertia('Type/Index', [
'types' => Type::paginate(), 'types' => Type::with(['classification'])->paginate(),
'classifications' => Classification::all()
]); ]);
} }
@ -28,10 +30,14 @@ class TypeController extends Controller
public function store(Request $request) public function store(Request $request)
{ {
$request->validate([ $request->validate([
'name' => 'required|string|max:255' 'name' => 'required|string|max:255',
'classification_id' => 'required|exists:classifications,id'
]); ]);
Type::create(['name' => $request->name]); Type::create([
'name' => $request->name,
'classification_id' => $request->classification_id
]);
} }
/** /**
@ -44,10 +50,14 @@ class TypeController extends Controller
public function update(Request $request, Type $type) public function update(Request $request, Type $type)
{ {
$request->validate([ $request->validate([
'name' => 'required|string|max:255' 'name' => 'required|string|max:255',
'classification_id' => 'required|exists:classifications,id'
]); ]);
$type->update(['name' => $request->name]); $type->update([
'name' => $request->name,
'classification_id' => $request->classification_id
]);
} }
/** /**

@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use ShiftOneLabs\LaravelCascadeDeletes\CascadesDeletes;
class Classification extends Model
{
use HasFactory, CascadesDeletes;
protected $fillable = ['name'];
protected $cascadeDeletes = ['types'];
public function types()
{
return $this->hasMany(Type::class);
}
}

@ -12,6 +12,7 @@ class Type extends Model
protected $fillable = [ protected $fillable = [
"name", "name",
'classification_id'
]; ];
protected $cascadeDeletes = ['documents']; protected $cascadeDeletes = ['documents'];
@ -21,4 +22,9 @@ class Type extends Model
return $this->hasMany(Document::class); return $this->hasMany(Document::class);
} }
public function classification()
{
return $this->belongsTo(Classification::class);
}
} }

200
composer.lock generated

@ -8,26 +8,26 @@
"packages": [ "packages": [
{ {
"name": "barryvdh/laravel-dompdf", "name": "barryvdh/laravel-dompdf",
"version": "v2.0.0", "version": "v2.0.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/barryvdh/laravel-dompdf.git", "url": "https://github.com/barryvdh/laravel-dompdf.git",
"reference": "1d47648c6cef37f715ecb8bcc5f5a656ad372e27" "reference": "9843d2be423670fb434f4c978b3c0f4dd92c87a6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/1d47648c6cef37f715ecb8bcc5f5a656ad372e27", "url": "https://api.github.com/repos/barryvdh/laravel-dompdf/zipball/9843d2be423670fb434f4c978b3c0f4dd92c87a6",
"reference": "1d47648c6cef37f715ecb8bcc5f5a656ad372e27", "reference": "9843d2be423670fb434f4c978b3c0f4dd92c87a6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"dompdf/dompdf": "^2", "dompdf/dompdf": "^2.0.1",
"illuminate/support": "^6|^7|^8|^9", "illuminate/support": "^6|^7|^8|^9|^10",
"php": "^7.2 || ^8.0" "php": "^7.2 || ^8.0"
}, },
"require-dev": { "require-dev": {
"nunomaduro/larastan": "^1|^2", "nunomaduro/larastan": "^1|^2",
"orchestra/testbench": "^4|^5|^6|^7", "orchestra/testbench": "^4|^5|^6|^7|^8",
"phpro/grumphp": "^1", "phpro/grumphp": "^1",
"squizlabs/php_codesniffer": "^3.5" "squizlabs/php_codesniffer": "^3.5"
}, },
@ -69,7 +69,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/barryvdh/laravel-dompdf/issues", "issues": "https://github.com/barryvdh/laravel-dompdf/issues",
"source": "https://github.com/barryvdh/laravel-dompdf/tree/v2.0.0" "source": "https://github.com/barryvdh/laravel-dompdf/tree/v2.0.1"
}, },
"funding": [ "funding": [
{ {
@ -81,30 +81,29 @@
"type": "github" "type": "github"
} }
], ],
"time": "2022-07-06T11:12:10+00:00" "time": "2023-01-12T15:12:49+00:00"
}, },
{ {
"name": "brick/math", "name": "brick/math",
"version": "0.10.2", "version": "0.11.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/brick/math.git", "url": "https://github.com/brick/math.git",
"reference": "459f2781e1a08d52ee56b0b1444086e038561e3f" "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/brick/math/zipball/459f2781e1a08d52ee56b0b1444086e038561e3f", "url": "https://api.github.com/repos/brick/math/zipball/0ad82ce168c82ba30d1c01ec86116ab52f589478",
"reference": "459f2781e1a08d52ee56b0b1444086e038561e3f", "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "php": "^8.0"
"php": "^7.4 || ^8.0"
}, },
"require-dev": { "require-dev": {
"php-coveralls/php-coveralls": "^2.2", "php-coveralls/php-coveralls": "^2.2",
"phpunit/phpunit": "^9.0", "phpunit/phpunit": "^9.0",
"vimeo/psalm": "4.25.0" "vimeo/psalm": "5.0.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -129,7 +128,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/brick/math/issues", "issues": "https://github.com/brick/math/issues",
"source": "https://github.com/brick/math/tree/0.10.2" "source": "https://github.com/brick/math/tree/0.11.0"
}, },
"funding": [ "funding": [
{ {
@ -137,7 +136,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2022-08-10T22:54:19+00:00" "time": "2023-01-15T23:15:59+00:00"
}, },
{ {
"name": "composer/semver", "name": "composer/semver",
@ -465,16 +464,16 @@
}, },
{ {
"name": "dompdf/dompdf", "name": "dompdf/dompdf",
"version": "v2.0.1", "version": "v2.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/dompdf/dompdf.git", "url": "https://github.com/dompdf/dompdf.git",
"reference": "c5310df0e22c758c85ea5288175fc6cd777bc085" "reference": "ad4c631bf8897fc1ca7b566468a969cfd71a558a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/c5310df0e22c758c85ea5288175fc6cd777bc085", "url": "https://api.github.com/repos/dompdf/dompdf/zipball/ad4c631bf8897fc1ca7b566468a969cfd71a558a",
"reference": "c5310df0e22c758c85ea5288175fc6cd777bc085", "reference": "ad4c631bf8897fc1ca7b566468a969cfd71a558a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -521,9 +520,9 @@
"homepage": "https://github.com/dompdf/dompdf", "homepage": "https://github.com/dompdf/dompdf",
"support": { "support": {
"issues": "https://github.com/dompdf/dompdf/issues", "issues": "https://github.com/dompdf/dompdf/issues",
"source": "https://github.com/dompdf/dompdf/tree/v2.0.1" "source": "https://github.com/dompdf/dompdf/tree/v2.0.2"
}, },
"time": "2022-09-22T13:43:41+00:00" "time": "2023-01-31T13:30:40+00:00"
}, },
{ {
"name": "dragonmantank/cron-expression", "name": "dragonmantank/cron-expression",
@ -1252,21 +1251,21 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v9.48.0", "version": "v9.50.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "c78ae7aeb0cbcb1a205050d3592247ba07f5b711" "reference": "3b400f76619cd5257a69fdd6b897043b6522a89a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/c78ae7aeb0cbcb1a205050d3592247ba07f5b711", "url": "https://api.github.com/repos/laravel/framework/zipball/3b400f76619cd5257a69fdd6b897043b6522a89a",
"reference": "c78ae7aeb0cbcb1a205050d3592247ba07f5b711", "reference": "3b400f76619cd5257a69fdd6b897043b6522a89a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"brick/math": "^0.10.2", "brick/math": "^0.9.3|^0.10.2|^0.11",
"doctrine/inflector": "^2.0", "doctrine/inflector": "^2.0.5",
"dragonmantank/cron-expression": "^3.3.2", "dragonmantank/cron-expression": "^3.3.2",
"egulias/email-validator": "^3.2.1|^4.0", "egulias/email-validator": "^3.2.1|^4.0",
"ext-mbstring": "*", "ext-mbstring": "*",
@ -1365,7 +1364,6 @@
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage, and SES mail driver (^3.235.5).", "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage, and SES mail driver (^3.235.5).",
"brianium/paratest": "Required to run tests in parallel (^6.0).", "brianium/paratest": "Required to run tests in parallel (^6.0).",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.4).", "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.13.3|^3.1.4).",
"ext-bcmath": "Required to use the multiple_of validation rule.",
"ext-ftp": "Required to use the Flysystem FTP driver.", "ext-ftp": "Required to use the Flysystem FTP driver.",
"ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().",
"ext-memcached": "Required to use the memcache cache driver.", "ext-memcached": "Required to use the memcache cache driver.",
@ -1437,7 +1435,7 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2023-01-17T15:06:19+00:00" "time": "2023-02-01T17:36:26+00:00"
}, },
{ {
"name": "laravel/sanctum", "name": "laravel/sanctum",
@ -1506,16 +1504,16 @@
}, },
{ {
"name": "laravel/serializable-closure", "name": "laravel/serializable-closure",
"version": "v1.2.2", "version": "v1.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/serializable-closure.git", "url": "https://github.com/laravel/serializable-closure.git",
"reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae" "reference": "f23fe9d4e95255dacee1bf3525e0810d1a1b0f37"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/47afb7fae28ed29057fdca37e16a84f90cc62fae", "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/f23fe9d4e95255dacee1bf3525e0810d1a1b0f37",
"reference": "47afb7fae28ed29057fdca37e16a84f90cc62fae", "reference": "f23fe9d4e95255dacee1bf3525e0810d1a1b0f37",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1562,7 +1560,7 @@
"issues": "https://github.com/laravel/serializable-closure/issues", "issues": "https://github.com/laravel/serializable-closure/issues",
"source": "https://github.com/laravel/serializable-closure" "source": "https://github.com/laravel/serializable-closure"
}, },
"time": "2022-09-08T13:45:54+00:00" "time": "2023-01-30T18:31:20+00:00"
}, },
{ {
"name": "laravel/tinker", "name": "laravel/tinker",
@ -2468,16 +2466,16 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "2.65.0", "version": "2.66.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "09acf64155c16dc6f580f36569ae89344e9734a3" "reference": "496712849902241f04902033b0441b269effe001"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/09acf64155c16dc6f580f36569ae89344e9734a3", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/496712849902241f04902033b0441b269effe001",
"reference": "09acf64155c16dc6f580f36569ae89344e9734a3", "reference": "496712849902241f04902033b0441b269effe001",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2566,7 +2564,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-06T15:55:01+00:00" "time": "2023-01-29T18:53:47+00:00"
}, },
{ {
"name": "nette/schema", "name": "nette/schema",
@ -2632,29 +2630,30 @@
}, },
{ {
"name": "nette/utils", "name": "nette/utils",
"version": "v3.2.9", "version": "v4.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nette/utils.git", "url": "https://github.com/nette/utils.git",
"reference": "c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c" "reference": "cacdbf5a91a657ede665c541eda28941d4b09c1e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c", "url": "https://api.github.com/repos/nette/utils/zipball/cacdbf5a91a657ede665c541eda28941d4b09c1e",
"reference": "c91bac3470c34b2ecd5400f6e6fdf0b64a836a5c", "reference": "cacdbf5a91a657ede665c541eda28941d4b09c1e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2 <8.3" "php": ">=8.0 <8.3"
}, },
"conflict": { "conflict": {
"nette/di": "<3.0.6" "nette/finder": "<3",
"nette/schema": "<1.2.2"
}, },
"require-dev": { "require-dev": {
"jetbrains/phpstorm-attributes": "dev-master", "jetbrains/phpstorm-attributes": "dev-master",
"nette/tester": "~2.0", "nette/tester": "^2.4",
"phpstan/phpstan": "^1.0", "phpstan/phpstan": "^1.0",
"tracy/tracy": "^2.3" "tracy/tracy": "^2.9"
}, },
"suggest": { "suggest": {
"ext-gd": "to use Image", "ext-gd": "to use Image",
@ -2668,7 +2667,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.2-dev" "dev-master": "4.0-dev"
} }
}, },
"autoload": { "autoload": {
@ -2712,9 +2711,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/nette/utils/issues", "issues": "https://github.com/nette/utils/issues",
"source": "https://github.com/nette/utils/tree/v3.2.9" "source": "https://github.com/nette/utils/tree/v4.0.0"
}, },
"time": "2023-01-18T03:26:20+00:00" "time": "2023-02-02T10:41:53+00:00"
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
@ -3583,16 +3582,16 @@
}, },
{ {
"name": "psy/psysh", "name": "psy/psysh",
"version": "v0.11.11", "version": "v0.11.12",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/bobthecow/psysh.git", "url": "https://github.com/bobthecow/psysh.git",
"reference": "ba67f2d26278ec9266a5cfe0acba33a8ca1277ae" "reference": "52cb7c47d403c31c0adc9bf7710fc355f93c20f7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/bobthecow/psysh/zipball/ba67f2d26278ec9266a5cfe0acba33a8ca1277ae", "url": "https://api.github.com/repos/bobthecow/psysh/zipball/52cb7c47d403c31c0adc9bf7710fc355f93c20f7",
"reference": "ba67f2d26278ec9266a5cfe0acba33a8ca1277ae", "reference": "52cb7c47d403c31c0adc9bf7710fc355f93c20f7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3653,9 +3652,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/bobthecow/psysh/issues", "issues": "https://github.com/bobthecow/psysh/issues",
"source": "https://github.com/bobthecow/psysh/tree/v0.11.11" "source": "https://github.com/bobthecow/psysh/tree/v0.11.12"
}, },
"time": "2023-01-23T16:14:59+00:00" "time": "2023-01-29T21:24:40+00:00"
}, },
{ {
"name": "ralouphie/getallheaders", "name": "ralouphie/getallheaders",
@ -3792,20 +3791,20 @@
}, },
{ {
"name": "ramsey/uuid", "name": "ramsey/uuid",
"version": "4.7.3", "version": "4.x-dev",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/ramsey/uuid.git", "url": "https://github.com/ramsey/uuid.git",
"reference": "433b2014e3979047db08a17a205f410ba3869cf2" "reference": "25c4faac19549ebfcd3a6a73732dddeb188eaf5a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/433b2014e3979047db08a17a205f410ba3869cf2", "url": "https://api.github.com/repos/ramsey/uuid/zipball/25c4faac19549ebfcd3a6a73732dddeb188eaf5a",
"reference": "433b2014e3979047db08a17a205f410ba3869cf2", "reference": "25c4faac19549ebfcd3a6a73732dddeb188eaf5a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"brick/math": "^0.8.8 || ^0.9 || ^0.10", "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11",
"ext-json": "*", "ext-json": "*",
"php": "^8.0", "php": "^8.0",
"ramsey/collection": "^1.2 || ^2.0" "ramsey/collection": "^1.2 || ^2.0"
@ -3842,6 +3841,7 @@
"paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter",
"ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type."
}, },
"default-branch": true,
"type": "library", "type": "library",
"extra": { "extra": {
"captainhook": { "captainhook": {
@ -3868,7 +3868,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/ramsey/uuid/issues", "issues": "https://github.com/ramsey/uuid/issues",
"source": "https://github.com/ramsey/uuid/tree/4.7.3" "source": "https://github.com/ramsey/uuid/tree/4.x"
}, },
"funding": [ "funding": [
{ {
@ -3880,7 +3880,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-12T18:13:24+00:00" "time": "2023-01-28T17:00:47+00:00"
}, },
{ {
"name": "rap2hpoutre/fast-excel", "name": "rap2hpoutre/fast-excel",
@ -4589,16 +4589,16 @@
}, },
{ {
"name": "symfony/http-foundation", "name": "symfony/http-foundation",
"version": "v6.2.5", "version": "v6.2.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-foundation.git", "url": "https://github.com/symfony/http-foundation.git",
"reference": "9d081ead9d3432e2e8002178d14c4c9dd4b8ffbf" "reference": "e8dd1f502bc2b3371d05092aa233b064b03ce7ed"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/9d081ead9d3432e2e8002178d14c4c9dd4b8ffbf", "url": "https://api.github.com/repos/symfony/http-foundation/zipball/e8dd1f502bc2b3371d05092aa233b064b03ce7ed",
"reference": "9d081ead9d3432e2e8002178d14c4c9dd4b8ffbf", "reference": "e8dd1f502bc2b3371d05092aa233b064b03ce7ed",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4647,7 +4647,7 @@
"description": "Defines an object-oriented layer for the HTTP specification", "description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/http-foundation/tree/v6.2.5" "source": "https://github.com/symfony/http-foundation/tree/v6.2.6"
}, },
"funding": [ "funding": [
{ {
@ -4663,20 +4663,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-01T08:38:09+00:00" "time": "2023-01-30T15:46:28+00:00"
}, },
{ {
"name": "symfony/http-kernel", "name": "symfony/http-kernel",
"version": "v6.2.5", "version": "v6.2.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-kernel.git", "url": "https://github.com/symfony/http-kernel.git",
"reference": "f68aaa11eee6b21c99bce0f3d98815924888fe62" "reference": "7122db07b0d8dbf0de682267c84217573aee3ea7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/f68aaa11eee6b21c99bce0f3d98815924888fe62", "url": "https://api.github.com/repos/symfony/http-kernel/zipball/7122db07b0d8dbf0de682267c84217573aee3ea7",
"reference": "f68aaa11eee6b21c99bce0f3d98815924888fe62", "reference": "7122db07b0d8dbf0de682267c84217573aee3ea7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -4758,7 +4758,7 @@
"description": "Provides a structured process for converting a Request into a Response", "description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/http-kernel/tree/v6.2.5" "source": "https://github.com/symfony/http-kernel/tree/v6.2.6"
}, },
"funding": [ "funding": [
{ {
@ -4774,7 +4774,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-24T15:33:24+00:00" "time": "2023-02-01T08:32:25+00:00"
}, },
{ {
"name": "symfony/mailer", "name": "symfony/mailer",
@ -6922,16 +6922,16 @@
}, },
{ {
"name": "laravel/breeze", "name": "laravel/breeze",
"version": "v1.18.0", "version": "v1.18.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/breeze.git", "url": "https://github.com/laravel/breeze.git",
"reference": "4280282cff1ed240d6494bbb3405635820a09931" "reference": "bed2fb2a8a4131be37cc3556826cca961db3406a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/breeze/zipball/4280282cff1ed240d6494bbb3405635820a09931", "url": "https://api.github.com/repos/laravel/breeze/zipball/bed2fb2a8a4131be37cc3556826cca961db3406a",
"reference": "4280282cff1ed240d6494bbb3405635820a09931", "reference": "bed2fb2a8a4131be37cc3556826cca961db3406a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6979,20 +6979,20 @@
"issues": "https://github.com/laravel/breeze/issues", "issues": "https://github.com/laravel/breeze/issues",
"source": "https://github.com/laravel/breeze" "source": "https://github.com/laravel/breeze"
}, },
"time": "2023-01-17T14:08:34+00:00" "time": "2023-01-31T16:16:21+00:00"
}, },
{ {
"name": "laravel/pint", "name": "laravel/pint",
"version": "v1.4.0", "version": "v1.4.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/pint.git", "url": "https://github.com/laravel/pint.git",
"reference": "0e7ffdb0af871be10d798e234772ea5d4020ae4a" "reference": "80ddf23a5d97825e79bb1018eebb6f3f985d4fa8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/pint/zipball/0e7ffdb0af871be10d798e234772ea5d4020ae4a", "url": "https://api.github.com/repos/laravel/pint/zipball/80ddf23a5d97825e79bb1018eebb6f3f985d4fa8",
"reference": "0e7ffdb0af871be10d798e234772ea5d4020ae4a", "reference": "80ddf23a5d97825e79bb1018eebb6f3f985d4fa8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7003,7 +7003,7 @@
"php": "^8.0" "php": "^8.0"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "~3.13.1", "friendsofphp/php-cs-fixer": "^3.14",
"illuminate/view": "^9.32.0", "illuminate/view": "^9.32.0",
"laravel-zero/framework": "^9.2.0", "laravel-zero/framework": "^9.2.0",
"mockery/mockery": "^1.5.1", "mockery/mockery": "^1.5.1",
@ -7045,20 +7045,20 @@
"issues": "https://github.com/laravel/pint/issues", "issues": "https://github.com/laravel/pint/issues",
"source": "https://github.com/laravel/pint" "source": "https://github.com/laravel/pint"
}, },
"time": "2023-01-10T20:03:42+00:00" "time": "2023-01-31T15:50:45+00:00"
}, },
{ {
"name": "laravel/sail", "name": "laravel/sail",
"version": "v1.18.1", "version": "v1.19.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/sail.git", "url": "https://github.com/laravel/sail.git",
"reference": "a64f78a4ab86c04a4c5de39bea20a8d36ad48a22" "reference": "4f230634a3163f3442def6a4e6ffdb02b02e14d6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/sail/zipball/a64f78a4ab86c04a4c5de39bea20a8d36ad48a22", "url": "https://api.github.com/repos/laravel/sail/zipball/4f230634a3163f3442def6a4e6ffdb02b02e14d6",
"reference": "a64f78a4ab86c04a4c5de39bea20a8d36ad48a22", "reference": "4f230634a3163f3442def6a4e6ffdb02b02e14d6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7105,7 +7105,7 @@
"issues": "https://github.com/laravel/sail/issues", "issues": "https://github.com/laravel/sail/issues",
"source": "https://github.com/laravel/sail" "source": "https://github.com/laravel/sail"
}, },
"time": "2023-01-11T14:35:04+00:00" "time": "2023-01-31T13:37:57+00:00"
}, },
{ {
"name": "mockery/mockery", "name": "mockery/mockery",
@ -7439,16 +7439,16 @@
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "9.2.23", "version": "9.2.24",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c" "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed",
"reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7504,7 +7504,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.23" "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24"
}, },
"funding": [ "funding": [
{ {
@ -7512,7 +7512,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2022-12-28T12:41:10+00:00" "time": "2023-01-26T08:26:55+00:00"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",

@ -16,6 +16,7 @@ return new class extends Migration
Schema::create('types', function (Blueprint $table) { Schema::create('types', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('name'); $table->string('name');
$table->bigInteger('classification_id')->nullable();
$table->timestamps(); $table->timestamps();
}); });
} }

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('classifications', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('classifications');
}
};

@ -5,6 +5,7 @@ namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents; // use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use App\Models\Category; use App\Models\Category;
use App\Models\Classification;
use App\Models\Company; use App\Models\Company;
use App\Models\Department; use App\Models\Department;
use App\Models\Group; use App\Models\Group;
@ -78,6 +79,10 @@ class DatabaseSeeder extends Seeder
['name' => 'update-company', 'label' => 'Edit Perusahaan'], ['name' => 'update-company', 'label' => 'Edit Perusahaan'],
['name' => 'create-company', 'label' => 'Buat Perusahaan'], ['name' => 'create-company', 'label' => 'Buat Perusahaan'],
['name' => 'delete-company', 'label' => 'Hapus Perusahaan'], ['name' => 'delete-company', 'label' => 'Hapus Perusahaan'],
['name' => 'view-classification', 'label' => 'Lihat Klasifikasi'],
['name' => 'update-classification', 'label' => 'Edit Klasifikasi'],
['name' => 'create-classification', 'label' => 'Buat Klasifikasi'],
['name' => 'delete-classification', 'label' => 'Hapus Klasifikasi'],
['name' => 'view-setting', 'label' => 'Setting'], ['name' => 'view-setting', 'label' => 'Setting'],
]; ];
@ -96,7 +101,8 @@ class DatabaseSeeder extends Seeder
]); ]);
Type::create(['name' => 'Type 1']); $classification = Classification::create(['name' => 'Klasifikasi 1']);
Type::create(['name' => 'Type 1', 'classification_id' => $classification->id]);
Category::create(['name' => 'Category 1', 'short' => 'C1', 'duration' => 3]); Category::create(['name' => 'Category 1', 'short' => 'C1', 'duration' => 3]);
Setting::create([ Setting::create([

@ -2,6 +2,12 @@
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
.table td, .table th {
padding: 1rem;
vertical-align: middle;
white-space: normal;
}
/* width */ /* width */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 5px; width: 5px;

@ -11,6 +11,7 @@ const rs = [
{name: "Dokumen", show: true, items: [ {name: "Dokumen", show: true, items: [
{name: "Dokumen", route: 'docs.index', show: true, permission: 'view-document'}, {name: "Dokumen", route: 'docs.index', show: true, permission: 'view-document'},
{name: "Ketegori", route: 'categories.index', show: true, permission: 'view-category'}, {name: "Ketegori", route: 'categories.index', show: true, permission: 'view-category'},
{name: "Klasifikasi", route: 'classifications.index', show: true, permission: 'view-classification'},
{name: "Jenis", route: 'types.index', show: true, permission: 'view-type'}, {name: "Jenis", route: 'types.index', show: true, permission: 'view-type'},
]}, ]},
{name: "Perusahaan", show: true, items: [ {name: "Perusahaan", show: true, items: [

@ -0,0 +1,112 @@
import React, { useEffect } from 'react'
import { useForm, usePage } from '@inertiajs/react'
import { toast } from 'react-toastify'
export default function FormModal(props) {
const { modalState } = props
const { data, setData, post, put, processing, errors, reset, clearErrors } = useForm({
name: '',
})
const handleOnChange = (event) => {
setData(event.target.name, event.target.type === 'checkbox' ? event.target.checked : event.target.value);
}
const handleReset = () => {
reset()
clearErrors()
modalState.setData(null)
}
const handleCancel = () => {
handleReset()
modalState.toggle()
}
const handleSubmit = () => {
const classification = modalState.data
if(classification !== null) {
put(route('classifications.update', classification), {
onSuccess: () =>
Promise.all([
handleReset(),
modalState.toggle(),
toast.success('The Data has been changed'),
]),
})
return
}
post(route('classifications.store'), {
onSuccess: () =>
Promise.all([
handleReset(),
modalState.toggle(),
toast.success('The Data has been saved'),
]),
})
}
useEffect(() => {
const classification = modalState.data
if (classification !== null) {
setData({
name: classification?.name,
})
}
}, [modalState])
return (
<div
className="modal modal-bottom sm:modal-middle pb-10"
style={
modalState.isOpen
? {
opacity: 1,
pointerEvents: 'auto',
visibility: 'visible',
overflowY: 'initial',
}
: {}
}
>
<div className="modal-box overflow-y-auto max-h-screen">
<h1 className="font-bold text-2xl pb-8">Klasifikasi</h1>
<div className="form-control">
<label className="label">
<span className="label-text font-semibold">Nama</span>
</label>
<input
type="text"
placeholder="nama"
className={`input input-bordered ${
errors.name && 'input-error'
}`}
name="name"
value={data.name}
onChange={handleOnChange}
/>
<label className="label">
<span className="label-text-alt text-red-600">{errors.name}</span>
</label>
</div>
<div className="modal-action">
<div
onClick={handleSubmit}
className="btn btn-primary"
disabled={processing}
>
Simpan
</div>
<div
onClick={handleCancel}
className="btn btn-secondary"
disabled={processing}
>
Batal
</div>
</div>
</div>
</div>
)
}

@ -0,0 +1,118 @@
import React from 'react'
import { Head } from '@inertiajs/react'
import { router } from '@inertiajs/react'
import { toast } from 'react-toastify'
import { useModalState } from '@/Hooks'
import { hasPermission } from '@/utils'
import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout'
import Pagination from '@/Components/Pagination'
import ModalConfirm from '@/Components/ModalConfirm'
import FormModal from './FormModal'
export default function Classification(props) {
const { data: classifications, links } = props.classifications
const formModal = useModalState(false)
const toggle = (classification = null) => {
formModal.setData(classification)
formModal.toggle()
}
const confirmModal = useModalState(false)
const handleDelete = (classification) => {
confirmModal.setData(classification)
confirmModal.toggle()
}
const onDelete = () => {
const classification = confirmModal.data
if(classification != null) {
router.delete(route('classifications.destroy', classification), {
onSuccess: () => toast.success('The Data has been deleted'),
})
}
}
const canCreate = hasPermission('create-classification', props.auth.user)
const canUpdate = hasPermission('update-classification', props.auth.user)
const canDelete = hasPermission('delete-classification', props.auth.user)
return (
<AuthenticatedLayout
auth={props.auth}
errors={props.errors}
flash={props.flash}
notify={props.notify}
>
<Head title="Roles" />
<div className="flex flex-col w-full sm:px-6 lg:px-8 space-y-2">
<div className="card bg-base-100 w-full">
<div className="card-body">
<div className="flex w-full mb-4 justify-between">
{canCreate && (
<div
className="btn btn-neutral"
onClick={() => toggle()}
>
Tambah
</div>
)}
</div>
<div className="overflow-x-auto">
<table className="table w-full table-zebra">
<thead>
<tr>
<th>Id</th>
<th>Nama</th>
<th></th>
</tr>
</thead>
<tbody>
{classifications?.map((classification) => (
<tr key={classification.id}>
<th>{classification.id}</th>
<td>{classification.name}</td>
<td className="text-right">
{canUpdate && (
<div
className="btn btn-primary mx-1"
onClick={() =>
toggle(classification)
}
>
Edit
</div>
)}
{canDelete && (
<div
className="btn btn-secondary mx-1"
onClick={() =>
handleDelete(classification)
}
>
Delete
</div>
)}
</td>
</tr>
))}
</tbody>
</table>
</div>
<Pagination links={links} />
</div>
</div>
</div>
<FormModal
modalState={formModal}
/>
<ModalConfirm
isOpen={confirmModal.isOpen}
toggle={confirmModal.toggle}
onConfirm={onDelete}
/>
</AuthenticatedLayout>
)
}

@ -134,10 +134,12 @@ export default function Document(props) {
<table className="table w-full table-zebra"> <table className="table w-full table-zebra">
<thead> <thead>
<tr> <tr>
<th>Perusahaan</th>
<th className='hover:underline' onClick={() => sort('type_id')}>Jenis</th> <th className='hover:underline' onClick={() => sort('type_id')}>Jenis</th>
<th className='hover:underline' onClick={() => sort('category_id')}>Ketegori</th> <th className='hover:underline' onClick={() => sort('category_id')}>Ketegori</th>
<th>No Dokumen</th> <th>No Dokumen</th>
<th>Nama Dokumen</th> <th>Nama Dokumen</th>
<th className='hover:underline' onClick={() => sort('publish_date')}>Tanggal Terbit</th>
<th className='hover:underline' onClick={() => sort('due_date')}>Tanggal Berakhir</th> <th className='hover:underline' onClick={() => sort('due_date')}>Tanggal Berakhir</th>
<th>Catatan</th> <th>Catatan</th>
<th></th> <th></th>
@ -146,15 +148,19 @@ export default function Document(props) {
<tbody> <tbody>
{docs?.map((doc) => ( {docs?.map((doc) => (
<tr key={doc.id}> <tr key={doc.id}>
<td>{doc.company.short}</td>
<td>{doc.variety.name}</td> <td>{doc.variety.name}</td>
<td>{doc.category.name}</td> <td>{doc.category.name}</td>
<td>{doc.no_doc}</td> <td>{doc.no_doc}</td>
<td>{doc.name}</td> <td>{doc.name}</td>
<td>
{doc.publish_date !== null ? formatDate(doc.publish_date) : ''}
</td>
<td> <td>
{doc.due_date !== null ? formatDate(doc.due_date) : ''} {doc.due_date !== null ? formatDate(doc.due_date) : ''}
</td> </td>
<th>{doc.due_status}</th> <th>{doc.due_status}</th>
<td className='text-right'> <td className='text-right w-1/8'>
<div className="dropdown dropdown-left"> <div className="dropdown dropdown-left">
<label tabIndex={0} className="btn btn-sm m-1 px-1"><IconMenu/></label> <label tabIndex={0} className="btn btn-sm m-1 px-1"><IconMenu/></label>
<ul tabIndex={0} className="dropdown-content menu p-2 shadow bg-base-100 rounded-box w-52"> <ul tabIndex={0} className="dropdown-content menu p-2 shadow bg-base-100 rounded-box w-52">

@ -4,9 +4,11 @@ import { toast } from 'react-toastify'
export default function FormModal(props) { export default function FormModal(props) {
const { modalState } = props const { modalState } = props
const { props: { classifications } } = usePage()
const { data, setData, post, put, processing, errors, reset, clearErrors } = useForm({ const { data, setData, post, put, processing, errors, reset, clearErrors } = useForm({
name: '', name: '',
classification_id: ''
}) })
const handleOnChange = (event) => { const handleOnChange = (event) => {
@ -52,6 +54,7 @@ export default function FormModal(props) {
if (type !== null) { if (type !== null) {
setData({ setData({
name: type?.name, name: type?.name,
classification_id: type?.classification_id
}) })
} }
}, [modalState]) }, [modalState])
@ -90,6 +93,29 @@ export default function FormModal(props) {
<span className="label-text-alt text-red-600">{errors.name}</span> <span className="label-text-alt text-red-600">{errors.name}</span>
</label> </label>
</div> </div>
<div className="form-control">
<label className="label">
<span className="label-text">Klasifikasi</span>
</label>
<select
className={`select select-bordered w-full ${
errors.classification_id && 'select-error'
}`}
name='classification_id'
value={data.classification_id}
onChange={handleOnChange}
>
<option disabled value=""></option>
{classifications.map(classification => (
<option key={classification.id} value={classification.id}>{classification.name}</option>
))}
</select>
<label className="label">
<span className="label-text-alt">
{errors.classification_id}
</span>
</label>
</div>
<div className="modal-action"> <div className="modal-action">
<div <div
onClick={handleSubmit} onClick={handleSubmit}

@ -65,6 +65,7 @@ export default function Types(props) {
<tr> <tr>
<th>Id</th> <th>Id</th>
<th>Nama</th> <th>Nama</th>
<th>Klasifikasi</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
@ -73,6 +74,7 @@ export default function Types(props) {
<tr key={type.id}> <tr key={type.id}>
<th>{type.id}</th> <th>{type.id}</th>
<td>{type.name}</td> <td>{type.name}</td>
<td>{type?.classification?.name}</td>
<td className="text-right"> <td className="text-right">
{canUpdate && ( {canUpdate && (
<div <div

@ -1,6 +1,7 @@
<?php <?php
use App\Http\Controllers\CategoryController; use App\Http\Controllers\CategoryController;
use App\Http\Controllers\ClassificationController;
use App\Http\Controllers\CompanyController; use App\Http\Controllers\CompanyController;
use App\Http\Controllers\DocumentController; use App\Http\Controllers\DocumentController;
use App\Http\Controllers\GeneralController; use App\Http\Controllers\GeneralController;
@ -58,6 +59,11 @@ Route::middleware(['auth'])->group(function () {
Route::post('/companies', [CompanyController::class, 'store'])->name('companies.store'); Route::post('/companies', [CompanyController::class, 'store'])->name('companies.store');
Route::put('/companies/{company}', [CompanyController::class, 'update'])->name('companies.update'); Route::put('/companies/{company}', [CompanyController::class, 'update'])->name('companies.update');
Route::delete('/companies/{company}', [CompanyController::class, 'destroy'])->name('companies.destroy'); Route::delete('/companies/{company}', [CompanyController::class, 'destroy'])->name('companies.destroy');
Route::get('/classifications', [ClassificationController::class, 'index'])->name('classifications.index');
Route::post('/classifications', [ClassificationController::class, 'store'])->name('classifications.store');
Route::put('/classifications/{classification}', [ClassificationController::class, 'update'])->name('classifications.update');
Route::delete('/classifications/{classification}', [ClassificationController::class, 'destroy'])->name('classifications.destroy');
Route::get('/types', [TypeController::class, 'index'])->name('types.index'); Route::get('/types', [TypeController::class, 'index'])->name('types.index');
Route::post('/types', [TypeController::class, 'store'])->name('types.store'); Route::post('/types', [TypeController::class, 'store'])->name('types.store');

Loading…
Cancel
Save