|
Lines 3-9
$(document).ready(function () {
Link Here
|
| 3 |
var button = $(e.relatedTarget); |
3 |
var button = $(e.relatedTarget); |
| 4 |
var cashup = button.data("cashup"); |
4 |
var cashup = button.data("cashup"); |
| 5 |
var description = button.data("register"); |
5 |
var description = button.data("register"); |
|
|
6 |
var inProgress = button.data("in-progress") || false; |
| 6 |
var summary_modal = $(this); |
7 |
var summary_modal = $(this); |
|
|
8 |
|
| 9 |
// Update title based on whether this is a preview |
| 10 |
if (inProgress) { |
| 11 |
summary_modal |
| 12 |
.find("#cashupSummaryLabel") |
| 13 |
.text("Cashup summary preview (in progress)"); |
| 14 |
} else { |
| 15 |
summary_modal.find("#cashupSummaryLabel").text("Cashup summary"); |
| 16 |
} |
| 17 |
|
| 7 |
summary_modal.find("#register_description").text(description); |
18 |
summary_modal.find("#register_description").text(description); |
| 8 |
$.ajax({ |
19 |
$.ajax({ |
| 9 |
url: "/api/v1/cashups/" + cashup, |
20 |
url: "/api/v1/cashups/" + cashup, |
|
Lines 17-22
$(document).ready(function () {
Link Here
|
| 17 |
let to_date = $datetime(data.summary.to_date); |
28 |
let to_date = $datetime(data.summary.to_date); |
| 18 |
summary_modal.find("#to_date").text(to_date); |
29 |
summary_modal.find("#to_date").text(to_date); |
| 19 |
|
30 |
|
|
|
31 |
// Add preview notice if this is an in-progress cashup |
| 32 |
if (inProgress) { |
| 33 |
var previewNotice = summary_modal.find(".preview-notice"); |
| 34 |
if (previewNotice.length === 0) { |
| 35 |
summary_modal |
| 36 |
.find(".modal-body > ul") |
| 37 |
.after( |
| 38 |
'<div class="alert alert-info preview-notice">' + |
| 39 |
'<i class="fa-solid fa-info-circle"></i> ' + |
| 40 |
"<strong>Preview:</strong> This summary shows the current expected cashup amounts. " + |
| 41 |
"New transactions will update these values until you complete the cashup." + |
| 42 |
"</div>" |
| 43 |
); |
| 44 |
} |
| 45 |
} else { |
| 46 |
summary_modal.find(".preview-notice").remove(); |
| 47 |
} |
| 48 |
|
| 20 |
// Check for reconciliation (surplus or deficit) from dedicated fields |
49 |
// Check for reconciliation (surplus or deficit) from dedicated fields |
| 21 |
var surplus = data.summary.surplus_total; |
50 |
var surplus = data.summary.surplus_total; |
| 22 |
var deficit = data.summary.deficit_total; |
51 |
var deficit = data.summary.deficit_total; |
| 23 |
- |
|
|