@extends('admin.layouts.app')

@section('content')
<div class="container-fluid">
    <h2>휴면계정 관리 - 환경설정</h2>
    <hr/>
    @include('admin.messages')
    @include('admin.user.dormant.navTabs')

    <div class="row">
        <div class="col">
            <div class="form-text text-muted">
                <p>개인정보유효기간제 시행에 따라 로그인한지 <u>1년 이상</u> 경과된 고객은 자동으로 휴면회원 처리되며, 개인정보가 분리 보관됩니다.</p>
                <p>사업자는 유효기간제 적용 대상이 된 이용자에게 <u>서비스 미이용 기간 만료 30일 전</u>까지 전자우편, 서면, 모사전송(팩스), 전화 등의 방법 중 하나를 선택하여 본인의 개인정보가 파기 또는 분리 저장·관리가 되는 사실 및 일시, 개인정보 항목을 통지하여야 합니다.</p>
                <p>설정 시 <u>매일 새벽 3시</u>에 자동으로 휴면예정 회원을 파악 후 개인정보를 별도 보관 합니다.</p>
            </div>
        </div>
    </div>
    <br/>
    <form name="f_admin_write" id="fAdminWrite" method="post" action="{{ route('admin.user.dormant.config.store') }}">
        @csrf
        <div class="row mb-3">
            <label for="dormantUse_1" class="col-sm-2">휴면계정 전환 여부</label>
            <div class="col-sm-10">
                <div class="form-check form-check-inline">
                    <input type="radio" name="user_dormant_use" id="dormantUse_1" class="form-check-input" value="1" @if(config('user_dormant_use') == '1') checked @endif />
                    <label for="dormantUse_1" class="form-check-label">사용함</label>
                </div>
                <div class="form-check form-check-inline">
                    <input type="radio" name="user_dormant_use" id="dormantUse_0" class="form-check-input" value="0" @if(!config('user_dormant_use')) checked @endif />
                    <label for="dormantUse_0" class="form-check-label">사용안함</label>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="userAutoWithdrawDay" class="col-sm-2 col-form-label">탈퇴 요청회원 자동삭제 기한</label>
            <div class="col-sm-10">
                <div class="d-inline-block">
                    <select name="user_auto_withdraw_day" id="userAutoWithdrawDay" class="form-select">
                        <option value="3" @if(config('user_auto_withdraw_day') == '3') selected @endif>3일</option>
                        <option value="5" @if(config('user_auto_withdraw_day') == '5') selected @endif>5일</option>
                        <option value="7" @if(config('user_auto_withdraw_day') == '7') selected @endif>7일</option>
                        <option value="14" @if(config('user_auto_withdraw_day') == '14') selected @endif>14일</option>
                        <option value="30" @if(config('user_auto_withdraw_day') == '30') selected @endif>30일</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="row mb-3">
            <label for="userWithdrawShopReviewDelete" class="col-sm-2">탈퇴 요청회원 자동삭제 자료</label>
            <div class="col-sm-10">
                <div class="form-check form-check-inline">
                    <input type="checkbox" name="user_withdraw_shop_review_delete" id="userWithdrawShopReviewDelete" class="form-check-input" value="1" @if(config('user_withdraw_shop_review_delete') == '1') checked @endif />
                    <label for="userWithdrawShopReviewDelete" class="form-check-label">구매후기</label>
                </div>
                <div class="form-check form-check-inline">
                    <input type="checkbox" name="user_withdraw_shop_qna_delete" id="userWithdrawShopQnaDelete" class="form-check-input" value="1" @if(config('user_withdraw_shop_qna_delete') == '1') checked @endif />
                    <label for="userWithdrawShopQnaDelete" class="form-check-label">상품문의</label>
                </div>
                <div class="form-check form-check-inline">
                    <input type="checkbox" name="user_withdraw_shop_order_delete" id="userWithdrawShopOrderDelete" class="form-check-input" value="1" @if(config('user_withdraw_shop_order_delete') == '1') checked @endif />
                    <label for="userWithdrawShopOrderDelete" class="form-check-label">주문내역</label>
                </div>
                <div class="form-check form-check-inline">
                    <input type="checkbox" name="user_withdraw_board_qna_delete" id="userWithdrawBoardQnaDelete" class="form-check-input" value="1" @if(config('user_withdraw_board_qna_delete') == '1') checked @endif />
                    <label for="userWithdrawBoardQnaDelete" class="form-check-label">1:1 상담</label>
                </div>
                <div class="form-check form-check-inline">
                    <input type="checkbox" name="user_withdraw_shop_wish_list_delete" id="userWithdrawShopWishListDelete" class="form-check-input" value="1" @if(config('user_withdraw_shop_wish_list_delete') == '1') checked @endif />
                    <label for="userWithdrawShopWishListDelete" class="form-check-label">관심상품</label>
                </div>
                <div class="form-check form-check-inline">
                    <input type="checkbox" name="user_withdraw_shop_cart_delete" id="userWithdrawShopCartDelete" class="form-check-input" value="1" @if(config('user_withdraw_shop_cart_delete') == '1') checked @endif />
                    <label for="userWithdrawShopCartDelete" class="form-check-label">장바구니</label>
                </div>
            </div>
        </div>
        <hr/>
        <div class="text-end">
            <button type="submit" class="btn btn-success">저장하기</button>
        </div>
    </form>
</div>

<script type="module">
$("#fAdminWrite").validate({
    rules: {
        user_dormant_use: {required: true, number: true, contains: [0, 1]},
        user_auto_withdraw_day: {required: true, number: true, contains: [3, 5, 7, 14, 30]},
        user_withdraw_shop_review_delete: {number: true, contains: [0, 1]},
        user_withdraw_shop_qna_delete: {number: true, contains: [0, 1]},
        user_withdraw_shop_order_delete: {number: true, contains: [0, 1]},
        user_withdraw_board_qna_delete: {number: true, contains: [0, 1]},
        user_withdraw_shop_wish_list_delete: {number: true, contains: [0, 1]},
        user_withdraw_shop_cart_delete: {number: true, contains: [0, 1]}
    }
});
</script>
@endsection
