diff --git a/app/Http/Controllers/M_assetController.php b/app/Http/Controllers/M_assetController.php index 401c2a1..c5b8cb2 100644 --- a/app/Http/Controllers/M_assetController.php +++ b/app/Http/Controllers/M_assetController.php @@ -2,14 +2,17 @@ namespace App\Http\Controllers; -use App\Exports\AssetExport; +use Dompdf\Dompdf; use App\Models\m_asset; use Barryvdh\DomPDF\PDF; -use Dompdf\Dompdf; use App\Models\m_warehouse; +use App\Exports\AssetExport; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Maatwebsite\Excel\Facades\Excel; +use Illuminate\Support\Facades\Storage; +// use SimpleSoftwareIO\QrCode\Facades\QrCode; +use SimpleSoftwareIO\QrCode\Facades\QrCode; class M_assetController extends Controller { @@ -20,7 +23,7 @@ class M_assetController extends Controller { $asset = m_asset::get(); $warehouse = m_warehouse::all(); - return view('addons.SettingPlatform.manajement_asset', compact('asset', 'warehouse')); + return view('MasterData.asset', compact('asset', 'warehouse')); } /** @@ -36,32 +39,122 @@ class M_assetController extends Controller */ // public function store(Request $request) // { + // $latestAsset = \App\Models\m_asset::latest()->first(); + // // Mendapatkan tahun saat ini + // $currentYear = date("Y"); + // // Menghitung nomor urut untuk kode barang + // if ($latestAsset == null) { + // // Kode pertama + // $nomorUrut = 1; + // } else { + // // Kode berikutnya + // $lastCode = substr($latestAsset->seri, 7); + // $nomorUrut = intval($lastCode) + 1; + // } + // // Menggabungkan semua komponen kode barang + // $seri = 'AST' . $currentYear . str_pad($nomorUrut, STR_PAD_LEFT); + // // Validasi input + // $request->validate([ + // 'name' => 'required', + // 'description' => 'required', + // 'warehouse_id' => 'required', + // 'date' => 'required', + // 'qr_count' => '', + // ]); + // try { + // $currentUser = Auth::user(); + // // Menyiapkan data untuk disimpan + // $validatedData = $request->except('_token'); + // $validatedData['seri'] = $seri; + // $validatedData['created_by'] = $currentUser->id; // Menambahkan ID pengguna sebagai created_by + // $validatedData['updated_by'] = $currentUser->id; // Menambahkan ID pengguna sebagai updated_by + + // // Menyimpan data ke dalam database + // $newAsset = \App\Models\m_asset::create($validatedData); + + // // Membuat QR code dan menyimpannya ke dalam basis data + // $dataForQR = [ + // 'seri' => $newAsset->seri, + // 'name' => $newAsset->name, + // // ... tambahkan lebih banyak data sesuai kebutuhan ... + // ]; + + // $qrCode = QrCode::size(300)->generate(json_encode($dataForQR)); + + // // Menyimpan QR code ke dalam kolom 'qr_code' di tabel asset (perbaikan) + // $newAsset->update(['qr_count' => $qrCode]); + + // return redirect()->back()->with('success', 'Data asset berhasil ditambah.'); + // } catch (\Throwable $th) { + // return redirect()->back()->with('error', 'Data asset gagal ditambah.'); + // } + // } + + // public function store(Request $request) + // { + // $latestAsset = \App\Models\m_asset::latest()->first(); + + // // Mendapatkan tahun saat ini + // $currentYear = date("Y"); + + // // Menghitung nomor urut untuk kode barang + // if ($latestAsset == null) { + // // Kode pertama + // $nomorUrut = 1; + // } else { + // // Kode berikutnya + // $lastCode = substr($latestAsset->seri, 7); + // $nomorUrut = intval($lastCode) + 1; + // } + + // // Menggabungkan semua komponen kode barang + // $seri = 'AST' . $currentYear . str_pad($nomorUrut, STR_PAD_LEFT); + + // // Validasi input // $request->validate([ // 'name' => 'required', // 'description' => 'required', // 'warehouse_id' => 'required', // 'date' => 'required', - // 'qr_count' => 'required', + // 'qr_count' => '', // ]); - // // dd($request); + // try { // $currentUser = Auth::user(); + // // Menyiapkan data untuk disimpan // $validatedData = $request->except('_token'); + // $validatedData['seri'] = $seri; // $validatedData['created_by'] = $currentUser->id; // Menambahkan ID pengguna sebagai created_by // $validatedData['updated_by'] = $currentUser->id; // Menambahkan ID pengguna sebagai updated_by - // dd($validatedData); - // m_asset::create($validatedData); - // return redirect()->back()->with('success', 'Data barang berhasil ditambah.'); + + // // Menyimpan data ke dalam database + // $newAsset = \App\Models\m_asset::create($validatedData); + + // // Generate QR code and save it as an image in the public directory + // $dataForQR = [ + // 'seri' => $newAsset->seri, + // 'name' => $newAsset->name, + // // ... tambahkan lebih banyak data sesuai kebutuhan ... + // ]; + + // $qrCode = QrCode::format('png')->size(300)->generate(json_encode($dataForQR)); + + // // Menyimpan QR code sebagai gambar di direktori penyimpanan publik + // $qrCodePath = 'qr_codes/' . $seri . '.png'; + // Storage::disk('public')->put($qrCodePath, $qrCode); + + // // Menyimpan URL gambar QR code ke dalam kolom 'qr_count' + // $newAsset->update(['qr_count' => $qrCodePath]); + + // return redirect()->back()->with('success', 'Data asset berhasil ditambah.'); // } catch (\Throwable $th) { - // return redirect()->back()->with('error', 'Data barang gagal ditambah.'); + // return redirect()->back()->with('error', 'Data asset gagal ditambah.'); // } - // return redirect()->back()->with('success', 'Data barang berhasil ditambah.'); // } public function store(Request $request) { // dd($request); - // Mendapatkan produk terbaru $latestAsset = \App\Models\m_asset::latest()->first(); // Mendapatkan tahun saat ini $currentYear = date("Y-m-d"); @@ -82,7 +175,6 @@ class M_assetController extends Controller 'description' => 'required', 'warehouse_id' => 'required', 'date' => 'required', - 'qr_count' => 'required', ]); try { $currentUser = Auth::user(); @@ -107,6 +199,18 @@ class M_assetController extends Controller public function show($id) { // dd('oke'); + $asset = m_asset::find($id); + $warehouse = m_warehouse::all(); + return view('MasterData.asset.show', compact('asset', 'warehouse')); + } + + // Menampilkan data QR + public function QR($id) + { + $asset = m_asset::find($id); + return QrCode::generate( + 'Hello, World!', + ); } /** @@ -165,7 +269,7 @@ class M_assetController extends Controller // Buat objek Dompdf $dompdf = new Dompdf(); // Render tampilan ke PDF - $html = view('addons.SettingPlatform.asset_pdf', compact('asset'))->render(); + $html = view('MasterData.asset_pdf', compact('asset'))->render(); // Muat HTML ke Dompdf $dompdf->loadHtml($html); @@ -177,11 +281,14 @@ class M_assetController extends Controller $dompdf->render(); // Tampilkan PDF di browser - return $dompdf->stream('Laporan Barang'); + return $dompdf->stream('Laporan Assets'); } + /** + * Cetak Exel. + */ public function export() { - return Excel::download(new AssetExport, 'Assets.xlsx'); + return Excel::download(new AssetExport, 'Laporan Assets.xlsx'); } } diff --git a/app/Http/Controllers/M_userController.php b/app/Http/Controllers/M_userController.php index c26342f..473c7f7 100644 --- a/app/Http/Controllers/M_userController.php +++ b/app/Http/Controllers/M_userController.php @@ -6,6 +6,7 @@ use App\Models\User; use App\Models\m_role; use App\Models\m_warehouse; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; class M_userController extends Controller { @@ -15,8 +16,10 @@ class M_userController extends Controller public function index() { // dd('oke'); + $warehouse = m_warehouse::get(); + $role = m_role::get(); $user = User::get(); - return view('addons.SettingPlatform.manajement_user', compact('user')); + return view('MasterData.user', compact('user', 'role', 'warehouse')); } /** @@ -32,7 +35,27 @@ class M_userController extends Controller */ public function store(Request $request) { - // dd('oke'); + $request->validate([ + 'username' => 'required', + 'fullname' => 'required', + 'email' => 'required|email', + 'divisi' => 'required', + 'role_id' => 'required', + 'warehouse_id' => 'required', + 'password' => 'required', + ]); + + try { + $currentUser = Auth::user(); + $validatedData = $request->except('_token'); + $validatedData['created_by'] = $currentUser->fullname; // Menggunakan nama pengguna sebagai created_by + $validatedData['updated_by'] = $currentUser->fullname; // Menggunakan nama pengguna sebagai updated_by + $validatedData['password'] = bcrypt($request->input('password')); // Enkripsi password + user::create($validatedData); + return redirect()->back()->with('success', 'Data User Berhasil Ditambah.'); + } catch (\Throwable $th) { + return redirect()->back()->with('error', 'Data User Gagal Ditambah.'); + } } /** @@ -44,7 +67,7 @@ class M_userController extends Controller $user = User::find($id); $role = m_role::get(); $warehouse = m_warehouse::get(); - return view('addons.SettingPlatform.update_user', compact('user', 'role', 'warehouse')); + return view('MasterData.update_user', compact('user', 'role', 'warehouse')); } /** @@ -67,18 +90,30 @@ class M_userController extends Controller 'no_hp' => 'required', 'divisi' => 'required', 'address' => 'required', - 'status' => 'required', 'role_id' => 'required', 'warehouse_id' => 'required', ]); // dd($request->all()); try { $user = User::findOrFail($id); - $user->update($request->all()); + $userData = $request->all(); + + // Menambahkan nama pengguna yang melakukan pembaruan + $userData['updated_by'] = Auth::user()->fullname; + + $user->update($userData); return redirect()->route('user.index')->with('success', 'Data User berhasil diperbaharui'); } catch (\Throwable $th) { return redirect()->back()->with('error', 'Data User gagal diperbaharui'); } + // try { + // $user = User::findOrFail($id); + // $user->update($request->all()); + + // return redirect()->route('user.index')->with('success', 'Data User berhasil diperbaharui'); + // } catch (\Throwable $th) { + // return redirect()->back()->with('error', 'Data User gagal diperbaharui'); + // } } /** diff --git a/app/Http/Controllers/PeminjamanController.php b/app/Http/Controllers/PeminjamanController.php index dbc364e..136584c 100644 --- a/app/Http/Controllers/PeminjamanController.php +++ b/app/Http/Controllers/PeminjamanController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Models\asset_status; use App\Models\m_asset; +use App\Models\m_warehouse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -16,7 +17,8 @@ class PeminjamanController extends Controller { $asset = m_asset::all(); $peminjaman = asset_status::get(); - return view('dashboard.peminjaman', compact('asset', 'peminjaman')); + $warehouse = m_warehouse::get(); + return view('dashboard.peminjaman', compact('asset', 'peminjaman', 'warehouse')); } /** @@ -86,8 +88,7 @@ class PeminjamanController extends Controller // dd($request); try { $peminjaman = asset_status::findOrFail($id); - // dd($peminjaman); - // dd($request->all()); + $peminjaman['updated_by'] = Auth::user()->fullname; // Menambahkan ID pengguna sebagai updated_by $peminjaman->update($request->all()); return redirect()->back()->with('success', 'Data peminjaman berhasil diperbaharui'); } catch (\Throwable $th) { diff --git a/app/Http/Controllers/PengembalianController.php b/app/Http/Controllers/PengembalianController.php index 68e1c5e..75e1038 100644 --- a/app/Http/Controllers/PengembalianController.php +++ b/app/Http/Controllers/PengembalianController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Models\asset_status; use App\Models\m_asset; +use App\Models\m_warehouse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -37,8 +38,9 @@ class PengembalianController extends Controller */ public function show($id) { + $warehouse = m_warehouse::get(); $peminjaman = asset_status::findOrFail($id); - return view('dashboard.update_pengembalian', compact('peminjaman')); + return view('dashboard.update_pengembalian', compact('peminjaman', 'warehouse')); } /** @@ -55,20 +57,18 @@ class PengembalianController extends Controller public function update(Request $request, $id) { // dd('oke'); + // dd($request->all()); $request->validate([ 'asset_id' => 'required', 'exit_at' => 'required', 'exit_pic' => 'required', - 'exit_warehouse' => 'required', 'enter_at' => 'required', 'enter_pic' => 'required', 'enter_warehouse' => 'required', ]); - // dd($request); try { $peminjaman = asset_status::findOrFail($id); - // dd($peminjaman); - // dd($request->all()); + $peminjaman['updated_by'] = Auth::user()->fullname; // Menambahkan ID pengguna sebagai updated_by $peminjaman->update($request->all()); return redirect()->route('pengembalian.index')->with('success', 'Data peminjaman berhasil diperbaharui'); } catch (\Throwable $th) { @@ -76,6 +76,30 @@ class PengembalianController extends Controller return redirect()->back()->with('error', 'Data peminjaman gagal diperbaharui'); } } + // public function update(Request $request, $id) + // { + // // dd('oke'); + // $request->validate([ + // 'asset_id' => 'required', + // 'exit_at' => 'required', + // 'exit_pic' => 'required', + // 'exit_warehouse' => 'required', + // 'enter_at' => 'required', + // 'enter_pic' => 'required', + // 'enter_warehouse' => 'required', + // ]); + // // dd($request); + // try { + // $peminjaman = asset_status::findOrFail($id); + // // dd($peminjaman); + // // dd($request->all()); + // $peminjaman->update($request->all()); + // return redirect()->route('pengembalian.index')->with('success', 'Data peminjaman berhasil diperbaharui'); + // } catch (\Throwable $th) { + // // dd($th->getMessage()); + // return redirect()->back()->with('error', 'Data peminjaman gagal diperbaharui'); + // } + // } /** * Remove the specified resource from storage. diff --git a/app/Http/Controllers/WarehouseController.php b/app/Http/Controllers/WarehouseController.php new file mode 100644 index 0000000..3a7b51d --- /dev/null +++ b/app/Http/Controllers/WarehouseController.php @@ -0,0 +1,107 @@ +validate([ + 'name' => 'required', + 'description' => 'required', + 'address' => 'required', + ]); + try { + $currentUser = Auth::user(); + $validatedData = $request->except('_token'); + $validatedData['created_by'] = $currentUser->fullname; // Menggunakan nama pengguna sebagai created_by + $validatedData['updated_by'] = $currentUser->fullname; // Menggunakan nama pengguna sebagai updated_by + m_warehouse::create($validatedData); + return redirect()->back()->with('success', 'Data gudang berhasil ditambah.'); + } catch (\Throwable $th) { + return redirect()->back()->with('error', 'Data gudang gagal ditambah.'); + } + return redirect()->back()->with('success', 'Data gudang berhasil ditambah.'); + } + + /** + * Display the specified resource. + */ + public function show($id) + { + // dd('oke'); + } + + /** + * Show the form for editing the specified resource. + */ + public function edit() + { + // dd('oke'); + } + + /** + * Update the specified resource in storage. + */ + public function update(Request $request, $id) + { + // dd('oke'); + $request->validate([ + 'name' => 'required', + 'description' => 'required', + 'address' => 'required', + ]); + // dd($request); + try { + $warehouse = m_warehouse::findOrFail($id); + $warehouse->update($request->all()); + + // Menambahkan nama pengguna yang melakukan pembaruan + $userData['updated_by'] = Auth::user()->fullname; + + return redirect()->back()->with('success', 'Data Gudang Berhasil Diperbaharui'); + } catch (\Throwable $th) { + return redirect()->back()->with('error', 'Data Gudang Gagal Diperbaharui'); + } + } + + /** + * Remove the specified resource from storage. + */ + public function destroy($id) + { + // dd("oke"); + try { + $asset = m_warehouse::findOrFail($id); + $asset->delete(); + return redirect()->back()->with('success', 'Data Gudang berhasil dihapus'); + } catch (\Throwable $th) { + return redirect()->back()->with('error', 'Data Gudang gagal dihapus'); + } + } +} diff --git a/app/Models/asset_status.php b/app/Models/asset_status.php index ae8a4e0..98868f1 100644 --- a/app/Models/asset_status.php +++ b/app/Models/asset_status.php @@ -14,4 +14,9 @@ class asset_status extends Model { return $this->belongsTo(m_asset::class, 'asset_id'); } + + public function warehouse() + { + return $this->belongsTo(m_warehouse::class, 'exit_warehouse'); + } } diff --git a/composer.json b/composer.json index 35add6e..f5b11e9 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ "laravel/framework": "^10.10", "laravel/sanctum": "^3.2", "laravel/tinker": "^2.8", - "maatwebsite/excel": "^3.1" + "maatwebsite/excel": "^3.1", + "simplesoftwareio/simple-qrcode": "^4.2" }, "require-dev": { "fakerphp/faker": "^1.9.1", diff --git a/composer.lock b/composer.lock index b8e7377..9aaad52 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,62 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "52a35cd301acc3e94305f4149d559010", + "content-hash": "eebc71566b355489dede69a8f81b8d19", "packages": [ + { + "name": "bacon/bacon-qr-code", + "version": "2.0.8", + "source": { + "type": "git", + "url": "https://github.com/Bacon/BaconQrCode.git", + "reference": "8674e51bb65af933a5ffaf1c308a660387c35c22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/8674e51bb65af933a5ffaf1c308a660387c35c22", + "reference": "8674e51bb65af933a5ffaf1c308a660387c35c22", + "shasum": "" + }, + "require": { + "dasprid/enum": "^1.0.3", + "ext-iconv": "*", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "phly/keep-a-changelog": "^2.1", + "phpunit/phpunit": "^7 | ^8 | ^9", + "spatie/phpunit-snapshot-assertions": "^4.2.9", + "squizlabs/php_codesniffer": "^3.4" + }, + "suggest": { + "ext-imagick": "to generate QR code images" + }, + "type": "library", + "autoload": { + "psr-4": { + "BaconQrCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Ben Scholzen 'DASPRiD'", + "email": "mail@dasprids.de", + "homepage": "https://dasprids.de/", + "role": "Developer" + } + ], + "description": "BaconQrCode is a QR code generator for PHP.", + "homepage": "https://github.com/Bacon/BaconQrCode", + "support": { + "issues": "https://github.com/Bacon/BaconQrCode/issues", + "source": "https://github.com/Bacon/BaconQrCode/tree/2.0.8" + }, + "time": "2022-12-07T17:46:57+00:00" + }, { "name": "barryvdh/laravel-dompdf", "version": "v2.0.1", @@ -219,6 +273,56 @@ ], "time": "2023-08-31T09:50:34+00:00" }, + { + "name": "dasprid/enum", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/DASPRiD/Enum.git", + "reference": "6faf451159fb8ba4126b925ed2d78acfce0dc016" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/DASPRiD/Enum/zipball/6faf451159fb8ba4126b925ed2d78acfce0dc016", + "reference": "6faf451159fb8ba4126b925ed2d78acfce0dc016", + "shasum": "" + }, + "require": { + "php": ">=7.1 <9.0" + }, + "require-dev": { + "phpunit/phpunit": "^7 | ^8 | ^9", + "squizlabs/php_codesniffer": "*" + }, + "type": "library", + "autoload": { + "psr-4": { + "DASPRiD\\Enum\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Ben Scholzen 'DASPRiD'", + "email": "mail@dasprids.de", + "homepage": "https://dasprids.de/", + "role": "Developer" + } + ], + "description": "PHP 7.1 enum implementation", + "keywords": [ + "enum", + "map" + ], + "support": { + "issues": "https://github.com/DASPRiD/Enum/issues", + "source": "https://github.com/DASPRiD/Enum/tree/1.0.5" + }, + "time": "2023-08-25T16:18:39+00:00" + }, { "name": "dflydev/dot-access-data", "version": "v3.0.2", @@ -3958,6 +4062,74 @@ }, "time": "2021-12-11T13:40:54+00:00" }, + { + "name": "simplesoftwareio/simple-qrcode", + "version": "4.2.0", + "source": { + "type": "git", + "url": "https://github.com/SimpleSoftwareIO/simple-qrcode.git", + "reference": "916db7948ca6772d54bb617259c768c9cdc8d537" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/SimpleSoftwareIO/simple-qrcode/zipball/916db7948ca6772d54bb617259c768c9cdc8d537", + "reference": "916db7948ca6772d54bb617259c768c9cdc8d537", + "shasum": "" + }, + "require": { + "bacon/bacon-qr-code": "^2.0", + "ext-gd": "*", + "php": ">=7.2|^8.0" + }, + "require-dev": { + "mockery/mockery": "~1", + "phpunit/phpunit": "~9" + }, + "suggest": { + "ext-imagick": "Allows the generation of PNG QrCodes.", + "illuminate/support": "Allows for use within Laravel." + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "SimpleSoftwareIO\\QrCode\\QrCodeServiceProvider" + ], + "aliases": { + "QrCode": "SimpleSoftwareIO\\QrCode\\Facades\\QrCode" + } + } + }, + "autoload": { + "psr-4": { + "SimpleSoftwareIO\\QrCode\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Simple Software LLC", + "email": "support@simplesoftware.io" + } + ], + "description": "Simple QrCode is a QR code generator made for Laravel.", + "homepage": "https://www.simplesoftware.io/#/docs/simple-qrcode", + "keywords": [ + "Simple", + "generator", + "laravel", + "qrcode", + "wrapper" + ], + "support": { + "issues": "https://github.com/SimpleSoftwareIO/simple-qrcode/issues", + "source": "https://github.com/SimpleSoftwareIO/simple-qrcode/tree/4.2.0" + }, + "time": "2021-02-08T20:43:55+00:00" + }, { "name": "symfony/console", "version": "v6.3.2", diff --git a/database/migrations/2023_09_20_163615_create_m_warehouses_table.php b/database/migrations/2023_09_20_163615_create_m_warehouses_table.php index 83cbbf7..f539621 100644 --- a/database/migrations/2023_09_20_163615_create_m_warehouses_table.php +++ b/database/migrations/2023_09_20_163615_create_m_warehouses_table.php @@ -16,16 +16,17 @@ return new class extends Migration $table->id(); $table->string('name', 200); $table->text('description')->nullable(); + $table->text('address')->nullable(); $table->timestamps(); $table->softDeletes(); - $table->string('created_by', 200)->nullable()->default('System'); - $table->string('updated_by', 200)->nullable()->default('System'); + $table->string('created_by', 200)->nullable(); + $table->string('updated_by', 200)->nullable(); }); DB::table('m_warehouses')->insert([ - ['name' => 'Gudangsatu', 'description' => 'Gudang Barang'], - ['name' => 'Gudangdua', 'description' => 'Gudang Makanan'], - ['name' => 'Gudangtiga', 'description' => 'Gudang Pakaian'], + ['name' => 'Gudangsatu', 'description' => 'Gudang Barang', 'address' => 'Jln. Raya Kesatu'], + ['name' => 'Gudangdua', 'description' => 'Gudang Makanan', 'address' => 'Jln. Raya Kedua'], + ['name' => 'Gudangtiga', 'description' => 'Gudang Pakaian', 'address' => 'Jln. Raya Ketiga'], ]); } diff --git a/database/migrations/2023_09_20_163617_create_users_table.php b/database/migrations/2023_09_20_163617_create_users_table.php index eae356e..828170f 100644 --- a/database/migrations/2023_09_20_163617_create_users_table.php +++ b/database/migrations/2023_09_20_163617_create_users_table.php @@ -16,22 +16,19 @@ return new class extends Migration $table->id(); $table->string('username', 50); $table->string('fullname'); - $table->string('nip', 20); + $table->string('nip', 20)->nullable(); $table->string('email')->unique(); - $table->string('no_hp', 20); + $table->string('no_hp', 20)->nullable(); $table->string('divisi', 255); $table->date('tgl_lahir')->nullable(); $table->enum('jenis_kelamin', ['L', 'P'])->nullable(); $table->enum('agama', ['Islam', 'Kristen', 'Katolik', 'Hindu', 'Budha', 'Konghucu'])->nullable(); $table->string('foto', 255)->nullable(); - // $table->integer('role_id'); $table->bigInteger('role_id')->unsigned(); $table->foreign('role_id')->references('id')->on('m_roles'); - // $table->integer('warehouse_id'); $table->bigInteger('warehouse_id')->unsigned(); $table->foreign('warehouse_id')->references('id')->on('m_warehouses'); - $table->text('address'); - $table->enum('status', ['aktif', 'tidak aktif']); + $table->text('address')->nullable(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); $table->rememberToken(); @@ -42,9 +39,9 @@ return new class extends Migration }); DB::table('users')->insert([ - ['username' => 'Gunawan19621', 'fullname' => 'Gunawan', 'nip' => '111111', 'email' => 'gunawan19621@gmail.com', 'no_hp' => '085159079010', 'divisi' => 'admin', 'role_id' => 1, 'warehouse_id' => 1, 'address' => 'Jl. Raya Gelarmendala', 'status' => 'aktif', 'password' => bcrypt('19062001')], - ['username' => 'warehouse123', 'fullname' => 'warehouse', 'nip' => '222222', 'email' => 'warehouse@gmail.com', 'no_hp' => '085159079020', 'divisi' => 'admin', 'role_id' => 2, 'warehouse_id' => 2, 'address' => 'Jl. Raya Ciwatu', 'status' => 'aktif', 'password' => bcrypt('warehouse123')], - ['username' => 'customer123', 'fullname' => 'customer', 'nip' => '333333', 'email' => 'customer@gmail.com', 'no_hp' => '085159079030', 'divisi' => 'admin', 'role_id' => 3, 'warehouse_id' => 3, 'address' => 'Jl. Raya Balongan', 'status' => 'aktif', 'password' => bcrypt('customer123')] + ['username' => 'Gunawan19621', 'fullname' => 'Gunawan', 'nip' => '111111', 'email' => 'gunawan19621@gmail.com', 'no_hp' => '085159079010', 'divisi' => 'admin', 'role_id' => 1, 'warehouse_id' => 1, 'address' => 'Jl. Raya Gelarmendala', 'password' => bcrypt('19062001')], + ['username' => 'warehouse123', 'fullname' => 'warehouse', 'nip' => '222222', 'email' => 'warehouse@gmail.com', 'no_hp' => '085159079020', 'divisi' => 'admin', 'role_id' => 2, 'warehouse_id' => 2, 'address' => 'Jl. Raya Ciwatu', 'password' => bcrypt('warehouse123')], + ['username' => 'customer123', 'fullname' => 'customer', 'nip' => '333333', 'email' => 'customer@gmail.com', 'no_hp' => '085159079030', 'divisi' => 'admin', 'role_id' => 3, 'warehouse_id' => 3, 'address' => 'Jl. Raya Balongan', 'password' => bcrypt('customer123')] ]); } diff --git a/database/migrations/2023_09_20_163618_create_m_assets_table.php b/database/migrations/2023_09_20_163618_create_m_assets_table.php index fef152d..5f59556 100644 --- a/database/migrations/2023_09_20_163618_create_m_assets_table.php +++ b/database/migrations/2023_09_20_163618_create_m_assets_table.php @@ -19,7 +19,8 @@ return new class extends Migration $table->bigInteger('warehouse_id')->unsigned(); $table->foreign('warehouse_id')->references('id')->on('m_warehouses'); $table->datetime('date'); - $table->integer('qr_count'); + // $table->integer('qr_count'); + $table->string('qr_count')->nullable(); $table->timestamps(); $table->softDeletes(); $table->string('created_by', 200); diff --git a/database/migrations/2023_09_20_163641_create_asset_statuses_table.php b/database/migrations/2023_09_20_163641_create_asset_statuses_table.php index aaf3e5d..d3a2634 100644 --- a/database/migrations/2023_09_20_163641_create_asset_statuses_table.php +++ b/database/migrations/2023_09_20_163641_create_asset_statuses_table.php @@ -17,10 +17,14 @@ return new class extends Migration $table->foreign('asset_id')->references('id')->on('m_assets')->onDelete('cascade'); $table->datetime('exit_at'); $table->string('exit_pic', 200); - $table->string('exit_warehouse', 200); + // $table->string('exit_warehouse', 200); + $table->bigInteger('exit_warehouse')->unsigned()->nullable(); + $table->foreign('exit_warehouse')->references('id')->on('m_warehouses')->onDelete('cascade'); $table->datetime('enter_at')->nullable(); $table->string('enter_pic', 200)->nullable(); - $table->string('enter_warehouse', 200)->nullable(); + // $table->string('enter_warehouse', 200)->nullable(); + $table->bigInteger('enter_warehouse')->unsigned()->nullable(); + $table->foreign('enter_warehouse')->references('id')->on('m_warehouses')->onDelete('cascade'); $table->timestamps(); $table->softDeletes(); $table->string('created_by', 200); diff --git a/resources/views/addons/SettingPlatform/manajement_asset.blade.php b/resources/views/MasterData/asset.blade.php similarity index 85% rename from resources/views/addons/SettingPlatform/manajement_asset.blade.php rename to resources/views/MasterData/asset.blade.php index 5c6f491..316416a 100644 --- a/resources/views/addons/SettingPlatform/manajement_asset.blade.php +++ b/resources/views/MasterData/asset.blade.php @@ -2,14 +2,6 @@ @section('title', 'Setting Platform') @section('content')
-
- {{--
-
DataTables Asset
-
- CETAK PDF - - - CETAK Exel - -
--}}
@@ -74,14 +57,19 @@ - + + +
{{ $data->description }} {{ $data->warehouse->name }} {{ \Carbon\Carbon::parse($data->date)->format('d-m-Y') }}{{ $data->qr_count }} + {!! QrCode::size(80)->generate(route('asset.show', $data->id)) !!} + + + + - - - + data-target="#editDataModal{{ $data->id }}"> + + @@ -131,10 +119,10 @@ - + {{-- + onkeypress="return event.charCode >= 48 && event.charCode <= 57" required> --}} +@endsection diff --git a/resources/views/addons/SettingPlatform/asset_pdf.blade.php b/resources/views/MasterData/asset_pdf.blade.php similarity index 100% rename from resources/views/addons/SettingPlatform/asset_pdf.blade.php rename to resources/views/MasterData/asset_pdf.blade.php diff --git a/resources/views/addons/pengadaan.blade.php b/resources/views/MasterData/pengadaan.blade.php similarity index 100% rename from resources/views/addons/pengadaan.blade.php rename to resources/views/MasterData/pengadaan.blade.php diff --git a/resources/views/addons/settingPlatform.blade.php b/resources/views/MasterData/settingPlatform.blade.php similarity index 100% rename from resources/views/addons/settingPlatform.blade.php rename to resources/views/MasterData/settingPlatform.blade.php diff --git a/resources/views/addons/SettingPlatform/update_user.blade.php b/resources/views/MasterData/update_user.blade.php similarity index 86% rename from resources/views/addons/SettingPlatform/update_user.blade.php rename to resources/views/MasterData/update_user.blade.php index e79b57f..bb2c1f3 100644 --- a/resources/views/addons/SettingPlatform/update_user.blade.php +++ b/resources/views/MasterData/update_user.blade.php @@ -37,15 +37,6 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + @php + $noUser = 1; + @endphp + @forelse ($user as $data) + + + + + + + + + + @empty +

