<template>
	<v-row
		class="search-box"
		align="center"
		no-gutters
		style="margin: 14px 0px 0px"
	>
		<v-col v-if="item.label" :cols="labelCols">
			<label for="" class="search-box-label">
				<v-icon x-small color="primary" class="mr-1">mdi-record-circle</v-icon>
				{{ item.label }}
			</label>
		</v-col>
		<v-col :cols="labelCols ? 11 - labelCols : ''">
			<v-text-field
				v-model="InputValue"
				class="v-input__custom"
				hide-details
			></v-text-field>
		</v-col>
	</v-row>
</template>

<script>
import { mapState, mapMutations } from 'vuex';
export default {
	props: {
		parentPrgmId: {
			type: String,
			require: true,
		},
		item: {
			type: Object,
			require: true,
		},
	},
	data() {
		return {};
	},
	computed: {
		...mapState({
			searchParam(state) {
				return state.pageData[this.parentPrgmId];
			},
		}),
		InputValue: {
			get() {
				return this.searchParam[this.item.valueNm];
			},
			set(value) {
				return this.setPageData({ [this.item.valueNm]: value });
			},
		},
		labelCols() {
			let myCols = 0;
			if (this.item.label) {
				myCols = this.item.labelCols || '4';
			}
			return myCols;
		},
	},
	created() {},
	methods: {
		...mapMutations({ setPageData: 'setPageData' }),
	},
};
</script>

<style></style>
