IMMREX7

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

<?php $__env->startSection('content'); ?>
<div class="row clearfix">
    <div class="col-lg-5 col-md-5 col-sm-5">
        <div class="card">
            <div class="header">
                <h2><strong>Assign Discount</strong></h2>
            </div>
            <div class="body">
                <?php if(isset($discount)): ?>
                <?php echo Form::model($discount, ['method' => 'PATCH', 'action' => ['School\AssignDiscountController@update', $discount->idStdDiscount], 'class' => 'form-horizontal']); ?>

                <?php else: ?>
                <?php echo Form::open(['url' => 'school/assigndiscount', 'class' => 'form-horizontal']); ?>

                <?php endif; ?>
                <div class="row clearfix">
                    <div class="col-sm-4 form-control-label">
                        <label for="classname">Class</label>
                    </div>
                    <div class="col-sm-7">
                        <div class="form-group">
                            <?php if(isset($discount)): ?>
                            <select name='idClass' class="form-control show-tick ms select2">
                                <option value="<?php echo e($studentDetails->idClass); ?>"><?php echo e($studentDetails->classM->className); ?></option>
                            </select>
                            <?php else: ?>
                            <?php echo Form::select('idClass',$classes,null,['class' => 'form-control show-tick ms select2']); ?>

                            <?php endif; ?>
                            <?php if($errors->has('idClass')): ?>
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong><?php echo e($errors->first('idClass')); ?></strong>
                            </label>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-4 form-control-label">
                        <label for="classname">Section</label>
                    </div>
                    <div class="col-sm-7">
                        <div class="form-group">
                            <?php if(isset($discount)): ?>
                             <select name='idSection' class="form-control show-tick ms select2">
                                <option value="<?php echo e($studentDetails->idSection); ?>"><?php echo e($studentDetails->section->sectionName); ?></option>
                            </select>
                            <?php else: ?>
                            <select name='idSection' class="form-control show-tick ms select2"></select>
                            <?php endif; ?>
                            <?php if($errors->has('idSection')): ?>
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong><?php echo e($errors->first('idSection')); ?></strong>
                            </label>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-4 form-control-label">
                        <label for="classname">Enrollement No</label>
                    </div>
                    <div class="col-sm-7">
                        <div class="form-group">
                             <?php if(isset($discount)): ?>
                             <select name='idStudent' class="form-control show-tick ms select2">
                                <option value="<?php echo e($studentDetails->idStudent); ?>"><?php echo e($studentDetails->ecNo); ?></option>
                            </select>
                            <?php else: ?>
                            <select name='idStudent' class="form-control show-tick ms select2"></select>
                            <?php endif; ?>
                            <?php if($errors->has('idStudent')): ?>
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong><?php echo e($errors->first('idStudent')); ?></strong>
                            </label>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                     <div class="col-sm-4 form-control-label">
                        <label for="classname">Feeheader</label>
                    </div>
                    <div class="col-sm-7">
                        <div class="form-group">
                             <?php if(isset($discount)): ?>
                             <select name='idFeehead' class="form-control show-tick ms">
                                <option value="<?php echo e($feehead->idFeehead); ?>"><?php echo e($feehead->feeheadName); ?></option>
                            </select>
                            <?php else: ?>
                            <select name='idFeehead' class="form-control show-tick ms"></select>
                            <?php endif; ?>
                            <?php if($errors->has('idFeehead')): ?>
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong><?php echo e($errors->first('idFeehead')); ?></strong>
                            </label>
                            <?php endif; ?>
                            <span id="feeheadamtdata">
                                <?php if(isset($discount)): ?>
                                <input type="hidden" id="hiddenamt" value="<?php echo e($feehead->amount); ?>">
                                 <?php endif; ?>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-4 form-control-label">
                        <label for="classname">Discount</label>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                            <?php if(isset($discount)): ?>
                            <?php echo Form::text('percentage',$discount->percentage,['class' => 'form-control','id'=>'hiddenper','placeholder'=>'Percentage','onkeyup'=>'calculateAmt()']); ?>

                            <?php else: ?>
                            <?php echo Form::text('percentage',null,['class' => 'form-control','id'=>'hiddenper','placeholder'=>'Percentage','onkeyup'=>'calculateAmt()']); ?>

                            <?php endif; ?>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="form-group">
                         <?php echo Form::text('amount',null,['class' => 'form-control','placeholder'=>'Amount','id'=>'amountf']); ?>

                        </div>
                           <?php if($errors->has('amount')): ?>
                            <label id="minmaxlength-error" class="error" for="minmaxlength">
                                <strong><?php echo e($errors->first('amount')); ?></strong>
                            </label>
                            <?php endif; ?>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-4 form-control-label">
                        <label for="classname">Remarks</label>
                    </div>
                    <div class="col-sm-8">
                        <div class="form-group">
                            <?php echo Form::textarea('remarks',null,['class' => 'form-control','size'=>'30x2']); ?>

                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-8 offset-sm-2">
                        <?php echo Form::submit('SAVE',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>

                        <?php echo Form::close(); ?> 
                    </div>
                </div>
           
            </div>
        </div>
    </div>

    <div class="col-sm-7">
        <div class="card">
            <div class="header">
                <h2><strong>Student Discounts</strong></h2>
            </div>
            <div class="body table-responsive">
                <?php echo Form::open(['method' => 'GET',  'action' => ['School\AssignDiscountController@index'], 'class' => 'form-horizontal']); ?>

                <div class="row clearfix">
                    <div class="col-sm-3 form-control-label">
                        <label for="classname">Financial Year</label>
                    </div>
                    <div class="col-sm-5">
                        <div class="form-group">
                           <?php echo Form::select('idFinancialYear',fys(),null,['class' => 'form-control show-tick ms']); ?>

                        </div>
                    </div>
                    <div class="col-sm-2">
                        <?php echo Form::submit('Search',['class' => 'btn btn-raised btn-primary btn-round waves-effect']); ?>

                    </div>
                </div>
                <?php echo Form::close(); ?> 
                <br>
                <table class="table table-bordered table-striped table-hover js-basic-example dataTable">
                    <thead>
                        <tr>
                            <th>S. No.</th>
                            <th>Class</th>
                            <th>Section</th>
                            <th>EC No.</th>
                            <th>Name</th>
                            <th>Discount Header</th>
                            <th>Amount</th>
                            <th>Percentage</th>
                            <th>Assigned Date</th>
                            <th>Remarks</th>
                            <th>Status</th>
                            <th>Action</th>
                            <th>Created By</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 1; ?>
                        <?php $__currentLoopData = $stddiscounts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <tr>
                            <th scope="row"><?php echo e($i); ?></th>
                            <td><?php echo e($value->student->classM->className); ?></td>
                            <td><?php echo e($value->student->section->sectionName); ?></td>
                            <td><?php echo e($value->student->ecNo); ?></td>
                            <td><?php echo e($value->student->firstName); ?> <?php echo e($value->student->middleName); ?> <?php echo e($value->student->lastName); ?></td>
                            <?php if(isset($value->feehead)): ?>
                            <td><?php echo e($value->feehead->feeheadName); ?></td>
                            <?php else: ?> <td></td>
                            <?php endif; ?>
                            <td><?php echo e($value->amount); ?></td>
                            <td><?php echo e($value->percentage); ?></td>
                            <td><?php echo e($value->created_at->format('d-m-Y')); ?></td>
                            <td><?php echo e($value->remarks); ?></td>
                            <td>
                                <?php if($value->isActive == 'N'): ?>
                                <a class="btn btn-success btn-sm" href="<?php echo e(url('/school/assigndiscount/'.$value->idStdDiscount.'/activate')); ?>">Activate</a>
                                <?php else: ?>
                                <a class="btn btn-warning btn-sm" href="<?php echo e(url('/school/assigndiscount/'.$value->idStdDiscount.'/deactivate')); ?>">Deactivate</a>
                                <?php endif; ?>
                            </td>
                            <td>
                                 <a class="btn btn-primary btn-sm" href="<?php echo e(url('/school/assigndiscount/'.$value->idStdDiscount.'/edit')); ?>">Edit</a>
                                 <button class="btn btn-danger btn-sm js-sweetalert" data-id="<?php echo e($value->idStdDiscount); ?>" data-type="confirm">DELETE</button>
                            
                            </td>
                            <?php if(isset($value->collector)): ?>
                            <td><?php echo e($value->collector); ?></td>
                            <?php else: ?>
                            <td></td>
                            <?php endif; ?>
                        </tr>
                        <?php $i++; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script>
$(document).ready(function() {
        $('select[name="idClass"]').on('change', function() {
            var classID = $(this).val();
            if(classID) {
                $.ajax({
                    url: "<?php echo e(url('/school/class')); ?>"+'/' +classID + "/sections",
                    type: "GET",
                    dataType: "json",
                    success:function(data) {
                        $('select[name="idSection"]').empty();
                        $('select[name="idSection"]').append('<option value="">--- Select ---</option>');
                        $.each(data, function(key, value) {
                            $('select[name="idSection"]').append('<option value="'+ key +'">'+ value +'</option>');
                        });
                    }
                });
            }else{
                $('select[name="idSection"]').empty();
            }
        });
        $('select[name="idSection"]').on('change', function() {
            var sectionID = $(this).val();
            if(sectionID) {
                $.ajax({
                    url: "<?php echo e(url('/school/section')); ?>"+'/' +sectionID + "/students",
                    type: "GET",
                    dataType: "json",
                    success:function(data) {
                        $('select[name="idStudent"]').empty();
                        $('select[name="idStudent"]').append('<option value="">--- Select ---</option>');
                        $.each(data, function(key, value) {
                            $('select[name="idStudent"]').append('<option value="'+ key +'">'+ value +'</option>');
                        });
                    }
                });
            }else{
                $('select[name="idSection"]').empty();
            }
        });
        $('select[name="idSection"]').on('change', function() {
            var sectionID = $(this).val();
            if(sectionID) {
                $.ajax({
                    url: "<?php echo e(url('/school/section')); ?>"+'/' +sectionID + "/feeheads",
                    type: "GET",
                    dataType: "json",
                    success:function(data) {
                        $('select[name="idFeehead"]').empty();
                        $('select[name="idFeehead"]').append('<option value="">--- Select ---</option>');
                        $.each(data, function(key, value) {
                            $('select[name="idFeehead"]').append('<option value="'+ key +'">'+ value +'</option>');
                        });
                    }
                });
            }else{
                $('select[name="idSection"]').empty();
            }
        });

        <?php if(Auth::guard('school')->user()->idSchool == 128 || Auth::guard('school')->user()->idSchool == 25  || Auth::guard('school')->user()->idSchool == 140 || Auth::guard('school')->user()->idSchool == 135): ?>
        $('select[name="idStudent"]').on('change', function() {
            var sectionID = $(this).val();
            if(sectionID) {
                $.ajax({
                    url: "<?php echo e(url('/school/students')); ?>"+'/' +sectionID + "/feeheads",
                    type: "GET",
                    dataType: "json",
                    success:function(data) {
                        $('select[name="idFeehead"]').empty();
                        $('select[name="idFeehead"]').append('<option value="">--- Select ---</option>');
                        $.each(data, function(key, value) {
                            $('select[name="idFeehead"]').append('<option value="'+ key +'">'+ value +'</option>');
                        });
                    }
                });
            }
        });
        <?php endif; ?>
        $('select[name="idFeehead"]').on('change', function() {
            var feeheadID = $(this).val();
            if(feeheadID) {
                $.ajax({
                    url: "<?php echo e(url('/school/feeheads')); ?>"+'/' +feeheadID,
                    type: "GET",
                    dataType: "json",
                    success:function(data) {
                        $('#feeheadamtdata').empty();
                        $('#feeheadamtdata').append('<input type="hidden" id="hiddenamt" value="'+data['amount']+'">');
                    }
                });
            }
        });
});
function calculateAmt()
    {
        var famt = $('#hiddenamt').val();
        console.log(famt);
        var fper = $('#hiddenper').val();
        console.log(fper);
        var amountf = (famt * fper)/ 100 
                document.getElementById("amountf").value = amountf.toFixed(2);
    }
$(document).on('click', '.js-sweetalert', function (e) {
    $.ajaxSetup({
        headers: {
          'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    e.preventDefault();
    var id = $(this).data('id');
    swal({
            title: "Are you sure?",
            text: "Are You sure you want to delete this Discount!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, delete it!",
            closeOnConfirm: true
        },
        function() {
         //   console.log('here');
            $.ajax({
                type: "DELETE",
                url: "<?php echo e(url('/school/assigndiscount/')); ?>" +"/"+id,
                data: {id:id}
                       
            })
            .done(function(data) {
                swal({
                    title: "Deleted", 
                    text: "Discount has been successfully deleted", 
                    type: "success"
                },function() {
                    location.reload();
                });
            })
            .error(function(data) {
              swal("Oops", "We couldn't connect to the server!", "error");
            });
            return false;
    });
});
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('schools.school_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

Copyright © 2021 - 2025 IMMREX7