IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/storage/framework/views/b096480a6b04262db64f6e47c72d8a1264a6b048.php

<?php $__env->startSection('content'); ?>
<div class="modal" tabindex="-1" role="dialog" id="paymentModal" aria-labelledby="paymentModalLabel" aria-hidden="true" data-backdrop="">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-body">
        <div id="payment-form"></div>
      </div>
    </div>
  </div>
</div>
<div role="tabpanel" class="tab-pane in active" id="details" aria-expanded="true">
    <div class="card" id="details">
        <div class="body">                                
            <div class="row">
                <div class="col-sm-6 col-sm-offset-1">
                    <address>
                        <strong> Student Name : </strong><?php echo e($student->firstName); ?> <?php echo e($student->middleName); ?> <?php echo e($student->lastName); ?><br>
                        <strong> Father Name : </strong><?php echo e($student->father_fname); ?> <?php echo e(isset($student->father_lname) ? $student->father_lname : ''); ?><br>
                        <strong> Mobile : </strong><?php echo e($student->father_mobile); ?><br>
                        <strong> Class : </strong><?php echo e($student->classM->className); ?><br>
                        <?php if(isset($student->section)): ?>
                        <strong> Section : </strong><?php echo e($student->section->sectionName); ?><br>
                        <?php endif; ?>
                        <strong> Ec No. : </strong><?php echo e($student->ecNo); ?><br>
                    </address>

                    <?php if(session('status')): ?>
                    <?php if(session('status') == 'Payment Error'): ?>
                    <div class="alert alert-warning">
                        <?php echo e(session('status')); ?>

                    </div>
                    <?php else: ?>
                    <div class="alert alert-success">
                        <?php echo e(session('status')); ?>

                    </div>
                    <?php endif; ?>
                    <?php endif; ?>
                </div>
            </div>
            <div class="mt-40"></div>
            <form action="<?php echo e(url('/student/payfees')); ?>" method= "get">
                <div class="row">
                    <div class="col-sm-5">
                        <div class="row clearfix">
                            <div class="col-sm-4 form-control-label">
                                <label for="classname"><strong>Payable Mode</strong></label>
                            </div>
                            <div class="col-sm-6">
                                <div class="form-group">
                                    <input type="radio" id="paymode1" name="paymode" value="full" <?php if($isFull == 'Full'): ?> checked <?php endif; ?>>
                                           <label for="paymode1">Plan A (Full Payment)</label><br>
                                    <input type="radio" id="paymode2" name="paymode" value="installments"  <?php if($isFull == 'Installment'): ?> checked <?php endif; ?>>
                                           <label for="paymode2">Plan B (Installment)</label><br>  
                                </div>
                            </div>
                            <div class="col-sm-2">
                                <input class="btn btn-primary btn-round" type="submit" value="Change Now" style="background-color:black;color:white;"/>
                            </div>
                        </div>
                    </div>
            </form>
            <div class="col-md-12">
                <div class="table-responsive">
                    <form id="feesubmission">
                        <input type="hidden" name="_token" id="token" value="<?php echo e(csrf_token()); ?>">


                        <?php $logo = \App\School::where('idSchool', '=', $student->idSchool)->first();
                        ?>
                        <input type="hidden" name="idStudent" value="<?php echo e($student->idStudent); ?>">
                        <input type="hidden" name="idFinancialYear" value="<?php echo e($student->idFinancialYear); ?>">
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th></th>
                                    <th style="width:60px;">Due Date</th>
                                    <th>Particular</th>
                                    <th>Amount</th>
                                    <th>Discount</th>
                                    <th>Fine</th>
                                    <th>Status</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $totalFine = 0;$actualTotal = 0; ?>
                                <?php $__currentLoopData = $feeheads; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $fee): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if(str_contains($fee->feeheadName, $isFull) || str_contains($fee->feeheadName, 'Admission') || str_contains($fee->feeheadName, 'P1') || str_contains($fee->feeheadName, 'P2')): ?>
                                <tr>
                                    <?php
                                    $disableHeader = true;
                                    $feepaid = \App\StudentTransactionDetail::where('idStudent', '=', $student->idStudent)
                                                    ->where('idFeehead', '=', $fee->idFeehead)->first();
                                    $lesser_feepaid = DB::table('lesser_transaction')
                                                    ->join('lesser_transaction_details', 'lesser_transaction_details.idLesserTransaction', '=', 'lesser_transaction.idLesserTransaction')
                                                    ->where('lesser_transaction.idStudent', '=', $student->idStudent)
                                                    ->where('idFeehead', '=', $fee->idFeehead)
                                                    ->where(function($query) {
                                                        $query->whereNull('lesser_transaction.status');
                                                        $query->orWhere('lesser_transaction.status', '=', 'Cleared');
                                                        $query->orWhere('lesser_transaction.status', '=', 'In-Process');
                                                        $query->orWhere('lesser_transaction.status', '=', 'Success');
                                                    })
                                                ->select(DB::raw('SUM(totalPaid) as totalPaid'))
                                                ->first();

                                                
                                    $stepFine = 0;
                                    $sdiscount = \App\StudentDiscount::where('idStudent', '=', $student->idStudent)
                                                    ->where('idFeehead', '=', $fee->idFeehead)->where('isActive', 'Y')->get();

                                    $todate = Carbon\Carbon::parse($fee->toDate);
                                    $today_date = Carbon\Carbon::parse(today_date());
                                    $days_afterduedate = $todate->diffInDays($today_date);
                                    $curdate = strtotime(today_date());
                                    $lastfeedate = strtotime($fee->toDate);

                                    $headerObject = \App\FeeHead::where('idFeehead', '=', $fee->idFeehead)->first()->toArray();
                                    if(str_contains($headerObject['feeheadName'], "Full Payment")){
                                        $startDate = Carbon\Carbon::parse($headerObject['toDate']);
                                        $now = Carbon\Carbon::now();
                                        $dueDiff = $startDate->diffInDays($now, false);
                                        if($dueDiff >= 1)
                                        $disableHeader = false;
                                    }else{
                                        $startDate = Carbon\Carbon::parse($headerObject['fromDate']);
                                        $now = Carbon\Carbon::now();
                                        $dueDiff = $startDate->diffInDays($now, false);
                                        $disableHeader = ($dueDiff > -1);
                                        if($dueDiff > -1){
                                            $endDate = Carbon\Carbon::parse($headerObject['toDate']);
                                            $now = Carbon\Carbon::now();
                                            $endDiff = $endDate->diffInDays($now, false);
                                            $disableHeader = ($endDiff < 0);
                                        }
                                    }
                                    $date = Carbon\Carbon::parse($headerObject['toDate']);
                                    $startDate = Carbon\Carbon::parse($headerObject['fromDate']);
                                    $now = Carbon\Carbon::now();

                                    $diff = $date->diffInDays($now, false);
                                    $dueDiff = $startDate->diffInDays($now, false);


                                    $std_trdet = \App\StudentTransactionDetail::where('idStudent', '=', $student->idStudent)
                                                    ->where('idFeehead', '=', $fee->idFeehead)
                                                    ->select(DB::raw('amountPaid as amount'), DB::raw('discount as discount'), DB::raw('fine as fine'), 'status')->latest()->first();


                                    if ($diff > 0 && $std_trdet == null) {
                                        if ($headerObject['fine'] != null && $headerObject['fine'] != 0.00) {
                                            $stepFine = $headerObject['fine'] * $diff;
                                            $totalFine = $totalFine + ( $headerObject['fine'] * $diff);
                                        } else
                                        if ($headerObject['flatFine'] != null) {
                                            $stepFine = $stepFine + $headerObject['flatFine'];
                                            $totalFine = $totalFine + $headerObject['flatFine'];
                                        }
                                    }


                                    $stepDiscount = 0;
                                    if ($sdiscount != null) {
                                        foreach ($sdiscount as $discounts) {
                                            $stepDiscount = $stepDiscount + $discounts->amount;
                                        }
                                        $tootalfeeamt = $fee->amount - $stepDiscount + $totalFine;
                                    } else {
                                        $tootalfeeamt = $fee->amount + $totalFine;
                                    }

                                    if($std_trdet != null)
                                    $ft = $std_trdet['amount'] + $std_trdet['fine'] - $std_trdet['discount'];
                                    $actualTotal =  $actualTotal + $tootalfeeamt;
                                    $fromDate = strtotime($fee->fromDate);
                                    $todayDate = strtotime(today_date());
                                    ?>
                                    <td>
                                        <?php if($std_trdet==null): ?>
                                        <div class="checkbox-inline" style="padding-left:10px;">
                                            <?php if(str_contains($fee->feeheadName, 'P1')): ?>
                                            <input type="checkbox" name="selectedHeaders[]" value="<?php echo e($fee->idFeehead); ?>" class="feeclass" checked onclick="return false;">
                                            <?php $disableHeader = false; ?>
                                            <?php else: ?>
                                            <?php if($disableHeader): ?>
                                            <input type="checkbox" name="selectedHeaders[]" value="<?php echo e($fee->idFeehead); ?>" class="feeclass">
                                            <?php $disableHeader = false; ?>
                                            <?php endif; ?>
                                            <?php endif; ?>
                                        </div>
                                        <?php elseif( $std_trdet['status'] != null
                                        &&  $std_trdet['status'] != 'Cleared' &&  $std_trdet['status'] != 'In-Process' &&  $std_trdet['status'] != 'Success'): ?> 
                                        <div class="checkbox-inline" style="padding-left:10px;"><input type="checkbox" name="selectedHeaders[]" value="<?php echo e($fee->idFeehead); ?>" class="feeclass"></div>
                                        <?php endif; ?>
                                    </td>
                                    <td><?php echo e(Carbon\Carbon::parse($fee->toDate)->format('d-m-Y')); ?></td>
                                    <td>
                                        <?php echo e($fee->feeheadName); ?>

                                        <?php echo e($fee->description); ?>

                                        <?php if(isset($lesser_fees->totalPaid)): ?>
                                        <?php if($lesser_fees->totalPaid < $tootalfeeamt): ?>
                                        <br>
                                        <label id="lesser_note"><b> Amount Paid: </b><?php echo e($lesser_fees->totalPaid); ?> </label>
                                        <?php endif; ?>
                                        <?php endif; ?>
                                        <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][idFeehead]' value="<?php echo e($fee->idFeehead); ?>">
                                    </td>
                                    <td class='amt'>
                                        <?php echo e($fee->amount); ?>

                                        <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][famount]' value="<?php echo e($fee->amount); ?>">
                                    </td>
                                    <td class="discount">
                                        <?php if(isset($std_trdet->discount)): ?>
                                        <p><?php echo e($std_trdet->discount); ?></p>
                                        <?php elseif(isset($sdiscount)): ?>
                                        <span>
                                            <?php if(isset($feepaid_date)): ?>
                                            <?php echo e($stepDiscount); ?><?php echo e($feepaid_date); ?>

                                            <?php else: ?>
                                            <?php echo e($stepDiscount); ?>

                                            <?php endif; ?>
                                            <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][discount]' value="<?php echo e($stepDiscount); ?>">
                                        </span>
                                        <?php else: ?>
                                        <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][discount]' value="0.00">
                                        <?php endif; ?>


                                    </td>
                                    <td class="fine">
                                        <?php if($stepFine > 0): ?>
                                        <p><?php echo e($stepFine); ?></p>
                                        <?php elseif($std_trdet != null): ?>
                                        <p><?php echo e($std_trdet['fine']); ?></p>
                                        <?php elseif($feepaid!=null): ?>
                                        <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][fine]' value="<?php echo e($feepaid->fine); ?> ">
                                        <?php elseif($curdate > $lastfeedate   && $fee->fine > 0): ?>
                                        <?php echo e($fee->fine * $days_afterduedate); ?>

                                        <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][fine]' value="<?php echo e($fee->fine * $days_afterduedate); ?> ">
                                        <?php elseif(($curdate > $lastfeedate   && $fee->flatFine > 0)): ?>
                                        <?php echo e($fee->flatFine); ?>

                                        <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][fine]' value="<?php echo e($fee->flatFine); ?>">
                                        <?php else: ?>
                                        <input type="hidden" name='feeheads[<?php echo e($fee->idFeehead); ?>][fine]' value="0.00">
                                        <?php endif; ?>
                                    </td>
                                    <td>
                                        <?php if($std_trdet != null): ?>
                                            <?php if($std_trdet['status'] == null || $std_trdet['status'] == 'Cleared'): ?>
                                            <span class="badge badge-success">Paid </span>
                                            <?php else: ?>
                                            <span class="badge badge-info">In-Process </span>
                                            <?php endif; ?>
                                        <?php else: ?>
                                        <?php if($dueDiff > 0): ?>
                                        <span class="badge badge-danger">DUE</span>
                                        <?php else: ?>
                                        <span class="badge badge-info">UPCOMING</span>
                                        <?php endif; ?>
                                        <?php endif; ?>
                                    </td>
                                </tr>
                                <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                </div>
            </div>
            <div class="col-sm-5">
                <div class="row clearfix">
                    <div class="col-sm-5 form-control-label">
                        <label for="classname">Payable Amount</label>
                    </div>
                    <div class="col-sm-6">
                        <div class="form-group">
                            <?php if(isset($prevaccess_fee->excessAmount)): ?>
                            <?php if($prevaccess_fee->excessAmount > 0): ?>
                            <label id="access_note"><b>Excess Amount Available: </b><?php echo e($prevaccess_fee->excessAmount); ?> </label>
                            <?php endif; ?>
                            <?php endif; ?>
                            <input type="text" name="payableAmount" class="form-control" readonly="readonly"  style="color: black;font-size: 1.2em;">
                        </div>
                    </div>

                    <div class="hidden-print col-md-8 text-right">
                        <input class="btn btn-primary btn-round" type="submit" name="payable" value="Pay Now" id="submit-btn" style="background-color:black;color:white;"/>

                    </div>

                </div>
            </div>
            </form>
           
            <div class="col-sm-12">
                <h5>Payment History</h5>
                <div class="table-responsive">
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th>Receipt No</th>
                                <th>Date</th>
                                <th>Amount</th>
                                <!--<th>Balance</th>-->
                                <th>Payment Mode</th>
                                <th>Print</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            foreach($paidfees as $transact){
                                $feeHead = \App\StudentTransactionDetail::join('feeheads', 'student_transaction_details.idFeehead', '=', 'feeheads.idFeehead')->where('idTransaction', '=', $transact->idTransaction)->first();
                                if($feeHead != null)
                                if(str_contains($feeHead->feeheadName, "Full Payment") && $feeHead->idFinancialYear == 244){
                                    $paidfees[] = json_decode(json_encode (array(
                                        "type" => "book",
                                        "idTransaction" => $transact->idTransaction."00",
                                        "receiptNo" => "BOOK".$transact->idTransaction."MH",
                                        "totalPaid" => "0.00",
                                        "paymentDate" => $transact->paymentDate,
                                        "paymentMode" => $transact->paymentMode,
                                        "fine" => $transact->fine
                                    )), FALSE);
                                    break;
                                }
                            }
                            ?>
                            <?php $__currentLoopData = $paidfees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td><?php echo e($var->receiptNo); ?></td>
                                <td><?php echo e($var->paymentDate); ?></td>
                                <td><?php echo e($var->totalPaid); ?></td>
                                <!--<td></td>-->
                                <td><?php echo e($var->paymentMode); ?></td>
                                <?php if(isset($var->type)): ?>
                                <td><a href="<?php echo e(url('student/stdtransaction/'.$var->idTransaction.'/book-print')); ?>" target="_blank" class="btn btn-sm btn-info">Book Print</a></td>
                                <?php else: ?>
                                <td><a href="<?php echo e(url('student/stdtransaction/'.$var->idTransaction.'/print')); ?>" target="_blank" class="btn btn-sm btn-info">Print</a></td>
                                <?php endif; ?>
                            </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            
                        </tbody>
                    </table>
                </div>
                <h6>Lesser Paid Receipt</h6>
                <div class="table-responsive">
                    <table class="table table-hover">
                        <thead>
                            <tr>
                                <th>Date</th>
                                <th>Amount</th>
                                <!--<th>Balance</th>-->
                                <th>Payment Mode</th>
                                <th>Print</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $lesserfees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $var): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td><?php echo e($var->paymentDate); ?></td>
                                <td><?php echo e($var->totalPaid); ?></td>
                                <!--<td></td>-->
                                <td><?php echo e($var->paymentMode); ?></td>
                                <?php if($var->status == 'Cleared' || $var->status == null): ?>
                                <td><a href="<?php echo e(url('student/stdtransaction/lessamt/'.$var->idLesserTransaction.'/print')); ?>" target="_blank" class="btn btn-sm btn-info">Print</a></td>
                                <?php endif; ?>
                            </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>
            </div>


        </div>
        <div class="row">
            <p  class="col-md-12 text-right" style="color:blue;cursor:pointer;" onClick="toogleDetails()">More Fee Details <i class="zmdi zmdi-long-arrow-down"></i></p>
            <div class="col-md-12 text-right" id="show_details" style="display:none;">
                <p class="m-b-0"><b>Fee Total: </b><span  id='total_fee'></span>
                    <input type="hidden" name="feeTotal" id="feetotal">
                </p>
                <p class="m-b-0">
                    <b>Discount: </b>
                    <span  id='total_discount'></span>
                    <input type="hidden" name="discount" id="discounttotal">
                </p>     
                <p class="m-b-0">
                    <b>Fine: </b>
                    <span id='total_fine'></span>
                    <input type="hidden" name="fine" id="finetotal">
                </p>
                <p class="m-b-0">
                    <b>Cheque Bounce Penalty: </b>
                    <span id="penaltyAmt"></span>
                    <?php
                    $chqbounce = \App\StudentTransaction::where('idStudent', '=', $student->idStudent)
                            ->where('idFinancialYear', '=', $student->idFinancialYear)
                            ->where('status', '=', 'Bounced')
                            ->get();

                    $chqPenaltyAmount = 0;
                    $chqPenaltyPaid = 0;
                    $chqPenaltyUnPaid = 0;
                    if (isset($chqbounce)) {
                        foreach ($chqbounce as $chqFine) {
                            if ($chqFine->chqFineStatus == 1)
                                $chqPenaltyPaid = $chqPenaltyPaid + $chqFine->chequeBounceCharge;
                            else
                                $chqPenaltyUnPaid = $chqPenaltyUnPaid + $chqFine->chequeBounceCharge;

                            $chqPenaltyAmount = $chqPenaltyAmount + $chqFine->chequeBounceCharge;
                        }
                    }
                    ?>
                    <?php if(isset($chqbounce)): ?>
                    <?php echo e($chqPenaltyAmount); ?>

                    <?php if($chqPenaltyAmount==0): ?>
                    <span></span>
                    <?php elseif($chqPenaltyAmount > $chqPenaltyPaid): ?>
                    <span style="color:red"> | <?php echo e($chqPenaltyUnPaid); ?>(Unpaid)</span>
                    <?php else: ?>
                    <span style="color:green">(Paid)</span>
                    <?php endif; ?>
                    <?php else: ?>
                    <span>0.00</span>
                    <?php endif; ?>
                </p>
                <p class="m-b-0"><b>Excess Amount : </b>
                    <?php if(isset($prevaccess_fee->excessAmount)): ?>
                    <?php echo e($prevaccess_fee->excessAmount); ?>

                    <?php else: ?>
                    <span>0.00</span>
                    <?php endif; ?>
                </p>
                <?php $totalAmount = ($actualTotal + $totalFine + $chqPenaltyAmount - $paidfees_tot->discount); ?>
                <p class="m-b-0"><b>Total Amount : </b>
                    <?php echo e($totalAmount); ?>

                </p> 
                <p class="m-b-0"><b>Total Paid: </b>
                    <span id='total_paid'>
                        <?php if($paidfees_tot): ?>
                        <?php echo e($paidfees_tot->totalPaid); ?>

                        <?php else: ?>
                        0.00
                        <?php endif; ?>
                    </span>
                </p>
                <p class="m-b-0"><b>Balance Amount: </b>
                    <?php if($paidfees_tot->totalPaid !=null): ?>
                    <?php $b = $totalAmount - ($paidfees_tot->totalPaid); ?>
                    <?php echo e($b); ?>

                    <?php else: ?>
                    <?php echo e($totalAmount); ?>

                    <?php endif; ?>

                </p>
            </div>
        </div>
        <!--<hr>-->

        <hr>
    </div>
