<?php

defined('ABSPATH') or die('No script kiddies please!'); 
$s = substr(str_shuffle(str_repeat("0123456789abcdefghijklmnopqrstuvwxyz", 5)), 0, 5);

// echo "<pre>";
// print_r($wpwab_settings);
// echo "</pre>";

?>
<div class="wrap wpwab-wrap">
    <div class="wpwab-content-wrap">
        <div class="wpwab-element wpwab-abc wpwab-clearfix">
            <span class="abc fa fa-arrows"></span>
            <label>
                <h3> 
                    <span class="wpwab-label-keyup "> <?php echo $value['contact_number']; ?> </span> 
                </h3>
            </label>
            <div class="wpwab-element-action-buttons">
                <a href="javascript:void(0)" class="wpwab-elements-settings-trigger button-primary">Settings</a>
                <a href="javascript:void(0)" class="wpwab-elements-delete-trigger button-primary">Delete</a>
                <span class="fa fa-chevron-down"></span>
            </div>
        </div>
        <div class = "wpwab-elements-settings-wrap" style="display:none;" >
            <div class="wpwab-field-wrap">
                <label> <?php _e('WhatsApp Contact Number', wpwab_TD); ?> </label>
                <div class="wpwab-field">
                    <input type="tel" id="wpwab_contact_number" class="wpwab_contact_number wpwab-label-class" name="wpwab_settings[multiple][<?php echo $s; ?>][contact_number]" value="<?php echo isset($value['contact_number']) && $value['contact_number'] != '' ? $value['contact_number'] :''  ?>" placeholder="Contact Number" autocomplete="off" />
                    <p class="description"><?php _e('Note: Please enter your valid mobile number with your country code(for example for Nepal user it will be +9779849121091).', wpwab_TD) ?> </p>
                </div>
            </div>
            
            <div class="wpwab-field-wrap" >
                <label for="wpwab_button_text_value"><?php _e( 'Button Text', wpwab_TD ); ?></label>
                <div class="wpwab-field">
                    <input type="text" name="wpwab_settings[multiple][<?php echo $s; ?>][button_text]" id="wpwab_button_text_value" value="<?php echo (isset($value['button_text'])) ? esc_attr($value['button_text']) : ''; ?>" placeholder="Insert Button Text"/>
                    <label for="wpwab_button_text_value"></label>
                    <p class="description"><?php _e('Please add text on button to display.', wpwab_TD) ?></p>
                </div>
            </div>

            <div class="wpwab-field-wrap" >
                <label for="wpwab_button_text_value"><?php _e( 'Button Description Text', wpwab_TD ); ?></label>
                <div class="wpwab-field">
                    <input type="text" name="wpwab_settings[multiple][<?php echo $s; ?>][button_description]" id="wpwab_button_description_value" value="<?php echo (isset($value['button_description'])) ? esc_attr($value['button_description']) : ''; ?>" placeholder="Insert Button description"/>
                    <label for="wpwab_button_description_value"></label>
                    <p class="description"><?php _e('Please add description for the button text', wpwab_TD) ?></p>
                </div>
            </div>

            <div class="wpwab-field-wrap" >
                <label for='wpwab_button_text_position'><?php _e( 'Button Text Align', wpwab_TD ); ?></label>
                <div class="wpwab-field">
                    <label><input type="radio" name="wpwab_settings[multiple][<?php echo $s; ?>][button_text_position]" id="wpwab_button_text_position"  value="left" <?php echo (isset ($value['button_text_position']) && $value['button_text_position']=='left') ?'checked = "checked"' :''; ?> >Left</label>
                    <label><input type="radio" name="wpwab_settings[multiple][<?php echo $s; ?>][button_text_position]" id="wpwab_button_text_position" value="right" <?php echo (isset ($value['button_text_position']) && $value['button_text_position']=='right') ?'checked = "checked"' :''; ?> >Right</label><br/>
                </div>
            </div>

            <div class="wpwab-field-wrap">
                <label ><?php _e( 'Choose Icon', wpwab_TD ); ?></label>
                <div class="wpwab-field">
                    <select name="wpwab_settings[multiple][<?php echo $s; ?>][icon]" class=" wpwab-icon"  >
                        <option id="wpwab-select-likeicon-via" value="default" <?php if (isset($value['icon']) && $value['icon'] == 'default') { ?>selected="selected"<?php } ?>>
                            <?php
                            _e('Default Icon', wpwab_TD);
                            ?>
                        </option>
                        <option id="wpwab-select-likeicon-via" value="custom" <?php if (isset($value['icon']) && $value['icon'] == 'custom') { ?>selected="selected"<?php } ?>>
                            <?php
                            _e('Upload Custom Image', wpwab_TD);
                            ?>
                        </option>
                    </select>
                </div> 
            </div>

            <div class="wpwab-field-wrap wpwab-upload-wrapper" <?php echo (isset($value['icon']) && $value['icon'] == "custom") ? "style='display:block;'" : "style='display:none;'"; ?>>

                <label><?php _e('Upload Image', wpwab_TD); ?></label>

                <div class="wpwab-field">
                    <div>
                        <input type="text" name="wpwab_settings[multiple][<?php echo $s; ?>][custom_icon]" class="wpwab-form-field" value="<?php echo isset($value['custom_icon']) && $value['custom_icon'] != '' ? $value['custom_icon'] : '' ; ?>"/>
                        <input type="button" class="button-primary wpwab-media-uploader" value="<?php _e('Upload Image', wpwab_TD); ?>"/>
                    </div>
                    <div>
                        <span class="wpwab-custom-preview wpwab-preview-icon">
                            <?php if (isset($value['custom_icon']) && $value['custom_icon'] != '') { ?>
                                <span class="wpwab-preview">
                                    <?php _e('Preview', wpwab_TD); ?>
                                </span>
                                <img src="<?php echo esc_url($value['custom_icon']); ?>"/>
                            <?php } ?>
                        </span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>