mirror of
https://github.com/rekywhyd/WebGIS_PengentasanKemiskinan.git
synced 2026-07-07 01:43:07 +00:00
Akses akun admin
This commit is contained in:
@@ -18,6 +18,10 @@ class KuponController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
if (Auth::user()->role !== 'user') {
|
||||
abort(403, 'Cetak kupon hanya tersedia untuk akun role user.');
|
||||
}
|
||||
|
||||
$query = PenerimaBantuan::with('tempat_ibadah')->where('status_persetujuan', 'disetujui');
|
||||
|
||||
// Jika admin, bisa melihat semua dan filter. Jika user, hanya melihat yang sesuai tempat ibadahnya.
|
||||
@@ -42,6 +46,10 @@ class KuponController extends Controller
|
||||
}
|
||||
public function show($id)
|
||||
{
|
||||
if (Auth::user()->role !== 'user') {
|
||||
abort(403, 'Cetak kupon hanya tersedia untuk akun role user.');
|
||||
}
|
||||
|
||||
$warga = PenerimaBantuan::findOrFail($id);
|
||||
|
||||
// Tentukan periode kupon
|
||||
@@ -95,6 +103,10 @@ class KuponController extends Controller
|
||||
|
||||
public function cetak(Request $request)
|
||||
{
|
||||
if (Auth::user()->role !== 'user') {
|
||||
abort(403, 'Cetak kupon hanya tersedia untuk akun role user.');
|
||||
}
|
||||
|
||||
$ids = $request->input('penerima_ids');
|
||||
|
||||
if (empty($ids) || !is_array($ids)) {
|
||||
|
||||
@@ -41,10 +41,12 @@
|
||||
</div>
|
||||
</form>
|
||||
@endif
|
||||
@if(Auth::user()->role === 'user')
|
||||
<button type="button" onclick="opencetakModal()" class="px-5 py-2.5 bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-500 hover:to-indigo-500 text-white rounded-xl font-medium shadow-lg shadow-blue-500/30 hover:-translate-y-0.5 transition-all flex items-center text-sm whitespace-nowrap">
|
||||
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v1m6 11h2m-6 0h-2v4m0-11v3m0 0h.01M12 12h4.01M16 20h4M4 12h4m12 0h.01M5 8h2a1 1 0 001-1V5a1 1 0 00-1-1H5a1 1 0 00-1 1v2a1 1 0 001 1zm12 0h2a1 1 0 001-1V5a1 1 0 00-1-1h-2a1 1 0 00-1 1v2a1 1 0 001 1zM5 20h2a1 1 0 001-1v-2a1 1 0 00-1-1H5a1 1 0 00-1 1v2a1 1 0 001 1z"></path></svg>
|
||||
Cetak Kupon
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user