Problem Description: I am working on a POS system where I need to allow users to enable or disable the "Show Receipt" feature after completing a cash transaction. The receipt should only be shown if the setting is enabled; otherwise, it should be skipped.
I have implemented the following: Backend (Laravel):
A setting in the business settings (enable_show_receipt) that controls whether the receipt is shown after a transaction. The setting is stored in the session and should be accessible in the JavaScript part. Frontend (JavaScript):
A JavaScript function (pos_print(receipt)) that checks the session value of enable_show_receipt and either shows or hides the receipt accordingly. I'm trying to dynamically check this value and skip the receipt print if the setting is disabled.
However, the issue is:
Even when the "Enable Show Receipt" checkbox is disabled or enabled in the settings, the print preview window still shows up. The setting does not seem to be applied properly, and the receipt is always printed regardless of the checkbox setting.
When the "Enable Show Receipt" checkbox is checked: The receipt should be shown after a successful transaction.
When the checkbox is unchecked: The receipt should be skipped.