Path : /var/www/html/thb_loan_system/resources/views/loan/ |
B-Con CMD Config cPanel C-Rdp D-Log Info Jump Mass Ransom Symlink vHost Zone-H |
Current File : /var/www/html/thb_loan_system/resources/views/loan/show.blade.php |
@extends('layouts.master') @section('title') {{translate('loan detail')}} @endsection @section('content') @if($loan->borrower->blacklisted==1) <div class="row"> <div class="col-sm-12"> <div class="alert bg-danger">{{translate('blacklist_notification')}}</div> </div> </div> @endif <div class="row"> <div class="col-md-12"> <div class="panel border-left-lg border-left-primary"> <div class="panel-heading"> <h6 class="panel-title">{{translate('borrower detail')}}</h6> <div class="heading-elements"> </div> </div> <div class="panel-body"> <div class="row"> <div class="col-md-2"> @if(!empty($loan->borrower->photo)) <a href="{{asset('uploads/'.$loan->borrower->photo)}}" class="fancybox"> <img class="img-thumbnail" src="{{asset('uploads/'.$loan->borrower->photo)}}" alt="user image" style="max-height: 150px"/></a> @else <img class="img-thumbnail" src="{{asset('assets/dist/img/user.png')}}" alt="user image" style="max-height: 150px"/> @endif </div> <div class="col-md-3 form-horizontal"> <div class="form-group"> <label class="control-label col-md-4"><strong>{{translate('name')}} :</strong></label> <div class="col-md-8" style="padding-top: 9px;"> <span>{{$loan->borrower->title}} {{$loan->borrower->first_name}} {{$loan->borrower->last_name}}</span> </div> </div> <div class="form-group"> <label class="control-label col-md-4"><strong>{{translate('id')}} :</strong></label> <div class="col-md-8" style="padding-top: 9px;"> <span>#{{$loan->borrower->id}}</span> </div> </div> <div class="form-group"> <label class="control-label col-md-4"><strong>{{translate('gender')}} :</strong></label> <div class="col-md-8" style="padding-top: 9px;"> @if($loan->borrower->gender=="Male") <span class="">{{translate('male')}}</span> @endif @if($loan->borrower->gender=="Female") <span class="">{{translate('female')}}</span> @endif </div> </div> </div> <div class="col-md-3 form-horizontal"> <div class="form-group"> <label class="control-label col-md-4"><strong>{{translate('age')}} :</strong></label> <div class="col-md-8" style="padding-top: 9px;"> {{--<span>{{date("Y-m-d")->diff($loan->borrower->dob)}} {{translate('year')}}</span>--}} <span>{{\Carbon\Carbon::now()->diffInYears($loan->borrower->dob)}} {{translate('year')}}</span> </div> </div> <div class="form-group"> <label class="control-label col-md-4"><strong>{{translate('phone')}} :</strong></label> <div class="col-md-8" style="padding-top: 9px;"> <span> <a href="{{url('communication/sms/create?borrower_id='.$loan->borrower->id)}}"> {{$loan->borrower->mobile}}</a></span> </div> </div> <div class="form-group"> <label class="control-label col-md-4"><strong>{{translate('email')}} :</strong></label> <div class="col-md-8" style="padding-top: 9px;"> <span> <a href="{{url('communication/email/create?borrower_id='.$loan->borrower->id)}}">{{$loan->borrower->email}}</a></span> </div> </div> </div> <div class="col-md-3 form-horizontal"> <div class="form-group"> <label class="control-label col-md-4"><strong>{{translate('business')}} :</strong></label> <div class="col-md-8" style="padding-top: 9px;"> <span>{{$loan->borrower->business_name}}</span> </div> </div> <div class="form-group"> <label class="control-label col-md-4"><strong>{{translate('address')}} :</strong></label> <div class="col-md-8" style="padding-top: 9px;"> <span>{{$loan->borrower->address}}</span> </div> </div> <div class="form-group"> <label class="control-label col-sm-4"><strong>{{translate('country')}} :</strong></label> <div class="col-sm-8" style="padding-top: 9px;"> @if($loan->borrower->country) <span>{{$loan->borrower->country->name}}</span> @endif </div> </div> </div> </div> </div> <div class="panel-footer panel-footer-condensed"><a class="heading-elements-toggle"><i class="icon-more"></i></a> <div class="heading-elements"> <span class="heading-text">{{translate('created_at')}}: <span class="text-semibold">{{$loan->borrower->created_at}}</span></span> <ul class="list-inline list-inline-condensed heading-text pull-right"> <li class="dropdown"> <a href="#" class="text-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="icon-menu7"></i> <span class="caret"></span></a> <ul class="dropdown-menu dropdown-menu-right active"> @if(Sentinel::hasAccess('loans.create')) <li class=""> <a href="{{url('loan/create?borrower_id='.$loan->borrower_id)}}">{{translate('add')}} {{translate('loan')}}</a> </li> @endif @if(Sentinel::hasAccess('borrowers.update')) <li class=""> <a href="{{url('borrower/'.$loan->borrower_id.'/edit')}}">{{translate('edit')}} {{translate('borrower')}}</a> </li> @endif </ul> </li> <li class="dropdown"> <a href="#" class="text-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">{{translate('borrower statement')}} <span class="caret"></span></a> <ul class="dropdown-menu dropdown-menu-right"> <li> <a href="{{url('loan/'.$loan->borrower_id.'/borrower_statement/print')}}" target="_blank"><i class="icon-printer"></i> {{translate('print statement')}} </a> </li> <li> <a href="{{url('loan/'.$loan->borrower_id.'/borrower_statement/pdf')}}" target="_blank"><i class="icon-file-pdf"></i> {{translate('download in pdf')}} </a> </li> <!-- <li> <a href="{{url('loan/'.$loan->borrower_id.'/borrower_statement/email')}}" ><i class="icon-envelop"></i> {{translate('email statement')}} </a> </li> --> </ul> </li> </ul> </div> </div> </div> </div> </div> <div class="row"> <div class="col-md-12"> <!-- Custom Tabs --> <div class="panel panel-white"> <div class="panel-body"> <ul class="nav nav-tabs"> @if($loan->status=="disbursed" || $loan->status=="closed" || $loan->status=="withdrawn" || $loan->status=="written_off" || $loan->status=="rescheduled" ) <li class=""><a href="#transactions" data-toggle="tab" aria-expanded="true">{{translate('transaction')}}</a></li> <li><a href="#loan_schedule" data-toggle="tab" aria-expanded="false">{{translate('loan')}} {{translate('schedule')}}</a></li> <li class=""><a href="#pending_dues" data-toggle="tab" aria-expanded="false">{{translate('summary')}}</a> </li> @endif <li class="active"><a href="#loan_terms" data-toggle="tab" aria-expanded="false"> {{translate('detail')}}</a> </li> <li class=""><a href="#loan_collateral" data-toggle="tab" aria-expanded="false">{{translate('loan collateral')}}</a> </li> <li class=""><a href="#loan_guarantors" data-toggle="tab" aria-expanded="false">{{translate('loan guarantor')}}</a> </li> <li class=""><a href="#loan_files" data-toggle="tab" aria-expanded="false">{{translate('loan file')}}</a> </li> <li class=""><a href="#loan_comments" data-toggle="tab" aria-expanded="false">{{translate('loan comment')}}</a> </li> </ul> <div class="tab-content"> @if($loan->status=="disbursed" || $loan->status=="closed" || $loan->status=="withdrawn" || $loan->status=="written_off" || $loan->status=="rescheduled" ) <!-- /.tab-pane --> <div class="tab-pane " id="transactions"> {{-- <div class="btn-group-horizontal"> @if($loan->status=="disbursed") @if(Sentinel::hasAccess('repayments.create')) <!-- <a type="button" class="btn btn-info m-10" href="{{url('loan/'.$loan->id.'/repayment/create')}}">{{translate('add')}} {{translate('repayment')}}</a> --> <a type="button" class="btn btn-info m-10" href="{{url('loan/'.$loan->id.'/pay-off/create')}}"> {{translate('add')}} {{translate('pay_off')}}</a> @endif @endif </div> --}} <div class="box box-info"> <div class="panel-body"> <div class="row"> <div class="col-sm-12"> <div class="table-responsive"> <table id="repayments-data-table" class="table table-condensed table-hover"> <thead> <tr> <th> {{translate('id')}} </th> <th> {{translate('date')}} </th> <th> {{translate('submitted on')}} </th> <th> {{translate('type')}} </th> <th> {{translate('debit')}} </th> <th> {{translate('credit')}} </th> <th> {{translate('balance')}} </th> <th> {{translate('detail')}} </th> <th class="text-center"> {{translate('action')}} </th> </tr> </thead> <tbody> <?php $balance = 0; ?> @foreach(\App\Models\LoanTransaction::where('loan_id',$loan->id)->whereIn('reversal_type',['user','none'])->get() as $key) <?php $balance = $balance + ($key->debit - $key->credit); ?> <tr> <td>{{$key->id}}</td> <td>{{$key->date}}</td> <td>{{$key->created_at}}</td> <td> @if($key->transaction_type=='disbursement') {{translate('disbursement')}} @endif @if($key->transaction_type=='pay_off') {{translate('pay_off')}} @endif @if($key->transaction_type=='specified_due_date_fee') {{translate('specified_due_date')}} {{translate('fee')}} @endif @if($key->transaction_type=='installment_fee') {{translate('installment_fee')}} @endif @if($key->transaction_type=='overdue_installment_fee') {{translate('overdue_installment_fee')}} @endif @if($key->transaction_type=='loan_rescheduling_fee') {{translate('loan_rescheduling_fee')}} @endif @if($key->transaction_type=='overdue_maturity') {{translate('overdue_maturity')}} @endif @if($key->transaction_type=='disbursement_fee') {{translate('disbursement charge')}} @endif @if($key->transaction_type=='interest') {{translate('interest applied')}} @endif @if($key->transaction_type=='repayment') {{translate('repayment')}} @endif @if($key->transaction_type=='penalty') {{translate('penalty')}} @endif @if($key->transaction_type=='interest_waiver') {{translate('interest waiver')}} @endif @if($key->transaction_type=='waiver') {{translate('waiver')}} @endif @if($key->transaction_type=='charge_waiver') {{translate('charge waiver')}} @endif @if($key->transaction_type=='write_off') {{translate('write_off')}} @endif @if($key->transaction_type=='write_off_recovery') {{translate('recovery repayment')}} @endif @if($key->reversed==1) @if($key->reversal_type=="user") <span class="text-danger"><b>({{translate('user reversed')}} )</b></span> @endif @if($key->reversal_type=="system") <span class="text-danger"><b>({{translate('system reversed')}} )</b></span> @endif @endif </td> <td class="credit">{{currency_converter($key->debit)}}</td> <td class="credit">{{currency_converter($key->credit)}}</td> <td class="credit">{{currency_converter($balance)}}</td> <td class="credit">{{$key->receipt}}</td> <td class="text-center"> <ul class="icons-list"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="icon-menu9"></i> </a> <ul class="dropdown-menu dropdown-menu-right"> <li> <a href="{{url('loan/transaction/'.$key->id.'/show')}}"><i class="fa fa-search"></i> {{ translate('view') }} </a></li> <li> @if($key->transaction_type=='repayment' && $key->reversible==1) <li> <a href="{{url('loan/transaction/'.$key->id.'/print')}}" target="_blank"><i class="icon-printer"></i> {{ translate('print') }} {{translate('receipt')}} </a></li> <li> <a href="{{url('loan/transaction/'.$key->id.'/pdf')}}" target="_blank"><i class="icon-file-pdf"></i> {{ translate('pdf') }} {{translate('receipt')}} </a></li> <li> <a href="{{url('loan/repayment/'.$key->id.'/edit')}}"><i class="fa fa-edit"></i> {{ translate('edit') }} </a></li> <li> <a href="{{url('loan/repayment/'.$key->id.'/reverse')}}" class="delete"><i class="fa fa-minus-circle"></i> {{ translate('reverse') }} </a></li> @endif @if($key->transaction_type=='penalty' && $key->reversible==1) <li> <a href="{{url('loan/transaction/'.$key->id.'/waive')}}" class="delete"><i class="fa fa-minus-circle"></i> {{ translate('waive') }} </a></li> @endif @if($key->transaction_type=='installment_fee' && $key->reversible==1) <li> <a href="{{url('loan/transaction/'.$key->id.'/waive')}}" class="delete"><i class="fa fa-minus-circle"></i> {{ translate('waive') }} </a></li> @endif @if($key->transaction_type=='specified_due_date_fee' && $key->reversible==1) <li> <a href="{{url('loan/transaction/'.$key->id.'/waive')}}" class="delete"><i class="fa fa-minus-circle"></i> {{ translate('waive') }} </a></li> @endif </ul> </li> </ul> </td> </tr> @endforeach </tbody> </table> </div> </div> </div> </div> </div> </div> <!-- /.tab-pane --> <!-- /.tab-pane --> <div class="tab-pane" id="loan_schedule"> <div class="row"> <div class="col-sm-3"> <!-- <div class="input-group-btn"> <button type="button" class="btn btn-info dropdown-toggle m-10" data-toggle="dropdown" aria-expanded="false">{{translate('loan schedule')}} <span class="fa fa-caret-down"></span></button> <ul class="dropdown-menu" role="menu"> <li> <a href="{{url('loan/'.$loan->id.'/schedule/print')}}" target="_blank">{{translate('print statement')}}</a> </li> <li> <a href="{{url('loan/'.$loan->id.'/schedule/pdf')}}" target="_blank">{{translate('download in pdf')}}</a> </li> @if(Sentinel::hasAccess('communication.create')) <li> <a href="{{url('loan/'.$loan->id.'/schedule/email')}}" >{{translate('email schedule')}}</a> </li> @endif <li> <a href="{{url('loan/'.$loan->id.'/schedule/excel')}}" target="_blank">Download in Excel</a></li> <li> <a href="{{url('loan/'.$loan->id.'/schedule/csv')}}" target="_blank">Download in CSV</a></li> </ul> </div> --> </div> <div class="col-sm-9 pull-right"> <div class="btn-group-horizontal"> <a type="button" class="btn btn-info m-10" href="{{url('loan/'.$loan->id.'/schedule/print')}}" target="_blank">{{translate('print schedule')}}</a> </div> </div> </div> <div class="box box-success"> <div class="panel-body table-responsive no-padding"> <table class="table table-bordered table-condensed table-hover"> <tbody> <tr> <th style="width: 10px"> <b>#</b> </th> <th> <b>{{translate('date')}}</b> </th> <th style="text-align:right;"> <b>{{translate('paid by')}}</b> </th> <th> <b>{{translate('description')}}</b> </th> <th style=""> <b>{{translate('principal')}}</b> </th> <th style="text-align:right;"> <b>{{translate('interest')}}</b> </th> <th style="text-align:right;"> <b>{{translate('fee')}}</b> </th> <th style="text-align:right;"> <b>{{translate('penalty')}}</b> </th> <th style="text-align:right;"> <b> {{translate('due')}}</b> </th> <th style="text-align:right;"> <b>{{translate('paid')}}</b> </th> <th style="text-align:right;"> <b> {{translate('pending due')}}</b> </th> <th style="text-align:right;"> <b> {{translate('principal balance')}}</b> </th> <th>Action</th> </tr> <?php //check for disbursement charges $disbursement_charges = \App\Models\LoanTransaction::where('loan_id', $loan->id)->where('transaction_type', 'disbursement_fee')->where('reversed', 0)->sum('debit'); ?> <tr> <td></td> <td>{{$loan->release_date}}</td> <td></td> <td>{{translate('disbursement')}}</td> <td></td> <td></td> <td style="text-align:right;" class="credit"> @if(!empty($disbursement_charges)) <b>{{currency_converter($disbursement_charges)}}</b> @endif </td> <td></td> <td style="text-align:right;" class="credit"> @if(!empty($disbursement_charges)) <b>{{currency_converter($disbursement_charges)}}</b> @endif </td> <td style="text-align:right;" class="credit"> @if(!empty($disbursement_charges)) <b>{{currency_converter($disbursement_charges)}}</b> @endif </td> <td></td> <td style="text-align:right;" class="credit"> {{currency_converter(\App\Models\LoanSchedule::where('loan_id', $loan->id)->sum('principal'))}} </td> <td> </td> </tr> <?php $timely = 0; $total_overdue = 0; $overdue_date = ""; $total_till_now = 0; $count = 1; $total_due = 0; $principal_balance = \App\Models\LoanSchedule::where('loan_id', $loan->id)->sum('principal'); $payments = \App\Helpers\GeneralHelper::loan_total_paid($loan->id); $total_paid = $payments; $next_payment = []; $next_payment_amount = ""; foreach ($loan->schedules as $schedule) { $principal_balance = $principal_balance - $schedule->principal; $total_due = $total_due + ($schedule->principal + $schedule->interest + $schedule->fees + $schedule->penalty - $schedule->interest_waived); $paid = 0; $paid_by = ''; $overdue = 0; $due = $schedule->principal + $schedule->interest + $schedule->fees + $schedule->penalty - $schedule->interest_waived; if ($payments > 0) { if ($payments > $due) { //$paid = $due; //old //$payments = $payments - $due; //old $paid = \App\Helpers\GeneralHelper::loan_paid($schedule->id); //find the corresponding paid by date $p_paid = 0; foreach (\App\Models\LoanTransaction::where('loan_id', $loan->id)->where('transaction_type', 'repayment')->where('reversed', 0)->orderBy('date', 'asc')->get() as $key) { $p_paid = $p_paid + $key->credit; if ((int)$p_paid >= (int)$total_due) { $paid_by = $key->date; if ($key->date > $schedule->due_date && date("Y-m-d") > $schedule->due_date) { $overdue = 1; $total_overdue = $total_overdue + 1; $overdue_date = ''; } break; } } } else { $paid = $payments; $payments = 0; if (date("Y-m-d") > $schedule->due_date) { $overdue = 1; $total_overdue = $total_overdue + 1; $overdue_date = $schedule->due_date; } $next_payment[$schedule->due_date] = (($schedule->principal + $schedule->interest + $schedule->fees + $schedule->penalty - $schedule->interest_waived) - $paid); } } else { if (date("Y-m-d") > $schedule->due_date) { $overdue = 1; $total_overdue = $total_overdue + 1; $overdue_date = $schedule->due_date; } $next_payment[$schedule->due_date] = (($schedule->principal + $schedule->interest + $schedule->fees + $schedule->penalty - $schedule->interest_waived)); } // $outstanding = $due - $paid; $outstanding = $due > $paid ? $due - $paid : 0; //check if the schedule has been paid in time ?> <tr class="@if($overdue==1) danger @endif @if($overdue==0 && $outstanding==0) success @endif"> <td> {{$count}} </td> <td> {{$schedule->due_date}} </td> <td style=""> @if(empty($paid_by) && $overdue==1) {{translate('overdue')}} @endif @if(!empty($paid_by) && $overdue==1) {{$paid_by}} <i class="fa fa-minus-circle" data-toggle="tooltip" title=" {{translate('late')}}"></i> @endif @if(!empty($paid_by) && $overdue==0) {{$paid_by}} <i class="fa fa-check-circle" data-toggle="tooltip" title=" {{translate('timely')}}"></i> @endif </td> <td> {{$schedule->description}} </td> <td style="text-align:right" class="credit"> {{currency_converter($schedule->principal)}} </td> <td style="text-align:right" class="credit"> @if($schedule->interest_waived>0) <s> {{currency_converter($schedule->interest_waived)}}</s> @endif @if($schedule->pay_off != null) <s> {{currency_converter($schedule->pay_off)}}</s> @endif {{currency_converter($schedule->interest)}} </td> <td style="text-align:right" class="credit"> {{currency_converter($schedule->fees)}} </td> <td style="text-align:right" class="credit"> {{currency_converter($schedule->penalty)}} </td> <td style="text-align:right; font-weight:bold" class="credit"> {{currency_converter($due)}} </td> <td style="text-align:right;" class="credit"> {{currency_converter($paid)}} </td> <td style="text-align:right;" class="credit"> {{currency_converter($outstanding)}} </td> <td style="text-align:right;" class="credit"> {{currency_converter($principal_balance)}} </td> <td class="credit"> @if($schedule->penalty>0 && !empty((int)$outstanding)) <a href="#" data-toggle="modal" data-target="#waivePenalty" class="btn btn-info btn-xs waivePenalty" style="margin: 5px 0px;" onclick="setPenaltyValue({{$schedule->penalty}}, {{$schedule->id}})"> {{translate('waive penalty')}} </a> @endif <a href="{{url('loan/'.$loan->id.'/'.$schedule->id.'/repayment/create')}}" class="btn btn-info btn-xs @if(empty((int)$outstanding) || $loan->status!='disbursed') disabled @endif">{{translate('repayment')}}</a> </td> </tr> <?php $count++; } ?> <tr> <td colspan="3"></td> <td style="font-weight:bold">{{translate('total due')}}</td> <td style="text-align:right;" class="credit"> {{currency_converter(\App\Helpers\GeneralHelper::loan_total_principal($loan->id))}} </td> <td style="text-align:right;" class="credit"> {{currency_converter(\App\Helpers\GeneralHelper::loan_total_interest($loan->id)-\App\Helpers\GeneralHelper::loan_total_interest_waived($loan->id))}} </td> <td style="text-align:right;" class="credit"> {{currency_converter(\App\Helpers\GeneralHelper::loan_total_fees($loan->id)+$disbursement_charges)}} </td> <td style="text-align:right;" class="credit"> {{currency_converter(\App\Helpers\GeneralHelper::loan_total_penalty($loan->id))}} </td> <td style="text-align:right;" class="credit"> {{currency_converter($total_due+$disbursement_charges)}} </td> <td style="text-align:right;" class="credit"> {{currency_converter($total_paid+$disbursement_charges)}} </td> <td style="text-align:right;" class="credit"> {{currency_converter(\App\Helpers\GeneralHelper::loan_total_balance($loan->id))}} </td> <td colspan="2"></td> </tr> </tbody> </table> </div> </div> </div> <div class="tab-pane" id="pending_dues"> <div class="tab_content"> <?php $loan_due_items = \App\Helpers\GeneralHelper::loan_due_items($loan->id, $loan->release_date, date("Y-m-d")); $loan_paid_items = \App\Helpers\GeneralHelper::loan_paid_items($loan->id, $loan->release_date, date("Y-m-d")); ?> <div class="row"> <div class="col-md-6"> <div class="row"> <div class="col-md-6"><h6> <b>{{translate('timely repayment')}} :</b></h6></div> <div class="col-md-6"> <?php $count = \App\Models\LoanSchedule::where('due_date', '<=', date("Y-m-d"))->where('loan_id', $loan->id)->count(); ?> @if($count>0) <h6><b>{{round(($count-$total_overdue)/$count)}}% </b></h6> @else <h6><b>0 %</b></h6> @endif </div> </div> <div class="row"> <div class="col-md-6"><h6> <b>{{translate('amount in arrears')}} :</b></h6></div> <div class="col-md-6" class="credit"> @if(($loan_due_items["principal"]+$loan_due_items["interest"]+$loan_due_items["fees"]+$loan_due_items["penalty"])>($loan_paid_items["principal"]+$loan_paid_items["interest"]+$loan_paid_items["fees"]+$loan_paid_items["penalty"])) <h6><b> <span class="text-danger">{{currency_converter(($loan_due_items["principal"]+$loan_due_items["interest"]+$loan_due_items["fees"]+$loan_due_items["penalty"])-($loan_paid_items["principal"]+$loan_paid_items["interest"]+$loan_paid_items["fees"]+$loan_paid_items["penalty"]))}}</span></b> </h6> @else <h6><b> <span class="text-danger">0.00</span></b></h6> @endif </div> </div> <div class="row"> <div class="col-md-6"><h6> <b>{{translate('day in arrears')}} :</b></h6></div> <div class="col-md-6"> @if(!empty($overdue_date)) <?php $date1 = new DateTime($overdue_date); $date2 = new DateTime(date("Y-m-d")); ?> <h6> <b><span class="text-danger">{{$date2->diff($date1)->format("%a")}}</span></b> </h6> @else <h6><b> <span class="text-danger">0</span></b></h6> @endif </div> </div> </div> <div class="col-md-6"> <div class="row"> <div class="col-md-6"><h6> <b>{{translate('last payment')}} :</b></h6></div> <div class="col-md-6"> <?php $last_payment = \App\Models\LoanTransaction::where('loan_id', $loan->id)->where('transaction_type', 'repayment')->where('reversed', 0)->orderBy('date', 'desc')->first(); ?> @if(!empty($last_payment)) <h6 class="credit"><b>{{currency_converter($last_payment->credit)}} on {{$last_payment->date}}</b></h6> @else ---- @endif </div> </div> <div class="row"> <div class="col-md-6"><h6> <b>{{translate('next payment')}} :</b></h6></div> <div class="col-md-6"> <?php $count = \App\Models\LoanSchedule::where('due_date', '<=', date("Y-m-d"))->where('loan_id', $loan->id)->count(); ?> @foreach($next_payment as $key=>$value) <?php if ($key > date("Y-m-d")) { echo ' <h6><b>' . currency_converter($value) . ' on ' . $key . '</b></h6>'; break; } ?> @endforeach </div> </div> <div class="row"> <div class="col-md-6"><h6> <b>{{translate('last payment expected')}} :</b></h6></div> <div class="col-md-6"> <h6> <b>{{\App\Models\LoanSchedule::where('loan_id', $loan->id)->orderBy('due_date','asc')->get()->last()->due_date??''}}</b> </h6> </div> </div> </div> </div> <table class="table table-bordered table-condensed"> <tbody> <tr class="bg-success"> <th width="200"> <b>{{translate('item')}} :</b> </th> <th style="text-align:right;"> <b>{{translate('principal')}}</b> </th> <th style="text-align:right;"> <b>{{translate('interest')}}</b> </th> <th style="text-align:right;"> <b>{{translate('fee')}}</b> </th> <th style="text-align:right;"> <b>{{translate('penalty')}}</b> </th> <th style="text-align:right;"> <b>{{translate('total')}}</b> </th> </tr> <tr> <td class="text-bold bg-danger"> {{translate('total due')}} </td> <td style="text-align:right" class="credit"> {{currency_converter(\App\Helpers\GeneralHelper::loan_total_principal($loan->id))}} </td> <td style="text-align:right" class="credit"> {{currency_converter(\App\Helpers\GeneralHelper::loan_total_interest($loan->id))}} </td> <td style="text-align:right" class="credit"> {{currency_converter(\App\Helpers\GeneralHelper::loan_total_fees($loan->id)+$disbursement_charges)}} </td> <td style="text-align:right" class="credit"> {{currency_converter(\App\Helpers\GeneralHelper::loan_total_penalty($loan->id))}} </td> <td style="text-align:right; font-weight:bold" class="credit"> {{currency_converter(\App\Helpers\GeneralHelper::loan_total_due_amount($loan->id)+$disbursement_charges)}} </td> </tr> <tr> <td class="text-bold bg-green"> {{translate('total paid')}} </td> <td style="text-align:right" class="credit"> {{currency_converter($loan_paid_items['principal'])}} </td> <td style="text-align:right" class="credit"> {{currency_converter($loan_paid_items['interest'])}} </td> <td style="text-align:right" class="credit"> {{currency_converter($loan_paid_items['fees']+$disbursement_charges)}} </td> <td style="text-align:right" class="credit"> {{currency_converter($loan_paid_items['penalty'])}} </td> <td style="text-align:right; font-weight:bold" class="credit"> {{currency_converter(($loan_paid_items['principal']+$loan_paid_items['interest']+$loan_paid_items['fees']+$loan_paid_items['penalty'])+$disbursement_charges)}} </td> </tr> <tr> <td class="text-bold btn-info"> {{translate('balance')}} </td> <td style="text-align:right" class="credit"> {{currency_converter((\App\Helpers\GeneralHelper::loan_total_principal($loan->id)-$loan_paid_items['principal']))}} </td> <td style="text-align:right" class="credit"> {{currency_converter((\App\Helpers\GeneralHelper::loan_total_interest($loan->id)-$loan_paid_items['interest']))}} </td> <td style="text-align:right" class="credit"> {{currency_converter((\App\Helpers\GeneralHelper::loan_total_fees($loan->id)-$loan_paid_items['fees']))}} </td> <td style="text-align:right" class="credit"> {{currency_converter((\App\Helpers\GeneralHelper::loan_total_penalty($loan->id)-$loan_paid_items['penalty']))}} </td> <td style="text-align:right; font-weight:bold" class="credit"> {{currency_converter((\App\Helpers\GeneralHelper::loan_total_due_amount($loan->id)-($loan_paid_items['principal']+$loan_paid_items['interest']+$loan_paid_items['fees']+$loan_paid_items['penalty'])))}} </td> </tr> </tbody> </table> </div> </div> <div class="modal fade" id="waiveInterest"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">*</span></button> <h4 class="modal-title">{{translate('waive interest')}}</h4> </div> {!! Form::open(array('url' => url('loan/'.$loan->id.'/waive_interest'),'method'=>'post')) !!} <div class="modal-body"> <div class="form-group"> <div class="form-line"> {!! Form::label('date',translate('date'),array('class'=>' control-label')) !!} {!! Form::text('date',date("Y-m-d"),array('class'=>'form-control date-picker','required'=>'required')) !!} </div> </div> <div class="form-group"> <div class="form-line"> {!! Form::label('amount',translate('amount'),array('class'=>' control-label')) !!} {!! Form::text('amount',\App\Helpers\GeneralHelper::loan_total_interest($loan->id)-$loan_paid_items['interest'],array('class'=>'form-control touchspin',''=>'','required'=>'required')) !!} </div> </div> <div class="form-group"> <div class="form-line"> {!! Form::label( 'notes',translate('note'),array('class'=>' control-label')) !!} {!! Form::textarea('notes',null,array('class'=>'form-control','rows'=>'3')) !!} </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-info">{{translate('save')}}</button> <button type="button" class="btn default" data-dismiss="modal">{{translate('close')}}</button> </div> {!! Form::close() !!} </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <div class="modal fade" id="waivePenalty"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">*</span></button> <h4 class="modal-title">{{translate('waive penalty')}}</h4> </div> {!! Form::open(array('url' => url('loan/schedule/'.$schedule->id.'/waive_penalty'),'method'=>'post')) !!} <div class="modal-body"> <p>Are you sure to waive penalty?</p> <div class="form-group"> <div class="form-line"> {!! Form::label('amount',translate('amount'),array('class'=>' control-label waive_penalty')) !!} {!! Form::text('amount',$schedule->penalty,array('class'=>'form-control touchspin waivePenaltyAmount',''=>'','required'=>'required')) !!} <input type="hidden" name="schedule_id" id="schedule_id" value="{{$schedule->id}}"> </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-info">{{translate('save')}}</button> <button type="button" class="btn default" data-dismiss="modal">{{translate('close')}}</button> </div> {!! Form::close() !!} </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <div class="modal fade" id="addCharge"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">*</span></button> <h4 class="modal-title">{{translate('add charge')}}</h4> </div> {!! Form::open(array('url' => url('loan/'.$loan->id.'/add_charge'),'method'=>'post')) !!} <div class="modal-body"> <?php $specified_charges = []; foreach (\App\Models\Charge::where('charge_type', 'specified_due_date')->where('active', 1)->get() as $key) { $specified_charges[$key->id] = $key->name; } ?> <div class="form-group"> {!! Form::label('charge',translate('charge'),array('class'=>' ')) !!} {!! Form::select('charge',$specified_charges,null,array('class'=>' select2','required'=>'required')) !!} </div> <div class="form-group"> {!! Form::label('date',translate('date'),array('class'=>' control-label')) !!} {!! Form::text('date',date("Y-m-d"),array('class'=>'form-control date-picker','required'=>'required')) !!} </div> <div class="form-group"> {!! Form::label('amount',translate('amount'),array('class'=>' control-label')) !!} {!! Form::text('amount',null,array('class'=>'form-control touchspin',''=>'','required'=>'required')) !!} </div> <div class="form-group"> {!! Form::label( 'notes',translate('note'),array('class'=>' control-label')) !!} {!! Form::textarea('notes',null,array('class'=>'form-control','rows'=>'3')) !!} </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-info">{{translate('save')}}</button> <button type="button" class="btn default" data-dismiss="modal">{{translate('close')}}</button> </div> {!! Form::close() !!} </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> @endif <div class="tab-pane active" id="loan_terms"> <div class="row"> <div class="col-sm-8"> @if($loan->status=='pending') <div class="col-sm-6"> @if(Sentinel::hasAccess('loans.approve')) <button type="button" class="btn btn-success m-10" data-toggle="modal" data-target="#approveLoan">{{translate('approve')}}</button> <button type="button" class="btn btn-danger m-10" data-toggle="modal" data-target="#declineLoan">{{translate('decline')}}</button> @endif </div> @endif @if($loan->status=='declined') <div class="col-sm-6"> @if(Sentinel::hasAccess('loans.approve')) <button type="button" class="btn btn-success m-10" data-toggle="modal" data-target="#approveLoan">{{translate('approve')}}</button> @endif </div> @endif @if($loan->status=='approved') <div class="col-sm-6"> @if(Sentinel::hasAccess('loans.disburse')) <button type="button" class="btn btn-success m-10" data-toggle="modal" data-target="#disburseLoan">{{translate('disburse')}}</button> <a type="button" class="btn btn-danger delete m-10" href="{{url('loan/'.$loan->id.'/unapprove')}}">{{translate('undo approval')}}</a> @endif </div> @endif @if($loan->status=='written_off') <div class="col-sm-6"> @if(Sentinel::hasAccess('loans.writeoff')) <a type="button" class="btn btn-danger delete m-10" href="{{url('loan/'.$loan->id.'/unwrite_off')}}">{{translate('undo write_off')}}</a> @endif </div> @endif @if($loan->status=='withdrawn') <div class="col-sm-6"> @if(Sentinel::hasAccess('loans.withdraw')) <a type="button" class="btn btn-danger delete m-10" href="{{url('loan/'.$loan->id.'/unwithdraw')}}">{{translate('undo withdrawal')}}</a> @endif </div> @endif @if($loan->status=='disbursed') <div class="col-sm-3"> <div class="btn-group-horizontal"> @if(Sentinel::hasAccess('loans.disburse')) <a type="button" class="btn btn-danger delete m-10" href="{{url('loan/'.$loan->id.'/undisburse')}}" >{{translate('undo disbursement')}}</a> @endif </div> </div> <div class="col-sm-3"> <div class="input-group-btn"> <button type="button" class="btn btn-info dropdown-toggle m-10" data-toggle="dropdown" aria-expanded="false">{{translate('more_action')}} <span class="fa fa-caret-down"></span></button> <ul class="dropdown-menu" role="menu"> @if(Sentinel::hasAccess('loans.writeoff')) <li> <a href="#" class="" data-toggle="modal" data-target="#writeoffLoan">{{translate('write_off loan')}}</a> </li> @endif @if(Sentinel::hasAccess('loans.reschedule')) <li> <a href="#" class="" data-toggle="modal" data-target="#rescheduleLoan">{{translate('reschedule loan')}}</a> </li> @endif <!-- @if(Sentinel::hasAccess('loans.update')) <li> <a href="#" class="" data-toggle="modal" data-target="#waiveInterest">{{translate('waive interest')}}</a> </li> @endif --> @if(Sentinel::hasAccess('loans.update')) <li> <a href="#" class="" data-toggle="modal" data-target="#addCharge">{{translate('add charge')}}</a> </li> @endif @if($loan->status=="disbursed") @if(Sentinel::hasAccess('repayments.create')) <li> <a href="{{url('loan/'.$loan->id.'/pay-off/create')}}"> {{translate('add')}} {{translate('pay_off')}} </a> </li> @endif @endif </ul> </div> </div> @endif @if($loan->status=="disbursed" || $loan->status=="closed" || $loan->status=="withdrawn" || $loan->status=="written_off" || $loan->status=="rescheduled" ) <!-- <div class="col-sm-3"> <div class="input-group-btn"> <button type="button" class="btn btn-info dropdown-toggle m-10" data-toggle="dropdown" aria-expanded="false">{{translate('loan schedule')}} <span class="fa fa-caret-down"></span></button> <ul class="dropdown-menu" role="menu"> <li> <a href="{{url('loan/'.$loan->id.'/loan_statement/print')}}" target="_blank">{{translate('print statement')}}</a> </li> <li> <a href="{{url('loan/'.$loan->id.'/loan_statement/pdf')}}" target="_blank">{{translate('download in pdf')}}</a> </li> @if(Sentinel::hasAccess('communication.create')) <li> <a href="{{url('loan/'.$loan->id.'/loan_statement/email')}}" >{{translate('email statement')}}</a> </li> @endif <li> <a href="{{url('loan/'.$loan->id.'/loan_statement/excel')}}" target="_blank">Download in Excel</a></li> <li> <a href="{{url('loan/'.$loan->id.'/loan_statement/csv')}}" target="_blank">Download in CSV</a></li> </ul> </div> </div>--> @endif <div class="col-sm-3"> <div class="input-group-btn"> <button type="button" class="btn btn-info dropdown-toggle m-10" data-toggle="dropdown" aria-expanded="false">{{translate('print_contract')}} <span class="fa fa-caret-down"></span></button> <ul class="dropdown-menu" role="menu"> <!-- <li> <a href="{{url('loan/'.$loan->id.'/contact-real-estate-mortgage/print')}}" target="_blank">{{translate('print_real_estate_mortgage_contract')}} </a> </li> --> <li> <a href="{{url('loan/'.$loan->id.'/contract-borrow-money/print')}}" target="_blank">{{translate('print_contract_borrow_money')}}</a> </li> <?php $vehicles = ["Car", "Motor", "car", "motor", "ឡាន", "ម៉ូតូ"]; ?> @if($loan->collateral->first() && in_array($loan->collateral->first()->collateral_type->name, $vehicles)) <li> <a href="{{url('loan/'.$loan->id.'/contract-motor-rental/print')}}" target="_blank">{{translate('print_motor_rental_contract')}}</a> </li> <li> <a href="{{url('loan/'.$loan->id.'/contract-buy-sell-motor/print')}}" target="_blank">{{translate('print_motor_buy_sell_contract')}}</a> </li> @endif <li> <a href="{{url('loan/'.$loan->id.'/print-collateral-receipt/print')}}" target="_blank">{{translate('print_collateral_receipt')}}</a> </li> </ul> </div> </div> </div> <div class="col-sm-4 pull-right"> <div class="btn-group-horizontal"> @if($loan->status=='pending'||$loan->status=='approved') @if(Sentinel::hasAccess('loans.update')) <a type="button" class="btn btn-info m-10" href="{{url('loan/'.$loan->id.'/edit')}}">{{translate('edit')}} {{translate('loan')}}</a> @endif @if(Sentinel::hasAccess('loans.delete')) <a type="button" class="btn btn-info m-10 deleteLoan" href="{{url('loan/'.$loan->id.'/delete')}}">{{translate('delete')}} {{translate('loan')}}</a> @endif @endif </div> </div> </div> <div class="panel-body no-padding"> <table class="table table-condensed"> <tbody> <tr> <td> <b>{{translate('loan status')}}</b> </td> <td> @if($loan->maturity_date<date("Y-m-d") && \App\Helpers\GeneralHelper::loan_total_balance($loan->id)>0) <span class="label label-danger">{{translate('past_maturity')}}</span> @else @if($loan->status=='pending') <span class="label label-warning">{{translate('pending approval')}}</span> @endif @if($loan->status=='approved') <span class="label label-info">{{translate('awaiting disbursement')}}</span> @endif @if($loan->status=='disbursed') <span class="label label-info">{{translate('active')}}</span> @endif @if($loan->status=='declined') <span class="label label-danger">{{translate('declined')}}</span> @endif @if($loan->status=='withdrawn') <span class="label label-danger">{{translate('withdrawn')}}</span> @endif @if($loan->status=='written_off') <span class="label label-danger">{{translate('written_off')}}</span> @endif @if($loan->status=='closed') <span class="label label-success">{{translate('closed')}}</span> @endif @if($loan->status=='pending_reschedule') <span class="label label-warning">{{translate('pending reschedule')}}</span> @endif @if($loan->status=='rescheduled') <span class="label label-info">{{translate('rescheduled')}}</span> @endif @endif </td> </tr> <tr> <td width="200"> <b>{{translate('loan application id')}}</b> </td> <td>{{$loan->id}}</td> </tr> <tr> <td> <b>{{translate('loan product')}}</b> </td> <td> @if(!empty($loan->loan_product)) {{$loan->loan_product->name}} @endif </td> </tr> <tr> <td colspan="2"></td> </tr> <tr> <td colspan="2" class="bg-navy disabled color-palette"> <b> {{translate('loan term')}} </b> </td> </tr> <tr> <td><b>{{translate('disbursed_by')}}</b></td> <td> @if(!empty($loan->loan_disbursed_by)) {{$loan->loan_disbursed_by->name}} @endif </td> </tr> <tr> <td> <b>{{translate('principal amount')}}</b> </td> <td class="credit">{{currency_converter($loan->principal)}}</td> </tr> <tr> <td> <b>{{translate('loan fee')}} ({{$loanChargesType}})</b> </td> <td class="credit"> <!-- if($loanChargesType=='fixed') --> {{currency_converter($loanCharges->amount??0)}} <!-- else {{$loanCharges->amount??0}} endif --> </td> </tr> <tr> <td> <b>{{translate('loan release date')}}</b> </td> <td>{{$loan->release_date}}</td> </tr> <tr> <td> <b>{{translate('loan interest method')}}</b> </td> <td> @if($loan->interest_method=='declining_balance_equal_installments') {{translate('declining_balance_equal_installments')}} @endif @if($loan->interest_method=='declining_balance_equal_principal') {{translate('declining_balance_equal_principal')}} @endif @if($loan->interest_method=='interest_only') {{translate('interest_only')}} @endif @if($loan->interest_method=='flat_rate') {{translate('flat_rate')}} @endif @if($loan->interest_method=='compound_interest') {{translate('compound_interest')}} @endif </td> </tr> <tr> <td> <b>{{translate('loan interest')}}</b> </td> <td class="credit">{{number_format($loan->interest_rate,2)}}%/{{$loan->interest_period}} </td> </tr> <tr> <td> <b>{{translate('loan pay_off')}}</b> </td> <td class="credit">{{number_format($loan->pay_off_interest_rate,2)}}% </td> </tr> <tr> <td> <b>{{translate('loan duration')}}</b> </td> <td>{{$loan->loan_duration}} {{$loan->loan_duration_type}}s </td> </tr> <tr> <td><b>{{translate('repayment_cycle')}}</b></td> <td> @if($loan->repayment_cycle=='daily') {{translate('daily')}} @endif @if($loan->repayment_cycle=='weekly') {{translate('weekly')}} @endif @if($loan->repayment_cycle=='monthly') {{translate('monthly')}} @endif @if($loan->repayment_cycle=='bi_monthly') {{translate('bi_monthly')}} @endif @if($loan->repayment_cycle=='quarterly') {{translate('quarterly')}} @endif @if($loan->repayment_cycle=='semi_annual') {{translate('semi_annually')}} @endif @if($loan->repayment_cycle=='annually') {{translate('annual')}} @endif </td> </tr> <tr> <td><b>{{translate('number')}} of {{translate('repayment')}}</b></td> <td> {{\App\Models\LoanSchedule::where('loan_id',$loan->id)->where('description',"<>", "Pay Off")->count()}} </td> </tr> <tr> <td><b>{{translate('decimal_place')}}</b></td> <td> @if($loan->decimal_places=='round_off_to_two_decimal') {{translate('round_off_to_two_decimal')}} @endif @if($loan->decimal_places=='round_off_to_integer') {{translate('round_off_to_integer')}} @endif </td> </tr> <tr> <td> <b>{{translate('first repayment date')}}</b> </td> <td>{{$loan->first_payment_date}}</td> </tr> <tr> <td colspan="2"></td> </tr> </tbody> </table> </div> </div> <div class="tab-pane" id="loan_collateral"> <div class="btn-group-horizontal"> @if(Sentinel::hasAccess('collateral.create')) <a type="button" class="btn btn-info m-10" href="{{url('collateral/'.$loan->id.'/create?return_url='.Request::url())}}">{{translate('add')}} {{translate('collateral')}}</a> @endif </div> <div class="box box-success"> <div class="table-responsive"> <table id="data-table" class="table table-striped table-condensed table-hover"> <thead> <tr> <th>{{translate('type')}}</th> <th>{{translate('name')}}</th> <th>{{translate('value')}}</th> <th>{{translate('status')}}</th> <th>{{translate('date')}}</th> <th>{{ translate('action') }}</th> </tr> </thead> <tbody> @foreach($loan->collateral as $key) <tr> <td> @if(!empty($key->collateral_type)) {{$key->collateral_type->name}} @endif </td> <td>{{ $key->name }}</td> <td>{{ $key->value }}</td> <td> @if($key->status=='deposited_into_branch') {{translate('deposited_into_branch')}} @endif @if($key->status=='collateral_with_borrower') {{translate('collateral_with_borrower')}} @endif @if($key->status=='returned_to_borrower') {{translate('returned_to_borrower')}} @endif @if($key->status=='repossession_initiated') {{translate('repossession_initiated')}} @endif @if($key->status=='repossessed') {{translate('repossessed')}} @endif @if($key->status=='sold') {{translate('sold')}} @endif @if($key->status=='lost') {{translate('lost')}} @endif </td> <td>{{ $key->date }}</td> <td> <div class="btn-group"> <button type="button" class="btn btn-info btn-xs dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> {{ translate('choose') }} <span class="caret"></span> <span class="sr-only">Toggle Dropdown</span> </button> <ul class="dropdown-menu" role="menu"> @if(Sentinel::hasAccess('collateral.view')) <li><a href="{{ url('collateral/'.$key->id.'/show') }}"><i class="fa fa-search"></i> {{ translate('view') }} </a></li> @endif @if(Sentinel::hasAccess('collateral.update')) <li><a href="{{ url('collateral/'.$key->id.'/edit') }}"><i class="fa fa-edit"></i> {{ translate('edit') }} </a></li> @endif @if(Sentinel::hasAccess('collateral.delete')) <li> <a href="{{ url('collateral/'.$key->id.'/delete') }}" class="delete"><i class="fa fa-trash"></i> {{ translate('delete') }} </a></li> @endif </ul> </div> </td> </tr> @endforeach </tbody> </table> </div> </div> </div> <div class="tab-pane" id="loan_guarantors"> <div class="btn-group-horizontal"> @if(Sentinel::hasAccess('loans.guarantor.create')) <a type="button" class="btn btn-info m-10" data-toggle="modal" data-target="#addGuarantor">{{translate('add')}} {{translate('guarantor')}}</a> @endif </div> <div class="box box-success"> <div class="table-responsive"> <table id="data-table" class="table table-bordered table-condensed table-hover"> <thead> <tr> <th>{{translate('full_name')}}</th> <th>{{translate('business')}}</th> <th>{{translate('unique')}}#</th> <th>{{translate('mobile')}}</th> <th>{{translate('email')}}</th> <th>{{ translate('action') }}</th> </tr> </thead> <tbody> @foreach($loan->guarantors as $key) @if(!empty($key->guarantor)) <tr> <td>{{ $key->guarantor->first_name }} {{ $key->guarantor->last_name }}</td> <td>{{ $key->guarantor->business_name }}</td> <td>{{ $key->guarantor->unique_number }}</td> <td>{{ $key->guarantor->mobile }}</td> <td>{{ $key->guarantor->email }}</td> <td> <div class="btn-group"> <button type="button" class="btn btn-info btn-xs dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> {{ translate('choose') }} <span class="caret"></span> <span class="sr-only">Toggle Dropdown</span> </button> <ul class="dropdown-menu dropdown-menu-right" role="menu"> @if(Sentinel::hasAccess('loans.guarantor.create')) <li> <a href="{{ url('guarantor/'.$key->guarantor->id.'/show') }}"><i class="fa fa-search"></i> {{translate('detail')}} </a></li> @endif @if(Sentinel::hasAccess('loans.guarantor.delete')) <li> <a href="{{ url('loan/guarantor/'.$key->guarantor->id.'/remove') }}" class="delete"><i class="fa fa-minus"></i> {{ translate('remove') }} </a> </li> @endif @if(Sentinel::hasAccess('loans.guarantor.update')) <li> <a href="{{ url('guarantor/'.$key->guarantor->id.'/edit') }}"><i class="fa fa-edit"></i> {{ translate('edit') }} </a> </li> @endif @if(Sentinel::hasAccess('loans.guarantor.delete')) <li> <a href="{{ url('guarantor/'.$key->guarantor->id.'/delete') }}" class="delete"><i class="fa fa-trash"></i> {{ translate('delete') }} </a> </li> @endif </ul> </div> </td> </tr> @endif @endforeach </tbody> </table> </div> </div> </div> <div class="tab-pane" id="loan_files"> <p>To add new loan files or remove existing files, pls click the <b>Loan Terms</b> tab and then <b>Edit Loan</b>.</p> <ul class="" style="font-size:12px; padding-left:10px"> @foreach(unserialize($loan->files) as $key=>$value) <li><a href="{!!asset('uploads/'.$value)!!}" target="_blank">{!! $value!!}</a></li> @endforeach </ul> </div> <div class="tab-pane" id="loan_comments"> <div class="tab_content"> <div class="btn-group-horizontal"> <a type="button" class="btn btn-info m-10" href="{{url('loan/'.$loan->id.'/loan_comment/create')}}">{{translate('add')}} {{translate('comment')}}</a> </div> <div class="panel-footer box-comments"> @foreach($loan->comments as $comment) <div class="media"> <div class="media-left"> <a href="#"><img src="assets/images/placeholder.jpg" class="img-circle img-md" alt=""></a> </div> <div class="media-body"> {!! $comment->notes !!} <div class="media-annotation mt-5"> <i class="icon-user"></i> @if(!empty(\App\Models\User::find($comment->user_id))) {{\App\Models\User::find($comment->user_id)->first_name}} {{\App\Models\User::find($comment->user_id)->last_name}} @endif <i class="icon-alarm"></i> {{$comment->created_at}} <div class="btn-group-horizontal pull-right"> <a type="button" class="btn bg-info btn-xs text-bold" href="{{url('loan/'.$loan->id.'/loan_comment/'.$comment->id.'/edit')}}">{{translate('edit')}}</a><a type="button" class="btn btn-danger btn-xs text-bold deleteComment" href="{{url('loan/'.$loan->id.'/loan_comment/'.$comment->id.'/delete')}}">{{translate('delete')}}</a> </div> </div> </div> </div> @endforeach </div> </div> </div> <!-- /.tab-pane --> </div> <!-- /.tab-content --> </div> </div> <!-- nav-tabs-custom --> </div> </div> <div class="modal fade" id="approveLoan"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">*</span></button> <h4 class="modal-title">{{translate('approve loan')}}</h4> </div> {!! Form::open(array('url' => url('loan/'.$loan->id.'/approve'),'method'=>'post')) !!} <div class="modal-body"> <div class="form-group"> <div class="form-line"> {!! Form::label('approved_date',null,array('class'=>' control-label')) !!} {!! Form::text('approved_date',date("Y-m-d"),array('class'=>'form-control date-picker','required'=>'required')) !!} </div> </div> <div class="form-group"> <div class="form-line"> {!! Form::label('approved_amount',null,array('class'=>' control-label')) !!} {!! Form::text('approved_amount',$loan->principal,array('class'=>'form-control touchspin','required'=>'required')) !!} </div> </div> <div class="form-group"> <div class="form-line"> {!! Form::label( 'Notes',null,array('class'=>' control-label')) !!} {!! Form::textarea('approved_notes','',array('class'=>'form-control','rows'=>'3')) !!} </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-info">{{translate('save')}}</button> <button type="button" class="btn default" data-dismiss="modal">{{translate('close')}}</button> </div> {!! Form::close() !!} </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <div class="modal fade" id="disburseLoan"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">*</span></button> <h4 class="modal-title">{{translate('disburse loan')}}</h4> </div> {!! Form::open(array('url' => url('loan/'.$loan->id.'/disburse'),'method'=>'post')) !!} <div class="modal-body"> <div class="form-group"> <div class="form-line"> {!! Form::label('disbursed_date',null,array('class'=>' control-label')) !!} {!! Form::text('disbursed_date',$loan->release_date,array('class'=>'form-control date-picker','required'=>'required')) !!} </div> </div> <div class="form-group"> <div class="form-line"> {!! Form::label('first_payment_date',null,array('class'=>' control-label')) !!} {!! Form::text('first_payment_date',$loan->first_payment_date,array('class'=>'form-control date-picker',''=>'','required'=>'required')) !!} </div> </div> <div class="form-group"> <div class="form-line"> {!! Form::label('loan_disbursed_by_id',"Disbursed By",array('class'=>' control-label')) !!} {!! Form::select('loan_disbursed_by_id',$loan_disbursed_by,null,array('class'=>'form-control','required'=>'required')) !!} </div> </div> <div class="form-group"> <div class="form-line"> {!! Form::label( 'Notes',null,array('class'=>' control-label')) !!} {!! Form::textarea('disbursed_notes','',array('class'=>'form-control','rows'=>'3')) !!} </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-info">{{translate('save')}}</button> <button type="button" class="btn default" data-dismiss="modal">{{translate('close')}}</button> </div> {!! Form::close() !!} </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <div class="modal fade" id="declineLoan"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">*</span></button> <h4 class="modal-title">{{translate('decline loan')}}</h4> </div> {!! Form::open(array('url' => url('loan/'.$loan->id.'/decline'),'method'=>'post')) !!} <div class="modal-body"> <div class="form-group"> <div class="form-line"> {!! Form::label('declined_date',null,array('class'=>' control-label')) !!} {!! Form::text('declined_date',date("Y-m-d"),array('class'=>'form-control date-picker','required'=>'required')) !!} </div> </div> <div class="form-group"> <div class="form-line"> {!! Form::label( 'Notes',null,array('class'=>' control-label')) !!} {!! Form::textarea('declined_notes','',array('class'=>'form-control','rows'=>'3','required'=>'required')) !!} </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-info">{{translate('save')}}</button> <button type="button" class="btn default" data-dismiss="modal">{{translate('close')}}</button> </div> {!! Form::close() !!} </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <div class="modal fade" id="writeoffLoan"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">*</span></button> <h4 class="modal-title">{{translate('write_off loan')}}</h4> </div> {!! Form::open(array('url' => url('loan/'.$loan->id.'/write_off'),'method'=>'post')) !!} <div class="modal-body"> <div class="form-group"> <div class="form-line"> {!! Form::label('written_off_date',translate('date'),array('class'=>' control-label')) !!} {!! Form::text('written_off_date',date("Y-m-d"),array('class'=>'form-control date-picker','required'=>'required')) !!} </div> </div> <div class="form-group"> <div class="form-line"> {!! Form::label( 'written_off_notes',translate('note'),array('class'=>' control-label')) !!} {!! Form::textarea('written_off_notes','',array('class'=>'form-control','rows'=>'3','required'=>'required')) !!} </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-info">{{translate('save')}}</button> <button type="button" class="btn default" data-dismiss="modal">{{translate('close')}}</button> </div> {!! Form::close() !!} </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <div class="modal fade" id="withdrawLoan"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">*</span></button> <h4 class="modal-title">{{translate('withdraw loan')}}</h4> </div> {!! Form::open(array('url' => url('loan/'.$loan->id.'/withdraw'),'method'=>'post')) !!} <div class="modal-body"> <div class="form-group"> <div class="form-line"> {!! Form::label('withdrawn_date',translate('date'),array('class'=>' control-label')) !!} {!! Form::text('withdrawn_date',date("Y-m-d"),array('class'=>'form-control date-picker','required'=>'required')) !!} </div> </div> <div class="form-group"> <div class="form-line"> {!! Form::label( 'withdrawn_notes',translate('note'),array('class'=>' control-label')) !!} {!! Form::textarea('withdrawn_notes','',array('class'=>'form-control','rows'=>'3','required'=>'required')) !!} </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-info">{{translate('save')}}</button> <button type="button" class="btn default" data-dismiss="modal">{{translate('close')}}</button> </div> {!! Form::close() !!} </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <div class="modal fade" id="withdrawSaving"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">*</span></button> <h4 class="modal-title">{{translate('withdraw saving')}}</h4> </div> {!! Form::open(array('url' =>'','method'=>'post','id'=>'withdrawSavingForm')) !!} <div class="modal-body"> <div class="form-group"> {!! Form::label('amount',translate('amount'),array('class'=>'')) !!} {!! Form::text('amount',null, array('class' => 'form-control touchspin', 'id'=>'accepted_amount','required'=>'')) !!} </div> <div class="form-group"> {!! Form::label('date',translate('date'),array('class'=>'')) !!} {!! Form::text('date',date("Y-m-d"), array('class' => 'form-control date-picker', 'placeholder'=>'','required'=>'')) !!} </div> <div class="form-group"> {!! Form::label('time',translate('time'),array('class'=>'')) !!} {!! Form::text('time',date("H:i"), array('class' => 'form-control time-picker', 'placeholder'=>'','required'=>'')) !!} </div> <div class="form-group"> {!! Form::label('notes',translate('note'),array('class'=>'')) !!} {!! Form::textarea('notes',null, array('class' => 'form-control', 'placeholder'=>'',)) !!} </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-info">{{translate('save')}}</button> <button type="button" class="btn default" data-dismiss="modal">{{translate('close')}}</button> </div> {!! Form::close() !!} </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <div class="modal fade" id="rescheduleLoan"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">*</span></button> <h4 class="modal-title">{{translate('reschedule loan')}}</h4> </div> {!! Form::open(array('url' => url('loan/'.$loan->id.'/reschedule'),'method'=>'get')) !!} <div class="modal-body"> <div class="form-group"> <div class="form-line"> {!! Form::label('type',translate('reschedule').' '.translate('on'),array('class'=>' control-label')) !!} {!! Form::select('type',['0'=>translate('outstanding_p'),'1'=>translate('outstanding_p_i'),'2'=>translate('outstanding_p_i_f'),'3'=>translate('outstanding_total')],null,array('class'=>'form-control','required'=>'required')) !!} </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-info">{{translate('save')}}</button> <button type="button" class="btn default" data-dismiss="modal">{{translate('close')}}</button> </div> {!! Form::close() !!} </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <div class="modal fade" id="addGuarantor"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">*</span></button> <h4 class="modal-title">{{translate('add guarantor')}}</h4> </div> {!! Form::open(array('url' => url('loan/'.$loan->id.'/guarantor/add'),'method'=>'post')) !!} <div class="modal-body"> <div class="form-group"> <div class="form-line"> {!! Form::label('guarantor_id',translate('guarantor'),array('class'=>' control-label')) !!} {!! Form::select('guarantor_id',$guarantors,null,array('class'=>' select2','required'=>'required','placeholder'=>'')) !!} </div> </div> </div> <div class="modal-footer"> <button type="submit" class="btn btn-info">{{translate('save')}}</button> <button type="button" class="btn default" data-dismiss="modal">{{translate('close')}}</button> </div> {!! Form::close() !!} </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> @endsection @section('footer-scripts') <script> $('#repayments-data-table').DataTable({ dom: '<"datatable-header"fl><"datatable-scroll"t><"datatable-footer"ip>', autoWidth: false, columnDefs: [{ orderable: false, width: '100px', targets: [8] }], "order": [[1, "asc"]], language: { "lengthMenu": "{{ translate('lengthMenu') }}", "zeroRecords": "{{ translate('zeroRecords') }}", "info": "{{ translate('info') }}", "infoEmpty": "{{ translate('infoEmpty') }}", "search": "{{ translate('search') }}:", "infoFiltered": "{{ translate('infoFiltered') }}", "paginate": { "first": "{{ translate('first') }}", "last": "{{ translate('last') }}", "next": "{{ translate('next') }}", "previous": "{{ translate('previous') }}" } }, drawCallback: function () { $('.delete').on('click', function (e) { e.preventDefault(); var href = $(this).attr('href'); swal({ title: 'Are you sure?', text: '', type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Ok', cancelButtonText: 'Cancel' }).then(function () { window.location = href; }) }); } }); </script> <script> $(document).ready(function () { $("body").addClass('sidebar-xs'); $('#withdrawSaving').on('shown.bs.modal', function (e) { var id = $(e.relatedTarget).data('id'); var amount = $(e.relatedTarget).data('amount'); var url = "{!! url('loan/'.$loan->id.'/guarantor') !!}/" + id + "/withdraw"; $(e.currentTarget).find("#withdrawSavingForm").attr('action', url); $(e.currentTarget).find("#accepted_amount").val(amount); }); $('.deleteLoan').on('click', function (e) { e.preventDefault(); var href = $(this).attr('href'); swal({ title: '{{translate('are_you_sure')}}', text: '{{translate('delete_loan_msg')}}', type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: '{{translate('ok')}}', cancelButtonText: '{{translate('cancel')}}' }).then(function () { window.location = href; }) }); $('.deletePayment').on('click', function (e) { e.preventDefault(); var href = $(this).attr('href'); swal({ title: '{{translate('are_you_sure')}}', text: '{{translate('delete_payment_msg')}}', type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: '{{translate('ok')}}', cancelButtonText: '{{translate('cancel')}}' }).then(function () { window.location = href; }) }); $('.deleteComment').on('click', function (e) { e.preventDefault(); var href = $(this).attr('href'); swal({ title: '{{translate('are_you_sure')}}', text: '', type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: '{{translate('ok')}}', cancelButtonText: '{{translate('cancel')}}' }).then(function () { window.location = href; }) }); }); function setPenaltyValue(value, schedule_id) { //var value = parseFloat(value).toFixed; $(".waivePenaltyAmount").val(value); $('#schedule_id').val(schedule_id); } </script> @endsection