From 8392beea2a790906529fd8c0c6cc9fdc5c8c7a0d Mon Sep 17 00:00:00 2001 From: Gunawan19621 Date: Mon, 27 Nov 2023 21:24:38 +0700 Subject: [PATCH] perbaikan hak akses admin dan operator --- app/Http/Controllers/DisposalController.php | 7 +- app/Http/Controllers/HistoryController.php | 6 +- app/Http/Controllers/HomeController.php | 9 +- .../Controllers/PetternLotPetiController.php | 3 +- app/Http/Controllers/StokOpNameController.php | 16 +-- .../TransaksiKeluarMasukController.php | 2 +- .../Disposal/ValidasiCreateDisposal.php | 12 ++- .../Disposal/ValidasiUpdateDisposal.php | 12 ++- app/Models/Disposal.php | 7 +- app/Models/Peti.php | 26 +++-- app/Models/Transfer.php | 8 +- app/Models/User.php | 5 +- app/Models/asset_status.php | 30 ++++-- .../2023_10_23_075245_create_users_table.php | 4 +- .../2023_11_06_085238_create_petis_table.php | 8 +- ...23_11_08_132316_create_transfers_table.php | 2 +- ...23_11_17_075418_create_disposals_table.php | 6 +- database/seeders/PetiSeeder.php | 100 ++++++++++++++++-- .../views/dashboard/Disposal/index.blade.php | 5 +- .../History/Peminjaman/index.blade.php | 1 - .../History/Pengembalian/index.blade.php | 1 - .../Master_Data/Customer/index.blade.php | 1 - .../Kondisi_Peti/index.blade.php | 6 +- .../Manajemen_Peti/Peti/index.blade.php | 1 - .../Manajemen_Peti/Type_peti/index.blade.php | 1 - .../Pattern_lot_peti/detail_peti.blade.php | 1 - .../Report/Pattern_lot_peti/index.blade.php | 1 - .../Report/Stok_opname/index.blade.php | 1 - .../Master_Data/User/index.blade.php | 1 - .../dashboard/Peminjaman/index.blade.php | 1 - .../dashboard/Pengembalian/index.blade.php | 1 - .../views/dashboard/Transaksi/index.blade.php | 1 - .../views/dashboard/Transfer/index.blade.php | 3 +- resources/views/dashboard/index.blade.php | 21 +++- resources/views/layouts/navbar.blade.php | 8 +- resources/views/layouts/navbar_list.blade.php | 19 +++- .../Manajemen_Peti/Peti/index.blade.php | 2 - .../pages/user/dashboard/index.blade.php | 4 +- routes/web.php | 3 +- 39 files changed, 245 insertions(+), 101 deletions(-) diff --git a/app/Http/Controllers/DisposalController.php b/app/Http/Controllers/DisposalController.php index 95f76e3..8317552 100644 --- a/app/Http/Controllers/DisposalController.php +++ b/app/Http/Controllers/DisposalController.php @@ -16,14 +16,17 @@ class DisposalController extends Controller public function index() { $data = [ - 'disposal' => Disposal::where('status_disposal', 'INAKTIF')->orderBy('created_at', 'desc')->get(), - // 'disposal' => Disposal::orderBy('created_at', 'desc')->get(), + 'disposal' => Disposal::where('status_disposal', 'INAKTIF') + ->orderBy('created_at', 'desc') + ->get(), 'active' => 'menu-disposal', ]; + return view('dashboard.Disposal.index', $data); } + /** * Show the form for creating a new resource. */ diff --git a/app/Http/Controllers/HistoryController.php b/app/Http/Controllers/HistoryController.php index f7902fc..ed8f847 100644 --- a/app/Http/Controllers/HistoryController.php +++ b/app/Http/Controllers/HistoryController.php @@ -14,7 +14,7 @@ class HistoryController extends Controller $data = [ // 'peminjaman' => asset_status::get(), - 'peminjaman' => asset_status::orderBy('created_at', 'desc')->get(), + 'peminjaman' => asset_status::withTrashed()->orderBy('created_at', 'desc')->get(), 'warehouse' => m_warehouse::get(), 'active' => 'history-peminjaman', ]; @@ -25,7 +25,7 @@ class HistoryController extends Controller public function historyPengembalian() { $data = [ - 'peminjaman' => asset_status::orderBy('created_at', 'desc')->get(), + 'peminjaman' => asset_status::withTrashed()->orderBy('created_at', 'desc')->get(), 'active' => 'history-pengembalian', ]; return view('dashboard.History.Pengembalian.index', $data); @@ -34,7 +34,7 @@ class HistoryController extends Controller public function historyTransfer() { $data = [ - 'transfer' => Transfer::orderBy('created_at', 'desc')->get(), + 'transfer' => Transfer::withTrashed()->orderBy('created_at', 'desc')->get(), 'active' => 'history-transfer', ]; return view('dashboard.History.Transfer.index', $data); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index f8bba8e..0c45ff7 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -37,11 +37,12 @@ class HomeController extends Controller public function notification() { + $notification = \App\Models\asset_status::whereNull('enter_at') + ->whereDate('est_pengembalian', \Carbon\Carbon::today()) + ->get(); + $data = [ - 'reminder' => \App\Models\asset_status::whereNull('enter_at')->count(), - 'jumlahPeti' => \App\Models\Peti::count(), - 'jumlahPeminjaman' => \App\Models\asset_status::count(), - 'jumlahPengembalian' => \App\Models\asset_status::whereNotNull('enter_at')->count(), + 'notifikasi' => $notification, 'active' => 'menu-admin', ]; diff --git a/app/Http/Controllers/PetternLotPetiController.php b/app/Http/Controllers/PetternLotPetiController.php index 7e3baf9..ed225cf 100644 --- a/app/Http/Controllers/PetternLotPetiController.php +++ b/app/Http/Controllers/PetternLotPetiController.php @@ -13,8 +13,7 @@ class PetternLotPetiController extends Controller public function index() { $data = [ - // 'warehouses' => m_warehouse::orderBy('created_at', 'desc')->get(), - 'peti' => Peti::get(), + 'peti' => Peti::withTrashed()->get(), 'active' => 'menu-Pettern_Lot_Peti' ]; return view('dashboard.Master_Data.Report.Pattern_lot_peti.index', $data); diff --git a/app/Http/Controllers/StokOpNameController.php b/app/Http/Controllers/StokOpNameController.php index 65eb5af..f1e0999 100644 --- a/app/Http/Controllers/StokOpNameController.php +++ b/app/Http/Controllers/StokOpNameController.php @@ -14,27 +14,27 @@ class StokOpNameController extends Controller public function index() { // Total Peti Berdasarkan Gudang - $gudangStokOpnames = Peti::with('customer', 'tipe_peti', 'warehouse') + $gudangStokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti', 'warehouse') ->select('customer_id', 'tipe_peti_id', 'warehouse_id', DB::raw('COUNT(*) as total_petis')) ->groupBy('customer_id', 'tipe_peti_id', 'warehouse_id') ->get(); // Total Peti Berdasarkan Tanggal Sekarang - $todayStokOpnames = Peti::with('customer', 'tipe_peti') + $todayStokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti') ->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) ->whereDate('created_at', today()) ->groupBy('customer_id', 'tipe_peti_id') ->get(); // Total Peti Berdasarkan Tanggal Sebelum Tanggal Sekarang - $yesterdayStokOpnames = Peti::with('customer', 'tipe_peti') + $yesterdayStokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti') ->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) ->whereDate('created_at', '<', today()) // Mendapatkan data sebelum tanggal hari ini ->groupBy('customer_id', 'tipe_peti_id') ->get(); // Total Peti - $stokOpnames = Peti::with('customer', 'tipe_peti') + $stokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti') ->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) ->groupBy('customer_id', 'tipe_peti_id') ->get(); @@ -52,27 +52,27 @@ class StokOpNameController extends Controller public function export() { //total peti - $stokOpnames = Peti::with('customer', 'tipe_peti') + $stokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti') ->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) ->groupBy('customer_id', 'tipe_peti_id') ->get(); // Total Peti Berdasarkan Tanggal Sekarang - $todayStokOpnames = Peti::with('customer', 'tipe_peti') + $todayStokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti') ->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) ->whereDate('created_at', today()) ->groupBy('customer_id', 'tipe_peti_id') ->get(); // Total Peti Berdasarkan Tanggal Sebelum Tanggal Sekarang - $yesterdayStokOpnames = Peti::with('customer', 'tipe_peti') + $yesterdayStokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti') ->select('customer_id', 'tipe_peti_id', DB::raw('COUNT(*) as total_petis')) ->whereDate('created_at', '<', today()) // Mendapatkan data sebelum tanggal hari ini ->groupBy('customer_id', 'tipe_peti_id') ->get(); // Total Peti Berdasarkan Gudang - $gudangStokOpnames = Peti::with('customer', 'tipe_peti', 'warehouse') + $gudangStokOpnames = Peti::withTrashed()->with('customer', 'tipe_peti', 'warehouse') ->select('customer_id', 'tipe_peti_id', 'warehouse_id', DB::raw('COUNT(*) as total_petis')) ->groupBy('customer_id', 'tipe_peti_id', 'warehouse_id') ->get(); diff --git a/app/Http/Controllers/TransaksiKeluarMasukController.php b/app/Http/Controllers/TransaksiKeluarMasukController.php index 8b556d1..3aee8cd 100644 --- a/app/Http/Controllers/TransaksiKeluarMasukController.php +++ b/app/Http/Controllers/TransaksiKeluarMasukController.php @@ -14,7 +14,7 @@ class TransaksiKeluarMasukController extends Controller public function index() { $data = [ - 'peminjaman' => asset_status::all(), + 'peminjaman' => asset_status::withTrashed()->all(), 'active' => 'menu-transaksi', ]; return view('dashboard.transaksi.index', $data); diff --git a/app/Http/Requests/Disposal/ValidasiCreateDisposal.php b/app/Http/Requests/Disposal/ValidasiCreateDisposal.php index 5090760..b1a60c3 100644 --- a/app/Http/Requests/Disposal/ValidasiCreateDisposal.php +++ b/app/Http/Requests/Disposal/ValidasiCreateDisposal.php @@ -22,9 +22,9 @@ class ValidasiCreateDisposal extends FormRequest public function rules(): array { return [ - 'peti_id' => 'required', - 'customer_id' => 'nullable', - 'warehouse_id' => 'nullable', + 'peti_id' => 'required|integer', + 'customer_id' => 'required|integer', + 'warehouse_id' => 'required|integer', 'date_disposal' => 'nullable|date', 'description' => 'nullable|string', 'status_disposal' => 'nullable', @@ -34,6 +34,12 @@ class ValidasiCreateDisposal extends FormRequest public function messages(): array { return [ + 'peti_id.required' => 'Peti harus dipilih.', + 'peti_id.integer' => 'Peti harus berupa angka.', + 'customer_id.required' => 'Customer harus dipilih.', + 'customer_id.integer' => 'Customer harus berupa angka.', + 'warehouse_id.required' => 'Gudang harus dipilih.', + 'warehouse_id.integer' => 'Gudang harus berupa angka.', 'date_disposal.date' => 'Format tanggal disposal tidak valid.', 'description.string' => 'Deskripsi harus berupa teks.', ]; diff --git a/app/Http/Requests/Disposal/ValidasiUpdateDisposal.php b/app/Http/Requests/Disposal/ValidasiUpdateDisposal.php index e400920..511b52c 100644 --- a/app/Http/Requests/Disposal/ValidasiUpdateDisposal.php +++ b/app/Http/Requests/Disposal/ValidasiUpdateDisposal.php @@ -22,9 +22,9 @@ class ValidasiUpdateDisposal extends FormRequest public function rules(): array { return [ - 'peti_id' => 'required', - 'customer_id' => 'nullable', - 'warehouse_id' => 'nullable', + 'peti_id' => 'required|integer', + 'customer_id' => 'required|integer', + 'warehouse_id' => 'required|integer', 'date_disposal' => 'nullable|date', 'description' => 'nullable|string', 'status_disposal' => 'nullable', @@ -34,6 +34,12 @@ class ValidasiUpdateDisposal extends FormRequest public function messages(): array { return [ + 'peti_id.required' => 'Peti harus dipilih.', + 'peti_id.integer' => 'Peti harus berupa angka.', + 'customer_id.required' => 'Customer harus dipilih.', + 'customer_id.integer' => 'Customer harus berupa angka.', + 'warehouse_id.required' => 'Gudang harus dipilih.', + 'warehouse_id.integer' => 'Gudang harus berupa angka.', 'date_disposal.date' => 'Format tanggal disposal tidak valid.', 'description.string' => 'Deskripsi harus berupa teks.', ]; diff --git a/app/Models/Disposal.php b/app/Models/Disposal.php index 966bf75..fd57ffd 100644 --- a/app/Models/Disposal.php +++ b/app/Models/Disposal.php @@ -9,7 +9,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; class Disposal extends Model { - use HasFactory, SoftDeletes, UUID; + use HasFactory, SoftDeletes; protected $table = 'disposals'; protected $fillable = [ @@ -35,13 +35,14 @@ class Disposal extends Model 'kondisipeti_id', 'fix_lot', 'updated_by', - ); + )->withTrashed(); } + public function customer() { return $this->belongsTo(Customer::class, 'customer_id')->select( 'name', 'code_customer', - ); + )->withTrashed(); } } diff --git a/app/Models/Peti.php b/app/Models/Peti.php index c401091..545ca4e 100644 --- a/app/Models/Peti.php +++ b/app/Models/Peti.php @@ -31,29 +31,43 @@ class Peti extends Model public function customer() { - return $this->belongsTo(Customer::class, 'customer_id')->select('id', 'name', 'code_customer', 'lot_no'); + return $this->belongsTo(Customer::class, 'customer_id')->select( + 'id', + 'name', + 'code_customer', + 'lot_no' + )->withTrashed(); } public function warehouse() { - return $this->belongsTo(m_warehouse::class, 'warehouse_id')->select('id', 'name', 'address'); + return $this->belongsTo(m_warehouse::class, 'warehouse_id')->select('id', 'name', 'address')->withTrashed(); } public function tipe_peti() { - return $this->belongsTo(Type_peti::class, 'tipe_peti_id')->select('id', 'type', 'size_peti', 'description'); + return $this->belongsTo(Type_peti::class, 'tipe_peti_id')->select( + 'id', + 'type', + 'size_peti', + 'description' + )->withTrashed(); } public function kondisipeti() { - return $this->belongsTo(Kondisi_Peti::class, 'kondisipeti_id')->select('id', 'nama_kondisi', 'deskripsi_kondisi'); + return $this->belongsTo(Kondisi_Peti::class, 'kondisipeti_id')->select( + 'id', + 'nama_kondisi', + 'deskripsi_kondisi' + )->withTrashed(); } public function transfer() { - return $this->hasOne(Transfer::class, 'peti_id'); + return $this->hasOne(Transfer::class, 'peti_id')->withTrashed(); } // proses pengambilan data public function assetStatuses() { - return $this->hasMany(asset_status::class, 'peti_id'); + return $this->hasMany(asset_status::class, 'peti_id')->withTrashed(); } } diff --git a/app/Models/Transfer.php b/app/Models/Transfer.php index 744dbef..addde0e 100644 --- a/app/Models/Transfer.php +++ b/app/Models/Transfer.php @@ -35,27 +35,27 @@ class Transfer extends Model 'kondisipeti_id', 'fix_lot', 'updated_by', - ); + )->withTrashed(); } public function customer() { return $this->belongsTo(Customer::class, 'name_customer')->select( 'name', 'code_customer', - ); + )->withTrashed(); } public function sourceWarehouse() { return $this->belongsTo(m_warehouse::class, 'source_warehouse')->select( 'name', 'address', - ); + )->withTrashed(); } public function destinationWarehouse() { return $this->belongsTo(m_warehouse::class, 'destination_warehouse')->select( 'name', 'address', - ); + )->withTrashed(); } } diff --git a/app/Models/User.php b/app/Models/User.php index c2a3446..8cb2de9 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -8,11 +8,12 @@ use Laravel\Sanctum\HasApiTokens; use Illuminate\Notifications\Notifiable; use PHPOpenSourceSaver\JWTAuth\Contracts\JWTSubject; use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable implements JWTSubject { - use HasApiTokens, HasFactory, Notifiable; + use HasApiTokens, HasFactory, Notifiable, SoftDeletes; /** * The attributes that are mass assignable. @@ -40,7 +41,7 @@ class User extends Authenticatable implements JWTSubject public function warehouse() { - return $this->belongsTo(m_warehouse::class, 'warehouse_id'); + return $this->belongsTo(m_warehouse::class, 'warehouse_id')->withTrashed(); } /** diff --git a/app/Models/asset_status.php b/app/Models/asset_status.php index 7679654..3e5d7c2 100644 --- a/app/Models/asset_status.php +++ b/app/Models/asset_status.php @@ -7,11 +7,12 @@ use App\Traits\UUID; use App\Models\Customer; use App\Models\Type_peti; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\Factories\HasFactory; class asset_status extends Model { - use HasFactory; + use HasFactory, SoftDeletes; protected $table = 'asset_statuses'; protected $fillable = [ @@ -34,41 +35,52 @@ class asset_status extends Model public function asset() { - return $this->belongsTo(m_asset::class, 'asset_id'); + return $this->belongsTo(m_asset::class, 'asset_id')->withTrashed(); } public function warehouseId() { - return $this->belongsTo(m_warehouse::class, 'warehouse_id')->select('id', 'name', 'address'); + return $this->belongsTo(m_warehouse::class, 'warehouse_id')->select('id', 'name', 'address')->withTrashed(); } public function warehouse() { - return $this->belongsTo(m_warehouse::class, 'exit_warehouse')->select('id', 'name', 'address'); + return $this->belongsTo(m_warehouse::class, 'exit_warehouse')->select('id', 'name', 'address')->withTrashed(); } public function warehouseEnter() { - return $this->belongsTo(m_warehouse::class, 'enter_warehouse')->select('id', 'name', 'address'); + return $this->belongsTo(m_warehouse::class, 'enter_warehouse')->select('id', 'name', 'address')->withTrashed(); } public function peti() { - return $this->belongsTo(Peti::class, 'peti_id')->select('id', 'tipe_peti_id', 'warna', 'fix_lot', 'packing_no', 'customer_id', 'jumlah', 'date_pembuatan', 'warehouse_id', 'kondisipeti_id'); + return $this->belongsTo(Peti::class, 'peti_id')->select( + 'id', + 'tipe_peti_id', + 'warna', + 'fix_lot', + 'packing_no', + 'customer_id', + 'jumlah', + 'date_pembuatan', + 'warehouse_id', + 'kondisipeti_id' + )->withTrashed(); } public function tipe_peti() { - return $this->belongsTo(Type_peti::class, 'type')->select('id', 'type', 'size_peti', 'description'); + return $this->belongsTo(Type_peti::class, 'type')->select('id', 'type', 'size_peti', 'description')->withTrashed(); } public function customer() { - return $this->belongsTo(Customer::class, 'customer_id'); + return $this->belongsTo(Customer::class, 'customer_id')->withTrashed(); } public function kondisi_peti() { - return $this->belongsTo(kondisi_peti::class, 'kondisi_peti_id'); + return $this->belongsTo(kondisi_peti::class, 'kondisi_peti_id')->withTrashed(); } } 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 0deee1e..3431ce6 100644 --- a/database/migrations/2023_10_23_075245_create_users_table.php +++ b/database/migrations/2023_10_23_075245_create_users_table.php @@ -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->foreignId('role_id')->nullable()->constrained('m_roles')->onDelete('set null'); - $table->foreignId('warehouse_id')->nullable()->constrained('m_warehouses')->onDelete('set null'); + $table->foreignId('role_id')->nullable()->constrained('m_roles'); + $table->foreignId('warehouse_id')->nullable()->constrained('m_warehouses'); $table->text('address')->nullable(); $table->timestamp('email_verified_at')->nullable(); $table->string('password', 255)->nullable(); 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 1281ae8..6466944 100644 --- a/database/migrations/2023_11_06_085238_create_petis_table.php +++ b/database/migrations/2023_11_06_085238_create_petis_table.php @@ -13,15 +13,15 @@ return new class extends Migration { Schema::create('petis', function (Blueprint $table) { $table->id(); - $table->foreignId('tipe_peti_id')->nullable()->constrained('type_petis')->onDelete('set null'); + $table->foreignId('tipe_peti_id')->nullable()->constrained('type_petis'); $table->string('warna', 50); $table->string('fix_lot', 100); $table->integer('packing_no'); - $table->foreignId('customer_id')->nullable()->constrained('customers')->onDelete('set null'); + $table->foreignId('customer_id')->nullable()->constrained('customers'); $table->integer('jumlah')->nullable(); $table->date('date_pembuatan', 100)->nullable(); - $table->foreignId('warehouse_id')->nullable()->constrained('m_warehouses')->onDelete('set null'); - $table->foreignId('kondisipeti_id')->nullable()->constrained('kondisi_petis')->onDelete('set null'); + $table->foreignId('warehouse_id')->nullable()->constrained('m_warehouses'); + $table->foreignId('kondisipeti_id')->nullable()->constrained('kondisi_petis'); $table->string('status', 50)->default('AKTIF'); $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 6e72b31..ec0f37a 100644 --- a/database/migrations/2023_11_08_132316_create_transfers_table.php +++ b/database/migrations/2023_11_08_132316_create_transfers_table.php @@ -17,7 +17,7 @@ return new class extends Migration $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->foreignId('destination_warehouse')->nullable()->constrained('m_warehouses'); $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 19f1b86..b34d682 100644 --- a/database/migrations/2023_11_17_075418_create_disposals_table.php +++ b/database/migrations/2023_11_17_075418_create_disposals_table.php @@ -12,11 +12,11 @@ return new class extends Migration public function up(): void { Schema::create('disposals', function (Blueprint $table) { - $table->uuid('id')->primary(); + $table->id(); $table->uuid('mobile_id')->nullable(); $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->foreignId('customer_id')->constrained('customers'); + $table->foreignId('warehouse_id')->constrained('m_warehouses'); $table->date('date_disposal'); $table->text('description')->nullable(); $table->string('status_disposal', 50); diff --git a/database/seeders/PetiSeeder.php b/database/seeders/PetiSeeder.php index cedcd46..d1fc4ee 100644 --- a/database/seeders/PetiSeeder.php +++ b/database/seeders/PetiSeeder.php @@ -15,24 +15,106 @@ class PetiSeeder extends Seeder public function run() { // Generate 5 dummy data - for ($i = 0; $i < 5; $i++) { - DB::table('petis')->insert([ + // for ($i = 0; $i < 5; $i++) { + // DB::table('petis')->insert([ + // 'tipe_peti_id' => $this->getRandomId('type_petis'), + // 'warna' => 'Warna', + // 'fix_lot' => 'Dummy Fix Lot ' . ($i + 1), + // 'packing_no' => rand(1, 100), + // 'customer_id' => $this->getRandomId('customers'), + // 'jumlah' => rand(1, 10), + // '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', + // 'updated_by' => 'Seeder', + // ]); + // } + DB::table('petis')->insert([ + [ 'tipe_peti_id' => $this->getRandomId('type_petis'), - 'warna' => 'Dummy Warna ' . ($i + 1), - 'fix_lot' => 'Dummy Fix Lot ' . ($i + 1), - 'packing_no' => rand(1, 100), + 'warna' => 'Warna', + 'fix_lot' => 'Dummy Fix Lot 1', + 'packing_no' => 1, 'customer_id' => $this->getRandomId('customers'), - 'jumlah' => rand(1, 10), + 'jumlah' => 1, 'date_pembuatan' => now(), - 'warehouse_id' => $this->getRandomId('m_warehouses'), + 'warehouse_id' => 1, 'kondisipeti_id' => $this->getRandomId('kondisi_petis'), 'status' => 'AKTIF', 'created_at' => now(), 'updated_at' => now(), 'created_by' => 'Seeder', 'updated_by' => 'Seeder', - ]); - } + ], + [ + 'tipe_peti_id' => $this->getRandomId('type_petis'), + 'warna' => 'Warna', + 'fix_lot' => 'Dummy Fix Lot 2', + 'packing_no' => 2, + 'customer_id' => $this->getRandomId('customers'), + 'jumlah' => 2, + 'date_pembuatan' => now(), + 'warehouse_id' => 2, + 'kondisipeti_id' => $this->getRandomId('kondisi_petis'), + 'status' => 'AKTIF', + 'created_at' => now(), + 'updated_at' => now(), + 'created_by' => 'Seeder', + 'updated_by' => 'Seeder', + ], + [ + 'tipe_peti_id' => $this->getRandomId('type_petis'), + 'warna' => 'Warna', + 'fix_lot' => 'Dummy Fix Lot 3', + 'packing_no' => 3, + 'customer_id' => $this->getRandomId('customers'), + 'jumlah' => 3, + 'date_pembuatan' => now(), + 'warehouse_id' => 3, + 'kondisipeti_id' => $this->getRandomId('kondisi_petis'), + 'status' => 'AKTIF', + 'created_at' => now(), + 'updated_at' => now(), + 'created_by' => 'Seeder', + 'updated_by' => 'Seeder', + ], + [ + 'tipe_peti_id' => $this->getRandomId('type_petis'), + 'warna' => 'Warna', + 'fix_lot' => 'Dummy Fix Lot 4', + 'packing_no' => 4, + 'customer_id' => $this->getRandomId('customers'), + 'jumlah' => 4, + 'date_pembuatan' => now(), + 'warehouse_id' => 4, + 'kondisipeti_id' => $this->getRandomId('kondisi_petis'), + 'status' => 'AKTIF', + 'created_at' => now(), + 'updated_at' => now(), + 'created_by' => 'Seeder', + 'updated_by' => 'Seeder', + ], + [ + 'tipe_peti_id' => $this->getRandomId('type_petis'), + 'warna' => 'Warna', + 'fix_lot' => 'Dummy Fix Lot 5', + 'packing_no' => 5, + 'customer_id' => $this->getRandomId('customers'), + 'jumlah' => 5, + 'date_pembuatan' => now(), + 'warehouse_id' => 1, + 'kondisipeti_id' => $this->getRandomId('kondisi_petis'), + 'status' => 'AKTIF', + 'created_at' => now(), + 'updated_at' => now(), + 'created_by' => 'Seeder', + 'updated_by' => 'Seeder', + ], + ]); } /** diff --git a/resources/views/dashboard/Disposal/index.blade.php b/resources/views/dashboard/Disposal/index.blade.php index 6dc3865..8cc5f6e 100644 --- a/resources/views/dashboard/Disposal/index.blade.php +++ b/resources/views/dashboard/Disposal/index.blade.php @@ -46,8 +46,8 @@ @forelse ($disposal as $data_disposal) {{ $nodisposal++ }} - {{ $data_disposal->peti->fix_lot }} - {{ $data_disposal->customer->name }} + {{ optional($data_disposal->peti)->fix_lot }} + {{ optional($data_disposal->customer)->name }} {{ \Carbon\Carbon::parse($data_disposal->date_disposal)->format('d/m/Y') }} {{ $data_disposal->description }} {{ $data_disposal->status_disposal }} @@ -68,7 +68,6 @@ @empty -

Data Kosong

@endforelse diff --git a/resources/views/dashboard/History/Peminjaman/index.blade.php b/resources/views/dashboard/History/Peminjaman/index.blade.php index 5e3a36f..fbd96fe 100644 --- a/resources/views/dashboard/History/Peminjaman/index.blade.php +++ b/resources/views/dashboard/History/Peminjaman/index.blade.php @@ -47,7 +47,6 @@ {{ $data_peminjaman->warehouse->name }} @empty -

Data Kosong

@endforelse diff --git a/resources/views/dashboard/History/Pengembalian/index.blade.php b/resources/views/dashboard/History/Pengembalian/index.blade.php index da66913..7dac629 100644 --- a/resources/views/dashboard/History/Pengembalian/index.blade.php +++ b/resources/views/dashboard/History/Pengembalian/index.blade.php @@ -94,7 +94,6 @@ @endif @empty -

Data Kosong

@endforelse diff --git a/resources/views/dashboard/Master_Data/Customer/index.blade.php b/resources/views/dashboard/Master_Data/Customer/index.blade.php index 7130eeb..c5da031 100644 --- a/resources/views/dashboard/Master_Data/Customer/index.blade.php +++ b/resources/views/dashboard/Master_Data/Customer/index.blade.php @@ -63,7 +63,6 @@ @empty -

Data Kosong

@endforelse diff --git a/resources/views/dashboard/Master_Data/Manajemen_Peti/Kondisi_Peti/index.blade.php b/resources/views/dashboard/Master_Data/Manajemen_Peti/Kondisi_Peti/index.blade.php index 1d59825..c9a2d7c 100644 --- a/resources/views/dashboard/Master_Data/Manajemen_Peti/Kondisi_Peti/index.blade.php +++ b/resources/views/dashboard/Master_Data/Manajemen_Peti/Kondisi_Peti/index.blade.php @@ -31,7 +31,7 @@ @php $nokondisi = 1; @endphp - @forelse ($kondisiPeti as $data_kondisiPeti) + @foreach ($kondisiPeti as $data_kondisiPeti) {{ $nokondisi++ }} {{ $data_kondisiPeti->nama_kondisi }} @@ -53,9 +53,7 @@ - @empty -

Data Kosong

- @endforelse + @endforeach diff --git a/resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php b/resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php index e9979cc..fa5c123 100644 --- a/resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php +++ b/resources/views/dashboard/Master_Data/Manajemen_Peti/Peti/index.blade.php @@ -92,7 +92,6 @@ @empty -

Data Kosong

@endforelse diff --git a/resources/views/dashboard/Master_Data/Manajemen_Peti/Type_peti/index.blade.php b/resources/views/dashboard/Master_Data/Manajemen_Peti/Type_peti/index.blade.php index 4c0d18c..3ab7578 100644 --- a/resources/views/dashboard/Master_Data/Manajemen_Peti/Type_peti/index.blade.php +++ b/resources/views/dashboard/Master_Data/Manajemen_Peti/Type_peti/index.blade.php @@ -57,7 +57,6 @@ @empty -

Data Kosong

@endforelse diff --git a/resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/detail_peti.blade.php b/resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/detail_peti.blade.php index 042750d..26a3c3e 100644 --- a/resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/detail_peti.blade.php +++ b/resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/detail_peti.blade.php @@ -86,7 +86,6 @@ @empty -

Data Kosong

@endforelse diff --git a/resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/index.blade.php b/resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/index.blade.php index 2c6bc01..14bc874 100644 --- a/resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/index.blade.php +++ b/resources/views/dashboard/Master_Data/Report/Pattern_lot_peti/index.blade.php @@ -64,7 +64,6 @@ {{ $data_peti->status }} @empty -

Data Kosong

@endforelse diff --git a/resources/views/dashboard/Master_Data/Report/Stok_opname/index.blade.php b/resources/views/dashboard/Master_Data/Report/Stok_opname/index.blade.php index e57f546..f2118f0 100644 --- a/resources/views/dashboard/Master_Data/Report/Stok_opname/index.blade.php +++ b/resources/views/dashboard/Master_Data/Report/Stok_opname/index.blade.php @@ -165,7 +165,6 @@ @empty -

Data Kosong

@endforelse diff --git a/resources/views/dashboard/Master_Data/User/index.blade.php b/resources/views/dashboard/Master_Data/User/index.blade.php index 1710cb6..c67c5ed 100644 --- a/resources/views/dashboard/Master_Data/User/index.blade.php +++ b/resources/views/dashboard/Master_Data/User/index.blade.php @@ -72,7 +72,6 @@ @empty -

Data Kosong

@endforelse diff --git a/resources/views/dashboard/Peminjaman/index.blade.php b/resources/views/dashboard/Peminjaman/index.blade.php index 7aefac5..ded370f 100644 --- a/resources/views/dashboard/Peminjaman/index.blade.php +++ b/resources/views/dashboard/Peminjaman/index.blade.php @@ -77,7 +77,6 @@ @endif @empty -

Data Kosong

@endforelse diff --git a/resources/views/dashboard/Pengembalian/index.blade.php b/resources/views/dashboard/Pengembalian/index.blade.php index 7377074..8d40ee3 100644 --- a/resources/views/dashboard/Pengembalian/index.blade.php +++ b/resources/views/dashboard/Pengembalian/index.blade.php @@ -101,7 +101,6 @@ @endif @empty -

Data Kosong

@endforelse diff --git a/resources/views/dashboard/Transaksi/index.blade.php b/resources/views/dashboard/Transaksi/index.blade.php index a1766f7..0552bd7 100644 --- a/resources/views/dashboard/Transaksi/index.blade.php +++ b/resources/views/dashboard/Transaksi/index.blade.php @@ -90,7 +90,6 @@ @empty -

Data Kosong

@endforelse diff --git a/resources/views/dashboard/Transfer/index.blade.php b/resources/views/dashboard/Transfer/index.blade.php index 2c88505..863d3c1 100644 --- a/resources/views/dashboard/Transfer/index.blade.php +++ b/resources/views/dashboard/Transfer/index.blade.php @@ -44,7 +44,8 @@ @foreach ($transfer as $data_transfer) {{ $notransfer++ }} - {{ $data_transfer->peti->fix_lot }} + {{-- {{ $data_transfer->peti->fix_lot }} --}} + {{ optional($data_transfer->peti)->fix_lot }} {{ $data_transfer->customer->name ?? '' }} {{ \Carbon\Carbon::parse($data_transfer->date)->format('d/m/Y') }} {{ $data_transfer->sourceWarehouse->name ?? '' }} diff --git a/resources/views/dashboard/index.blade.php b/resources/views/dashboard/index.blade.php index 60f6391..48252ab 100644 --- a/resources/views/dashboard/index.blade.php +++ b/resources/views/dashboard/index.blade.php @@ -3,7 +3,7 @@ @if (auth()->user()->role_id == 1)

Dashboard

- Generate Report
@@ -292,6 +292,25 @@ } }); + + + @endpush @elseif(auth()->user()->role_id == 2) @include('pages.user.dashboard.index') diff --git a/resources/views/layouts/navbar.blade.php b/resources/views/layouts/navbar.blade.php index 606a582..029bbe5 100644 --- a/resources/views/layouts/navbar.blade.php +++ b/resources/views/layouts/navbar.blade.php @@ -46,15 +46,15 @@
- {{ \Carbon\Carbon::parse($data_notification->exit_at)->format('F j, Y') }}
+ {{ \Carbon\Carbon::parse($data_notification->est_pengembalian)->format('F j, Y') }} +
Peti dengan kode - {{ $data_notification->peti->fix_lot }} berhasil di pinjam + {{ $data_notification->peti->fix_lot }} Sudah waktunya pengembalian @endforeach Show All - Alerts + href="{{ route('dashboard.navbarList.notification') }}">Show All Notifikasi diff --git a/resources/views/layouts/navbar_list.blade.php b/resources/views/layouts/navbar_list.blade.php index b383456..a54b3eb 100644 --- a/resources/views/layouts/navbar_list.blade.php +++ b/resources/views/layouts/navbar_list.blade.php @@ -1,4 +1,21 @@ @extends('layouts.main') @section('content') -

