<?php

$groups  = ftm_geo_target_currentGroups();

$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-site-groups" class="btn btn-success">Back to groups</a>
            </div>
            <?php
            if($sidebar_mode === "add") {?>
                <h2 class="hndle"><span><?php esc_attr_e(
                            'Add Group', 'wp_admin_style'
                        ); ?></span></h2>

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

                <div class="inside">
                    <input class="btn btn-primary" type="submit" form="edit_group_form" onclick="return special_validation('edit_group_form','groupid');" name="edit_internal" value="<?php esc_attr_e('Update group'); ?>"/>
                </div>
                <h2 class="hndle"><span><?php esc_attr_e(
                            'Delete Group', '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_group_form','group_delete_id','<?php echo($groupID);?>');" name="delete_group" type="submit">Delete</button>
                </div>
                <!-- .inside -->
            <?php
            }
            ?>

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


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

</div>
