Merge pull request #245 from Ritikeshyadav/RitikeshFreeu

Ritikesh freeu
This commit is contained in:
Ritikeshyadav
2024-06-06 17:42:38 +05:30
committed by GitHub
7 changed files with 115 additions and 38 deletions

View File

@@ -10,6 +10,8 @@ use App\Models\Category;
use Illuminate\Http\Request;
use App\Models\LeadTasksMeeting;
use App\Http\Controllers\Controller;
use App\Models\MonthlyUpdateFractionalRealEstate;
use App\Models\MonthlyUpdateAlternativeInvestmentFund;
use App\Models\MonthlyUpdateMaster;
use App\Models\MonthlyUpdateMasterCommission;
use App\Models\Product;
@@ -83,7 +85,7 @@ class DashboardController extends Controller
$tasks = LeadTasksMeeting::where('owner', auth()->user()->id)->tasks()->get();
$meetings = LeadTasksMeeting::where('host', auth()->user()->id)->meetings()->get();
$users = User::admins()->get();
// dd($leads);
// dd($totalInvestment);
return view('Admin.general-dashboard', compact('companyCount', 'a', 'leads', 'tasks', 'meetings', 'users', 'userCount', 'investingUserCount', 'totalProductCount'));
}
@@ -107,11 +109,24 @@ class DashboardController extends Controller
$intervalNet[] = $data->total_net;
}
// $total_commission = $getTotal->where('type_of_commission')->selectRaw(\DB::raw('SUM(total_investment_or_commitment_amount) as total_commission'))->first();
$monthlyUpdateMaster = MonthlyUpdateMaster::all();
$totalInvestment = 0;
foreach($monthlyUpdateMaster as $data)
{
if(MonthlyUpdateAlternativeInvestmentFund::where('custom_id',$data->custom_id)->exists())
{
$totalInvestment += (int)MonthlyUpdateAlternativeInvestmentFund::where('custom_id',$data->custom_id)->first()->getRawOriginal()['commitment_amount'];
}
if(MonthlyUpdateFractionalRealEstate::where('custom_id',$data->custom_id)->exists())
{
$totalInvestment += (int)MonthlyUpdateFractionalRealEstate::where('custom_id',$data->custom_id)->first()->getRawOriginal()['investment_value'];
}
}
$getTotal = $getTotal->selectRaw(\DB::raw('SUM(total_investment_or_commitment_amount) as total_commission, SUM(gross_commissioned_earned_inr) as total_gross, SUM(net_commission_received) as total_net'))
->first();
return response()->json([
'total_investment' => $this->IND_money_format($getTotal->total_commission),
'total_investment' => $this->IND_money_format($totalInvestment),
'gross_commission' => $this->IND_money_format($getTotal->total_gross),
'net_commission' => $this->IND_money_format($getTotal->total_net),
'days' => $splitDates,

View File

@@ -1163,22 +1163,32 @@ class ManageUserProductController extends Controller
// dd($request->all());
$status = $request->status;
$id = $request->id;
if ($status == "1") {
$update = MonthlyUpdateAlternativeInvestmentFund::where('id', $id)->update([
'status' => '0'
]);
} else {
$update = MonthlyUpdateAlternativeInvestmentFund::where('id', $id)->update([
"status" => "1"
]);
$custom_id = $request->custom_id;
$count = MonthlyUpdateAlternativeInvestmentFund::where('custom_id', $custom_id)->get()->count();
if($count > 1)
{
if ($status == "1") {
$update = MonthlyUpdateAlternativeInvestmentFund::where('id', $id)->update([
'status' => '0'
]);
} else {
$update = MonthlyUpdateAlternativeInvestmentFund::where('id', $id)->update([
"status" => "1"
]);
}
return response()->json(
[
"status" => 'success',
"code" => 200,
"message" => "Status Changed"
]
);
}
// dd($request->all());
return response()->json(
[
"status" => 'success',
"code" => 200,
"message" => "Status Changed"
"status" => 400,
"message" => "Status not changed, Atleast one should be active",
]
);
}
@@ -1201,18 +1211,21 @@ class ManageUserProductController extends Controller
}
public function updateFractionalRealEstateStatus(Request $request)
{
$data = MonthlyUpdateFractionalRealEstate::where('id', $request->id)->first();
if ($data) {
if ($request->status == '1') {
$data->status = '0';
} else {
$data->status = '1';
if(MonthlyUpdateFractionalRealEstate::where('custom_id', $request->custom_id)->get()->count() > 1)
{
$data = MonthlyUpdateFractionalRealEstate::where('id', $request->id)->first();
if ($data) {
if ($request->status == '1') {
$data->status = '0';
} else {
$data->status = '1';
}
$data->save();
}
$data->save();
return response(['status' => 200, 'message'=>'Product status changed successfully']);
}
return response(['status' => 200]);
return response(['status' => 400, 'message'=>'Status not changed, Atleast one should be active']);
}
public function updateFractionalRealEstateMonthlyUpdate(Request $request)
@@ -1391,7 +1404,7 @@ class ManageUserProductController extends Controller
$excel_name = "Indian_Financial_Assets.XLSX";
} elseif ($categories == 'Alternative Investment Fund') {
$category = ["Alternative Investment Fund"];
$columns = ['Name','Email','Custom ID','Product Name','Product Category', 'Commitment Amount', 'Contribution Amount', 'Contribution Called Amount', 'Contribution Uncalled Amount', 'Date of Initial Contribution', 'Face value/NAV per unit', 'Principal (capital) repaid', 'Gross Income', 'Total fees Paid -Set Up -Management -Operating', 'Net Income', 'No of Units alloted', 'No of Units redeemed', 'Current Valuation', 'Current NAV', 'No of Units held'];
$columns = ['Name','Email','Custom ID','Product Name','Product Category', 'Commitment Amount', 'Contribution Amount', 'Contribution Called Amount', 'Contribution Uncalled Amount', 'Date of Initial Contribution', 'Face value/NAV per unit', 'Principal (capital) repaid', 'Gross Income', 'Total fees Paid -Set Up -Management -Operating', 'Net Income', 'No of Units alloted', 'No of Units redeemed', 'Current Valuation', 'No of Units held'];
$excel_name = "Alternative_Investment_Fund.XLSX";
} elseif ($categories == 'Fractional Real Estate') {
$category = ["Fractional Real Estate"];

View File

@@ -24,4 +24,13 @@ class MonthlyUpdateMaster extends Model
{
return $this->belongsTo(Company::class, 'investment_platform');
}
public function monthlyAIF()
{
return $this->hasOne(MonthlyUpdateAlternativeInvestmentFund::class,'custom_id','custom_id');
}
public function monthlyFRE()
{
return $this->hasOne(MonthlyUpdateFractionalRealEstate::class,'custom_id','custom_id');
}
}

View File

@@ -5869,4 +5869,8 @@ ul.notification-drop {
.notifications .item ul li {
list-style: none;
}
.admin-profile .dropdown {
display: flex;
align-items: center;
}

View File

@@ -71,7 +71,7 @@
data-bs-placement="top" title="Active and Inactive">
<label
class="form-check form-switch form-switch-sm form-check-custom form-check-solid flex-stack">
<input class="form-check-input status_update" type="checkbox" data-id="{{ $data->id }}"
<input class="form-check-input status_update" type="checkbox" data-custom-id="{{$data->custom_id}}" data-id="{{ $data->id }}"
value="{{ $data->status }}" {{ $data->status == '1' ? 'checked' : '' }} />
</label>
</a>
@@ -631,6 +631,7 @@
$('.status_update').click(function() {
var status = $(this).val();
var id = $(this).data('id');
var custom_id = $(this).data('custom-id');
$.ajaxSetup({
headers: {
@@ -643,12 +644,21 @@
data: {
'status': status,
'id': id,
'custom_id': custom_id,
},
dataType: 'json',
success: function(result) {
if (result.status == "success") {
if (result.status == 200) {
toastr.success(result.message);
location.reload();
setTimeout(() => {
location.reload();
}, 2000);
}
if (result.status == 400) {
toastr.warning(result.message);
setTimeout(() => {
location.reload();
}, 4000);
}
},
});

View File

@@ -43,12 +43,20 @@
</a>
<a class="actions_icon" data-bs-toggle="tooltip" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="Active and Inactive">
{{-- <a class="actions_icon" data-bs-toggle="tooltip" data-bs-custom-class="tooltip-inverse" data-bs-placement="top" title="Active and Inactive">
<div class="on-off-toggle">
<input class="on-off-toggle__input is_status" type="checkbox" id="bopis{{$data->id}}" data-id="{{$data->id}}" value="{{$data->status}}" {{$data->status == '1' ? 'checked' : ''}} />
<input class="on-off-toggle__input is_status" type="checkbox" id="bopis{{$data->id}}" data-id="{{$data->id}}" data-custom-id="{{$data->custom_id}}" value="{{$data->status}}" {{$data->status == '1' ? 'checked' : ''}} />
<label for="bopis{{$data->id}}" class="on-off-toggle__slider"></label>
</div>
</a>
</a> --}}
<a class="update_status" data-bs-toggle="tooltip" data-bs-custom-class="tooltip-inverse"
data-bs-placement="top" title="Active and Inactive">
<label
class="form-check form-switch form-switch-sm form-check-custom form-check-solid flex-stack">
<input class="form-check-input is_status" type="checkbox" data-custom-id="{{$data->custom_id}}" data-id="{{ $data->id }}"
value="{{ $data->status }}" {{ $data->status == '1' ? 'checked' : '' }} />
</label>
</a>
</td>
<!--end::Action=-->
</tr>
@@ -326,6 +334,7 @@
$(document).on('click', '.is_status', function() {
var status = $(this).val();
var id = $(this).data('id');
var custom_id = $(this).data('custom-id');
$.ajax({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
@@ -334,7 +343,8 @@
url: "{{route('update-Fractional-RealEstat-eStatus-status')}}",
data: {
'status': status,
'id': id
'id': id,
'custom_id': custom_id,
},
success: function(data) {
// window.location.href = 'manage_blog';
@@ -343,9 +353,17 @@
"progressBar": true,
"closeButton": true,
}
toastr.success('Product status changed successfully');
// window.location.href = '/manage_blog';
location.reload();
toastr.success(data.message);
setTimeout(() => {
location.reload();
}, 2000);
}
if(data.status == 400)
{
toastr.warning(data.message);
setTimeout(() => {
location.reload();
}, 4000);
}
}
});

View File

@@ -84,9 +84,9 @@
<li><a class="dropdown-item"
href="{{ url('export-excel-user-product/' . 'Fractional Real Estate') }}">Fractional
Real Estate</a></li>
<li><a class="dropdown-item"
{{-- <li><a class="dropdown-item"
href="{{ url('export-excel-user-product/' . 'Indian Financial Assets') }}">Indian
Financial Assets</a></li>
Financial Assets</a></li> --}}
</ul>
</div>
<a class="action_icon" href="{{ route('export-user-product') }}">
@@ -893,6 +893,14 @@
// alert(Math.ceil(profitSharing));
// profitSharing = 2;
// console.log(Math.ceil(profitSharing),profitSharing);
if(status == 'Reedemed')
{
toastr.warning('Product status cannot changed')
setTimeout(() => {
window.location.reload();
}, 3000);
return;
}
if (Math.ceil(profitSharing) > 0 && status == 'Holding') {
$('#id').val(id);
$('#product_id').val(productId);