<?php $__env->startSection('header'); ?>
    <div class="col-lg-8 col-md-6 col-sm-6 col-6 search-box">
        <i class="fa fa-times"></i><i class="fa fa-bars desktop-hidden"></i>
        
       	<form action="<?php echo url('user_dashboard_login'); ?>" method="POST" onsubmit="return checkInp()">
            <span class="mobile-hidden"><i class="fa fa-search"></i>
                <input type="text" class="search-field" placeholder="Enter Mobile Number" name="mobile_no" onkeypress="return isNumberKey(event)">
            </span>
            <button class="btn mobile-hidden" style="diplay:inline-block">GO</button>
        </form>
        <div class="error-message mobile-hidden" style="color:red; margin-top:20px;"><?php echo Session::get('message'); ?></div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
    <div class="section1">
        <div class="row desktop-menu-container">
            <div class="col-lg-11 col-md-11 col-sm-10">
                <div class="row">
                   <?php if(Session::has('employeeuser')): ?>
                        <?php 
                            $employee = Session::get('employeeuser');
                            $permission = explode(",",$employee->permission);
                        ?>
                        <?php if(in_array("1", $permission)): ?>
                            <div class="col-lg-2 col-md-2 padding-0">
                                <div class="menu-list" id="add-credit">add credits</div> 
                            </div>
                        <?php else: ?>
                            <div class="col-lg-2 col-md-2 padding-0">
                                <div class="menu-list">add credits</div> 
                            </div>
                        <?php endif; ?>
                        <?php if($merchant_details->comboPermission == 'Yes'): ?>
                        <?php if(in_array("1", $permission)): ?>
                            <div class="col-lg-2 col-md-2 padding-0">
                                <div class="menu-list" id="redeem-add">redeem & add credits</div> 
                            </div>
                        <?php else: ?>
                            <div class="col-lg-2 col-md-2 padding-0">
                                <div class="menu-list">redeem & add</div> 
                            </div>
                        <?php endif; ?>
                        <?php endif; ?>
                        <?php if(in_array("5", $permission)): ?>
                            <div class="col-lg-2 col-md-2 padding-0">
                                <div class="menu-list" id="redeem-credit">redeem credits</div> 
                            </div>
                        <?php else: ?>
                            <div class="col-lg-2 col-md-2 padding-0">
                                <div class="menu-list">redeem credits</div> 
                            </div>
                        <?php endif; ?>
                        <?php if(in_array("2", $permission)): ?>
                            <div class="col-lg-2 col-md-2 padding-0">
                                <div class="menu-list" id="verify-code">verify code</div> 
                            </div>
                        <?php else: ?>
                            <div class="col-lg-2 col-md-2 padding-0">
                                <div class="menu-list">verify code</div> 
                            </div>
                        <?php endif; ?>
                        <div class="col-lg-2 col-md-2 padding-0">
                            <div class="menu-list" id="booklet">booklets & coupons</div> 
                        </div>
                        <?php if($merchant_details->ewallet == 'Yes'): ?>
                        <div class="col-lg-2 col-md-2 padding-0">
                            <div class="menu-list" id="ewallet" style="text-transform: none;">eWallet</div> 
                        </div>
                        <?php endif; ?>
                    <?php else: ?>
                        <div class="col-lg-2 col-md-2 padding-0">
                            <div class="menu-list" id="add-credit">add credits</div> 
                        </div>
                        <?php if($merchant_details->comboPermission == 'Yes'): ?>
                        <div class="col-lg-2 col-md-2 padding-0">
                            <div class="menu-list" id="redeem-add">redeem & add credits</div> 
                        </div>
                        <?php endif; ?>
                        <div class="col-lg-2 col-md-2 padding-0">
                            <div class="menu-list" id="redeem-credit">redeem credits</div> 
                        </div>
                        <div class="col-lg-2 col-md-2 padding-0">
                            <div class="menu-list" id="verify-code">verify code</div> 
                        </div>
                        <div class="col-lg-2 col-md-2 padding-0">
                            <div class="menu-list" id="booklet">booklets & coupons</div> 
                        </div>
                        <?php if($merchant_details->ewallet == 'Yes'): ?>
                        <div class="col-lg-2 col-md-2 padding-0">
                            <div class="menu-list" id="ewallet" style="text-transform: none;">eWallet</div> 
                        </div>
                        <?php endif; ?>
                    <?php endif; ?>
                </div>
            </div>
            <div class="col-lg-1 col-md-1 col-sm-2 padding-0">
                <div class="expand">
                    Expand <span aria-hidden="true" class="arrow_triangle-left"></span>
                </div>
                <div class="less">
                    Less <span aria-hidden="true" class="arrow_triangle-down"></span>
                </div>
            </div>
        </div>
        <div class="row desktop-hidden">
        	<form action="<?php echo url('user_dashboard_login'); ?>" method="POST">
	            <span class=""><i class="fa fa-search"></i>
	                <input type="text" class="search-field1" placeholder="Enter Mobile Number" name="mobile_no" onkeypress="return isNumberKey(event)">
	            </span>
	            <button class="btn " style="diplay:inline-block">GO</button>
        	</form>
        	<div class="error-message" style="color:red; margin-top:20px;"><?php echo Session::get('message'); ?></div>
        </div>
        <div class="hidden-form">
            <div class="">
                <div class="mobile-menu-list" id="mobile-add-credit">
                    <div class="float-left">add credits</div> 
                    <span class="arrow_carrot-down"></span>
                    <div class="clearfix"></div>
                </div>
                <div class="hidden-section add-credit">
                    <form  method="post" class="add-credit-form">
                        <div class="row">
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Mobile Number</div>
                                <input type="text" name="mobile_no" class="mobile-no disabled" value="<?php echo $user_details->mobile; ?>" readonly>
                                <div class="form-error"></div>
                            </div>
                            <?php if($auto_bill=="No"): ?>
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Bill Number</div>
                                <input type="text" name="bill_no" class="add-credit-bill-no">
                                <div class="form-error"></div>
                            </div>
                            <?php endif; ?>
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Bill Amount</div>
                                <input type="text" name="bill_amount" class="add-credit-bill-amount" onkeypress="return isNumberKey(event)" onkeyup="calculateCreditAwarded()" maxlength="5">
                                <div class="form-error"></div>
                            </div>
                            <div class="col-lg-3 col-md-3 hidden-form-field"></div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Credits to be awarded</div>
                                <?php if($edit_award=="Yes"): ?>
                                    <div class="percentage-container">
                                        <input type="text" name="" class="percentage credit-percentage" value="<?php echo $percentage; ?>"  onkeyup="calculateCreditAwarded()"><i class="fa fa-percent"></i>
                                    </div>
                                <?php else: ?>
                                    <div class="percentage-container">
                                        <input type="text" name="" class="percentage credit-percentage" value="<?php echo $percentage; ?>" onkeyup="calculateCreditAwarded()" readonly><i class="fa fa-percent"></i>
                                    </div>
                                <?php endif; ?>
                                <input type="text" name="credits" class="percentage_value" readonly>
                                <div class="form-error"></div>
                            </div>
                            <div class="col-lg-6 col-md-6 hidden-form-field">
                                <div class="hidden-form-label">Comments</div>
                                    <textarea name="comment" class="add-credit-comment"></textarea>
                                    <div class="form-error"></div>
                                </div>
                            <div class="col-lg-3 col-md-3 hidden-form-field"></div>
                        </div>
                        <div>
                            <button class="add-credit-btn btn">Add Credits</button>
                        </div>
                    </form>
                </div>
            </div>
            <?php if($merchant_details->comboPermission == 'Yes'): ?>
            <div class="">
                <div class="mobile-menu-list" id="mobile-redeem-add">
                    <div class="float-left">redeem & add credits</div>
                    <span class="arrow_carrot-down"></span> 
                    <div class="clearfix"></div>
                </div>
                <div class="hidden-section redeem-add">
                    <form action="<?php echo url('combo_redeem_credits'); ?>" method="post" class="combo-redeem-credit-form">
                        <div class="row">
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Mobile Number</div>
                                <input type="text" name="mobile_no" class="mobile_no disabled" value="<?php echo $user_details->mobile; ?>" readonly>
                                <div class="form-error"></div>
                            </div>
                            <?php if($auto_bill=="No"): ?>
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Bill Number</div>
                                <input type="text" name="bill_no"class="combo-bill-number">
                                <div class="form-error"></div>
                            </div>
                            <?php endif; ?>
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label" >Bill Amount</div>
                                <input type="text" name="bill_amount" class="combo-bill-amount" onkeypress="return isNumberKey(event)" onkeyup="calculateComboRedeemAmount()" maxlength="5">
                                <input type="hidden" class="current_point_for_user_combo" value="<?php echo $card->current_points; ?>">
                                <div class="form-error"></div>
                            </div>
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Credits to be redeemed</div>
                                <input type="text" name="credits_redeemed" class="combo-redeem-credit-redeemed">
                                <div class="form-error"></div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Net Bill Amount</div>
                                <input type="text" name="netbill_amount" class="combo-redeem-net-amount disabled" readonly>
                                <div class="form-error"></div>
                            </div>
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Credits to be awarded</div>
                                <!--<input type="text" name="" class="percentage" value="20%">-->
                                <?php if($edit_award=="Yes"): ?>
                                    <div class="percentage-container">
                                            <input type="text" name="" class="percentage combo-credit-percentage" value="<?php echo $percentage; ?>" onkeyup="calculateCreditAwardedForCombo()"><i class="fa fa-percent"></i>
                                    </div>
                                <?php else: ?>
                                    <div class="percentage-container">
                                            <input type="text" name="" class="percentage combo-credit-percentage" value="<?php echo $percentage; ?>" onkeyup="calculateCreditAwardedForCombo()" readonly><i class="fa fa-percent"></i>
                                </div>
                                <?php endif; ?>
                                <input type="text" name="credits" class="combo_percentage_value" readonly>
                                <div class="form-error"></div>
                            </div>
                            <div class="col-lg-6 col-md-6 hidden-form-field">
                                <div class="hidden-form-label">Comments</div>
                                <textarea name="comment" class="combo-redeem-credit-comment"></textarea>
                            </div>
                        </div>
                        <div>
                            <button class="add-redeem btn">Redeem & Add Credits</button>
                            <!--<button class="add-redeem btn" data-toggle="modal" data-target="#information">Add or Redeem</button>-->
                        </div>
                    </form>
                </div>
            </div>
            <?php endif; ?>
            <div class="">
                <div class="mobile-menu-list" id="mobile-redeem-credit">
                    <div class="float-left">redeem credits</div>
                    <span class="arrow_carrot-down"></span> 
                    <div class="clearfix"></div>
                </div>
                <div class="hidden-section redeem-credit">
                    <form action="<?php echo url('redeem_credits'); ?>" method="post" class="redeem-credit-form">
                        <div class="row">
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Mobile Number</div>
                                <input type="text" name="mobile_no" class="mobile_no disabled" value="<?php echo $user_details->mobile; ?>" readonly>
                                <div class="form-error"></div>
                            </div>
                            <?php if($auto_bill=="No"): ?>
                                <div class="col-lg-3 col-md-3 hidden-form-field">
                                    <div class="hidden-form-label">Bill Number</div>
                                    <input type="text" name="bill_no" class="redeem-credit-bill-no">
                                    <div class="form-error"></div>
                                </div>
                            <?php endif; ?>
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Bill Amount</div>
                                <input type="text" name="bill_amount" class="redeem-credit-bill-amount" onkeypress="return isNumberKey(event)" onkeyup="calculateCreditRedeemed()" maxlength="5">
                                <input type="hidden" class="current_point_for_user" value="<?php echo $card->current_points; ?>">
                                <div class="form-error"></div>
                            </div>
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Credits to be redeemed</div>
                                <input type="text" name="credits_redeemed" class="redeem-credit-redeemed disabled" onkeypress="return isNumberKey(event)" maxlength="5">
                                <div class="form-error"></div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Net Bill Amount</div>
                                <input type="text" name="netbill_amount" class="redeem-net-amount disabled" readonly>
                            </div>
                            <div class="col-lg-6 col-md-6 hidden-form-field">
                                <div class="hidden-form-label">Comments</div>
                                <textarea name="comment" class="redeem-credit-comment"></textarea>
                                <div class="form-error"></div>
                            </div>
                            <div class="col-lg-3 col-md-3"></div>
                        </div>
                        <div>
                            <button class="redeem-credit-btn btn">Redeem Credits</button>
                        </div>
                    </form>
                </div>
            </div>
            <div class="">
                <div class="mobile-menu-list" id="mobile-verify-code">
                    <div class="float-left">verify code</div> 
                    <span class="arrow_carrot-down"></span>
                    <div class="clearfix"></div>
                </div>
                <div class="hidden-section verify-code">
                    <form class="verify-form">
                        <div class="row">
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Mobile Number</div>
                                <input type="text"  name="mobile_no" class="mobile_no disabled" value="<?php echo $user_details->mobile; ?>" readonly>
                            </div>
                            <div class="col-lg-3 col-md-3 hidden-form-field">
                                <div class="hidden-form-label">Verify Code</div>
                                <input type="text" name="code" class="code">
                                <div class="form-error"></div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-lg-6 col-md-6 hidden-form-field">
                                <div class="hidden-form-label">Comments</div>
                                <textarea name="comment" class="redeem-credit-comment"></textarea>
                                <div class="form-error"></div>
                            </div>
                        </div>
                        <div>
                            <button class="verify-code-btn btn">Verify Code</button>
                        </div>
                    </form>
                </div>                        
            </div>
            <div class="">
                <div class="mobile-menu-list" id="mobile-booklet">
                    <div class="float-left">booklets & coupons</div> 
                    <span class="arrow_carrot-down"></span>
                    <div class="clearfix"></div>
                </div>
                <div class="hidden-section booklet">
                    <div class="row redeem-navigation">
                        <div class="col-lg-4 col-md-4 col-sm-4"></div>
                        <div class="col-lg-2 col-md-2 col-sm-2 text-right border-right">
                            <div class="hidden-field-menu-active booklet-menu">Booklets</div>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 text-left">
                            <div class="hidden-field-menu coupon-menu">Coupons</div>
                        </div>
                        <div class="col-lg-4 col-md-4 col-sm-4"></div>
                    </div>
                      <div class="booklet-area">
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 hidden-form-field">
                                <input type="checkbox" class="select-all"> SELECT ALL
                            </div>
                        </div>
                        <div class="row" style="margin-right: 0px; margin-left: 0px;">
                          <?php if(count($c_booklet_list)>0): ?>

                            <?php foreach($c_booklet_list as $eachbooklets): ?>
                            <div class="col-lg-3 col-md-3 col-sm-3 hidden-form-field">
                                <div class="row">
                                    <div class="col-lg-1 col-md-1 col-sm-1" style="padding: 0px!important;">
                                        <input type="checkbox" class="checkbox-input-booklet" value="<?php echo $eachbooklets['booklet_id']; ?>" data-name="<?php echo $eachbooklets['booklet_name']; ?>">
                                    </div>
                                    <div class="col-lg-11 col-md-11 col-sm-11" style="padding: 0 0 0 5px !important;">
                                        <span class="checkbox-text checkbox-text-popup" >
                                            <?php echo $eachbooklets['booklet_name']; ?></span><br><span class="statistic-heading1">
                                            (<?php echo $eachbooklets['no_of_coupons']; ?> Coupon(s) for <?php echo $eachbooklets['booklet_value']; ?> only) 
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <?php endforeach; ?>
                        <?php else: ?>
                            <div class="col-lg-3 col-md-3 col-sm-3 hidden-form-field">No Booklet present</div>
                        <?php endif; ?>
                        </div>
                        
                        <div>
                            <div class="form-error"></div>
                             <input type="hidden" id="user_id1" value="14145">
                            <button class="btn"  id="booklet-send">Confirm</button>
                        </div>
                    </div>
                    <div class="coupon-area">
                        <div class="row">
                            <div class="col-lg-3 col-md-3 col-sm-3 hidden-form-field">
                                <input type="checkbox" class="select-all"> SELECT ALL
                            </div>
                        </div>
                       <div class="row" style="margin-right: 0px; margin-left: 0px;">
                          <?php if(count($tokenlists)>0): ?>

                            <?php foreach($tokenlists as $eachToken): ?>
                            <div class="col-lg-3 col-md-3 col-sm-3 hidden-form-field">
                                <div class="row">
                                    <div class="col-lg-1 col-md-1 col-sm-1" style="padding: 0px!important;">
                                        <input type="checkbox" class="checkbox-input-coupon-send" value="<?php echo $eachToken['id']; ?>" data-name="<?php echo $eachToken['name']; ?>">
                                    </div>
                                    <div class="col-lg-11 col-md-11 col-sm-11" style="padding: 0 0 0 5px !important;">
                                        <span class="checkbox-text">
                                            <?php echo $eachToken['name']; ?></span><br>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <?php endforeach; ?>
                        <?php else: ?>
                            <div class="col-lg-3 col-md-3 col-sm-3 hidden-form-field">No Coupon present</div>
                        <?php endif; ?>
                        </div>
                        <div>
                            <div class="form-error"></div>
                            <button class="btn" id="coupon-send">Confirm</button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="">
                <div class="mobile-menu-list" id="mobile-ewallet">
                    <div class="float-left">e-Wallet</div> 
                    <span class="arrow_carrot-down"></span>
                    <div class="clearfix"></div>
                </div>
                <div class="hidden-section ewallet">
                    <div class="row redeem-navigation">
                        <div class="col-lg-4 col-md-4 col-sm-4"></div>
                        <div class="col-lg-2 col-md-2 col-sm-2 text-right border-right">
                            <div class="hidden-field-menu-active ebooklet-menu" style="text-transform: none;">My eWallets</div>
                        </div>
                        <?php if(Session::has('employeeuser')): ?>
                        <?php 
                            $employee = Session::get('employeeuser');
                            $permission = explode(",",$employee->permission);
                        ?>
                        <?php if(in_array("6", $permission)): ?>
                        <div class="col-lg-2 col-md-2 col-sm-2 text-left">
                            <div class="hidden-field-menu ewallet-menu" style="text-transform: none;">Custom eWallet</div>
                        </div>
                        <?php endif; ?>
                        <?php endif; ?>
                        <div class="col-lg-4 col-md-4 col-sm-4"></div>
                    </div>
                    <div class="ebooklet-area">
                            <div class="row">
                                <div class="col-lg-3 col-md-3 col-sm-3 hidden-form-field">
                                    <input type="checkbox" class="select-all"> SELECT ALL
                                </div>
                            </div>
                              <div class="row" style="margin-right: 0px; margin-left: 0px;">

                          <?php if(count($booklet_list)>0): ?>

                            <?php foreach($booklet_list as $eachbooklet): ?>
                            <div class="col-lg-3 col-md-3 col-sm-3 hidden-form-field">
                                <div class="row">
                                    <div class="col-lg-1 col-md-1 col-sm-1" style="padding: 0px!important;">
                                        <input type="checkbox" class="checkbox-input-ebooklet" value="<?php echo $eachbooklet['booklet_id']; ?>" data-name="<?php echo $eachbooklet['booklet_name']; ?>">
                                    </div>
                                    <div class="col-lg-11 col-md-11 col-sm-11" style="padding: 0 0 0 5px !important;">
                                        <span class="checkbox-text">
                                            <?php echo $eachbooklet['booklet_name']; ?></span><br><span class="statistic-heading">
                                            (<?php echo $eachbooklet['booklet_credit']; ?> credits for <?php echo $eachbooklet['booklet_price']; ?> only) 
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <?php endforeach; ?>
                        <?php else: ?>
                            <div class="col-lg-3 col-md-3 col-sm-3 hidden-form-field">No eWallet Booklet present</div>
                        <?php endif; ?>
                        </div>

                     <div>
                         <div class="form-error"></div>
                            <input type="hidden" id="user_id" value="<?php echo $user_details->id; ?>">
                            <button class="btn " id="ebooklet_send">Confirm</button>
                        </div>
                    </div>
                     <div class="ewallet-area">
                        <div class="row">
                            <div class="col-lg-4 col-md-4 col-sm-4 hidden-form-field">
                                <div class="hidden-form-label">Mobile Number</div>
                                 <input type="text" name="eWallet_mobile_number" class="disabled" id="eWallet_mobile_number" value="<?php echo $user_details->mobile; ?>" readonly>
                            </div>
                            <div class="col-lg-4 col-md-4 col-sm-4 hidden-form-field">
                                <div class="hidden-form-label">Award Credits</div>
                                <input type="text" name="eWallet_point" id="eWallet_point" onkeypress="return isNumberKey(event)" maxlength="5">
                                 <div class="form-error"></div>
                            </div>
                            <div class="col-lg-4 col-md-4 col-sm-4 hidden-form-field">
                                <div class="hidden-form-label">Comments</div>
                                <textarea name="eWallet_comment" id="eWallet_comment"></textarea>
                            </div>
                        </div>
                        <div>
                            <button class="add-credits btn" id="add_ewallet">Add credits</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
            <?php if($errors->any()): ?>
            <div class="alert alert-info">
                <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
                <strong><?php echo $errors->first(); ?></strong>
            </div>
            <?php endif; ?>
    <div class="section2">
        <div class="profile-container">
           <div id="reward_add"> <a href="#" data-toggle="modal" class="rewards desktop-hidden" data-target="#rewards_coupon"><img class="reward_load_data" src="<?php echo asset('revampstyles/icons/Rewards.png'); ?>" alt="rewards" width="20px" height="20px"></a></div>
            <div class="check-in desktop-hidden" data-toggle="modal" data-target="#chek_in" style="cursor: pointer;"><i class="fa fa-map-marker"></i> check-in</div>
            <div class="row">
                <div class="col-lg-2 col-md-4 col-sm-12 col-12">
                    <?php if(file_exists($user_details->image)): ?>
                        <div class="profile-pic">
                            <img src="<?php echo asset($user_details->image); ?>" alt="profile-pic">
                        </div>
                    <?php else: ?>
                        <div class="profile-pic">
                            <img src="<?php echo asset('assets/images/default.jpg'); ?>" alt="profile-pic">
                        </div>
                    <?php endif; ?>
                </div>
                <div class="col-lg-10 col-md-8 col-sm-12 col-12">
                    <div class="row profile-heading">
                        <div class="col-lg-2 col-md-2 col-sm-12">
                            <div class="profile-name"><?php echo $user_details->name; ?></div>
                        </div>
                         <div class="col-lg-8 col-md-6 col-sm-12">
                            <!--<div class="profile-status">Loyal customer (Active)</div>-->
                        </div>
                        <div class="col-lg-2 col-md-4 col-sm-12 mobile-hidden">
                            <div class="row" style="padding:0px;float:right">
                                <div class="col-lg-3 col-md-3 col-sm-3 col-1" style="padding:0px;">
                                    <img class="reward_load_data" src="<?php echo asset('revampstyles/icons/Rewards.png'); ?>" alt="rewards" width="20px" height="20px">
                                </div>
                                <div class="col-lg-9 col-md-9 col-sm-9 col-11" style="padding-right:60px;cursor: pointer;">
                                    <div class="check-in-status" data-toggle="modal" data-target="#chek_in">
                                    <!-- <a href="#" data-toggle="modal" class="check-in-status" data-target="#chek_in">--><i class="fa fa-map-marker"></i>&emsp;check-in
                                    </div>
                                </div>
                            </div>                                   
                        </div> 
                    </div>
                    <div>
                    	<?php
                    			function IND_money_format($money)
                        		{
								    $len = strlen($money);
								    $m = '';
								    $money = strrev($money);
								    for($i=0;$i<$len;$i++)
								    {
								        if(( $i==3 || ($i>3 && ($i-1)%2==0) )&& $i!=$len)
								        {
								            $m .=',';
								        }
								        $m .=$money[$i];
							    	}
						    		return strrev($m);
								}
                    	?>
                        <div class="statistic">
                            <div class="statistic-heading">credit balance</div>
                            <div class="statistic-value" id="user_points"><?php echo IND_money_format($card->current_points); ?></div>
                        </div>
                        <div class="statistic">
                            <div class="statistic-heading">total billing</div>
                            <div class="statistic-value"><?php if($parameter->totalBillAmount == '' ): ?> 0 <?php else: ?> <?php echo IND_money_format($parameter->totalBillAmount); ?> <?php endif; ?></div>
                        </div>
                        <div class="statistic">
                            <div class="statistic-heading">last visit date</div>
                            <div class="statistic-value"><?php if($parameter->last_visit == '' ): ?> N/A <?php else: ?> <?php echo date("jS M, Y",strtotime($parameter->last_visit)); ?> <?php endif; ?></div>
                        </div>
                        <div class="statistic">
                            <div class="statistic-heading">credits earned</div>
                            <div class="statistic-value"><?php if($parameter->totalCreditEarned == '' ): ?> 0 <?php else: ?> <?php echo IND_money_format($parameter->totalCreditEarned); ?> <?php endif; ?></div>
                        </div>
                        <div class="statistic">
                            <div class="statistic-heading">credits redeemed</div>
                            <div class="statistic-value"><?php if($parameter->totalCreditRedeemed == '' ): ?> 0 <?php else: ?> <?php echo IND_money_format($parameter->totalCreditRedeemed); ?> <?php endif; ?></div>
                        </div>
                        <div class="statistic">
                            <div class="statistic-heading">coupons issued</div>
                            <div class="statistic-value"><?php if($parameter->totalCouponGiven == '' ): ?> 0 <?php else: ?> <?php echo IND_money_format($parameter->totalCouponGiven); ?> <?php endif; ?></div>
                        </div>
                        <div class="statistic">
                            <div class="statistic-heading">coupons redeemed</div>
                            <div class="statistic-value"><?php if($parameter->totalTokenRedeemed == '' ): ?> 0 <?php else: ?> <?php echo IND_money_format($parameter->totalTokenRedeemed); ?> <?php endif; ?></div>
                        </div>
                        <div class="statistic">
                            <div class="statistic-heading">rewards redeemed</div>
                            <div class="statistic-value"><?php if($parameter->TotalRewardRedeemed == '' ): ?> 0 <?php else: ?> <?php echo IND_money_format($parameter->TotalRewardRedeemed); ?> <?php endif; ?></div>
                        </div>
                        <div class="statistic">
                            <div class="statistic-heading">total transactions</div>
                            <div class="statistic-value"><?php if($parameter->total_visits == '' ): ?> 0 <?php else: ?> <?php echo IND_money_format($parameter->total_visits); ?> <?php endif; ?></div>
                        </div>
                        <div class="statistic">
                            <div class="statistic-heading">total visits</div>
                            <div class="statistic-value"><?php if($parameter->actual_visits == '' ): ?> 0 <?php else: ?> <?php echo IND_money_format($parameter->actual_visits); ?> <?php endif; ?></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="section3">
        <div class="card-container">
            <div class="row">
                <div class="col-lg-3 col-md-6 col-sm-6 col-12">
                    <div class="cards">
                        <div class="card-header">
                            <div class="float-left">personal information</div>
                            <div class="float-right" id="pInfo-edit"><i class="fa fa-edit"></i></div>
                            <div class="clearfix"></div>
                        </div>
                        <div class="card-body">
                            <div class="row personal-details">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Mobile.png'); ?>" alt="icon"></div>
                                <div class="col-lg-10 col-md-10 col-sm-10 col-10"><?php echo $user_details->mobile; ?></div>
                            </div>
                            <div class="row personal-details">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Email.png'); ?>" alt="icon"></div>
                                <div class="col-lg-10 col-md-10 col-sm-10 col-10"><span id="p-info-user"><?php echo $user_details->email; ?></span><a href="#" class="float-right" data-toggle="modal" data-target="#edit_email" style="color:#3d3c3c"><i class="fa fa-edit"></i></a></div>
                            </div>
                            <div class="row personal-details">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Pincode.png'); ?>" alt="icon"></div>
                                <div class="col-lg-10 col-md-10 col-sm-10 col-10"><?php if($user_details->pincode==""): ?> N/A <?php else: ?> <?php echo $user_details->pincode; ?> <?php endif; ?></div>
                            </div>
                            <div class="row personal-details">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Gender.png'); ?>" alt="icon"></div>
                                <div class="col-lg-10 col-md-10 col-sm-10 col-10"><?php if($user_details->gender==""): ?> N/A <?php else: ?> <?php echo $user_details->gender; ?> <?php endif; ?></div>
                            </div>
                            <div class="row personal-details">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Birthday.png'); ?>" alt="icon"></div>
                                <div class="col-lg-10 col-md-10 col-sm-10 col-10"><?php if($user_details->dob=="0000-00-00"): ?> N/A <?php else: ?> <?php echo date('j<\s\up>S<\/\s\up> F, Y',strtotime($user_details->dob)); ?> <?php endif; ?></div>
                            </div>
                            <div class="row personal-details">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Maritial Status.png'); ?>" alt="icon"></div>
                                <div class="col-lg-10 col-md-10 col-sm-10 col-10"><?php if($user_details->marital==""): ?> N/A <?php else: ?> <?php echo $user_details->marital; ?> <?php endif; ?></div>
                            </div>
                            <div class="row personal-details">
                            <?php if($user_details->marital=='Married'): ?>
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Anniversary.png'); ?>" alt="icon"></div>
                                <div class="col-lg-10 col-md-10 col-sm-10 col-10"><?php echo date('j<\s\up>S<\/\s\up> F, Y',strtotime($user_details->anniversary_date)); ?></div>
                            <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3 col-md-6 col-sm-6 col-12">
                     <div class="cards">
                        <div class="card-header">
                            <div class="float-left" >membership details</div>
                            <div class="float-right" id="member-detail"><i class="fa fa-edit"></i></div>
                            <div class="clearfix"></div>
                        </div>
                        <div class="card-body">
                            <div class="details-field" >
                                <div class="label">membership validity</div>
                                <?php if($card->user_validity=='2027-01-01'): ?>
                                 <input type="radio" name="validity" checked> Lifetime
                                 <input type="radio" name="validity"> Limited
                                <?php else: ?>
                                 <input type="radio" name="validity" > Lifetime
                                 <input type="radio" name="validity"  checked> Limited
                                 <div class="details-field">
                                 <div class="label">valid till</div>
                                 <input type="text" name="valid_till" value="<?php echo $card->user_validity; ?>" readonly="true">
                                </div>
                                <?php endif; ?>
                            </div>  
                            <div class="details-field">
                                <div class="label">membership number</div>
                                <input type="text" name="membership_no" value="<?php echo $card->member_id; ?>" readonly="true">
                            </div>
                        </div> 
                    </div>
                </div>
                <div class="col-lg-3 col-md-6 col-sm-6 col-12">
                      <div class="cards">
                        <div class="card-header">
                            <div class="float-left">notes</div>
                            <div class="float-right" id="edit-note"><i class="fa fa-edit"></i></div>
                            <div class="clearfix"></div>
                        </div>
                        <div class="card-body">
                            <textarea class="note-textarea" readonly="true"><?php echo $card->temp_feedback; ?></textarea>
                        </div>
                    </div>
                </div>
                <div class="col-lg-3 col-md-6 col-sm-6 col-12">
                      <div class="cards">
                        <div class="card-header">
                            <div class="float-left">tags</div>
                            <div class="float-right" id="edit-tag"><i class="fa fa-edit"></i></div>
                            <div class="clearfix"></div>
                        </div>
                        <div class="card-body">

                            <div class="tags-field">
                                <div class="label">Tag 1</div>
                                <?php if(count($tag)>=1): ?>
                                <input type="text" name="tag1" value="<?php echo $tag['0']; ?>" readonly="true">
                                <?php else: ?>
                                <input type="text" name="tag1"  readonly="true">
                                <?php endif; ?>
                                <div class="label">Tag 2</div>
                                <?php if(count($tag)>=2): ?>
                                <input type="text" name="tag2" value="<?php echo $tag['1']; ?>" readonly="true">
                                <?php else: ?>
                                <input type="text" name="tag2"  readonly="true">
                                <?php endif; ?>
                                <div class="label">Tag 3</div>
                                <?php if(count($tag)>=3): ?>
                                <input type="text" name="tag3" value="<?php echo $tag['2']; ?>" readonly="true">
                                <?php else: ?>
                                <input type="text" name="tag3"  readonly="true">
                                <?php endif; ?>
                                <div class="label">Tag 4</div>
                                <?php if(count($tag)>=3): ?>
                                <input type="text" name="tag4" value="<?php echo $tag['3']; ?>" readonly="true">
                                <?php else: ?>
                                <input type="text" name="tag4"  readonly="true">
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>  
            </div>
        </div>
        <?php if(!Session::has('employeeuser')): ?>
        <div>
            <button class="btn" data-toggle="modal" data-target="#advanced_dashboard_login" style="display: block; position: fixed; bottom: 20px; right: 30px; z-index: 99; cursor: pointer;">admin dashboard</button>
        </div>
        <?php endif; ?>
    </div>
