Skip to content

Commit

Permalink
Update a load of js
Browse files Browse the repository at this point in the history
  • Loading branch information
rebkwok committed Sep 16, 2023
1 parent 8dbcaa9 commit 54f020f
Show file tree
Hide file tree
Showing 27 changed files with 180 additions and 201 deletions.
4 changes: 1 addition & 3 deletions booking/views/checkout_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ def stripe_checkout(request):
# Create the Stripe PaymentIntent
stripe.api_key = settings.STRIPE_SECRET_KEY
seller = Seller.objects.filter(site=Site.objects.get_current(request)).first()

context = {}
if seller is None:
logger.error("No seller found on Stripe checkout attempt")
Expand All @@ -338,7 +337,6 @@ def stripe_checkout(request):
total_as_int = int(total * 100)

payment_intent_data = {
"payment_method_types": ['card'],
"amount": total_as_int,
"currency": 'gbp',
"stripe_account": stripe_account,
Expand Down Expand Up @@ -374,7 +372,7 @@ def stripe_checkout(request):
logger.info("Updating payment intent")
payment_intent = stripe.PaymentIntent.modify(
invoice.stripe_payment_intent_id, **payment_intent_data,
)
)
except stripe.error.InvalidRequestError as error:
payment_intent = stripe.PaymentIntent.retrieve(
invoice.stripe_payment_intent_id, stripe_account=stripe_account
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1866,3 +1866,18 @@ span.disclaimer_version {
div.message.alert > p {
margin-bottom: 0;
}

.stripe-checkout-btn {
border: #625afa solid 1px;
background-color: #625afa;
color: white;
border-radius: 6px;
padding-left: 20px;
padding-right: 20px;
}

.stripe-checkout-btn:hover {
border: #625afa solid 1px;
background-color: white;
color: #625afa;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Date.prototype.dateFormat = function( format ){

var timeoutID;

var $jq = jQuery.noConflict();

function timeoutShoppingBasket() {
var bookingsPaypalForm = document.getElementById("checkout-bookings-total-and-paypalform");
var blocksPaypalForm = document.getElementById("checkout-blocks-total-and-paypalform");
Expand All @@ -25,95 +27,114 @@ function timeoutShoppingBasket() {
}


jQuery(document).ready(function () {
$jq(function () {

timeoutID = window.setTimeout(timeoutShoppingBasket, 60*1000);

// jQuery.scrollTrack();
$jq(function() {
// messages timeout for 5 sec
setTimeout(function() {
$jq('#message-row').fadeOut('slow');
}, 5000); // <-- time in milliseconds, 1000 = 1 sec
});

// blocks modal in menu bar
$jq(".blockmodalbtn").on("click", function(ev) { // for each edit url
ev.preventDefault(); // prevent navigation
var url = $jq(this).data("url"); // get the form url
$jq("#BlocksModal").load(url, function() { // load the url into the modal
$jq(this).modal('show'); // display the modal on url load
});
return false; // prevent the click propagation
});

$jq(function () {
$jq('[data-toggle="tooltip"]').tooltip()
})

jQuery('form.dirty-check').areYouSure();
$jq('form.dirty-check').areYouSure();

jQuery('#datetimepicker').datetimepicker({
$jq('#datetimepicker').datetimepicker({
format:'D MMM YYYY HH:mm',
sideBySide: true
});
jQuery('#start_datetimepicker').datetimepicker({
$jq('#start_datetimepicker').datetimepicker({
format:'D MMM YYYY HH:mm',
sideBySide: true
});
jQuery('#end_datetimepicker').datetimepicker({
$jq('#end_datetimepicker').datetimepicker({
format:'D MMM YYYY HH:mm',
sideBySide: true
});

jQuery('#datepicker').datetimepicker({
$jq('#datepicker').datetimepicker({
format:'D MMM YYYY',
});

jQuery('.blockdatepicker').datetimepicker({
$jq('.blockdatepicker').datetimepicker({
format:'D MMM YYYY',
widgetPositioning: {
horizontal: 'left',
vertical: 'bottom'
}
});

jQuery('#datepicker1').datetimepicker({
$jq('#datepicker1').datetimepicker({
format:'D MMM YYYY',
});

jQuery('#logdatepicker').datetimepicker({
$jq('#logdatepicker').datetimepicker({
format:'D-MMM-YYYY',
});

for(var i = 0; i < 5; i++) {
jQuery('#datepicker_startdate_' + i).datetimepicker({
$jq('#datepicker_startdate_' + i).datetimepicker({
format:'ddd D MMM YYYY',
useCurrent: true
});

jQuery('#datepicker_enddate_' + i).datetimepicker({
$jq('#datepicker_enddate_' + i).datetimepicker({
format:'ddd D MMM YYYY',
});
}

jQuery('#datepicker_registerdate').datetimepicker({
$jq('#datepicker_registerdate').datetimepicker({
format:'ddd D MMM YYYY',
useCurrent: true
});

jQuery('#timepicker').datetimepicker({
$jq('#timepicker').datetimepicker({
format:'HH:mm',
});

jQuery('#dobdatepicker').datetimepicker({
$jq('#dobdatepicker').datetimepicker({
format:'D MMM YYYY',
defaultDate: '1990/01/01',
});

jQuery('#eventdatepicker').datetimepicker({
$jq('#eventdatepicker').datetimepicker({
format:'D MMM YYYY',
});

//http://tablesorter.com/docs/
jQuery("#sortTable").tablesorter();
$jq("#sortTable").tablesorter();

jQuery('#select-all').click(function (event) { //on click
$jq('#select-all').click(function (event) { //on click
if (this.checked) { // check select status
jQuery('.select-checkbox').each(function () { //loop through each checkbox
$jq('.select-checkbox').each(function () { //loop through each checkbox
this.checked = true; //select all checkboxes with class "select-checkbox"
});
} else {
jQuery('.select-checkbox').each(function () { //loop through each checkbox
$jq('.select-checkbox').each(function () { //loop through each checkbox
this.checked = false; //deselect all checkboxes with class "select-checkbox"
});
}
});

jQuery('.collapse')
$jq('.collapse')
.on('shown.bs.collapse', function() {
if(this.id) {
jQuery(this)
$jq(this)
.parent()
.find("." + this.id + ".fa-plus-square")
.removeClass("fa-plus-square")
Expand All @@ -122,7 +143,7 @@ jQuery(document).ready(function () {
})
.on('hidden.bs.collapse', function() {
if(this.id) {
jQuery(this)
$jq(this)
.parent()
.find("." + this.id + ".fa-minus-square")
.removeClass("fa-minus-square")
Expand All @@ -134,15 +155,15 @@ jQuery(document).ready(function () {


//Add CSRF tokens for ajax forms
$(function() {
$jq(function() {

// This function gets cookie with a given name
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
var cookie = $jq.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
Expand Down Expand Up @@ -176,7 +197,7 @@ $(function() {
!(/^(\/\/|http:|https:).*/.test(url));
}

$.ajaxSetup({
$jq.ajaxSetup({
beforeSend: function(xhr, settings) {
if (!csrfSafeMethod(settings.type) && sameOrigin(settings.url)) {
// Send the token to same-origin, relative URLs only.
Expand Down
35 changes: 0 additions & 35 deletions static/booking/js/jquery.rememberscroll.js

This file was deleted.

4 changes: 2 additions & 2 deletions static/booking/js/updateLocation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jQuery(document).ready(function () {
$jq(function () {

var navtabs = document.getElementsByClassName('nav-tab');

Expand All @@ -9,4 +9,4 @@ jQuery(document).ready(function () {
})
});

});
});

0 comments on commit 54f020f

Please sign in to comment.