Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating readem #1

Merged
merged 7 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# GeraiPi
Gerai Pi Indonesia is one of the P2App Marketplaces which will become a Digitalization Transaction Bridge driven by Pi Coin as a Crypto Currency by prioritizing Trust in the Indonesian Pi/Pioneer Community

# Developer of Geraipi
Binary file added frontend/static/video.mp3
Binary file not shown.
Binary file added frontend/static/video.mp4
Binary file not shown.
Binary file removed frontend/static/videos.mp4
Binary file not shown.
59 changes: 48 additions & 11 deletions frontend/templates/splash.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,63 @@
transform: scale(1, 1);
}
}
.container-mobile{
background: transparent;
}
</style>
<img src="{% static 'geraigif.gif' %}" alt="" style="height: 100vh; width: 450px;">
<!-- <video id="mvideo" autoplay muted style="max-width: 450px;">
<source src="{% static 'videos.mp4' %}" type="video/mp4"/>
</video> -->
<!-- <img src="{% static 'geraigif.gif' %}" alt="" style="height: 100vh; width: 450px;"> -->
<div style="max-width: 450px; height: 100vh;">
<video id="mvideo" autoplay style="width: 100%; height: 100vh;" muted>
<source src="{% static 'video.mp4' %}" type="video/mp4"/>
</video>
</div>
<!-- <div class="justify-center flex-1 justify-items-center h-screen flex items-center">
<img src="{% static 'logo_tunggal.png' %}" class="w-24 h-24 mt-auto mb-auto zoom-in-out-box" />
</div> -->
{% endblock %} {% block script %}
<script>
// window.onload = function(){
// var promise = document.getElementById('mvideo').play();

// if (promise !== undefined) {
// promise.then(_ => {
// // Autoplay started!
// console.log("started")
// document.getElementById('mvideo').play();
// }).catch(error => {
// console.log("prevented")
// document.getElementById('mvideo').muted = false;
// document.getElementById('mvideo').play();
// // Autoplay was prevented.
// // Show a "Play" button so that user can start playback.
// });
// }
// }
// document.getElementById('mvideo').addEventListener('playing',myHandlerplay,false);
// function myHandlerplay(e) {
// // alert("hello")
// document.getElementById('aud').play()
// // window.location = '/home'
// // What you want to do after the event
// }
document.getElementById('mvideo').addEventListener('ended',myHandler,false);
function myHandler(e) {
// alert("hello")
window.location = '/home'
// What you want to do after the event
}
// $(window).on('load', function(){
// })
total = 2
timeinterval = setInterval(function () {
// timeinterval = setInterval(function () {

total = --total;
// total = --total;

if (total <= 0) {
clearInterval(timeinterval);
window.location = '/home';
}
}, 14000);
// if (total <= 0) {
// clearInterval(timeinterval);
// window.location = '/home';
// }
// }, 14000);
// document.getElementById('mvideo').addEventListener('ended',myHandler,false);
// function myHandler(e) {
// console.log("hello")
Expand Down
54 changes: 27 additions & 27 deletions frontend/views/payments_cart_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,33 +58,33 @@ def get(self, request, param):
cart_id = request.GET.get("cart_id")
requestjson = requestdata.json()
result_dict = json.loads(str(json.dumps(requestjson)))
try:
carts = CartItem.objects.get(pk=cart_id)
print(carts, cart_id)
CartItem.objects.get(cart__id=carts.id)
from django.core.mail import EmailMessage
from django.template.loader import render_to_string

# print(carts, cartitems)
subject, from_email, to = (
"Payment Success GeraiPi",
"[email protected]",
request.user.email,
)
html_message = render_to_string("mail_template.html", {"carts": carts})
# # plain_message = strip_tags(html_message)
# # mail.send_mail(subject,
# # plain_message,
# # from_email,
# # [to],
# # html_message=html_message)

msg = EmailMessage(subject, html_message, from_email, [to])
msg.content_subtype = "html"
msg.send()

except CartItem.DoesNotExist or Exception as e:
print(e)
# try:
# carts = CartItem.objects.get(pk=cart_id)
# print(carts, cart_id)
# CartItem.objects.get(cart__id=carts.id)
# from django.core.mail import EmailMessage
# from django.template.loader import render_to_string

# # print(carts, cartitems)
# subject, from_email, to = (
# "Payment Success GeraiPi",
# "[email protected]",
# request.user.email,
# )
# html_message = render_to_string("mail_template.html", {"carts": carts})
# # # plain_message = strip_tags(html_message)
# # # mail.send_mail(subject,
# # # plain_message,
# # # from_email,
# # # [to],
# # # html_message=html_message)