<?php $__env->stopSection(); ?>
    
<?php $__env->startSection('modals'); ?>
    <!-- this modal for advance login -->
    <div class="modal fade" id="advanced_dashboard_login" role="dialog" aria-hidden="true">
            <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                <h5 class="modal-title">admin dashboard</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                </div>
                <div class="modal-body">
                <!--<form action="<?php echo url('admin_dashboard_login'); ?>" method="POST">-->
                    <div><input type="password" name="password" class="modal-field advance-password" placeholder="Enter your password"></div>
                    <div>
                        <button class="btn account-login" id="test1">go</button>
                    </div>
                    <div class="form-error"></div>
                    <a class="forgot-password" href="<?php echo url('merchant/forgotadvancepasswordnew'); ?>">Forgot Password?</a>
                <!--</form>-->
                </div>
            </div>
            </div>
    </div>
    <!-- OTP For Redeeming Credits Modal -->
    <div class="modal fade" id="otp" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-body">
                    <a  class="modal-close" data-dismiss="modal">&times;</a>
                    <div class="countdown">05:00</div>
                    <div class="awaiting-message">Awaiting response from the user</div>
                    <div class="or">- OR -</div>
                    <form>
                        <div><input type="text" name="" class="reedeem-credits-otp modal-field" placeholder="Enter OTP"></div>
                        <div>
                            <button class="confirm-otp1 btn">Confirm</button>
                        </div>
                        <div class="form-error"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- OTP For Edit Confirmation Modal -->
    <div class="modal fade" id="otp2" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="countdown">05:00</div>
                    <div class="awaiting-message">Ask the member to share the OTP with you to save the changes</div>
                    <form>
                        <div><input type="text" name="" class="modal-field" placeholder="Enter OTP"></div>
                        <div>
                            <button class="confirm-otp2 btn">Confirm</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!-- OTP For Edit email Modal -->
    <div class="modal fade" id="edit-email-otp" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-body">
                    <div class="countdown">05:00</div>
                    <div class="awaiting-message">Ask the member to share the OTP with you to save the changes</div>
                    <form>
                        <div><input type="text" name="" id="edited-email-otp" class="modal-field" placeholder="Enter OTP"></div>
                         <div class="form-error" id="edit-email-otp-error"></div>
                        <div>
                            <button class="btn" id="edit-email-submit">Confirm</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- Verify Code Modal -->
    <div class="modal fade" id="verify_code" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">verify code</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-4 col-md-4 col-sm-4 col-4">
                            <div class="verify-avatar">
                                <?php if(file_exists($user_details->image)): ?>
                                <img src="<?php echo asset($user_details->image); ?>" alt="avatar">
                                <?php else: ?>
                                <img src="<?php echo asset('assets/images/default.jpg'); ?>" alt="avatar">
                                <?php endif; ?>
                            </div>
                        </div>
                        <div class="col-lg-8 col-md-8 col-sm-8 col-8 user-informations">
                            <div class="row">
                                <div class="col-lg-6 col-md-6 col-sm-6 col-6">
                                    <div class="verify-name">Name:</div>
                                </div>
                                <div class="col-lg-6 col-md-6 col-sm-6 col-6">
                                    <div class="verify-content"><?php echo $user_details->name; ?></div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-6 col-md-6 col-sm-6 col-6">
                                    <div class="verify-name">Mobile No:</div>
                                </div>
                                <div class="col-lg-6 col-md-6 col-sm-6 col-6">
                                    <div class="verify-content"><?php echo $user_details->mobile; ?></div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-lg-6 col-md-6 col-sm-6 col-6">
                                    <div class="verify-name">Credit Balance:</div>
                                </div>
                                <div class="col-lg-6 col-md-6 col-sm-6 col-6">
                                    <div class="verify-content"><?php echo $card->current_points; ?></div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <form class="rewards-submit">
                    <div class="verify-fields">
                        
                        <!--<div class="verify-divs">
                            <div class="verify-name">coupon name</div>
                            <div class="verify-content">One coffee free</div>
                        </div>
                        <div class="verify-divs">
                            <div class="verify-name">valid days</div>
                            <div class="verify-content">MON, TUES, WED, THRUS, FRI, SAT, SUN</div>
                        </div>
                        <div class="verify-divs">
                            <div class="verify-name">valid time</div>
                            <div class="verify-content">12:00 AM - 11:59 PM</div>
                        </div>
                        <div class="verify-divs">
                            <div class="verify-name">terms & conditions</div>
                            <div class="verify-content">1. This offer cannot be clubbed with any other offer.</div>
                        </div>-->
                    </div>
                    <div>
                        <button class="redeem-code btn">redeem</button>
                    </div>
                    <div class="form-error"></div>
                </form>
            </div>
            </div>
        </div>
    </div>

    <!-- Information Modal -->
    <div class="modal fade" id="information" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">info</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <div class="information-content">
                        <div class="information-div">Minimum credits balance should be 5 to redeem</div>
                        <div class="information-div">Maximum 100% of bill amount can be redeemed</div>
                        <div class="information-div">Maximum 15,000 credits can be redeemed</div>
                    </div>
                <div>
                        <button class="info-btn btn">done</button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Booklet Content Modal -->
     <div class="modal fade" id="booklet_content" style="font-size: 12px;" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="booklet-details-name"></h5>
                    </div>
                <div class="modal-body">
                    <div class="information-content-booklet" style="overflow-y: auto; overflow-x: hidden;height: 180px;">
                                   
                    </div>
                    <div>
                        <button class="info-btn btn" data-dismiss="modal" >done</button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Booklet Confirmation Modal -->
    <div class="modal fade" id="booklet_confirmation" style="" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">confirmation</h5>
                </div>
                <div class="modal-body">
                    <form>
                        <div>
                            <div class="label" style="font-size:16px;">Mobile Number</div>
                            <input type="text" name="" class="modal-field disabled" placeholder="Enter mobile number" value="<?php echo $user_details->mobile; ?>" readonly>
                        </div>
                        <div class="booklets-selected">Booklets Selected</div>
                        <div class="selected-booklet-area" style="overflow-y: auto; overflow-x: hidden;height: 180px;">
                        </div>
                        <br>
                        <div>
                            <textarea name="comments" class="modal-field-textarea" id="booklet-comment" placeholder="Comment here...."></textarea>
                        </div>
                        <div>
                           <button type="button" class="btn" data-dismiss="modal" aria-label="Close" style="float: left;font-size: 12px;">Back to Edit</button> <button class="send-booklet btn" style="float: right;font-size: 12px;">send</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>


    <!-- e-Booklet Confirmation Modal -->
     <div class="modal fade" id="e_booklet_confirmation" style="" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">confirmation</h5>
                </div>
                <div class="modal-body">
                    <form>
                        <div>
                            <div class="label" style="font-size:16px;">Mobile Number</div>
                            <input type="text" name="" class="modal-field disabled" placeholder="Enter mobile number" value="<?php echo $user_details->mobile; ?>" readonly>
                        </div>
                        <div class="booklets-selected" >eWallet Selected</div>
                        <div class="e-booklet-area" style="overflow-y: auto; overflow-x: hidden;height: 180px;">
                        </div>
                        <br>
                        <div>
                            <textarea name="comments" class="modal-field-textarea" id="e-booklet-comment" placeholder="Comment here...."></textarea>
                        </div>
                        <div>
                           <button type="button" class="btn" data-dismiss="modal" aria-label="Close" style="float: left;font-size: 12px;">Back to Edit</button> <button class="send-e-booklet btn" style="float: right;font-size: 12px;">send</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    
    <!-- Coupon Confirmation Modal -->
    <div class="modal fade" id="coupon_confirmation" style="" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">confirmation</h5>
               </div>
                <div class="modal-body">
                    <form id="coupon-submit-form">
                        <div>
                            <div class="label" style="font-size:16px;">Mobile Number</div>
                           <input type="text" name="" id="coupon-send-mobile" class="modal-field disabled" placeholder="Enter mobile number" value="<?php echo $user_details->mobile; ?>" readonly>
                        </div>
                        <div class="row coupons-selected" >
                            <div class="col-lg-6 col-md-6 col-sm-6 col-7 text-left">
                                Coupons Selected 
                            </div>
                            <div class="col-lg-6 col-md-6 col-sm-6 col-5 text-right">
                               no of uses 
                            </div>
                        </div>
                        <div class="coupon-area-selected" style="overflow-y: auto; overflow-x: hidden;height: 180px;">
                           
                        </div>
                        <div>
                            <textarea name="comments" id="coupon-modal-comment" class="modal-field-textarea" placeholder="Comment here...."></textarea>
                        </div>
                        <div>
                          <button type="button" class="btn" data-dismiss="modal" aria-label="Close" style="float: left;font-size: 12px;">Back to Edit</button> <button class="send-coupon btn" style="float: right;font-size: 12px;">send</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- OTP For Combo Redeeming Credits Modal -->
    <div class="modal fade" id="otp-combo" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-body">
                    <a  class="modal-close" data-dismiss="modal">&times;</a>
                    <div class="countdown">05:00</div>
                    <div class="awaiting-message">Awaiting response from the user</div>
                    <div class="or">- OR -</div>
                    <form>
                        <div><input type="text" name="" class="combo-reedeem-credits-otp modal-field" placeholder="Enter OTP"></div>
                        <div>
                            <button class="confirm-otp2 btn">Confirm</button>
                        </div>
                        <div class="form-error"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!-- OTP For Reward Menu  -->
    <div class="modal fade" id="otp-reward-menu" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-body">
                    <a  class="modal-close" data-dismiss="modal">&times;</a>
                    <div class="countdown">05:00</div>
                    <!-- <div class="awaiting-message">Awaiting response from the user</div>
                    <div class="or">- OR -</div> -->
                    <form>
                        <div><input type="text" name="otp-code" id="otp-code" class="modal-field" placeholder="Enter OTP"></div>
                        <div>
                            <button class="otp-reward-submit btn">Confirm</button>
                        </div>
                        <input type="hidden" id="reward_id_hidden" value=""/>
                        <div class="form-error" id="reward-otp-error"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <!-- OTP For customer cart  -->
    <div class="modal fade" id="otp-customer-cart" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-body">
                    <a  class="modal-close" data-dismiss="modal">&times;</a>
                    <div class="countdown">05:00</div>
                    <!-- <div class="awaiting-message">Awaiting response from the user</div>
                    <div class="or">- OR -</div> -->
                    <form>
                        <div><input type="text" name="cart-otp-code" id="cart-otp-code" class="modal-field" placeholder="Enter OTP"></div>
                        <div>
                            <button class="otp-customer-cart-submit btn">Confirm</button>
                        </div>
                        <input type="hidden" id="cart-item-id" data-name="" data-tid="" value=""/>
                        <div class="form-error" id="customer-cart-otp-error"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- Edit Email Modal -->
    <div class="modal fade" id="edit_email" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">edit email address</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form>
                        <div>
                            <div class="label">Email Address</div>
                            <input type="email" name="user_email" id="user_email" class="modal-field" value="<?php echo $user_details->email; ?>" placeholder="Enter email here" required>
                        </div>
                        <div class="form-error"></div>
                        <div>

                            <button class="btn" id="edit-email-button">next</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
  <!-- Edit Personal Information Modal -->
    <div class="modal fade" id="edit_PersonalInformation" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">Edit Personal Information</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form class="p-info-update-form">
                      <div class="row personal-details-modal">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/user.png'); ?>" alt="icon"></div>
                                <div class="col-lg-10 col-md-10 col-sm-10 col-10"><input type="text" class="modal-field" name="name" id="name"  value="<?php echo $user_details->name; ?>" ></div>
                       </div>
                       <div class="row personal-details-modal">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Mobile.png'); ?>" alt="icon"></div>
                                <div class="col-lg-10 col-md-10 col-sm-10 col-10"><input type="text" class="modal-field disabled" name="p_mobile" id="p_mobile"  value="<?php echo $user_details->mobile; ?>" readonly="true"></div>
                       </div>
                       <div class="row personal-details-modal">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Pincode.png'); ?>" alt="icon"></div>
                                <div class="col-lg-10 col-md-10 col-sm-10 col-10"><input type="text" class="modal-field" name="pincode" value="<?php echo $user_details->pincode; ?>" maxlength="6" onkeypress="return isNumberKey(event)"></div>
                       </div>
                       <div class="row personal-details-modal" style="margin-bottom: 20px;">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Gender.png'); ?>" alt="icon"></div>
                                <div class="col-lg-10 col-md-10 col-sm-10 col-10" style="text-align: left;">           
                                    <?php if($user_details->gender=='Male'): ?>
                                    <span>Male</span>
                                    <input type="radio" name="gender" value="Male"  checked>
                                    <span>Female</span>
                                    <input type="radio" name="gender" value="Female"  >
                                    <?php else: ?>
                                    <span>Male</span>
                                    <input type="radio" name="gender" value="Male"  >
                                    <span>Female</span>
                                    <input type="radio" name="gender" value="Female"  checked>
                                    <?php endif; ?> 
                                </div>
                         </div>
                         <div class="row personal-details-modal">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Birthday.png'); ?>" alt="icon"></div>
                                <div class="col-lg-10 col-md-10 col-sm-10 col-10"><input type="text" name="pinfo-dob" id="pinfodob" class="modal-field" value="<?php echo $user_details->dob; ?>"></div>
                         </div>
                         <div class="row personal-details-modal" style="margin-bottom: 20px;">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Maritial Status.png'); ?>" alt="icon"></div>
                                <div class="col-lg-10 col-md-10 col-sm-10 col-10" style="text-align: left;">
                                 <span>Married</span>
                                    <?php if($user_details->marital=='Married'): ?>
                                    <input type="radio" name="marital" value="Married" class="Married"    checked >
                                    <?php else: ?><input type="radio" name="marital" value="Married" class="Married"   >
                                    <?php endif; ?>
                                     <span>Single</span>
                                    <?php if($user_details->marital=='Single'): ?>
                                    <input type="radio" name="marital" value="Single"  class="single"   checked>
                                    <?php else: ?><input type="radio" name="marital" class="single"  value="Single"   >
                                    <?php endif; ?> 
                                </div>
                           </div>
                             <?php if($user_details->marital=='Married'): ?>
                            <div class="row personal-details-modal" id="doa_row">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Anniversary.png'); ?>" alt="icon"></div>
                               <div class="col-lg-10 col-md-10 col-sm-10 col-10"><input type="text" name="pinfo-doa" id="pinfodoa" class="modal-field" value="<?php echo $user_details->anniversary_date; ?>"></div>
                            </div>
                            <?php else: ?>
                             <div class="row personal-details-modal" id="doa_row" style="display:none">
                                <div class="col-lg-2 col-md-2 col-sm-2 col-2"><img src="<?php echo asset('revampstyles/icons/Anniversary.png'); ?>" alt="icon"></div>
                               <div class="col-lg-10 col-md-10 col-sm-10 col-10"><input type="text" name="pinfo-doa" id="pinfodoa" class="modal-field" value="<?php echo $user_details->anniversary_date; ?>"></div>
                            </div>
                            <?php endif; ?>
                            <div class="row personal-details-modal" style="float:center">
                            <button class="btn" id="pUpdate"> update </button>
                            </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

 <!-- check-In Modal -->
    <div class="modal fade" id="chek_in" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
             <div class="modal-header">
                    <h5 class="modal-title">Check-In</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form>
                         <div class="row">
                           <div class="col-md-12">
                             <input type="text" name="mobile_no" id="mobile_no" class="modal-field disabled" placeholder="Mobile Number" value="<?php echo $user_details->mobile; ?>" readonly><br>
                             <input type="text" name="bill_number" id="bill_number" class="modal-field" placeholder="Bill Number" ><br>
                           </div>
                         </div>
                         <div class="row">
                           <div class="col-md-6"><input type="text" name="bill_amount" id="bill_amount" class="modal-field" placeholder="Bill Amount" maxlength="5"></div>
                            <div class="col-md-6"> <input type="text" name="number_of_guests" id="number_of_guests" class="modal-field" placeholder="Number of guests" ></div>
                         </div>
                           <div class="row">
                           <div class="col-md-12">
                            <input type="text" name="activity" id="activity" class="modal-field"  placeholder="Activity"><br>
                             <input type="text" name="feedback" id="feedback" class="modal-field" placeholder="Comments" ><br>
                           </div>
                         </div>
                        <div>
                            <button class="btn" id="chek_in_submit">Check In</button>
                        </div>
                        <div class="form-error" style="color: red;"></div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- Rewards and Coupons Modal -->
   <div class="modal fade" id="rewards_coupon" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">rewards & coupons</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form>
                        <div class="row redeem-navigation" style="margin-right: 0px;margin-left: 0px;">
                            <div class="col-lg-1 col-md-1 col-sm-hidden"></div>
                            <div class="col-lg-5 col-md-5 col-sm-6 col-6 text-right border-right">
                                <div class="modal-menu customer-cart" id="customer-cart-list">customer cart</div>
                            </div>
                            <div class="col-lg-5 col-md-5 col-sm-6 col-6 text-left">
                                <div class="modal-menu-active rewards-menu">rewards menu</div>
                            </div>
                            <div class="col-lg-1 col-md-1 col-sm-hidden"></div>
                        </div>
                        <div class="customer-cart-area" style="overflow-y: auto; overflow-x: hidden;height: 180px;">
                        </div>
                        <div class="rewards-area" style="overflow-y: auto; overflow-x: hidden;height: 180px;">   
                        </div>
                        <div>
                            <button class="btn" data-dismiss="modal" aria-label="Close" >done</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
     <!-- Edit Note modal-->
    <div class="modal fade" id="note-modal" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">Notes</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                   <textarea id="note" class="modal-field-textarea" id="note-text" placeholder="Add some note"><?php echo $card->temp_feedback; ?></textarea>
                     <button class="btn" id="addNote" style="float:center;">done</button>
                </div>
            </div>
        </div>
    </div>
       <!-- Edit Membership Details-->
       <div class="modal fade" id="MembershipDetails" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">Membership Details</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                <form id="cardinfo">
                       <div class="details-field" style="text-align:left;">

                                <div class="label">membership validity</div>
                                 <?php if($card->user_validity=='2027-01-01'): ?>
                                <input type="radio" name="validity" class="Lifetime" value="Lifetime" checked> Lifetime
                                <?php else: ?>
                                <input type="radio" name="validity" class="Lifetime"  value="Lifetime" > Lifetime
                                <?php endif; ?>
                                <?php if($card->user_validity!='2027-01-01'): ?>
                                <input type="radio" name="validity" class="Limited" value="Limited" checked> Limited
                                <div class="details-field" id="validBlock">
                                <div class="label">valid till</div>
                                <input type="text" name="valid_till" class="valid-card" value="<?php echo $card->user_validity; ?>">
                                </div>
                                <?php else: ?>
                                <input type="radio" name="validity" class="Limited"  value="Limited"> Limited
                                 <div class="details-field" id="validBlock" style="display:none;">
                                <div class="label">valid till</div>
                                <input type="text" name="valid_till" class="valid-card" >
                                </div>
                                <?php endif; ?>
                            </div>
                            <div class="details-field">
                                <div class="label">membership number</div>
                                <input type="text" name="M_number" id="M_number" value="<?php echo $card->member_id; ?>">
                            </div>
                             <input type="hidden" name="cardinfo_id" id="cardinfo_id" value="<?php echo $user_details->id; ?>">
                        <button class="btn" id="add_m_dtl" style="float:center;">update</button>
                      
                     </form>
                </div>
            </div>
        </div>
    </div>
     <!-- Edit Tag modal-->
    <div class="modal fade" id="tag-modal" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">Tags</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                <div class="tags-field">
                <form id="tag-form">
                                <div class="label">Tag 1</div>
                                <?php if(count($tag)>=1): ?>
                                <input type="text" name="tag1" value="<?php echo $tag['0']; ?>">
                                <?php else: ?>
                                <input type="text" name="tag1" >
                                <?php endif; ?>
                                <div class="label">Tag 2</div>
                                <?php if(count($tag)>=2): ?>
                                <input type="text" name="tag2" value="<?php echo $tag['1']; ?>">
                                <?php else: ?>
                                <input type="text" name="tag2" >
                                <?php endif; ?>
                                <div class="label">Tag 3</div>
                                <?php if(count($tag)>=3): ?>
                                <input type="text" name="tag3" value="<?php echo $tag['2']; ?>">
                                <?php else: ?>
                                <input type="text" name="tag3" >
                                <?php endif; ?>
                                <div class="label">Tag 4</div>
                                <?php if(count($tag)>=3): ?>
                                <input type="text" name="tag4" value="<?php echo $tag['3']; ?>">
                                <?php else: ?>
                                <input type="text" name="tag4">
                                <?php endif; ?>
                            </div>
                     <button class="btn" id="addtag" style="float:center;">done</button>
                     <input type="hidden" name="userId" id="user_id" value="<?php echo $user_details->id; ?>">
                     </from>
                </div>
            </div>
        </div>
    </div>

    <!-- Message Modal -->
    <div class="modal fade" id="message" role="dialog" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">Message</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <div class="message-content"></div>
                </div>
            </div>
        </div>
    </div>
    
