From c95132de1dbfc99c15ba95a3aff6dac4a1693e9e Mon Sep 17 00:00:00 2001 From: SyahrulApr86 <apriansyah.syahrul@gmail.com> Date: Tue, 13 Dec 2022 23:52:07 +0700 Subject: [PATCH] m --- account/views.py | 26 +- templates/navbar.html | 535 +++++++++++++++++++++++++++--------------- trigger3/views.py | 171 ++++++++------ trigger5/views.py | 6 +- 4 files changed, 462 insertions(+), 276 deletions(-) diff --git a/account/views.py b/account/views.py index 8619f61..02a3ba2 100644 --- a/account/views.py +++ b/account/views.py @@ -9,7 +9,7 @@ import re def show_main(request): - cursor.execute('set search_path to sirest') + # Jika user sudah login, redirect ke halaman dashboard @@ -166,7 +166,7 @@ def show_main(request): def logout_user(request): - cursor.execute('set search_path to sirest') + response = HttpResponseRedirect(reverse('account:show_main')) for cookie in request.COOKIES: response.delete_cookie(cookie) @@ -174,7 +174,7 @@ def logout_user(request): def login(request): - cursor.execute('set search_path to sirest') + # if user is logged in, redirect to dashboard if request.COOKIES.get('role'): return HttpResponseRedirect(reverse('account:show_main')) @@ -337,12 +337,12 @@ def login(request): def register(request): - cursor.execute('set search_path to sirest') + return render(request, 'register.html') def register_admin(request): - cursor.execute('set search_path to sirest') + if request.method == 'POST' or 'post' and not request.method == 'GET': email = request.POST.get('email') password = request.POST.get('password') @@ -427,7 +427,7 @@ def register_admin(request): def register_pelanggan(request): - cursor.execute('set search_path to sirest') + if request.method == 'POST' or 'post' and not request.method == 'GET': email = request.POST.get('email') password = request.POST.get('password') @@ -523,7 +523,7 @@ def register_pelanggan(request): def register_restoran(request): - cursor.execute('set search_path to sirest') + if request.method == 'POST' or 'post' and not request.method == 'GET': email = request.POST.get('email') password = request.POST.get('password') @@ -626,7 +626,7 @@ def register_restoran(request): def register_kurir(request): - cursor.execute('set search_path to sirest') + if request.method == 'POST' or 'post' and not request.method == 'GET': email = request.POST.get('email') password = request.POST.get('password') @@ -725,14 +725,14 @@ def register_kurir(request): def dashboard_admin(request): - cursor.execute('set search_path to sirest') + role = request.COOKIES.get('role') return render(request, 'dashboard_admin.html') def profile_restoran(request, email): - cursor.execute('set search_path to sirest') + cursor.execute( f'select * from user_acc u, transaction_actor t, restaurant r where u.email = \'{email}\' and u.email = t.email and t.email = r.email') @@ -756,7 +756,7 @@ def profile_restoran(request, email): def profile_pelanggan(request, email): - cursor.execute('set search_path to sirest') + role = request.COOKIES.get('role') cursor.execute( @@ -770,7 +770,7 @@ def profile_pelanggan(request, email): def profile_kurir(request, email): - cursor.execute('set search_path to sirest') + role = request.COOKIES.get('role') cursor.execute( @@ -783,7 +783,7 @@ def profile_kurir(request, email): return render(request, 'profile_kurir.html', context) def verifikasi_user(request, email_user, email_admin): - cursor.execute('set search_path to sirest') + cursor.execute( f'update transaction_actor set adminid = \'{email_admin}\' where email = \'{email_user}\'') connection.commit() diff --git a/templates/navbar.html b/templates/navbar.html index 9683953..a3acdd7 100644 --- a/templates/navbar.html +++ b/templates/navbar.html @@ -1,189 +1,358 @@ <head> <script> - function menu(e){ - let list = document.getElementById('list-navbar'); - e.name === 'menu' ? (e.name = "close", list.classList.remove('hidden')) :( e.name = "menu", list.classList.add('hidden')) - } + function menu(e) { + let list = document.getElementById("list-navbar"); + e.name === "menu" + ? ((e.name = "close"), list.classList.remove("hidden")) + : ((e.name = "menu"), list.classList.add("hidden")); + } </script> - <script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js" defer></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"> - {% comment %} if adminid is not none {% endcomment %} - {% 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> + <script + src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js" + defer + ></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 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' %} + <div @click.away="open = false" class="relative" x-data="{ open: false }"> + <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> + <span>Restoran</span> + <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> + </button> + <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 'trigger5:daftar_kategori' %}">Daftar Kategori 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 'trigger5:buat_kategori' %}">Buat Kategori 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="#">Daftar Kategori Makanan</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="#">Buat Kategori Makanan</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 'trigger5:daftar_bahanmakanan' %}">Daftar Bahan Makanan</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 'trigger5:buat_bahanmakanan' %}">Buat Bahan Makanan</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 'trigger3:daftar_restoran' %}">Daftar Restoran dan Makanan</a> + </div> + </div> + </div> + + <!-- {admin start} --> + {% if role == 'admin' %} + <div @click.away="open = false" class="relative" x-data="{ open: false }"> + <button + @click="open = !open" + class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500" + > + <span>Restoran</span> + <svg + fill="currentColor" + viewBox="0 0 20 20" + :class="{'rotate-180': open, 'rotate-0': !open}" + class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1" + > + <path + fill-rule="evenodd" + d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" + clip-rule="evenodd" + ></path> + </svg> + </button> + <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="#" + >Daftar Kategori 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="#" + >Buat Kategori 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="#" + >Daftar Kategori Makanan</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="#" + >Buat Kategori Makanan</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 Bahan Makanan</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="#" + >Buat Bahan Makanan</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 Restoran dan Makanan</a + > + </div> </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> + </div> + + <div @click.away="open = false" class="relative" x-data="{ open: false }"> + <button + @click="open = !open" + class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500" + > + <span>Promo</span> + <svg + fill="currentColor" + viewBox="0 0 20 20" + :class="{'rotate-180': open, 'rotate-0': !open}" + class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1" + > + <path + fill-rule="evenodd" + d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" + clip-rule="evenodd" + ></path> + </svg> + </button> + <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</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_buat_promo' %}" + >Buat Promo</a + > + </div> </div> - - <!-- {admin start} --> - {% if role == 'admin' %} - <div @click.away="open = false" class="relative" x-data="{ open: false }"> - <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> - <span>Restoran</span> - <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> - </button> - <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 'trigger5:daftar_kategori' %}">Daftar Kategori 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 'trigger5:buat_kategori' %}">Buat Kategori 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="#">Daftar Kategori Makanan</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="#">Buat Kategori Makanan</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 'trigger5:daftar_bahanmakanan' %}">Daftar Bahan Makanan</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 'trigger5:buat_bahanmakanan' %}">Buat Bahan Makanan</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 'trigger3:daftar_restoran' %}">Daftar Restoran dan Makanan</a> - </div> - </div> - </div> - - <div @click.away="open = false" class="relative" x-data="{ open: false }"> - <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> - <span>Promo</span> - <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> - </button> - <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</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_buat_promo' %}">Buat Promo</a> - </div> - </div> - </div> - - <div @click.away="open = false" class="relative" x-data="{ open: false }"> - <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> - <span>Pesanan</span> - <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> - </button> - <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 'trigger3:tarif_detail' %}">Daftar Tarif Pengiriman per KM</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 'trigger3:tambah_tarif' %}">Buat Tarif Pengiriman per KM</a> - </div> - </div> + </div> + + <div @click.away="open = false" class="relative" x-data="{ open: false }"> + <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> + <span>Pesanan</span> + <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> + </button> + <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 'trigger3:tarif_detail' %}">Daftar Tarif Pengiriman per KM</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 'trigger3:tambah_tarif' %}">Buat Tarif Pengiriman per KM</a> + </div> + </div> + </div> + {% endif %} + <!-- admin end --> + <div @click.away="open = false" class="relative" x-data="{ open: false }"> + <button + @click="open = !open" + class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500" + > + <span>Pesanan</span> + <svg + fill="currentColor" + viewBox="0 0 20 20" + :class="{'rotate-180': open, 'rotate-0': !open}" + class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1" + > + <path + fill-rule="evenodd" + d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" + clip-rule="evenodd" + ></path> + </svg> + </button> + <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="#" + >Daftar Tarif Pengiriman per KM</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="#" + >Buat Tarif Pengiriman per KM</a + > + </div> </div> - {% endif %} - <!-- admin end --> - - <!-- pelanggan start --> - {% if role == 'customer' and adminid != None %} - <div class="md:mx-5 my-3 md:my-0 text-center"> - <a href="{% url 'trigger3:daftar_restoran' %}" class="hover:text-[#DBC8AC] hover:text-lg duration-500 whitespace-nowrap">Daftar Restoran dan Makanan</a> - </div> - - <div @click.away="open = false" class="relative" x-data="{ open: false }"> - <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> - <span>Pesanan</span> - <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> - </button> - <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="#">Buat Pesanan</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="#">Pesanan Berlangsung</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_riwayat' %}">Riwayat Pesanan</a> - </div> - </div> - </div> - - <div class="md:mx-5 my-3 md:my-0"> - <a href="" class="hover:text-[#DBC8AC] hover:text-lg duration-500">Restopay</a> - </div> - {% endif %} - <!-- pelanggan end --> - - <!-- restoran start --> - {% if role == 'restaurant' and adminid != None %} - <div @click.away="open = false" class="relative" x-data="{ open: false }"> - <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500 whitespace-nowrap"> - <span>Jam Operasional</span> - <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> - </button> - <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="#">Daftar Jam Operasional</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="#">Buat Jam Operasional</a> - </div> - </div> - </div> - <div @click.away="open = false" class="relative" x-data="{ open: false }"> - <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> - <span>Makanan</span> - <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> - </button> - <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 'trigger3:makanan_resto' %}">Daftar Makanan</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 'trigger3:tambah_makanan' %}">Buat Makanan</a> - </div> - </div> - </div> - <div @click.away="open = false" class="relative" x-data="{ open: false }"> - <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> - <span>Pesanan</span> - <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> - </button> - <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="#">Pesanan Berlangsung</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_riwayat' %}">Riwayat Pesanan</a> - </div> - </div> - </div> - <div @click.away="open = false" class="relative" x-data="{ open: false }"> - <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> - <span>Promo</span> - <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> - </button> - <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> - </div> - </div> - </div> - <div class="md:mx-5 my-3 md:my-0"> - <a href="" class="hover:text-[#DBC8AC] hover:text-lg duration-500">RestoPay</a> - </div> - {% endif %} - <!-- restoran end --> - - <!-- kurir start --> - {% if role == 'courier' and adminid != None %} - <div class="md:mx-5 my-3 md:my-0"> - <a href="{% url 'trigger3:daftar_restoran' %}" class="hover:text-[#DBC8AC] hover:text-lg duration-500 whitespace-nowrap">Daftar Restoran dan Makanan</a> - </div> - <div @click.away="open = false" class="relative" x-data="{ open: false }"> - <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> - <span>Pesanan</span> - <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> - </button> - <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 'trigger5:pemesanan_kurir' %}">Pesanan Berlangsung</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_riwayat' %}">Riwayat Pesanan</a> - </div> - </div> - </div> - <div class="md:mx-5 my-3 md:my-0"> - <a href="" class="hover:text-[#DBC8AC] hover:text-lg duration-500">RestoPay</a> - </div> - {% endif %} - <!-- kurir end --> - - <div class="md:mx-5 my-3 md:my-0"> - <a href="{% url 'account:logout' %}" class="hover:text-[#DBC8AC] hover:text-lg duration-500">Logout</a> - </div> - </div> -</nav> + </div> + {% endif %} + <!-- admin end --> + + <!-- pelanggan start --> + {% if role == 'customer' and adminid != None %} + <div class="md:mx-5 my-3 md:my-0 text-center"> + <a + href="{% url 'trigger3:daftar_restoran' %}" + class="hover:text-[#DBC8AC] hover:text-lg duration-500 whitespace-nowrap" + >Daftar Restoran dan Makanan</a + > + </div> + + <div @click.away="open = false" class="relative" x-data="{ open: false }"> + <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> + <span>Pesanan</span> + <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> + </button> + <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="#">Buat Pesanan</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="#">Pesanan Berlangsung</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_riwayat' %}">Riwayat Pesanan</a> + </div> + </div> + </div> + + <div class="md:mx-5 my-3 md:my-0"> + <a + href="{% url 'trigger_2:saldo_restopay' %}" + class="hover:text-[#DBC8AC] hover:text-lg duration-500" + >Restopay</a + > + </div> + {% endif %} + <!-- pelanggan end --> + + <!-- restoran start --> + {% if role == 'restaurant' and adminid != None %} + <div @click.away="open = false" class="relative" x-data="{ open: false }"> + <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500 whitespace-nowrap"> + <span>Jam Operasional</span> + <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> + </button> + <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_2:daftar_jam_operasional' %}">Daftar Jam Operasional</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_2:buat_jam_operasional' %}" + >Buat Jam Operasional</a> + </div> + </div> + </div> + <div @click.away="open = false" class="relative" x-data="{ open: false }"> + <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> + <span>Makanan</span> + <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> + </button> + <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 'trigger3:makanan_resto' %}">Daftar Makanan</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 'trigger3:tambah_makanan' %}">Buat Makanan</a> + </div> + </div> + </div> + <div @click.away="open = false" class="relative" x-data="{ open: false }"> + <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> + <span>Pesanan</span> + <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> + </button> + <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_2:daftar_pesanan' %}">Pesanan Berlangsung</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_riwayat' %}">Riwayat Pesanan</a> + </div> + </div> + </div> + <div @click.away="open = false" class="relative" x-data="{ open: false }"> + <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> + <span>Promo</span> + <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> + </button> + <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="{% url 'trigger_6:show_daftar_promo_restoran' rname rbranch %}">Daftar Promo Restoran</a> + </div> + </div> + </div> + <div class="md:mx-5 my-3 md:my-0"> + <a + href="{% url 'trigger_2:saldo_restopay' %}" + class="hover:text-[#DBC8AC] hover:text-lg duration-500" + >Restopay</a + > + </div> + {% endif %} + <!-- restoran end --> + + <!-- kurir start --> + {% if role == 'courier' and adminid != None %} + <div class="md:mx-5 my-3 md:my-0"> + <a href="{% url 'trigger3:daftar_restoran' %}" class="hover:text-[#DBC8AC] hover:text-lg duration-500 whitespace-nowrap">Daftar Restoran dan Makanan</a> + </div> + <div @click.away="open = false" class="relative" x-data="{ open: false }"> + <button @click="open = !open" class="flex flex-row items-center w-full md:mx-5 my-3 md:my-0 text-left bg-transparent rounded-lg focus:outline-none focus:shadow-outline hover:text-[#DBC8AC] hover:text-lg duration-500"> + <span>Pesanan</span> + <svg fill="currentColor" viewBox="0 0 20 20" :class="{'rotate-180': open, 'rotate-0': !open}" class="inline w-4 h-4 mt-1 ml-1 transition-transform duration-200 transform md:-mt-1"><path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd"></path></svg> + </button> + <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 'trigger5:pemesanan_kurir' %}">Pesanan Berlangsung</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_riwayat' %}">Riwayat Pesanan</a> + </div> + </div> + </div> + <div class="md:mx-5 my-3 md:my-0"> + <a + href="{% url 'trigger_2:saldo_restopay' %}" + class="hover:text-[#DBC8AC] hover:text-lg duration-500" + >Restopay</a + > + </div> + {% endif %} + <!-- kurir end --> + + <div class="md:mx-5 my-3 md:my-0"> + <a href="{% url 'account:logout' %}" class="hover:text-[#DBC8AC] hover:text-lg duration-500">Logout</a> + </div> + </div> + </nav> \ No newline at end of file diff --git a/trigger3/views.py b/trigger3/views.py index fc94bc8..5c4c5b8 100644 --- a/trigger3/views.py +++ b/trigger3/views.py @@ -16,11 +16,9 @@ def tambah_tarif(request): return redirect("/login") if role != 'admin': return redirect("/") - - if request.method == "POST": - try : + try: cursor.execute(f""" INSERT INTO DELIVERY_FEE_PER_KM VALUES ('{request.POST['id_trf']}', @@ -30,7 +28,7 @@ def tambah_tarif(request): """) connection.commit() return redirect("/trigger3/daftartarif") - except Exception as e : + except Exception as e: messages.error(request, e) connection.rollback() @@ -39,9 +37,9 @@ def tambah_tarif(request): """) maxId = cursor.fetchall()[0][0] length = int(maxId) + 1 - - - return render(request, 'create_tarif_pengiriman.html', {'length': length, 'role':request.COOKIES.get('role'), 'adminid': adminid}) + + return render(request, 'create_tarif_pengiriman.html', {'length': length, 'role': request.COOKIES.get('role'), 'adminid': adminid, 'rname': request.COOKIES.get('rname'), 'rbranch': request.COOKIES.get('rbranch'), + }) def tarif_detail(request): @@ -49,12 +47,16 @@ def tarif_detail(request): cursor.execute(f'select * from DELIVERY_FEE_PER_KM') record = cursor.fetchall() context = { - 'dataTarif' : record, - 'role':request.COOKIES.get('role'), - 'adminid' :request.COOKIES.get('adminid') + 'dataTarif': record, + 'role': request.COOKIES.get('role'), + 'rname': request.COOKIES.get('rname'), + 'rbranch': request.COOKIES.get('rbranch'), + 'adminid': request.COOKIES.get('adminid'), + } return render(request, "read_tarif_pengiriman.html", context) + def makanan_resto(request): cursor.execute('set search_path to sirest') role = request.COOKIES.get('role') @@ -64,30 +66,31 @@ def makanan_resto(request): return redirect("/login") if role != 'restaurant': return redirect("/") - - + rname = request.COOKIES.get('rname') rbranch = request.COOKIES.get('rbranch') - cursor.execute(f'select f.foodname, f.description, f.stock, f.price, fg.name, string_agg(i.name, \', \') from food f, food_category fg, food_ingredient fi, ingredient i where f.rbranch = \'{rbranch}\' and f.rname = \'{rname}\' and fg.id = f.fcategory and f.rbranch = fi.rbranch and f.rname = fi.rname and f.foodname = fi.foodname and fi.Ingredient = i.id group by f.foodname, f.description, f.stock, f.price, fg.name') + cursor.execute( + f'select f.foodname, f.description, f.stock, f.price, fg.name, string_agg(i.name, \', \') from food f, food_category fg, food_ingredient fi, ingredient i where f.rbranch = \'{rbranch}\' and f.rname = \'{rname}\' and fg.id = f.fcategory and f.rbranch = fi.rbranch and f.rname = fi.rname and f.foodname = fi.foodname and fi.Ingredient = i.id group by f.foodname, f.description, f.stock, f.price, fg.name') record = cursor.fetchall() - cursor.execute(f'select foodname from food where rbranch = \'{rbranch}\' and rname = \'{rname}\' and (rname, rbranch, foodname) not in (select distinct rname, rbranch, foodname from transaction_food) ') + cursor.execute( + f'select foodname from food where rbranch = \'{rbranch}\' and rname = \'{rname}\' and (rname, rbranch, foodname) not in (select distinct rname, rbranch, foodname from transaction_food) ') deletable = cursor.fetchall() - foodArr = [] for food in deletable: foodArr.append(food[0]) context = { - 'deletable_food' : foodArr, - 'dataMakanan' : record, - 'role':request.COOKIES.get('role'), - 'adminid': adminid, + 'deletable_food': foodArr, + 'dataMakanan': record, + 'role': request.COOKIES.get('role'), + 'rname': request.COOKIES.get('rname'), + 'rbranch': request.COOKIES.get('rbranch'), + 'adminid': request.COOKIES.get('adminid'), } - + return render(request, "read_makanan.html", context) - def update_tarif(request, id): @@ -98,11 +101,10 @@ def update_tarif(request, id): return redirect("/login") if role != 'admin': return redirect("/") - + cursor.execute(f'select * from delivery_fee_per_km where id = \'{id}\'') record = cursor.fetchall() - if request.method == "POST": try: cursor.execute(f""" @@ -113,19 +115,22 @@ def update_tarif(request, id): """) connection.commit() return redirect("/trigger3/daftartarif") - except Exception as e : + except Exception as e: messages.error(request, e) connection.rollback() context = { - 'provinsi' : record[0][1], - 'motorfee' : record[0][2], - 'carfee' : record[0][3], - 'role':request.COOKIES.get('role'), - 'adminid': adminid, + 'provinsi': record[0][1], + 'motorfee': record[0][2], + 'carfee': record[0][3], + 'role': request.COOKIES.get('role'), + 'rname': request.COOKIES.get('rname'), + 'rbranch': request.COOKIES.get('rbranch'), + 'adminid': request.COOKIES.get('adminid'), } return render(request, "update_tarif_pengiriman.html", context) + def delete_tarif(request, id): cursor.execute('set search_path to sirest') role = request.COOKIES.get('role') @@ -133,11 +138,10 @@ def delete_tarif(request, id): return redirect("/login") if role != 'admin': return redirect("/") - + cursor.execute(f'select * from delivery_fee_per_km where id = \'{id}\'') record = cursor.fetchall() - - + cursor.execute(f""" DELETE FROM DELIVERY_FEE_PER_KM WHERE id = '{id}'; @@ -157,14 +161,14 @@ def tambah_makanan(request): rname = request.COOKIES.get('rname') rbranch = request.COOKIES.get('rbranch') - if request.method == "POST": - + category = request.POST['kategoriMakanan'] - cursor.execute(f'select id FROM food_category where name = \'{category}\' ') + cursor.execute( + f'select id FROM food_category where name = \'{category}\' ') idCategory = cursor.fetchmany() - + cursor.execute(f""" INSERT INTO FOOD VALUES ('{rname}', @@ -182,7 +186,8 @@ def tambah_makanan(request): for x in range(int(click)): ingredient = request.POST[f'select-{x}'] - cursor.execute(f'select id FROM ingredient where name = \'{ingredient}\' ') + cursor.execute( + f'select id FROM ingredient where name = \'{ingredient}\' ') idBahan = cursor.fetchmany() cursor.execute(f""" @@ -195,25 +200,25 @@ def tambah_makanan(request): """) connection.commit() - - return redirect("/trigger3/daftarmakanan") - cursor.execute(f'select name FROM FOOD_CATEGORY') kategoriAll = cursor.fetchall() cursor.execute(f'select name FROM INGREDIENT') bahanAll = cursor.fetchall() - + context = { - 'kategoriMakanan' : kategoriAll, + 'kategoriMakanan': kategoriAll, 'jsonBahan': json.dumps(bahanAll), - 'bahanMakanan' : bahanAll, - 'adminid': adminid, + 'bahanMakanan': bahanAll, + 'rname': request.COOKIES.get('rname'), + 'rbranch': request.COOKIES.get('rbranch'), + 'adminid': request.COOKIES.get('adminid'), 'role': role } return render(request, "create_makanan.html", context) + def update_makanan(request, foodname): cursor.execute('set search_path to sirest') adminid = request.COOKIES.get('adminid') @@ -222,18 +227,19 @@ def update_makanan(request, foodname): return redirect("/login") if role != 'restaurant': return redirect("/") - + rname = request.COOKIES.get('rname') rbranch = request.COOKIES.get('rbranch') cursor.execute(f'select * from food where foodname = \'{foodname}\'') record = cursor.fetchall() - + if request.method == "POST": - + # Update food nya category = request.POST['kategoriMakanan'] - cursor.execute(f'select id FROM food_category where name = \'{category}\' ') + cursor.execute( + f'select id FROM food_category where name = \'{category}\' ') idCategory = cursor.fetchmany() cursor.execute(f""" @@ -252,7 +258,8 @@ def update_makanan(request, foodname): bahanArr.remove("") for bahan in bahanArr: - cursor.execute(f'select id FROM ingredient where name = \'{bahan}\' ') + cursor.execute( + f'select id FROM ingredient where name = \'{bahan}\' ') bahanIns = cursor.fetchall() cursor.execute(f""" @@ -265,7 +272,8 @@ def update_makanan(request, foodname): click = request.POST['click'] for x in range(int(click)): ingredient = request.POST[f'select-{x}'] - cursor.execute(f'select id FROM ingredient where name = \'{ingredient}\' ') + cursor.execute( + f'select id FROM ingredient where name = \'{ingredient}\' ') idBahan = cursor.fetchmany() cursor.execute(f""" @@ -278,32 +286,34 @@ def update_makanan(request, foodname): """) connection.commit() - return redirect("/trigger3/daftarmakanan") - cursor.execute(f'select name FROM FOOD_CATEGORY') - kategoriAll = cursor.fetchall() + kategoriAll = cursor.fetchall() cursor.execute(f'select name FROM INGREDIENT') bahanAll = cursor.fetchall() - cursor.execute(f'select i.name FROM food_ingredient fi, ingredient i where fi.foodname = \'{foodname}\' and fi.ingredient = i.id') + cursor.execute( + f'select i.name FROM food_ingredient fi, ingredient i where fi.foodname = \'{foodname}\' and fi.ingredient = i.id') bahanSelected = cursor.fetchall() context = { - 'foodname' : record[0][2], - 'description' : record[0][3], - 'stock' : record[0][4], - 'price' : record[0][5], - 'foodcategory' : record[0][6], - 'bahanMakanan' : bahanAll, + 'foodname': record[0][2], + 'description': record[0][3], + 'stock': record[0][4], + 'price': record[0][5], + 'foodcategory': record[0][6], + 'bahanMakanan': bahanAll, 'jsonBahan': json.dumps(bahanAll), - 'kategoriMakanan' : kategoriAll, - 'bahanUsed' : bahanSelected, - 'adminid': adminid, + 'kategoriMakanan': kategoriAll, + 'bahanUsed': bahanSelected, + 'rname': request.COOKIES.get('rname'), + 'rbranch': request.COOKIES.get('rbranch'), + 'adminid': request.COOKIES.get('adminid'), 'role': role } return render(request, "update_makanan.html", context) + def delete_makanan(request, foodname): cursor.execute('set search_path to sirest') role = request.COOKIES.get('role') @@ -311,8 +321,7 @@ def delete_makanan(request, foodname): return redirect("/login") if role != 'restaurant': return redirect("/") - - + cursor.execute(f""" DELETE FROM FOOD WHERE FoodName = '{foodname}' @@ -322,6 +331,7 @@ def delete_makanan(request, foodname): connection.commit() return redirect("/trigger3/daftarmakanan") + def daftar_restoran(request): cursor.execute('set search_path to sirest') role = request.COOKIES.get('role') @@ -334,12 +344,15 @@ def daftar_restoran(request): cursor.execute(f'select * from restaurant') record = cursor.fetchall() context = { - 'dataRestoran' : record, - 'adminid': adminid, + 'dataRestoran': record, + 'rname': request.COOKIES.get('rname'), + 'rbranch': request.COOKIES.get('rbranch'), + 'adminid': request.COOKIES.get('adminid'), 'role': role } return render(request, "daftar_restoran_cust.html", context) + def menu_restoran_cust(request, rname, rbranch): cursor.execute('set search_path to sirest') role = request.COOKIES.get('role') @@ -349,18 +362,19 @@ def menu_restoran_cust(request, rname, rbranch): if role == 'restaurant': return redirect("/") - - cursor.execute(f'select f.foodname, f.description, f.stock, f.price, fg.name, string_agg(i.name, \', \') from food f, food_category fg, food_ingredient fi, ingredient i where f.stock > 0 and f.rbranch = \'{rbranch}\' and f.rname = \'{rname}\' and fg.id = f.fcategory and f.rbranch = fi.rbranch and f.rname = fi.rname and f.foodname = fi.foodname and fi.Ingredient = i.id group by f.foodname, f.description, f.stock, f.price, fg.name') + cursor.execute( + f'select f.foodname, f.description, f.stock, f.price, fg.name, string_agg(i.name, \', \') from food f, food_category fg, food_ingredient fi, ingredient i where f.stock > 0 and f.rbranch = \'{rbranch}\' and f.rname = \'{rname}\' and fg.id = f.fcategory and f.rbranch = fi.rbranch and f.rname = fi.rname and f.foodname = fi.foodname and fi.Ingredient = i.id group by f.foodname, f.description, f.stock, f.price, fg.name') record = cursor.fetchall() context = { - 'dataMenu' : record, - 'rname' : rname, - 'rbranch' : rbranch, - 'adminid': adminid, + 'dataMenu': record, + 'rname': request.COOKIES.get('rname'), + 'rbranch': request.COOKIES.get('rbranch'), + 'adminid': request.COOKIES.get('adminid'), 'role': role } return render(request, "menu_restoran_cust.html", context) + def detail_restoran(request, rname, rbranch): cursor.execute('set search_path to sirest') role = request.COOKIES.get('role') @@ -370,12 +384,15 @@ def detail_restoran(request, rname, rbranch): if role == 'restaurant': return redirect("/") - cursor.execute(f'select * from restaurant r, restaurant_category rc, restaurant_operating_hours ros where r.rname = \'{rname}\' and r.rbranch = \'{rbranch}\' and r.rcategory = rc.id and r.rname = ros.name and r.rbranch = ros.branch') + cursor.execute( + f'select * from restaurant r, restaurant_category rc, restaurant_operating_hours ros where r.rname = \'{rname}\' and r.rbranch = \'{rbranch}\' and r.rcategory = rc.id and r.rname = ros.name and r.rbranch = ros.branch') records = cursor.fetchmany() context = { - 'dataRestoran' : records, - 'adminid': adminid, + 'dataRestoran': records, + 'rname': request.COOKIES.get('rname'), + 'rbranch': request.COOKIES.get('rbranch'), + 'adminid': request.COOKIES.get('adminid'), 'role': role } - + return render(request, "detail_restoran.html", context) diff --git a/trigger5/views.py b/trigger5/views.py index d64be6a..2c3c36e 100644 --- a/trigger5/views.py +++ b/trigger5/views.py @@ -314,9 +314,9 @@ def daftar_bahanmakanan(request): context = { 'list_ingredient': final_data_ingredient, 'role':request.COOKIES.get('role'), - #'adminid': adminid, - #'rname': request.COOKIES.get('rname'), - #'rbranch': request.COOKIES.get('rbranch'), + 'adminid': request.COOKIES.get('adminid'), + 'rname': request.COOKIES.get('rname'), + 'rbranch': request.COOKIES.get('rbranch'), } return render(request, "daftar_bahanmakanan.html", context) -- GitLab