diff --git a/trigger_2/templates/buat_jam_operasional.html b/trigger_2/templates/buat_jam_operasional.html
index f70f53953f7b6c43be59bc9a664c1c15f2402e24..2668a72436b7cf5adf98afde1c289e99433c6d44 100644
--- a/trigger_2/templates/buat_jam_operasional.html
+++ b/trigger_2/templates/buat_jam_operasional.html
@@ -8,6 +8,7 @@
       class="w-[25rem] drop-shadow-2xl flex flex-col justify-center items-center bg-cream-tua p-10 rounded-xl lg:scale-100 md:scale-90 scale-75"
     >
       <h1 class="text-2xl font-bold mb-3">BUAT JAM OPERASIONAL</h1>
+      <h1 class="text-red-500 font-bold my-2">{{message}}</h1>
 
       <form
         action=""
@@ -22,8 +23,6 @@
             <td>{{ field.errors }} {{ field }}</td>
           </tr>
           {% endfor %}
-
-
         </table>
 
         <button
@@ -33,6 +32,11 @@
           Simpan
         </button>
       </form>
+      <a
+        href="{% url 'account:show_main' %}"
+        class="btn mt-4 bg-red-600 hover:bg-red-700 text-white font-bold py-2 px-4 rounded flex items-center justify-center"
+        >Kembali</a
+      >
     </div>
   </div>
 </div>
diff --git a/trigger_2/templates/daftar_jam_operasional.html b/trigger_2/templates/daftar_jam_operasional.html
index 361b29a471052c132073d78a70d7b29d2e1e2f65..dd667d96e591251d4ec1d5668907663f51479159 100644
--- a/trigger_2/templates/daftar_jam_operasional.html
+++ b/trigger_2/templates/daftar_jam_operasional.html
@@ -30,18 +30,18 @@
                     {{ forloop.counter }}
                 </td>
                 <td class="py-3 px-6">
-                    {{ jam_operasional.hari }}
+                    {{ jam_operasional.2 }}
                 </td>
                 <td class="py-3 px-6">
-                    {{ jam_operasional.jam_buka }}
+                    {{ jam_operasional.3 }}
                 </td>
                 <td class="py-3 px-6">
-                    {{ jam_operasional.jam_tutup }}
+                    {{ jam_operasional.4 }}
                 </td>
                 <td class="py-3 px-6">
-                    <a href="" class="text-blue-500">Ubah</a>
+                    <a href="{% url 'trigger_2:edit_jam_operasional' jam_operasional.0 jam_operasional.1 jam_operasional.2 %}" class="text-blue-500">Ubah</a>
                     <br>
-                    <a href="" class="text-blue-500">Hapus</a>
+                    <a href="{% url 'trigger_2:hapus_jam_operasional' jam_operasional.0 jam_operasional.1 jam_operasional.2 %}" class="text-blue-500">Hapus</a>
                 </td>
             </tr>
             {% endfor %}
diff --git a/trigger_2/templates/edit_jam_operasional.html b/trigger_2/templates/edit_jam_operasional.html
index 4f45cb23e59ec7eaa75d1981b3f8076537f837ff..20a486b4ca37ce323a05acf69e78b38cf27bd98e 100644
--- a/trigger_2/templates/edit_jam_operasional.html
+++ b/trigger_2/templates/edit_jam_operasional.html
@@ -8,6 +8,8 @@
       class="w-[25rem] drop-shadow-2xl flex flex-col justify-center items-center bg-cream-tua p-10 rounded-xl lg:scale-100 md:scale-90 scale-75"
     >
       <h1 class="text-2xl font-bold mb-3">EDIT JAM OPERASIONAL</h1>
+      <h1 class="text-red-500 font-bold my-2">{{message}}</h1>
+
 
       <form
         action=""
@@ -35,6 +37,12 @@
           Simpan
         </button>
       </form>
