Skip to content

Commit

Permalink
update migration
Browse files Browse the repository at this point in the history
  • Loading branch information
roniahmadi committed Jun 17, 2024
1 parent 4f07050 commit 064addc
Show file tree
Hide file tree
Showing 19 changed files with 4,385 additions and 4 deletions.
46 changes: 46 additions & 0 deletions frontend/templates/member/register.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{% extends 'layout.html' %}
{% load static %}
{% block content %}
<div class="container p-4">
<div class="">
<div class="grid grid-cols-1 gap-1 shadow-lg pb-2 border rounded-lg p-3">
<p><strong>GeraiPi Army Uniform</strong></p>
<p>
<strong>GeraiPi Army Uniform</strong> adalah salah satu bentuk <strong>Identitas Ekosistem Utilitas Pi</strong> sekalikus <strong>Kebanggaan Pioner</strong> bisa bergabung dan berkontribusi sebagai <strong>Penyedia layanan ( Vendor Produk )</strong> Melalui GeraiPi Indonesia Marketplace.
</p>
<p>
Manfaat <strong>GeraiPi Army Uniform</strong>:
<ul style="list-style: circle; padding:revert;">
<li>
Mendapatkan <strong>Unique Code</strong> untuk Verifikasi Otomatis Tanpa antrian Validasi saat mendaftar Vendor dan siap berdagang di Layanan Gerai Pi Indonesia Marketplace
</li>
<li>
Bebas/<strong>GRATIS Fee Withdrawal Pi Coin</strong> untuk 5X Transaksi
</li>
<li>
Mendapatkan <strong>Souvenir</strong> dari Gerai Pi Indonesia
</li>
<li>Mendapatkan <strong>Informasi Update</strong> Gerai Pi Indonesia</li>
</ul>
</p>
<p>
<strong>Gerai Pi Army Uniform hanya 100 Kuota</strong>
</p>
<p>
Segera Daftarkan !!! 10 Pendaftar Pertama <strong>Bonus Voucher Pulsa GRATIS @10.000</strong>
</p>
{% if register %}
<button class="bg-slate-400 text-white" >Dalam Proses</button>
{% else %}
<form action="" method="POST">
{% csrf_token %}
<input type="hidden" name="applied" value="0" />
<button type="submit" class="bg-green-600 text-center p-3 mt-8 rounded">Daftar</button>
</form>
{% endif %}

</div>
</div>
</div>
{% endblock %}
{% block script %}{% endblock %}
24 changes: 24 additions & 0 deletions frontend/templates/member/register_code_input.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{% extends 'layout.html' %}
{% load static %}
{% block content %}
<div class="container p-4">
<div class="h-full">
<div class="grid grid-cols-1 gap-1 shadow-lg pb-2 border rounded-lg p-3">
<p><strong>Input Code Form</strong></p>
<p>
<strong>GeraiPi Army Uniform</strong> adalah salah satu bentuk <strong>Identitas Ekosistem Utilitas Pi</strong> sekalikus <strong>Kebanggaan Pioner</strong> bisa bergabung dan berkontribusi sebagai <strong>Penyedia layanan ( Vendor Produk )</strong> Melalui GeraiPi Indonesia Marketplace.
</p>
<form action="" method="POST">
{% csrf_token %}
<input type="text" name="applied" value="" required class="w-full my-4 rounded-lg"/>
<button type="submit" class="bg-green-600 text-center p-3 rounded w-full text-white">Submit Code</button>
</form>
<a class="bg-red-600 text-center p-2 rounded text-white w-full" href="{% url 'register_member' %}">Batal</a>

