@php
    $partyId = old('party_id', $voucher->party_id ?? '');
    $partyType = old('party_type', $voucher->party_type ?? '');
    $partyValue = ($partyId && $partyType) ? "{$partyType}:{$partyId}" : '';
@endphp
<div class="col-12 col-sm-6 col-md-4 voucher-party-header-field">
    <label class="form-label fw-semibold">{{ $partyLabel }}</label>
    <input type="hidden" name="party_id" id="partyId" value="{{ $partyId }}">
    <input type="hidden" name="party_type" id="partyType" value="{{ $partyType }}">
    <div class="voucher-party-picker voucher-party-picker--header" data-voucher-party-header="1">
        <input type="hidden" value="{{ $partyValue }}" class="voucher-party-input">
        <button type="button" class="form-select voucher-party-picker-toggle text-start" aria-expanded="false">
            <span class="voucher-party-picker-label">— Select —</span>
        </button>
        <div class="voucher-party-picker-menu d-none">
            <div class="voucher-party-picker-search">
                <i class="bi bi-search"></i>
                <input type="search" class="form-control form-control-sm voucher-party-picker-search-input" placeholder="Search names..." autocomplete="off">
            </div>
            <div class="voucher-party-picker-columns">
                <span></span>
                <span>Code</span>
                <span>Name</span>
                <span>Type</span>
            </div>
            <div class="voucher-party-picker-tree"></div>
            <div class="voucher-party-picker-empty d-none">No matching names</div>
            <div class="voucher-party-picker-actions">
                <button type="button" class="btn btn-link btn-sm p-0 voucher-party-picker-clear">Clear</button>
            </div>
        </div>
    </div>
</div>
