@extends('layouts.app') @section('content') @php $emiAmount = App\Helpers\CommonHelper::amountConversion(@$projectDetails->emi_amount); $investmentAmount = App\Helpers\CommonHelper::amountConversion(@$projectDetails->investment_amount); $gladCommissionAmount = App\Helpers\CommonHelper::amountConversion(@$projectDetails->glad_commision_amount); $ddeCommissionAmount = App\Helpers\CommonHelper::amountConversion(@$projectDetails->dde_commision_amount); $income = @$projectDetails->glad_commision_amount - @$projectDetails->dde_commision_amount; $income = App\Helpers\CommonHelper::amountConversion($income); $revenuePerYear = App\Helpers\CommonHelper::amountConversion(@$projectDetails->revenue_per_year); $totalLoanAmount = App\Helpers\CommonHelper::amountConversion(@$totalLoanAmount); $loanAmount = App\Helpers\CommonHelper::amountConversion(@$projectDetails->loan_amount); $totalEmiAmount = App\Helpers\CommonHelper::amountConversion(@$totalEmi_Amount); $totalDueAmountData = App\Helpers\CommonHelper::amountConversion(@$totalDueAmount); $totalTenure = App\Helpers\CommonHelper::amountConversion(@$totalTenureAmount); if($milkSupplyForOneDays != 0 && $totalDueAmount != 0 && $totalTenureAmount != 0 && $projectDetails->milk_price != 0){ $afterEmiDeduction = round($milkSupplyForOneDays- $totalDueAmount/$totalTenureAmount/$projectDetails->milk_price/30 , 2); }else{ $afterEmiDeduction = 0; } $milkMspPrice=@$milkMsp->msp; $farmerParticipation = App\Helpers\CommonHelper::amountConversion(@$projectDetails->farmer_participation); $currentYield = App\Helpers\CommonHelper::farmerCurrentYield(@$projectDetails->farmer_id); $remainingEmiValue = App\Helpers\CommonHelper::amountConversion(@$remaining_emi_value); $target_farm_production = App\Helpers\CommonHelper::amountConversion(@$target_farm_production * 30); $supplyValue = App\Helpers\CommonHelper::amountConversion(@$projectDetails->milk_supply_6months_value); $msp = App\Helpers\CommonHelper::amountConversion(@$projectDetails->milk_price); if($projectDetails->initial_yield) { $currentYield=$projectDetails->initial_yield; }else{ $currentYield=$currentYield; } $totalProductionValueMonthly = App\Helpers\CommonHelper::amountConversion($projectDetails->milk_price ? $currentYield * $projectDetails->milking_cows * 30 * $msp : 0); $totalProductionValueAnnualy = App\Helpers\CommonHelper::amountConversion($projectDetails->milk_price ? $currentYield * $projectDetails->milking_cows * 365 * $msp : 0); $user= auth()->user(); $totalAnnualValue = $projectDetails->milk_price ? ($currentYield * $projectDetails->milk_price) * 365 : 0; $fiftyPercentOfTotalAnnualy = App\Helpers\CommonHelper::amountConversion($totalAnnualValue * 0.50); $totalAnnualRevenue=@$projectDetails->revenue_per_year; $fiftyPercentOfTotalAnnualRevenue = App\Helpers\CommonHelper::amountConversion(@$projectDetails->revenue_per_year * 0.75); $grantAmount = App\Models\FarmerProjectInvestment::where('farmer_project_id', $projectDetails->id)->where('investment_type', 'grant')->sum('amount'); $investorAmount = App\Models\FarmerProjectInvestment::where('farmer_project_id', $projectDetails->id)->where('investment_type', 'investment')->sum('amount'); $principleAmount = @$projectDetails->investment_amount - @$projectDetails->farmer_participation - $grantAmount - $investorAmount; $principleAmount = App\Helpers\CommonHelper::amountConversion(@$principleAmount); $grantAmount = App\Helpers\CommonHelper::amountConversion($grantAmount); $investorAmount = App\Helpers\CommonHelper::amountConversion($investorAmount); @endphp

{{@$projectDetails->name}} @if(@$projectDetails->reject_status == 1) Rejected @else {{str_replace("_"," ",ucwords(@$projectDetails->project_status))}} @endif

{{@$projectDetails->improvementArea->name}}

