@extends('admin.layouts.app')

@section('content')
<div class="container-fluid">
    <h2>회사</h2>
    <hr/>
    @include('admin.messages')
    @include('admin.config.setting.navTabs')

    <form name="f_admin_write" id="fAdminWrite" method="post" action="{{ route('admin.config.setting.company.store') }}">
        @csrf
        <div class="alert alert-dismissible alert-primary">
            웹사이트 정보와 사업자정보, 운영자 정보등은 웹사이트 하단에 노출됩니다.
        </div>
        <div class="row mb-3">
            <label for="companyName" class="col-sm-2 col-form-label">회사명</label>
            <div class="col-sm-10">
                <input type="text" name="company_name" id="companyName" class="form-control" value="{{ $config->company_name ?? old('company_name') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="companyRegNo" class="col-sm-2 col-form-label">사업자등록번호</label>
            <div class="col-sm-10">
                <input type="text" name="company_reg_no" id="companyRegNo" class="form-control" value="{{ $config->company_reg_no ?? old('company_reg_no') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="companyOwner" class="col-sm-2 col-form-label">대표자명</label>
            <div class="col-sm-10">
                <input type="text" name="company_owner" id="companyOwner" class="form-control" value="{{ $config->company_owner ?? old('company_owner') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="companyPhone" class="col-sm-2 col-form-label">대표전화번호</label>
            <div class="col-sm-10">
                <input type="text" name="company_phone" id="companyPhone" class="form-control" value="{{ $config->company_phone ?? old('company_phone') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="companyFax" class="col-sm-2 col-form-label">FAX 번호</label>
            <div class="col-sm-10">
                <input type="text" name="company_fax" id="companyFax" class="form-control" value="{{ $config->company_fax ?? old('company_fax') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="companyRetailSaleNo" class="col-sm-2 col-form-label">통신판매업신고번호</label>
            <div class="col-sm-10">
                <input type="text" name="company_retail_sale_no" id="companyRetailSaleNo" class="form-control" value="{{ $config->company_retail_sale_no ?? old('company_retail_sale_no') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="companyAddedSaleNo" class="col-sm-2 col-form-label">부가통신 사업자번호</label>
            <div class="col-sm-10">
                <input type="text" name="company_added_sale_no" id="companyAddedSaleNo" class="form-control" value="{{ $config->company_added_sale_no ?? old('company_added_sale_no') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="companyZipCode" class="col-sm-2 col-form-label">사업장 우편번호</label>
            <div class="col-sm-10">
                <input type="text" name="company_zip_code" id="companyZipCode" class="form-control" value="{{ $config->company_zip_code ?? old('company_zip_code') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="companyAddress" class="col-sm-2 col-form-label">사업장 주소</label>
            <div class="col-sm-10">
                <input type="text" name="company_address" id="companyAddress" class="form-control" value="{{ $config->company_address ?? old('company_address') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="companyHosting" class="col-sm-2 col-form-label">호스팅서비스</label>
            <div class="col-sm-10">
                <input type="text" name="company_hosting" id="companyHosting" class="form-control" value="{{ $config->company_hosting ?? old('company_hosting') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="companyAdminName" class="col-sm-2 col-form-label">정보관리책임자명</label>
            <div class="col-sm-10">
                <input type="text" name="company_admin_name" id="companyAdminName" class="form-control" value="{{ $config->company_admin_name ?? old('company_admin_name') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="companyAdminEmail" class="col-sm-2 col-form-label">정보관리책임자 이메일</label>
            <div class="col-sm-10">
                <input type="text" name="company_admin_email" id="companyAdminEmail" class="form-control" value="{{ $config->company_admin_email ?? old('company_admin_email') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="companySiteUrl" class="col-sm-2 col-form-label">홈페이지 주소</label>
            <div class="col-sm-10">
                <input type="text" name="company_site_url" id="companySiteUrl" class="form-control" value="{{ $config->company_site_url ?? old('company_site_url') }}" />
            </div>
        </div>
        <div class="row mb-3">
            <label for="companyBankCode" class="col-sm-2 col-form-label">입금 계좌</label>
            <div class="col-sm-10">
                <div class="row">
                    <label for="companyBankCode" class="col-auto col-form-label">은행</label>
                    <div class="col-sm">
                        <select name="company_bank_code" id="companyBankCode" class="form-select">
                            <option value="">선택하세요.</option>
                            @foreach($banks as $i => $k)
                            <option value="{{ $i }}" @if(($config->company_bank_code ?? old('company_bank_code')) == $i) selected @endif>{{ $k }}</option>
                            @endforeach
                        </select>
                    </div>
                    <label for="companyBankOwner" class="col-auto col-form-label">예금주</label>
                    <div class="col-sm">
                        <input type="text" name="company_bank_owner" id="companyBankOwner" class="form-control" value="{{ $config->company_bank_owner ?? old('company_bank_owner') }}" />
                    </div>
                    <label for="companyBankNumber" class="col-auto col-form-label">계좌번호</label>
                    <div class="col-sm">
                        <input type="text" name="company_bank_number" id="companyBankNumber" class="form-control" value="{{ $config->company_bank_number ?? old('company_bank_number') }}" />
                    </div>
                </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: {
        company_admin_email: {email : true}
    }
});
</script>
@endsection
