<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
?>
<div class="client">
    <input type="hidden" class="client-selected-from-list" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client_from_list'; ?>" value="<?php echo isset($invoice[$Config::INPUTS_PREFIX.'client_from_list']) ? esc_attr(sanitize_text_field($invoice[$Config::INPUTS_PREFIX.'client_from_list'])) : '0'; ?>">
    <div class="mb-4 selectable">
        <div><label><b><?php esc_html_e( 'Client:', 'kirilkirkov-pdf-invoice-manager' ); ?></b></label></div>
        <div class="flex items-center justify-between">
            <input type="text" class="client-name-input" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client[client]'; ?>" value="<?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['client']) ? esc_attr(sanitize_text_field($invoice[$Config::INPUTS_PREFIX.'client']['client'])) : ''; ?>" />
            <a class="ajax-select kkwi-show-select-client-modal" href="javascript:;">
                <span class="dashicons dashicons-menu-alt"></span>
                <?php esc_html_e( 'Select from list', 'kirilkirkov-pdf-invoice-manager' ); ?>
            </a>
        </div>
    </div>
    <div class="mb-4">
        <label>
            <input type="hidden" value="0" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client[is_individual]'; ?>">
            <input type="checkbox" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client[is_individual]'; ?>" <?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['is_individual']) && (int)$invoice[$Config::INPUTS_PREFIX.'client']['is_individual'] > 0 ? 'checked' : ''; ?> class="is-individual" value="1">
            <?php esc_html_e( 'Individual', 'kirilkirkov-pdf-invoice-manager' ); ?>
        </label>
    </div>
    <div class="mb-4 <?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['is_individual']) && (int)$invoice[$Config::INPUTS_PREFIX.'client']['is_individual'] > 0 ? 'hidden' : ''; ?> not-individual">
        <label>
            <input type="hidden" value="0" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client[has_vat_registration]'; ?>">
            <input type="checkbox" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client[has_vat_registration]'; ?>" <?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['has_vat_registration']) && (int)$invoice[$Config::INPUTS_PREFIX.'client']['has_vat_registration'] > 0 ? 'checked' : ''; ?> class="vat-registration" value="1">
            <?php esc_html_e( 'VAT registration', 'kirilkirkov-pdf-invoice-manager' ); ?>
        </label>
    </div>
    <div class="mb-4 <?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['has_vat_registration']) && (int)$invoice[$Config::INPUTS_PREFIX.'client']['has_vat_registration'] > 0 && (int)$invoice[$Config::INPUTS_PREFIX.'client']['is_individual'] < 1 ? '' : 'hidden'; ?> has-vat-number">
        <div><label><b><?php esc_html_e( 'VAT Number:', 'kirilkirkov-pdf-invoice-manager' ); ?></b></label></div>
        <input type="text" class="client-vat-number-input" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client[vat_number]'; ?>" value="<?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['vat_number']) ? esc_attr(sanitize_text_field($invoice[$Config::INPUTS_PREFIX.'client']['vat_number'])) : ''; ?>" />
    </div>
    <div class="mb-4 <?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['is_individual']) && (int)$invoice[$Config::INPUTS_PREFIX.'client']['is_individual'] > 0 ? 'hidden' : ''; ?> not-individual">
        <div><label><b><?php esc_html_e( 'Accountable person:', 'kirilkirkov-pdf-invoice-manager' ); ?></b></label></div>
        <input type="text" class="client-accountable-person-input" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client[accountable_person]'; ?>" value="<?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['accountable_person']) ? esc_attr(sanitize_text_field($invoice[$Config::INPUTS_PREFIX.'client']['accountable_person'])) : ''; ?>" />
    </div>
    <div class="mb-4 <?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['is_individual']) && (int)$invoice[$Config::INPUTS_PREFIX.'client']['is_individual'] > 0 ? '' : 'hidden'; ?> only-individual">
        <div><label><b><?php esc_html_e( 'Identification number:', 'kirilkirkov-pdf-invoice-manager' ); ?></b></label></div>
        <input type="text" class="client-indentification-number-input" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client[identification_number]'; ?>" value="<?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['identification_number']) ? esc_attr(sanitize_text_field($invoice[$Config::INPUTS_PREFIX.'client']['identification_number'])) : ''; ?>" />
    </div>
    <div class="mb-4">
        <div><label><b><?php esc_html_e( 'City:', 'kirilkirkov-pdf-invoice-manager' ); ?></b></label></div>
        <input type="text" class="client-city-input" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client[city]'; ?>" value="<?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['city']) ? esc_attr(sanitize_text_field($invoice[$Config::INPUTS_PREFIX.'client']['city'])) : ''; ?>" />
    </div>
    <div class="mb-4">
        <div><label><b><?php esc_html_e( 'Address:', 'kirilkirkov-pdf-invoice-manager' ); ?></b></label></div>
        <input type="text" class="client-address-input" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client[address]'; ?>" value="<?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['address']) ? esc_attr(sanitize_text_field($invoice[$Config::INPUTS_PREFIX.'client']['address'])) : ''; ?>" />
    </div>
    <div class="mb-4">
        <div><label><b><?php esc_html_e( 'Country:', 'kirilkirkov-pdf-invoice-manager' ); ?></b></label></div>
        <input type="text" class="client-country-input" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client[country]'; ?>" value="<?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['country']) ? esc_attr(sanitize_text_field($invoice[$Config::INPUTS_PREFIX.'client']['country'])) : ''; ?>" />
    </div>
    <div class="mb-4">
        <div><label><b><?php esc_html_e( 'Beneficiary:', 'kirilkirkov-pdf-invoice-manager' ); ?></b></label></div>
        <input type="text" class="client-beneficiary-input" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client[beneficiary]'; ?>" value="<?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['beneficiary']) ? esc_attr(sanitize_text_field($invoice[$Config::INPUTS_PREFIX.'client']['beneficiary'])) : ''; ?>" />
    </div>
    <div class="mb-4">
        <div><label><b><?php esc_html_e( 'Zip Code:', 'kirilkirkov-pdf-invoice-manager' ); ?></b></label></div>
        <input type="text" class="client-zip-code-input" name="<?php echo esc_attr($Config::INPUTS_PREFIX).'client[zip_code]'; ?>" value="<?php echo isset($invoice[$Config::INPUTS_PREFIX.'client']['zip_code']) ? esc_attr(sanitize_text_field($invoice[$Config::INPUTS_PREFIX.'client']['zip_code'])) : ''; ?>" />
    </div>
</div>