@if($isProjectPaid)
@elseif(@$projectDetails->project_status == 'active' || @$projectDetails->project_status == 'hold' || @$projectDetails->project_status == 'completed')
{{round($projectCompletionPercent,2)}}% Completed
@endif
@if((@$projectDetails->project_status == 'suggested') || (@$projectDetails->project_status == 'interested') || (@$projectDetails->project_status == 'not_interested') || (@$projectDetails->project_status == 'deferred')|| (@$projectDetails->project_status == 'doc_verified')|| (@$projectDetails->project_status == 'approved'))
@endif

{{@$projectDetails->description}}

Project Cost: UGX {{@$investmentAmount ? @$investmentAmount : 0}}

GLAD Commission: UGX {{@$gladCommissionAmount ? @$gladCommissionAmount : 0}} {{@$projectDetails->glad_commision_percentage ? @$projectDetails->glad_commision_percentage : 0}}%

DDE Commission: UGX {{@$ddeCommissionAmount ? @$ddeCommissionAmount : 0}} {{@$projectDetails->dde_commision_percentage ? @$projectDetails->dde_commision_percentage : 0}}%

{{--

Income: UGX {{$income}}

--}}
@php $permission = App\Helpers\CommonHelper::checkPermission($user, 'Farmers'); @endphp
@php $permission = App\Helpers\CommonHelper::checkPermission($user, 'DDE'); @endphp
@if($projectDetails->category == 6) @if(isset($projectDetails->liveStockCart)) @php if(isset($projectDetails->liveStockCart->seller_id)){ $userDetails = App\Models\FarmerMaster::where('user_id', $projectDetails->liveStockCart->seller_id)->first(); } @endphp @if($userDetails)
@endif @endif @endif @if($projectDetails->category != 6) @if($suppliersSurveyData) @if(!empty($suppliersSurveyData->supplier)) @php $permission = App\Helpers\CommonHelper::checkPermission($user, 'Supplier'); @endphp
@endif @endif @endif

Farmer & Farm Information

@if((@$projectDetails->project_status == 'suggested') || (@$projectDetails->project_status == 'interested') || (@$projectDetails->project_status == 'not_interested') || (@$projectDetails->project_status == 'deferred')|| (@$projectDetails->project_status == 'doc_verified') || (@$projectDetails->project_status == 'verified')) @endif Track the progress

{{$projectDetails->milking_cows ? ($currentYield * $projectDetails->milking_cows) : 0}} Ltr.

Farm Production(Daily)

{{$projectDetails->milking_cows ? ($currentYield * $projectDetails->milking_cows) * 30 : 0}} Ltr.

Monthly Production

UGX {{$totalProductionValueMonthly ?? 0}}

Total Production Value(Monthly)

UGX {{$totalProductionValueAnnualy}}

Total Production Value(Annual)

{{ round(@$milkSupplyForOneDays ,2) ?? 0}} Ltr.

Milk Delivery to MCC

@if(@$projectDetails->project_status != 'active' && @$projectDetails->project_status != 'hold' && @$projectDetails->project_status != 'completed')

{{@$milkSupplySixMonth ?? 0}} Ltr.

Milk Supplied (6 Months)

UGX {{@$milkSupplyValueSixMonth ?? 0}}

Supply Value (6 Months)

@endif

{{$projectDetails->milking_cows ? $projectDetails->milking_cows : 0}}

Milking Cows

Loan & Quotation Information

UGX {{@$investmentAmount ? @$investmentAmount : 0}}

Project Cost

@if(@$projectDetails->project_status == 'active' || @$projectDetails->project_status == 'hold' || @$projectDetails->project_status == 'completed')
@if(@$projectDetails->farmer_participation_status == 'paid') @endif @if(@$projectDetails->farmer_participation_status == 'pending') Confirm @endif
@endif

UGX {{$farmerParticipation ? $farmerParticipation: 0}}

Farmer Participation

UGX {{$grantAmount}}

Grants

UGX {{$investorAmount}}

Investor Participation

UGX {{$principleAmount}}

Glad Participation

UGX {{@$loanAmount ? @$loanAmount : 0}}

Total Repayment

UGX {{@$revenuePerYear ? @$revenuePerYear : 0}}

Annual Incremental Income

{{@$projectDetails->roi_per_year ? @$projectDetails->roi_per_year : 0}}%

Farmer's ROI

{{@$projectDetails->repayment_months}} Months

Repayment Tenure

