@extends('views.layouts.master')
<link rel="stylesheet" href="{{ csset('/themes/pro/modunawa/resources/css/user-auth.css') }}">
@section('content')

<!--=====================================
	USER FORM PART START
=======================================-->
<section class="user-form-part signup divide">
    <div class="container">
        <div class="row justify-content-center">
            <form class="col-12 col-sm-10 col-md-12 col-lg-12 col-xl-12 form-prevent-multiple-submits"
                  id="company-signup-form" action="{{ route('member-company-signup.store') }}" method="POST" enctype="multipart/form-data">
                @csrf
                <div class="user-form-card">
                    <div class="user-form-title">
                        <h2>가맹점 회원가입</h2>
                        <p>회원가입을 위해 아래 폼을 작성해 주세요.</p>
                    </div>
                    <div>
                        <div class="user-form-group">
                            <div class="user-form form-prevent-multiple-submits">
                                <h6>
                                	기본정보
                                    <p><strong>*</strong>는 필수 입력 사항입니다.</p>
                                </h6>
                                <div class="form-group re">
                                    <label>이메일</label>
                                    <input type="email" class="form-control" name="email" value="{{ old('email') }}" placeholder="이메일 주소를 입력해 주세요" required>

                                    @error('email')
                                        <span class="text-danger"><i class="icon-cancel-circle2 mr-2"></i>{{ $message }}</span>
                                    @enderror
                                </div>
                                <div class="form-group re">
                                    <label>비밀번호</label>
                                    <input type="password" name="password" value="{{ old('password') }}" class="form-control" placeholder="{{ $policyDesc }}" required>
                                    <!--<span class="text-danger"><i class="icon-cancel-circle2 mr-2"></i></span>-->
                                </div>
                                <div class="form-group re">
                                    <label>비밀번호 확인</label>
                                    <input type="password" name="password_confirmation" value="{{ old('password_confirmation') }}" class="form-control" placeholder="비밀번호 한번 더 입력해 주세요" required>

                                    @error('password')
                                        <span class="text-danger"><i class="icon-cancel-circle2 mr-2"></i>{{ $message }}</span>
                                    @enderror
                                </div>
                                <div class="form-group re">
                                    <label>이름</label>
                                    <input type="text" class="form-control" name="first_name" value="{{ old('first_name') }}" placeholder="이름을 입력해 주세요" required>
                                </div>
                                <div class="form-group re">
                                    <label>휴대폰번호</label>
                                    <input type="tel" name="mobile_no" value="{{ old('mobile_no', session('smsCert.mobile_no')) }}"
                                           class="form-control" placeholder="-없이 입력하세요" readonly required>
                                </div>
{{--                                <div class="form-group re">--}}
{{--                                    <label>주소</label>--}}
{{--                                    <ul>--}}
{{--                                        <li>--}}
{{--                                            <input type="text" name="" class="form-control" placeholder="우편번호">--}}
{{--                                            <button type="button" onclick="get_zip_code()">우편번호검색</button>--}}
{{--                                        </li>--}}
{{--                                        <li>--}}
{{--                                            <input type="text" name="" class="form-control" placeholder="주소">--}}
{{--                                        </li>--}}
{{--                                        <li>--}}
{{--                                            <input type="text" name="" class="form-control" placeholder="상세주소를 입력하세요">--}}
{{--                                        </li>--}}
{{--                                    </ul>--}}
{{--                                </div>--}}
                            </div>
                            <div class="user-form-divider"></div>
                            <div class="user-form form-prevent-multiple-submits">
                                <h6>
                                	사업자 정보
                                    <p><strong>*</strong>는 필수 입력 사항입니다.</p>
                                </h6>
                                <div class="form-group re">
                                    <label>상호</label>
                                    <input type="text" class="form-control" value="{{ old('company_name') }}" name="company_name" placeholder="상호를 입력해 주세요" required>
                                </div>
                                <div class="form-group re">
                                    <label>사업자번호</label>
                                    <input type="text" name="tax_no" class="form-control" value="{{ old('tax_no') }}" placeholder="-없이 입력하세요" required>
                                </div>
                                <div class="form-group re">
                                    <label>대표자명</label>
                                    <input type="text" class="form-control" name="president" value="{{ old('president') }}" placeholder="대표자명을 입력해 주세요" required>
                                </div>
                                <div class="form-group re">
                                    <label>전화번호</label>
                                    <input type="tel" name="tel_no" class="form-control" value="{{ old('tel_no') }}" placeholder="-없이 입력하세요" required>
                                </div>
                                <div class="form-group re">
                                    <label>업태</label>
                                    <input type="text" class="form-control" name="biz_type" value="{{ old('biz_type') }}" placeholder="업태를 입력해 주세요" required>
                                </div>
                                <div class="form-group re">
                                    <label>종목</label>
                                    <input type="text" class="form-control" name="deal_item" value="{{ old('deal_item') }}" placeholder="종목을 입력해 주세요" required>
                                </div>
                                <div class="form-group re">
                                    <label>주소</label>
                                    <ul>
                                        <li>
                                            <input type="text" name="zip_code" id="zip-code-txt" value="{{ old('zip_code') }}" class="form-control" placeholder="우편번호" required>
                                            <button type="button" onclick="get_zip_code()">우편번호검색</button>
                                        </li>
                                        <li>
                                            <input type="text" name="addr1" id="addr1-txt" value="{{ old('addr1') }}" class="form-control" placeholder="주소">
                                        </li>
                                        <li>
                                            <input type="text" name="addr2" class="form-control" value="{{ old('addr2') }}" placeholder="상세주소를 입력하세요">
                                        </li>
                                    </ul>
                                </div>
                                <div class="form-group re">
                                    <label>사업자등록증 사진 첨부</label>
                                    <input type="file" id="upload-file" name="cert_img" value="{{ old('cert_img') }}" class="cursor-pointer rounded w-100 form-control-uniform-custom" required style="text-indent: 0;">
                                </div>
                                <div class="form-group">
                                    <label>사용중인 카드 단말기(VAN)</label>
                                    <select class="form-control" name="van">
                                        <option value="">사용중인 카드 단말기 선택</option>
                                        @foreach(['한국정보통신(KICC)', '나이스정보통신', 'KSNET',
                                        '스마트로', 'KIS정보통신', '퍼스트데이타', 'KOVAN', 'JT NET',
                                        '다우데이타', '한국사이버결제(KCP)', 'KOCES', 'SPC', '금융결제원' ] as $title)
                                            <option value="{{ $title }}" {{ old('van') == $title ? "selected" : "" }}>
                                                {{ $title }}
                                            </option>
                                        @endforeach
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>VAN 아이디</label>
                                    <input type="text" class="form-control" value="{{ old('van_id') }}" name="van_id" placeholder="VAN 아이디를 입력해 주세요">
                                </div>
                                <div class="form-group">
                                    <label>VAN 비밀번호</label>
                                    <input type="text" class="form-control" value="{{ old('van_pw') }}" name="van_pw" placeholder="VAN 비밀번호를 입력해 주세요">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-check mb-3">
                    <input class="form-check-input" type="checkbox" id="verifiy-ck">
                    <label class="form-check-label" for="verifiy-ck">약관에 동의합니다. <a href="{{ route('policy.index') }}" target="_blank">약관보기</a> </label>
                </div>
                <div class="form-button">
                    <button type="submit" class="button-prevent-multiple-submits">
                        <i class="spinner fa fa-spinner fa-spin"></i>
                        확인
                    </button>
                </div>
                <div class="user-form-remind">
                    <p>이미 회원이시면 로그인해 주세요.<a href="{{ route('member-login') }}">로그인</a></p>
                </div>
                <!--
						<div class="user-form-footer">
                            <p>Greeny | &COPY; Copyright by <a href="#">Mironcoder</a></p>
                        </div>
						-->
            </form>
        </div>
    </div>
</section>
<!--=====================================
                    USER FORM PART END
        =======================================-->
@endsection

@push('js')
<script src="//t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"></script>
    <script>
        $(document).ready(function() {
            $('#upload-file').fileselect();
        });

        function get_zip_code() {
            new daum.Postcode({
                oncomplete: function(data) {
                    $('#zip-code-txt').val(data.zonecode)
                    $('#addr1-txt').val(data.roadAddress)
                }
            }).open();
        }

        $('#company-signup-form').on('submit', function(event) {
            event.preventDefault();

            if ($('#verifiy-ck').is(':checked')) {
                this.submit()
                return
            }

            iziToast.info({ title: 'Info', message: "@lang('이용약관에 동의하셔야 합니다')" });
            return false
        });
    </script>
@endpush
