diff --git a/app/Http/Controllers/M_assetController.php b/app/Http/Controllers/M_assetController.php index 2f35a23..469029f 100644 --- a/app/Http/Controllers/M_assetController.php +++ b/app/Http/Controllers/M_assetController.php @@ -20,7 +20,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')); } /** @@ -165,7 +165,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); diff --git a/app/Http/Controllers/M_userController.php b/app/Http/Controllers/M_userController.php index c26342f..42ac86f 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')); } /** @@ -30,9 +33,53 @@ class M_userController extends Controller /** * Store a newly created resource in storage. */ + // public function store(Request $request) + // { + // $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->name; // Menggunakan nama pengguna sebagai created_by + // $validatedData['updated_by'] = $currentUser->name; // 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.'); + // } + // } 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 +91,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 +114,31 @@ 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/WarehouseController.php b/app/Http/Controllers/WarehouseController.php new file mode 100644 index 0000000..60d45b5 --- /dev/null +++ b/app/Http/Controllers/WarehouseController.php @@ -0,0 +1,86 @@ +validate([ + 'name' => 'required', + 'description' => 'required', + 'address' => 'required', + ]); + try { + $validatedData = $request->except('_token'); + 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'); + } + + /** + * 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/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..d73426b 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,6 +16,7 @@ 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'); @@ -23,9 +24,9 @@ return new class extends Migration }); 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/resources/views/addons/SettingPlatform/manajement_asset.blade.php b/resources/views/MasterData/asset.blade.php similarity index 89% rename from resources/views/addons/SettingPlatform/manajement_asset.blade.php rename to resources/views/MasterData/asset.blade.php index 63366c4..37938ee 100644 --- a/resources/views/addons/SettingPlatform/manajement_asset.blade.php +++ b/resources/views/MasterData/asset.blade.php @@ -3,13 +3,13 @@ @section('content')
+
+

Our Item Tables are enhanced with the help of the DataTables plugin. This is a powerful tool that allows you + to explore return data in a more interactive and efficient way

+ + + Tambah data + +
-->
- {{--
-
DataTables Asset
-
- CETAK PDF - - - CETAK Exel - -
--}}
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..5ad2752 --- /dev/null +++ b/resources/views/MasterData/warehouse.blade.php @@ -0,0 +1,113 @@ +@extends('layouts.main') +@section('title', 'Update Data User') +@section('content') +
+ {{--

Halaman management warehouse

--}} +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + @php + $nowarehouses = 1; + @endphp + @foreach ($warehouses as $data) + + + + + + + + @endforeach + +
No.NamaDeskripsiAlamatAction
No.NamaDeskripsiAlamatAction
{{ $nowarehouses++ }}{{ $data->name }}{{ $data->description }}{{ $data->address }} + + + + + + +
+
+ +
+
+
+ + + +@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 0c93383..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
-
-
- {{-- - + Tambah data - --}} -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - @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..7067152 100644 --- a/resources/views/dashboard/index.blade.php +++ b/resources/views/dashboard/index.blade.php @@ -1,156 +1,163 @@ @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 +
+
28
+
+
+
-
28
-
-
-
-
- -
-
- -
-
Grafik Peminjaman VS Pengembalian -
-