<form class="modal-form form-prevent-multiple-submits" action="{{ route('address.update', $address['Id']) }}" method="POST">
    @csrf
    <div class="form-title">
        <h3>주소 수정</h3>
    </div>
    <div class="form-group">
        <label class="form-label">종류</label>
        <div class="d-flex align-items-center">
            @forelse ($codeTitle['sort']['company-destina-bd'] ?? [] as $key => $sort)
                @if ($sort['Code'] !== '')
                    <div class="sort-div">
                        <input type="radio" value="{{ $sort['Code'] }}" name="sort" id="sort-radio-{{ $key }}" {{ $sort['Code'] === $address['Sort'] ? 'checked' : '' }}>
                        <label for="sort-radio-{{ $key }}" class="form-label">{{ $sort['Title'] }}</label>
                    </div>
                @endif
            @empty
            @endforelse
        </div>
    </div>
    <div class="form-group">
        <label class="form-label">우편번호</label>
        <div class="d-flex">
            <input class="form-control radius-r0" type="text" value="{{ $address['ZipCode'] }}" name="zip_code" id="zip-code-txt"
                   placeholder="우편번호를 입력하세요." required>
            <button type="button" onclick="get_zip_code(this)" tabindex="-1"
                    class="btn-dark rounded border-0 radius-l0 col-4">
                <i class="fas fa-map-marker-alt fa-lg" style="line-height: 24px;"></i>
            </button>
        </div>
    </div>
    <div class="form-group">
        <label class="form-label">주소</label>
        <input class="form-control" type="text" name="addr1" value="{{ $address['Addr1'] }}" id="addr1-txt" placeholder="주소를 입력하세요." required>
    </div>
    <div class="form-group">
        <label class="form-label">주소상세</label>
        <textarea style="height: 100px" class="form-control" name="addr2" id="addr2-txt" placeholder="주소를 입력하세요.">{{ $address['Addr2'] }}</textarea>
    </div>
    <button class="form-btn button-prevent-multiple-submits save-prev-scroll-submits" type="submit">
        <i class="spinner fa fa-spinner fa-spin"></i>
        저장
    </button>
</form>

@once
    <script src="//t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"></script>

    <script>
        function get_zip_code($this){
            new daum.Postcode({
                oncomplete: function(data) {
                    $($this).closest('form').find('#zip-code-txt').val(data.zonecode)
                    $($this).closest('form').find('#addr1-txt').val(data.roadAddress)
                }
            }).open();
        }
    </script>
@endonce
