diff --git a/app/Http/Controllers/Auth/RedirectAuthController.php b/app/Http/Controllers/Auth/RedirectAuthController.php index 287de3a..fa5d439 100644 --- a/app/Http/Controllers/Auth/RedirectAuthController.php +++ b/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'); - // } } } diff --git a/app/Http/Controllers/HistoryController.php b/app/Http/Controllers/HistoryController.php new file mode 100644 index 0000000..f7902fc --- /dev/null +++ b/app/Http/Controllers/HistoryController.php @@ -0,0 +1,42 @@ + 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); + } +} diff --git a/app/Http/Controllers/PeminjamanController.php b/app/Http/Controllers/PeminjamanController.php index 64871ec..1406303 100644 --- a/app/Http/Controllers/PeminjamanController.php +++ b/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(), diff --git a/app/Http/Controllers/PengembalianController.php b/app/Http/Controllers/PengembalianController.php index 0838a58..8a5c009 100644 --- a/app/Http/Controllers/PengembalianController.php +++ b/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); diff --git a/app/Http/Controllers/PetiController.php b/app/Http/Controllers/PetiController.php index 8b9aaba..58fdc53 100644 --- a/app/Http/Controllers/PetiController.php +++ b/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); } diff --git a/app/Http/Controllers/TransferController.php b/app/Http/Controllers/TransferController.php index 4c20870..ca41b24 100644 --- a/app/Http/Controllers/TransferController.php +++ b/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. */ diff --git a/app/Http/Controllers/WarehouseController.php b/app/Http/Controllers/WarehouseController.php index 0c2697d..c26df98 100644 --- a/app/Http/Controllers/WarehouseController.php +++ b/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. */ diff --git a/app/Http/Requests/ValidasiCreatePeti.php b/app/Http/Requests/ValidasiCreatePeti.php index 08ce11d..80bf878 100644 --- a/app/Http/Requests/ValidasiCreatePeti.php +++ b/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!', diff --git a/app/Http/Requests/ValidasiCreateWarehouse.php b/app/Http/Requests/ValidasiCreateWarehouse.php index d32fa33..148226b 100644 --- a/app/Http/Requests/ValidasiCreateWarehouse.php +++ b/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.', diff --git a/app/Models/Customer.php b/app/Models/Customer.php index bc6508b..6c5f5a9 100644 --- a/app/Models/Customer.php +++ b/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 = [ diff --git a/app/Models/Kondisi_Peti.php b/app/Models/Kondisi_Peti.php index b5f97af..3224a0f 100644 --- a/app/Models/Kondisi_Peti.php +++ b/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 = [ diff --git a/app/Models/Peti.php b/app/Models/Peti.php index d0223df..efedd7a 100644 --- a/app/Models/Peti.php +++ b/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 = [ diff --git a/app/Models/Type_peti.php b/app/Models/Type_peti.php index 15c6a66..7f1fad9 100644 --- a/app/Models/Type_peti.php +++ b/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 = [ diff --git a/app/Models/User.php b/app/Models/User.php index 06af296..c2a3446 100644 --- a/app/Models/User.php +++ b/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. diff --git a/app/Models/m_role.php b/app/Models/m_role.php index fec0070..654a374 100644 --- a/app/Models/m_role.php +++ b/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 = [ diff --git a/app/Models/m_warehouse.php b/app/Models/m_warehouse.php index 955f49b..2558dbd 100644 --- a/app/Models/m_warehouse.php +++ b/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', diff --git a/config/app.php b/config/app.php index 7569ccb..9a47129 100644 --- a/config/app.php +++ b/config/app.php @@ -70,7 +70,7 @@ return [ | */ - 'timezone' => 'UTC', + 'timezone' => 'Asia/Jakarta', /* |-------------------------------------------------------------------------- diff --git a/database/migrations/2023_10_23_073314_create_m_warehouses_table.php b/database/migrations/2023_10_23_073314_create_m_warehouses_table.php index 12d658d..50c9bae 100644 --- a/database/migrations/2023_10_23_073314_create_m_warehouses_table.php +++ b/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(); diff --git a/database/migrations/2023_10_23_075239_create_m_roles_table.php b/database/migrations/2023_10_23_075239_create_m_roles_table.php index ecb9928..6147ad1 100644 --- a/database/migrations/2023_10_23_075239_create_m_roles_table.php +++ b/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(); diff --git a/database/migrations/2023_10_23_075245_create_users_table.php b/database/migrations/2023_10_23_075245_create_users_table.php index 93473ac..0deee1e 100644 --- a/database/migrations/2023_10_23_075245_create_users_table.php +++ b/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(); diff --git a/database/migrations/2023_10_28_080457_create_customers_table.php b/database/migrations/2023_10_28_080457_create_customers_table.php index db13ebb..d65cd05 100644 --- a/database/migrations/2023_10_28_080457_create_customers_table.php +++ b/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); diff --git a/database/migrations/2023_10_28_083930_create_type_petis_table.php b/database/migrations/2023_10_28_083930_create_type_petis_table.php index 9784d19..611c518 100644 --- a/database/migrations/2023_10_28_083930_create_type_petis_table.php +++ b/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(); diff --git a/database/migrations/2023_11_06_022213_create_kondisi_petis_table.php b/database/migrations/2023_11_06_022213_create_kondisi_petis_table.php index 7e06bf8..dae6984 100644 --- a/database/migrations/2023_11_06_022213_create_kondisi_petis_table.php +++ b/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(); diff --git a/database/migrations/2023_11_06_085238_create_petis_table.php b/database/migrations/2023_11_06_085238_create_petis_table.php index 4532dc4..1281ae8 100644 --- a/database/migrations/2023_11_06_085238_create_petis_table.php +++ b/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(); diff --git a/database/migrations/2023_11_06_122033_create_asset_statuses_table.php b/database/migrations/2023_11_06_122033_create_asset_statuses_table.php index cade79b..06fb07e 100644 --- a/database/migrations/2023_11_06_122033_create_asset_statuses_table.php +++ b/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(); diff --git a/database/migrations/2023_11_08_132316_create_transfers_table.php b/database/migrations/2023_11_08_132316_create_transfers_table.php index 8409fbc..6e72b31 100644 --- a/database/migrations/2023_11_08_132316_create_transfers_table.php +++ b/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(); diff --git a/database/migrations/2023_11_17_075418_create_disposals_table.php b/database/migrations/2023_11_17_075418_create_disposals_table.php index a1e684c..19f1b86 100644 --- a/database/migrations/2023_11_17_075418_create_disposals_table.php +++ b/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); diff --git a/database/seeders/Customer.php b/database/seeders/Customer.php index 792f44d..ea7992e 100644 --- a/database/seeders/Customer.php +++ b/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', diff --git a/database/seeders/Kondisi_PetiSeeder.php b/database/seeders/Kondisi_PetiSeeder.php index 4024b73..c1cbac7 100644 --- a/database/seeders/Kondisi_PetiSeeder.php +++ b/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', diff --git a/database/seeders/PetiSeeder.php b/database/seeders/PetiSeeder.php index cde5687..cedcd46 100644 --- a/database/seeders/PetiSeeder.php +++ b/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; } } diff --git a/database/seeders/RoleSeeder.php b/database/seeders/RoleSeeder.php index 566a4b0..19d9a3f 100644 --- a/database/seeders/RoleSeeder.php +++ b/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', diff --git a/database/seeders/Type_Peti.php b/database/seeders/Type_Peti.php index 66b38bb..ec9d884 100644 --- a/database/seeders/Type_Peti.php +++ b/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', diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php index 8187715..561aa38 100644 --- a/database/seeders/UserSeeder.php +++ b/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'), diff --git a/database/seeders/WarehouseSeeder.php b/database/seeders/WarehouseSeeder.php index 1706e4a..18cd16f 100644 --- a/database/seeders/WarehouseSeeder.php +++ b/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', diff --git a/resources/views/dashboard/History/Peminjaman/index.blade.php b/resources/views/dashboard/History/Peminjaman/index.blade.php new file mode 100644 index 0000000..11b6dec --- /dev/null +++ b/resources/views/dashboard/History/Peminjaman/index.blade.php @@ -0,0 +1,63 @@ +@extends('layouts.main') +@section('content') + + @if (auth()->user()->role_id == 1) +
No | +Kode Peti | +Nama Customer | +Kode | +Tgl Peminjaman | +PJ Peminjaman | +Asal Gudang | +
---|---|---|---|---|---|---|
{{ $no_peminjaman++ }} | +{{ $data_peminjaman->peti->fix_lot }} | +{{ $data_peminjaman->peti->customer->name }} | +{{ $data_peminjaman->peti->customer->code_customer }} - + {{ $data_peminjaman->peti->tipe_peti->type }} | +{{ \Carbon\Carbon::parse($data_peminjaman->exit_at)->format('d/m/Y') }} | +{{ $data_peminjaman->exit_pic }} | +{{ $data_peminjaman->warehouse->name }} | +
No | +Kode Peti | +Customer | +Tgl Peinjaman | +Estimasi Pengembalian | +PJ Peminjaman | +Asal WH Peminjaman | +Tgl Pengembalian | +PJ Pengembalian | +Tujuan WH Pengembalian | +Kondisi Peti | +Status | +
---|---|---|---|---|---|---|---|---|---|---|---|
{{ $no_peminjaman++ }} | +{{ $data->peti->fix_lot }} | +{{ $data->peti->customer->name }} | +{{ \Carbon\Carbon::parse($data->exit_at)->format('d/m/Y') }} | +{{ \Carbon\Carbon::parse($data->est_pengembalian)->format('d/m/Y') }} | +{{ $data->exit_pic }} | +{{ $data->warehouse->name }} | +
+ @if ($data->enter_at)
+ {{ \Carbon\Carbon::parse($data->enter_at)->format('d-m-Y') }}
+ @else
+ - + @endif + |
+
+ @if ($data->enter_pic)
+ {{ $data->enter_pic }}
+ @else
+ - + @endif + |
+
+ @if ($data->enter_warehouse)
+ {{ $data->warehouse->name }}
+ @else
+ - + @endif + |
+
+ @if ($data->kondisi_peti)
+ {{ $data->kondisi_peti }}
+ @else
+ - + @endif + |
+ + @if ($data->enter_warehouse === null) + Not Return + @else + Return + @endif + | +
No | +Kode Peti | +Nama Customer | +Tgl Transfer | +Asal Gudang | +Tujuan Gudang | +
---|---|---|---|---|---|
{{ $notransfer++ }} | +{{ $data_transfer->peti->fix_lot }} | +{{ $data_transfer->customer->name ?? '' }} | +{{ \Carbon\Carbon::parse($data_transfer->date)->format('d/m/Y') }} | +{{ $data_transfer->sourceWarehouse->name ?? '' }} | +{{ $data_transfer->destinationWarehouse->name }} | +