Halaman Notification

+
+ @foreach ($notifikasi as $data_notifikasi) +
+
+ +
+ Kode Peti dengan dengan kode "{{ $data_notifikasi->peti->fix_lot }}" sudah waktunya dikembalikan + pada tanggal {{ \Carbon\Carbon::parse($data_notifikasi->est_pengembalian)->format('F j, Y') }} +
+
+
+ @endforeach +
@endsection diff --git a/resources/views/pages/user/Master_Data/Manajemen_Peti/Peti/index.blade.php b/resources/views/pages/user/Master_Data/Manajemen_Peti/Peti/index.blade.php index 56d33dd..968280b 100644 --- a/resources/views/pages/user/Master_Data/Manajemen_Peti/Peti/index.blade.php +++ b/resources/views/pages/user/Master_Data/Manajemen_Peti/Peti/index.blade.php @@ -12,7 +12,6 @@ No - Fix Lot User Customer @@ -33,7 +32,6 @@ @forelse ($peti as $data_peti) {{ $nopeti++ }} - {{ $data_peti->fix_lot }} {{ $data_peti->created_by }} {{ $data_peti->customer->name }} diff --git a/resources/views/pages/user/dashboard/index.blade.php b/resources/views/pages/user/dashboard/index.blade.php index dfb11aa..4aaf3ca 100644 --- a/resources/views/pages/user/dashboard/index.blade.php +++ b/resources/views/pages/user/dashboard/index.blade.php @@ -1,7 +1,7 @@

Dashboard

- Generate Report + {{-- Generate Report --}}
diff --git a/routes/web.php b/routes/web.php index dc0bce3..d79c075 100644 --- a/routes/web.php +++ b/routes/web.php @@ -205,9 +205,8 @@ Route::prefix('dashboard')->name('dashboard.')->middleware(['auth'])->group(func //halaman Report Stok Route::controller(StokOpNameController::class)->group(function () { - Route::get('StokOpname', 'index')->name('StokOpname.index'); - // Route::get('StokOpname/{id}', 'show')->name('StokOpname.show'); Route::get('StokOpname/export', 'export')->name('StokOpname.export'); + Route::get('StokOpname', 'index')->name('StokOpname.index'); }); });