</div>
</div>
</div>
{% endblock %}
{% block script %}{% endblock %}
{% block bottom_nav %}
{% endblock %}
1 change: 1 addition & 0 deletions frontend/templates/profil/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ <h6 class="font-bold">{% translater user.languages.code "profile_setting_title"
<a href="/profile/alamat" class="no-underline p-2 hover:bg-slate-200 rounded color-black bg-slate-100">{% translater user.languages.code "profile_menu_alamat_saya" "Alamat Saya" %}</a>
<a href="{% url 'transaksi_users' %}" class="no-underline p-2 rounded color-black bg-slate-100 hover:bg-slate-200">{% translater user.languages.code "profile_menu_transaksi_saya" "Transaksi" %}</a>
<a href="/faq/" class="no-underline p-2 rounded color-black bg-slate-100 hover:bg-slate-200">FAQ</a>
<a href="/member/" class="no-underline p-2 rounded color-black bg-slate-100 hover:bg-slate-200">Register Membership</a>
</div>

<div class="text-sm gap-2 border shadow-lg rounded-lg p-4 grid">
Expand Down
4 changes: 4 additions & 0 deletions frontend/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
from frontend.views.withdrawl_toko_view import WithdrawlToko
from frontend.views.withdrawl_view import Withdrawl
from frontend.views.withdrawltokojson_view import WithdrawlTokoJson
from frontend.views.profile.register_member import RegisterMember
from frontend.views.profile.register_member_code import RegisterMemberCode

urlpatterns = [
path("", Splash.as_view(), name="splash"),
Expand Down Expand Up @@ -168,6 +170,8 @@
path("cancel/<str:id>", Cancel.as_view(), name="cancel"),
path("completing/<str:id>", CompletePayment.as_view(), name="completing"),
path("faq/", Faq.as_view(), name="faq"),
path("member/", RegisterMember.as_view(), name="register_member"),
path("member/code/", RegisterMemberCode.as_view(), name="register_member_code"),
path(
"transaksi/users/list/json",
TransaksiUserJson.as_view(),
Expand Down
38 changes: 38 additions & 0 deletions frontend/views/profile/register_member.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect, render
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from profiles.models import UserAppliedMember, UserCodeGenerator
from ..base_view import FrontPage
import datetime


@method_decorator(csrf_exempt, name="dispatch")
@method_decorator(login_required, name="dispatch")
class RegisterMember(FrontPage):
def post(self, request):
userprofile = request.user
userapplied = UserAppliedMember()
userapplied.user = userprofile
userapplied.is_accept = False
userapplied.accept_date = datetime.datetime.now()
userapplied.save()
return redirect(reverse("register_member"))

def get(self, request):
applied = UserAppliedMember.objects.filter(user_id=request.user.id, is_accept=False)
accept = False
if applied.exists():
applied = applied.first()
accept = True
code = UserCodeGenerator.objects.filter(user_id=request.user.id, is_active=True)
if code.exists():
codes = code.first()
if codes.is_active:
return redirect(reverse('profile'))
return render(
request,
"member/register.html",
{"register":accept}
)
30 changes: 30 additions & 0 deletions frontend/views/profile/register_member_code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect, render
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from profiles.models import UserAppliedMember
from ..base_view import FrontPage
import datetime


@method_decorator(csrf_exempt, name="dispatch")
@method_decorator(login_required, name="dispatch")
class RegisterMemberCode(FrontPage):
def post(self, request):
userprofile = request.user
userapplied = UserAppliedMember()
userapplied.user = userprofile
userapplied.is_accept = False
userapplied.accept_date = datetime.datetime.now()
userapplied.save()
return redirect(reverse("register_member"))

def get(self, request):
applied = UserAppliedMember.objects.filter(user_id=request.user.id, is_accept=True)
if not applied.exists():
return redirect(reverse("register_member"))
return render(
request,
"member/register_code_input.html"
)
4 changes: 4 additions & 0 deletions master/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ class Negara(models.Model):
kode = models.CharField(max_length=50)
nama = models.CharField(max_length=100)

class VoucherConfig(models.Model):
generate_code = models.CharField(max_length=50)
has_access_store = models.BooleanField(default=False)
is_active = models.BooleanField(default=True)

# class Tampung(models.Model):
# history_tampung = models.CharField(max_length=)
8 changes: 8 additions & 0 deletions profiles/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
UserProfileAddress,
UserWithdrawlTransaction,
UserwithdrawlTransactionRequest,
UserCodeGenerator,
UserAppliedMember,
UserSettingsMember,
)


Expand Down Expand Up @@ -219,3 +222,8 @@ class LangSupportAdmin(admin.ModelAdmin):


admin.site.register(LangSupport, LangSupportAdmin)


admin.site.register(UserAppliedMember)
admin.site.register(UserCodeGenerator)
admin.site.register(UserSettingsMember)
40 changes: 40 additions & 0 deletions profiles/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,43 @@ class UserwithdrawlTransactionRequest(models.Model):

def __str__(self):
return str(self.kode)

class UserAppliedMember(models.Model):
user = models.ForeignKey(UserProfile, on_delete=models.SET_NULL, blank=True, null=True)
tanggal = models.DateTimeField(auto_now=True, auto_created=True)
is_accept = models.BooleanField(default=False)
accept_date = models.DateTimeField(auto_now=False, blank=True, null=True)

def save(self, *args, **kwargs):
if self.is_accept:
self.create_generator()
super(UserAppliedMember, self).save(*args, **kwargs) # Call the real save() method

def create_generator(self):
usergenerator = UserCodeGenerator()
usergenerator.code = get_random()
usergenerator.user = self.user
usergenerator.user_apply_id = self.pk
usergenerator.quota_withdrawl = 5
usergenerator.bypass_waiting = True
usergenerator.updated_information = True
usergenerator.is_active = True
usergenerator.save()

class UserCodeGenerator(models.Model):
user_apply = models.ForeignKey(UserAppliedMember, on_delete=models.SET_NULL, blank=True, null=True)
code = models.CharField(max_length=50)
quota_withdrawl = models.IntegerField(default=0)
bypass_waiting = models.BooleanField(default=False)
updated_information = models.BooleanField(default=False)
is_active = models.BooleanField(default=True)

def save(self, *args, **kwargs):
super(UserCodeGenerator, self).save(*args, **kwargs)

class UserSettingsMember(models.Model):
code = models.CharField(blank=True, null=True, max_length=50)
user = models.ForeignKey(UserProfile, on_delete=models.CASCADE, blank=True, null=True)
quota_withdrawl = models.IntegerField(default=0)
bypass_waiting = models.BooleanField(default=False)
updated_information = models.BooleanField(default=False)
52 changes: 52 additions & 0 deletions templatenew/templates/component/bottom_page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{% load static translater%}
<nav class="h-auto bg-black bottom-0 pt-4 pb-1 shadow-md sticky max-w-[450px]">
{% with request.resolver_match.url_name as url_name %}
<ul class="d-flex items-center justify-content-evenly text-sm">
<li>
<a href="/home" class="{% if url_name == 'home' %}text-[#b50795]{% else %}text-white hover:text-slate-900{% endif %} align-items-center d-flex flex-column">
<div>
<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 256 256">
<path fill="currentColor" d="m221.56 100.85l-79.95-75.47l-.16-.15a19.93 19.93 0 0 0-26.91 0l-.17.15l-79.93 75.47a20.07 20.07 0 0 0-6.44 14.7V208a20 20 0 0 0 20 20h48a20 20 0 0 0 20-20v-44h24v44a20 20 0 0 0 20 20h48a20 20 0 0 0 20-20v-92.45a20.07 20.07 0 0 0-6.44-14.7ZM204 204h-40v-44a20 20 0 0 0-20-20h-32a20 20 0 0 0-20 20v44H52v-86.72l76-71.75l76 71.75Z" />
</svg>
</div>
<div>
{% translater user.languages.code "bottombar_home" "Home" %}
</div>
</a>
</li>
<li>
<a href="/produk" class="{% if url_name == 'produk' %}text-[#b50795]{% else %}text-white hover:text-slate-900{% endif %} items-center flex flex-col">
<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 14 14"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M12.88 12.39a1 1 0 0 1-.25.78a1 1 0 0 1-.75.33H2.12a1 1 0 0 1-.75-.33a1 1 0 0 1-.25-.78L2 4.5h10ZM4.5 4.5V3a2.5 2.5 0 0 1 5 0v1.5"/></svg>
{% translater user.languages.code "bottombar_produk" "Produk" %}
</a>
</li>
<li class=" rounded-full w-10 ">

<a href="/jual/" class="{% if url_name == 'jual' %}text-[#b50795]{% else %}text-white hover:text-slate-900{% endif %} items-center flex flex-col relative">
<span class="flex items-center justify-center border-[6px] border-black bg-[#F19400] text-white p-5 rounded-full absolute -translate-y-12">
<svg xmlns="http://www.w3.org/2000/svg" width="23" height="23" viewBox="0 0 24 24"><path fill="currentColor" d="M11 6H9q-.425 0-.713-.288T8 5q0-.425.288-.713T9 4h2V2q0-.425.288-.713T12 1q.425 0 .713.288T13 2v2h2q.425 0 .713.288T16 5q0 .425-.288.713T15 6h-2v2q0 .425-.288.713T12 9q-.425 0-.713-.288T11 8V6ZM7 22q-.825 0-1.413-.588T5 20q0-.825.588-1.413T7 18q.825 0 1.413.588T9 20q0 .825-.588 1.413T7 22Zm10 0q-.825 0-1.413-.588T15 20q0-.825.588-1.413T17 18q.825 0 1.413.588T19 20q0 .825-.588 1.413T17 22ZM3 4H2q-.425 0-.713-.288T1 3q0-.425.288-.713T2 2h1.65q.275 0 .525.15t.375.425L8.525 11h7l3.625-6.5q.125-.25.35-.375T20 4q.575 0 .863.488t.012.987L17.3 11.95q-.275.5-.738.775T15.55 13H8.1L7 15h11q.425 0 .713.288T19 16q0 .425-.288.713T18 17H7q-1.125 0-1.713-.975T5.25 14.05L6.6 11.6L3 4Z"/></svg>

</span>
<span class="mt-5">
{% translater user.languages.code "bottombar_jual" "Jual" %}
</span>

</a>
</li>
<li>
<a href="/tutorial" class="{% if url_name == 'tutorial' %}text-[#b50795]{% else %}text-white hover:text-slate-900{% endif %} items-center flex flex-col">
<svg width="30" height="30" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="currentColor" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8zm-2-3.5l6-4.5l-6-4.5z"/></svg>
{% translater user.languages.code "bottombar_about_us" "About Us" %}
</a>
</li>
<li>
{% comment %} <a href="{% url 'profile' %}"> {% endcomment %}
<a href="#" class="{% if url_name == 'profile' %}text-[#b50795]{% else %}text-white hover:text-slate-900{% endif %} items-center flex flex-col">
<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 -960 960 960"><path fill="currentColor" d="M80-80v-720q0-33 23.5-56.5T160-880h640q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H240L80-80Zm126-240h594v-480H160v525l46-45Zm-46 0v-480 480Z"/>
</svg>
{% translater user.languages.code "bottombar_chat" "Chat" %}
</a>
</li>
</ul>
{% endwith %}
</nav>
39 changes: 39 additions & 0 deletions templatenew/templates/component/navbar_page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% load static %}
<nav class="position-sticky py-3 top-0 d-flex flex-column" style="z-index:99999px; background-color:#F19400;">
<div class="d-flex flex-row justify-content-between px-4 gap-2 align-items-center" style="">
<div class="bg-white border-2 p-1 rounded-circle" style="">
<a href="/home">
<img src="{% static 'logo_tunggal.png' %}" alt="" style="width: 40px" />
</a>
</div>
<div class="position-relative d-flex justify-content-between align-items-center rounded-pill" style="">
<span class="position-absolute text-slate-600 translate-x-2" style="left:10px;">
<svg xmlns="http://www.w3.org/2000/svg" width="20" viewBox="0 0 24 24"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m21 21l-4.343-4.343m0 0A8 8 0 1 0 5.343 5.343a8 8 0 0 0 11.314 11.314Z" /></svg>
</span>
<form action="" method="get">
<input type="search" name="q" class="w-full border-0 pl-8 bg-slate-100 rounded-pill focus:ring-0" placeholder="Search Product..." value="{{ request.GET.q }}" style="--tw-bg-opacity: 1; background-color:rgb(241 245 249 ); height:35px; padding-left:35px;"/>
</form>
</div>

{% comment %}
<a href="/beli/" class="text-white hover:text-fuchsia-700 min-w-[44px] p-2 hover:bg-slate-200/30 rounded-full">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="currentColor" d="m15.37 3.44l3.212 5.562h3.423v2h-1.167l-.757 9.083a1 1 0 0 1-.996.917H4.925a1 1 0 0 1-.997-.917l-.757-9.083H2.005v-2h3.422L8.639 3.44l1.732 1l-2.634 4.562h8.535L13.639 4.44l1.732-1Zm3.46 7.562H5.179l.667 8h12.319l.667-8Zm-5.825 2v4h-2v-4h2Zm-4 0v4h-2v-4h2Zm8 0v4h-2v-4h2Z" />
</svg>
</a>
{% endcomment %}
<div class="relative" style="position: relative;">
<a href="" class="{% if url_name == 'profile' %}text-[#b50795]{% else %}text-white hover:text-slate-900{% endif %} items-center flex flex-col" style="display: flex; flex-direction: column; align-items: center;">
<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 24 24">
<path
fill="currentColor"
fill-rule="evenodd"
d="M12 4a8 8 0 0 0-6.96 11.947A4.99 4.99 0 0 1 9 14h6a4.99 4.99 0 0 1 3.96 1.947A8 8 0 0 0 12 4Zm7.943 14.076A9.959 9.959 0 0 0 22 12c0-5.523-4.477-10-10-10S2 6.477 2 12a9.958 9.958 0 0 0 2.057 6.076l-.005.018l.355.413A9.98 9.98 0 0 0 12 22a9.947 9.947 0 0 0 5.675-1.765a10.055 10.055 0 0 0 1.918-1.728l.355-.413l-.005-.018ZM12 6a3 3 0 1 0 0 6a3 3 0 0 0 0-6Z"
clip-rule="evenodd" />
</svg>
Profile
</a>
</div>
</div>
<div id="google_translate_element"></div>
</nav>
1 change: 1 addition & 0 deletions templatenew/templates/home/page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends "template.html" %}
Loading

0 comments on commit 064addc

Please sign in to comment.