@if(@$projectDetails->project_status == 'active' || @$projectDetails->project_status == 'hold' || @$projectDetails->project_status == 'completed')
@php $repaymentStartDate = Carbon\Carbon::parse(@$projectDetails->repayment_start_date); $repaymentStartDate = $repaymentStartDate->format('d M, Y'); @endphp

{{$repaymentStartDate ?? ''}}

Repayment start date

@endif

UGX {{@$emiAmount ? @$emiAmount : 0}}

EMI Amount

@if((@$projectDetails->project_status == 'active') || (@$projectDetails->project_status == 'hold') || (@$projectDetails->project_status == 'completed'))

{{$paidEmis / 2}}

Paid EMI

UGX {{@$remainingEmiValue ? @$remainingEmiValue : 0}}

Remaining Loan

{{@$projectDetails->initial_yield ?? 0}} Ltr.

Initial Yield

@endif

{{@$currentYield ?? 0}} Ltr.

Current Yield

{{@$projectDetails->target_yield ? @$projectDetails->target_yield : 0}} Ltr.

Target Yield

{{--

{{@$ideal_yield ? @$ideal_yield : 0}} Ltr.

Ideal Yield

UGX {{@$target_farm_production ? @$target_farm_production : 0}}

Monthly Target Production

--}}

UGX {{$msp}}

MSP

{{$projectDetails->repayment_start_days ? $projectDetails->repayment_start_days : '0'}} Days

Grace Period

@if($projectDetails->remittance_type !='')

{{@$projectDetails->remittance_type ? @$projectDetails->remittance_type : ' '}}

Remittance Type

@endif

Status Information

{{@$projectDetails->credit_ratio}}

Credit Ratio

{{$fiftyPercentOfTotalAnnualy ?? 0}}

Farm Production(50%)

{{$fiftyPercentOfTotalAnnualRevenue ?? 0}}

Annual Incremental Income(75%)

Existing Loan

{{$totalLoanAmount ?? 0}} UGX

Total Loan Amount

{{$totalEmiAmount ?? 0}} UGX

EMI Amount

{{$totalDueAmountData }} UGX

Total Due Repayment

{{$totalTenure/2}} Month

Remaining Tenure

{{$afterEmiDeduction}} Ltr

Supply (After EMI Deduction)

@if($projectDetails->category == 6)
@if(!empty($projectDetails->liveStockCart) && !empty($projectDetails->liveStockCart->liveStockCartDetails)) @foreach($projectDetails->liveStockCart->liveStockCartDetails as $cartDetails) @if($cartDetails->delivery_status == 'approved' || $cartDetails->delivery_status == 'completed')
@endif @if(@$projectDetails->project_status == 'active' || @$projectDetails->project_status == 'hold' || @$projectDetails->project_status == 'completed') @php $permission = App\Helpers\CommonHelper::checkPermission($user, 'Financials'); @endphp

Financials

Farmer
@if(@$projectDetails->loan_amount > $paidEmiValue && ($getLastFinancialData->payment_status=='paid' || $getLastFinancialData->payment_status=='partial_paid')) Tenure Extention @endif
@if(!array_key_exists('farmerLoanPaidAmount',$projectLoanAmounts))
@else
@endif

UGX {{array_key_exists('farmerLoanPaidAmount',$projectLoanAmounts) ? App\Helpers\CommonHelper::amountConversion($projectLoanAmounts['farmerLoanPaidAmount']) : 0 }}

Paid

@if(!array_key_exists('farmerLoanDueAmount',$projectLoanAmounts))
@else
@endif

UGX {{array_key_exists('farmerLoanDueAmount',$projectLoanAmounts) ? App\Helpers\CommonHelper::amountConversion($projectLoanAmounts['farmerLoanDueAmount']) : 0}}

Due

@if(!array_key_exists('farmerLoanPendingAmount',$projectLoanAmounts))
@else
@endif

UGX {{array_key_exists('farmerLoanPendingAmount',$projectLoanAmounts) ? App\Helpers\CommonHelper::amountConversion($projectLoanAmounts['farmerLoanPendingAmount']) : 0}}

Pending

Supplier
@if(!array_key_exists('supplierLoanPaidAmount',$projectLoanAmounts))
@else
@endif

UGX {{array_key_exists('supplierLoanPaidAmount',$projectLoanAmounts) ? App\Helpers\CommonHelper::amountConversion($projectLoanAmounts['supplierLoanPaidAmount']) : 0}}

Paid

@if(!array_key_exists('supplierLoanDueAmount',$projectLoanAmounts))
@else
@endif

