Browse Source

Add dialog to set opening amount (issue #1)

master
Skylar Ittner 1 year ago
parent
commit
5775599b4b
3 changed files with 26 additions and 7 deletions
  1. 1
    0
      pages.php
  2. 9
    7
      pages/registers.php
  3. 16
    0
      static/js/registers.js

+ 1
- 0
pages.php View File

@@ -64,6 +64,7 @@ define("PAGES", [
"static/css/tables.css"
],
"scripts" => [
"static/js/bsalert.js",
"static/js/datatables.min.js",
"static/js/registers.js"
],

+ 9
- 7
pages/registers.php View File

@@ -85,12 +85,7 @@ $registers = $database->select('registers', ['registerid (id)', 'registername (n
<?php
} else {
?>
<form action="action.php" method="POST" class="d-inline">
<input type="hidden" name="action" value="opencash" />
<input type="hidden" name="source" value="registers" />
<input type="hidden" name="register" value="<?php echo $r['id']; ?>" />
<button class="btn btn-success btn-sm" type="submit"><i class="fas fa-play"></i> <?php lang("open"); ?></button>
</form>
<button class="btn btn-success btn-sm btn-opencash" data-register="<?php echo $r['id']; ?>"><i class="fas fa-play"></i> <?php lang("open"); ?></button>
<?php
}
?>
@@ -114,4 +109,11 @@ $registers = $database->select('registers', ['registerid (id)', 'registername (n
<th data-priority="3"><i class="fas fa-fw fa-stop d-none d-md-inline"></i> <?php lang('closed'); ?></th>
</tr>
</tfoot>
</table>
</table>

<form action="action.php" method="POST" class="d-none" id="opencashform">
<input type="hidden" name="action" value="opencash" />
<input type="hidden" name="source" value="registers" />
<input type="hidden" name="startamount" value="" id="opencashstart" />
<input type="hidden" name="register" value="" id="opencashregid" />
</form>

+ 16
- 0
static/js/registers.js View File

@@ -31,4 +31,20 @@ var registertable = $('#registertable').DataTable({
order: [
[2, 'asc']
]
});

$("#registertable").on('click', '.btn-opencash', function () {
var regid = $(this).data("register");
bsprompt(
"Open Cash",
"Enter the opening amount of cash in the drawer.",
"Open Cash",
"Cancel",
"number",
function (result) {
$("#opencashform #opencashregid").val(regid);
$("#opencashform #opencashstart").val(result);
$("#opencashform").submit();
}
);
});

Loading…
Cancel
Save