enable/disable email protocol
This commit is contained in:
		@@ -3,7 +3,8 @@
 | 
			
		||||
            :name="name"
 | 
			
		||||
            :class="formClasses"
 | 
			
		||||
            :error="formError">
 | 
			
		||||
        <el-select v-model="real_model" @input="change" filterable v-if="!multiple"
 | 
			
		||||
 | 
			
		||||
        <el-select v-model="real_model" @input="change" disabled filterable v-if="disabled"
 | 
			
		||||
            :placeholder="placeholder">
 | 
			
		||||
            <div v-if="addNew" class="el-select-dropdown__wrap" slot="empty">
 | 
			
		||||
                <ul class="el-scrollbar__view el-select-dropdown__list">
 | 
			
		||||
@@ -39,8 +40,43 @@
 | 
			
		||||
            </el-option-group>
 | 
			
		||||
        </el-select>
 | 
			
		||||
 | 
			
		||||
        <el-select v-model="real_model" @input="change" filterable v-if="!disabled && !multiple"
 | 
			
		||||
            :placeholder="placeholder">
 | 
			
		||||
            <div v-if="addNew" class="el-select-dropdown__wrap" slot="empty">
 | 
			
		||||
                <ul class="el-scrollbar__view el-select-dropdown__list">
 | 
			
		||||
                    <li class="el-select-dropdown__item hover" @click="onAddItem">
 | 
			
		||||
                        <span>{{ add_new_text }}</span>
 | 
			
		||||
                    </li>
 | 
			
		||||
                </ul>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
        <el-select v-model="real_model" @input="change" filterable v-if="multiple" multiple collapse-tags
 | 
			
		||||
            <template slot="prefix">
 | 
			
		||||
                <span class="el-input__suffix-inner el-select-icon">
 | 
			
		||||
                    <i :class="'select-icon-position el-input__icon fa fa-' + icon"></i>
 | 
			
		||||
                </span>
 | 
			
		||||
            </template>
 | 
			
		||||
 | 
			
		||||
            <el-option v-if="!group" v-for="(label, value) in selectOptions"
 | 
			
		||||
               :key="value"
 | 
			
		||||
               :label="label"
 | 
			
		||||
               :value="value">
 | 
			
		||||
            </el-option>
 | 
			
		||||
 | 
			
		||||
            <el-option-group
 | 
			
		||||
                v-if="group"
 | 
			
		||||
                v-for="(options, name) in selectOptions"
 | 
			
		||||
                :key="name"
 | 
			
		||||
                :label="name">
 | 
			
		||||
                <el-option
 | 
			
		||||
                    v-for="(label, value) in options"
 | 
			
		||||
                    :key="value"
 | 
			
		||||
                    :label="label"
 | 
			
		||||
                    :value="value">
 | 
			
		||||
                </el-option>
 | 
			
		||||
            </el-option-group>
 | 
			
		||||
        </el-select>
 | 
			
		||||
 | 
			
		||||
        <el-select v-model="real_model" @input="change" filterable v-if="!disabled && multiple" multiple collapse-tags
 | 
			
		||||
            :placeholder="placeholder">
 | 
			
		||||
            <div v-if="addNew" class="el-select-dropdown__wrap" slot="empty">
 | 
			
		||||
                <ul class="el-scrollbar__view el-select-dropdown__list">
 | 
			
		||||
@@ -115,7 +151,8 @@ export default {
 | 
			
		||||
        addNewText: null,
 | 
			
		||||
        addNewPath: null,
 | 
			
		||||
        group: false,
 | 
			
		||||
        multiple:false
 | 
			
		||||
        multiple:false,
 | 
			
		||||
        disabled:false
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    data() {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										53
									
								
								resources/assets/js/views/settings/settings.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										53
									
								
								resources/assets/js/views/settings/settings.js
									
									
									
									
										vendored
									
									
								
							@@ -28,22 +28,49 @@ const app = new Vue({
 | 
			
		||||
    data: function () {
 | 
			
		||||
        return {
 | 
			
		||||
            form: new Form('setting'),
 | 
			
		||||
            bulk_action: new BulkAction('settings')
 | 
			
		||||
            bulk_action: new BulkAction('settings'),
 | 
			
		||||
            email:{
 | 
			
		||||
                sendmailPath:true,
 | 
			
		||||
                smtpHost:true,
 | 
			
		||||
                smtpPort:true,
 | 
			
		||||
                smtpUsername:true,
 | 
			
		||||
                smtpPassword:true,
 | 
			
		||||
                smtpEncryption:true,
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    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
 | 
			
		||||
    mounted(){
 | 
			
		||||
        this.onChangeProtocol(this.form.protocol);
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    methods:{
 | 
			
		||||
        onChangeProtocol(protocol){
 | 
			
		||||
            switch(protocol){
 | 
			
		||||
                case "smtp":
 | 
			
		||||
                    this.email.sendmailPath = true;
 | 
			
		||||
                    this.email.smtpHost = false;
 | 
			
		||||
                    this.email.smtpPort = false;
 | 
			
		||||
                    this.email.smtpUsername = false;
 | 
			
		||||
                    this.email.smtpPassword = false;
 | 
			
		||||
                    this.email.smtpEncryption = false;
 | 
			
		||||
                    break;
 | 
			
		||||
                case "sendmail":
 | 
			
		||||
                    this.email.sendmailPath = false;
 | 
			
		||||
                    this.email.smtpHost = true;
 | 
			
		||||
                    this.email.smtpPort = true;
 | 
			
		||||
                    this.email.smtpUsername = true;
 | 
			
		||||
                    this.email.smtpPassword = true;
 | 
			
		||||
                    this.email.smtpEncryption = true;
 | 
			
		||||
                    break;
 | 
			
		||||
                default:
 | 
			
		||||
                    this.email.sendmailPath = true;
 | 
			
		||||
                    this.email.smtpHost = true;
 | 
			
		||||
                    this.email.smtpPort = true;
 | 
			
		||||
                    this.email.smtpUsername = true;
 | 
			
		||||
                    this.email.smtpPassword = true;
 | 
			
		||||
                    this.email.smtpEncryption = true;
 | 
			
		||||
                    break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user