diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php
index ee88f6f..e2ca913 100644
--- a/app/Http/Controllers/Admin/DashboardController.php
+++ b/app/Http/Controllers/Admin/DashboardController.php
@@ -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,
diff --git a/app/Http/Controllers/Admin/ManageUserProductController.php b/app/Http/Controllers/Admin/ManageUserProductController.php
index 0ab8c79..5938ec3 100644
--- a/app/Http/Controllers/Admin/ManageUserProductController.php
+++ b/app/Http/Controllers/Admin/ManageUserProductController.php
@@ -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"];
diff --git a/app/Models/MonthlyUpdateMaster.php b/app/Models/MonthlyUpdateMaster.php
index fa8a4e7..9d6de26 100644
--- a/app/Models/MonthlyUpdateMaster.php
+++ b/app/Models/MonthlyUpdateMaster.php
@@ -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');
+ }
}
diff --git a/public/assets/css/FrontendCss/style.css b/public/assets/css/FrontendCss/style.css
index eda64d0..7b10997 100644
--- a/public/assets/css/FrontendCss/style.css
+++ b/public/assets/css/FrontendCss/style.css
@@ -5869,4 +5869,8 @@ ul.notification-drop {
.notifications .item ul li {
list-style: none;
+}
+.admin-profile .dropdown {
+ display: flex;
+ align-items: center;
}
\ No newline at end of file
diff --git a/resources/views/Admin/Pages/manage_investors/manage_user_product/edit_monthly_update/alternative_investment_fund.blade.php b/resources/views/Admin/Pages/manage_investors/manage_user_product/edit_monthly_update/alternative_investment_fund.blade.php
index 8343f73..1aec578 100644
--- a/resources/views/Admin/Pages/manage_investors/manage_user_product/edit_monthly_update/alternative_investment_fund.blade.php
+++ b/resources/views/Admin/Pages/manage_investors/manage_user_product/edit_monthly_update/alternative_investment_fund.blade.php
@@ -71,7 +71,7 @@
data-bs-placement="top" title="Active and Inactive">
@@ -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);
}
},
});
diff --git a/resources/views/Admin/Pages/manage_investors/manage_user_product/edit_monthly_update/fractional_real_estate.blade.php b/resources/views/Admin/Pages/manage_investors/manage_user_product/edit_monthly_update/fractional_real_estate.blade.php
index 99aff86..5fa6d80 100644
--- a/resources/views/Admin/Pages/manage_investors/manage_user_product/edit_monthly_update/fractional_real_estate.blade.php
+++ b/resources/views/Admin/Pages/manage_investors/manage_user_product/edit_monthly_update/fractional_real_estate.blade.php
@@ -43,12 +43,20 @@
-
+ {{--