Add dialog to set opening amount (issue #1)

master
Skylar Ittner 6 years ago
parent 172e611a45
commit 5775599b4b

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

@ -85,12 +85,7 @@ $registers = $database->select('registers', ['registerid (id)', 'registername (n
<?php <?php
} else { } else {
?> ?>
<form action="action.php" method="POST" class="d-inline"> <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>
<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>
<?php <?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> <th data-priority="3"><i class="fas fa-fw fa-stop d-none d-md-inline"></i> <?php lang('closed'); ?></th>
</tr> </tr>
</tfoot> </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>

@ -31,4 +31,20 @@ var registertable = $('#registertable').DataTable({
order: [ order: [
[2, 'asc'] [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