</div>
</div>

<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<?php if($paymentMode == "easebuzz"): ?>
<script src="https://ebz-static.s3.ap-south-1.amazonaws.com/easecheckout/easebuzz-checkout.js"></script> 
<?php else: ?>
<script src="https://sdk.cashfree.com/js/ui/1.0.26/dropinClient.prod.js"></script>
<?php endif; ?>

<script>
function toogleDetails(){
    $("#show_details").toggle();
}    
<?php if($paymentMode == "easebuzz"): ?>
document.getElementById('submit-btn').onclick = function (e) {
        e.preventDefault();
        var adata = $('#feesubmission').serializeArray();
        
        $("#submit-btn").prop('disabled', true);
        $.ajax({
            method: 'post',
            url: "<?php echo url('student/generate-order-easebuzz'); ?>",
            data: adata,
            success:function(result){
//               console.log(result);
               $('#paymentModal').modal('show')
               var easebuzzCheckout = new EasebuzzCheckout(result["key"], 'prod')
               var options = {
                    access_key: result["token"], // access key received via Initiate Payment
                    onResponse: (response) => {
                        if (response.status == "success") {
                            $.ajax({
                                url: "<?php echo url('student/checkpaymentstatus-easebuzz?order_id='); ?>" + response.txnid,
                                success: function(result) {
                                    window.location.href = "<?php echo e(url('student/payfees')); ?>";
                                },
                            });
                        } 
                    },
                    theme: "#11385b" // color hex
                }
                $('#submit-btn').hide();
                easebuzzCheckout.initiatePayment(options);
            }
        });
    }
