<template>
	<!-- <div class="wrap bg-wrap"> -->
	<div>
		<div class="dimmed confirm" @click="confirmModalCancel();"></div>
		<div class="popup-wrap confirm">
			<!-- 수정 확인 -->
			<div class="popup confirm">
				<div class="pop-head">
					<h3 class="pop-tit">{{title}}</h3>
				</div>
				<div class="pop-cont">
					<p>{{msg}}</p>
				</div>
				<div class="pop-btn2">
					<button class="btn-pcolor" @click="confirmModalClose();">확인</button>
					<button class="btn-default" @click="confirmModalCancel();">취소</button>
				</div>
			</div>
        </div>
    </div>
</template>

<script>

export default {
    name: "confirm",
	data(){
        return{
		  row:{},
          title:'',
          msg: '',
        }
    },
	methods :{
        // 모달 오픈
		confirmModalOpen(props){
			var dimmed = document.getElementsByClassName('confirm');
			for(var i = 0; i < dimmed.length; i++){
				dimmed[i].style.display = 'block';
			}

            // var modal41 = document.getElementsByClassName('modal41');
            // modal41[0].style.display = 'block';

            this.title = props.title;
            this.msg = props.msg;
		},
		// 모달 끄기(ok)
		confirmModalClose(){
			var dimmed = document.getElementsByClassName('confirm');
			for(var i = 0; i < dimmed.length; i++){
				dimmed[i].style.display = 'none';
			}
            
            this.row.result = true;
            // 부모 함수 호출.
            this.$parent.confirmCalbackFnc(this.row);
		},
        // 모달 끄기(취소)
		confirmModalCancel(){
			var dimmed = document.getElementsByClassName('confirm');
			for(var i = 0; i < dimmed.length; i++){
				dimmed[i].style.display = 'none';
			}

            this.row.result = false;
            // 부모 함수 호출.
            this.$parent.confirmCalbackFnc(this.row);
		},		
	}
}
</script>

<style>
    .popup-btn-wrap {width: 500px; margin: auto; padding: 100px 0;}
    .popup-btn-wrap button {width: 100%; margin-bottom: 10px; height: 50px; border-radius: 5px; box-shadow: none; border: 1px solid #000; }
    .popup-btn-wrap button:hover {background: #000; color: #fff;}
</style>