<?php

$ctas  = ftm_geo_target_currentCtas();

$sidebar_mode = "add";

if($sidebar_action){
   $sidebar_mode = $sidebar_action;
}

?>
<div id="postbox-container-1" class="postbox-container">

    <div class="meta-box-sortables">

        <div class="postbox">

            <div class="handlediv" title="Click to toggle"><br></div>
            <!-- Toggle -->

            <div class="inside">
                <a href="admin.php?page=ftm-geo-target-ctas" class="btn btn-success">Back to CTAs</a>
            </div>
            <?php
            if($sidebar_mode === "add") {?>
                <h2 class="hndle"><span><?php esc_attr_e(
                            'Add CTA', 'wp_admin_style'
                        ); ?></span></h2>

                <div class="inside">
                    <input class="btn btn-primary" type="submit" form="add_cta_form" onclick="return special_validation('add_cta_form', '');" name="add_internal" value="<?php esc_attr_e('Add CTA'); ?>"/>
                </div>
                <!-- .inside -->
            <?php
            }
            elseif ($sidebar_mode === "edit"){?>
                <h2 class="hndle"><span><?php esc_attr_e(
                            'Edit CTA', 'wp_admin_style'
                        ); ?></span></h2>

                <div class="inside">
                    <input class="btn btn-primary" type="submit" form="edit_cta_form" onclick="return special_validation('edit_cta_form','ctaid');" name="edit_internal" value="<?php esc_attr_e('Update CTA'); ?>"/>
                </div>
                <h2 class="hndle"><span><?php esc_attr_e(
                            'Delete CTA', 'wp_admin_style'
                        ); ?></span></h2>

                <div class="inside">
                    <button class="btn btn-danger"  data-bs-toggle="modal" data-bs-target="#delete_modal"  onclick="fill_confirm_popup_key_value('delete_cta_form','cta_delete_id','<?php echo($ctaID);?>');" name="delete_cta" type="submit">Delete</button>
                </div>
                <!-- .inside -->
            <?php
            }
            ?>

        </div>
        <!-- .postbox -->


    </div>
    <!-- .meta-box-sortables -->

</div>
