From e0eec76691486bcd593f99878441009b06dc8fc5 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 26 Apr 2017 21:49:50 +0300 Subject: [PATCH] Remember if send email receipt is checked --- resources/views/payments/edit.blade.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/resources/views/payments/edit.blade.php b/resources/views/payments/edit.blade.php index 82c3521384de..394ca2d6e64c 100644 --- a/resources/views/payments/edit.blade.php +++ b/resources/views/payments/edit.blade.php @@ -71,7 +71,11 @@ {!! Former::text('transaction_reference') !!} @if (!$payment) - {!! Former::checkbox('email_receipt')->label(' ')->text(trans('texts.email_receipt'))->value(1) !!} + {!! Former::checkbox('email_receipt') + ->onchange('onEmailReceiptChange()') + ->label(' ') + ->text(trans('texts.email_receipt')) + ->value(1) !!} @endif @@ -130,6 +134,12 @@ $('.payment_date .input-group-addon').click(function() { toggleDatePicker('payment_date'); }); + + if (isStorageSupported()) { + if (localStorage.getItem('last:send_email_receipt')) { + $('#email_receipt').prop('checked', true); + } + } }); function onFormSubmit(event) { @@ -151,6 +161,14 @@ }); } + function onEmailReceiptChange() { + if (! isStorageSupported()) { + return; + } + var checked = $('#email_receipt').is(':checked'); + localStorage.setItem('last:send_email_receipt', checked ? true : ''); + } + @stop