+
+      <a
+        href="{% url 'trigger_2:daftar_jam_operasional' %}"
+        class="btn mt-4 bg-red-600 hover:bg-red-700 text-white font-bold py-2 px-4 rounded flex items-center justify-center"
+        >Kembali</a
+      >
     </div>
   </div>
 </div>
diff --git a/trigger_2/urls.py b/trigger_2/urls.py
index 038adbaa85061cbe06bfbbcd18056a947152a4c3..4d6659a56237622eb40ddbb3ef06935ab4730ef9 100644
--- a/trigger_2/urls.py
+++ b/trigger_2/urls.py
@@ -11,10 +11,8 @@ urlpatterns = [
     path('daftar_pesanan/<email>/<datetime>', detail_pesanan, name='detail_pesanan'),
     path('buat_jam_operasional/', buat_jam_operasional, name='buat_jam_operasional'),
     path('daftar_jam_operasional/', daftar_jam_operasional, name='daftar_jam_operasional'),
-    path('daftar_jam_operasional/<int:id_jam_operasional>/',
+    path('daftar_jam_operasional/<rname>/<rbranch>/<day>',
          edit_jam_operasional, name='edit_jam_operasional'),
     path('ubah_status_pesanan/<email>/<datetime>/<status>', ubah_status_pesanan, name='ubah_status_pesanan'),
-]
-
-
-
+    path('hapus_jam_operasional/<rname>/<rbranch>/<day>', hapus_jam_operasional, name='hapus_jam_operasional'),
+]
\ No newline at end of file
diff --git a/trigger_2/views.py b/trigger_2/views.py
index 040b293e58a9b582418a629e8da83db830265181..cc8b6d05dabc34992a857576d534f146f58830cb 100644
--- a/trigger_2/views.py
+++ b/trigger_2/views.py
@@ -4,6 +4,7 @@ from utils.query import *
 from django.urls import reverse
 from django.http import HttpResponse, HttpResponseRedirect
 import random
+from django.shortcuts import render, redirect
 
 # Create your views here.
 
@@ -50,6 +51,7 @@ def isi_saldo(request):
                 'rname': request.COOKIES.get('rname'),
                 'rbranch': request.COOKIES.get('rbranch'),
                 'adminid': request.COOKIES.get('adminid'),
+                'email': request.COOKIES.get('email')
             }
 
             return render(request, 'isi_saldo.html', context)
@@ -115,7 +117,23 @@ def isi_saldo(request):
             return render(request, 'isi_saldo.html', context)
 
         except Exception as e:
-            return render(request, 'isi_saldo.html', {'message': 'Isi Saldo Gagal'})
+            # rollback
+            connection.rollback()
+            form = FormIsiSaldo(request.POST or None)
+
+            context = {
+                'form': form,
+                'saldo': saldo,
+                'nama_bank': nama_bank,
+                'nomor_rekening': nomor_rekening,
+                'message': 'Isi Saldo Gagal',
+                'role': 'restaurant',
+                'rname': request.COOKIES.get('rname'),
+                'rbranch': request.COOKIES.get('rbranch'),
+                'adminid': request.COOKIES.get('adminid'),
+            }
+
+            return render(request, 'isi_saldo.html', context)
 
     form = FormIsiSaldo(request.POST or None)
 
@@ -240,6 +258,8 @@ def tarik_saldo(request):
 
             return render(request, 'tarik_saldo.html', context)
         except Exception as e:
+            # rollback
+            connection.rollback()
             form = FormTarikSaldo(request.POST or None)
 
             context = {
@@ -275,7 +295,6 @@ def tarik_saldo(request):
 def daftar_pesanan(request):
     email = request.COOKIES.get('email')
 
-    
     cursor.execute(
         f"""
         select concat(fname, ' ', lname), t.datetime, ts.name, ua.email
@@ -492,67 +511,206 @@ def detail_pesanan(request, email, datetime):
 
 
 def buat_jam_operasional(request):
+    email = request.COOKIES.get('email')
+    rname = request.COOKIES.get('rname')
+    rbranch = request.COOKIES.get('rbranch')
+
+    if request.method == 'POST' or 'post' and not request.method == 'GET':
+        hari = request.POST.get('hari')
+        jam_buka = request.POST.get('jam_buka')
+        jam_tutup = request.POST.get('jam_tutup')
+
+        # cek apakah jam buka dan jam tutup valid
+        if not (jam_buka < jam_tutup):
+            form = FormBuatJamOperasional(request.POST or None)
+            context = {
+                'form': form,
+                'message': 'Jam buka dan jam tutup tidak valid',
+                'role': 'restaurant',
+                'rname': request.COOKIES.get('rname'),
+                'rbranch': request.COOKIES.get('rbranch'),
+                'adminid': request.COOKIES.get('adminid'),
+                'email': request.COOKIES.get('email')
+            }
+            return render(request, 'buat_jam_operasional.html', context)
+
+        # cek apakah jam buka dan jam tutup sudah ada
+        cursor.execute(
+            f"""
+                select *
+                from restaurant_operating_hours
+                where name = '{rname}'
+                and branch = '{rbranch}'
+                and day = '{hari}';
+            """
+        )
+        record = cursor.fetchall()
+        if len(record) != 0:
+            form = FormBuatJamOperasional(request.POST or None)
+            context = {
+                'form': form,
+                'message': 'Jam Operasional di hari tersebut sudah ada',
+                'role': 'restaurant',
+                'rname': request.COOKIES.get('rname'),
+                'rbranch': request.COOKIES.get('rbranch'),
+                'adminid': request.COOKIES.get('adminid'),
+                'email': request.COOKIES.get('email')
+            }
+            return render(request, 'buat_jam_operasional.html', context)
+
+        # insert ke database
+        try:
+            cursor.execute(
+                f"""
+                    insert into restaurant_operating_hours
+                    values ('{rname}', '{rbranch}', '{hari}', '{jam_buka}', '{jam_tutup}');
+                """
+            )
+            connection.commit()
+
+            # redirect ke halaman daftar jam operasional
+            return redirect('trigger_2:daftar_jam_operasional')
+
+        except Exception as e:
+            # rollback
+            print(e)
+            connection.rollback()
+            form = FormBuatJamOperasional(request.POST or None)
+            context = {
+                'form': form,
+                'message': 'Gagal membuat jam operasional',
+                'role': 'restaurant',
+                'rname': request.COOKIES.get('rname'),
+                'rbranch': request.COOKIES.get('rbranch'),
+                'adminid': request.COOKIES.get('adminid'),
+                'email': request.COOKIES.get('email')
+            }
+            return render(request, 'buat_jam_operasional.html', context)
+
     form = FormBuatJamOperasional(request.POST or None)
 
     context = {
         'form': form,
+        'role': 'restaurant',
+        'rname': request.COOKIES.get('rname'),
+        'rbranch': request.COOKIES.get('rbranch'),
+        'adminid': request.COOKIES.get('adminid'),
+        'email': request.COOKIES.get('email')
     }
 
     return render(request, 'buat_jam_operasional.html', context)
 
 
 def daftar_jam_operasional(request):
+    email = request.COOKIES.get('email')
+    rname = request.COOKIES.get('rname')
+    rbranch = request.COOKIES.get('rbranch')
+
+    cursor.execute(
+        f"""
+            select *
+            from restaurant_operating_hours
+            where name = '{rname}'
+            and branch = '{rbranch}';
+        """
+    )
+
+    daftar_jam_operasional = cursor.fetchall()
+
     context = {
-        'daftar_jam_operasional': [
-            {
-                'hari': 'Senin',
-                'jam_buka': '08:00:00',
-                'jam_tutup': '16:00:00',
-            },
-            {
-                'hari': 'Selasa',
-                'jam_buka': '08:00:00',
-                'jam_tutup': '16:00:00',
-            },
-            {
-                'hari': 'Rabu',
-                'jam_buka': '08:00:00',
-                'jam_tutup': '16:00:00',
-            },
-            {
-                'hari': 'Kamis',
-                'jam_buka': '08:00:00',
-                'jam_tutup': '16:00:00',
-            },
-            {
-                'hari': 'Jumat',
-                'jam_buka': '08:00:00',
-                'jam_tutup': '16:00:00',
-            },
-            {
-                'hari': 'Sabtu',
-                'jam_buka': '08:00:00',
-                'jam_tutup': '16:00:00',
-            },
-            {
-                'hari': 'Minggu',
-                'jam_buka': '08:00:00',
-                'jam_tutup': '16:00:00',
-            },
-        ]
+        'daftar_jam_operasional': daftar_jam_operasional,
+        'role': 'restaurant',
+        'rname': request.COOKIES.get('rname'),
+        'rbranch': request.COOKIES.get('rbranch'),
+        'adminid': request.COOKIES.get('adminid'),
+        'email': request.COOKIES.get('email')
     }
     return render(request, 'daftar_jam_operasional.html', context)
 
 
-def edit_jam_operasional(request, id_jam_operasional):
+def edit_jam_operasional(request, rname, rbranch, day):
+    if request.method == 'POST' or 'post' and not request.method == 'GET':
+        jam_buka = request.POST.get('jam_buka')
+        jam_tutup = request.POST.get('jam_tutup')
+
+        # cek apakah jam buka dan jam tutup valid
+        if not (jam_buka < jam_tutup):
+            form = FormEditJamOperasional(request.POST or None)
+            context = {
+                'form': form,
+                'message': 'Jam buka dan jam tutup tidak valid',
+                'hari': day,
+                'role': 'restaurant',
+                'rname': request.COOKIES.get('rname'),
+                'rbranch': request.COOKIES.get('rbranch'),
+                'adminid': request.COOKIES.get('adminid'),
+                'email': request.COOKIES.get('email')
+            }
+            return render(request, 'edit_jam_operasional.html', context)
+
+        # insert ke database
+        try:
+            cursor.execute(
+                f"""
+                    update restaurant_operating_hours
+                    set starthours = '{jam_buka}',
+                        endhours = '{jam_tutup}'
+                    where name = '{rname}'
+                    and branch = '{rbranch}'
+                    and day = '{day}';
+                """
+            )
+            connection.commit()
+
+            # redirect ke halaman daftar jam operasional
+            return redirect('trigger_2:daftar_jam_operasional')
+
+        except Exception as e:
+            # rollback
+            print(e)
+            connection.rollback()
+            form = FormEditJamOperasional(request.POST or None)
+            context = {
+                'form': form,
+                'message': 'Gagal mengubah jam operasional',
+                'hari': day,
+                'role': 'restaurant',
+                'rname': request.COOKIES.get('rname'),
+                'rbranch': request.COOKIES.get('rbranch'),
+                'adminid': request.COOKIES.get('adminid'),
+                'email': request.COOKIES.get('email')
+            }
+            return render(request, 'edit_jam_operasional.html', context)
+
     form = FormEditJamOperasional(request.POST or None)
 
     context = {
         'form': form,
-        'id_jam_operasional': id_jam_operasional,
-        'hari': 'Senin',
-        'jam_buka': '08:00:00',
-        'jam_tutup': '16:00:00',
+        'hari': day,
+        'role': 'restaurant',
+        'rname': request.COOKIES.get('rname'),
+        'rbranch': request.COOKIES.get('rbranch'),
+        'adminid': request.COOKIES.get('adminid'),
+        'email': request.COOKIES.get('email')
     }
 
     return render(request, 'edit_jam_operasional.html', context)
+
+def hapus_jam_operasional(request, rname, rbranch, day):
+    try:
+        cursor.execute(
+            f"""
+                delete from restaurant_operating_hours
+                where name = '{rname}'
+                and branch = '{rbranch}'
+                and day = '{day}';
+            """
+        )
+        connection.commit()
+
+        return redirect('trigger_2:daftar_jam_operasional')
+
+    except Exception as e:
+        print(e)
+        connection.rollback()
+        return redirect('trigger_2:daftar_jam_operasional')
\ No newline at end of file