<?php else: ?>
document.getElementById('submit-btn').onclick = function (e) {
        e.preventDefault();
        var adata = $('#feesubmission').serializeArray();
        $("#submit-btn").prop('disabled', true);
        $.ajax({
            method: 'post',
            url: "<?php echo url('student/generate-order-cashfree'); ?>",
            data: adata,
            success:function(result){
//               console.log(result);
               $('#paymentModal').modal('show')
               var orderToken = result["order_token"];
               const dropConfig = {
                    "components": [
                        "order-details",
                        "card",
                        "netbanking",
                        "app",
                        "upi"
                    ],
                    "orderToken": orderToken,
                    "onSuccess": function(data) {
                        //on payment flow complete
                        if (data.order && data.order.status == "PAID") {
                            $.ajax({
                                url: "<?php echo url('student/checkpaymentstatus-cashfree?order_id='); ?>" + data.order.orderId,
                                success: function(result) {
                                    window.location.href = "<?php echo e(url('student/payfees')); ?>";
                                },
                            });
                        } else {
                            //order is still active
                            alert("Order is ACTIVE")
                        }
                    },
                    "onFailure": function(data) {
                        //on failure during payment initiation
                        alert(data.order.errorText);
                    },
                    "style": {
                        //to be replaced by the desired values
                        "backgroundColor": "#ffffff",
                        "color": "#11385b",
                        "fontFamily": "Lato",
                        "fontSize": "14px",
                        "errorColor": "#ff0000",
                        "theme": "light", //(or dark)
                    }
                }
                $('#submit-btn').hide();
                const cashfree = new Cashfree();
                const paymentElement = document.getElementById("payment-form");
                cashfree.initialiseDropin(paymentElement, dropConfig);
            }
        });
    }
    <?php endif; ?>
    // Saving form data