UGX {{array_key_exists('supplierLoanDueAmount',$projectLoanAmounts) ? App\Helpers\CommonHelper::amountConversion($projectLoanAmounts['supplierLoanDueAmount']) : 0}}

Due

@if(!array_key_exists('supplierLoanPendingAmount',$projectLoanAmounts))
@else
@endif

UGX {{array_key_exists('supplierLoanPendingAmount',$projectLoanAmounts) ? App\Helpers\CommonHelper::amountConversion($projectLoanAmounts['supplierLoanPendingAmount']) : 0}}

Pending

DDE
@if(!array_key_exists('ddeLoanPaidAmount',$projectLoanAmounts))
@else
@endif

UGX {{array_key_exists('ddeLoanPaidAmount',$projectLoanAmounts) ? App\Helpers\CommonHelper::amountConversion($projectLoanAmounts['ddeLoanPaidAmount']) : 0}}

Paid

@if(!array_key_exists('ddeLoanDueAmount',$projectLoanAmounts))
@else
@endif

UGX {{array_key_exists('ddeLoanDueAmount',$projectLoanAmounts) ? App\Helpers\CommonHelper::amountConversion($projectLoanAmounts['ddeLoanDueAmount']) : 0}}

Due

@if(!array_key_exists('ddeLoanPendingAmount',$projectLoanAmounts))
@else
@endif

UGX {{array_key_exists('ddeLoanPendingAmount',$projectLoanAmounts) ? App\Helpers\CommonHelper::amountConversion($projectLoanAmounts['ddeLoanPendingAmount']) : 0}}

Pending

@endif @if($projectDetails->category != 6 && $projectDetails->category != 7)
@if((@$projectDetails->project_status == 'suggested') || (@$projectDetails->project_status == 'interested') || (@$projectDetails->project_status == 'not_interested') || (@$projectDetails->project_status == 'deferred')|| (@$projectDetails->project_status == 'doc_verified'))
@endif
@if(@$projectDetails->project_status == 'active' || @$projectDetails->project_status == 'hold' || @$projectDetails->project_status == 'completed') @foreach(@$projectDetails->farmerProjectMilestones as $milestone)
@if($milestone->milestone_status == 'approved')
@else

{{$milestone->milestone_title}}

{{$milestone->farmer_project_task_count}} tasks included in this milestone.

@php $approvedTaskCount = 0; $milestoneCompletePercent = 0; if($milestone->farmerProjectTask){ foreach($milestone->farmerProjectTask as $task){ if($task->task_status == 'approved'){ $approvedTaskCount++; } } if($approvedTaskCount > 0){ $milestoneCompletePercent = ($approvedTaskCount/$milestone->farmer_project_task_count)*100; } } @endphp
{{@$milestoneCompletePercent}}% Completed
@php $milestoneValue = App\Helpers\CommonHelper::amountConversion(@$milestone->milestone_value); @endphp
Value
UGX {{@$milestoneValue ? @$milestoneValue : 0}}
Duration
{{$milestone->milestone_duration}} days
@php $due_date = Carbon\Carbon::parse(@$milestone->milestone_due_date); $due_date = $due_date->format('d M, Y'); @endphp
Due Date
{{$due_date}}
@endif
@endforeach @else @foreach(@$projectDetails->farmerProjectMilestones as $milestone)

{{$milestone->milestone_title}}

{{$milestone->milestone_description}}

@if((@$projectDetails->project_status == 'suggested') || (@$projectDetails->project_status == 'interested') || (@$projectDetails->project_status == 'not_interested') || (@$projectDetails->project_status == 'deferred')|| (@$projectDetails->project_status == 'doc_verified'))
@endif
@php $milestoneValue = App\Helpers\CommonHelper::amountConversion(@$milestone->milestone_value); @endphp
Value
UGX {{@$milestoneValue ? @$milestoneValue : 0}}
Duration
{{$milestone->milestone_duration}} days
@endforeach @endif
@endif
@if(((strtolower(@$projectDetails->project_status) == 'verified') || (strtolower(@$projectDetails->project_status) == 'approved') || (strtolower(@$projectDetails->project_status) == 'active') || (strtolower(@$projectDetails->project_status) == 'hold') || (strtolower(@$projectDetails->project_status) == 'completed')) && $projectDetails->category != 6 && $projectDetails->category != 7)

