Skip to content

Commit

Permalink
Removed dangling route from routes.rb and payments.js
Browse files Browse the repository at this point in the history
  • Loading branch information
SpookyBoy99 committed Sep 14, 2024
1 parent 1f8b73e commit 8c93b13
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 66 deletions.
65 changes: 0 additions & 65 deletions app/javascript/src/admin/payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ $(document).on("ready page:load turbolinks:load", function () {
},
);

$(".input-group#transaction_dates #update_transactions button").bind(
"click",
function () {
getCheckoutTransactions($(this));
},
);

//Update search
$("input#search").on("keyup", function () {
var query = new RegExp($(this).val(), "i");
Expand Down Expand Up @@ -63,61 +56,3 @@ function getWhatsappText(url) {
async: false,
}).responseText;
}

//Requests all checkout transactions for a given date
function getCheckoutTransactions(button) {
var start_date = $("#pin-total-date").val();

$.ajax({
url: "/payments/transactions",
type: "GET",
data: {
start_date: start_date,
},
})
.done(function (data, status) {
//Find and clear table
var table = $("#transactions").find("tbody");
var total = 0.0;
$(table).find("tr").remove();

// Bind json data to copy button
$("#copy_transactions button").attr(
"data-clipboard-text",
JSON.stringify(data),
);

//Fill table if not empty
if (data.length == 0) {
table.append(
`<tr style="height: 36px; line-height: 36px;"><td><em>${I18n.t(
"admin.payment.no_transactions",
)}</em></td><td></td><td></td></tr>`,
);
toastr.warning(I18n.t("admin.payment.not_found"));
} else {
$.each(data, function (key, t) {
let value = parseFloat(t.price);
total += value;
t.price = "€" + value.toFixed(2);
if (t.price.indexOf("-") > 0) t.price = "-€" + t.price.substring(2);
table.append(
'<tr style="height: 36px; line-height: 36px;"><td><a href="/members/' +
t.member_id +
'">' +
t.name +
"</a></td><td>" +
t.price +
"</td><td>" +
t.date +
"</td></tr>",
);
});
toastr.success(I18n.t("admin.payment.found"));
}
$("#pin-total-result").text("€" + total.toFixed(2));
})
.fail(function () {
toastr.error(I18n.t("admin.payment.no_update"));
});
}
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
scope 'payments' do
get '/', to: 'payments#index', as: "payments"
get 'whatsapp/:member_id', to: 'payments#whatsapp_redirect', as: 'payment_whatsapp_redirect'
get 'transactions', to: 'payments#update_transactions', as: 'payment_transactions'
get 'transactions_export', to: 'payments#export_payments', as: 'payment_transactions_export'
end

Expand Down

0 comments on commit 8c93b13

Please sign in to comment.