<div class="wrapper">
    <div class="container">
        <!-- Page-Title -->
        <div class="row">
            <div class="col-sm-12">
                <h4 class="page-title">Add Coupon Category:</h4>
            </div>
        </div>
        <?php if ($this->session->flashdata('Success') && $this->session->flashdata('Success') != ""){  ?>
        <div class="row">
            <div class="col-sm-12">
                <div class="alert alert-success">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                    <strong>Success!</strong> <?php echo $this->session->flashdata('Success'); ?>
                </div>
            </div>
        </div>
        <?php } ?>
        <?php if ($this->session->flashdata('Error') && $this->session->flashdata('Error') != ""){  ?>
        <div class="row">
            <div class="col-sm-12">
                <div class="alert alert-danger">
                    <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                    <strong>Error!</strong> <?php echo $this->session->flashdata('Error'); ?>
                </div>
            </div>
        </div>
        <?php } ?>
        <div class="row" id="divselection">
            <div class="col-sm-12">
                <div class="card-box ">
                    <h4 class="header-title m-t-0 m-b-30"></h4>
                    <form method="post" action="<?php echo base_url();?>coupon_controller/create_coupon_category">
                        <input type="hidden" name="csrf_test_name" id="account_head_csrf" value=""/>
                        <div class="form-group">
                            <div class="row m-t-20">
                                <div class="col-md-6">
                                    <label class="form-label">Coupon Category Title</label>
                                    <input class="form-control" name="coupon_category" value = "" required="required">
                                </div>
                                
                                <div class="col-md-6">
                                    <label class="form-label">Category Type</label>
                                    <select class="form-control" name="coupon_type" required="required">
                                        <option value="service">Discount on Services</option>
                                        <option value="service">Discount on Invoice</option>
                                    </select>
                                </div>
                                
                            </div>
                            <div class="row m-t-20">
                               <div class="col-md-6">
                                    <label class="form-label">Category Prefix</label>
                                    <input class="form-control" name="coupon_category_prefix" value = "" required="required">
                                </div>
                            
                               <div class="col-md-6">
                                    <label class="form-label">Category Discount %</label>
                                    <input class="form-control" type="number" step="0.1" min="1" max="100" name="discount_perc" value = "10" required="required">
                                </div>
                            
                            </div>  
                            <div class="row m-t-20">
                               <div class="col-md-6">
                                    <label class="form-label">Category Description</label>
                                    <textarea class="form-control" name="coupon_category_desc" value = "" required="required"></textarea>
                                </div>
                                
                                 <div class="col-md-6">
                                    <div class="btn-group pull-right m-t-15">
                                        <a href="<?php echo base_url();?>coupon_category" class="btn waves-effect waves-light btn-default m-t-20">Back</a>
                                        <button type="submit" onclick="$('#account_head_csrf').val($('#cook').val());" class="btn waves-effect waves-light btn-pink m-t-20">Save</button>
                                    </div>
                                </div>
                            </div>  
                            
                        </div>
                    </form>
                </div>
            </div>
        </div>    
    </div>
</div>

<script>
    $(document).ready(function() {

        toastr.options = {
            "closeButton": true,
            "debug": true,
            "newestOnTop": true,
            "progressBar": true,
            "positionClass": "toast-bottom-center",
            "preventDuplicates": true,
            "onclick": null,
            "showDuration": "300",
            "hideDuration": "1000",
            "timeOut": "5000",
            "extendedTimeOut": "1000",
            "showEasing": "swing",
            "hideEasing": "linear",
            "showMethod": "fadeIn",
            "hideMethod": "fadeOut"
        }

        $(".numeric").keypress(function(e) {
            //if the letter is not digit then display error and don't type anything
            if (e.which != 13 && e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
                return false;
            }
        });
    });

</script>