<?php echo $header; ?><?php echo $column_left; 
//echo "cfhfdd<pre>";
//print_r($field_arr);die;
?>
<div id="content">
    <div class="page-header">
        <div class="container-fluid">
            <div class="pull-right">
                <button type="submit" form="form-toastmsg-cc" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button>
                <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
            <h1><?php echo $heading_title; ?></h1>
            <ul class="breadcrumb">
                <?php foreach ($breadcrumbs as $breadcrumb) { ?>
                    <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
                <?php } ?>
            </ul>
        </div>
    </div>
    <div class="container-fluid">

        <?php
        if ($error_warning) {
            ?>
            <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?>
                <button type="button" class="close" data-dismiss="alert">&times;</button>
            </div>
            <?php
        }
        ?>
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-pencil"></i> <?php echo $text_edit; ?></h3>
            </div>
            <div class="panel-body">
                <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-toastmsg-cc" class="form-horizontal">

                    <?php 
                        if($field_arr){
                            foreach ($field_arr as $value) { 
                    ?>
                        <div class="row">
                             <div class="form-group">
                                <label class="col-sm-2 control-label" for="input-status">Enter # of Cart Item</label>
                                <div class="col-sm-6">
                                   <input class="form-control" type="test" name="no_of_item[]" placeholder="Enter Total no of Cart Item" value="<?php echo $value['no_of_item']; ?>">
                                </div>
                                <a href="#" class="add_more" style="margin-left: 10px;padding: 2px;" title="Click Here to Add More Messages">
                                    <i class="fa fa-plus-square-o fa-2x" aria-hidden="true"></i>
                                </a>
                                <a href="#" class="remove_msg" style="margin-left: 10px;padding: 2px; color:#F00;" title="Remove this Signer">
                                    <i class="fa fa-minus-square-o fa-2x" aria-hidden="true"></i>
                                </a>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label" for="input-status">Enter Message</label>
                                <div class="col-sm-6">
                                    <textarea class="form-control" name="message[]"><?php echo $value['message']; ?></textarea>
                                </div>
                            </div>
                             
                       
                            <div class="form-group">
                                <label class="col-sm-2 control-label" for="input-status">Message Status</label>
                                <div class="col-sm-6">
                                    <select class="form-control" name="status[]">
                                        <option value="1" <?=$value['status'] == '1' ? ' selected="selected"' : '';?>>Enable</option>
                                        <option value="0" <?=$value['status'] == '0' ? ' selected="selected"' : '';?>>Disable</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    <?php 
                            }  ////////////foreach close///////
                        }else{
                    ?>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="input-status">Enter # of Cart Item</label>
                            <div class="col-sm-6">
                               <input class="form-control" type="test" name="no_of_item[]" placeholder="Enter Total no of Cart Item">
                            </div>
                            <a href="#" class="add_more" style="margin-left: 10px;padding: 2px;" title="Click Here to Add More Messages">
                                <i class="fa fa-plus-square-o fa-2x" aria-hidden="true"></i>
                            </a>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="input-status">Enter Message</label>
                            <div class="col-sm-6">
                                <textarea class="form-control" name="message[]"></textarea>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label" for="input-status">Message Status</label>
                            <div class="col-sm-6">
                                <select class="form-control" name="status[]">
                                    <option value="1">Enable</option>
                                    <option value="0">Disable</option>
                                </select>
                            </div>
                        </div>
                    </div>
                <?php } ?>

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

<script type="text/javascript">
    $(document).ready(function(){
        
        $('.panel-body').on('click', '.add_more', function (e) {
            e.preventDefault();
            //alert('sdhshsfhsfhsfh');
            var html = '<div class="row"><div class="form-group"><label class="col-sm-2 control-label" for="input-status">Enter # of Cart Item</label><div class="col-sm-6"><input class="form-control" type="test" name="no_of_item[]" placeholder="Enter Total no of Cart Item"></div><a href="#" class="add_more" style="margin-left: 10px;padding: 2px;" title="Click Here to Add More Messages"><i class="fa fa-plus-square-o fa-2x" aria-hidden="true"></i></a><a href="#" class="remove_msg" style="margin-left: 10px;padding: 2px; color:#F00;" title="Remove this Signer"><i class="fa fa-minus-square-o fa-2x" aria-hidden="true"></i></a></div><div class="form-group"><label class="col-sm-2 control-label" for="input-status">Enter Message</label><div class="col-sm-6"><textarea class="form-control" name="message[]"></textarea></div></div><div class="form-group"><label class="col-sm-2 control-label" for="input-status">Message Status</label><div class="col-sm-6"><select class="form-control" name="status[]"><option value="1">Enable</option><option value="0">Disable</option></select></div></div></div>';
            $(html).insertAfter($(this).closest(".row") );
            return false;
        });

        $('.panel-body').on('click', '.remove_msg', function (e) {
            $(this).parent().parent().remove();
             return false;
        });
    });
</script>
<?php echo $footer; ?>