Browse Source

update kembali menggunakan id

master
Gunawan19621 12 months ago
parent
commit
d960588636
  1. 15
      app/Http/Controllers/Auth/RedirectAuthController.php
  2. 42
      app/Http/Controllers/HistoryController.php
  3. 2
      app/Http/Controllers/PeminjamanController.php
  4. 8
      app/Http/Controllers/PengembalianController.php
  5. 4
      app/Http/Controllers/PetiController.php
  6. 18
      app/Http/Controllers/TransferController.php
  7. 29
      app/Http/Controllers/WarehouseController.php
  8. 2
      app/Http/Requests/ValidasiCreatePeti.php
  9. 2
      app/Http/Requests/ValidasiCreateWarehouse.php
  10. 2
      app/Models/Customer.php
  11. 2
      app/Models/Kondisi_Peti.php
  12. 2
      app/Models/Peti.php
  13. 2
      app/Models/Type_peti.php
  14. 2
      app/Models/User.php
  15. 3
      app/Models/m_role.php
  16. 4
      app/Models/m_warehouse.php
  17. 2
      config/app.php
  18. 3
      database/migrations/2023_10_23_073314_create_m_warehouses_table.php
  19. 2
      database/migrations/2023_10_23_075239_create_m_roles_table.php
  20. 6
      database/migrations/2023_10_23_075245_create_users_table.php
  21. 2
      database/migrations/2023_10_28_080457_create_customers_table.php
  22. 2
      database/migrations/2023_10_28_083930_create_type_petis_table.php
  23. 2
      database/migrations/2023_11_06_022213_create_kondisi_petis_table.php
  24. 11
      database/migrations/2023_11_06_085238_create_petis_table.php
  25. 9
      database/migrations/2023_11_06_122033_create_asset_statuses_table.php
  26. 10
      database/migrations/2023_11_08_132316_create_transfers_table.php
  27. 6
      database/migrations/2023_11_17_075418_create_disposals_table.php
  28. 2
      database/seeders/Customer.php
  29. 2
      database/seeders/Kondisi_PetiSeeder.php
  30. 13
      database/seeders/PetiSeeder.php
  31. 2
      database/seeders/RoleSeeder.php
  32. 2
      database/seeders/Type_Peti.php
  33. 8
      database/seeders/UserSeeder.php
  34. 4
      database/seeders/WarehouseSeeder.php
  35. 63
      resources/views/dashboard/History/Peminjaman/index.blade.php
  36. 102
      resources/views/dashboard/History/Pengembalian/index.blade.php
  37. 52
      resources/views/dashboard/History/Transfer/index.blade.php
  38. 2
      resources/views/dashboard/Master_Data/Customer/index.blade.php
  39. 2
      resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php
  40. 2
      resources/views/dashboard/Master_Data/Manajemen_Peti/Type_peti/index.blade.php
  41. 2
      resources/views/dashboard/Master_Data/Role/index.blade.php
  42. 2
      resources/views/dashboard/Master_Data/User/index.blade.php
  43. 2
      resources/views/dashboard/Master_Data/Warehouse/index.blade.php
  44. 3
      resources/views/dashboard/Peminjaman/index.blade.php
  45. 8
      resources/views/dashboard/Pengembalian/index.blade.php
  46. 2
      resources/views/dashboard/Transaksi/index.blade.php
  47. 1
      resources/views/dashboard/Transfer/index.blade.php
  48. 25
      resources/views/dashboard/index.blade.php
  49. 58
      resources/views/layouts/sidebar.blade.php
  50. 19
      routes/web.php

15
app/Http/Controllers/Auth/RedirectAuthController.php

@ -11,28 +11,15 @@ class RedirectAuthController extends Controller
public function redirectAuth()
{
if (Auth::check()) {
if (Auth::user()->role_id == 'D961AD96-211B-4F68-9FF2-111111111111') {
if (Auth::user()->role_id == 1) {
// Admin
return redirect()->route('dashboard.home.admin');
} else {
return redirect()->route('dashboard.home.user');
// User (role_id selain 1)
// return redirect()->route('dashboard.home.user');
}
} else {
// Tidak ada akun atau kesalahan login
// return redirect()->route('login')->with('error', 'Kesalahan email atau password.');
return redirect()->route('login')->with('error', 'Kesalahan email atau password.');
}
// if (Auth::check() && Auth::user()->role_id == '1') {
// // Admin
// return redirect()->route('dashboard.home.admin');
// } elseif (Auth::check() && Auth::user()->role_id == '2') {
// return redirect()->route('dashboard.home.admin');
// // return redirect()->route('dashboard.home.user');
// } else {
// return redirect()->route('login');
// }
}
}

42
app/Http/Controllers/HistoryController.php

@ -0,0 +1,42 @@
<?php
namespace App\Http\Controllers;
use App\Models\Transfer;
use App\Models\m_warehouse;
use App\Models\asset_status;
use Illuminate\Http\Request;
class HistoryController extends Controller
{
public function historyPeminjaman()
{
$data = [
// 'peminjaman' => asset_status::get(),
'peminjaman' => asset_status::orderBy('created_at', 'desc')->get(),
'warehouse' => m_warehouse::get(),
'active' => 'history-peminjaman',
];
return view('dashboard.History.Peminjaman.index', $data);
}
public function historyPengembalian()
{
$data = [
'peminjaman' => asset_status::orderBy('created_at', 'desc')->get(),
'active' => 'history-pengembalian',
];
return view('dashboard.History.Pengembalian.index', $data);
}
public function historyTransfer()
{
$data = [
'transfer' => Transfer::orderBy('created_at', 'desc')->get(),
'active' => 'history-transfer',
];
return view('dashboard.History.Transfer.index', $data);
}
}

