fix
This commit is contained in:
parent
740623cf36
commit
6bbbe40c86
|
@ -5,6 +5,7 @@
|
|||
use App\Models\Admin;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use App\Models\Setting;
|
||||
|
||||
class AdminController extends Controller
|
||||
{
|
||||
|
@ -112,4 +113,22 @@ public function destroy($id)
|
|||
|
||||
return redirect()->route('admin')->with('success', 'Admin berhasil dihapus');
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
{
|
||||
$nomor_rekening = Setting::where('key', 'nomor_rekening')->first()->value ?? '';
|
||||
return view('admin.dashboard', compact('nomor_rekening'));
|
||||
}
|
||||
|
||||
public function saveRekening(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'nomor_rekening' => 'required|string|max:100',
|
||||
]);
|
||||
Setting::updateOrCreate(
|
||||
['key' => 'nomor_rekening'],
|
||||
['value' => $request->nomor_rekening]
|
||||
);
|
||||
return redirect()->route('admin.dashboard')->with('success_rekening', 'Nomor rekening berhasil disimpan!');
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Sewa;
|
||||
use App\Models\Setting;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
@ -68,4 +69,28 @@ public function hapus($id)
|
|||
return redirect()->route('riwayat')
|
||||
->with('success', 'Riwayat pesanan berhasil dihapus.');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$sewa = Sewa::with(['paket', 'kota'])->findOrFail($id);
|
||||
|
||||
// Pastikan hanya user yang berhak yang bisa akses
|
||||
if ($sewa->user_id != Auth::id()) {
|
||||
return response()->json(['error' => 'Unauthorized'], 403);
|
||||
}
|
||||
|
||||
$nomor_rekening = Setting::where('key', 'nomor_rekening')->first()->value ?? null;
|
||||
|
||||
return response()->json([
|
||||
'tanggal_pembayaran' => $sewa->tanggal_pembayaran,
|
||||
'status_pembayaran' => $sewa->status,
|
||||
'lokasi' => $sewa->lokasi,
|
||||
'kota' => $sewa->kota,
|
||||
'ongkir' => $sewa->ongkir,
|
||||
'bukti_pembayaran' => $sewa->bukti_pembayaran,
|
||||
'foto_jaminan' => $sewa->foto_jaminan,
|
||||
'jenis_jaminan' => $sewa->jenis_jaminan,
|
||||
'nomor_rekening' => $nomor_rekening,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Setting extends Model
|
||||
{
|
||||
protected $fillable = ['key', 'value'];
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key')->unique();
|
||||
$table->text('value')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('settings');
|
||||
}
|
||||
};
|
|
@ -100,3 +100,21 @@
|
|||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if(session('success_rekening'))
|
||||
<div class="bg-green-100 border-l-4 border-green-500 text-green-700 p-4 mb-4 rounded">
|
||||
{{ session('success_rekening') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="bg-white rounded-lg shadow-md p-6 mb-6 max-w-lg">
|
||||
<h2 class="text-lg font-semibold mb-4">Pengaturan Nomor Rekening</h2>
|
||||
<form action="{{ route('admin.save-rekening') }}" method="POST">
|
||||
@csrf
|
||||
<div class="mb-4">
|
||||
<label for="nomor_rekening" class="block text-gray-700 font-medium mb-2">Nomor Rekening</label>
|
||||
<input type="text" id="nomor_rekening" name="nomor_rekening" value="{{ old('nomor_rekening', $nomor_rekening ?? '') }}" class="w-full border border-gray-300 rounded-md px-3 py-2">
|
||||
</div>
|
||||
<button type="submit" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded">Simpan</button>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -177,6 +177,16 @@ class="w-full bg-gray-500 text-white px-3 py-1 rounded hover:bg-gray-600">
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Nomor Rekening -->
|
||||
${data.nomor_rekening ? `
|
||||
<div class="space-y-2 md:col-span-2">
|
||||
<h4 class="font-semibold">Nomor Rekening Pembayaran</h4>
|
||||
<div class="bg-gray-50 p-4 rounded-lg">
|
||||
<p class="text-sm">${data.nomor_rekening}</p>
|
||||
</div>
|
||||
</div>
|
||||
` : ''}
|
||||
|
||||
<!-- Bukti Pembayaran -->
|
||||
${data.bukti_pembayaran ? `
|
||||
<div class="space-y-2">
|
||||
|
|
|
@ -116,7 +116,13 @@
|
|||
<h3 class="text-lg font-bold text-gray-800 mb-4">Upload Bukti Pembayaran</h3>
|
||||
<div class="bg-blue-50 border-l-4 border-blue-500 text-blue-700 p-4 mb-4">
|
||||
<p class="font-medium">Informasi Pembayaran:</p>
|
||||
<p>Silakan masukkan nominal pembayaran sesuai keinginan Anda.</p>
|
||||
<p>tolong masukkan nominal pembayaran sebesar
|
||||
DP50% dari total harga yang sudah diberikan
|
||||
segera lakukan pembayaran ke rekening dibawah ini
|
||||
agar proses penyewaan ditangani lebih cepat
|
||||
jika ada masalah mohon hubungi admin di bagian hubungi kami
|
||||
</p>
|
||||
<b>BRI:002101269991507</b>
|
||||
</div>
|
||||
<form action="{{ route('sewa.upload-bukti', $sewa->id) }}" method="POST" enctype="multipart/form-data" class="space-y-4">
|
||||
@csrf
|
||||
|
|
|
@ -178,7 +178,8 @@
|
|||
|
||||
// Admin Routes
|
||||
Route::middleware(['auth', 'role:admin'])->prefix('admin')->group(function () {
|
||||
Route::get('/dashboard', [App\Http\Controllers\Admin\DashboardController::class, 'index'])->name('admin.dashboard');
|
||||
Route::get('/dashboard', [AdminController::class, 'dashboard'])->name('admin.dashboard');
|
||||
Route::post('/save-rekening', [AdminController::class, 'saveRekening'])->name('admin.save-rekening');
|
||||
// ... other admin routes ...
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue