<style>
    .group_descrip{
        overflow-wrap: break-word;
    }
</style>
<div class="col-sm-8">
    <div class="row ">
        <div class="col-sm-12">
            <div class="col-sm-12 gray">
                <div class="col-sm-12">
                    <div class="col-sm-6">
                        <h3><strong>Group Details</strong></h3>
                    </div>
                   
                </div>
                <div class="col-sm-12"><hr></div>

                <div class="col-sm-12 padding-zero">

                    <div class="col-sm-12 text-left" style="line-height: 30px">
                        <div class="col-sm-12">
                            <strong>Group Name : <?php echo $group_details->group_name; ?></strong>
                        </div>
                        <br>
                        <br>
                        <div class="col-sm-3">
                            <strong>Total Members : <?php echo count($group_member_list); ?></strong>
                        </div>
                        <div class="col-sm-3">
                            <strong>Member Pending : <?php echo count($group_requested_members); ?></strong>
                        </div>
                        <div class="col-sm-5">
                            <strong>
                                <?php
                                 $person_id = $this->session->userdata('user_id');
                                if ($group_details->group_created_by== $person_id){ ?>
                                Group Status : 
                                <?php
                                $group_status = $group_details->group_status;
                                if ($group_status == 0) {
                                    ?>Unpublished
                                    <a href="#" onclick="return checkForAction('<?php echo base_url() . 'publish-group/' . $group_details->url; ?>', 'Publish')">
                                        <i class="fa  fa-user-plus" title="Publish"></i>
                                    </a>&nbsp;&nbsp;
                                <?php } else if ($group_status == 1) { ?>Published
                                    <a href="#" onclick="return checkForAction('<?php echo base_url() . 'unpublish-group/' . $group_details->url; ?>', 'Unpublish')">
                                        <i class="fa  fa-user-times" title="Unpublish"></i>
                                    </a>&nbsp;&nbsp;
                                <?php } else if ($group_status == 2) { ?>Archive
                                    <a href="#" onclick="return checkForAction('<?php echo base_url() . 'publish-group/' . $group_details->url; ?>', 'Publish')">
                                        <i class="fa  fa-user-plus" title="Publish"></i>
                                    </a>&nbsp;&nbsp;
                                <?php } ?>

                                <?php if ($group_status != 2) { ?>
                                    <a href="#" onclick="return checkForDelete('<?php echo base_url() . 'archive-group/' . $group_details->url; ?>')">
                                        <i class="fa fa-trash-o" title="Delete"></i>
                                    </a>&nbsp;&nbsp;
                                <?php } } ?>
                            </strong>
                        </div>
                    </div>

                    <script>
                        function checkForAction(url, action) { // check for Active Inactives
                            swal({
                                title: "",
                                text: "Are you sure you want to " + action + " this Group?",
                                type: "warning",
                                showCancelButton: true,
                                confirmButtonColor: '#8CC73F',
                                confirmButtonText: 'Yes',
                                cancelButtonText: "No",
                                closeOnConfirm: true,
                                closeOnCancel: true
                            },
                            function (isConfirm) {
                                if (isConfirm) {
                                    document.location.href = url;
                                }
                            });
                        }

                        function checkForDelete(url) {
                            swal({
                                title: "",
                                text: "Are you sure you want to Delete this Group?",
                                type: "warning",
                                showCancelButton: true,
                                confirmButtonColor: '#8CC73F',
                                confirmButtonText: 'Yes!',
                                cancelButtonText: "No!",
                                closeOnConfirm: true,
                                closeOnCancel: true
                            },
                            function (isConfirm) {
                                if (isConfirm) {
                                    document.location.href = url;
                                }
                            });
                        }
                    </script>

                    <div class="col-sm-12"><br></div>

                    <div class="col-sm-12" style="line-height: 30px ">
                        <div class="col-sm-12 text-left">
                            <strong>Group Description : </strong>
                        </div>
                        <div class="col-sm-12">
                            <span class="text-justify group_descrip">
                                <p><?php echo $group_details->group_description; ?></p>
                            </span>
                        </div>
                    </div>
                    <br>
                    <form action="invite_message.html" method="post">

                        <div class="col-sm-8 text-left" style="line-height: 30px">
                            <div class="col-sm-12">
                                <strong>Group Invitation Code : </strong><br>
                                <div class="input-group">
                                    <input type="text" 
                                           class="form-control" 
                                           placeholder="Please Type  Invitation Code.."   
                                           value="<?php echo $group_details->group_public_id; ?>">
                                    <span class="input-group-addon"  title="Please Type  Invitation Code"><i class="fa fa-newspaper-o"></i></span>
                                </div>
                            </div>
                            <div class="col-sm-12"><br></div>
<!--                            <div class="col-sm-12">
                                <strong>Group Public URL : </strong><br>
                                <div class="input-group">
                                    <input type="text" class="form-control" placeholder=""  
                                           value="<?php // echo base_url() . 'group/' . $group_details->url . '/'; ?>" >
                                    <span class="input-group-addon"  title="Please Type  Invitation Code"><i class="fa fa-newspaper-o"></i></span>
                                </div>
                            </div>-->
                            <div class="col-sm-12"><br></div>
<!--                            <div class="col-sm-12">
                                <strong>Group Invitation URL : </strong><br>
                                <div class="input-group">
                                    <input type="text" class="form-control" 
                                           placeholder="Please Type  Invitation URL.."  
                                           value="<?php // echo base_url() . 'group-invite/' . $group_details->group_public_id . '/'; ?>" >
                                    <span class="input-group-addon"  title="Please Type  Invitation Code"><i class="fa fa-newspaper-o"></i></span>
                                </div>
                            </div>-->

                            <div class="col-sm-12"><br></div>
<!--                            <div class="col-sm-12">
                                <a href="<?php // echo base_url() . 'group-invitation/' . $group_details->url; ?>" class="btn btn-success">
                                    Send Invitation Message
                                </a>
                            </div>-->

                        </div>
                    </form>

                    <div class="col-sm-6">

                    </div>

                </div>
            </div>
        </div>
    </div>

</div>