var isValid=0;     

$(document).ready(function(){
 $('.otherpaymode').hide(); 
 $('#paymentModal').on('hidden.bs.modal', function () {
    window.location.href = "<?php echo e(url('student/payfees')); ?>";
 });
 $('#paymode').change(function() {
        var val = $(this).val();
        if((val == 'Cheque')){
           $('.otherpaymode').show();
        }else if(val == 'DD'){
           $('.otherpaymode').show();
        }else{
           $('.otherpaymode').hide();
        }
    });
});

var feeheaderIds = [];
$('.feeclass').change(function() {
    feeheaderIds = [];
    $("input:checkbox[name='selectedHeaders[]']:checked").each(function () {
            feeheaderIds.push($(this).val());
    });
    if(feeheaderIds.length>0)
    $.ajax({
            url: "<?php echo e(url('/student/feeheaders')); ?>"+'/' +feeheaderIds + "/students/"+<?php echo e($student->idStudent); ?>,
            type: "GET",
            dataType: "json",
                success:function(data) {
                     $('input[name="payableAmount"]').val(data);
                }
            });
    else    $('input[name="payableAmount"]').val(" ");      
});

function calculatePenalty(){
        var penaltyAmt = parseFloat($('#penalty').val());
        console.log(penaltyAmt);
        $('#penaltyAmt').text(penaltyAmt.toFixed(2));
    }
    
