<div class="col-sm-10">
    <div class="row gray">
        <div class="col-sm-10 ">
            <div class="col-sm-12">
                <h3>Add Coupon</h3>  
                <hr>
            </div>
            <div class="col-sm-12"><br></div>
            <div class="col-sm-12"><br></div>
            <div class="col-sm-12">
                <div class="col-sm-12  ">
                    <?php
//                    formID3
//                    echo validation_errors();
                    $url = 'add-coupon';
                    echo form_open_multipart($url, 'class="cmxform" id="" name="add_coupon_form"');
                    ?>
                    <div class="form-group col-sm-12">
                        <div class="col-sm-6">
                            <div class="input-group">
                                <input type="text"
                                       name="coupon_name"
                                       id="coupon_name"
                                       class="form-control validate[required, custom[couponNameExists]]"
                                       value="<?php echo set_value('coupon_name'); ?>"
                                       maxlength="256"
                                       oninput="getCouponName(this.value,'<?php echo base_url() . 'check-coupon-name' ?>')"
                                       placeholder="Please Type Coupon Name..">
                                <span class="input-group-addon"  title="Please Type Coupon Name"><i class="fa fa-bank"></i></span>
                            </div>
                            <input type="hidden" id="coupon_name_existence" value="">
                            <div id="coupon_name_error" style="color: red"><?php echo form_error('coupon_name'); ?></div>
                        </div>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <input type="text" 
                                       class="form-control validate[required, custom[couponCodeExists],custom[urlSpecialCaracter], custom[spaceFunction], custom[checkUrlHypen], custom[checkUrlHypenLast]]"
                                       name="coupon_code"
                                       id="coupon_code"
                                       value="<?php echo set_value('coupon_code'); ?>"
                                       maxlength="50"
                                       oninput="getCouponCode(this.value,'<?php echo base_url() . 'check-coupon-code' ?>')"
                                       placeholder="Please Type Coupon Code..">
                                <span class="input-group-addon"  title="Please Type Coupon Code"><i class="fa fa-empire"></i></span>
                            </div>
                            <input type="hidden" id="coupon_code_existence" value="">
                            <div id="coupon_code_error" style="color: red"><?php echo form_error('coupon_code'); ?></div>
                        </div>
                    </div>   
                    <div class="form-group col-sm-12"></div>



                    <div class="form-group col-sm-12">
                        <div class="col-sm-6">
                            <label class="col-sm-5 text-left padding-zero" for="person_status"> Coupon Expire Type:</label>
                            <div class="radio radio-success col-sm-7 margin-zero" >
                                <input type="radio" 
                                       name="coupon_expire_type"
                                       data-errormessage-value-missing="Please Select Coupon Expire Type" 
                                       class="validate[required]"
                                       id="date" 
                                       value="2" 
                                       onclick="getCouponType(this.value)">
                                <label for="date">Date</label>
                                <span style="margin-right: 30px"></span>
                                <input type="radio" 
                                       name="coupon_expire_type"
                                       data-errormessage-value-missing="Please Select Coupon Expire Type" 
                                       class="validate[required]"
                                       id="number" 
                                       value="1" 
                                       onclick="getCouponType(this.value)">
                                <label for="number">Number</label>
                            </div>
                            <div class="col-sm-12" id="coupon_expire_type_error" style="color: red"><?php echo form_error('coupon_expire_type'); ?></div>
                        </div>
                        <div class="col-sm-6" id="use_coupon_number_view" style="display: none">
                            <div class="input-group">
                                <input type="text"
                                       class="form-control validate[required, custom[integer], custom[nonZeroValue]]"
                                       name="coupon_can_use_number"
                                       id="coupon_can_use_number"
                                       value="<?php echo set_value('coupon_can_use_number'); ?>"
                                       maxlength="11"
                                       placeholder="How many times use Coupon..."   >
                                <span class="input-group-addon"  title="How many times use Coupon"><i class="fa fa-gift"></i></span>
                            </div>
                            <div id="coupon_can_use_number_error" style="color: red"><?php echo form_error('coupon_can_use_number'); ?></div>
                        </div>
                    </div>   
                    <div class="form-group col-sm-12"></div>




                    <div class="form-group col-sm-12" id="use_coupon_date_view" style="display: none">
                        <div class="col-sm-6">
                            <div class='input-group' id='datetimepicker5'>
                                <input type='text' 
                                       class="form-control validate[required, custom[mindate]] text-input"
                                       id="coupon_start_date"
                                       name="coupon_start_date"
                                       value="<?php echo set_value('coupon_start_date'); ?>"
                                       placeholder="Coupon Start date"/>
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-calendar" title="Course Start date"></span><br>
                                </span>
                            </div>
                            <div id="coupon_start_date_error" style="color: red"><?php echo form_error('coupon_start_date'); ?></div>
                        </div>
                        <div class="col-sm-6">
                            <div class='input-group' id='datetimepicker6'>
                                <input type='text' 
                                       class="form-control validate[required, custom[mindate], custom[couponFinishedDate]] text-input"
                                       id="coupon_finish_date"
                                       name="coupon_finish_date"
                                       value="<?php echo set_value('coupon_finish_date'); ?>"
                                       placeholder="Coupon End date"/>
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-calendar" title="Course Start date"></span><br>
                                </span>
                            </div>
                            <div id="coupon_finish_date_error" style="color: red"><?php echo form_error('coupon_finish_date'); ?></div>
                        </div>
                        <div class="form-group col-sm-12"></div>
                    </div>   





                    <div class="form-group col-sm-12">
                        <div class="col-sm-6">
                            <label class="col-sm-5 text-left padding-zero" for="person_status"> Coupon Price Type:</label>
                            <div class="radio radio-success col-sm-7 margin-zero" >
                                <input type="radio"
                                       data-errormessage-value-missing="Please Select Coupon Price Type" 
                                       class="validate[required]"
                                       name="coupon_price_type" 
                                       id="fixed" 
                                       value="2" 
                                       onclick="getCouponPriceType(this.value)">
                                <label for="fixed">Fixed</label>
                                <span style="margin-right: 30px"></span>
                                <input type="radio"
                                       data-errormessage-value-missing="Please Select Coupon Price Type" 
                                       class="validate[required]"
                                       name="coupon_price_type" 
                                       id="percentage" 
                                       value="1" 
                                       onclick="getCouponPriceType(this.value)">
                                <label for="percentage">Percentage</label>
                            </div>
                            <div class="col-sm-12" id="coupon_price_type_error" style="color: red"><?php echo form_error('coupon_price_type'); ?></div>
                        </div>
                        <div class="col-sm-6" id="coupon_amount_view" style="display: none">
                            <div class="input-group">
                                <input type="text"
                                       class="form-control validate[required, custom[number], custom[nonZeroValue]]"
                                       name="coupon_discount_amount2"
                                       id="coupon_discount_amount2"
                                       maxlength="13"
                                       value="<?php echo set_value('coupon_discount_amount2'); ?>"
                                       placeholder="Please Type Coupon Amount...."   >
                                <span class="input-group-addon"  title="Please Type Coupon Amount"><i class="fa fa-number"></i></span>
                            </div>
                            <div class="col-sm-12" id="coupon_discount_amount2_error" style="color: red"><?php echo form_error('coupon_discount_amount2'); ?></div>
                        </div>
                        <div class="col-sm-6" id="coupon_amount_discount_view" style="display: none">
                            <div class="input-group">
                                <input type="text" 
                                       class="form-control validate[required, custom[number], custom[nonZeroValue]]"
                                       name="coupon_discount_amount1"
                                       id="coupon_discount_amount1"
                                       maxlength="13"
                                       value="<?php echo set_value('coupon_discount_amount1'); ?>"
                                       placeholder="Please Type Coupon Discount Amount...."   >
                                <span class="input-group-addon"  title="Please Type Coupon Discount Amount"><i class="fa fa-number"></i></span>
                            </div>
                            <div class="col-sm-12" id="coupon_discount_amount1_error" style="color: red"><?php echo form_error('coupon_discount_amount1'); ?></div>
                        </div>
                    </div>   
                    <div class="form-group col-sm-12"></div>




                    <div class="form-group col-sm-12">
                        <div class="col-sm-12">
                            <label class="col-sm-2 text-left padding-zero" for="person_status"> Coupon Type:</label>
                            <div class="radio radio-success col-sm-7 padding-zero" style="margin: 0 0 0 45px;">
                                <input type="radio"
                                       data-errormessage-value-missing="Please Select Coupon User Type" 
                                       class="validate[required]"
                                       name="coupon_type"
                                       id="feature" 
                                       value="1">
                                <label for="feature">Feature</label>
                                <span style="margin-right: 30px"></span>
                                <input type="radio"
                                       data-errormessage-value-missing="Please Select Coupon User Type" 
                                       class="validate[required]"
                                       name="coupon_type" 
                                       id="course" 
                                       value="2">
                                <label for="course">Course</label>
                                <span style="margin-right: 30px"></span>
                                <input type="radio"
                                       data-errormessage-value-missing="Please Select Coupon User Type" 
                                       class="validate[required]"
                                       name="coupon_type" 
                                       id="video_course" 
                                       value="3">
                                <label for="video_course">Video Course</label>
                            </div>
                            <div class="col-sm-12" id="coupon_type_error" style="color: red"><?php echo form_error('coupon_type'); ?></div>
                        </div>
                    </div>   
                    <div class="form-group col-sm-12"></div>





                    <div class="form-group col-sm-12">
                        <div class="col-sm-12">
                            <label class="col-sm-2 text-left padding-zero" for="person_status"> Coupon Status :</label>
                            <div class="radio radio-success col-sm-7 padding-zero" style="margin: 0 0 0 45px;">
                                <input type="radio"
                                       data-errormessage-value-missing="Please Select Coupon Status" 
                                       class="validate[required]"
                                       name="coupon_status" 
                                       id="active" 
                                       value="1">
                                <label for="active">Active</label>
                                <span style="margin-right: 30px"></span>
                                <input type="radio"
                                       data-errormessage-value-missing="Please Select Coupon Status" 
                                       class="validate[required]"
                                       name="coupon_status" 
                                       id="inactive" 
                                       value="2">
                                <label for="inactive">Inactive</label>
                            </div>
                            <div class="col-sm-12" id="coupon_price_type_error" style="color: red"><?php echo form_error('coupon_status'); ?></div>
                        </div>
                    </div>   
                    <div class="form-group col-sm-12"></div>



                    <div class="form-group col-sm-4 col-sm-offset-4">
                        <input type="submit" class="green-btn btn btn-default" value="Add  Coupon !"><br/><br/>
                    </div>
                    <div class="col-sm-3"></div>
                    <?php echo form_close(); ?>
                </div>
            </div>
        </div>
    </div>
    <br>
    <br>

    <div class="col-sm-12 gray text-left">
        <label><a href="<?php echo base_url() ?>super_admin">Dashboard </a>->><a href="<?php echo base_url() ?>super_admin/manage_coupon">Manage Coupon </a>->>Add Coupon</label>
    </div>   
</div>
<script type="text/javascript" src="<?php echo base_url()?>back_end_resource/coupon/coupon.js">
</script>
<script>
    document.forms['add_coupon_form'].elements['coupon_expire_type'].value = '<?php echo set_value('coupon_expire_type'); ?>';
    getCouponType('<?php echo set_value('coupon_expire_type'); ?>');
    document.forms['add_coupon_form'].elements['coupon_price_type'].value = '<?php echo set_value('coupon_price_type'); ?>';
    document.forms['add_coupon_form'].elements['coupon_type'].value = '<?php echo set_value('coupon_type'); ?>';
    document.forms['add_coupon_form'].elements['coupon_status'].value = '<?php echo set_value('coupon_status'); ?>';
    getCouponPriceType('<?php echo set_value('coupon_price_type'); ?>');
</script>