bugs fixing

This commit is contained in:
cj201199
2024-05-21 15:15:23 +05:30
parent b818767c87
commit bf6eb7bb19
4 changed files with 64 additions and 18 deletions

View File

@@ -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 {

View File

@@ -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";
}

View File

@@ -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);

View File

@@ -15,7 +15,8 @@
<div class="iv-form col-md-6 mb-3">
<p><label for="name">Name</label></p>
<p><input type="text" id="name" name="name"
onkeydown="return /[a-zA-Z]/i.test(event.key)"
{{-- onkeydown="return /[a-zA-Z]/i.test(event.key)" --}}
oninput="$(this).val($(this).val().replace(/[^A-Za-z\s]/g, ''))"
value="{{ auth()->guard('users')->user()->name }}" class="iv-input"></p>
</div>
<div class="iv-form col-md-6 mb-3">
@@ -23,14 +24,14 @@
<p class="edit-invest-profile"><input type="tel" id="contact_number" readonly
name="contact_number"
oninput="this.value = this.value.replace(/[^0-9]/g, '').replace(/(\..*)\./g, '$1');"
value="{{ auth()->guard('users')->user()->contact_number }}" class="iv-input">
value="{{ auth()->guard('users')->user()->contact_number }}" class="iv-input" minlength="10" maxlength="10">
<a class="edit-mobile"><i class="fa-solid fs-5 fa-pen-to-square"></i></a>
</p>
</div>
<div class="iv-form col-md-6 mb-3">
<p><label for="email">Email Id</label></p>
<p class="edit-invest-profile"><input type="text" id="email" name="email"
value="{{ auth()->guard('users')->user()->email }}" readonly class="iv-input">
value="{{ auth()->guard('users')->user()->email }}" pattern="[a-zA-Z0-9._%+-]+@[a-z0-9.-]+\.[a-zA-Z]{2,4}" readonly class="iv-input">
<a class="edit-email"><i class="fa-solid fs-5 fa-pen-to-square"></i></a>
</p>
</div>
@@ -76,7 +77,7 @@
</div>
<div class="modal-body">
<label for="email">New Email Id</label><br>
<input type="email" name="newEmail" id="newEmail" placeholder="Enter email">
<input type="email" name="newEmail" id="newEmail" placeholder="Enter email" pattern="[a-zA-Z0-9._%+-]+@[a-z0-9.-]+\.[a-zA-Z]{2,4}">
</div>
<div class="modal-footer justify-content-center">
<button type="button" class="cancle-btn removeEmail" data-bs-dismiss="modal">Close</button>
@@ -141,7 +142,7 @@
<div class="modal-body">
<label for="newcontact_number">New Phone Number</label>
<input type="tel" name="newcontact_number" id="newcontact_number"
placeholder="Enter phone number">
placeholder="Enter phone number" maxlength="10" minlength="10">
</div>
<div class="modal-footer justify-content-center">
<button type="button" class="cancle-btn removecontact_number"
@@ -277,6 +278,13 @@
$('#newcontact_number').val('');
})
$.validator.addMethod("customEmail", function(value, element) {
// Regular expression for email validation
return /^[^\s@]+@[^\s@]+\.[a-zA-Z]{2,}$/.test(value);
// return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value);
}, "Please enter a valid email address");
// open modal and enter email to send otp
$('#update_only_email').validate({
ignore: [],
@@ -284,11 +292,13 @@
rules: {
newEmail: {
email: true,
required: true
required: true,
customEmail: true,
},
},
messages: {
newEmail: 'Please enter valid email address',
// newEmail: 'Please enter valid email address',
required: 'Enter your email'
},
submitHandler: function(form) {
var formData = new FormData(form);
@@ -331,7 +341,7 @@
},
},
messages: {
email_otp: 'Please enter OTP',
email_otp: 'Please enter 4 digit OTP',
},
submitHandler: function(form) {
var formData = new FormData(form);
@@ -411,7 +421,7 @@
},
},
messages: {
mobile_otp: 'Please enter OTP',
mobile_otp: 'Please enter 4 digit OTP',
},
submitHandler: function(form) {
var formData = new FormData(form);