From bf6eb7bb19a7ef169c22f5c21b28f15c630dfa02 Mon Sep 17 00:00:00 2001 From: cj201199 Date: Tue, 21 May 2024 15:15:23 +0530 Subject: [PATCH] bugs fixing --- app/Exports/UserProduct.php | 32 ++++++++++++++++++- .../Admin/ManageUserProductController.php | 4 +-- .../Frontend/ProfileController.php | 18 +++++++---- .../profile/investor-profile-edit.blade.php | 28 ++++++++++------ 4 files changed, 64 insertions(+), 18 deletions(-) diff --git a/app/Exports/UserProduct.php b/app/Exports/UserProduct.php index c5e059f..3a404ac 100644 --- a/app/Exports/UserProduct.php +++ b/app/Exports/UserProduct.php @@ -3,6 +3,10 @@ namespace App\Exports; use App\Models\Admin\monthly_update_master; +use App\Models\AlternativeInvestmentFund; +use App\Models\FractionalRealEstate; +use App\Models\MonthlyUpdateMaster; +use App\Models\Product; use Maatwebsite\Excel\Concerns\Exportable; use Maatwebsite\Excel\Concerns\FromCollection; use Maatwebsite\Excel\Concerns\WithHeadings; @@ -23,7 +27,33 @@ class UserProduct implements FromCollection, WithHeadings } public function collection() { - return monthly_update_master::select('custom_id')->whereIn('categories',$this->category)->where('holding_status','Holding')->get(); + $products_detail = MonthlyUpdateMaster::with('investor')->whereIn('categories',$this->category)->where('holding_status','Holding')->get(); + $return_data = []; + $data = collect(); + $products_detail->each(function ($value) use ($data){ + // dd($value); + $return_data['name'] = $value->investor->name; + $return_data['email'] = $value->investor->email; + $return_data['custom_id'] = $value->custom_id; + $return_data['product_name'] = $value->product_name; + $return_data['product_category'] = $value->product_category; + // if(AlternativeInvestmentFund::where('id',$value->products_id)->exists()) + // { + // $aid_data = Product::with('alternativeInvestmentFund','category')->where('id',$value->products_id)->first(); + // $return_data['product_name'] = $aid_data->alternativeInvestmentFund->fund_name; + // $return_data['product_category'] = $aid_data->category->category_name; + // } + // if(FractionalRealEstate::where('id',$value->products_id)->exists()) + // { + // $aid_data = Product::with('fractional_real_estate','category')->where('id',$value->products_id)->first(); + // $return_data['product_name'] = $aid_data->fractional_real_estate->property_name_and_location; + // $return_data['product_category'] = $aid_data->category->category_name; + // } + + $data->push($return_data); + }); + // dd($data); + return $data; } public function headings(): array { diff --git a/app/Http/Controllers/Admin/ManageUserProductController.php b/app/Http/Controllers/Admin/ManageUserProductController.php index a60f513..a111a36 100644 --- a/app/Http/Controllers/Admin/ManageUserProductController.php +++ b/app/Http/Controllers/Admin/ManageUserProductController.php @@ -1244,11 +1244,11 @@ class ManageUserProductController extends Controller $excel_name = "Indian_Financial_Assets.XLSX"; } elseif ($categories == 'Alternative Investment Fund') { $category = ["Alternative Investment Fund"]; - $columns = ['Custom ID', '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', 'Current NAV', 'No of Units held']; $excel_name = "Alternative_Investment_Fund.XLSX"; } elseif ($categories == 'Fractional Real Estate') { $category = ["Fractional Real Estate"]; - $columns = ['Custom ID', 'Total value of the Property', 'Investment Value', 'Investment Date', 'Total Gross Interest', 'TDS', 'Total Net Interest', 'Gross Entry Yield (%)', 'Target Return', 'Absolute Return till Date ', 'Absolute Return till date (%)']; + $columns = ['Name','Email','Custom ID','Product Name','Product Category', 'Total value of the Property', 'Investment Value', 'Investment Date', 'Total Gross Interest', 'TDS', 'Total Net Interest', 'Gross Entry Yield (%)', 'Target Return', 'Absolute Return till Date ', 'Absolute Return till date (%)']; $excel_name = "Fractional_Real_Estate.XLSX"; } diff --git a/app/Http/Controllers/Frontend/ProfileController.php b/app/Http/Controllers/Frontend/ProfileController.php index 2068f3a..e7263bc 100644 --- a/app/Http/Controllers/Frontend/ProfileController.php +++ b/app/Http/Controllers/Frontend/ProfileController.php @@ -363,8 +363,8 @@ class ProfileController extends Controller $validator = validator::make($request->all(), [ 'newEmail' => 'required|unique:users,email,' . Auth::guard('users')->user()->id . '', ], [ - 'required' => 'The :attribute field must be required', - 'unique' => 'The :attribute field must be unique', + 'required' => 'The attribute field must be required', + 'unique' => 'Email must be unique', ]); $validationMessage = $this->validationError($validator); @@ -392,8 +392,8 @@ class ProfileController extends Controller $validator = validator::make($request->all(), [ 'newEmail' => 'required|unique:users,email', ], [ - 'required' => 'The :attribute field must be required', - 'unique' => 'The :attribute field must be unique', + 'required' => 'The attribute field must be required', + 'unique' => 'The attribute field must be unique', ]); $validationMessage = $this->validationError($validator); if ($validationMessage) { @@ -436,9 +436,15 @@ class ProfileController extends Controller $validator = validator::make($request->all(), [ 'newcontact_number' => 'required|unique:users,contact_number,' . Auth::guard('users')->user()->id . '', ], [ - 'required' => 'The :attribute field must be required', - 'unique' => 'The :attribute field must be unique', + 'required' => 'The attribute field must be required', + 'unique' => 'Phone number must be unique', ]); + + $validationMessage = $this->validationError($validator); + if ($validationMessage) { + return response()->json(['status' => 400, 'message' => $validationMessage]); + } + $otp = rand(1000, 9999); Session::put('contact_number', $request->newcontact_number); Session::put('mobile_otp', $otp); diff --git a/resources/views/Frontend/Pages/profile/investor-profile-edit.blade.php b/resources/views/Frontend/Pages/profile/investor-profile-edit.blade.php index db95b38..d767201 100644 --- a/resources/views/Frontend/Pages/profile/investor-profile-edit.blade.php +++ b/resources/views/Frontend/Pages/profile/investor-profile-edit.blade.php @@ -15,7 +15,8 @@

@@ -23,14 +24,14 @@

+ value="{{ auth()->guard('users')->user()->contact_number }}" class="iv-input" minlength="10" maxlength="10">

+ value="{{ auth()->guard('users')->user()->email }}" pattern="[a-zA-Z0-9._%+-]+@[a-z0-9.-]+\.[a-zA-Z]{2,4}" readonly class="iv-input">

@@ -76,7 +77,7 @@