<?php $__env->stopSection(); ?>
    
<?php $__env->startSection('customscripts'); ?>
    <script>
        $(document).ready(function() 
        {
             var today = new Date();
            $("#pinfodob").datepicker({
                  dateFormat: "yy-mm-dd",
                  autoclose:true,
                  endDate: "today",
                  maxDate: today     
            });
            
            $("#pinfodoa").datepicker({
                  dateFormat: "yy-mm-dd",
                  autoclose:true,
                  endDate: "today",
                  maxDate: today           
            });
            
            $(".valid-card").datepicker({
                  dateFormat: "yy-mm-dd"
            });
            $(".send-e-booklet").one('click', function (event) {  
                   event.preventDefault();
                   //do something
                   //alert('hello');
                   $(this).prop('disabled', true);
            });
            $(".otp-reward-submit").one('click', function (event) {  
                   event.preventDefault();
                   //do something
                   //alert('hello');
                   $(this).prop('disabled', true);
            });
            $(".send-coupon").one('click', function (event) {  
                   event.preventDefault();
                   $(this).prop('disabled', true);
            });
            $(".send-booklet").one('click', function (event) {  
                   event.preventDefault();
                   $(this).prop('disabled', true);
            });
            $(".chek_in_submit").one('click', function (event) {  
                   event.preventDefault();
                   $(this).prop('disabled', true);
            });
             $('.Limited').click(function(){
                $("#validBlock").show("slow");
            });
            $('.Lifetime').click(function(){
              
               $("#validBlock").hide("slow");
            });
             $('.single').click(function(){
              
               $("#doa_row").hide("slow");
            });
               $('.Married').click(function(){
               // alert('you are here');
               $("#doa_row").show("slow");
            });
            $('#bill_amount,#number_of_guests').on('keydown',function(e){-1!==$.inArray(e.keyCode,[46,8,9,27,13,110,190])||(/65|67|86|88/.test(e.keyCode)&&(e.ctrlKey===true||e.metaKey===true))&&(!0===e.ctrlKey||!0===e.metaKey)||35<=e.keyCode&&40>=e.keyCode||(e.shiftKey||48>e.keyCode||57<e.keyCode)&&(96>e.keyCode||105<e.keyCode)&&e.preventDefault()});
            
            $(".add-credit").css("display","block");

            $(".expand").click(function()
            {
                $(this).css("display","none");
                $(".less").css("display","block");
                $("#add-credit").addClass("active");
                $(".hidden-form").fadeIn("fast");
                $(".add-credit").fadeIn("fast");
            });

            $(".less").click(function()
            {
                $(this).css("display","none");
                $(".expand").css("display","block");
                $("#add-credit").removeClass("active");
                $(".hidden-form").fadeOut("fast");
                $(".hidden-section").css("display","none");
                $(".menu-list").removeClass("active");
            });

            
            $("#add-credit").click(function()
            {
                $(".hidden-form").fadeIn("fast");
                $(".hidden-section").css("display","none");
                $(".menu-list").removeClass("active");
                $(this).addClass("active");
                $(".less").css("display","block");
                $(".expand").css("display","none");
                $(".add-credit").fadeIn("fast");
            });

            $("#redeem-credit").click(function()
            {
                $(".hidden-form").fadeIn("fast");
                $(".hidden-section").css("display","none");
                $(".menu-list").removeClass("active");
                $(this).addClass("active");
                $(".less").css("display","block");
                $(".expand").css("display","none");
                $(".redeem-credit").fadeIn("fast");
                var current_points = <?php echo $card->current_points; ?>;
                var mim_redeemable_amount = <?php echo $merchant_details->mim_balance_redeem; ?>;
                //alert(current_points);
                if(current_points<mim_redeemable_amount)
                {
                    $(".redeem-credit-redeemed").parent().find(".form-error").html("Minimum Balance required to redeem is <?php echo $merchant_details->mim_balance_redeem; ?>");
                }
            });

            $("#verify-code").click(function()
            {
                $(".hidden-form").fadeIn("fast");
                $(".hidden-section").css("display","none");
                $(".menu-list").removeClass("active");
                $(this).addClass("active");
                $(".less").css("display","block");
                $(".expand").css("display","none");
                $(".verify-code").fadeIn("fast");
            });

            $("#redeem-add").click(function()
            {
                $(".hidden-form").fadeIn("fast");
                $(".hidden-section").css("display","none");
                $(".menu-list").removeClass("active");
                $(this).addClass("active");
                $(".less").css("display","block");
                $(".expand").css("display","none");
                $(".redeem-add").fadeIn("fast");
            });

            $("#booklet").click(function()
            {
                $(".hidden-form").fadeIn("fast");
                $(".hidden-section").css("display","none");
                $(".menu-list").removeClass("active");
                $(this).addClass("active");
                $(".less").css("display","block");
                $(".expand").css("display","none");
                $(".booklet").fadeIn("fast");
            });

            $("#ewallet").click(function()
            {
                $(".hidden-form").fadeIn("fast");
                $(".hidden-section").css("display","none");
                $(".menu-list").removeClass("active");
                $(this).addClass("active");
                $(".less").css("display","block");
                $(".expand").css("display","none");
                $(".ewallet").fadeIn("fast");
            });

            $(".customer-cart").click(function()
            {
                $(".rewards-menu").removeClass("modal-menu-active");
                $(".rewards-menu").addClass("modal-menu");
                $(this).removeClass("modal-menu");
                $(this).addClass("modal-menu-active");
                $(".rewards-area").css("display","none");
                $(".customer-cart-area").css("display","block");
            });

            $(".rewards-menu").click(function()
            {
                $(".customer-cart").removeClass("modal-menu-active");
                $(".customer-cart").addClass("modal-menu");
                $(this).removeClass("modal-menu");
                $(this).addClass("modal-menu-active");
                $(".customer-cart-area").css("display","none");
                $(".rewards-area").css("display","block");
            });

            $(".booklet-menu").click(function()
            {
                $(".coupon-menu").removeClass("hidden-field-menu-active");
                $(".coupon-menu").addClass("hidden-field-menu");
                $(this).removeClass("hidden-field-menu");
                $(this).addClass("hidden-field-menu-active");
                $(".coupon-area").css("display","none");
                $(".booklet-area").css("display","block");
            });

            $(".coupon-menu").click(function()
            {
                $(".booklet-menu").removeClass("hidden-field-menu-active");
                $(".booklet-menu").addClass("hidden-field-menu");
                $(this).removeClass("hidden-field-menu");
                $(this).addClass("hidden-field-menu-active");
                $(".booklet-area").css("display","none");
                $(".coupon-area").css("display","block");
            });

            $(".ebooklet-menu").click(function()
            {
                $(".ewallet-menu").removeClass("hidden-field-menu-active");
                $(".ewallet-menu").addClass("hidden-field-menu");
                $(this).removeClass("hidden-field-menu");
                $(this).addClass("hidden-field-menu-active");
                $(".ewallet-area").css("display","none");
                $(".ebooklet-area").css("display","block");
            });

            $(".ewallet-menu").click(function()
            {
                $(".ebooklet-menu").removeClass("hidden-field-menu-active");
                $(".ebooklet-menu").addClass("hidden-field-menu");
                $(this).removeClass("hidden-field-menu");
                $(this).addClass("hidden-field-menu-active");
                $(".ebooklet-area").css("display","none");
                $(".ewallet-area").css("display","block");
            });

            $(document).on('click','.select-all',function()
            {
                $(this).addClass("unselect-all");
                $(this).parent().parent().parent().find("input[type='checkbox']").prop("checked",true);
                $(this).removeClass("select-all");
            });

            $(document).on('click','.unselect-all',function()
            {
                $(this).addClass("select-all");
                $(this).parent().parent().parent().find("input[type='checkbox']").prop("checked",false);
                $(this).removeClass("unselect-all");
            });

            $(".checkbox-input").click(function()
            {
                $(this).parent().parent().parent().find(".unselect-all").prop("checked",false);
                $(this).parent().parent().parent().find(".unselect-all").addClass("select-all");
                $(this).parent().parent().parent().find(".select-all").removeClass("unselect-all");
            });
            $(".checkbox-input-coupon-send").click(function()
            {
                $(this).parent().parent().parent().parent().parent().find(".unselect-all").prop("checked",false);
                $(this).parent().parent().parent().parent().parent().find(".unselect-all").addClass("select-all");
                $(this).parent().parent().parent().parent().parent().find(".select-all").removeClass("unselect-all");
            });
            $(".checkbox-input-booklet").click(function()
            {
                $(this).parent().parent().parent().parent().parent().find(".unselect-all").prop("checked",false);
                $(this).parent().parent().parent().parent().parent().find(".unselect-all").addClass("select-all");
                $(this).parent().parent().parent().parent().parent().find(".select-all").removeClass("unselect-all");
            });
            $(".checkbox-input-ebooklet").click(function()
            {
                $(this).parent().parent().parent().find(".unselect-all").prop("checked",false);
                $(this).parent().parent().parent().find(".unselect-all").addClass("select-all");
                $(this).parent().parent().parent().find(".select-all").removeClass("unselect-all");
            });

            var interval = ""; 
            
            $('#otp').on('show.bs.modal', function (e) 
            {
                $(".reedeem-credits-otp").val("");
                var timer2 = "5:00";
                interval = setInterval(function() 
                {
                    var timer = timer2.split(':');
                    //by parsing integer, I avoid all extra string processing
                    var minutes = parseInt(timer[0], 10);
                    var seconds = parseInt(timer[1], 10);
                    --seconds;
                    minutes = (seconds < 0) ? --minutes : minutes;
                    if(minutes < 0) 
                    {
                        clearInterval(interval);
                        minutes=0;
                        seconds=0;
                    }
                    seconds = (seconds < 0) ? 59 : seconds;
                    seconds = (seconds < 10) ? '0' + seconds : seconds;
                    //minutes = (minutes < 10) ?  minutes : minutes;
                    $('.countdown').html(minutes + ':' + seconds);
                    timer2 = minutes + ':' + seconds;

                }, 1000);

            });

            $('#otp').on('hidden.bs.modal', function(e) 
            {
                clearTimeout(interval);
                $('.countdown').html("05:00");
            });

            $('#otp-combo').on('show.bs.modal', function (e) 
            {
                $(".reedeem-credits-otp").val("");
                var timer2 = "5:00";
                interval = setInterval(function() 
                {
                    var timer = timer2.split(':');
                    //by parsing integer, I avoid all extra string processing
                    var minutes = parseInt(timer[0], 10);
                    var seconds = parseInt(timer[1], 10);
                    --seconds;
                    minutes = (seconds < 0) ? --minutes : minutes;
                    if(minutes < 0) 
                    {
                        clearInterval(interval);
                        minutes=0;
                        seconds=0;
                    }
                    seconds = (seconds < 0) ? 59 : seconds;
                    seconds = (seconds < 10) ? '0' + seconds : seconds;
                    //minutes = (minutes < 10) ?  minutes : minutes;
                    $('.countdown').html(minutes + ':' + seconds);
                    timer2 = minutes + ':' + seconds;

                }, 1000);

            });

            $('#otp-combo').on('hidden.bs.modal', function(e) 
            {
                clearTimeout(interval);
                $('.countdown').html("05:00");
            });

            //Mobile javacript
            $(".fa-bars").click(function()
            {
                $(".hidden-form").slideDown("slow");
                $(this).css("display", "none");
                $(".fa-times").css("display", "block");
            });

            $(".fa-times").click(function()
            {
                $(".hidden-form").slideUp("slow");
                $(this).css("display", "none");
                $(".fa-bars").css("display", "block");
                $(".mobile-hidden-section").css("display","none");
                $(".mobile-menu-list").find("span").attr("class","arrow_carrot-down");
            });


            $("#mobile-add-credit").click(function()
            {
                var src = ($(this).find("span").attr("class") == "arrow_carrot-down")?"arrow_carrot-up":"arrow_carrot-down";
                $(this).find("span").attr("class", src);
                $(".add-credit").slideToggle("slow");
            });

            $("#mobile-redeem-credit").click(function()
            {
                var src = ($(this).find("span").attr("class") == "arrow_carrot-down")?"arrow_carrot-up":"arrow_carrot-down";
                $(this).find("span").attr("class", src);
                $(".redeem-credit").slideToggle("slow");
            });

            $("#mobile-verify-code").click(function()
            {
                var src = ($(this).find("span").attr("class") == "arrow_carrot-down")?"arrow_carrot-up":"arrow_carrot-down";
                $(this).find("span").attr("class", src);
                $(".verify-code").slideToggle("slow");
            });

            $("#mobile-redeem-add").click(function()
            {
                var src = ($(this).find("span").attr("class") == "arrow_carrot-down")?"arrow_carrot-up":"arrow_carrot-down";
                $(this).find("span").attr("class", src);
                $(".redeem-add").slideToggle("slow");
            });

            $("#mobile-booklet").click(function()
            {
                var src = ($(this).find("span").attr("class") == "arrow_carrot-down")?"arrow_carrot-up":"arrow_carrot-down";
                $(this).find("span").attr("class", src);
                $(".booklet").slideToggle("slow");
            });

            $("#mobile-ewallet").click(function()
            {
                var src = ($(this).find("span").attr("class") == "arrow_carrot-down")?"arrow_carrot-up":"arrow_carrot-down";
                $(this).find("span").attr("class", src);
                $(".ewallet").slideToggle("slow");
            });
/******************************reward menu and customer card related  start**************************************************/
 $('.reward_load_data').click(function (e) 
            {

                e.preventDefault();
                var userId=$("#user_id").val();
                var points=$("#user_points").html();
                $.ajax({
                             type: 'POST',
                             url: '<?php echo url('rewardList'); ?>',
                             data: userId,
                             success: function(response)
                             {
                                var json = $.parseJSON(response);
                                if(json.error == 'false')
                                 {
                                 $(".rewards-area").html("");
                                 for(var i=0 ; i<json.msg.length;i++)
                                 {
                                    if(json.msg[i].daystatus=='invalid' ||json.msg[i].timestatus=='invalid' || json.msg[i].points>points)
                                    {

                                        if(json.msg[i].points>points)
                                        {
                                        $(".rewards-area").append('<div class="row coupon-row"> <div class="col-lg-7 col-md-7 col-sm-6 col-6"><div class="row"><div class="col-lg-3 col-md-3 col-m-3 col-3"><img src="<?php echo asset('revampstyles/icons/Rewards.png'); ?>" width="40px" height="40px" alt="booklet-icon"></div><div class="col-lg-9 col-md-9 col-sm-9 col-9 rewards-name">'+json.msg[i].name+'</div></div></div><div class="col-lg-5 col-md-5 col-sm-6 col-6"><div class="otp_send_reward"> <button class="redeem disabled point" value='+json.msg[i].id+' >for '+json.msg[i].points+' cr</button></div></div></div>');

                                        }
                                        else if(json.msg[i].timestatus=='invalid')
                                        {
                                        $(".rewards-area").append('<div class="row coupon-row"> <div class="col-lg-7 col-md-7 col-sm-6 col-6"><div class="row"><div class="col-lg-3 col-md-3 col-m-3 col-3"><img src="<?php echo asset('revampstyles/icons/Rewards.png'); ?>" width="40px" height="40px" alt="booklet-icon"></div><div class="col-lg-9 col-md-9 col-sm-9 col-9 rewards-name">'+json.msg[i].name+'</div></div></div><div class="col-lg-5 col-md-5 col-sm-6 col-6"><div class="otp_send_reward"> <button class="redeem disabled time" value='+json.msg[i].id+' >for '+json.msg[i].points+' cr</button></div></div></div>');
                                        }
                                        else
                                        {
                                        $(".rewards-area").append('<div class="row coupon-row"> <div class="col-lg-7 col-md-7 col-sm-6 col-6"><div class="row"><div class="col-lg-3 col-md-3 col-m-3 col-3"><img src="<?php echo asset('revampstyles/icons/Rewards.png'); ?>" width="40px" height="40px" alt="booklet-icon"></div><div class="col-lg-9 col-md-9 col-sm-9 col-9 rewards-name">'+json.msg[i].name+'</div></div></div><div class="col-lg-5 col-md-5 col-sm-6 col-6"><div class="otp_send_reward"> <button class="redeem disabled day" value='+json.msg[i].id+' >for '+json.msg[i].points+' cr</button></div></div></div>');

                                        }
                                    }
                                    else
                                    {
                                     $(".rewards-area").append('<div class="row coupon-row"> <div class="col-lg-7 col-md-7 col-sm-6 col-6"><div class="row"><div class="col-lg-3 col-md-3 col-m-3 col-3"><img src="<?php echo asset('revampstyles/icons/Rewards.png'); ?>" width="40px" height="40px" alt="booklet-icon"></div><div class="col-lg-9 col-md-9 col-sm-9 col-9 rewards-name">'+json.msg[i].name+'</div></div></div><div class="col-lg-5 col-md-5 col-sm-6 col-6"><div class="otp_send_reward"> <button class="redeem" value='+json.msg[i].id+'>for '+json.msg[i].points+' cr</button></div></div></div>');
                                    }

                                 }
                                if(json.msg.length=='0')
                                 {
                                     $(".rewards-area").html("No Reward/Coupon to display");
                                 }

                                 $("#rewards_coupon").modal("show");
                                 }
                                else
                                {
                                           
                                }
                             }
                        });
             });
             $("#customer-cart-list").click(function(e){
                var userId=$("#user_id").val();
                $.ajax({
                        type: 'POST',
                        url: '<?php echo url('get_customer_cart'); ?>',
                        data: {userId:userId},
                        success: function(response)
                        {
                        	//alert(response);          
                            var json = $.parseJSON(response);
                            if(json.error == 'false')
                            {
                              $(".customer-cart-area").html("");
                              for(var i=0;i<json.msg.rewards.length;i++)
                              {
                                if(json.msg.rewards[i].daystatus=='invalid' ||json.msg.rewards[i].timestatus=='invalid')
                                {
                                      if(json.msg.rewards[i].daystatus=='invalid')
                                     {
                                     $(".customer-cart-area").append('<div class="row coupon-row "><div class="col-lg-7 col-md-7 col-sm-7 col-7 padding-0"><div class="row"> <div class="col-lg-4 col-md-4 col-sm-4 col-4"><img src="<?php echo asset('revampstyles/icons/Rewards.png'); ?>" width="40px" height="40px" alt="booklet-icon"></div><div class="col-lg-8 col-md-8 col-sm-8 col-8 coupon-name">'+json.msg.rewards[i].name+'</br><span style="font-size:10px">Uses Left: 1</span></div></div></div><div class="col-lg-5 col-md-5 col-sm-5 col-5"><div><button class="redeem disabled day" value='+json.msg.rewards[i].reward_id+' data-name='+json.msg.rewards[i].redeem+' >redeem</button></div></div></div>');
                                     }
                                     else
                                     {
                                      $(".customer-cart-area").append('<div class="row coupon-row "><div class="col-lg-7 col-md-7 col-sm-7 col-7 padding-0"><div class="row"> <div class="col-lg-4 col-md-4 col-sm-4 col-4"><img src="<?php echo asset('revampstyles/icons/Rewards.png'); ?>" width="40px" height="40px" alt="booklet-icon"></div><div class="col-lg-8 col-md-8 col-sm-8 col-8 coupon-name">'+json.msg.rewards[i].name+'</br><span style="font-size:10px">Uses Left: 1</span></div></div></div><div class="col-lg-5 col-md-5 col-sm-5 col-5"><div><button class="redeem disabled time" value='+json.msg.rewards[i].reward_id+' data-name='+json.msg.rewards[i].redeem+' >redeem</button></div></div></div>');
                                     }
                                }
                                else
                                {
                                     $(".customer-cart-area").append('<div class="row coupon-row"><div class="col-lg-7 col-md-7 col-sm-7 col-7 padding-0"><div class="row"> <div class="col-lg-4 col-md-4 col-sm-4 col-4"><img src="<?php echo asset('revampstyles/icons/Rewards.png'); ?>" width="40px" height="40px" alt="booklet-icon"></div><div class="col-lg-8 col-md-8 col-sm-8 col-8 coupon-name">'+json.msg.rewards[i].name+'</br><span style="font-size:10px">Uses Left: 1</span></div></div></div><div class="col-lg-5 col-md-5 col-sm-5 col-5"><div><button class="redeem" value='+json.msg.rewards[i].reward_id+' data-name='+json.msg.rewards[i].redeem+'>redeem</button></div></div></div>');
                                }
                               
                              }
                              for(var i=0;i<json.msg.tokens.length;i++)
                              {
                                if(json.msg.tokens[i].daystatus=='invalid' ||json.msg.tokens[i].timestatus=='invalid')
                                {
                                    
                                    if(json.msg.tokens[i].daystatus=='invalid')
                                     {
                                     $(".customer-cart-area").append('<div class="row coupon-row"><div class="col-lg-7 col-md-7 col-sm-7 col-7 padding-0"><div class="row"> <div class="col-lg-4 col-md-4 col-sm-4 col-4"><img src="<?php echo asset('revampstyles/icons/Rewards.png'); ?>" width="40px" height="40px" alt="booklet-icon"></div><div class="col-lg-8 col-md-8 col-sm-8 col-8 coupon-name">'+json.msg.tokens[i].name+' </br><span style="font-size:10px">Uses Left: '+json.msg.tokens[i].use_limit+'</span> </div></div></div><div class="col-lg-5 col-md-5 col-sm-5 col-5"><div><button class="redeem disabled day" value='+json.msg.tokens[i].id+' data-name='+json.msg.tokens[i].token_code+' data-tokenid='+json.msg.tokens[i].token_id+' >redeem</button></div></div></div>');
                                     }
                                    else
                                    {
                                    $(".customer-cart-area").append('<div class="row coupon-row"><div class="col-lg-7 col-md-7 col-sm-7 col-7 padding-0"><div class="row"> <div class="col-lg-4 col-md-4 col-sm-4 col-4"><img src="<?php echo asset('revampstyles/icons/Rewards.png'); ?>" width="40px" height="40px" alt="booklet-icon"></div><div class="col-lg-8 col-md-8 col-sm-8 col-8 coupon-name">'+json.msg.tokens[i].name+' </br><span style="font-size:10px">Uses Left: '+json.msg.tokens[i].use_limit+'</span> </div></div></div><div class="col-lg-5 col-md-5 col-sm-5 col-5"><div><button class="redeem disabled time" value='+json.msg.tokens[i].id+' data-name='+json.msg.tokens[i].token_code+' data-tokenid='+json.msg.tokens[i].token_id+' >redeem</button></div></div></div>');
                                    }
                                }
                                else
                                {
                                    $(".customer-cart-area").append('<div class="row coupon-row"><div class="col-lg-7 col-md-7 col-sm-7 col-7 padding-0"><div class="row"> <div class="col-lg-4 col-md-4 col-sm-4 col-4"><img src="<?php echo asset('revampstyles/icons/Rewards.png'); ?>" width="40px" height="40px" alt="booklet-icon"></div><div class="col-lg-8 col-md-8 col-sm-8 col-8 coupon-name">'+json.msg.tokens[i].name+' </br><span style="font-size:10px">Uses Left: '+json.msg.tokens[i].use_limit+'</span> </div></div></div><div class="col-lg-5 col-md-5 col-sm-5 col-5"><div><button class="redeem" value='+json.msg.tokens[i].id+'  data-name='+json.msg.tokens[i].token_code+' data-tokenid='+json.msg.tokens[i].token_id+'>redeem</button></div></div></div>'); 
                                }
                               
                              }
                              if(json.msg.tokens.length=='0' || json.msg.rewards.length=='0')
                              {
                                 //$(".customer-cart-area").html("No Reward/ Coupon to display");
                              }
                            }
                            else
                            {
                               $(".customer-cart-area").html("No Reward/ Coupon to display");
                            }
                        }
                });

            });

            $(".rewards-area").on( 'click', '.redeem', function () 
            { 
            
                   if( $(this).hasClass('point') ){
                     $('#message').modal('show');
                     $(".message-content").html("<p style='color:red'>Member does not have enough balance</p>");
                     return false;
                    }
                   if($(this).hasClass('time') )
                    {
                        $('#message').modal('show');
                        $(".message-content").html("<p style='color:red'>This reward cannot be redeemed this time.</p>");
                         return false;
                        }
                        if($(this).hasClass('day') )
                        {
                         $('#message').modal('show');
                         $(".message-content").html("<p style='color:red'>This reward cannot be redeemed today.</p>");
                         return false;
                        }
                        var r_id=$(this).attr('value');
                        var user_id=$("#user_id").val();
                        var mobile=$("#eWallet_mobile_number").val();
                        var class1='mRedeem';
                        var sms = <?php echo $sms_skip; ?>;
                        //alert(sms);
                        if(sms==0)
                        {
                            //alert('here1');
                            $.ajax({
                                type:'POST',
                                url:'<?php echo url('send_OTP'); ?>',
                                data:{r_id:r_id,user_id:user_id,mobile:mobile,class1:class1},
                                success:function(response)
                                {
                                     var json = $.parseJSON(response);
                                     if(json.error == 'false')
                                     {
                                     $("#rewards_coupon").modal("hide");
                                     $("#reward_id_hidden").val(r_id);
                                     $('#otp-reward-menu').modal('show');
                                     }
                                     else
                                     {
                                        $(this).find('.form-error').val('User doesnot exist on ewards.');
                                     }   
                                }
                            });
                        }
                        else
                        {

                            var r  = confirm("Do you want to redeem this reward for the member?");

                            if(r == true)
                            {
                                $.ajax({
                                        type: "POST",
                                         url:'<?php echo url('m_loyaltyredeem'); ?>',
                                        data:{r_id:r_id,user_id:user_id},
                                        success: function (data) 
                                        {
                                            var json1=$.parseJSON(data);
                                            if(json1.error=='false')
                                            {
                                               
                                                var mobile=$("#eWallet_mobile_number").val();
                                                var coupon=json1.coupoCode;
                                              
                                                var reward_id=json1.rewardid;
                                               
                                                var currentpoints=json1.currentpoints;
                                               
                                                var merchant_id=json1.merchant_id;
                                               
                                                var feedback='';
                                               
                                                 $.ajax({
                                                    type: "POST",
                                                     url:'<?php echo url('couponverify_new'); ?>',
                                                    data:{coupon:coupon,merchant_id:merchant_id,mobile:mobile,feedback:feedback},
                                                    success: function (data1)
                                                     {
                                                        var json2=$.parseJSON(data1);
                                                        if(json2.error=='false')
                                                        {
                                                            
                                                            var coupon_id=json2.response.coupon.id;
                                                         
                                                            var merchant_id=json2.response.coupon.merchant_id;
                                                           
                                                            var user_id=json2.response.coupon.user_id;
                                                            
                                                            var class1=json2.response.coupon.class;
                                                            
                                                            var feedback='';
                                                             $.ajax({
                                                                    type: "POST",
                                                                     url:'<?php echo url('confirmfeedbacknew'); ?>',
                                                                    data:{coupon_id:coupon_id,merchant_id:merchant_id,user_id:user_id,feedback:feedback,class1:class1},
                                                                    success: function (data2)
                                                                     {
                                                                            var json3=$.parseJSON(data2);
                                                                            if(json3.error=='false')
                                                                            {
                                                                                $("#rewards_coupon").modal("hide");
                                                                                $('#message').modal('show');
                                                                                $(".message-content").html("<p style='color:green'>"+json3.msg+ "</p>");
                                                                                setTimeout(function()
                                                                                {
                                                                                    $('#message').modal('hide');
                                                                                    window.location.reload();
                                                                                }, 3000);   
                                                                            }
                                                                            else
                                                                            {
                                                                                 $('#message').modal('show');
                                                                                 $(".message-content").html("<p style='color:red'>"+json3.msg+ "</p>");
                                                                            }
                                                                     }
                                                                 });
                                                        }
                                                        else
                                                        {
                                                            $('#message').modal('show');
                                                            $(".message-content").html("<p style='color:red'>"+json2.msg+ "</p>");
                                                            
                                                        }
                                                        
                                                     }
                                                });

                                            }
                                            else
                                            {
                                                 $('#message').modal('show');
                                                 $(".message-content").html("<p style='color:red'>"+json1.msg+ "</p>");
                                                //alert(json1.msg);
                                            }
                                        }
                                    });
                            }
                            //alert('here');
                                    

                        }
                        //alert('here2');    
                        return false;
                   });  
                     $(".otp-reward-submit").click(function(e){      
                        e.preventDefault();  
                        $(".otp-reward-submit").prop('disabled', true);
                        var r_id=$("#reward_id_hidden").val();
                        var user_id=$("#user_id").val();
                        var mobile=$("#eWallet_mobile_number").val();
                        var class1='mRedeem';
                        var otp=$("#otp-code").val();

                        $.ajax({
                            type:'POST',
                            url:'<?php echo url('verify_OTP'); ?>',
                            data:{user_id:user_id,mobile:mobile,class1:class1,otp:otp},
                            success:function(response)
                            {
                                var json=$.parseJSON(response);
                                 if(json.error == 'false')
                                 { 
                                     $.ajax({
                                        type: "POST",
                                         url:'<?php echo url('m_loyaltyredeem'); ?>',
                                        data:{r_id:r_id,user_id:user_id},
                                        success: function (data) 
                                        {
                                            var json1=$.parseJSON(data);
                                            if(json1.error=='false')
                                            {
                                               
                                                var mobile=$("#eWallet_mobile_number").val();
                                                var coupon=json1.coupoCode;
                                              
                                                var reward_id=json1.rewardid;
                                               
                                                var currentpoints=json1.currentpoints;
                                               
                                                var merchant_id=json1.merchant_id;
                                               
                                                var feedback='';
                                               
                                                 $.ajax({
                                                    type: "POST",
                                                     url:'<?php echo url('couponverify_new'); ?>',
                                                    data:{coupon:coupon,merchant_id:merchant_id,mobile:mobile,feedback:feedback},
                                                    success: function (data1)
                                                     {
                                                        var json2=$.parseJSON(data1);
                                                        if(json2.error=='false')
                                                        {
                                                            
                                                            var coupon_id=json2.response.coupon.id;
                                                         
                                                            var merchant_id=json2.response.coupon.merchant_id;
                                                           
                                                            var user_id=json2.response.coupon.user_id;
                                                            
                                                            var class1=json2.response.coupon.class;
                                                            
                                                            var feedback='';
                                                             $.ajax({
                                                                    type: "POST",
                                                                     url:'<?php echo url('confirmfeedbacknew'); ?>',
                                                                    data:{coupon_id:coupon_id,merchant_id:merchant_id,user_id:user_id,feedback:feedback,class1:class1},
                                                                    success: function (data2)
                                                                     {
                                                                            var json3=$.parseJSON(data2);
                                                                            if(json3.error=='false')
                                                                            {
                                                                                $("#otp-reward-menu").modal("hide");
                                                                                $('#message').modal('show');
                                                                                $(".message-content").html("<p style='color:green'>"+json3.msg+ "</p>");
                                                                                setTimeout(function()
                                                                                {
                                                                                    $('#message').modal('hide');
                                                                                    window.location.reload();
                                                                                }, 3000);   
                                                                            }
                                                                            else
                                                                            {
                                                                                 $('#message').modal('show');
                                                                                 $(".message-content").html("<p style='color:red'>"+json3.msg+ "</p>");
                                                                            }
                                                                     }
                                                                 });
                                                        }
                                                        else
                                                        {
                                                            $('#message').modal('show');
                                                            $(".message-content").html("<p style='color:red'>"+json2.msg+ "</p>");
                                                            
                                                        }
                                                        
                                                     }
                                                });

                                            }
                                            else
                                            {
                                                 $('#message').modal('show');
                                                 $(".message-content").html("<p style='color:red'>"+json1.msg+ "</p>");
                                                //alert(json1.msg);
                                            }
                                        }
                                    });
                                 }
                                 else
                                 {
                                     $(".otp-reward-submit").prop('disabled', false);
                                     $('#reward-otp-error').html('Invalid OTP.');
                                 }
                            }
                        });

                    });
                   $('#otp-reward-menu').on('show.bs.modal', function (e) 
                    {
                       // $(".reedeem-credits-otp").val("");
                        var timer2 = "5:00";
                        interval = setInterval(function() 
                        {
                            var timer = timer2.split(':');
                            //by parsing integer, I avoid all extra string processing
                            var minutes = parseInt(timer[0], 10);
                            var seconds = parseInt(timer[1], 10);
                            --seconds;
                            minutes = (seconds < 0) ? --minutes : minutes;
                            if(minutes < 0) 
                            {
                                clearInterval(interval);
                                minutes=0;
                                seconds=0;
                            }
                            seconds = (seconds < 0) ? 59 : seconds;
                            seconds = (seconds < 10) ? '0' + seconds : seconds;
                            //minutes = (minutes < 10) ?  minutes : minutes;
                            $('.countdown').html(minutes + ':' + seconds);
                            timer2 = minutes + ':' + seconds;

                        }, 1000);

                    });
                    $('#otp-reward-menu,#otp-customer-cart').on('hidden.bs.modal', function(e) 
                    {
                        clearTimeout(interval);
                        $('.countdown').html("05:00");
                    });
                   //customer cart
            $(".customer-cart-area").on( 'click', '.redeem', function () 
            { 
                    if( $(this).hasClass('day') ){
                     $('#message').modal('show');
                     $(".message-content").html("<p style='color:red'>Not redeemable today.</p>");
                     return false;
                    }
                    if( $(this).hasClass('time') ){
                     $('#message').modal('show');
                     $(".message-content").html("<p style='color:red'>Not redeemable at this time.</p>");
                     return false;
                    }
                    var r_id=$(this).attr('value');
                    var code=$(this).attr('data-name');
                    var tokenId=$(this).attr('data-tokenid');
                    var user_id=$("#user_id").val();
                    var mobile=$("#eWallet_mobile_number").val();
                    var class1='rewardsRedeemed';
                    var sms = <?php echo $sms_skip; ?>;
                    if(sms == 0)
                    {
                        $.ajax({
                            type:'POST',
                            url:'<?php echo url('send_OTP'); ?>',
                            data:{r_id:r_id,user_id:user_id,mobile:mobile,class1:class1},
                            success:function(response)
                            {
                                 var json = $.parseJSON(response);
                                 if(json.error == 'false')
                                 {
                                 $("#rewards_coupon").modal("hide");
                                 $("#cart-item-id").val(r_id);
                                 $("#cart-item-id").attr('data-name',code);
                                 $("#cart-item-id").attr('data-tid',tokenId);
                                 
                                 $('#otp-customer-cart').modal('show');
                                 }
                                 else
                                 {
                                    $(this).find('.form-error').val('otp did not match.');
                                 }   
                            }
                        });
                    }
                    else
                    {
                        //alert(sms);
                                 var token_code=code;
                                 var token_id=tokenId;
                                 var feedback="";
                                 // alert(token_code);
                                 // alert(token_id);
                                 //var json=$.parseJSON(response);
                                 
                                        if(token_code.length=='5')
                                        {
                                            var r  = confirm("Do you want to redeem this coupon for the member?");
                                            if(r == true)
                                            {
                                                $.ajax({
                                                        type: "POST",
                                                         url:'<?php echo url('token_submit'); ?>',
                                                         data:{usertoken_id:r_id,token_id:token_id,user_id:user_id,token_code:token_code,feedback:feedback},
                                                        success: function (data) 
                                                        {
                                                            var json1=$.parseJSON(data);
                                                            if(json1.error=='false')
                                                            {
                                                                $('#rewards_coupon').modal('hide');
                                                                $('#message').modal('show');
                                                                $(".message-content").html("<p style='color:green'>"+json1.msg+ "</p>");
                                                                setTimeout(function()
                                                                {
                                                                $('#message').modal('hide');
                                                                window.location.reload();
                                                                }, 3000);

                                                            }
                                                            else
                                                            {
                                                                $('#message').modal('show');
                                                                $(".message-content").html("<p style='color:red'>"+json1.msg+ "</p>");

                                                            }
                                                        }
                                                    });
                                            }
                                          //token
                                               
                                        }
                                        else if(token_code.length=='6')
                                        {
                                            //reward
                                             //var coupon_id=$("#cart-item-id").val();
                                             var coupon_id = r_id;
                                             var class1='rewards';
                                             var r  = confirm("Do you want to redeem this reward for the member?");
                                             if(r == true)
                                             {
                                                $.ajax({
                                                        type: "POST",
                                                         url:'<?php echo url('reward_submit'); ?>',
                                                        data:{coupon_id:coupon_id,user_id:user_id,class1:class1,feedback:feedback},
                                                        success: function (data1) 
                                                        {
                                            
                                                            var json2=$.parseJSON(data1);
                                                            if(json2.error=='false')
                                                            {
                                                                $('#rewards_coupon').modal('hide');
                                                                $('#message').modal('show');
                                                                $(".message-content").html("<p style='color:green'>"+json2.msg+ "</p>");
                                                                setTimeout(function()
                                                                {
                                                                $('#message').modal('hide');
                                                                window.location.reload();
                                                                }, 3000);   
                                                            }
                                                            else
                                                            {
                                                               
                                                                $('#message').modal('show');
                                                                $(".message-content").html("<p style='color:red'>"+json2.msg+ "</p>");
                                                            }
                                                        }
                                                    });
                                             }
                                                 
                                           }
                                        else
                                        {
                                             $('#message').modal('show');
                                             $(".message-content").html("<p style='color:red'>Enter correct code</p>");
                                             
                                        }             
                    }
                
                    return false;
           }); 
           $('#otp-customer-cart').on('show.bs.modal', function (e) 
            {
               // $(".reedeem-credits-otp").val("");
                var timer2 = "5:00";
                interval = setInterval(function() 
                {
                    var timer = timer2.split(':');
                    //by parsing integer, I avoid all extra string processing
                    var minutes = parseInt(timer[0], 10);
                    var seconds = parseInt(timer[1], 10);
                    --seconds;
                    minutes = (seconds < 0) ? --minutes : minutes;
                    if(minutes < 0) 
                    {
                        clearInterval(interval);
                        minutes=0;
                        seconds=0;
                    }
                    seconds = (seconds < 0) ? 59 : seconds;
                    seconds = (seconds < 10) ? '0' + seconds : seconds;
                    //minutes = (minutes < 10) ?  minutes : minutes;
                    $('.countdown').html(minutes + ':' + seconds);
                    timer2 = minutes + ':' + seconds;

                }, 1000);

            });
        $(".otp-customer-cart-submit").click(function(e){
                
                e.preventDefault();  
                var usertoken_id=$("#cart-item-id").val();
                var user_id=$("#user_id").val();
                var mobile=$("#eWallet_mobile_number").val();
                var class1='rewardsRedeemed';
                var otp=$("#cart-otp-code").val();
                
                $.ajax({
                    type:'POST',
                    url:'<?php echo url('verify_OTP'); ?>',
                    data:{user_id:user_id,mobile:mobile,class1:class1,otp:otp},
                    success:function(response)
                    {
                        
                         var token_code=$("#cart-item-id").attr('data-name');
                         var token_id=$("#cart-item-id").attr('data-tid');
                         var feedback="";
                         var json=$.parseJSON(response);
                         if(json.error == 'false')
                         {
                              if(token_code.length=='5')
                                {
                                  //token
                                   $.ajax({
                                            type: "POST",
                                             url:'<?php echo url('token_submit'); ?>',
                                             data:{usertoken_id:usertoken_id,token_id:token_id,user_id:user_id,token_code:token_code,feedback:feedback},
                                            success: function (data) 
                                            {
                                                var json1=$.parseJSON(data);
                                                if(json1.error=='false')
                                                {
                                                    $('#otp-customer-cart').modal('hide');
                                                    $('#message').modal('show');
                                                    $(".message-content").html("<p style='color:green'>"+json1.msg+ "</p>");
                                                    setTimeout(function()
                                                    {
                                                    $('#message').modal('hide');
                                                    window.location.reload();
                                                    }, 3000);

                                                }
                                                else
                                                {
                                                    $('#message').modal('show');
                                                    $(".message-content").html("<p style='color:red'>"+json1.msg+ "</p>");

                                                }
                                            }
                                        });
                                }
                                else if(token_code.length=='6')
                                {
                                    //reward
                                     var coupon_id=$("#cart-item-id").val();
                                     var class1='rewards';
                                     $.ajax({
                                            type: "POST",
                                             url:'<?php echo url('reward_submit'); ?>',
                                            data:{coupon_id:coupon_id,user_id:user_id,class1:class1,feedback:feedback},
                                            success: function (data1) 
                                            {
                                
                                                var json2=$.parseJSON(data1);
                                                if(json2.error=='false')
                                                {
                                                    $('#otp-customer-cart').modal('hide');
                                                    $('#message').modal('show');
                                                    $(".message-content").html("<p style='color:green'>"+json2.msg+ "</p>");
                                                    setTimeout(function()
                                                    {
                                                    $('#message').modal('hide');
                                                    window.location.reload();
                                                    }, 3000);   
                                                }
                                                else
                                                {
                                                   
                                                    $('#message').modal('show');
                                                    $(".message-content").html("<p style='color:red'>"+json2.msg+ "</p>");
                                                }
                                            }
                                        });
                                   }
                                else
                                {
                                     $('#message').modal('show');
                                     $(".message-content").html("<p style='color:red'>Enter correct code</p>");
                                     
                                }
                            
                         }
                         else
                         {
                              $('#customer-cart-otp-error').html('Invalid OTP.');
                         }
                    }
                });

            }); 
/******************************reward menu and customer card related  end**************************************************/
/******************************edit profile and user info start**************************************************/
            $("#pInfo-edit").click(function(e){
                $("#edit_PersonalInformation").modal("show");
            });
            $("#member-detail").click(function(e){
                $("#MembershipDetails").modal("show");
            });
            $("#edit-note").click(function(e){
                $("#note-modal").modal("show");
            });
             $("#edit-tag").click(function(e){
                
                $("#tag-modal").modal("show");
            });
              $("#addtag").click(function(e){
                 e.preventDefault();           
                var form = $('#tag-form')[0];
                var data = new FormData(form);
                //data.userId=userId    
                $.ajax({
                     type: 'POST',
                        url: '<?php echo url('update/tag'); ?>',
                        data: data,
                        processData: false,
                        contentType: false,
                        cache: false,
                        success: function(response)
                        {
                           
                            var json = $.parseJSON(response);
                            if(json.error == 'false')
                            {
                                $("#tag-modal").modal("hide");
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:green'>"+json.msg+ "</p>");
                                setTimeout(function()
                                {
                                    $('#message').modal('hide');
                                    window.location.reload();
                                }, 3000);   
                            }
                            else
                            {
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:red'>"+json.msg+ "</p>");
                            }
                        }
                });
                       
            });
             $("#addNote").click(function(e){
                e.preventDefault();
                var note=$("#note").val();
                var userId=$("#user_id").val();
                
                 $.ajax(
                    {

                        type: 'POST',
                        url: '<?php echo url('update_note'); ?>',
                        data: {userId:userId,note:note},
                        success: function(response)
                        {  
                            
                         var json = $.parseJSON(response);
                         if(json.error == 'false')
                            {
                                $("#note-modal").modal("hide");
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:green'>"+json.msg+ "</p>");
                                setTimeout(function()
                                {
                                    $('#message').modal('hide');
                                    window.location.reload();
                                }, 3000);   
                            }
                            else
                            {
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:red'>"+json.msg+ "</p>");
                            }
                        }
                    });
            });
             $("#add_m_dtl").click(function(e){
                 e.preventDefault();    
                var form = $('#cardinfo')[0];
                var data = new FormData(form);
                $.ajax({
                     type: 'POST',
                        url: '<?php echo url('update/cardinfo'); ?>',
                        data: data,
                        processData: false,
                        contentType: false,
                        cache: false,
                        success: function(response)
                        {
                            var json = $.parseJSON(response);
                            if(json.error == 'false')
                            {
                                $("#MembershipDetails").modal("hide");
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:green'>"+json.msg+ "</p>");
                                setTimeout(function()
                                {
                                    $('#message').modal('hide');
                                    window.location.reload();
                                }, 3000);   
                            }
                            else
                            {
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:red'>"+json.msg+ "</p>");
                            }
                            
                        }
                });
                       
            });
            $("#pUpdate").click(function(e)
            {
                 e.preventDefault();
                // alert('heee');
                var form = $('.p-info-update-form')[0];
                var data = new FormData(form);
                //alert(data.pincode);
                $.ajax({
                     type: 'POST',
                        url: '<?php echo url('p_info_update'); ?>',
                        data: data,
                        processData: false,
                        contentType: false,
                        cache: false,
                        success: function(response)
                        {
                            var json = $.parseJSON(response);
                            if(json.error == 'false')
                            {
                                $("#edit_PersonalInformation").modal("hide");
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:green'>"+json.msg+ "</p>");
                                setTimeout(function()
                                {
                                    $('#message').modal('hide');
                                    window.location.reload();
                                }, 3000);   
                            }
                            else
                            {
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:red'>"+json.msg+ "</p>");
                            }
                       
                        }
                });
                       
            });
           $('#edit-email-otp').on('show.bs.modal', function (e) 
            {
                $(".reedeem-credits-otp").val("");
                var timer2 = "5:00";
                interval = setInterval(function() 
                {
                    var timer = timer2.split(':');
                    //by parsing integer, I avoid all extra string processing
                    var minutes = parseInt(timer[0], 10);
                    var seconds = parseInt(timer[1], 10);
                    --seconds;
                    minutes = (seconds < 0) ? --minutes : minutes;
                    if(minutes < 0) 
                    {
                        clearInterval(interval);
                        minutes=0;
                        seconds=0;
                    }
                    seconds = (seconds < 0) ? 59 : seconds;
                    seconds = (seconds < 10) ? '0' + seconds : seconds;
                    //minutes = (minutes < 10) ?  minutes : minutes;
                    $('.countdown').html(minutes + ':' + seconds);
                    timer2 = minutes + ':' + seconds;

                }, 1000);

            });
           $("#edit-email-button").click(function(e){
                e.preventDefault();   
                var new_email=$("#user_email").val();
                var old_email=$("#p-info-user").html();
            
                if(new_email=='')
                {
                    $(this).parent().parent().find(".form-error").html("please enter a valid email.");
                }
                else if(new_email==old_email)
                {
                    $(this).parent().parent().find(".form-error").html("please enter new email.");
                }
                else
                {
                    var user_id=$("#user_id").val();
                    var mobile=$("#eWallet_mobile_number").val();
                    var class1='pEdit';
                    $.ajax({
                        type:'POST',
                        url:'<?php echo url('send_OTP'); ?>',
                        data:{user_id:user_id,mobile:mobile,class1:class1},
                        success:function(response)
                        {
                             var json = $.parseJSON(response);
                             if(json.error == 'false')
                             {
                             $("#edit_email").modal("hide");
                             $("#edit-email-otp").modal("show");
                             }
                             else
                             {
                                $(this).find('.form-error').html('otp did not match.');
                             }   
                        }
                    });

                }
           });
         $("#edit-email-submit").click(function(e){
            e.preventDefault();
           
                var user_id=$("#user_id").val();
                var mobile=$("#eWallet_mobile_number").val();
                var class1='pEdit';
                var otp=$("#edited-email-otp").val();
                $.ajax({
                    type:'POST',
                    url:'<?php echo url('verify_OTP'); ?>',
                    data:{user_id:user_id,mobile:mobile,class1:class1,otp:otp},
                    success:function(response)
                    {
                            
                             var json = $.parseJSON(response);
                             if(json.error == 'false')
                             {
                                var email=$("#user_email").val();
                                 $.ajax({
                                        type:'POST',
                                        url:'<?php echo url('p_info_update_email'); ?>',
                                        data:{email:email,mobile:mobile},
                                        success:function(response1)
                                        {
                                             var json1 = $.parseJSON(response1);
                                             if(json1.error == 'false')
                                             {
                                                 $("#edit-email-otp").modal("hide");
                                                 $('#message').modal('show');
                                                 $(".message-content").html("<p style='color:green'>"+json1.msg+ "</p>");
                                                 setTimeout(function()
                                                 {
                                                 $('#message').modal('hide');
                                                 window.location.reload();
                                                 }, 3000);   
                                             }
                                             else
                                             {
                                                 $('#message').modal('show');
                                                 $(".message-content").html("<p style='color:red'>"+json1.msg+ "</p>");
                                             }
                                           
                                        }
                                    });

                             }
                             else
                             {
                          
                               $('#edit-email-otp-error').html('Invalid OTP.');
                             }   
                    }
                });
        });

/******************************edit profile and user info end**************************************************/ 

            $(".customer-cart").click(function()
            {
                $(".mobile-rewards-menu").removeClass("modal-menu-active");
                $(".mobile-rewards-menu").addClass("modal-menu");
                $(this).removeClass("modal-menu");
                $(this).addClass("modal-menu-active");
                $(".mobile-rewards-area").css("display","none");
                $(".mobile-customer-cart-area").css("display","block");
            });

            $(".mobile-rewards-menu").click(function()
            {
                $(".mobile-customer-cart").removeClass("modal-menu-active");
                $(".mobile-customer-cart").addClass("modal-menu");
                $(".mobile-customer-cart-area").css("display","none");
                $(".mobile-rewards-area").css("display","block");
            });

            $(".mobile-booklet-menu").click(function()
            {
                $(".mobile-coupon-menu").removeClass("hidden-field-menu-active");
                $(".mobile-coupon-menu").addClass("hidden-field-menu");
                $(this).removeClass("hidden-field-menu");
                $(this).addClass("hidden-field-menu-active");
                $(".mobile-coupon-area").css("display","none");
                $(".mobile-booklet-area").css("display","block");
            });

            $(".mobile-coupon-menu").click(function()
            {
                $(".mobile-booklet-menu").removeClass("hidden-field-menu-active");
                $(".mobile-booklet-menu").addClass("hidden-field-menu");
                $(this).removeClass("hidden-field-menu");
                $(this).addClass("hidden-field-menu-active");
                $(".mobile-booklet-area").css("display","none");
                $(".mobile-coupon-area").css("display","block");
            });

            $(".mobile-ebooklet-menu").click(function()
            {
                $(".mobile-ewallet-menu").removeClass("hidden-field-menu-active");
                $(".mobile-ewallet-menu").addClass("hidden-field-menu");
                $(this).removeClass("hidden-field-menu");
                $(this).addClass("hidden-field-menu-active");
                $(".mobile-ewallet-area").css("display","none");
                $(".mobile-ebooklet-area").css("display","block");
            });

            $(".mobile-ewallet-menu").click(function()
            {
                $(".mobile-ebooklet-menu").removeClass("hidden-field-menu-active");
                $(".mobile-ebooklet-menu").addClass("hidden-field-menu");
                $(this).removeClass("hidden-field-menu");
                $(this).addClass("hidden-field-menu-active");
                $(".mobile-ebooklet-area").css("display","none");
                $(".mobile-ewallet-area").css("display","block");
            });

            $('.credit-percentage').keyup(function () 
            {
                var limit = <?php echo $max_credit_percentage; ?>;
                this.value = this.value.replace(/[^0-9\.]/g,'');
                if(this.value>limit)
                {
                    this.value = this.value.replace(this.value,limit);
                    alert('Maximum '+limit+'% Credits can be awarded')
                    //alert('Maximum % is '+ limit);
                }
               
            });

            $('.combo-credit-percentage').keyup(function () 
            {
                var limit = <?php echo $max_credit_percentage; ?>;
                this.value = this.value.replace(/[^0-9\.]/g,'');
                if(this.value>limit)
                {
                    this.value = this.value.replace(this.value,limit);
                    alert('Maximum '+limit+'% Credits can be awarded')
                    //alert('Maximum % is '+ limit);
                }
               
            });
            $('.combo-redeem-credit-redeemed').keyup(function () 
            {
                var bill_amount = $(".combo-bill-amount").val();
                var limit = <?php echo $max_credit_percentage; ?>;
                var percentage = $(".combo-credit-percentage").val();
                var current_points = $(".current_point_for_user_combo").val();

                var max_redeem_gbill = <?php echo $max_redeem_gbill; ?>;
                var limit_max_redeem = '<?php echo $limit_max_redeem; ?>';
                var maxallow_redeem_trans = <?php echo $maxallow_redeem_trans; ?>;

                var percentage_redeemed = Math.round(bill_amount*(max_redeem_gbill/100));
                if(limit_max_redeem == 'Yes')
                {
                    if(maxallow_redeem_trans < percentage_redeemed)
                    {
                        if(maxallow_redeem_trans > current_points)
                        {
                                credits_redeemed = current_points;
                        }
                        else
                        {
                                credits_redeemed = maxallow_redeem_trans;
                        }
                    }
                    else
                    {
                        if(percentage_redeemed>current_points)
                        {
                                credits_redeemed = current_points;
                        }
                        else
                        {
                                credits_redeemed =  percentage_redeemed;
                        }

                    }
                }
                else
                {
                    //alert(current_points);
                    if(percentage_redeemed > current_points)
                    {
                        credits_redeemed = current_points;
                    }
                    else
                    {
                        credits_redeemed = percentage_redeemed;
                    }
                }
                var final_credits_redeemed = Math.round(credits_redeemed);
                this.value = this.value.replace(/[^0-9\.]/g,'');
                $(".combo-redeem-net-amount").val(bill_amount-this.value);
                if(this.value>final_credits_redeemed)
                {
                    this.value = this.value.replace(this.value,final_credits_redeemed);
                    $(".combo-redeem-net-amount").val(bill_amount-final_credits_redeemed);
                    alert('Maximum '+final_credits_redeemed+' Credits can be Redeemed1')
                    //alert('Maximum % is '+ limit);
                }
                calculateCreditAwardedForCombo();
               
            });

            $('.redeem-credit-redeemed').keyup(function () 
            {
                var bill_amount = $(".redeem-credit-bill-amount").val();
                var current_points = $(".current_point_for_user").val();

                var limit = <?php echo $max_credit_percentage; ?>;
                var max_redeem_gbill = <?php echo $max_redeem_gbill; ?>;
                var limit_max_redeem = '<?php echo $limit_max_redeem; ?>';
                var maxallow_redeem_trans = <?php echo $maxallow_redeem_trans; ?>;

                var percentage_redeemed = Math.round(bill_amount*(max_redeem_gbill/100));
                if(limit_max_redeem == 'Yes')
                {
                    if(maxallow_redeem_trans < percentage_redeemed)
                    {
                        if(maxallow_redeem_trans > current_points)
                        {
                                credits_redeemed = current_points;
                        }
                        else
                        {
                                credits_redeemed = maxallow_redeem_trans;
                        }
                    }
                    else
                    {
                        if(percentage_redeemed>current_points)
                        {
                                credits_redeemed = current_points;
                        }
                        else
                        {
                                credits_redeemed =  percentage_redeemed;
                        }

                    }
                }
                else
                {
                    //alert(current_points);
                    if(percentage_redeemed > current_points)
                    {
                        credits_redeemed = current_points;
                    }
                    else
                    {
                        credits_redeemed = percentage_redeemed;
                    }
                }
                var final_credits_redeemed = Math.round(credits_redeemed);
                //$(".redeem-credit-redeemed").val(final_credits_redeemed);
                

                //var limit = <?php echo $max_credit_percentage; ?>;
                this.value = this.value.replace(/[^0-9\.]/g,'');
                $(".redeem-net-amount").val(bill_amount-this.value);
                if(this.value>final_credits_redeemed)
                {
                    this.value = this.value.replace(this.value,final_credits_redeemed);
                    $(".redeem-net-amount").val(bill_amount-final_credits_redeemed);
                    alert('Maximum '+final_credits_redeemed+' Credits can be Redeemed')
                    //alert('Maximum % is '+ limit);
                }
               
            });
            
            $(".add-credit-btn").click(function(e)
            {
                e.preventDefault();
                $(".form-error").html("");
                var bill_no = $(".add-credit-bill-no").val();
                var bill_amount = $(".add-credit-bill-amount").val();
                var percentage_value = $(".percentage_value").val();

                if(bill_no=="")
                {
                    $(".add-credit-bill-no").parent().find(".form-error").html("Please provide the bill number");
                }
                else if(bill_amount=="")
                {
                    $(".add-credit-bill-amount").parent().find(".form-error").html("Please provide the bill amount");
                }
                else if(isNaN(bill_amount))
                {
                    $(".add-credit-bill-amount").parent().find(".form-error").html("Please enter Bill Amount in numbers only");
                }
                else if (isNaN(percentage_value)) 
                {
                    $(".percentage_value").parent().find(".form-error").html("Please enter Credits To Be Awarded in numbers only");
                }
                else
                {
                    $(this).attr('disabled', true);
                    var form = $('.add-credit-form')[0];
                    var data = new FormData(form);

                    $.ajax(
                    {
                        type: 'POST',
                        url: '<?php echo url('add_credits'); ?>',
                        data: data,
                        processData: false,
                        contentType: false,
                        cache: false,
                        success: function(response)
                        {
                            $(".add-credit-bill-no").val("");
                            $(".add-credit-bill-amount").val("");
                            $(".percentage_value").val("");
                            $(".add-credit-comment").val("");
                            $('#message').modal('show');
                            $(".message-content").html(response);
                            $(".add-credit-btn").attr('disabled', false);

                            setTimeout(function()
                            {
                                $('#message').modal('hide');
                                window.location.reload();
                            }, 3000);
                        }

                    });
                }
                
            });
             $("#add_ewallet").click(function(e)
            {

                e.preventDefault();
                $(".form-error").html("");
                var mobile_no = $("#eWallet_mobile_number").val();
                var points = $("#eWallet_point").val();
                var feedback = $("#eWallet_comment").val();
                if(points=="")
                {
                    $("#eWallet_point").parent().find(".form-error").html("Please provide the bill amount");
                }
               else
                {
                    $.ajax(
                    {
                        type: 'POST',
                        url: '<?php echo url('ewallet_for_dashboard'); ?>',
                        data: {mobile_no:mobile_no, points:points,feedback:feedback},
                        success: function(response)
                        {
                            var json = $.parseJSON(response);
                            if(json.error == 'false')
                            {
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:green'>"+json.msg+ "</p>");
                                setTimeout(function()
                                {
                                    $('#message').modal('hide');
                                    window.location.reload();
                                }, 3000);   
                            }
                            else
                            {
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:red'>"+json.msg+ "</p>");
                            }
                        }
                    });
                }
            });

            $('#ebooklet_send').click(function(e){
                e.preventDefault();
                var arr=[];
                var userId=$("#user_id").val();
                var feedback="test";
                $('.checkbox-input-ebooklet:checkbox:checked').each(function(){
                  arr.push($(this).val());
                });
                if(arr.length<=0)
                {
                $("#ebooklet_send").parent().find(".form-error").html("Please select an eWallet.");
                }
                else
                {
                    $('.e-booklet-area').html("");
                    
                    $('.checkbox-input-ebooklet:checkbox:checked').each(function()
                    {
                         var name = $(this).attr('data-name');
                         //var booklet_value = $(this).parent().find('.statistic-heading').html();
                         var booklet_value = $(this).parent().parent().find('.statistic-heading').html();
                         $(".e-booklet-area").append('<div class="row booklet-row"><div class="col-lg-6 col-md-6 col-sm-6 col-6"><div class="row" class="fortest"><div class="col-lg-4 col-md-4 col-sm-4 col-4"><img src="<?php echo asset('revampstyles/icons/Booklets.png'); ?>"  alt="booklet-icon"></div><div class="col-lg-8 col-md-8 col-sm-8 col-8 coupon-name">'+name+'</div></div></div> <div class="col-lg-6 col-md-6 col-sm-6 col-6"><div class="booklet-value">'+booklet_value+'</div></div></div>');
                    });
                    $("#e_booklet_confirmation").modal("show");
                }
            });
            $(".send-e-booklet").click(function(e){

                e.preventDefault();
                 var arr=[];
                var userId=$("#user_id").val();
                var feedback=$("#e-booklet-comment").val();
                $('.checkbox-input-ebooklet:checkbox:checked').each(function(){
                  arr.push($(this).val());
                });
                 $.ajax(
                    {
                        type: 'POST',
                        url: '<?php echo url('send_ebooklet_new_dashboard'); ?>',
                        data: {userId:userId, arr:arr,feedback:feedback},
                        success: function(response)
                        {  
                         var json = $.parseJSON(response);
                         if(json.error == 'false')
                            {
                                $("#e_booklet_confirmation").modal("hide");
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:green'>"+json.msg+ "</p>");
                                setTimeout(function()
                                {
                                    $('#message').modal('hide');
                                    window.location.reload();
                                }, 3000);   
                            }
                            else
                            {
                                 $('#message').modal('show');
                                $(".message-content").html("<p style='color:red'>"+json.msg+ "</p>");
                                 setTimeout(function()
                                {
                                    $('#message').modal('hide');
                                   
                                }, 3000);   
                            }
                        }
                    });
            });

            $("#coupon-send").click(function(e){
                e.preventDefault();
                var arr=[];
                $('.checkbox-input-coupon-send:checkbox:checked').each(function(){
                  arr.push($(this).val());
                });
                if(arr.length<=0)
                {
                     $("#coupon-send").parent().find(".form-error").html("Please select a coupon.");
                }
                else
                {
                    $('.coupon-area-selected').html("");
                    $('.checkbox-input-coupon-send:checkbox:checked').each(function()
                    {
                         var name = $(this).attr('data-name');
                         var cid = $(this).attr('value');
                        $(".coupon-area-selected").append('<div class="row coupon-row"><div class="col-lg-6 col-md-6 col-md-6 col-6 padding-0"><div class="row"><div class="col-lg-4 col-md-4 col-sm-4 col-4"><img src="<?php echo asset('revampstyles/icons/coupon.png'); ?>" alt="booklet-icon"></div><div class="col-lg-8 col-md-8 col-sm-8 col-8 coupon-name">'+name+'</div></div></div><div class="col-lg-6 col-md-6 col-md-6 col-6 coupon-value"><input type="text" id='+cid+' name="no_of_uses[]" onkeypress="return isNumberKey(event)" value="1"></div></div>');
                    });
                   $("#coupon_confirmation").modal("show");
                }
            });
           $(".send-coupon").click(function(e){
                e.preventDefault();
                 var token_id=[];
                 var feedback=$("#coupon-modal-comment").val();
                 var mobile_no=$("#coupon-send-mobile").val();
                $('.checkbox-input-coupon-send:checkbox:checked').each(function(){
                  token_id.push($(this).val());
                });
                var use_limit=[];
                var check = 0;
                 $("#coupon-submit-form :input[name*=no_of_uses]").each(function(){
                   use_limit.push($(this).val());
                   if(isNaN(use_limit))
                   {
                    //alert('hello2');
                    check =1;
                    //alert(check);
                   }
                });
                //alert(check);
                if(check == 1)
                {
                    alert("Please enter no of uses in numbers only");
                    $(".send-coupon").prop('disabled', false);
                }
                else
                {
                    $.ajax(
                    {
                        type: 'POST',
                        url: '<?php echo url('tokensend_new_dashboard'); ?>',
                        data: {token_id:token_id, use_limit:use_limit,feedback:feedback,mobile_no:mobile_no},
                        success: function(response)
                        {  
                                     var json = $.parseJSON(response);
                                     //alert(response);
                                     if(json.error=='false')
                                        {
                                           $("#coupon_confirmation").modal("hide");
                                            $('#message').modal('show');
                                            $(".message-content").html("<p style='color:green'>"+json.msg+ "</p>");
                                            setTimeout(function()
                                            {
                                                $('#message').modal('hide');
                                                window.location.reload();
                                            }, 3000);   
                                        }
                                        else
                                        {
                                            $('#message').modal('show');
                                            $(".message-content").html("<p style='color:red'>"+json.msg+ "</p>");
                                             setTimeout(function()
                                            {
                                                $('#message').modal('hide');
                                               
                                            }, 3000); 
                                        }
                        }
                    }); 
                } 
           });
           $('#booklet-send').click(function(e){
                e.preventDefault();
                var arr=[];
                $('.checkbox-input-booklet:checkbox:checked').each(function(){
                     arr.push($(this).val());
                });

                if(arr.length<=0)
                {
                    $("#booklet-send").parent().find(".form-error").html("Please select a booklet.");
                }  
                else
                {
                    $('.selected-booklet-area').html("");
                    $('.checkbox-input-booklet:checkbox:checked').each(function()
                    {

                         var name = $(this).attr('data-name');
                         var booklet_value = $(this).parent().parent().find('.statistic-heading1').html();
                         $(".selected-booklet-area").append('<div class="row booklet-row"><div class="col-lg-6 col-md-6 col-sm-6 col-6"><div class="row" class="fortest"><div class="col-lg-4 col-md-4 col-sm-4 col-4"><img src="<?php echo asset('revampstyles/icons/Booklets.png'); ?>"  alt="booklet-icon"></div><div class="col-lg-8 col-md-8 col-sm-8 col-8 coupon-name">'+name+'</div></div></div> <div class="col-lg-6 col-md-6 col-sm-6 col-6"><div class="booklet-value">'+booklet_value+'</div></div></div>');
                    });
                    $("#booklet_confirmation").modal("show");
                }
            });

           $(".checkbox-text-popup").click(function(e){
                e.preventDefault();
                var booklet_id=$(this).parent().parent().find(".checkbox-input-booklet").attr('value');
                var name=$(this).parent().parent().find(".checkbox-input-booklet").attr('data-name');
                $(".information-content-booklet").html("");

                $.ajax(
                {
                    type: 'GET',
                    url: '<?php echo url('merchant/coupon_details'); ?>',
                    data: {booklet_id:booklet_id},
                    success: function (response)
                    {
                        
                        var json = $.parseJSON(response);
                        for (var i = 0; i <json.length; i++)
                        {
                        $(".information-content-booklet").append('<div class="row coupon-row"><div class="col-lg-6 col-md-6 col-md-6 col-6 padding-0"><div class="row"><div class="col-lg-4 col-md-4 col-sm-4 col-4"><img src="<?php echo asset('revampstyles/icons/Booklets.png'); ?>" alt="booklet-icon"></div><div class="col-lg-8 col-md-8 col-sm-8 col-8 coupon-name">'+json[i].name+'</div></div></div><div class="col-lg-6 col-md-6 col-md-6 col-6 coupon-value">( '+json[i].value+' Uses )</div></div>');
                        }
                        $("#booklet-details-name").html(name);

                    }

                });
                $("#booklet_content").modal("show");
            });

            $(".send-booklet").click(function(e){
                            e.preventDefault();
                             var arr=[];
                            var userId=$("#user_id").val();
                            var feedback=$("#booklet-comment").val();
                            $('.checkbox-input-booklet:checkbox:checked').each(function(){
                              arr.push($(this).val());
                            });

                             $.ajax(
                                {
                                    type: 'POST',
                                    url: '<?php echo url('send_booklet_new_dashboard'); ?>',
                                    data: {userId:userId, arr:arr,feedback:feedback},
                                    success: function(response)
                                    {  
                                            
                                     var json = $.parseJSON(response);
                                     if(json.error == 'false')
                                        {
                                           $("#booklet_confirmation").modal("hide");
                                            $('#message').modal('show');
                                            $(".message-content").html("<p style='color:green'>"+json.msg+ "</p>");
                                            setTimeout(function()
                                            {
                                                $('#message').modal('hide');
                                                window.location.reload();
                                            }, 3000);   
                                        }
                                        else
                                        {
                                            $('#message').modal('show');
                                            $(".message-content").html("<p style='color:red'>"+json.msg+ "</p>");
                                             setTimeout(function()
                                            {
                                                $('#message').modal('hide');
                                               
                                            }, 3000); 
                                        }
                                    }
                                });
                  });

            $(".redeem-credit-btn").click(function(e)
            {
                e.preventDefault();
                $(".form-error").html("");
                var bill_no = $(".redeem-credit-bill-no").val();
                var bill_amount = $(".redeem-credit-bill-amount").val();
                var redeem_amount = $(".redeem-credit-redeemed").val();
                var current_points = <?php echo $card->current_points; ?>;
                var mim_redeemable_amount = <?php echo $merchant_details->mim_balance_redeem; ?>;

                if(bill_no=="")
                {
                    $(".redeem-credit-bill-no").parent().find(".form-error").html("Please provide the bill number");
                }
                else if(bill_amount=="")
                {
                    $(".redeem-credit-bill-amount").parent().find(".form-error").html("Please provide the bill amount");
                }
                else if(current_points<mim_redeemable_amount)
                {
                    $(".redeem-credit-redeemed").parent().find(".form-error").html("Minimum Balance required to redeem is <?php echo $merchant_details->mim_balance_redeem; ?>");
                }
                else
                {
                    var form = $('.redeem-credit-form')[0];
                    var data = new FormData(form);
                    $.ajax(
                    {
                        type: 'POST',
                        url: '<?php echo url('redeem_credits'); ?>',
                        data: data,
                        processData: false,
                        contentType: false,
                        cache: false,
                        success: function(response)
                        {
                            var reponse = JSON.stringify(response);
                            $(".redeem-credit-bill-no").val("");
                            $(".redeem-credit-bill-amount").val("");
                            $(".redeem-net-amount").val("");
                            $(".redeem-credit-redeemed").val("");
                            $(".redeem-credit-comment").val("");
                            if((response=="A Request to Redeem Credit(s) has been sent to the User Successfully")||(reponse=="A Request to Redeem Stamp(s) has been sent to the User Successfully"))
                            {
                                $('#otp').modal({
											    show: true,
											    keyboard: false,
											    backdrop: 'static'
											  });
                            }
                            else
                            {
                                //alert(response);
                                $('#message').modal('show');
                                $(".message-content").html(response);
                                setTimeout(function()
                                {
                                    $('#message').modal('hide');
                                    window.location.reload();
                                }, 3000);
                            }
                            $(".redeem-credit-btn").attr('disabled', false);
                          
                        }

                    });
                }
                
            });

            $(".verify-code-btn").click(function(e)
            {
                e.preventDefault();
                $(".form-error").html("");
                var code = $(".code").val();
               
                if(code=="")
                {
                    $(".code").parent().find(".form-error").html("Please provide the coupon/reward code");
                }
                else
                {
                    var form = $('.verify-form')[0];
                    var data = new FormData(form);
                    $.ajax(
                    {
                        type: 'POST',
                        url: '<?php echo url('check_coupon'); ?>',
                        data: data,
                        processData: false,
                        contentType: false,
                        cache: false,
                        success: function(response)
                        {
                            //var response = JSON.stringify(response);
                            //alert(res)
                            var json = $.parseJSON(response);
                            //alert(json);
                            if(json.error=="false")
                            {
                                $('#verify_code').modal('show');
                                if(json.type=='1')
                                {
                                    $(".verify-fields").html("");
                                    $(".verify-fields").append('<div class="verify-divs"> <div class="verify-name">coupon name</div> <div class="verify-content">'+json.coupon_name+'</div> </div> <div class="verify-divs"> <div class="verify-name">valid days</div> <div class="verify-content">'+json.valid_day+'</div> </div> <div class="verify-divs"> <div class="verify-name">valid time</div> <div class="verify-content">'+json.valid_time+'</div> </div> <div class="verify-divs"> <div class="verify-name">terms & conditions</div> <div class="verify-content">'+json.terms+'</div> </div><input type="hidden" name="merchant_id" value="'+json.merchant_id+'"> <input type="hidden" name="user_id" value="'+json.user_id+'"> <input type="hidden" name="merchant_email" value="'+json.merchant_email+'"> <input type="hidden" name="usertoken_id" value="'+json.usertoken_id+'"> <input type="hidden" name="token_id" value="'+json.token_id+'"> <input type="hidden" name="code" value="'+json.code+'"> <input type="hidden" name="feedback" value="'+json.feedback+'"> <input type="hidden" name="type" value="'+json.type+'">');    
                                }
                                else if(json.type==2)
                                {
                                    $(".verify-fields").html("");
                                    $(".verify-fields").append('<div class="verify-divs"> <div class="verify-name">coupon name</div> <div class="verify-content">'+json.coupon_name+'</div> </div> <div class="verify-divs"> <div class="verify-name">valid days</div> <div class="verify-content">'+json.valid_day+'</div> </div> <div class="verify-divs"> <div class="verify-name">valid time</div> <div class="verify-content">'+json.valid_time+'</div> </div> <div class="verify-divs"> <div class="verify-name">terms & conditions</div> <div class="verify-content">'+json.terms+'</div> </div><input type="hidden" name="merchant_id" value="'+json.merchant_id+'"> <input type="hidden" name="user_id" value="'+json.user_id+'"> <input type="hidden" name="merchant_email" value="'+json.merchant_email+'"> <input type="hidden" name="usertoken_id" value="'+json.usertoken_id+'"> <input type="hidden" name="token_id" value="'+json.token_id+'"> <input type="hidden" name="code" value="'+json.code+'"> <input type="hidden" name="feedback" value="'+json.feedback+'"> <input type="hidden" name="type" value="'+json.type+'"> <input type="hidden" name="class" value="'+json.class+'">');
                                }
                                else if(json.type==3)
                                {
                                    $(".verify-fields").html("");
                                    $(".verify-fields").append('<div class="verify-divs"> <div class="verify-name">coupon name</div> <div class="verify-content">'+json.coupon_name+'</div> </div> <div class="verify-divs"> <div class="verify-name">valid days</div> <div class="verify-content">'+json.valid_day+'</div> </div> <div class="verify-divs"> <div class="verify-name">valid time</div> <div class="verify-content">'+json.valid_time+'</div> </div> <div class="verify-divs"> <div class="verify-name">terms & conditions</div> <div class="verify-content">'+json.terms+'</div> </div><input type="hidden" name="merchant_id" value="'+json.merchant_id+'"> <input type="hidden" name="user_id" value="'+json.user_id+'"> <input type="hidden" name="merchant_email" value="'+json.merchant_email+'"> <input type="hidden" name="usertoken_id" value="'+json.usertoken_id+'"> <input type="hidden" name="token_id" value="'+json.token_id+'"> <input type="hidden" name="code" value="'+json.code+'"> <input type="hidden" name="feedback" value="'+json.feedback+'"> <input type="hidden" name="type" value="'+json.type+'"> <input type="hidden" name="class" value="'+json.class+'">');

                                }
                                //$(".verify-fields").clone();
                                
                                // $(".verify-fields").append('<div class="row" style="margin-top:10px;"><div class="col-lg-3"><input type="hidden" name="booklets[]" value="1"> xyz </div><div class="col-lg-9"> (<span style="color:green"> A coupons - B credits</span>)</div></div><div class="row">hello</div>')
                            }
                            else
                            {
                                $('#message').modal('show');
                                $(".message-content").html(json.msg);
                            }
                           
                        }

                    });
                    
                }
                
            });

            $(".confirm-otp1").click(function(e)
            {
                e.preventDefault();
                var OTP = $(".reedeem-credits-otp").val();
                if(OTP=="")
                {
                    $(this).parent().parent().find(".form-error").html("Please provide the OTP");
                }
                else
                {
                    $.ajax(
                    {
                        type: 'POST',
                        url: '<?php echo url('otp_redeem'); ?>',
                        data: {otp:OTP},
                        success: function(response)
                        {
                            var reponse = JSON.stringify(response);

                            if((response=="Credits redeemed successfully.")||(reponse=="Stamps redeemed successfully."))
                            {
                                $('#otp').modal('hide');
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:green'>"+response+ "</p>");
                                clearTimeout(interval);
                                $('.countdown').html("05:00");
                                setTimeout(function()
                                {
                                    $('#message').modal('hide');
                                    window.location.reload();
                                }, 3000);
                            }
                            else
                            {
                                $(".confirm-otp1").parent().parent().find(".form-error").html(response);
                            }
                            
                        }

                    });
                }

            });

            $(".redeem-code").click(function(e)
            {
                e.preventDefault();
                var form = $('.rewards-submit')[0];
                var data = new FormData(form);
                //alert('hello');
                    $.ajax(
                    {
                        type: 'POST',
                        url: '<?php echo url('submit_rewards'); ?>',
                        data: data,
                        processData: false,
                        contentType: false,
                        cache: false,
                        success: function(response)
                        {
                            //var reponse = JSON.stringify(response);
                            var json = $.parseJSON(response);
                            if(json.error=="false")
                            {
                                $('#verify_code').modal('hide');
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:green'>"+json.msg+ "</p>");
                                //clearTimeout(interval);
                                //$('.countdown').html("05:00");
                                setTimeout(function()
                                {
                                    $('#message').modal('hide');
                                    window.location.reload();
                                }, 3000);
                            }
                            else
                            {
                                $(".redeem-code").parent().parent().find(".form-error").html(json.msg);
                            }

                            
                            
                        }

                    });
                
            });

            $(".add-redeem").click(function(e)
            {
                e.preventDefault();
                $(".form-error").html("");
                var bill_no = $(".combo-bill-number").val();
                var bill_amount = $(".combo-bill-amount").val();
                var redeem_amount = $(".combo-redeem-credit-redeemed").val();
                var current_points = <?php echo $card->current_points; ?>;
                var mim_redeemable_amount = <?php echo $merchant_details->mim_balance_redeem; ?>;

                if(bill_no=="")
                {
                    $(".combo-bill-number").parent().find(".form-error").html("Please provide the bill number");
                }
                else if(bill_amount=="")
                {
                    $(".combo-bill-amount").parent().find(".form-error").html("Please provide the bill amount");
                }
                /*else if(current_points<mim_redeemable_amount)
                {
                    $(".combo-redeem-credit-redeemed").parent().find(".form-error").html("Minimum Balance required to redeem is <?php echo $merchant_details->mim_balance_redeem; ?>");
                }*/
                else
                {
                    var form = $('.combo-redeem-credit-form')[0];
                    var data = new FormData(form);
                    $.ajax(
                    {
                        type: 'POST',
                        url: '<?php echo url('combo_redeem_credits'); ?>',
                        data: data,
                        processData: false,
                        contentType: false,
                        cache: false,
                        success: function(response)
                        {
                            //var reponse = JSON.stringify(response);
                            var json = $.parseJSON(response);
                            //alert (response);
                            $(".combo-bill-no").val("");
                            $(".combo-bill-amount").val("");
                            $(".combo-redeem-net-amount").val("");
                            $(".combo-redeem-credit-redeemed").val("");
                            $(".combo-redeem-credit-comment").val("");
                            if(json.error=="false" && json.otp_popup=="true")
                            {
                                //alert(json.ck);
                                $('#otp-combo').modal({
                                                show: true,
                                                keyboard: false,
                                                backdrop: 'static'
                                              });
                            }
                            else
                            {
                                //alert("hello");
                                $('#message').modal('show');
                                $(".message-content").html(json.msg);
                                setTimeout(function()
                                {
                                    $('#message').modal('hide');
                                    window.location.reload();
                                }, 2000);
                            
                            }
                        }

                    });
                }
            });
            $("#chek_in_submit").click(function(e){
                e.preventDefault();
                var mobile_no = $("#mobile_no").val();
                var bill_number = $("#bill_number").val();
                var bill_amount = $("#bill_amount").val();
                var number_of_guests = $("#number_of_guests").val();
                var activity = $("#activity").val();
                var feedback = $("#feedback").val();
                 $.ajax(
                    {
                        type: 'POST',
                        url: '<?php echo url('check_in_newdashboard'); ?>',
                        data: {mobile_no:mobile_no,bill_number:bill_number,bill_amount:bill_amount,
                            number_of_guests:number_of_guests,activity:activity,feedback:feedback},
                        success: function(response)
                        {
                            
                            
                            var json = $.parseJSON(response);
                            if(json.error == 'false')
                            {
                              
                                $('#chek_in').modal('hide');
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:green'>"+json.msg+ "</p>");
                                setTimeout(function()
                                {
                                    $('#message').modal('hide');
                                    window.location.reload();
                                }, 3000);
                                
                            }
                            else
                            {
                              // alert(response);
                                $("#chek_in_submit").parent().parent().find(".form-error").html(json.msg);
                            }
                        }
                    });

            });

            $(".confirm-otp2").click(function(e)
            {
                e.preventDefault();
                var OTP = $(".combo-reedeem-credits-otp").val();
                if(OTP=="")
                {
                    $(this).parent().parent().find(".form-error").html("Please provide the OTP");
                }
                else
                {
                    $.ajax(
                    {
                        type: 'POST',
                        url: '<?php echo url('otp_redeem_combo'); ?>',
                        data: {otp:OTP},
                        success: function(response)
                        {
                            //var reponse = JSON.stringify(response);
                            var json = $.parseJSON(response);

                            if(json.error == 'false')
                            {
                                $('#otp-combo').modal('hide');
                                $('#message').modal('show');
                                $(".message-content").html("<p style='color:green'>"+json.msg+ "</p>");
                                clearTimeout(interval);
                                $('.countdown').html("05:00");
                                setTimeout(function()
                                {
                                    $('#message').modal('hide');
                                    window.location.reload();
                                }, 3000);
                            }
                            else
                            {
                                $(".confirm-otp2").parent().parent().find(".form-error").html(json.msg);
                            }
                            
                        }

                    });
                }
            });

            $(".account-login").click(function()
            {
                //alert("hello");
                    //e.preventDefault();
                    var password = $(".advance-password").val();
                    //alert(password);
                    if(password=="")
                    {
                        //alert("error");
                        $(this).parent().parent().find(".form-error").html("Please provide password");
                    }
                    else
                    {
                        $.ajax(
                        {
                            type: 'POST',
                            url: '<?php echo url('admin_dashboard_login'); ?>',
                            data: {password:password},
                            success: function(response)
                            {
                                var reponse = JSON.stringify(response);

                                if(response=="successfully")
                                {
                                    //alert("done");
                                    window.location.replace("../merchant/main-dashboard");
                                }
                                else
                                {
                                    $(".account-login").parent().parent().find(".form-error").html(response);
                                }
                                
                            }

                        });
                    }
            });
            $(".advance-password").keyup(function(event) {
                if (event.keyCode === 13) {
                    $(".account-login").click();
                }
            });
            
        });

        function calculateCreditAwarded()
        {
            var bill_amount = $(".add-credit-bill-amount").val();
            var percentage = $(".credit-percentage").val();
            var limit = <?php echo $max_credit_percentage; ?>;

            if(bill_amount=="")
            {
                bill_amount = 0;
            }
            else
            {
                bill_amount = parseInt(bill_amount);
            }

            if(percentage=="")
            {
                percentage = 0;
            }
            else
            {
            	if(percentage > limit)
            	{
            		percentage = parseInt(limit);

            	}
            	else
            	{
            		percentage = parseInt(percentage);	
            	}

            }

            var credits = Math.round(bill_amount*(percentage/100));
            //var credits = Math.round(credits);
            //alert(credits);

            $(".percentage_value").val(credits);
        }

        function calculateCreditRedeemed_old()
        {
            var mobile_no = $(".mobile_no").val();
            var bill_amount = $(".redeem-credit-bill-amount").val();

            $.ajax(
            {
                type: 'POST',
                url: '<?php echo url('calculate_redeem_amount'); ?>',
                data: {mobile_no:mobile_no, bill_amount:bill_amount},
                success: function(response)
                {
                    
                    $(".redeem-credit-redeemed").val(response);
                    $(".redeem-net-amount").val(bill_amount-response);
                }

            });
        }

        function calculateCreditRedeemed()
        {
            var mobile_no = $(".mobile_no").val();
            var bill_amount = $(".redeem-credit-bill-amount").val();
            var current_points = $(".current_point_for_user").val();

            var limit = <?php echo $max_credit_percentage; ?>;
            var max_redeem_gbill = <?php echo $max_redeem_gbill; ?>;
            var limit_max_redeem = '<?php echo $limit_max_redeem; ?>';
            var maxallow_redeem_trans = <?php echo $maxallow_redeem_trans; ?>;

            var percentage_redeemed = Math.round(bill_amount*(max_redeem_gbill/100));
            if(limit_max_redeem == 'Yes')
            {
                if(maxallow_redeem_trans < percentage_redeemed)
                {
                    if(maxallow_redeem_trans > current_points)
                    {
                            credits_redeemed = current_points;
                    }
                    else
                    {
                            credits_redeemed = maxallow_redeem_trans;
                    }
                }
                else
                {
                    if(percentage_redeemed>current_points)
                    {
                            credits_redeemed = current_points;
                    }
                    else
                    {
                            credits_redeemed =  percentage_redeemed;
                    }

                }
            }
            else
            {
                //alert(current_points);
                if(percentage_redeemed > current_points)
                {
                    credits_redeemed = current_points;
                }
                else
                {
                    credits_redeemed = percentage_redeemed;
                }
            }
            var final_credits_redeemed = Math.round(credits_redeemed);
            $(".redeem-credit-redeemed").val(final_credits_redeemed);
            $(".redeem-net-amount").val(bill_amount-final_credits_redeemed);

        }

        function calculateComboRedeemAmount_old()
        {
            var mobile_no = $(".mobile_no").val();
            var bill_amount = $(".combo-bill-amount").val();
            var limit = <?php echo $max_credit_percentage; ?>;
            var percentage = $(".combo-credit-percentage").val();

            $.ajax(
            {
                type: 'POST',
                url: '<?php echo url('calculate_combo_redeem_amount'); ?>',
                data: {mobile_no:mobile_no, bill_amount:bill_amount},
                success: function(response)
                {
                    
                    $(".combo-redeem-credit-redeemed").val(response);
                    $(".combo-redeem-net-amount").val(bill_amount-response);
                    var credits = Math.round((bill_amount-response)*(percentage/100));
                    //var credits = Math.round(credits);

                    $(".combo_percentage_value").val(credits);
                }

            });
        }
        function calculateCreditAwardedForCombo()
        {
            var bill_amount = $(".combo-redeem-net-amount").val();
            var percentage = $(".combo-credit-percentage").val();
            var limit = <?php echo $max_credit_percentage; ?>;

            if(bill_amount=="")
            {
                bill_amount = 0;
            }
            else
            {
                bill_amount = parseInt(bill_amount);
            }

            if(percentage=="")
            {
                percentage = 0;
            }
            else
            {
                if(percentage > limit)
                {
                    percentage = parseInt(limit);

                }
                else
                {
                    percentage = parseInt(percentage);  
                }

            }

            var credits = Math.ceil(bill_amount*(percentage/100));

            $(".combo_percentage_value").val(credits);
        }
        function calculateComboRedeemAmount()
        {
            var mobile_no = $(".mobile_no").val();
            var bill_amount = $(".combo-bill-amount").val();
            var limit = <?php echo $max_credit_percentage; ?>;
            var percentage = $(".combo-credit-percentage").val();
            var current_points = $(".current_point_for_user_combo").val();

            var max_redeem_gbill = <?php echo $max_redeem_gbill; ?>;
            var limit_max_redeem = '<?php echo $limit_max_redeem; ?>';
            var maxallow_redeem_trans = <?php echo $maxallow_redeem_trans; ?>;

            var percentage_redeemed = Math.round(bill_amount*(max_redeem_gbill/100));
            if(limit_max_redeem == 'Yes')
            {
                if(maxallow_redeem_trans < percentage_redeemed)
                {
                    if(maxallow_redeem_trans > current_points)
                    {
                            credits_redeemed = current_points;
                    }
                    else
                    {
                            credits_redeemed = maxallow_redeem_trans;
                    }
                }
                else
                {
                    if(percentage_redeemed>current_points)
                    {
                            credits_redeemed = current_points;
                    }
                    else
                    {
                            credits_redeemed =  percentage_redeemed;
                    }

                }
            }
            else
            {
                //alert(current_points);
                if(percentage_redeemed > current_points)
                {
                    credits_redeemed = current_points;
                }
                else
                {
                    credits_redeemed = percentage_redeemed;
                }
            }
            var final_credits_redeemed = Math.round(credits_redeemed);
            $(".combo-redeem-credit-redeemed").val(final_credits_redeemed);
            $(".combo-redeem-net-amount").val(bill_amount-final_credits_redeemed);
            var credits = Math.ceil((bill_amount-final_credits_redeemed)*(percentage/100));
            $(".combo_percentage_value").val(credits);
        }
        function checkInp()
        {
          var x=$(".search-field").val();
          if (isNaN(x)) 
          {
            alert("Please enter valid mobile number");
            //$(".innitial-dashboard").html(response);
            return false;
          }
        }
        function handleChange(input) 
        {
            alert('hello');
        }
        
    </script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.MasterLayout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>