From 47041706ec6c665d18ff6d2c234dd893c1da879f Mon Sep 17 00:00:00 2001 From: MJ Isip Date: Thu, 5 Dec 2019 18:47:42 +0800 Subject: [PATCH] enable/disable mail protocol --- resources/assets/js/views/settings/settings.js | 16 ++++++++++++++++ resources/views/settings/email/edit.blade.php | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/resources/assets/js/views/settings/settings.js b/resources/assets/js/views/settings/settings.js index 91d400ee9..b7c218850 100644 --- a/resources/assets/js/views/settings/settings.js +++ b/resources/assets/js/views/settings/settings.js @@ -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 + } + } } }); diff --git a/resources/views/settings/email/edit.blade.php b/resources/views/settings/email/edit.blade.php index bc43d5da4..e2ca24dd2 100644 --- a/resources/views/settings/email/edit.blade.php +++ b/resources/views/settings/email/edit.blade.php @@ -252,7 +252,7 @@
- {{ 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']) }}