Data Kosong

+ @endforelse + +
NoNamaEmailNo. HPAlamatDitugaskanAction
NoNamaEmailNo. HPAlamatDitugaskanAction
{{ $noUser++ }}{{ $data->fullname }}{{ $data->email }}{{ isset($data->no_hp) ? $data->no_hp : '-' }}{{ isset($data->address) ? $data->address : '-' }}{{ $data->warehouse->name }} + + + + + + +
+ + + + + + + +@endsection diff --git a/resources/views/MasterData/warehouse.blade.php b/resources/views/MasterData/warehouse.blade.php new file mode 100644 index 0000000..4bdec07 --- /dev/null +++ b/resources/views/MasterData/warehouse.blade.php @@ -0,0 +1,151 @@ +@extends('layouts.main') +@section('title', 'Update Data User') +@section('content') +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + @php + $nowarehouses = 1; + @endphp + @foreach ($warehouses as $data) + + + + + + + + @endforeach + +
No.NamaDeskripsiAlamatAction
No.NamaDeskripsiAlamatAction
{{ $nowarehouses++ }}{{ $data->name }}{{ $data->description }}{{ $data->address }} + + + + + + +
+
+ +
+
+
+ + + + + + @foreach ($warehouses as $data) + + @endforeach +@endsection diff --git a/resources/views/addons/SettingPlatform/manajement_user.blade.php b/resources/views/addons/SettingPlatform/manajement_user.blade.php deleted file mode 100644 index 2faf1bd..0000000 --- a/resources/views/addons/SettingPlatform/manajement_user.blade.php +++ /dev/null @@ -1,86 +0,0 @@ -@extends('layouts.main') -@section('title', 'Manajemen User') -@section('content') - {{--

Halaman Manajement User

--}} -
- -
-
-
-
-
Data User
-
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - @php - $noUser = 1; - @endphp - @forelse ($user as $data) - - - - - - - - - - @empty -

