Browse Source

update proses user

master
Gunawan19621 1 year ago
parent
commit
fbe3550d38
  1. 4
      app/Http/Controllers/M_assetController.php
  2. 70
      app/Http/Controllers/M_userController.php
  3. 86
      app/Http/Controllers/WarehouseController.php
  4. 7
      database/migrations/2023_09_20_163615_create_m_warehouses_table.php
  5. 15
      database/migrations/2023_09_20_163617_create_users_table.php
  6. 13
      resources/views/MasterData/asset.blade.php
  7. 0
      resources/views/MasterData/asset_pdf.blade.php
  8. 0
      resources/views/MasterData/pengadaan.blade.php
  9. 0
      resources/views/MasterData/settingPlatform.blade.php
  10. 9
      resources/views/MasterData/update_user.blade.php
  11. 147
      resources/views/MasterData/user.blade.php
  12. 113
      resources/views/MasterData/warehouse.blade.php
  13. 86
      resources/views/addons/SettingPlatform/manajement_user.blade.php
  14. 17
      resources/views/dashboard/index.blade.php
  15. 14
      resources/views/layouts/main.blade.php
  16. 5
      resources/views/layouts/sidebar.blade.php
  17. 15
      routes/web.php

4
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);

70
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');
// }
}
/**

86
app/Http/Controllers/WarehouseController.php

@ -0,0 +1,86 @@
<?php
namespace App\Http\Controllers;
use App\Models\m_warehouse;
use Illuminate\Http\Request;
class WarehouseController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$warehouses = m_warehouse::all();
return view('MasterData.warehouse', compact('warehouses'));
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
// dd('oke');
// dd($request);
$request->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');
}
}
}

7
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'],
]);
}

15
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')]
]);
}

13
resources/views/addons/SettingPlatform/manajement_asset.blade.php → resources/views/MasterData/asset.blade.php

@ -17,7 +17,8 @@
<h5 class="m-0 font-weight-bold text-primary mt-2">Data Asset</h5>
</div>
<div class="col-6 text-right">
<a href="#" class="btn btn-success btn-icon-split" data-toggle="modal" data-target="#tambahDataModal">
<a href="#" class="btn btn-success btn-icon-split" data-toggle="modal"
data-target="#tambahDataModal">
<span class="text">+ Tambah data</span>
</a>
<a href="{{ route('assetcetakpdf.cetakpdf') }}" class="btn btn-success btn-icon-split ml-auto"
@ -31,16 +32,6 @@
</div>
</div>
</div>
{{-- <div class="card-header py-3 d-flex justify-content-between align-items-center">
<h6 class="m-0 font-weight-bold text-primary">DataTables Asset</h6>
<a href="{{ route('assetcetakpdf.cetakpdf') }}" class="btn btn-success btn-icon-split ml-auto"
target="_blank">
<span class="text">CETAK PDF</span>
</a>
<a href="{{ route('assetexport.export') }}" class="btn btn-info btn-icon-split ml-auto" target="_blank">
<span class="text">CETAK Exel</span>
</a>
</div> --}}
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="tablebarang" width="100%" cellspacing="0">

0
resources/views/addons/SettingPlatform/asset_pdf.blade.php → resources/views/MasterData/asset_pdf.blade.php

0
resources/views/addons/pengadaan.blade.php → resources/views/MasterData/pengadaan.blade.php

0
resources/views/addons/settingPlatform.blade.php → resources/views/MasterData/settingPlatform.blade.php

9
resources/views/addons/SettingPlatform/update_user.blade.php → resources/views/MasterData/update_user.blade.php

@ -37,15 +37,6 @@
<label for="address" class="col-form-label">Alamat:</label>
<textarea class="form-control" name="address" id="address" placeholder="Masukan detail alamat anda" required>{{ $user->address }}</textarea>
<label for="status" class="col-form-label">Status:</label>
<select class="form-control" name="status" type="text" id="status">
<option disabled selected>Pilih Status</option>
<option value="aktif" {{ old('status', $user->status) == 'aktif' ? 'selected' : '' }}>Aktif
</option>
<option value="tidak aktif" {{ old('status', $user->status) == 'tidak aktif' ? 'selected' : '' }}>
Tidak Aktif
</option>
</select>
<label for="role_id" class="col-form-label">Hak Akses:</label>
<select class="form-control" name="role_id" type="text" id="role_id">
<option disabled selected>Pilih Hak Akses</option>

147
resources/views/MasterData/user.blade.php

@ -0,0 +1,147 @@
@extends('layouts.main')
@section('title', 'Manajemen User')
@section('content')
{{-- <h1>Halaman Manajement User</h1> --}}
<div class="container-fluid">
<!-- <h1 class="h3 mb-2 text-gray-800">Tabel User</h1>
<div class="mb-4">
<p>Our User 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</p>
{{-- <a href="#" class="btn btn-success btn-icon-split" data-toggle="modal" data-target="#tambahDataModal">
<span class="text">+ Tambah data</span> --}}
</a>
</div> -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">
<div class="col-6">
<h5 class="m-0 font-weight-bold text-primary mt-2">Data User</h5>
</div>
<div class="col-6 text-right">
<a href="#" class="btn btn-success btn-icon-split" data-toggle="modal"
data-target="#tambahDataModal">
<span class="text">+ Tambah data</span>
</a>
</div>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="tablebarang" width="100%" cellspacing="0">
<thead>
<tr>
<th>No</th>
<th>Nama</th>
<th>Email</th>
<th>No. HP</th>
<th>Alamat</th>
<th>Ditugaskan</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>No</th>
<th>Nama</th>
<th>Email</th>
<th>No. HP</th>
<th>Alamat</th>
<th>Ditugaskan</th>
<th class="text-center">Action</th>
</tr>
</tfoot>
<tbody>
@php
$noUser = 1;
@endphp
@forelse ($user as $data)
<tr>
<td class="text-center">{{ $noUser++ }}</td>
<td>{{ $data->fullname }}</td>
<td>{{ $data->email }}</td>
<td>{{ isset($data->no_hp) ? $data->no_hp : '-' }}</td>
<td>{{ isset($data->address) ? $data->address : '-' }}</td>
<td>{{ $data->warehouse->name }}</td>
<td class="text-center">
<a href="{{ route('user.show', [$data->id]) }}">
<i class="fa fa-edit mr-2" style="font-size: 20px"></i>
</a>
<a href="{{ route('hapusUser.destroy', $data->id) }}"
onclick="return confirm('Apakah Anda yakin ingin menghapus data ini?')">
<i class="fa fa-trash text-danger mr-2" style="font-size: 20px"></i>
</a>
</td>
</tr>
@empty
<p>Data Kosong</p>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Modal Tambah Asset-->
<div class="modal fade" id="tambahDataModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Tambah Data</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="{{ route('user.store') }}" method="POST" enctype="multipart/form-data">
@csrf
<div class="form-group">
<label for="username" class="col-form-label">Username:</label>
<input class="form-control" name="username" type="text" id="username"
value="{{ old('username') }}" placeholder="Masukan Username user" required>
<label for="fullname" class="col-form-label">Nama Lengkap:</label>
<input class="form-control" name="fullname" type="text" id="fullname"
value="{{ old('fullname') }}" placeholder="Masukan Nama Lengkap user" pattern="[^0-9]+"
oninput="this.value=this.value.replace(/[0-9]/g,'');" required>
<label for="email" class="col-form-label">Email:</label>
<input class="form-control" name="email" type="email" id="email"
value="{{ old('email') }}" placeholder="Masukan email user" required>
<label for="divisi" class="col-form-label">Divisi:</label>
<input class="form-control" name="divisi" type="text" id="divisi"
value="{{ old('divisi') }}" placeholder="Masukan Divisi user" pattern="[^0-9]+"
oninput="this.value=this.value.replace(/[0-9]/g,'');" required>
<label for="role_id" class="col-form-label">Hak Akses:</label>
<select class="form-control" name="role_id" id="role_id" required>
<option disabled selected>Pilih Hak Akses User</option>
@foreach ($role as $dt_role)
<option value="{{ $dt_role->id }}">{{ $dt_role->name }}</option>
@endforeach
</select>
<label for="warehouse_id" class="col-form-label">Ditugaskan:</label>
<select class="form-control" name="warehouse_id" id="warehouse_id" required>
<option disabled selected>Pilih Hak Akses User</option>
@foreach ($warehouse as $dt_warehouse)
<option value="{{ $dt_warehouse->id }}">{{ $dt_warehouse->name }}</option>
@endforeach
</select>
<label for="password" class="col-form-label">Password:</label>
<input class="form-control" name="password" type="text" id="password"
value="{{ old('password') }}" placeholder="Masukan password user" required>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<button type="submit" class="btn btn-primary">Simpan</button>
</div>
</form>
</div>
</div>
</div>
</div>
@endsection

113
resources/views/MasterData/warehouse.blade.php

@ -0,0 +1,113 @@
@extends('layouts.main')
@section('title', 'Update Data User')
@section('content')
<div class="container-fluid">
{{-- <h4>Halaman management warehouse</h4> --}}
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">
<div class="col-6">
<h5 class="m-0 font-weight-bold text-primary mt-2">Data Asset</h5>
</div>
<div class="col-6 text-right">
<a href="#" class="btn btn-success btn-icon-split" data-toggle="modal"
data-target="#tambahDataModal">
<span class="text">+ Tambah data</span>
</a>
<a href="{{ route('assetcetakpdf.cetakpdf') }}" class="btn btn-success btn-icon-split ml-auto"
target="_blank">
<span class="text">Cetak PDF</span>
</a>
<a href="{{ route('assetexport.export') }}" class="btn btn-info btn-icon-split ml-auto"
target="_blank">
<span class="text">Cetak Exel</span>
</a>
</div>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="tablebarang" width="100%" cellspacing="0">
<thead>
<tr>
<th class="text-center" style="width: 50px;">No.</th>
<th>Nama</th>
<th>Deskripsi</th>
<th>Alamat</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th class="text-center" style="width: 50px;">No.</th>
<th>Nama</th>
<th>Deskripsi</th>
<th>Alamat</th>
<th class="text-center">Action</th>
</tr>
</tfoot>
<tbody>
@php
$nowarehouses = 1;
@endphp
@foreach ($warehouses as $data)
<tr>
<td class="text-center" style="width: 50px;">{{ $nowarehouses++ }}</td>
<td>{{ $data->name }}</td>
<td>{{ $data->description }}</td>
<td>{{ $data->address }}</td>
<td class="text-center">
<a href="#" data-toggle="modal"
data-target="#editDataModal{{ $data['id'] }}">
<i class="fa fa-edit mr-2" style="font-size: 20px"></i>
</a>
<a href="{{ route('hapuswarehouse.destroy', $data->id) }}"
onclick="return confirm('Apakah Anda yakin ingin menghapus data ini?')">
<i class="fa fa-trash text-danger mr-2" style="font-size: 20px"></i>
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Modal Tambah Asset-->
<div class="modal fade" id="tambahDataModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Tambah Data</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form action="{{ route('warehouse.store') }}" method="POST" enctype="multipart/form-data">
@csrf
<div class="form-group">
<label for="name" class="col-form-label">Nama:</label>
<input class="form-control" name="name" type="text" id="name"
value="{{ old('name') }}" placeholder="Masukan Nama Gudang" required>
<label for="description" class="col-form-label">Deskripsi:</label>
<textarea class="form-control" name="description" id="description" placeholder="Masukkan Deskripsi Gudang" required>{{ old('description') }}</textarea>
<label for="address" class="col-form-label">Alamat:</label>
<textarea class="form-control" name="address" id="address" placeholder="Masukkan Alamat Gudang" required>{{ old('address') }}</textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Tutup</button>
<button type="submit" class="btn btn-primary">Simpan</button>
</div>
</form>
</div>
</div>
</div>
</div>
@endsection

86
resources/views/addons/SettingPlatform/manajement_user.blade.php

@ -1,86 +0,0 @@
@extends('layouts.main')
@section('title', 'Manajemen User')
@section('content')
{{-- <h1>Halaman Manajement User</h1> --}}
<div class="container-fluid">
<!-- <h1 class="h3 mb-2 text-gray-800">Tabel User</h1>
<div class="mb-4">
<p>Our User 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</p>
{{-- <a href="#" class="btn btn-success btn-icon-split" data-toggle="modal" data-target="#tambahDataModal">
<span class="text">+ Tambah data</span> --}}
</a>
</div> -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">
<div class="col-6">
<h5 class="m-0 font-weight-bold text-primary mt-2">Data User</h5>
</div>
<div class="col-6 text-right">
{{--<a href="#" class="btn btn-success btn-icon-split" data-toggle="modal" data-target="#tambahDataModal">
<span class="text">+ Tambah data</span>
</a>--}}
</div>
</div>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="tablebarang" width="100%" cellspacing="0">
<thead>
<tr>
<th>No</th>
<th>Nama</th>
<th>Email</th>
<th>No. HP</th>
<th>Alamat</th>
<th>Ditugaskan</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tfoot>
<tr>
<th>No</th>
<th>Nama</th>
<th>Email</th>
<th>No. HP</th>
<th>Alamat</th>
<th>Ditugaskan</th>
<th class="text-center">Action</th>
</tr>
</tfoot>
<tbody>
@php
$noUser = 1;
@endphp
@forelse ($user as $data)
<tr>
<td>{{ $noUser++ }}</td>
<td>{{ $data->fullname }}</td>
<td>{{ $data->email }}</td>
<td>{{ $data->no_hp }}</td>
<td>{{ $data->address }}</td>
<td>{{ $data->warehouse->name }}</td>
<td class="text-center">
<a href="{{ route('user.show', [$data->id]) }}">
<i class="fa fa-edit mr-2" style="font-size: 20px"></i>
</a>
{{-- <a href="{{ route('hapusUser.destroy', $data->id) }}">
<i class="fa fa-trash text-danger mr-2" style="font-size: 20px"></i>
</a> --}}
<a href="{{ route('hapusUser.destroy', $data->id) }}"
onclick="return confirm('Apakah Anda yakin ingin menghapus data ini?')">
<i class="fa fa-trash text-danger mr-2" style="font-size: 20px"></i>
</a>
</td>
</tr>
@empty
<p>Data Kosong</p>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection

17
resources/views/dashboard/index.blade.php

@ -1,6 +1,7 @@
@extends('layouts.main')
@section('title', 'Dashboard')
@section('content')
<div class="container-fluid">
<div class="d-sm-flex align-items-center justify-content-between mb-4">
<h1 class="h3 mb-0 text-gray-800">Dashboard</h1>
<a href="#" class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i
@ -12,10 +13,12 @@
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1" style="font-size: 14px;">
<div class="text-xs font-weight-bold text-primary text-uppercase mb-1"
style="font-size: 14px;">
<strong>Pengadaan</strong>
</div>
<div class="h5 mb-0 font-weight-bold text-gray-800" style="font-size: 25px;">{{ $jumlahAsset }}
<div class="h5 mb-0 font-weight-bold text-gray-800" style="font-size: 25px;">
{{ $jumlahAsset }}
</div>
</div>
<div class="col-auto">
@ -32,7 +35,8 @@
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-success text-uppercase mb-1" style="font-size: 14px;">
<div class="text-xs font-weight-bold text-success text-uppercase mb-1"
style="font-size: 14px;">
<strong>Peminjaman</strong>
</div>
<div class="h5 mb-0 font-weight-bold text-gray-800" style="font-size: 25px;">
@ -52,7 +56,8 @@
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1" style="font-size: 14px;">
<div class="text-xs font-weight-bold text-info text-uppercase mb-1"
style="font-size: 14px;">
<strong>Pengembalian</strong>
</div>
<div class="h5 mb-0 font-weight-bold text-gray-800" style="font-size: 25px;">
@ -72,7 +77,8 @@
<div class="card-body">
<div class="row no-gutters align-items-center">
<div class="col mr-2">
<div class="text-xs font-weight-bold text-warning text-uppercase mb-1" style="font-size: 13px;">
<div class="text-xs font-weight-bold text-warning text-uppercase mb-1"
style="font-size: 13px;">
<strong>Reminder Pengembalian</strong>
</div>
<div class="h5 mb-0 font-weight-bold text-gray-800" style="font-size: 25px;">28</div>
@ -156,4 +162,5 @@
</div>
</div>
</div>
</div>
@endsection

14
resources/views/layouts/main.blade.php

@ -30,7 +30,7 @@
<!-- Begin Page Content -->
<!-- <div class="container-fluid"> -->
<!-- allert update data foto -->
{{-- @if (session()->has('success'))
@if (session()->has('success'))
<div id="success-alert" class="alert alert-success floating-alert">
{{ session()->get('success') }}
</div>
@ -38,20 +38,8 @@
<div id="error-alert" class="alert alert-danger floating-alert">
X {{ session()->get('error') }}
</div>
@endif --}}
@if (session()->has('success'))
<div id="success-alert" class="alert alert-success">
{{ session()->get('success') }}
</div>
@elseif(session()->has('error'))
<div id="success-alert" class="alert alert-danger">
X {{ session()->get('error') }}
</div>
@endif
<!-- allert update data foto -->
@yield('content')
<!-- </div> -->
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->

5
resources/views/layouts/sidebar.blade.php

@ -68,4 +68,9 @@
<span class="ml-4">User</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ route('warehouse.index') }}">
<span class="ml-4">Warehouse</span>
</a>
</li>
</ul>

15
routes/web.php

@ -14,6 +14,7 @@ use App\Http\Controllers\BarangMasukController;
use App\Http\Controllers\BarangKeluarController;
use App\Http\Controllers\PengembalianController;
use App\Http\Controllers\SettingPlatformController;
use App\Http\Controllers\WarehouseController;
/*
|--------------------------------------------------------------------------
@ -27,8 +28,6 @@ use App\Http\Controllers\SettingPlatformController;
*/
Route::get('/', function () {
// return view('welcome');
// return view('landing_page.layouts.main');
return view('auth.login');
});
@ -52,7 +51,7 @@ Route::group(['prefix' => 'dashboard'], function () {
});
//Halaman Transaksi
Route::middleware('auth')->resource('/transaksi', TransaksiController::class);
// Route::middleware('auth')->resource('/transaksi', TransaksiController::class);
//Halaman Peminjaman
Route::middleware('auth')->resource('/peminjaman', PeminjamanController::class);
@ -74,12 +73,16 @@ Route::group(['prefix' => 'dashboard'], function () {
Route::middleware('auth')->resource('/user', M_userController::class);
Route::get('/hapusUser/{id}', [M_userController::class, 'destroy'])->name('hapusUser.destroy');
//Halaman Warehouse
Route::middleware('auth')->resource('/warehouse', WarehouseController::class);
Route::get('/hapuswarehouse/{id}', [WarehouseController::class, 'destroy'])->name('hapuswarehouse.destroy');
//Halaman Barang Masuk
Route::middleware('auth')->resource('/barangMasuk', BarangMasukController::class);
// Route::middleware('auth')->resource('/barangMasuk', BarangMasukController::class);
//Halaman Barang Keluar
Route::middleware('auth')->resource('/barangKeluar', BarangKeluarController::class);
Route::get('/hapusBarangK/{id}', [BarangKeluarController::class, 'destroy'])->name('hapusBarangK.destroy');
// Route::middleware('auth')->resource('/barangKeluar', BarangKeluarController::class);
// Route::get('/hapusBarangK/{id}', [BarangKeluarController::class, 'destroy'])->name('hapusBarangK.destroy');
});
require __DIR__ . '/auth.php';

Loading…
Cancel
Save