
<div class="error-main"></div>
<div class="form-group input-container">
    <label for="Name" class=" form-control-label">Promocode</label>
    <input type="text" name="name" id="name" placeholder="Promocode" class="form-control" value="<?php if(isset($data['cl_name'])){echo $data['cl_name'];}?>" />
    <div class="error-input"></div>
</div>
 <div class="form-group input-container">
    <label for="Name" class=" form-control-label">Description</label>
    <textarea name="description" id="description" placeholder="Description" class="form-control" ><?php if(isset($data['cl_description'])){echo $data['cl_description'];}?></textarea>
    <div class="error-input"></div>
</div>
<div class="form-group input-container">
    <label for="Name" class=" form-control-label">Maximum number of attempts (0 for unlimited)</label>
    <input type="text" name="max_number_attmpts" id="max_number_attmpts" placeholder="Maximum Number of attempts" class="form-control" value="<?php if(isset($data['cl_max_number_attmpts'])){echo $data['cl_max_number_attmpts'];}?>" />
    <div class="error-input"></div>
</div>
<div class="form-group input-container">
    <label for="Name" class=" form-control-label">Maximum Number of attempts per each user (0 for unlimited)</label>
    <input type="text" name="max_number_attmpts_user" id="max_number_attmpts_user" placeholder="Maximum Number of attempts for each user" class="form-control" value="<?php if(isset($data['cl_max_number_attmpts_user'])){echo $data['cl_max_number_attmpts_user'];}?>" />
    <div class="error-input"></div>
</div>
<div class="form-group input-container type_minimum_amount">
    <label for="Description" class=" form-control-label">Minimum Amount for discount to Apply</label>
    <input type="text" id="minimum_amount" name="minimum_amount" placeholder="Minimum Amount for discount to Apply" class="form-control" value="<?php if(isset($data['cl_minimum_amount'])){echo $data['cl_minimum_amount'];}?>" />
    <div class="error-input"></div>
</div>
<div class="form-group input-container">
    <label for="Description" class=" form-control-label">Type</label>
    <select class="form-control" name="type" id="type">
        <option value="">---Select Type---</option>
        <option value="Percentage" <?php if(isset($data['cl_type']) && $data['cl_type'] == 'Percentage'){echo 'selected';}?>>Percentage</option>
        <option value="Amount" <?php if(isset($data['cl_type']) && $data['cl_type'] == 'Amount'){echo 'selected';}?>>Amount</option>
    </select>
    <div class="error-input"></div>
</div>

 <div class="form-group input-container type_percentage" style="<?php if($templateType == 'add'){echo 'display:none';}else if($data['cl_type'] == 'Amount'){echo 'display:none';} ?>">
    <label for="Description" class=" form-control-label">Discount Percentage</label>
    <input type="text" id="Description" name="percentage" placeholder="Discount Percentage" class="form-control" value="<?php if(isset($data['cl_percentage'])){echo $data['cl_percentage'];}?>" />
    <div class="error-input"></div>
</div>
 <div class="form-group input-container type_percentage" style="<?php if($templateType == 'add'){echo 'display:none';}else if($data['cl_type'] == 'Amount'){echo 'display:none';} ?>">
    <label for="Description" class=" form-control-label">Maximum Discount Amount</label>
    <input type="text" id="Description" name="maximum_amount" placeholder="Maximum Discount Amount" class="form-control" value="<?php if(isset($data['cl_maximum_amount'])){echo $data['cl_maximum_amount'];}?>" />
    <div class="error-input"></div>
</div>
 <div class="form-group input-container type_amount" style="<?php if($templateType == 'add'){echo 'display:none';}else if($data['cl_type'] == 'Percentage'){echo 'display:none';} ?>">
    <label for="Description" class=" form-control-label">Amount</label>
    <input type="text" id="Description" name="amount" placeholder="Amount" class="form-control" value="<?php if(isset($data['cl_amount'])){echo $data['cl_amount'];}?>" />
    <div class="error-input"></div>
</div>
 <div class="form-group input-container" >
    <label for="Description" class=" form-control-label">Active</label>
    <select class="form-control" name="active">
        <option value="1" <?php if($templateType == 'edit' && $data['cl_active'] == 1){echo 'selected';} ?>>Yes</option>
        <option value="0" <?php if($templateType == 'edit' && $data['cl_active'] == 0){echo 'selected';} ?>>No</option>
    </select>
    <div class="error-input"></div>
</div>


<div class="form-group">
     <button type="submit" class="track-btn pull-right btn-submit">Submit</button>

</div>

<script>
    jQuery(document).ready(function(){
        jQuery('#type').change(function(){
            if($(this).val() == 'Percentage')
            {
                $('.type_percentage').show();
                $('.type_amount').hide();
            }
            else if($(this).val() == 'Amount')
            {
                $('.type_percentage').hide();
                $('.type_amount').show();
            }
        });
    });

</script>