Data Kosong

- @endforelse - -
NoNamaEmailNo. HPAlamatDitugaskanAction
NoNamaEmailNo. HPAlamatDitugaskanAction
{{ $noUser++ }}{{ $data->fullname }}{{ $data->email }}{{ $data->no_hp }}{{ $data->address }}{{ $data->warehouse->name }} - - - - {{-- - - --}} - - - -
-
-
-
-
-@endsection diff --git a/resources/views/dashboard/index.blade.php b/resources/views/dashboard/index.blade.php index 0267491..821c5c5 100644 --- a/resources/views/dashboard/index.blade.php +++ b/resources/views/dashboard/index.blade.php @@ -1,156 +1,164 @@ @extends('layouts.main') @section('title', 'Dashboard') @section('content') -
-

Dashboard

- Generate Report -
-
-
-
-
-
-
-
- Pengadaan +
+
+

Dashboard

+ Generate Report +
+
+
+
+
+
+
+
+ Pengadaan +
+
+ {{ $jumlahAsset }} +
-
{{ $jumlahAsset }} +
+
-
- -
-
- -
-
-
-
-
-
- Peminjaman + +
+
+
+
+
+
+ Peminjaman +
+
+ {{ $jumlahPeminjaman }}
+
+
+
-
- {{ $jumlahPeminjaman }}
-
-
-
-
- -
-
-
-
-
-
- Pengembalian + +
+
+
+
+
+
+ Pengembalian +
+
+ {{ $jumlahPengembalian }}
+
+
+
-
- {{ $jumlahPengembalian }}
-
-
-
-
- -
-
-
-
-
-
- Reminder Pengembalian + +
+
+
+
+
+
+ Reminder Pengembalian +
+
+ {{ $reminder }}
+
+
+
-
28
-
-
-
-
- -
-
- -
-
Grafik Peminjaman VS Pengembalian -
-