enable/disable mail protocol

This commit is contained in:
MJ Isip 2019-12-05 18:47:42 +08:00
parent 4fe1d9f4ae
commit 47041706ec
2 changed files with 17 additions and 1 deletions

View File

@ -30,5 +30,21 @@ const app = new Vue({
form: new Form('setting'),
bulk_action: new BulkAction('settings')
}
},
methods: {
onProtocolChange(protocol) {
if (protocol === 'smtp') {
document.getElementById('smtp_host').disabled = false
document.getElementById('smtp_port').disabled = false
document.getElementById('smtp_username').disabled = false
document.getElementById('smtp_password').disabled = false
} else {
document.getElementById('smtp_host').disabled = true
document.getElementById('smtp_port').disabled = true
document.getElementById('smtp_username').disabled = true
document.getElementById('smtp_password').disabled = true
}
}
}
});

View File

@ -252,7 +252,7 @@
<div id="collapse10" class="collapse hide" aria-labelledby="heading10" data-parent="#accordion10">
<div class="card-body">
<div class="row">
{{ Form::selectGroup('protocol', trans('settings.email.protocol'), 'share', $email_protocols, !empty($setting['protocol']) ? $setting['protocol'] : null, []) }}
{{ Form::selectGroup('protocol', trans('settings.email.protocol'), 'share', $email_protocols, !empty($setting['protocol']) ? $setting['protocol'] : null, ['change' => 'onProtocolChange']) }}
{{ Form::textGroup('sendmail_path', trans('settings.email.sendmail_path'), 'road', [':disabled' => '(form.protocol == "smtp") || (form.protocol != "sendmail") ? true : false']) }}