<template>
	<div class="form-group" :class="{'has-error': form.errors.has(input_name)}">
        <label v-if="label">{{ label }}</label>
        <select 
            class="form-control"
            v-model="form[input_name]"
            @change="$emit('clicked')"
            :disabled="readonly"
        >
            <option disabled value="">Select Option</option>
            <option :value="option.id" v-if="list" v-for="(option, $index) in list" :key="$index">
                {{ option.name }}
            </option>
        </select>
        <div class="text-danger text-left" v-if="form.errors.has(input_name)" v-text="form.errors.get(input_name)"></div>
    </div>
</template>

<script type="text/javascript">
	export default {
		props: ['input_name', 'form', 'label', 'list', 'readonly']
	}
</script>