# msg = EmailMessage(subject, html_message, from_email, [to])
# msg.content_subtype = "html"
# msg.send()

# except CartItem.DoesNotExist or Exception as e:
# print("error")

txid = result_dict.get("transaction")
txid = json.loads(str(json.dumps(txid)))
Expand Down
94 changes: 53 additions & 41 deletions frontend/views/toko_transaksi_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,48 +52,58 @@ def post(self, request, id):
code_expedisi = Expedisi.objects.get(
id=request.POST.get("expedisi")
)
if code_expedisi.source_request == 1:
cekresi = cekinit.check_resi(
resi=resi, courier=code_expedisi.code
)
if cekresi.status_code != 200:
return redirect(
reverse(
"transaksi_toko",
kwargs={"id": str(request.user.id)},
) + "?status=" + str(status)
if not konfigurasi.bypass_expedisi:
if code_expedisi.source_request == 1:
cekresi = cekinit.check_resi(
resi=resi, courier=code_expedisi.code
)
else:
messages.success(request, "Nomor resi valid")
cart.save()
return redirect(
reverse(
"transaksi_toko",
kwargs={"id": str(request.user.id)},
) + "?status=" + str(status)
if cekresi.status_code != 200:
return redirect(
reverse(
"transaksi_toko",
kwargs={"id": str(request.user.id)},
) + "?status=" + str(status)
)
else:
messages.success(request, "Nomor resi valid")
cart.save()
return redirect(
reverse(
"transaksi_toko",
kwargs={"id": str(request.user.id)},
) + "?status=" + str(status)
)
elif code_expedisi.source_request == 2:
cekinit.api = konfigurasi.api_biteship
cekresi = cekinit.check_resi_bitesip(
resi=resi, courier=code_expedisi.code
)
elif code_expedisi.source_request == 2:
cekinit.api = konfigurasi.api_biteship
cekresi = cekinit.check_resi_bitesip(
resi=resi, courier=code_expedisi.code
if cekresi.status_code != 200:
cart.save()
messages.success(request, "Nomor resi valid")
return redirect(
reverse(
"transaksi_toko",
kwargs={"id": str(request.user.id)},
) + "?status=" + str(status)
)
else:
messages.error(request, "Sorry, Nomor resi tidak valid")
return redirect(
reverse(
"transaksi_toko",
kwargs={"id": str(request.user.id)},
) + "?status=" + str(status)
)
else:
cart.save()
messages.success(request, "Nomor resi valid")
return redirect(
reverse(
"transaksi_toko",
kwargs={"id": str(request.user.id)},
) + "?status=" + str(status)
)
if cekresi.status_code != 200:
cart.save()
messages.success(request, "Nomor resi valid")
return redirect(
reverse(
"transaksi_toko",
kwargs={"id": str(request.user.id)},
) + "?status=" + str(status)
)
else:
messages.error(request, "Sorry, Nomor resi tidak valid")
return redirect(
reverse(
"transaksi_toko",
kwargs={"id": str(request.user.id)},
) + "?status=" + str(status)
)
else:
messages.error(request, "Sorry, please input your number")
return redirect(
Expand All @@ -106,8 +116,10 @@ def post(self, request, id):
cart.status = 3
cart.tanggal_selesai = datetime.datetime.now()
# cart.status_toko = 4

self.send_mail(request)
try:
self.send_mail(request)
except Exception as e:
print(e)
cart.save()
return redirect("/toko/" + str(request.user.id) + "/transaksi/")

Expand Down
1 change: 1 addition & 0 deletions master/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class ConfigurationWebsite(SingletonModel):

api_biteship = models.CharField(blank=True, null=True, max_length=255)
verification = models.CharField(blank=True, null=True, max_length=255)
bypass_expedisi = models.BooleanField(default=False)


class HistoriTampung(models.Model):
Expand Down
2 changes: 1 addition & 1 deletion templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
<script src="{% static 'splide/dist/js/splide.min.js' %}"></script>
<script src="{% static 'loading/loading-bar.js' %}"></script>
<script>
Pi.init({ version: "2.0", sandbox: {% env "SANDBOX" %} });
Pi.init({ version: "2.0", sandbox: false });
</script>

<!--Start of Tawk.to Script-->
Expand Down
Loading