<?php
defined('ABSPATH') or die('No script kiddies please!!');
?>
<div class="ciws-settings-section" data-settings-ref="account">
    <div class="ciws-field-wrap">
        <label>
            <?php esc_html_e('Account Name', 'chat-in-website'); ?>
        </label>
        <div class="ciws-field ciws-checkbox-toggle">
            <input class="ciws-account-field-name" name="account_name" type="text"
                value="<?php echo esc_attr((!empty($account_name)) ? $account_name : ''); ?>" required="required" />
        </div>
    </div>
    <div class="ciws-field-wrap">
        <label>
            <?php esc_html_e('Profile Photo', 'chat-in-website'); ?>
        </label>
        <div class="ciws-field ciws-checkbox-toggle">
            <input type="button" class="ciws-profile-button" value="Click to Upload Profile Photo" />

            <input name="ciws_settings[account][profile_photo]" type="hidden"
                value="<?php echo (!empty($ciws_account_settings['account']['profile_photo'])) ? esc_attr($ciws_account_settings['account']['profile_photo']) : ''; ?>" />

            <div class="profile-image-preview">
                <?php
                if (!empty($ciws_account_settings['account']['profile_photo'])) { ?>
                    <img
                        src="<?php echo (!empty($ciws_account_settings['account']['profile_photo'])) ? esc_attr($ciws_account_settings['account']['profile_photo']) : ''; ?>" />
                <?php } ?>
            </div>

        </div>
    </div>
    <div class="ciws-field-wrap">
        <label>
            <?php esc_html_e('Account Number', 'chat-in-website'); ?>
        </label>
        <div class="ciws-field ciws-checkbox-toggle">
            <input name="ciws_settings[account][account_number]" id="account-number" type="text"
                value="<?php echo (!empty($ciws_account_settings['account']['account_number'])) ? esc_attr($ciws_account_settings['account']['account_number']) : ''; ?>"
                required="required" />
            <small>WhatsApp number (e.g., +1234567890)</small>
            <div id="error-message" class="ciws-error-mesg" style=" display: none;">Invalid phone number format. Please
                include a country code starting with +.</div>
        </div>

    </div>

    <div class="ciws-field-wrap">
        <label>
            <?php esc_html_e('Default Message', 'chat-in-website'); ?>
        </label>
        <div class="ciws-field ciws-checkbox-toggle">
            <textarea name="ciws_settings[account][default_msg]" class="ciws-bknd-txt-area" rows="4"
                cols="50"><?php echo (!empty($ciws_account_settings['account']['default_msg'])) ? esc_attr(rtrim($ciws_account_settings['account']['default_msg'])) : ''; ?></textarea>
        </div>

    </div>
    <?php
    $account_online = (!empty($ciws_account_settings['account']['online'])) ? 1 : 1;
    ?>
    <div class="ciws-field-wrap">
        <label>
            <?php esc_html_e('Always Online (Available)', 'chat-in-website'); ?>
        </label>
        <div class="ciws-field ciws-checkbox-toggle">
            <input type="checkbox" class="ciws-customize-status" name="ciws_settings[account][online]" value="1" <?php checked($account_online, '1'); ?>>
            <label></label>
        </div>
    </div>
</div>