var sum = 0;
var discount = 0;
var fine = 0;
// iterate through each td based on class and add the values
$(".amt").each(function() {

    var value = $(this).text();
    // add only if the value is number
    if(!isNaN(value) && value.length != 0) {
        sum += parseFloat(value);
    }
    $('#total_fee').text(sum.toFixed(2));
    
});

$(".discount").each(function() {

    var value = Number($(this).text());
    // add only if the value is number
    if(!isNaN(value) && value.length != 0) {
        discount += parseFloat(value);
    }
   $('#total_discount').text(discount.toFixed(2));
});
$(".fine").each(function() {

    var value = Number($(this).text());
    // add only if the value is number
    if(!isNaN(value) && value.length != 0) {
        fine += parseFloat(value);
    }
    $('#total_fine').text(fine.toFixed(2));
});
 var ftotal = parseFloat($('#total_fee').text()); 
 var tdiscount = parseFloat($('#total_discount').text());
 var tfine = parseFloat($('#total_fine').text());
 var paidtot = parseFloat($('#total_paid').text());
 var fbalance = parseFloat(ftotal+paidtot);
 $('#total_balance').text(fbalance.toFixed(2));
 var feetotal = parseFloat(ftotal);
 $('#feetotal').val(feetotal.toFixed(2));
 
 var distotal = parseFloat($('#total_discount').text()); 
 $('#discounttotal').val(distotal.toFixed(2));

 var tf = parseFloat($('#total_fine').text()); 
 $('#finetotal').val(tf.toFixed(2));
 
 var baltotal = parseFloat(ftotal+tfine-tdiscount);
 $('#balance_total').text(baltotal.toFixed(2));
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('students.student_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

Copyright © 2021 - 2025 IMMREX7