diff --git a/account/views.py b/account/views.py
index 77110cb8a9622e38a03c127d44e68c79fc3e50eb..66416a2c21dca199866bd8955e398ba7f50f38b7 100644
--- a/account/views.py
+++ b/account/views.py
@@ -23,7 +23,6 @@ def show_main(request):
                 f'select day, starthours, endhours from restaurant r, restaurant_operating_hours roh where name = rname and branch = rbranch and email = \'{email}\''
             )
             records_hours = cursor.fetchall()
-            print(records)
             context = {
                 'email': records[0][0],
                 'password': records[0][1],
@@ -53,7 +52,6 @@ def show_main(request):
             response.set_cookie('rname', records[0][5])
             response.set_cookie('rbranch', records[0][6])
             response.set_cookie('adminid', records[0][20])
-            print('masuk resto')
             return response
 
         # Role Admin -> Dashboard Admin
@@ -90,7 +88,6 @@ def show_main(request):
                 elif (records_actor[i][0],) in list_restaurant:
                     records_actor[i] += ('Restoran', )
 
-            print(records_admin)
 
             context = {
                 'role': 'admin',
@@ -105,7 +102,6 @@ def show_main(request):
             response = render(request, 'dashboard_admin.html', context)
             response.set_cookie('role', 'admin')
             response.set_cookie('email', records_admin[0][0])
-            print('masuk admin')
             return response
 
         # Role Customer -> Dashboard Customer
@@ -132,7 +128,6 @@ def show_main(request):
             response.set_cookie('role', 'customer')
             response.set_cookie('email', records[0][0])
             response.set_cookie('adminid', records[0][13])
-            print('masuk pelanggan')
             return response
 
         # Role Courier -> Dashboard Courier
@@ -161,7 +156,6 @@ def show_main(request):
             response.set_cookie('role', 'courier')
             response.set_cookie('email', records[0][0])
             response.set_cookie('adminid', records[0][15])
-            print('masuk kurir')
             return response
 
     # Jika tidak ada cookie role, redirect ke halaman login
@@ -229,7 +223,6 @@ def login(request):
                 response = render(request, 'dashboard_admin.html', context)
                 response.set_cookie('role', 'admin')
                 response.set_cookie('email', records_admin[0][0])
-                print('masuk admin')
                 return response
 
             cursor.execute(
@@ -272,7 +265,6 @@ def login(request):
                 response.set_cookie('rname', records[0][5])
                 response.set_cookie('rbranch', records[0][6])
                 response.set_cookie('adminid', records[0][20])
-                print('masuk resto')
                 return response
 
             cursor.execute(
@@ -296,19 +288,16 @@ def login(request):
                     'adminid': records[0][15],
                     'role': 'courier'
                 }
-                # print(context)
                 response = render(request, 'dashboard_pengguna.html', context)
                 response.set_cookie('role', 'courier')
                 response.set_cookie('email', records[0][0])
                 response.set_cookie('adminid', records[0][15])
-                print('masuk kurir')
                 return response
 
             cursor.execute(
                 f'select * from user_acc u, customer c, transaction_actor ta where u.email = c.email and u.email = \'{email}\' and c.email = ta.email')
             records = cursor.fetchmany()
             if (len(records) == 1):
-                # print(records)
                 context = {
                     'email': records[0][0],
                     'password': records[0][1],
@@ -324,12 +313,10 @@ def login(request):
                     'adminid': records[0][13],
                     'role': 'customer'
                 }
-                # print(context)
                 response = render(request, 'dashboard_pengguna.html', context)
                 response.set_cookie('role', 'customer')
                 response.set_cookie('email', records[0][0])
                 response.set_cookie('adminid', records[0][13])
-                print('masuk pelanggan')
                 return response
 
         else:
@@ -758,7 +745,6 @@ def profile_restoran(request, email):
         'jadwal': records_hours,
         'promo': records_promo,
     }
- 
     return render(request, 'profile_restoran.html', context)
 
 
diff --git a/templates/navbar.html b/templates/navbar.html
index 6a75f86e8b9f59d210a23ea05546baab66c0fdb6..273c8c6d18f3f68964727d2b1d90489cf0dffc35 100644
--- a/templates/navbar.html
+++ b/templates/navbar.html
@@ -13,36 +13,26 @@
   ></script>
 </head>
 
-<nav
-  class="sticky z-50 top-0 md:px-20 px-4 py-2 bg-[#DD5353] shadow-2xl md:flex md:items-center md:justify-between mb-3"
-  id="navbar"
->
-  <div class="flex gap-2 md:w-full justify-between">
-    <a href="{% url 'account:show_main' %}">
-      <div
-        class="text-2xl font-bold text-[#fff] flex items-center cursor-pointer hover:text-cream-tua"
-      >
-        {% if adminid is not none %} 
-        SIREST {{role}} {{rname}} {{rbranch}} 
-        {% else %} 
-        SIREST {{role}} {{rname}} {{rbranch}}
-        <h3 class="text-xs">Not Verified</h3>
-        {% endif %}
-      </div>
-    </a>
-    <div class="text-3xl cursor-pointer flex items-center md:hidden">
-      <ion-icon name="menu" onclick="menu(this)" class="fill-white"></ion-icon>
-    </div>
-  </div>
-  <div
-    id="list-navbar"
-    class="text-base text-white hidden md:show md:flex md:flex-row md:items-center md:justify-end"
-  >
-    <div class="md:mx-5 my-3 md:my-0">
-      <a href="" class="hover:text-[#DBC8AC] hover:text-lg duration-500"
-        >Dashboard</a
-      >
+<nav class="sticky z-50 top-0 md:px-20 px-4 py-2 bg-[#DD5353] shadow-2xl md:flex md:items-center md:justify-between mb-3" id="navbar">
+    <div class="flex gap-2 md:w-full justify-between">
+        <a href="{% url 'account:show_main' %}">
+            <div class="text-2xl font-bold text-[#fff] flex items-center cursor-pointer hover:text-cream-tua">
+                {% comment %}  if adminid is not none {% endcomment %}
+                {% if adminid is not none or role == 'admin' %}
+                    SIREST {{role}}
+                {% else %}
+                    SIREST {{role}}  <h3 class="text-xs"> Not Verified</h3>
+                {% endif %}
+            </div>
+        </a>
+        <div class="text-3xl cursor-pointer flex items-center md:hidden">
+            <ion-icon name="menu" onclick="menu(this)" class="fill-white"></ion-icon>
+        </div>
     </div>
+    <div id="list-navbar" class="text-base text-white hidden md:show md:flex md:flex-row md:items-center md:justify-end">
+        <div class="md:mx-5 my-3 md:my-0">
+            <a href="{% url 'account:show_main' %}" class="hover:text-[#DBC8AC] hover:text-lg duration-500">Dashboard</a>
+        </div>
 
         <!-- {admin start} -->
         {% if role == 'admin' %}
@@ -320,7 +310,7 @@
             <div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="absolute right-0 w-full mt-2 origin-top-right rounded-md shadow-lg md:w-48">
                 <div class="px-2 py-2 bg-white text-gray-900 rounded-md shadow ">
                     <a class="block px-4 py-2 mt-2 rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger_6:show_daftar_promo' %}">Daftar Promo Tersedia</a>
-                    <a class="block px-4 py-2 mt-2  rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="#">Daftar Promo Restoran</a>
+                    <a class="block px-4 py-2 mt-2  rounded-lg hover:bg-gray-200 focus:bg-gray-200 focus:outline-none focus:shadow-outline" href="{% url 'trigger_6:show_daftar_promo_restoran' rname rbranch %}">Daftar Promo Restoran</a>
                 </div>
             </div>
         </div> 
diff --git a/trigger_6/templates/daftar_promo.html b/trigger_6/templates/daftar_promo.html
index a13feb5c941867e918a09465daae46f1e4b7762a..c60d025af43450cdc603228a2bc1dba8643a459f 100644
--- a/trigger_6/templates/daftar_promo.html
+++ b/trigger_6/templates/daftar_promo.html
@@ -1,5 +1,5 @@
 {% extends 'base.html' %} {% block meta %}
-<title>Riwayat</title>
+<title>Detail Promo</title>
 {% endblock meta %} {% block content %}
 <div class="m-20">
     {% if role == 'admin' %}
diff --git a/trigger_6/templates/detail_promosi_restoran.html b/trigger_6/templates/detail_promosi_restoran.html
index 47d91aa87b97296add8275851d08f866325dd3d5..23be314e467f2914869cc11a0ad9f0df4d49fe02 100644
--- a/trigger_6/templates/detail_promosi_restoran.html
+++ b/trigger_6/templates/detail_promosi_restoran.html
@@ -1,5 +1,5 @@
 {% extends 'base.html' %} {% block meta %}
-<title>Detail Promo</title>
+<title>Detail Promo Restoran</title>
 {% endblock meta %} {% block content %}
 <div class="border-black m-20">
     <div class="flex justify-center items-center p-2 bg-red-300 rounded-t-lg mb-3">
diff --git a/trigger_6/templates/form_promo_hari_spesial.html b/trigger_6/templates/form_promo_hari_spesial.html
index b1e576cb30936f2862554959e4b030cbc9be5e9a..a3ee8eeef071b03121d2d6ce28f29e7b4a95d045 100644
--- a/trigger_6/templates/form_promo_hari_spesial.html
+++ b/trigger_6/templates/form_promo_hari_spesial.html
@@ -15,15 +15,15 @@
                         <div class="flex flex-col justify-around gap-2 w-full">
                             <div class="flex flex-col text-sm font-medium justify-around">
                                 <p>Nama Promo:</p>
-                                <input type="text" name="name" id="name" class="form-control rounded-lg text-black">
+                                <input type="text" name="name" id="name" class="form-control rounded-lg text-black" required oninvalid="this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')" oninput="setCustomValidity('')">
                             </div>
                             <div class="flex flex-col text-sm font-medium mb-2 justify-around">
                                 <p>Diskon:</p>
-                                <input type="text" name="discount" id="discount" class="form-control rounded-lg text-black">
+                                <input type="text" name="discount" id="discount" class="form-control rounded-lg text-black" required oninvalid="this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')" oninput="setCustomValidity('')">
                             </div>
                             <div class="flex flex-col text-sm font-medium mb-2 justify-around">
                                 <p>Tanggal Berlangsung:</p>
-                                <input type="date" name="date" id="date" class="form-control rounded-lg text-black">
+                                <input type="date" name="date" id="date" class="form-control rounded-lg text-black" required oninvalid="this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')" oninput="setCustomValidity('')">
                             </div>
                             <div class="flex justify-center">
                                 <input type="submit" name="submit" value="SIMPAN" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"/> 
diff --git a/trigger_6/templates/form_promo_minimum.html b/trigger_6/templates/form_promo_minimum.html
index a3f598592e5358521bdf351ccf87a04e96401a32..4c90b167924bd252d2ce67fb15f956c15b51e945 100644
--- a/trigger_6/templates/form_promo_minimum.html
+++ b/trigger_6/templates/form_promo_minimum.html
@@ -15,15 +15,15 @@
                         <div class="flex flex-col justify-around gap-2 w-full">
                             <div class="flex flex-col text-sm font-medium justify-around">
                                 <p>Nama Promo:</p>
-                                <input type="text" name="name" id="name" class="form-control rounded-lg text-black">
+                                <input type="text" name="name" id="name" class="form-control rounded-lg text-black" required oninvalid="this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')" oninput="setCustomValidity('')">
                             </div>
                             <div class="flex flex-col text-sm font-medium mb-2 justify-around">
                                 <p>Diskon:</p>
-                                <input type="text" name="discount" id="discount" class="form-control rounded-lg text-black">
+                                <input type="text" name="discount" id="discount" class="form-control rounded-lg text-black" required oninvalid="this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')" oninput="setCustomValidity('')">
                             </div>
                             <div class="flex flex-col text-sm font-medium mb-2 justify-around">
                                 <p>Minimum Transaksi:</p>
-                                <input type="text" name="mintransaction" id="mintransaction" class="form-control rounded-lg text-black">
+                                <input type="text" name="mintransaction" id="mintransaction" class="form-control rounded-lg text-black" required oninvalid="this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')" oninput="setCustomValidity('')">
                             </div>
                             <div class="flex justify-center">
                                 <input type="submit" name="submit" value="SIMPAN" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"/> 
diff --git a/trigger_6/templates/form_promo_restoran.html b/trigger_6/templates/form_promo_restoran.html
index c3477b5197db9270aaa9e9dc3ec8c274000edc5b..56792180ccc5b4789ce9f81d509a22624dc94549 100644
--- a/trigger_6/templates/form_promo_restoran.html
+++ b/trigger_6/templates/form_promo_restoran.html
@@ -69,12 +69,12 @@
                         <div class="flex flex-col justify-around gap-2 w-full">
                             <div class="flex flex-col text-sm font-medium justify-around">
                                 <label for="name">Nama Promo:</label>
-                                <select name="name" id="name"
+                                <select name="name" id="name" required oninput="setCustomValidity('')" oninvalid="this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')"
                                     onchange="handleClick(this.value); this.selectedindex = -1"
                                     class="border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 mt-2">
-                                    <option style="display: none"></option>
+                                    <option style="display: none"></option required>
                                     {% for promoname in record_promoname %}
-                                    <option value="{{ promoname.1 }}">{{ promoname.0 }}</option>
+                                    <option value="{{ promoname.1 }}">{{ promoname.0 }}</option required>
                                     {% endfor %}
                                 </select>
                             </div>
diff --git a/trigger_6/templates/form_ubah_promo_restoran.html b/trigger_6/templates/form_ubah_promo_restoran.html
index e353fab53532ef375c4b5e2ed7ac52e00b257e85..d3de107c7e6f1eae53fc2a9afa5bc1c127d8dc6b 100644
--- a/trigger_6/templates/form_ubah_promo_restoran.html
+++ b/trigger_6/templates/form_ubah_promo_restoran.html
@@ -27,11 +27,11 @@
                             </div>
                             <div class="flex flex-col text-sm font-medium mb-2 justify-around">
                                 <p>Tanggal Mulai:</p>
-                                <input type="date" name="startdate" id="startdate" class="form-control rounded-lg text-black">
+                                <input type="date" name="startdate" id="startdate" class="form-control rounded-lg text-black" required oninvalid="this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')" oninput="setCustomValidity('')">
                             </div>
                             <div class="flex flex-col text-sm font-medium mb-2 justify-around">
                                 <p>Tanggal Berakhir:</p>
-                                <input type="date" name="enddate" id="enddate" class="form-control rounded-lg text-black">
+                                <input type="date" name="enddate" id="enddate" class="form-control rounded-lg text-black" required oninvalid="this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')" oninput="setCustomValidity('')">
                             </div>
                             <div class="flex justify-center">
                                 <input type="submit" name="submit" value="SIMPAN" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"/> 
diff --git a/trigger_6/templates/form_ubah_promosi.html b/trigger_6/templates/form_ubah_promosi.html
index f21d9b99f9377eac1dd48410f33084cab6017e9f..0eb40d7455acdf85fec01fe22c35414e94b0bbe0 100644
--- a/trigger_6/templates/form_ubah_promosi.html
+++ b/trigger_6/templates/form_ubah_promosi.html
@@ -15,24 +15,24 @@
                         <div class="flex flex-col justify-around gap-2">
                             <div class="flex flex-col text-sm font-medium justify-around">
                                 <p>Jenis Promosi:</p>
-                                <input type="text" name="name" id="name" class="form-control rounded-lg text-black" disabled placeholder='{{jenis_promo}}'>
+                                <input type="text" name="name" id="name" class="form-control rounded-lg text-black" disabled placeholder='{{jenis_promo}}' required>
                             </div>
                             <div class="flex flex-col text-sm font-medium justify-around">
                                 <p>Nama Promosi:</p>
-                                <input type="text" name="name" id="name" class="form-control rounded-lg text-black" disabled placeholder='{{nama_promo}}''>
+                                <input type="text" name="name" id="name" class="form-control rounded-lg text-black" disabled placeholder='{{nama_promo}}' required>
                             </div>
                             <div class="flex flex-col text-sm font-medium mb-2 justify-around">
                                 <p>Diskon (%):</p>
-                                <input type="text" name="discount" id="discount" class="form-control rounded-lg text-black">
+                                <input type="text" name="discount" id="discount" class="form-control rounded-lg text-black" required oninvalid="this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')" oninput="setCustomValidity('')">
                             </div>
                             {% if jenis_promo == 'Promo Minimum Transaksi' %}
                             <div class="flex flex-col text-sm font-medium mb-2 justify-around">
                                 <p>Minimum Transaksi:</p>
-                                <input type="text" name="mintransaction" id="mintransaction" class="form-control rounded-lg text-black">
+                                <input type="text" name="mintransaction" id="mintransaction" class="form-control rounded-lg text-black" required oninvalid="this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')" oninput="setCustomValidity('')">
                             </div>
                             {% endif %}
                             <div class="flex justify-center">
-                                <input type="submit" name="submit" value="SIMPAN" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"/> 
+                                <input type="submit" name="submit" value="SIMPAN" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800" required oninvalid="this.setCustomValidity('Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu')" oninput="setCustomValidity('')"/> 
                             </div>
                         </div>
                     </div>
diff --git a/trigger_6/views.py b/trigger_6/views.py
index 77a49b3e9dc26452f3a40b6ace6d818d517a9594..70bc5a9827a106159479fd5b5ff409e5b7aec7ac 100644
--- a/trigger_6/views.py
+++ b/trigger_6/views.py
@@ -12,6 +12,13 @@ def show_riwayat(request):
     role = request.COOKIES.get('role')
     email = request.COOKIES.get('email')
 
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
+    cursor.execute('set search_path to sirest')
+
     if role == 'restaurant':
         rname = request.COOKIES.get('rname')
         rbranch = request.COOKIES.get('rbranch')
@@ -43,12 +50,20 @@ def show_riwayat(request):
         'rname': request.COOKIES.get('rname'),
         'rbranch': request.COOKIES.get('rbranch'),
         'record': record,
+        'adminid':request.COOKIES.get('adminid')
     }
-    print(record)
+
     return render(request, 'riwayat.html', context)
 
 
 def show_detail_riwayat(request, email, datetime):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+    cursor.execute('set search_path to sirest')
     # query riwayat by id
     sql = f'''select u.fname, u.lname, t.street, t.district, t.city, t.province, r.rname, r.rbranch, t.datetime, t.rating, foo.fname, foo.lname, co.platenum, co.vehicletype, co.vehiclebrand, 
     r.street, r.district, r.city, r.province, t.totalfood, t.totaldiscount, t.deliveryfee, t.totalprice, pm.name, ps.name from transaction t, courier co, transaction_food tf,  
@@ -78,15 +93,22 @@ def show_detail_riwayat(request, email, datetime):
         'role': request.COOKIES.get('role'),
         'rname': request.COOKIES.get('rname'),
         'rbranch': request.COOKIES.get('rbranch'),
+        'adminid':request.COOKIES.get('adminid')
     }
-    print('masuk')
-    print(record_riwayat)
-    print(ordered_food)
-    print(transaction_status)
+
     return render(request, 'detail_riwayat.html', context)
 
 
 def show_form_penilaian(request, email, datetime):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
+    cursor.execute('set search_path to sirest')
+
     if request.method == 'POST':
         rating = request.POST.get('nilai')
         if rating != '0':
@@ -98,18 +120,34 @@ def show_form_penilaian(request, email, datetime):
             context = {
                 'status': 'error',
                 'message': 'Data yang diisikan belum lengkap, silahkan lengkapi data terlebih dahulu',
-                'role': request.COOKIES.get('role')
+                'role': request.COOKIES.get('role'),
+                'adminid':request.COOKIES.get('adminid')
             }
             return render(request, 'form_penilaian.html', context)
 
-    return render(request, 'form_penilaian.html', {'role': request.COOKIES.get('role')})
+    return render(request, 'form_penilaian.html', {'role': request.COOKIES.get('role'), 'adminid':request.COOKIES.get('adminid')})
 
 
 def show_buat_promo(request):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
     return render(request, 'buat_promo.html', {'role': request.COOKIES.get('role')})
 
 
 def show_form_promo_minimum(request):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
+    cursor.execute('set search_path to sirest')
+
     if request.method == "POST":
         name = request.POST.get('name')
         discount = request.POST.get('discount')
@@ -143,6 +181,15 @@ def show_form_promo_minimum(request):
 
 
 def show_form_promo_hari_spesial(request):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
+    cursor.execute('set search_path to sirest')
+
     if request.method == "POST":
         name = request.POST.get('name')
         discount = request.POST.get('discount')
@@ -170,8 +217,16 @@ def show_form_promo_hari_spesial(request):
 
 
 def show_daftar_promo(request):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
+    cursor.execute('set search_path to sirest')
+
     cursor.execute('select * from promo')
-    # TODO: GANTI FETCH ALL
     records_promo = cursor.fetchall()
     records_promo = sorted(records_promo, key=lambda x: x[1].lower())
     print(records_promo)
@@ -195,6 +250,7 @@ def show_daftar_promo(request):
         'records_promo': records_promo,
         'role': request.COOKIES.get('role'),
         'rname': request.COOKIES.get('rname'),
+        'adminid':request.COOKIES.get('adminid'),
         'rbranch': request.COOKIES.get('rbranch'),
     }
 
@@ -202,6 +258,15 @@ def show_daftar_promo(request):
 
 
 def show_ubah_promo(request, jenis, id):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
+    cursor.execute('set search_path to sirest')
+
     cursor.execute(f'select promoname from promo where id = \'{id}\'')
     record = cursor.fetchall()
     if request.method == 'POST':
@@ -240,6 +305,13 @@ def show_ubah_promo(request, jenis, id):
 
 
 def show_daftar_promo_restoran(request, rname, rbranch):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
     cursor.execute('set search_path to sirest')
     cursor.execute(f'select * from promo p, restaurant_promo r where p.id = r.pid and r.rname = \'{rname}\' and r.rbranch = \'{rbranch}\'')
     records_promo_resto = cursor.fetchall()
@@ -256,13 +328,21 @@ def show_daftar_promo_restoran(request, rname, rbranch):
         'role':request.COOKIES.get('role'),
         'rname':rname,
         'rbranch':rbranch,
-        'empty':len(records_promo_resto)
+        'empty':len(records_promo_resto),
+        'adminid':request.COOKIES.get('adminid')
     }
 
     return render(request, 'daftar_promo_restoran.html', context)
 
 
 def show_form_promo_restoran(request):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
     cursor.execute('set search_path to sirest')
     rname = request.COOKIES.get('rname')
     rbranch = request.COOKIES.get('rbranch')
@@ -284,11 +364,12 @@ def show_form_promo_restoran(request):
         except Exception as e:
             connection.rollback()
             context = {
-                'message':e.args[0:40],
+                'message':e.args[0][0:40],
                 'role':request.COOKIES.get('role'),
                 'rname':rname,
                 'rbranch':rbranch,
                 'record_promoname':record_promoname,
+                'adminid':request.COOKIES.get('adminid')
             }
             return render(request, 'form_promo_restoran.html', context)
 
@@ -297,11 +378,21 @@ def show_form_promo_restoran(request):
         'rname':rname,
         'rbranch':rbranch,
         'record_promoname':record_promoname,
+        'adminid':request.COOKIES.get('adminid')
     }
     return render(request, 'form_promo_restoran.html', context)
 
 
 def show_form_ubah_promo_restoran(request, id):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
+    cursor.execute('set search_path to sirest')
+
     cursor.execute(
         f'select promoname, discount from promo where id = \'{id}\'')
     record_pname = cursor.fetchall()
@@ -330,6 +421,7 @@ def show_form_ubah_promo_restoran(request, id):
                 'rname': request.COOKIES.get('rname'),
                 'rbranch': request.COOKIES.get('rbranch'),
                 'discount': record_pname[0][1],
+                'adminid':request.COOKIES.get('adminid')
             }
             return render(request, 'form_ubah_promo_restoran.html', context)
         else:
@@ -349,7 +441,8 @@ def show_form_ubah_promo_restoran(request, id):
                     'role': request.COOKIES.get('role'),
                     'rname': request.COOKIES.get('rname'),
                     'rbranch': request.COOKIES.get('rbranch'),
-                    'discount': record_pname[0][1],
+                    'discount': record_pname[0][1],    
+                    'adminid':request.COOKIES.get('adminid'),
                 }
                 return render(request, 'form_ubah_promo_restoran.html', context)
 
@@ -360,12 +453,22 @@ def show_form_ubah_promo_restoran(request, id):
         'role': request.COOKIES.get('role'),
         'rname': request.COOKIES.get('rname'),
         'rbranch': request.COOKIES.get('rbranch'),
+        'adminid':request.COOKIES.get('adminid')
     }
 
     return render(request, 'form_ubah_promo_restoran.html', context)
 
 
 def show_detail_promo(request, id):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
+    cursor.execute('set search_path to sirest')
+
     cursor.execute(f'select * from promo where id = \'{id}\'')
     records_promo = cursor.fetchmany()
 
@@ -385,6 +488,7 @@ def show_detail_promo(request, id):
         'records_promo': records_promo[0],
         'role': request.COOKIES.get('role'),
         'rname': request.COOKIES.get('rname'),
+        'adminid':request.COOKIES.get('adminid'),
         'rbranch': request.COOKIES.get('rbranch'),
     }
 
@@ -392,6 +496,15 @@ def show_detail_promo(request, id):
 
 
 def show_detail_promo_restoran(request, rname, rbranch, id):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
+    cursor.execute('set search_path to sirest')
+
     cursor.execute(
         f'select * from promo p, restaurant_promo r where p.id = r.pid and r.pid = \'{id}\' and r.rname = \'{rname}\' and r.rbranch = \'{rbranch}\'')
     record_promo = cursor.fetchall()
@@ -409,30 +522,59 @@ def show_detail_promo_restoran(request, rname, rbranch, id):
     record_promo = list(record_promo[0])
     record_promo[6] = record_promo[6].date()
     record_promo[7] = record_promo[7].date()
+
     context = {
         'record_promo': record_promo,
         'id': id,
-        'rname': rname,
-        'rbranch': rbranch,
+        'rname': request.COOKIES.get('rname'),
+        'rbranch': request.COOKIES.get('rbranch'),
+        'adminid':request.COOKIES.get('adminid'),
+        'role': request.COOKIES.get('role'),
     }
 
-    print(record_promo)
     return render(request, 'detail_promosi_restoran.html', context)
 
 
 def delete_promo(request, id):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
+    cursor.execute('set search_path to sirest')
+
     cursor.execute(f'delete from promo where id = \'{id}\'')
     connection.commit()
     return HttpResponseRedirect(reverse('trigger_6:show_daftar_promo'))
 
 
 def delete_promo_restoran(request, rname, rbranch, id):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
+    cursor.execute('set search_path to sirest')
+
     cursor.execute(
         f'delete from restaurant_promo where pid = \'{id}\' and rname = \'{rname}\' and rbranch = \'{rbranch}\'')
     connection.commit()
-    return HttpResponseRedirect(reverse('trigger_6:show_daftar_promo_restoran'))
+    return HttpResponseRedirect(reverse('trigger_6:show_daftar_promo_restoran', kwargs={'rname':rname, 'rbranch':rbranch}))
 
 def ubah_form_input(request, id):
+    role = request.COOKIES.get('role')
+
+    if role == None:
+        return redirect("/login")
+    if role != 'restaurant':
+        return redirect("/")
+
+    cursor.execute('set search_path to sirest')
+
     cursor.execute(f'select discount from sirest.promo where id = \'{id}\'')
     discount = cursor.fetchone()