Remember if send email receipt is checked

This commit is contained in:
Hillel Coren 2017-04-26 21:49:50 +03:00
parent 45834a6da5
commit e0eec76691

View File

@ -71,7 +71,11 @@
{!! Former::text('transaction_reference') !!} {!! Former::text('transaction_reference') !!}
@if (!$payment) @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 @endif
</div> </div>
@ -130,6 +134,12 @@
$('.payment_date .input-group-addon').click(function() { $('.payment_date .input-group-addon').click(function() {
toggleDatePicker('payment_date'); toggleDatePicker('payment_date');
}); });
if (isStorageSupported()) {
if (localStorage.getItem('last:send_email_receipt')) {
$('#email_receipt').prop('checked', true);
}
}
}); });
function onFormSubmit(event) { 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 : '');
}
</script> </script>
@stop @stop