2
app/Http/Controllers/PeminjamanController.php

@ -37,7 +37,7 @@ class PeminjamanController extends Controller
'peti' => Peti::all(),
'peminjaman' => asset_status::get(),
'warehouse' => m_warehouse::get(),
'peti_block' => Peti::whereNotIn('id', asset_status::where('status', 0)->pluck('peti_id')->toArray())
'peti_block' => Peti::whereNotIn('id', asset_status::where('status', 1)->pluck('peti_id')->toArray())
->where('status', 'AKTIF') // Sesuaikan dengan nama kolom yang benar
->get(),

8
app/Http/Controllers/PengembalianController.php

@ -13,8 +13,14 @@ class PengembalianController extends Controller
{
public function index()
{
$pengembalian = asset_status::orderBy('created_at', 'desc')->get();
$latestpengembalian = $pengembalian->groupBy('peti_id')->map(function ($group) {
return $group->first();
});
$data = [
'peminjaman' => asset_status::orderBy('created_at', 'desc')->get(),
'peminjaman' => $latestpengembalian,
'active' => 'menu-pengembalian',
];
return view('dashboard.Pengembalian.index', $data);

4
app/Http/Controllers/PetiController.php

@ -76,10 +76,6 @@ class PetiController extends Controller
$validatedData['created_by'] = $currenttype->fullname; // Menggunakan nama pengguna sebagai created_by
$validatedData['updated_by'] = $currenttype->fullname; // Menggunakan nama pengguna sebagai updated_by
// Ambil nomor urutan otomatis untuk id_incre
$nextIdIncre = Peti::max('id_incre') + 1;
$validatedData['id_incre'] = $nextIdIncre;
// Buat entri peti baru
Peti::create($validatedData);
}

18
app/Http/Controllers/TransferController.php

@ -16,13 +16,29 @@ class TransferController extends Controller
{
public function index()
{
$transfers = Transfer::orderBy('created_at', 'desc')->get();
$latestTransfers = $transfers->groupBy('peti_id')->map(function ($group) {
return $group->first();
});
$data = [
'transfer' => Transfer::orderBy('created_at', 'desc')->get(),
'transfer' => $latestTransfers,
'active' => 'menu-transfer',
];
return view('dashboard.Transfer.index', $data);
}
// public function index()
// {
// $data = [
// 'transfer' => Transfer::orderBy('created_at', 'desc')->get(),
// 'active' => 'menu-transfer',
// ];
// return view('dashboard.Transfer.index', $data);
// }
/**
* Show the form for creating a new resource.
*/

29
app/Http/Controllers/WarehouseController.php

@ -37,14 +37,9 @@ class WarehouseController extends Controller
try {
$currentUser = Auth::user();
// Ambil nomor urutan otomatis untuk id_incre
$latestRecord = m_warehouse::latest()->first();
$nextIdIncre = ($latestRecord) ? $latestRecord->id_incre + 1 : 1;
$validatedData = $request->except('_token');
$validatedData['created_by'] = $currentUser->fullname;
$validatedData['updated_by'] = $currentUser->fullname;
$validatedData['id_incre'] = $nextIdIncre;
m_warehouse::create($validatedData);
@ -54,30 +49,6 @@ class WarehouseController extends Controller
}
}
// public function store(ValidasiCreateWarehouse $request)
// {
// try {
// $currentUser = Auth::user();
// // Ambil nomor urutan otomatis untuk id_incre
// $nextIdIncre = m_warehouse::max('id_incre') + 1;
// $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
// // Set nilai id_incre sebelum membuat entri
// $validatedData['id_incre'] = $nextIdIncre;
// 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.
*/

2
app/Http/Requests/ValidasiCreatePeti.php

@ -22,7 +22,6 @@ class ValidasiCreatePeti extends FormRequest
public function rules(): array
{
return [
'id_incre' => 'integer',
'tipe_peti_id' => 'required|exists:type_petis,id',
'warna' => 'required|string|max:50',
'customer_id' => 'required|exists:customers,id',
@ -38,7 +37,6 @@ class ValidasiCreatePeti extends FormRequest
public function messages()
{
return [
'id_incre.integer' => 'ID Incre harus berupa angka!',
'tipe_peti_id.required' => 'Tipe Peti tidak boleh kosong!',
'tipe_peti_id.exists' => 'Tipe Peti tidak ditemukan!',
'warna.required' => 'Warna tidak boleh kosong!',

2
app/Http/Requests/ValidasiCreateWarehouse.php

@ -22,7 +22,6 @@ class ValidasiCreateWarehouse extends FormRequest
public function rules(): array
{
return [
'id_incre' => 'integer',
'name' => 'required|string|max:32',
'description' => 'required|string|max:255',
'address' => 'required|string|max:255',
@ -32,7 +31,6 @@ class ValidasiCreateWarehouse extends FormRequest
public function messages()
{
return [
'id_incre.integer' => 'Kolom id incre harus berupa angka.',
'name.required' => 'Kolom nama wajib diisi.',
'name.string' => 'Kolom nama harus berupa teks.',
'name.max' => 'Kolom nama tidak boleh lebih dari :max karakter.',

2
app/Models/Customer.php

@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
class Customer extends Model
{
use HasFactory, SoftDeletes, UUID;
use HasFactory, SoftDeletes;
protected $table = 'customers';
protected $fillable = [

2
app/Models/Kondisi_Peti.php

@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
class Kondisi_Peti extends Model
{
use HasFactory, SoftDeletes, UUID;
use HasFactory, SoftDeletes;
protected $table = 'kondisi_petis';
protected $fillable = [

2
app/Models/Peti.php

@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
class Peti extends Model
{
use HasFactory, SoftDeletes, UUID;
use HasFactory, SoftDeletes;
protected $table = 'petis';
protected $fillable = [

2
app/Models/Type_peti.php

@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
class Type_peti extends Model
{
use HasFactory, SoftDeletes, UUID;
use HasFactory, SoftDeletes;
protected $table = 'type_petis';
protected $fillable = [

2
app/Models/User.php

@ -12,7 +12,7 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements JWTSubject
{
use HasApiTokens, HasFactory, Notifiable, UUID;
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.

3
app/Models/m_role.php

@ -5,10 +5,11 @@ namespace App\Models;
use App\Traits\UUID;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
class m_role extends Model
{
use HasFactory, UUID;
use HasFactory, SoftDeletes;
protected $table = 'm_roles';
protected $fillable = [

4
app/Models/m_warehouse.php

@ -5,14 +5,14 @@ namespace App\Models;
use App\Traits\UUID;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
class m_warehouse extends Model
{
use HasFactory, UUID;
use HasFactory, SoftDeletes;
protected $table = 'm_warehouses';
protected $fillable = [
'id_incre',
'name',
'description',
'address',

2
config/app.php

@ -70,7 +70,7 @@ return [
|
*/
'timezone' => 'UTC',
'timezone' => 'Asia/Jakarta',
/*
|--------------------------------------------------------------------------

3
database/migrations/2023_10_23_073314_create_m_warehouses_table.php

@ -12,8 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::create('m_warehouses', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->bigInteger('id_incre')->default(1)->unsigned();
$table->id();
$table->string('name', 32)->nullable();
$table->text('description')->nullable();
$table->text('address')->nullable();

2
database/migrations/2023_10_23_075239_create_m_roles_table.php

@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::create('m_roles', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->id();
$table->string('name', 50)->nullable();
$table->text('description')->nullable();
$table->timestamps();

6
database/migrations/2023_10_23_075245_create_users_table.php

@ -13,7 +13,7 @@ return new class extends Migration
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->id();
$table->string('username', 32)->nullable();
$table->string('fullname', 50)->nullable();
@ -25,8 +25,8 @@ return new class extends Migration
$table->string('foto', 255)->nullable();
$table->string('jenis_kelamin', 20)->nullable();
$table->string('agama', 15)->nullable();
$table->foreignUuid('role_id')->nullable()->constrained('m_roles')->cascadeOnDelete();
$table->foreignUuid('warehouse_id')->nullable()->constrained('m_warehouses')->onDelete('set null');
$table->foreignId('role_id')->nullable()->constrained('m_roles')->onDelete('set null');
$table->foreignId('warehouse_id')->nullable()->constrained('m_warehouses')->onDelete('set null');
$table->text('address')->nullable();
$table->timestamp('email_verified_at')->nullable();
$table->string('password', 255)->nullable();

2
database/migrations/2023_10_28_080457_create_customers_table.php

@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::create('customers', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->id();
$table->string('name', 50);
$table->string('code_customer', 15);
$table->string('lot_no', 50);

2
database/migrations/2023_10_28_083930_create_type_petis_table.php

@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::create('type_petis', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->id();
$table->string('type', 20);
$table->string('size_peti', 25);
$table->text('description')->nullable();

2
database/migrations/2023_11_06_022213_create_kondisi_petis_table.php

@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::create('kondisi_petis', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->id();
$table->string('nama_kondisi', 50);
$table->text('deskripsi_kondisi');
$table->timestamps();

11
database/migrations/2023_11_06_085238_create_petis_table.php

@ -12,17 +12,16 @@ return new class extends Migration
public function up(): void
{
Schema::create('petis', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->bigInteger('id_incre')->default(1)->unsigned();
$table->foreignUuid('tipe_peti_id')->nullable()->constrained('type_petis')->onDelete('set null');
$table->id();
$table->foreignId('tipe_peti_id')->nullable()->constrained('type_petis')->onDelete('set null');
$table->string('warna', 50);
$table->string('fix_lot', 100);
$table->integer('packing_no');
$table->foreignUuid('customer_id')->nullable()->constrained('customers')->onDelete('set null');
$table->foreignId('customer_id')->nullable()->constrained('customers')->onDelete('set null');
$table->integer('jumlah')->nullable();
$table->date('date_pembuatan', 100)->nullable();
$table->foreignUuid('warehouse_id')->nullable()->constrained('m_warehouses')->onDelete('set null');
$table->foreignUuid('kondisipeti_id')->nullable()->constrained('kondisi_petis')->onDelete('set null');
$table->foreignId('warehouse_id')->nullable()->constrained('m_warehouses')->onDelete('set null');
$table->foreignId('kondisipeti_id')->nullable()->constrained('kondisi_petis')->onDelete('set null');
$table->string('status', 50)->default('AKTIF');
$table->timestamps();
$table->softDeletes();

9
database/migrations/2023_11_06_122033_create_asset_statuses_table.php

@ -12,18 +12,17 @@ return new class extends Migration
public function up(): void
{
Schema::create('asset_statuses', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->id();
$table->uuid('mobile_id')->nullable();
$table->foreignUuid('peti_id')->nullable()->constrained('petis')->onDelete('set null');
$table->foreignId('peti_id')->nullable()->constrained('petis');
$table->date('exit_at')->nullable();
$table->date('est_pengembalian')->nullable();
$table->string('exit_pic', 200)->nullable();
$table->foreignUuid('exit_warehouse')->nullable()->constrained('m_warehouses');
$table->foreignId('exit_warehouse')->nullable()->constrained('m_warehouses');
$table->date('enter_at')->nullable();
$table->string('enter_pic', 200)->nullable();
$table->foreignUuid('enter_warehouse')->nullable()->constrained('m_warehouses');
$table->foreignId('enter_warehouse')->nullable()->constrained('m_warehouses');
$table->string('kondisi_peti')->nullable();
// $table->string('status')->default('DIPINJAM');
$table->boolean('status')->default(1);
$table->timestamps();
$table->softDeletes();

10
database/migrations/2023_11_08_132316_create_transfers_table.php

@ -12,12 +12,12 @@ return new class extends Migration
public function up(): void
{
Schema::create('transfers', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->id();
$table->uuid('mobile_id')->nullable();
$table->foreignUuid('peti_id')->constrained('petis');
$table->foreignUuid('name_customer')->constrained('customers');
$table->foreignUuid('source_warehouse')->constrained('m_warehouses');
$table->foreignUuid('destination_warehouse')->constrained('m_warehouses');
$table->foreignId('peti_id')->nullable()->constrained('petis');
$table->foreignId('name_customer')->nullable()->constrained('customers');
$table->foreignId('source_warehouse')->nullable()->constrained('m_warehouses');
$table->foreignId('destination_warehouse')->nullable()->constrained('m_warehouses')->onDelete('set null');
$table->date('date');
$table->timestamps();
$table->softDeletes();

6
database/migrations/2023_11_17_075418_create_disposals_table.php

@ -14,9 +14,9 @@ return new class extends Migration
Schema::create('disposals', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->uuid('mobile_id')->nullable();
$table->foreignUuid('peti_id')->constrained('petis');
$table->foreignUuid('customer_id')->nullable()->constrained('customers');
$table->foreignUuid('warehouse_id')->nullable()->constrained('m_warehouses');
$table->foreignId('peti_id')->constrained('petis');
$table->foreignId('customer_id')->nullable()->constrained('customers')->onDelete('set null');
$table->foreignId('warehouse_id')->nullable()->constrained('m_warehouses')->onDelete('set null');
$table->date('date_disposal');
$table->text('description')->nullable();
$table->string('status_disposal', 50);

2
database/seeders/Customer.php

@ -15,7 +15,6 @@ class Customer extends Seeder
{
// Sisipkan data pertama
DB::table('customers')->insert([
'id' => 'd961ad96-211b-4f68-9ff2-111111111111',
'name' => 'DHARMA',
'code_customer' => 'DPM',
'lot_no' => 'JKT23',
@ -27,7 +26,6 @@ class Customer extends Seeder
// Sisipkan data kedua
DB::table('customers')->insert([
'id' => 'a5c7b207-1a1c-43b8-89bf-222222222222',
'name' => 'ADHI CHANDRA',
'code_customer' => 'ACJ',
'lot_no' => 'JKT23',

2
database/seeders/Kondisi_PetiSeeder.php

@ -15,7 +15,6 @@ class Kondisi_PetiSeeder extends Seeder
{
// Sisipkan data Kondisi Peti Rusak
Kondisi_Peti::create([
'id' => 'd961ad96-211b-4f68-9ff2-111111111111',
'nama_kondisi' => 'Rusak',
'deskripsi_kondisi' => 'Barang Rusak',
'created_by' => 'Seeder',
@ -24,7 +23,6 @@ class Kondisi_PetiSeeder extends Seeder
// Sisipkan data Kondisi Peti Baik
Kondisi_Peti::create([
'id' => 'a5c7b207-1a1c-43b8-89bf-222222222222',
'nama_kondisi' => 'Ready',
'deskripsi_kondisi' => 'Barang Siap Bawa',
'created_by' => 'Seeder',

13
database/seeders/PetiSeeder.php

@ -12,17 +12,11 @@ class PetiSeeder extends Seeder
/**
* Run the database seeds.
*/
// public function run(): void
// {
// //
// }
public function run()
{
// Generate 5 dummy data
for ($i = 0; $i < 5; $i++) {
DB::table('petis')->insert([
'id' => Str::uuid(),
'id_incre' => $i + 1, // Increment id_incre from 1 to 5
'tipe_peti_id' => $this->getRandomId('type_petis'),
'warna' => 'Dummy Warna ' . ($i + 1),
'fix_lot' => 'Dummy Fix Lot ' . ($i + 1),
@ -32,6 +26,7 @@ class PetiSeeder extends Seeder
'date_pembuatan' => now(),
'warehouse_id' => $this->getRandomId('m_warehouses'),
'kondisipeti_id' => $this->getRandomId('kondisi_petis'),
'status' => 'AKTIF',
'created_at' => now(),
'updated_at' => now(),
'created_by' => 'Seeder',
@ -46,10 +41,8 @@ class PetiSeeder extends Seeder
* @param string $tableName
* @return string|null
*/
private function getRandomId($tableName)
protected function getRandomId($table)
{
$record = DB::table($tableName)->inRandomOrder()->first();
return $record ? $record->id : null;
return DB::table($table)->inRandomOrder()->first()->id;
}
}

2
database/seeders/RoleSeeder.php

@ -15,7 +15,6 @@ class RoleSeeder extends Seeder
{
// Role Admin
m_role::create([
'id' => 'd961ad96-211b-4f68-9ff2-111111111111',
'name' => 'Admin',
'description' => 'admin sistem',
'created_by' => 'Seeder',
@ -24,7 +23,6 @@ class RoleSeeder extends Seeder
// Role User
m_role::create([
'id' => 'a5c7b207-1a1c-43b8-89bf-222222222222',
'name' => 'Operator',
'description' => 'Operator sistem',
'created_by' => 'Seeder',

2
database/seeders/Type_Peti.php

@ -15,7 +15,6 @@ class Type_Peti extends Seeder
public function run(): void
{
DB::table('type_petis')->insert([
'id' => 'd961ad96-211b-4f68-9ff2-111111111111',
'type' => 'Bagus',
'size_peti' => '2 X 2 X 2 X 2',
'description' => 'Detail Barang Bagus',
@ -23,7 +22,6 @@ class Type_Peti extends Seeder
'updated_by' => 'Seeder',
]);
DB::table('type_petis')->insert([
'id' => 'a5c7b207-1a1c-43b8-89bf-222222222222',
'type' => 'Standar',
'size_peti' => '3 X 3 X 3 X 3',
'description' => 'Detail Barang Standar',

8
database/seeders/UserSeeder.php

@ -26,8 +26,8 @@ class UserSeeder extends Seeder
'jenis_kelamin' => 'Laki-laki',
'agama' => 'Islam',
'foto' => '', // Ganti dengan nama berkas foto jika diperlukan
'role_id' => 'd961ad96-211b-4f68-9ff2-111111111111', // Menghasilkan UUID versi 4
'warehouse_id' => 'd961ad96-211b-4f68-9ff2-111111111111', // Menghasilkan UUID versi 4
'role_id' => 1, // Menghasilkan UUID versi 4
'warehouse_id' => 1, // Menghasilkan UUID versi 4
'address' => 'Jalan Ciwatu',
'email_verified_at' => now(),
'password' => bcrypt('admin'),
@ -47,8 +47,8 @@ class UserSeeder extends Seeder
'jenis_kelamin' => 'Perempuan',
'agama' => 'Islam',
'foto' => '', // Ganti dengan nama berkas foto jika diperlukan
'role_id' => 'a5c7b207-1a1c-43b8-89bf-222222222222', // Menghasilkan UUID versi 4
'warehouse_id' => 'a5c7b207-1a1c-43b8-89bf-222222222222', // Menghasilkan UUID versi 4
'role_id' => 2, // Menghasilkan UUID versi 4
'warehouse_id' => 2, // Menghasilkan UUID versi 4
'address' => 'Jalan Gelarmendala',
'email_verified_at' => now(),
'password' => bcrypt('operator'),

4
database/seeders/WarehouseSeeder.php

@ -15,8 +15,6 @@ class WarehouseSeeder extends Seeder
{
// Warehouse 1
m_warehouse::create([
'id' => 'd961ad96-211b-4f68-9ff2-111111111111',
'id_incre' => 1,
'name' => 'Gudang A',
'description' => 'Gudang utama',
'address' => 'Alamat Gudang A',
@ -26,8 +24,6 @@ class WarehouseSeeder extends Seeder
// Warehouse 2
m_warehouse::create([
'id' => 'a5c7b207-1a1c-43b8-89bf-222222222222',
'id_incre' => 2,
'name' => 'Gudang B',
'description' => 'Gudang cabang',
'address' => 'Alamat Gudang B',

63
resources/views/dashboard/History/Peminjaman/index.blade.php

@ -0,0 +1,63 @@
@extends('layouts.main')
@section('content')
<style>
.table th {
white-space: nowrap;
}
.table td {
white-space: nowrap;
}
</style>
@if (auth()->user()->role_id == 1)
<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">Histori Peminjaman</h5>
</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">No</th>
<th>Kode Peti</th>
<th>Nama Customer</th>
<th>Kode</th>
<th>Tgl Peminjaman</th>
<th>PJ Peminjaman</th>
<th>Asal Gudang</th>
</tr>
</thead>
<tbody>
@php
$no_peminjaman = 1;
@endphp
@forelse ($peminjaman as $data_peminjaman)
@if ($data_peminjaman->enter_warehouse == null)
<tr>
<td class="text-center">{{ $no_peminjaman++ }}</td>
<td>{{ $data_peminjaman->peti->fix_lot }}</td>
<td>{{ $data_peminjaman->peti->customer->name }}</td>
<td>{{ $data_peminjaman->peti->customer->code_customer }} -
{{ $data_peminjaman->peti->tipe_peti->type }}</td>
<td>{{ \Carbon\Carbon::parse($data_peminjaman->exit_at)->format('d/m/Y') }}</td>
<td>{{ $data_peminjaman->exit_pic }}</td>
<td>{{ $data_peminjaman->warehouse->name }}</td>
</tr>
@endif
@empty
<p>Data Kosong</p>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
@else
@include('pages.user.Peminjaman.index')
@endif
@endsection

102
resources/views/dashboard/History/Pengembalian/index.blade.php

@ -0,0 +1,102 @@
@extends('layouts.main')
@section('content')
<style>
.table th {
white-space: nowrap;
}
.table td {
white-space: nowrap;
}
</style>
@if (auth()->user()->role_id == 1)
<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 Pengembalian</h5>
</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>Kode Peti</th>
<th>Customer</th>
<th>Tgl Peinjaman</th>
<th>Estimasi Pengembalian</th>
<th>PJ Peminjaman</th>
<th>Asal WH Peminjaman</th>
<th>Tgl Pengembalian</th>
<th>PJ Pengembalian</th>
<th>Tujuan WH Pengembalian</th>
<th>Kondisi Peti</th>
<th>Status</th>
</tr>
</thead>
<tbody>
@php
$no_peminjaman = 1;
@endphp
@forelse ($peminjaman as $data)
@if ($data->enter_warehouse !== null)
<tr>
<td>{{ $no_peminjaman++ }}</td>
<td>{{ $data->peti->fix_lot }}</td>
<td>{{ $data->peti->customer->name }}</td>
<td>{{ \Carbon\Carbon::parse($data->exit_at)->format('d/m/Y') }}</td>
<td>{{ \Carbon\Carbon::parse($data->est_pengembalian)->format('d/m/Y') }}</td>
<td>{{ $data->exit_pic }}</td>
<td>{{ $data->warehouse->name }}</td>
<td>
@if ($data->enter_at)
{{ \Carbon\Carbon::parse($data->enter_at)->format('d-m-Y') }}
@else
<p class="text-center font-weight-bold">-</p>
@endif
</td>
<td>
@if ($data->enter_pic)
{{ $data->enter_pic }}
@else
<p class="text-center font-weight-bold">-</p>
@endif
</td>
<td>
@if ($data->enter_warehouse)
{{ $data->warehouse->name }}
@else
<p class="text-center font-weight-bold">-</p>
@endif
</td>
<td>
@if ($data->kondisi_peti)
{{ $data->kondisi_peti }}
@else
<p class="text-center font-weight-bold">-</p>
@endif
</td>
<td>
@if ($data->enter_warehouse === null)
Not Return
@else
Return
@endif
</td>
</tr>
@endif
@empty
<p>Data Kosong</p>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
@else
@include('pages.user.Pengembalian.index')
@endif
@endsection

52
resources/views/dashboard/History/Transfer/index.blade.php

@ -0,0 +1,52 @@
@extends('layouts.main')
@section('content')
<style>
.table th {
white-space: nowrap;
}
.table td {
white-space: nowrap;
}
</style>
<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 Transfer</h5>
</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">No</th>
<th>Kode Peti</th>
<th>Nama Customer</th>
<th>Tgl Transfer</th>
<th>Asal Gudang</th>
<th>Tujuan Gudang</th>
</tr>
</thead>
<tbody>
@php
$notransfer = 1;
@endphp
@foreach ($transfer as $data_transfer)
<tr>
<td>{{ $notransfer++ }}</td>
<td>{{ $data_transfer->peti->fix_lot }}</td>
<td>{{ $data_transfer->customer->name ?? '' }}</td>
<td>{{ \Carbon\Carbon::parse($data_transfer->date)->format('d/m/Y') }}</td>
<td>{{ $data_transfer->sourceWarehouse->name ?? '' }}</td>
<td>{{ $data_transfer->destinationWarehouse->name }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
@endsection

2
resources/views/dashboard/Master_Data/Customer/index.blade.php

@ -1,7 +1,7 @@
@extends('layouts.main')
@section('content')
@include('layouts.components.alert-prompt')
@if (auth()->user()->role_id == 'D961AD96-211B-4F68-9FF2-111111111111')
@if (auth()->user()->role_id == 1)
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">

2
resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php

@ -11,7 +11,7 @@
</style>
@include('layouts.components.alert-prompt')
@if (auth()->user()->role_id == 'D961AD96-211B-4F68-9FF2-111111111111')
@if (auth()->user()->role_id == 1)
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">

2
resources/views/dashboard/Master_Data/Manajemen_Peti/Type_peti/index.blade.php

@ -1,7 +1,7 @@
@extends('layouts.main')
@section('content')
@include('layouts.components.alert-prompt')
@if (auth()->user()->role_id == 'D961AD96-211B-4F68-9FF2-111111111111')
@if (auth()->user()->role_id == 1)
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">

2
resources/views/dashboard/Master_Data/Role/index.blade.php

@ -2,7 +2,7 @@
@section('title', 'Role')
@section('content')
@include('layouts.components.alert-prompt')
@if (auth()->user()->role_id == 'D961AD96-211B-4F68-9FF2-111111111111')
@if (auth()->user()->role_id == 1)
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">

2
resources/views/dashboard/Master_Data/User/index.blade.php

@ -1,7 +1,7 @@
@extends('layouts.main')
@section('content')
@include('layouts.components.alert-prompt')
@if (auth()->user()->role_id == 'D961AD96-211B-4F68-9FF2-111111111111')
@if (auth()->user()->role_id == 1)
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">

2
resources/views/dashboard/Master_Data/Warehouse/index.blade.php

@ -3,7 +3,7 @@
@section('content')
@include('layouts.components.alert-prompt')
@if (auth()->user()->role_id == 'D961AD96-211B-4F68-9FF2-111111111111')
@if (auth()->user()->role_id == 1)
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">

3
resources/views/dashboard/Peminjaman/index.blade.php

@ -11,7 +11,7 @@
</style>
@include('layouts.components.alert-prompt')
@if (auth()->user()->role_id == 'D961AD96-211B-4F68-9FF2-111111111111')
@if (auth()->user()->role_id == 1)
<div class="card shadow mb-4">
<div class="card-header py-3">
<div class="row">
@ -22,7 +22,6 @@
<a href="{{ route('dashboard.peminjaman.create') }}" class="btn btn-success btn-icon-split">
<span class="text">Tambah Peminjaman</span>
</a>
</a>
</div>
</div>
</div>

8
resources/views/dashboard/Pengembalian/index.blade.php

@ -10,10 +10,14 @@
white-space: nowrap;
}
</style>
@if (auth()->user()->role_id == 'D961AD96-211B-4F68-9FF2-111111111111')
@if (auth()->user()->role_id == 1)
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Data Pengembalian</h6>
<div class="row">
<div class="col-6">
<h5 class="m-0 font-weight-bold text-primary mt-2">Data Pengembalian</h5>
</div>
</div>
</div>
<div class="card-body">
<div class="table-responsive">

2
resources/views/dashboard/Transaksi/index.blade.php

@ -10,7 +10,7 @@
white-space: nowrap;
}
</style>
@if (auth()->user()->role_id == 'D961AD96-211B-4F68-9FF2-111111111111')
@if (auth()->user()->role_id == 1)
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Data Pengembalian</h6>

1
resources/views/dashboard/Transfer/index.blade.php

@ -20,7 +20,6 @@
<a href="{{ route('dashboard.transfer.create') }}" class="btn btn-success btn-icon-split">
<span class="text">Transfer Peti</span>
</a>
</a>
</div>
</div>
</div>

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

@ -85,31 +85,6 @@
</div>
</div>
</div>
<!-- Area Bar Chart -->
{{-- <div class="col-xl-7 col-lg-7">
<div class="card shadow mb-4">
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
<h6 class="m-0 font-weight-bold text-primary">Grafik Peminjaman VS Pengembalian</h6>
</div>
@php
$chartData = app('App\Http\Controllers\HomeController')->generateChartData();
@endphp
<div class="card-body">
<label for="yearFilter">Pilih Tahun:</label>
<select id="yearFilter" class="form-control">
@foreach ($chartData['years'] as $year)
@if ($chartData['exitData'][$loop->index] || $chartData['enterData'][$loop->index])
<option value="{{ $year }}">{{ $year }}</option>
@endif
@endforeach
</select>
<canvas id="ChartAssetStatus" style="max-height: 600px;"></canvas>
</div>
</div>
</div> --}}
<div class="col-xl-7 col-lg-7">
<div class="card shadow mb-4" style="max-height: 600px;">
<div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">

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

@ -1,5 +1,5 @@
<ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion" id="accordionSidebar">
@if (auth()->user()->role_id == 'D961AD96-211B-4F68-9FF2-111111111111')
@if (auth()->user()->role_id == 1)
<!-- Sidebar - Brand -->
<a class="sidebar-brand d-flex align-items-center justify-content-center"
href="{{ route('dashboard.home.admin') }}">
@ -25,24 +25,30 @@
<hr class="sidebar-divider">
<li class="nav-item {{ $active == 'menu-transaksi' ? 'active' : '' }}">
<a class="nav-link" href="{{ route('dashboard.transaksikeluamasuk.index') }}">
<i class="fas fa-fw fa-upload"></i>
<span>Transaksi</span>
</a>
</li>
<!-- <li class="nav-item {{ $active == 'menu-pengembalian' ? 'active' : '' }}">
<a class="nav-link" href="{{ route('dashboard.pengembalian.index') }}">
<i class="fas fa-fw fa-download"></i>
<span>Pengembalian</span>
</a>
</li> -->
<li class="nav-item {{ $active == 'menu-transfer' ? 'active' : '' }}">
<a class="nav-link" href="{{ route('dashboard.transfer.index') }}">
@php
$isTransaksiActive = in_array($active, ['menu-user', 'menu-role']);
@endphp
<!-- Transaction -->
<li class="nav-item">
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapsetransaktion"
aria-expanded="{{ $isTransaksiActive ? 'true' : 'false' }}" aria-controls="collapsetransaktion">
<i class="fas fa-fw fa-exchange-alt"></i>
<span>Transfer</span>
<span>Transaksi</span>
</a>
<div id="collapsetransaktion" class="collapse" aria-labelledby="headingTransaktion"
data-parent="#accordionSidebar">
<div class="bg-white py-2 collapse-inner rounded">
<a class="collapse-item {{ $active == 'menu-peminjaman' ? 'active' : '' }}"
href="{{ route('dashboard.peminjaman.index') }}">Peminjaman</a>
<a class="collapse-item {{ $active == 'menu-pengembalian' ? 'active' : '' }}"
href="{{ route('dashboard.pengembalian.index') }}">Pengembalian</a>
<a class="collapse-item {{ $active == 'menu-transfer' ? 'active' : '' }}"
href="{{ route('dashboard.transfer.index') }}">Transfer</a>
</div>
</div>
</li>
<li class="nav-item {{ $active == 'menu-disposal' ? 'active' : '' }}">
<a class="nav-link" href="{{ route('dashboard.disposal.index') }}">
<i class="fas fa-fw fa-trash"></i>
@ -50,19 +56,21 @@
</a>
</li>
<!-- Histories -->
<li class="nav-item">
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseTwo"
aria-controls="collapseTwo">
<i class="fas fa-fw fa-user"></i>
<a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapsehistory"
aria-expanded="{{ $isTransaksiActive ? 'true' : 'false' }}" aria-controls="collapsehistory">
<i class="fas fa-history"></i>
<span>History</span>
</a>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionSidebar">
<div id="collapsehistory" class="collapse" aria-labelledby="headingHistory" data-parent="#accordionSidebar">
<div class="bg-white py-2 collapse-inner rounded">
<a class="collapse-item {{ $active == 'menu-user' ? 'active' : '' }}"
href="{{ route('dashboard.peminjaman.index') }}">Peminjaman</a>
<a class="collapse-item {{ $active == 'menu-role' ? 'active' : '' }}"
href="{{ route('dashboard.pengembalian.index') }}">Pengembalian</a>
<a class="collapse-item {{ $active == 'history-peminjaman' ? 'active' : '' }}"
href="{{ route('dashboard.history.historyPeminjaman') }}">Peminjaman</a>
<a class="collapse-item {{ $active == 'history-pengembalian' ? 'active' : '' }}"
href="{{ route('dashboard.history.historyPengembalian') }}">Pengembalian</a>
<a class="collapse-item {{ $active == 'history-transfer' ? 'active' : '' }}"
href="{{ route('dashboard.history.historyTransfer') }}">Transfer</a>
</div>
</div>
</li>

19
routes/web.php

@ -4,6 +4,7 @@ use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PetiController;
use App\Http\Controllers\RoleController;
use App\Http\Controllers\M_userController;
use App\Http\Controllers\HistoryController;
use App\Http\Controllers\M_assetController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\CustomerController;
@ -14,8 +15,8 @@ use App\Http\Controllers\WarehouseController;
use App\Http\Controllers\PeminjamanController;
use App\Http\Controllers\KondisiPetiController;
use App\Http\Controllers\PengembalianController;
use App\Http\Controllers\TransaksiKeluarMasukController;
use App\Http\Controllers\PetternLotPetiController;
use App\Http\Controllers\TransaksiKeluarMasukController;
/*
|--------------------------------------------------------------------------
@ -71,7 +72,7 @@ Route::prefix('dashboard')->name('dashboard.')->middleware(['auth'])->group(func
Route::delete('pengembalian/delete/{id}', 'destroy')->name('pengembalian.destroy');
});
Route::controller(TransaksiKeluarMasukController::class)->group(function() {
Route::controller(TransaksiKeluarMasukController::class)->group(function () {
Route::get('transaksikeluamasuk', 'index')->name('transaksikeluamasuk.index');
Route::get('transaksikeluamasuk/create', 'create')->name('transaksikeluamasuk.create');
Route::post('transaksikeluamasuk/store', 'store')->name('transaksikeluamasuk.store');
@ -103,6 +104,20 @@ Route::prefix('dashboard')->name('dashboard.')->middleware(['auth'])->group(func
Route::delete('disposal/delete/{id}', 'destroy')->name('disposal.destroy');
});
//Halaman History
Route::controller(HistoryController::class)->group(function () {
Route::get('history/peminjaman', 'historyPeminjaman')->name('history.historyPeminjaman');
Route::get('history/pengembalian', 'historyPengembalian')->name('history.historyPengembalian');
Route::get('history/transfer', 'historyTransfer')->name('history.historyTransfer');
// Route::get('history/create', 'create')->name('history.create');
// Route::post('history/store', 'store')->name('history.store');
// Route::get('history/{id}', 'show')->name('history.show');
// Route::get('history/{id}/edit', 'edit')->name('history.edit');
// Route::put('history/{id}', 'update')->name('history.update');
// Route::delete('history/delete/{id}', 'destroy')->name('history.destroy');
});
//Halaman User
Route::controller(M_userController::class)->group(function () {
Route::get('user', 'index')->name('user.index');

Loading…
Cancel
Save