@foreach(@$projectDetails->farmerProjectPaymentTerms as $paymentTerms) @if(($paymentTerms->payment_term != null) && ($paymentTerms->payment_percentage != null))

{{@$paymentTerms->payment_term}}

@if(@$paymentTerms->payment_term != 'Advance')
{{@$paymentTerms->farmerProjectMilestones->milestone_title}}
@endif
{{@$paymentTerms->payment_percentage}} %
@endif @endforeach
@endif @if(count(@$uploadedLoanDocuments) > 0)

@foreach(@$uploadedLoanDocuments as $loanDocuments) @if(@$loanDocuments->loan_document_file != null)
@php $createdAt = Carbon\Carbon::parse($loanDocuments->created_at); $uploadedDate = $createdAt->format('d M, y'); @endphp

{{$loanDocuments->document_name}}

{{$uploadedDate}}
Download
@foreach(@$loanDocuments->media as $attachment)
@if(strtolower(trim($attachment->mime_type)) === 'application/pdf') @else @endif
@endforeach
@endif @endforeach
@endif @php $quotation = array(); if($projectDetails->farmerProjectSurvey){ foreach($projectDetails->farmerProjectSurvey as $survey){ array_push($quotation, $survey->survey_upload_quotation); } } $allQuotationNull = array_reduce($quotation, function ($carry, $item) { return $item == null; }); @endphp @if(!$allQuotationNull)

@foreach(@$projectDetails->farmerProjectSurvey as $surveys) @if(count($surveys->media) > 0 )

Survey Quotation

Download
@foreach(@$surveys->media as $attachment)
@if(strtolower(trim($attachment->mime_type)) === 'application/pdf') @else @endif
@endforeach
@endif @endforeach
@endif
@if($projectDetails->farmerProjectKycDocument != null)
@endif @if($projectDetails->reject_status == 1)

Rejection Remarks:
{{@$projectDetails->reject_remarks}}

@endif
@if((@$projectDetails->project_status == 'doc_verified') && (@$projectDetails->category != 6))
@endif @if($projectDetails->category == 6 || $projectDetails->category == 7) @if((strtolower(@$projectDetails->project_status) == 'verified'))
@endif @endif @if((strtolower(@$projectDetails->project_status) == 'verified') && count(@$projectDetails->farmerProjectPaymentTerms) > 0)
@endif @if((@$projectDetails->project_status == 'hold'))
@endif
@endif @include('farmer.project-modal-partials.milestones-details') @include('farmer.project-modal-partials.kpis-edit') @include('farmer.project-modal-partials.project-details-edit') @include('farmer.project-modal-partials.add-milestone') @include('farmer.project-modal-partials.edit-milestone') @include('farmer.project-modal-partials.milk-supplied-pdfl') @include('farmer.project-modal-partials.edit-resource') @include('farmer.project-modal-partials.add-resource') @include('farmer.project-modal-partials.edit-payment-terms') @include('farmer.project-modal-partials.reject-modal') @include('farmer.project-modal-partials.pre-approve-kyc') @include('farmer.project-modal-partials.invite-supplier') @include('farmer.project-modal-partials.invite-supplier-thank-you') @include('farmer.project-modal-partials.loan-approval') @include('farmer.project-modal-partials.loan-approval-thank-you') @include('farmer.project-modal-partials.project-timelines') @include('farmer.project-modal-partials.project-reject') @include('farmer.project-modal-partials.project-resume') @include('farmer.project-modal-partials.project-resume-thank-you') @include('farmer.project-modal-partials.participation-confirm') @include('farmer.project-modal-partials.participation-thank-you') @include('farmer.project-modal-partials.farmer-account-statement') @include('farmer.project-modal-partials.task-uploaded-image') @include('farmer.project-modal-partials.project-rating') @include('farmer.project-modal-partials.supplier-kyc')
@include('farmer.project-modal-partials.livestock-details') @include('farmer.project-modal-partials.approve-kyc') @include('farmer.project-modal-partials.farmer-reject-kyc') @include('farmer.project-modal-partials.kyc-reject-thankyou-modal') @include('farmer.project-modal-partials.loan-settlement') @include('farmer.project-modal-partials.grant-breakup-modal') @include('farmer.project-modal-partials.investor-breakup-modal')
@include('farmer.project-modal-partials.chat-modal') @endsection @section('scripts') @include('farmer.project-js-partials.project-details-js') @include('farmer.project-js-partials.chat-js') @endsection