fixed manage seller profile product count issue
This commit is contained in:
@@ -24,15 +24,14 @@ class ManageSellerProfileController extends Controller
|
||||
->withCount(['aif', 'fre', 'op'])
|
||||
->latest()
|
||||
->get();
|
||||
dd($sellerProfile->toArray());
|
||||
return view('Admin.Pages.pre_owned_investment.manage_seller_profile', compact('sellerProfile'));
|
||||
}
|
||||
|
||||
public function sellerDetails($id)
|
||||
{
|
||||
$sellerProfile = MarketplaceSellerForm::findOrFail($id);
|
||||
$freListing = MarketplaceFractionalRealEstateSeller::where('seller_forms_id', $id)->get();
|
||||
$aifListing = MarketplaceAlternativeInvestmentFundSeller::where('seller_forms_id', $id)->get();
|
||||
$freListing = MarketplaceFractionalRealEstateSeller::where('seller_forms_id', $id)->where('current_market_value_of_the_property','!=',0)->get();
|
||||
$aifListing = MarketplaceAlternativeInvestmentFundSeller::where('seller_forms_id', $id)->where('no_of_units_you_wish_to_sell','!=',0)->get();
|
||||
$opListing = MarketplaceOtherProductsSeller::where('seller_forms_id', $id)->get();
|
||||
$id = $id;
|
||||
$productsSold = $this->productsSold($sellerProfile);
|
||||
@@ -50,7 +49,7 @@ class ManageSellerProfileController extends Controller
|
||||
$buyerArr = array();
|
||||
$buyerArr['product_name'] = $data->name_of_the_aif_fund;
|
||||
$buyerArr['buyer'] = $buyerData->name;
|
||||
$buyerArr['company'] = $data->type_of_fund;
|
||||
$buyerArr['company'] = $data->type_of_fund == '' ? 'N/A' : $data->type_of_fund ;
|
||||
$buyerArr['seller_price'] = $buyerData->total_purchase_value;
|
||||
array_push($productsSold, $buyerArr);
|
||||
}
|
||||
@@ -63,7 +62,7 @@ class ManageSellerProfileController extends Controller
|
||||
$buyerArr = array();
|
||||
$buyerArr['product_name'] = $data->property_name;
|
||||
$buyerArr['buyer'] = $buyerData->name;
|
||||
$buyerArr['company'] = $data->asset_type;
|
||||
$buyerArr['company'] = $data->asset_type == '' ? 'N/A' : $data->asset_type ;
|
||||
$buyerArr['seller_price'] = $buyerData->total_purchase_value;
|
||||
array_push($productsSold, $buyerArr);
|
||||
}
|
||||
|
||||
@@ -19,13 +19,15 @@ class MarketplaceSellerForm extends Model
|
||||
|
||||
public function aif(){
|
||||
// return $this->hasMany(MarketplaceAlternativeInvestmentFundSeller::class,'seller_forms_id')->where('listing_status', '!=','Hide')->where('status','Approved');
|
||||
return $this->hasMany(MarketplaceAlternativeInvestmentFundSeller::class,'seller_forms_id')->where('status','Approved');
|
||||
// return
|
||||
return $this->hasMany(MarketplaceAlternativeInvestmentFundSeller::class,'seller_forms_id')->where('status','Approved')->where('no_of_units_you_wish_to_sell','!=',0);
|
||||
// dd($data);
|
||||
// return $this->hasMany(MarketplaceAlternativeInvestmentFundSeller::class,'seller_forms_id');
|
||||
}
|
||||
|
||||
public function fre(){
|
||||
// return $this->hasMany(MarketplaceFractionalRealEstateSeller::class,'seller_forms_id')->where('listing_status', '!=','Hide')->where('status','Approved');
|
||||
return $this->hasMany(MarketplaceFractionalRealEstateSeller::class,'seller_forms_id')->where('status','Approved');
|
||||
return $this->hasMany(MarketplaceFractionalRealEstateSeller::class,'seller_forms_id')->where('status','Approved')->where('current_market_value_of_the_property','!=',0);
|
||||
// $data = $this->hasMany(MarketplaceFractionalRealEstateSeller::class,'seller_forms_id')->where('status','Approved');
|
||||
// dd($data);
|
||||
|
||||
|
||||
@@ -325,24 +325,30 @@ function getAllSoldProducts($sellerFormId)
|
||||
|
||||
$marketplaceAIFPRoducts = MarketplaceAlternativeInvestmentFundSeller::where('seller_forms_id', $sellerFormId)->get();
|
||||
foreach ($marketplaceAIFPRoducts as $data) {
|
||||
if (MarketplaceBuyerForm::where(['table' => 'marketplace_aif_sellers', 'status' => 'Sold', 'associated_id' => $data->id])->exists()) {
|
||||
$productsSold++;
|
||||
if($data->no_of_units_you_wish_to_sell == 0)
|
||||
{
|
||||
if (MarketplaceBuyerForm::where(['table' => 'marketplace_aif_sellers', 'status' => 'Sold', 'associated_id' => $data->id])->exists()) {
|
||||
$productsSold++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$marketplaceFREPRoducts = MarketplaceFractionalRealEstateSeller::where('seller_forms_id', $sellerFormId)->get();
|
||||
foreach ($marketplaceFREPRoducts as $data) {
|
||||
if (MarketplaceBuyerForm::where(['table' => 'marketplace_fre_sellers', 'status' => 'Sold', 'associated_id' => $data->id])->exists()) {
|
||||
$productsSold++;
|
||||
if($data->current_market_value_of_the_property == 0)
|
||||
{
|
||||
if (MarketplaceBuyerForm::where(['table' => 'marketplace_fre_sellers', 'status' => 'Sold', 'associated_id' => $data->id])->exists()) {
|
||||
$productsSold++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$marketplaceOPPRoducts = MarketplaceOtherProductsSeller::where('seller_forms_id', $sellerFormId)->get();
|
||||
foreach ($marketplaceOPPRoducts as $data) {
|
||||
if (MarketplaceBuyerForm::where(['table' => 'marketplace_op_sellers', 'status' => 'Sold', 'associated_id' => $data->id])->exists()) {
|
||||
$productsSold++;
|
||||
}
|
||||
}
|
||||
// $marketplaceOPPRoducts = MarketplaceOtherProductsSeller::where('seller_forms_id', $sellerFormId)->get();
|
||||
// foreach ($marketplaceOPPRoducts as $data) {
|
||||
// if (MarketplaceBuyerForm::where(['table' => 'marketplace_op_sellers', 'status' => 'Sold', 'associated_id' => $data->id])->exists()) {
|
||||
// $productsSold++;
|
||||
// }
|
||||
// }
|
||||
return $productsSold;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,6 +162,7 @@
|
||||
</thead>
|
||||
<tbody class="text-gray-600 fw-semibold">
|
||||
@foreach ($productsSold as $data)
|
||||
{{-- @dd($data) --}}
|
||||
<tr>
|
||||
<td>
|
||||
<div
|
||||
|
||||
@@ -120,6 +120,7 @@
|
||||
<!--end::User=-->
|
||||
<!--begin::Role=-->
|
||||
<!-- <td>4/5</td> -->
|
||||
{{-- @dd($profile); --}}
|
||||
<td>{{$profile->aif_count + $profile->fre_count + $profile->op_count}}</td>
|
||||
@php($getAllSoldProducts = getAllSoldProducts($profile->id))
|
||||
<td>{{$getAllSoldProducts}}</td>
|
||||
|
||||
Reference in New Issue
Block a user