diff --git a/app/Http/Controllers/Admin/OverviewController.php b/app/Http/Controllers/Admin/OverviewController.php index f986c66..b3b268b 100644 --- a/app/Http/Controllers/Admin/OverviewController.php +++ b/app/Http/Controllers/Admin/OverviewController.php @@ -5,7 +5,7 @@ namespace App\Http\Controllers\Admin; use Mail; use App\Models\User; use App\Models\Company; -use App\Mail\SentBuyerMail; +use App\Mail\SentBuyerMail; use Illuminate\Http\Request; use App\Notifications\UserAdmin; use App\Models\Admin\BuyerSentMail; @@ -35,25 +35,23 @@ class OverviewController extends Controller // dd($freMarketPlace); $opMarketPlace = MarketplaceOtherProductsSeller::where('status', 'Approved')->latest()->get(); $allMarketPlace = collect(); - foreach($aifMarketPlace as $data) - { + foreach ($aifMarketPlace as $data) { $data->table = 'marketplace_aif_sellers'; $allMarketPlace->push($data); } - foreach($freMarketPlace as $data) - { + foreach ($freMarketPlace as $data) { $data->table = 'marketplace_fre_sellers'; $allMarketPlace->push($data); } - + $allMarketPlace = $allMarketPlace->sortByDesc('created_at'); // dd($allMarketPlace); - return view('Admin.Pages.pre_owned_investment.pre_owned_investment', compact('aifMarketPlace', 'freMarketPlace', 'opMarketPlace', 'totalSellerProfile', 'completedTransactions', 'totalInvestmentListed','allMarketPlace')); + return view('Admin.Pages.pre_owned_investment.pre_owned_investment', compact('aifMarketPlace', 'freMarketPlace', 'opMarketPlace', 'totalSellerProfile', 'completedTransactions', 'totalInvestmentListed', 'allMarketPlace')); } public function downloadInvestment() { - + // $aifMarketPlace = MarketplaceAlternativeInvestmentFundSeller::with(['seller' => function($query){$query->select('name as SellerName','email as Email','contact_number as Contact')->get();}])->where('status', 'Approved')->latest()->select('name_of_the_aif_fund as Product','expected_sale_per_unit as ExpectedSellingPrice','listing_status as ListingStatus')->get(); $aifMarketPlace = MarketplaceAlternativeInvestmentFundSeller::with('seller')->where('status', 'Approved')->latest()->get(); $freMarketPlace = MarketplaceFractionalRealEstateSeller::with('seller')->where('status', 'Approved')->latest()->get(); @@ -62,8 +60,7 @@ class OverviewController extends Controller $allMarketPlace = collect(); $newData = []; $count = 0; - foreach($aifMarketPlace as $data) - { + foreach ($aifMarketPlace as $data) { // $data['table'] = 'marketplace_aif_sellers'; // $newData[$count]['Product'] = $data->name_of_the_aif_fund; // $newData[$count]['ExpectedSellingPrice'] = $data->expected_sale_per_unit ; @@ -84,8 +81,7 @@ class OverviewController extends Controller $allMarketPlace->push($newData); $count++; } - foreach($freMarketPlace as $data) - { + foreach ($freMarketPlace as $data) { // $newData[$count]['Product'] = $data->property_name; // $newData[$count]['ExpectedSellingPrice'] = $data->expected_selling_price ; // $newData[$count]['SellerName'] = $data->seller->name; @@ -95,7 +91,7 @@ class OverviewController extends Controller // $newData[$count]['CreatedAt'] = $data->created_at->format('F d, o'); $newData = array( "Product" => $data->property_name, - "ExpectedSellingPrice" => $data->expected_selling_price , + "ExpectedSellingPrice" => $data->expected_selling_price, "SellerName" => $data->seller->name, "Email" => $data->seller->email, "Contact" => $data->seller->contact_number, @@ -114,7 +110,7 @@ class OverviewController extends Controller public function interestedBuyers($id, $table) { - $interestedBuyers = MarketplaceBuyerForm::where(['associated_id' => $id, 'table' => $table])->orderBy('updated_at','DESC')->get(); + $interestedBuyers = MarketplaceBuyerForm::where(['associated_id' => $id, 'table' => $table])->orderBy('updated_at', 'DESC')->get(); if ($table == 'marketplace_fre_sellers') { $data = MarketplaceFractionalRealEstateSeller::with('seller')->where('id', $id)->firstOrFail(); @@ -157,8 +153,7 @@ class OverviewController extends Controller ]); // if ($changeListingStatus && $listingStatus != 'Hide') { if ($listingStatus != 'Hide') { - if( $listingStatus != 'Non-Featured') - { + if ($listingStatus != 'Non-Featured') { $user = User::find($data->users_id); $productName = $data->security_name ?? $data->property_name ?? $data->name_of_the_aif_fund; $notify['message'] = "Congratulations, Your investment($productName) has been assigned to $listingStatus section!"; @@ -193,7 +188,7 @@ class OverviewController extends Controller // $updateUnits = MarketplaceAlternativeInvestmentFundSeller::where('id',$marketPlaceId)->update([ // 'no_of_units_you_wish_to_sell' => $newUnits, // ]); - + // } // // elseif(MarketplaceFractionalRealEstateSeller::where('id',$marketPlaceId)->exists()) // // { @@ -206,7 +201,7 @@ class OverviewController extends Controller // // } // }else - + // dd($request->all()); // $userID .= '';F $product_name = ''; @@ -215,32 +210,26 @@ class OverviewController extends Controller $marketPlaceId = $getMarketplaceBuyerUnit->associated_id; $getUnits = (int)$getMarketplaceBuyerUnit->no_of_units_you_wish_to_buy ?? 0; $getBuyingPurchaseValue = (int)$getMarketplaceBuyerUnit->getAttributes()['total_purchase_value']; - if(MarketplaceAlternativeInvestmentFundSeller::where('id',$marketPlaceId)->exists() && $getMarketplaceBuyerUnit->table == 'marketplace_aif_sellers') - { - $getAIFData = MarketplaceAlternativeInvestmentFundSeller::where('id',$marketPlaceId)->first(); + if (MarketplaceAlternativeInvestmentFundSeller::where('id', $marketPlaceId)->exists() && $getMarketplaceBuyerUnit->table == 'marketplace_aif_sellers') { + $getAIFData = MarketplaceAlternativeInvestmentFundSeller::where('id', $marketPlaceId)->first(); $product_name .= $getAIFData->name_of_the_aif_fund; - if($status == 'Sold'){ + if ($status == 'Sold') { $oldUnit = (int)$getAIFData->no_of_units_you_wish_to_sell; $newUnits = $oldUnit - (int)$getUnits; - if($newUnits >= 0) - { - $updateUnits = MarketplaceAlternativeInvestmentFundSeller::where('id',$marketPlaceId)->update([ + if ($newUnits >= 0) { + $updateUnits = MarketplaceAlternativeInvestmentFundSeller::where('id', $marketPlaceId)->update([ 'no_of_units_you_wish_to_sell' => $newUnits, ]); - } - else{ - return response()->json(['status' => 400, 'message' => 'Bid units is more than seller units with '.abs($newUnits).' units']); + } else { + return response()->json(['status' => 400, 'message' => 'Bid units is more than seller units with ' . abs($newUnits) . ' units']); } } - - }else if(MarketplaceFractionalRealEstateSeller::where('id',$marketPlaceId)->exists() && $getMarketplaceBuyerUnit->table == 'marketplace_fre_sellers') - { + } else if (MarketplaceFractionalRealEstateSeller::where('id', $marketPlaceId)->exists() && $getMarketplaceBuyerUnit->table == 'marketplace_fre_sellers') { // dd('inside'); - $getFREData = MarketplaceFractionalRealEstateSeller::where('id',$marketPlaceId)->first(); + $getFREData = MarketplaceFractionalRealEstateSeller::where('id', $marketPlaceId)->first(); $product_name .= $getFREData->property_name; - if($status == 'Sold'){ - if((int)$getFREData->current_market_value_of_the_property <= 0) - { + if ($status == 'Sold') { + if ((int)$getFREData->current_market_value_of_the_property <= 0) { return response()->json(['status' => 400, 'message' => 'Product cannot be sold. because product has no value.']); } $freValue = (int)$getFREData->current_market_value_of_the_property; @@ -251,17 +240,16 @@ class OverviewController extends Controller $expectedSellingPrice = (int)$getFREData->expected_selling_price; $updateExpectedSellingPrice = $expectedSellingPrice * ($percentage / 100); // dd($percentage,$updateExpectedSellingPrice); - if($nowValue <= 0) - { - $updatePrice = MarketplaceFractionalRealEstateSeller::where('id',$marketPlaceId)->update([ + if ($nowValue <= 0) { + $updatePrice = MarketplaceFractionalRealEstateSeller::where('id', $marketPlaceId)->update([ 'current_market_value_of_the_property' => 0, 'expected_selling_price' => 0, - ]); - }else if($nowValue > 0){ - $updatePrice = MarketplaceFractionalRealEstateSeller::where('id',$marketPlaceId)->update([ + ]); + } else if ($nowValue > 0) { + $updatePrice = MarketplaceFractionalRealEstateSeller::where('id', $marketPlaceId)->update([ 'current_market_value_of_the_property' => $nowValue, 'expected_selling_price' => $updateExpectedSellingPrice, - ]); + ]); } } // else{ @@ -272,19 +260,19 @@ class OverviewController extends Controller // $productName = $data->security_name ?? $data->property_name ?? $data->name_of_the_aif_fund; $notify['message'] = "Your BID status for ($product_name) product has been changed to $status !"; $user->notify(new UserAdmin($notify)); - // dd('outside'); + // dd('outside'); // } - // $user = User::find($userID); - // // $productName = $data->security_name ?? $data->property_name ?? $data->name_of_the_aif_fund; - // $notify['message'] = "Your BID status for ($product_name) product has been changed to $status !"; - // $user->notify(new UserAdmin($notify)); + // $user = User::find($userID); + // // $productName = $data->security_name ?? $data->property_name ?? $data->name_of_the_aif_fund; + // $notify['message'] = "Your BID status for ($product_name) product has been changed to $status !"; + // $user->notify(new UserAdmin($notify)); // } // dd('hello'); $alreadySold = MarketplaceBuyerForm::where('id', $buyerId)->update([ 'status' => $status ]); - + return response()->json(['status' => 200, 'message' => 'Status Changed!']); } @@ -347,10 +335,10 @@ class OverviewController extends Controller } elseif ($table == 3) { $data = MarketplaceOtherProductsSeller::with('seller')->where('id', $id)->firstOrFail(); } - $anyOneBuyed = MarketplaceBuyerForm::where(['associated_id'=>$id,'table'=>$tableName])->exists(); + $anyOneBuyed = MarketplaceBuyerForm::where(['associated_id' => $id, 'table' => $tableName])->exists(); // dd($data); - return view('Admin.Pages.pre_owned_investment.pending_investment_view', compact('data', 'table','anyOneBuyed')); + return view('Admin.Pages.pre_owned_investment.pending_investment_view', compact('data', 'table', 'anyOneBuyed')); } public function listingStatus(Request $request) @@ -401,17 +389,15 @@ class OverviewController extends Controller // $opBuyerForm = MarketplaceOtherProductsSeller::with('seller', 'company')->join('marketplace_buyer_forms', 'marketplace_op_sellers.id', 'marketplace_buyer_forms.associated_id')->latest('marketplace_op_sellers.created_at')->get(); - $marketPlaceBuyerFrom = MarketplaceBuyerForm::where('status','Sold')->get(); + $marketPlaceBuyerFrom = MarketplaceBuyerForm::where('status', 'Sold')->get(); $newData = collect(); - foreach($marketPlaceBuyerFrom as $item){ - if($item->table == 'marketplace_fre_sellers'){ - $item['data'] = MarketplaceFractionalRealEstateSeller::with('seller.users', 'company',)->where('id',$item->associated_id)->first(); + foreach ($marketPlaceBuyerFrom as $item) { + if ($item->table == 'marketplace_fre_sellers') { + $item['data'] = MarketplaceFractionalRealEstateSeller::with('seller.users', 'company',)->where('id', $item->associated_id)->first(); $newData->push($item); // dd( $item['data']); - } - else if($item->table == 'marketplace_aif_sellers') - { - $item['data'] = MarketplaceAlternativeInvestmentFundSeller::with('seller', 'company',)->where('id',$item->associated_id)->first(); + } else if ($item->table == 'marketplace_aif_sellers') { + $item['data'] = MarketplaceAlternativeInvestmentFundSeller::with('seller', 'company',)->where('id', $item->associated_id)->first(); $newData->push($item); } } @@ -428,7 +414,7 @@ class OverviewController extends Controller $companies = Company::active()->pluck('company_name', 'id'); // dd($newData[0]); // return view('Admin.Pages.pre_owned_investment.transactions', compact('aifBuyerForm', 'freBuyerForm', 'opBuyerForm', 'companies','newData')); - return view('Admin.Pages.pre_owned_investment.transactions', compact('companies','newData')); + return view('Admin.Pages.pre_owned_investment.transactions', compact('companies', 'newData')); } // public function manage_seller_profile() @@ -499,4 +485,4 @@ class OverviewController extends Controller return response()->json(["status" => 400, 'message' => 'Transaction Cannot Be Updated!'], 400); } } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/Frontend/HomeController.php b/app/Http/Controllers/Frontend/HomeController.php index 377d726..c70a037 100644 --- a/app/Http/Controllers/Frontend/HomeController.php +++ b/app/Http/Controllers/Frontend/HomeController.php @@ -33,7 +33,7 @@ class HomeController extends Controller // dd($this->getAllTopPickProducts()['data']->toArray()); return view('Frontend.Pages.index', [ 'topPicks' => $this->getAllTopPickProducts(), - 'testimonial' => Testimonial::where('is_active',true)->get(), + 'testimonial' => Testimonial::where('is_active', true)->get(), ]); } @@ -43,15 +43,14 @@ class HomeController extends Controller session()->forget('risk_disclosure'); $checkRiskDisclosure = $request->checked_risk_disclosure == 'true' ? Session::put('risk_disclosure', 'true') : Session::put('risk_disclosure', 'false'); // dd(Session::get('risk_disclosure')); - if(Session::get('risk_disclosure') == 'true') - { - return response()->json(['status'=>200]); + if (Session::get('risk_disclosure') == 'true') { + return response()->json(['status' => 200]); } } public function getAllTopPickProducts() { - $data['data'] = Product::getAllDetails()->where('top_pick',true)->where('products.status',1)->where('categories.status',true)->get(); + $data['data'] = Product::getAllDetails()->where('top_pick', true)->where('products.status', 1)->where('categories.status', true)->get(); // dd($data['data']); // foreach($data['data'] as $row) // { @@ -234,7 +233,7 @@ class HomeController extends Controller { $user = User::find($request->user()->id); $count = $user->unreadNotifications->count(); - return response()->json(['status'=>200,'count'=>$count]); + return response()->json(['status' => 200, 'count' => $count]); } public function getAllNotificationsApi(Request $request) diff --git a/public/assets/css/FrontendCss/style.css b/public/assets/css/FrontendCss/style.css index b528bd8..f88c99f 100644 --- a/public/assets/css/FrontendCss/style.css +++ b/public/assets/css/FrontendCss/style.css @@ -6663,4 +6663,9 @@ ul#user_notification { .primary-investment .parimay-card .assets-card { min-height: 480px; margin-bottom: 30px; -} \ No newline at end of file +} +.marketplace-table a.green-btn, +.marketplace-table a.golden-btn, +.marketplace-table a.sliver-btn { + pointer-events: none; +} diff --git a/routes/api.php b/routes/api.php index a8c82b6..7d68dc5 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,5 +1,7 @@ ['auth:sanctum']], function () { Route::post('check-pin', [HomeController::class, 'checkPin']); Route::get('get-user', [AuthController::class, 'getUser']); Route::post("update-profile", [ProfileController::class, 'updateAPI']); - + Route::post("send-email-otp", [ProfileController::class, 'sendEmailOTPApi']); - Route::post("verify-user-email-or-contact-otp", [ProfileController::class, 'verifyOtpAPI']); - Route::post("resend-otp-for-email-or-contact", [ProfileController::class, 'resendOtpForProfileUpdate']); - + Route::post("verify-user-email-or-contact-otp", [ProfileController::class, 'verifyOtpAPI']); + Route::post("resend-otp-for-email-or-contact", [ProfileController::class, 'resendOtpForProfileUpdate']); + Route::post('logout', [AuthController::class, 'userLogout']); // Route::post("update-profile", [ProfileController::class, 'updateAPI']); Route::post("personal-information-kyc", [AccountsController::class, 'personalInformationKYC']); @@ -225,11 +227,11 @@ Route::group(['middleware' => ['auth:sanctum']], function () { Route::post("marketplace/other-products/seller-form", [DashboardController::class, 'marketplaceOPFormAPI']); // get Companies - Route::get('get-companies',[ManageCompaniesController::class,'getCompaniesData']); - + Route::get('get-companies', [ManageCompaniesController::class, 'getCompaniesData']); + // get chat - Route::get('get-unread-message-count',[ManageChatController::class,'getMessageCount']); - Route::get('read-user-message',[ManageChatController::class,'getAllMessage']); + Route::get('get-unread-message-count', [ManageChatController::class, 'getMessageCount']); + Route::get('read-user-message', [ManageChatController::class, 'getAllMessage']); //Marketplace Buyer Form Route::get('/buyer-form/{slug}', [MarketPlaceController::class, 'buyerFormAPI']);