1420 lines
63 KiB
PHP
1420 lines
63 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Imports\AlternativeInvestmentFundImport;
|
|
use App\Imports\BondImport;
|
|
use App\Imports\CleanAndGreenAssetImport;
|
|
use App\Imports\FundImport;
|
|
use App\Imports\StockFundsRealEstateExchangeImport;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Maatwebsite\Excel\Facades\Excel;
|
|
use App\Imports\FractionalRealEstateImport;
|
|
use App\Imports\HighYieldFinanceImport;
|
|
use App\Imports\IndianFinancialAssetsImport;
|
|
use App\Imports\InvoiceDiscountingImport;
|
|
use App\Imports\LeaseBasedFinancingImport;
|
|
use App\Imports\RealEstateImport;
|
|
use App\Imports\PeerToPeerLendingImport;
|
|
use App\Imports\SecuritizedDebtInstrumentImport;
|
|
use App\Models\Product;
|
|
use App\Models\Category;
|
|
use App\Models\FractionalRealEstate;
|
|
use App\Models\RealEstate;
|
|
use App\Models\Fund;
|
|
use App\Models\Bonds;
|
|
use App\Models\CleanAndGreenAsset;
|
|
use App\Models\IndianFinancialAssets;
|
|
use App\Models\PeerToPeerLending;
|
|
use App\Models\HighYieldFinance;
|
|
use App\Models\InvoiceDiscounting;
|
|
use App\Models\LeaseBasedFinancing;
|
|
use App\Models\SecuritizedDebtInstrument;
|
|
use App\Models\StockFundsRealEstateExchange;
|
|
use App\Models\AlternativeInvestmentFund;
|
|
use Illuminate\Support\Str;
|
|
use App\Models\ProductPhotoDocuments;
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
|
class ManageFreeUInvestmentController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$products = Product::query()
|
|
->select(DB::raw('products.id, coalesce(sdi.product_name, p2p.scheme, fre.property_name_and_location,id.company_name,aif.fund_name,caga.project_name,hyf.security_name,lbf.company,sdi.product_name,vd.company_name) as product_name'), DB::raw('DATE_FORMAT(products.created_at, "%d-%b-%Y") as date'), 'categories.category_name', DB::raw('coalesce(sdi.minimum_investment, p2p.minimum_investment, fre.minimum_investment,id.minimum_investment,aif.minimum_investment,caga.minimum_investment,hyf.minimum_investment,lbf.minimum_investment,sdi.minimum_investment,vd.minimum_investment) as minimum_investment'), 'products.commission_type', 'products.rate', 'products.commission', 'products.description', 'products.top_pick', 'products.tables_id', 'products.status')
|
|
->leftJoin('securitized_debt_instruments as sdi', 'products.id', 'sdi.products_id')
|
|
->leftJoin('fractional_real_estates as fre', 'products.id', 'fre.products_id')
|
|
->leftJoin('peer_to_peer_lendings as p2p', 'products.id', 'p2p.products_id')
|
|
->leftJoin('invoice_discountings as id', 'products.id', 'id.products_id')
|
|
->leftJoin('alternative_investment_funds as aif', 'products.id', 'aif.products_id')
|
|
->leftJoin('clean_and_green_assets as caga', 'products.id', 'caga.products_id')
|
|
->leftJoin('high_yield_finances as hyf', 'products.id', 'hyf.products_id')
|
|
->leftJoin('lease_based_financings as lbf', 'products.id', 'lbf.products_id')
|
|
->leftJoin('venture_debts as vd', 'products.id', 'vd.products_id')
|
|
->join('categories', 'products.categories_id', 'categories.id')
|
|
->latest('products.created_at')
|
|
->get();
|
|
return view('Admin.Pages.manage_freeu_investment.manage_freeu_investment', compact('products'));
|
|
}
|
|
|
|
// public function add_new_investment_product()
|
|
public function addNewInvestmentProduct()
|
|
{
|
|
return view('Admin.Pages.manage_freeu_investment.add_new_investment_product');
|
|
}
|
|
|
|
public function productDelete(Request $request)
|
|
{
|
|
// dd($request->all());
|
|
$product = Product::where('id', $request->id)->delete();
|
|
if ($product) {
|
|
return response(['status' => 200, 'message' => 'Product deleted successfully']);
|
|
} else {
|
|
return response(['status' => 204, 'message' => 'Something went wrong! Try again']);
|
|
}
|
|
}
|
|
|
|
// public function viewFractionalRealEstateProduct($id)
|
|
// {
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
// // dd($products);
|
|
// return view('Admin.Pages.manage_freeu_investment.view_investment_product', compact('products'));
|
|
// }
|
|
|
|
// public function editFractionalRealEstateProduct($id)
|
|
// {
|
|
// $categories = Category::all();
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
// return view('Admin.Pages.manage_freeu_investment.edit_investment_product', compact('products', 'categories'));
|
|
// }
|
|
|
|
public function productStatus(Request $request)
|
|
{
|
|
$id = $request->id;
|
|
$status = $request->status == 1 ? 0 : 1;
|
|
$updateStatus = Product::where('id', $id)->update([
|
|
'status' => $status
|
|
]);
|
|
if (!$updateStatus) {
|
|
return response()->json(['status' => 400, 'message' => 'Error Changing Category Status!']);
|
|
}
|
|
return response()->json(['status' => 200, 'message' => 'Status Changed!']);
|
|
}
|
|
|
|
public function topPick(Request $request)
|
|
{
|
|
$id = $request->id;
|
|
$top_pick = $request->top_pick == 1 ? 0 : 1;
|
|
$updateStatus = Product::where('id', $id)->update([
|
|
'top_pick' => $top_pick
|
|
]);
|
|
if (!$updateStatus) {
|
|
return response()->json(['status' => 400, 'message' => 'Error Changing Top Pick Status!']);
|
|
}
|
|
return response()->json(['status' => 200, 'message' => 'Top Pick Status Changed!']);
|
|
}
|
|
|
|
public function getAllTopPickProducts()
|
|
{
|
|
$data['data'] = Product::getAllDetails()->where('top_pick', true)->get();
|
|
return $data;
|
|
}
|
|
|
|
// public function updateFractionalRealEstateProduct(Request $request)
|
|
// {
|
|
// $request->validate([
|
|
// 'property_name' => 'required'
|
|
// ]);
|
|
|
|
// $fractionalRealEstate = FractionalRealEstate::where('id', $request->fractional_real_estate)->update([
|
|
// 'property_name' => $request->property_name,
|
|
// 'companies_id' => $request->companies_id,
|
|
// 'price_per_sq_ft' => $request->price_per_sq_ft,
|
|
// 'property_location' => $request->property_location,
|
|
// 'project_type' => $request->project_type,
|
|
// 'current_status' => $request->current_status,
|
|
// 'booking_amount' => $request->booking_amount,
|
|
// 'price_range' => $request->price_range,
|
|
// 'total_price' => $request->total_price,
|
|
// 'transaction_type' => $request->transaction_type,
|
|
// 'project_code_or_rera_id' => $request->project_code_or_rera_id,
|
|
// 'built_up_area' => $request->built_up_area,
|
|
// 'carpet_area' => $request->carpet_area,
|
|
// 'area_in_sq_ft' => $request->area_in_sq_ft,
|
|
// 'construction_status' => $request->construction_status,
|
|
// 'launch_date' => $request->launch_date,
|
|
// 'completed_in' => $request->completed_in,
|
|
// 'total_units' => $request->total_units,
|
|
// 'unit_type' => $request->unit_type,
|
|
// 'no_of_bedrooms' => $request->no_of_bedrooms,
|
|
// 'no_of_restrooms' => $request->no_of_restrooms,
|
|
// 'no_of_floors' => $request->no_of_floors,
|
|
// 'furnished_status' => $request->furnished_status,
|
|
// 'commencement_certificate' => $request->commencement_certificate,
|
|
// 'occupancy_certificate' => $request->occupancy_certificate,
|
|
// 'total_towers' => $request->total_towers,
|
|
// 'builder_details' => $request->builder_details,
|
|
// 'landmarks' => $request->landmarks,
|
|
// 'amenities' => $request->amenities,
|
|
// 'elevators' => $request->elevators,
|
|
// 'car_parking' => $request->car_parking,
|
|
// 'electricity_status' => $request->electricity_status,
|
|
// 'fire_safety_measures' => $request->fire_safety_measures,
|
|
// 'water_facility' => $request->water_facility,
|
|
// 'price_negotiable' => $request->price_negotiable,
|
|
// 'maintenance_fees' => $request->maintenance_fees,
|
|
// 'nearest_railway_metro_station' => $request->nearest_railway_metro_station,
|
|
// 'pre_leased' => $request->pre_leased,
|
|
// 'tenant_details' => $request->tenant_details,
|
|
// 'facilities_features' => $request->facilities_features,
|
|
// 'construction_age' => $request->construction_age,
|
|
// 'country' => $request->country,
|
|
// 'remarks' => $request->remarks,
|
|
|
|
// // 'min_investment' => $request->min_investment,
|
|
// // 'min_investment_int' => $request->min_investment_int,
|
|
// // 'total_price' => $request->total_price,
|
|
// // 'total_price_int' => $request->total_price_int,
|
|
// // 'gross_average_field' => $request->gross_average_field,
|
|
// // 'funded_amount' => $request->funded_amount,
|
|
|
|
// // 'city' => $request->city,
|
|
// // 'tenure' => $request->tenure,
|
|
// // 'asset_type' => $request->asset_type,
|
|
// // 'address' => $request->address,
|
|
// // 'return_rate' => $request->return_rate,
|
|
// // 'target_irr' => $request->target_irr,
|
|
// // 'description' => $request->description,
|
|
// // 'overview' => $request->overview,
|
|
// ]);
|
|
|
|
// return response()->json(['status' => 200, 'message' => 'Fractional Real Estate Updated Successfully']);
|
|
// }
|
|
|
|
public function manage_manufactures_company()
|
|
{
|
|
return view('Admin.Pages.manage_freeu_investment.manage_manufactures_company');
|
|
}
|
|
|
|
public function manageProducts()
|
|
{
|
|
}
|
|
|
|
public function manageCompanies()
|
|
{
|
|
return view('Admin.manage-freeu-investments.companies');
|
|
}
|
|
|
|
public function manageCategories()
|
|
{
|
|
}
|
|
|
|
public function addProduct()
|
|
{
|
|
return view('Admin.Pages.manage_freeu_investment.add_product');
|
|
}
|
|
|
|
public function uploadFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
Excel::import(new FractionalRealEstateImport, $request->file('productFile'));
|
|
return back()->with('success', 'Product Imported Successfully.');
|
|
}
|
|
|
|
public function fractionalRealEstate()
|
|
{
|
|
$fractionalRealEstate = FractionalRealEstate::all();
|
|
return response()->json(['status' => 200, 'message' => 'Data Found', 'data' => $fractionalRealEstate], 200);
|
|
}
|
|
|
|
public function uploadBonds()
|
|
{
|
|
$id = basename(request()->path());
|
|
|
|
$bondData = [
|
|
1 => ['id' => Category::SovereignGovernmentBondId, 'file' => 'SovereignGovernmentBondTemplate'],
|
|
2 => ['id' => Category::CorporateBondInvestmentGradeId, 'file' => 'CorporateBondInvestmentGradeTemplate'],
|
|
3 => ['id' => Category::CorporateBondHighYieldId, 'file' => 'CorporateBondHighYieldTemplate'],
|
|
];
|
|
|
|
if (!array_key_exists($id, $bondData)) {
|
|
abort(404);
|
|
}
|
|
|
|
$category = Category::find($bondData[$id]['id']);
|
|
$category_id = $category->id;
|
|
$text = $category->category_name;
|
|
$excelName = $bondData[$id]['file'];
|
|
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.bonds', compact('text', 'category_id', 'excelName'));
|
|
}
|
|
|
|
public function uploadBondFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
Excel::import(new BondImport($category_type), $request->file('productFile'));
|
|
return back()->with('success', 'Bonds Imported Successfully.');
|
|
}
|
|
|
|
public function viewBond($id)
|
|
{
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
// dd($products);
|
|
$bond = Product::with('category', 'bonds')->bonds()->find($id);
|
|
// dd($bond);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.bonds', compact('bond'));
|
|
}
|
|
|
|
public function editBondProduct($id)
|
|
{
|
|
// $categories = Category::all();
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
$bond = Product::with('category', 'bonds')->bonds()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.edit-product.bonds', compact('bond'));
|
|
}
|
|
|
|
public function updateBondProduct(Request $request)
|
|
{
|
|
// $request->validate([
|
|
// 'issuer' => 'required'
|
|
// ]);
|
|
|
|
$validate = Validator::make($request->all(), [
|
|
'issuer' => 'required',
|
|
'presentation' => "required|mimes:pdf,zip",
|
|
'fact_sheet' => "required|mimes:pdf,zip",
|
|
'type' => 'required',
|
|
'geographic_focus' => 'required',
|
|
], [
|
|
'required' => "This :attribute field is required",
|
|
'mimes' => "This :attribute field extension must be pdf or zip",
|
|
]);
|
|
|
|
|
|
$validationMessage = validationErrorMessage($validate);
|
|
if ($validationMessage) {
|
|
|
|
return response()->json(
|
|
|
|
[
|
|
|
|
'status' => 400,
|
|
|
|
'message' => $validationMessage
|
|
|
|
]
|
|
|
|
);
|
|
}
|
|
|
|
$bond = Bonds::where('id', $request->bond_id)->update([
|
|
'issuer' => $request->issuer,
|
|
'geographic_focus' => $request->geographic_focus,
|
|
'bond_type' => $request->bond_type,
|
|
'about_issuer' => $request->about_issuer,
|
|
'industry' => $request->industry,
|
|
'country_of_risk' => $request->country_of_risk,
|
|
'country_of_incorporation' => $request->country_of_incorporation,
|
|
'isin' => $request->isin,
|
|
'bond_type_or_maturity_date' => $request->bond_type_or_maturity_date,
|
|
'call_date' => $request->call_date,
|
|
'coupon' => $request->coupon,
|
|
'indicative_yield_pa_mid' => $request->indicative_yield_pa_mid,
|
|
'indicative_price_us_mid' => $request->indicative_price_us_mid,
|
|
'minimum_investment' => $request->minimum_investment,
|
|
'construction_status' => $request->construction_status,
|
|
'yield_to_worst_pa_ask' => $request->yield_to_worst_pa_ask,
|
|
'yield_to_worst_pa_bid' => $request->yield_to_worst_pa_bid,
|
|
'price_ask' => $request->price_ask,
|
|
'price_bid' => $request->price_bid,
|
|
'accrued_interest' => $request->accrued_interest,
|
|
'yield_to_call' => $request->yield_to_call,
|
|
'duration' => $request->duration,
|
|
'amount_outstanding' => $request->amount_outstanding,
|
|
'collateral_type' => $request->collateral_type,
|
|
'credit_rating' => $request->credit_rating,
|
|
]);
|
|
|
|
$product = Product::where('id', $request->product_bond_id)->first();
|
|
// dd($product);
|
|
if ($request->has('presentation')) {
|
|
if (\File::exists(public_path('/uploads/product/presentation/' . $product->presentation))) {
|
|
\File::delete(public_path('/uploads/product/presentation/' . $product->presentation));
|
|
}
|
|
$productpresentation = time() . '_presentation' . '.' . $request->presentation->extension();
|
|
$request->presentation->move(public_path('/uploads/product/presentation'), $productpresentation);
|
|
$updatepresentation = Product::where('id', $request->product_bond_id)->update([
|
|
'presentation' => $productpresentation,
|
|
]);
|
|
}
|
|
|
|
if ($request->has('fact_sheet')) {
|
|
if (\File::exists(public_path('/uploads/product/fact_sheet/' . $product->fact_sheet))) {
|
|
\File::delete(public_path('/uploads/product/fact_sheet' . $product->fact_sheet));
|
|
}
|
|
$productfactsheet = time() . '_factsheet' . '.' . $request->fact_sheet->extension();
|
|
$request->fact_sheet->move(public_path('uploads/product/fact_sheet'), $productfactsheet);
|
|
$updatefactsheet = Product::where('id', $request->product_bond_id)->update([
|
|
'fact_sheet' => $productfactsheet,
|
|
]);
|
|
}
|
|
|
|
$updateType = Product::where('id', $request->product_bond_id)->update(['type' => $request->type]);
|
|
|
|
return response()->json(['status' => 200, 'message' => 'Bond Updated Successfully']);
|
|
}
|
|
|
|
public function uploadFunds()
|
|
{
|
|
$id = basename(request()->path());
|
|
|
|
$exchangeData = [
|
|
1 => ['id' => Category::GlobalMutualFundId, 'file' => 'InternationalMutualFundsTemplate'],
|
|
2 => ['id' => Category::GlobalVentureCapitalFundId, 'file' => 'InternationalVentureCapitalFundTemplate'],
|
|
3 => ['id' => Category::GlobalPrivateEquityFundId, 'file' => 'InternationalPrivateEquityFundTemplate'],
|
|
4 => ['id' => Category::GlobalVentureDebtId, 'file' => 'RealEstateInvestmentTrustsTemplate'],
|
|
5 => ['id' => Category::GlobalHedgeFundId, 'file' => 'InternationalHedgeFundTemplate'],
|
|
];
|
|
|
|
if (!array_key_exists($id, $exchangeData)) {
|
|
abort(404);
|
|
}
|
|
|
|
$category = Category::find($exchangeData[$id]['id']);
|
|
$category_id = $category->id;
|
|
$text = $category->category_name;
|
|
$excelName = $exchangeData[$id]['file'];
|
|
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.funds', compact('text', 'category_id', 'excelName'));
|
|
}
|
|
|
|
public function uploadFundFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
Excel::import(new FundImport($category_type), $request->file('productFile'));
|
|
return back()->with('success', 'Funds Imported Successfully.');
|
|
}
|
|
|
|
public function viewFund($id)
|
|
{
|
|
$fund = Product::with('category', 'funds.returns')->funds()->find($id);
|
|
// dd($fund);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.funds', compact('fund'));
|
|
}
|
|
|
|
public function editFundProduct($id)
|
|
{
|
|
// $categories = Category::all();
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
$fund = Product::with('category', 'funds.returns')->funds()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.edit-product.funds', compact('fund'));
|
|
}
|
|
|
|
public function updateFundProduct(Request $request)
|
|
{
|
|
// dd($request->all());
|
|
// $request->validate([
|
|
// 'issuer' => 'required'
|
|
// ]);
|
|
|
|
$validate = Validator::make($request->all(), [
|
|
'issuer' => 'required',
|
|
'presentation' => "required|mimes:pdf,zip",
|
|
'fact_sheet' => "required|mimes:pdf,zip",
|
|
'type' => 'required',
|
|
'geographic_focus' => 'required',
|
|
], [
|
|
'required' => "This :attribute field is required",
|
|
'mimes' => "This :attribute field extension must be pdf or zip",
|
|
]);
|
|
|
|
|
|
$validationMessage = validationErrorMessage($validate);
|
|
if ($validationMessage) {
|
|
|
|
return response()->json(
|
|
|
|
[
|
|
|
|
'status' => 400,
|
|
|
|
'message' => $validationMessage
|
|
|
|
]
|
|
|
|
);
|
|
}
|
|
|
|
$fund = Fund::where('id', $request->fund_id)->update([
|
|
'issuer' => $request->issuer,
|
|
'fund_name' => $request->fund_name,
|
|
'geographic_focus' => $request->geographic_focus,
|
|
'fund_type' => $request->fund_type,
|
|
'about_issuer' => $request->about_issuer,
|
|
'fund_description' => $request->fund_description,
|
|
'sharpe_ratio' => $request->sharpe_ratio,
|
|
'annualized_volatility' => $request->annualized_volatility,
|
|
'max_dropdown' => $request->max_dropdown,
|
|
'isin' => $request->isin,
|
|
'inception_date' => $request->inception_date,
|
|
'fund_aum' => $request->fund_aum,
|
|
'expense_ratio' => $request->expense_ratio,
|
|
'nav_per_unit' => $request->nav_per_unit,
|
|
'minimum_investment' => $request->minimum_investment,
|
|
'ytd' => $request->ytd,
|
|
'year1_return' => $request->year1_return,
|
|
'year3_return' => $request->year3_return,
|
|
]);
|
|
|
|
$product = Product::where('id', $request->product_fund_id)->first();
|
|
// dd($product);
|
|
if ($request->has('presentation')) {
|
|
if (\File::exists(public_path('/uploads/product/presentation/' . $product->presentation))) {
|
|
\File::delete(public_path('/uploads/product/presentation/' . $product->presentation));
|
|
}
|
|
$productpresentation = time() . '_presentation' . '.' . $request->presentation->extension();
|
|
$request->presentation->move(public_path('/uploads/product/presentation'), $productpresentation);
|
|
$updatepresentation = Product::where('id', $request->product_fund_id)->update([
|
|
'presentation' => $productpresentation,
|
|
]);
|
|
}
|
|
|
|
if ($request->has('fact_sheet')) {
|
|
if (\File::exists(public_path('/uploads/product/fact_sheet/' . $product->fact_sheet))) {
|
|
\File::delete(public_path('/uploads/product/fact_sheet' . $product->fact_sheet));
|
|
}
|
|
$productfactsheet = time() . '_factsheet' . '.' . $request->fact_sheet->extension();
|
|
$request->fact_sheet->move(public_path('uploads/product/fact_sheet'), $productfactsheet);
|
|
$updatefactsheet = Product::where('id', $request->product_fund_id)->update([
|
|
'fact_sheet' => $productfactsheet,
|
|
]);
|
|
}
|
|
|
|
$fund = Fund::find($request->fund_id);
|
|
$type = Product::where('id', $fund->products_id)->update(['type' => $request->type]);
|
|
|
|
return response()->json(['status' => 200, 'message' => 'Fund Updated Successfully']);
|
|
}
|
|
|
|
public function uploadExchange()
|
|
{
|
|
$id = basename(request()->path());
|
|
|
|
$exchangeData = [
|
|
1 => ['id' => Category::EquitiesId, 'file' => 'InternationalEquitiesTemplate'],
|
|
2 => ['id' => Category::ExchangeTradedFundsId, 'file' => 'ExchangeTradedFundsTemplate'],
|
|
3 => ['id' => Category::RealEstateInvestmentTrustsId, 'file' => 'RealEstateInvestmentTrustsTemplate'],
|
|
];
|
|
|
|
if (!array_key_exists($id, $exchangeData)) {
|
|
abort(404);
|
|
}
|
|
|
|
$category = Category::find($exchangeData[$id]['id']);
|
|
$category_id = $category->id;
|
|
$text = $category->category_name;
|
|
$excelName = $exchangeData[$id]['file'];
|
|
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.exchange', compact('text', 'category_id', 'excelName'));
|
|
}
|
|
|
|
public function uploadExchangeFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
Excel::import(new StockFundsRealEstateExchangeImport($category_type), $request->file('productFile'));
|
|
return back()->with('success', 'Exchange Imported Successfully.');
|
|
}
|
|
|
|
public function viewExchange($id)
|
|
{
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
$exchange = Product::with('category', 'exchanges')->exchanges()->find($id);
|
|
// dd($exchange);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.stock-fund-real-estate-exchange', compact('exchange'));
|
|
}
|
|
|
|
public function editExchangeProduct($id)
|
|
{
|
|
// $categories = Category::all();
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
$exchange = Product::with('category', 'exchanges')->exchanges()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.edit-product.exchange', compact('exchange'));
|
|
}
|
|
|
|
public function updateExchangeProduct(Request $request)
|
|
{
|
|
// $request->validate([
|
|
// 'name' => 'required'
|
|
// ]);
|
|
$validate = Validator::make($request->all(), [
|
|
'name' => 'required',
|
|
'presentation' => "required|mimes:pdf,zip",
|
|
'fact_sheet' => "required|mimes:pdf,zip",
|
|
'type' => 'required',
|
|
'geographic_focus' => 'required',
|
|
], [
|
|
'required' => "This :attribute field is required",
|
|
'mimes' => "This :attribute field extension must be pdf or zip",
|
|
]);
|
|
|
|
|
|
$validationMessage = validationErrorMessage($validate);
|
|
if ($validationMessage) {
|
|
|
|
return response()->json(
|
|
|
|
[
|
|
|
|
'status' => 400,
|
|
|
|
'message' => $validationMessage
|
|
|
|
]
|
|
|
|
);
|
|
}
|
|
|
|
$exchange = StockFundsRealEstateExchange::where('id', $request->exchange_id)->update([
|
|
'name' => $request->name,
|
|
// 'companies_id' => $request->companies_id,
|
|
'ticker' => $request->ticker,
|
|
'geographic_focus' => $request->geographic_focus,
|
|
'exchange' => $request->exchange,
|
|
'about' => $request->about,
|
|
'industry' => $request->industry,
|
|
'market_cap' => $request->market_cap,
|
|
'pe_ratio' => $request->pe_ratio,
|
|
'dividend_yield' => $request->dividend_yield,
|
|
'beta' => $request->beta,
|
|
'provider' => $request->provider,
|
|
'category' => $request->category,
|
|
'expense_ratio' => $request->expense_ratio,
|
|
'month1_return' => $request->month1_return,
|
|
'month6_return' => $request->month6_return,
|
|
'year1_return' => $request->year1_return,
|
|
'year3_return' => $request->year3_return,
|
|
]);
|
|
$product = Product::where('id', $request->product_exchange_id)->first();
|
|
// dd($product);
|
|
if ($request->has('presentation')) {
|
|
if (\File::exists(public_path('/uploads/product/presentation/' . $product->presentation))) {
|
|
\File::delete(public_path('/uploads/product/presentation/' . $product->presentation));
|
|
}
|
|
$productpresentation = time() . '_presentation' . '.' . $request->presentation->extension();
|
|
$request->presentation->move(public_path('/uploads/product/presentation'), $productpresentation);
|
|
$updatepresentation = Product::where('id', $request->product_exchange_id)->update([
|
|
'presentation' => $productpresentation,
|
|
]);
|
|
}
|
|
|
|
if ($request->has('fact_sheet')) {
|
|
if (\File::exists(public_path('/uploads/product/fact_sheet/' . $product->fact_sheet))) {
|
|
\File::delete(public_path('/uploads/product/fact_sheet' . $product->fact_sheet));
|
|
}
|
|
$productfactsheet = time() . '_factsheet' . '.' . $request->fact_sheet->extension();
|
|
$request->fact_sheet->move(public_path('uploads/product/fact_sheet'), $productfactsheet);
|
|
$updatefactsheet = Product::where('id', $request->product_exchange_id)->update([
|
|
'fact_sheet' => $productfactsheet,
|
|
]);
|
|
}
|
|
|
|
$exchange = StockFundsRealEstateExchange::find($request->exchange_id);
|
|
$type = Product::where('id', $exchange->products_id)->update(['type' => $request->type]);
|
|
|
|
return response()->json(['status' => 200, 'message' => 'Exchange Details Updated Successfully']);
|
|
}
|
|
|
|
public function uploadRealEstate()
|
|
{
|
|
$id = basename(request()->path());
|
|
|
|
$realEstateData = [
|
|
1 => ['id' => Category::IndianResidentialRealEstateID, 'file' => 'IndianResidentialRealEstateTemplate'],
|
|
2 => ['id' => Category::IndianCommercialRealEstateID, 'file' => 'IndianCommercialRealEstateTemplate'],
|
|
3 => ['id' => Category::IndianIndustrialRealEstateID, 'file' => 'IndianIndustrialRealEstateTemplate'],
|
|
4 => ['id' => Category::GlobalResidentialRealEstateID, 'file' => 'InternationalResidentialRealEstateTemplate'],
|
|
5 => ['id' => Category::GlobalCommercialRealEstateID, 'file' => 'InternationalCommercialRealEstateTemplate'],
|
|
6 => ['id' => Category::GlobalIndustrialRealEstateID, 'file' => 'InternationalIndustrialRealEstateTemplate']
|
|
];
|
|
|
|
if (!array_key_exists($id, $realEstateData)) {
|
|
abort(404);
|
|
}
|
|
|
|
$category = Category::find($realEstateData[$id]['id']);
|
|
$category_id = $category->id;
|
|
$text = $category->category_name;
|
|
$excelName = $realEstateData[$id]['file'];
|
|
|
|
// if ($id == 1) {
|
|
// $text = 'Indian Residential Real Estate';
|
|
// $category_id = 17;
|
|
// } else if ($id == 2) {
|
|
// $text = 'Indian Commercial Real Estate';
|
|
// $category_id = 18;
|
|
// } else if ($id == 3) {
|
|
// $text = 'Indian Industrial Real Estate';
|
|
// $category_id = 19;
|
|
// } else if ($id == 4) {
|
|
// $text = 'Global Residential Real Estate';
|
|
// $category_id = 20;
|
|
// } else if ($id == 5) {
|
|
// $text = 'Global Commercial Real Estate';
|
|
// $category_id = 21;
|
|
// } else if ($id == 6) {
|
|
// $text = 'Global Industrial Real Estate';
|
|
// $category_id = 22;
|
|
// }
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.real-estate', compact('text', 'category_id', 'excelName'));
|
|
}
|
|
|
|
public function uploadRealEstateFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
Excel::import(new RealEstateImport($category_type), $request->file('productFile'));
|
|
return back()->with('success', 'Real Estate Imported Successfully.');
|
|
}
|
|
|
|
public function viewRealEstate($id)
|
|
{
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
$products = Product::with('category', 'realEstates')->realestates()->find($id);
|
|
// dd($products);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.real-estate', compact('products'));
|
|
}
|
|
|
|
public function editRealEstateProduct($id)
|
|
{
|
|
$categories = Category::all();
|
|
$products = Product::with('category', 'realEstates')->realestates()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.edit-product.real-estate', compact('products', 'categories'));
|
|
}
|
|
|
|
public function updateRealEstateProduct(Request $request)
|
|
{
|
|
// dd($request->all());
|
|
// $request->validate([
|
|
// 'property_name' => 'required'
|
|
// ]);
|
|
$validate = Validator::make($request->all(), [
|
|
'property_name' => 'required',
|
|
// 'presentation' => "required|mimes:pdf,zip",
|
|
// 'fact_sheet' => "required|mimes:pdf,zip",
|
|
'type' => 'required',
|
|
'geographic_focus' => 'required',
|
|
], [
|
|
'required' => "This :attribute field is required",
|
|
'mimes' => "This :attribute field extension must be pdf or zip",
|
|
]);
|
|
|
|
|
|
$validationMessage = validationErrorMessage($validate);
|
|
if ($validationMessage) {
|
|
|
|
return response()->json(
|
|
|
|
[
|
|
|
|
'status' => 400,
|
|
|
|
'message' => $validationMessage
|
|
|
|
]
|
|
|
|
);
|
|
}
|
|
|
|
$realEstate = RealEstate::where('id', $request->realEstates)->update([
|
|
'property_name' => $request->property_name,
|
|
// 'companies_id' => $request->companies_id,
|
|
'geographic_focus' => $request->geographic_focus,
|
|
'price_per_sq_ft' => $request->price_per_sq_ft,
|
|
'property_location' => $request->property_location,
|
|
'project_type' => $request->project_type,
|
|
'current_status' => $request->current_status,
|
|
'booking_amount' => $request->booking_amount,
|
|
'price_range' => $request->price_range,
|
|
'total_price' => $request->total_price,
|
|
'transaction_type' => $request->transaction_type,
|
|
'project_code_or_rera_id' => $request->project_code_or_rera_id,
|
|
'built_up_area' => $request->built_up_area,
|
|
'carpet_area' => $request->carpet_area,
|
|
'area_in_sq_ft' => $request->area_in_sq_ft,
|
|
'construction_status' => $request->construction_status,
|
|
'launch_date' => $request->launch_date,
|
|
'completed_in' => $request->completed_in,
|
|
'total_units' => $request->total_units,
|
|
'unit_type' => $request->unit_type,
|
|
'no_of_bedrooms' => $request->no_of_bedrooms,
|
|
'no_of_restrooms' => $request->no_of_restrooms,
|
|
'no_of_floors' => $request->no_of_floors,
|
|
'furnished_status' => $request->furnished_status,
|
|
'commencement_certificate' => $request->commencement_certificate,
|
|
'occupancy_certificate' => $request->occupancy_certificate,
|
|
'total_towers' => $request->total_towers,
|
|
'builder_details' => $request->builder_details,
|
|
'landmarks' => $request->landmarks,
|
|
'amenities' => $request->amenities,
|
|
'elevators' => $request->elevators,
|
|
'car_parking' => $request->car_parking,
|
|
'electricity_status' => $request->electricity_status,
|
|
'fire_safety_measures' => $request->fire_safety_measures,
|
|
'water_facility' => $request->water_facility,
|
|
'price_negotiable' => $request->price_negotiable,
|
|
'maintenance_fees' => $request->maintenance_fees,
|
|
'nearest_railway_metro_station' => $request->nearest_railway_metro_station,
|
|
'pre_leased' => $request->pre_leased,
|
|
'tenant_details' => $request->tenant_details,
|
|
'facilities_features' => $request->facilities_features,
|
|
'construction_age' => $request->construction_age,
|
|
'country' => $request->country,
|
|
'remarks' => $request->remarks,
|
|
]);
|
|
|
|
$estate = RealEstate::find($request->realEstates);
|
|
$type = Product::where('id', $estate->products_id)->update(['type' => $request->type]);
|
|
|
|
$photos = $request->photos;
|
|
$documents = $request->documents;
|
|
|
|
if ($photos) {
|
|
$this->uploadPhotosDocuments($photos, $request->realEstates, ProductPhotoDocuments::Photos);
|
|
}
|
|
|
|
if ($documents) {
|
|
$this->uploadPhotosDocuments($documents, $request->realEstates, ProductPhotoDocuments::Documents);
|
|
}
|
|
|
|
$product = Product::where('id', $request->product_realestate_id)->first();
|
|
// dd($product);
|
|
if ($request->has('presentation')) {
|
|
if (\File::exists(public_path('/uploads/product/presentation/' . $product->presentation))) {
|
|
\File::delete(public_path('/uploads/product/presentation/' . $product->presentation));
|
|
}
|
|
$productpresentation = time() . '_presentation' . '.' . $request->presentation->extension();
|
|
$request->presentation->move(public_path('/uploads/product/presentation'), $productpresentation);
|
|
$updatepresentation = Product::where('id', $request->product_realestate_id)->update([
|
|
'presentation' => $productpresentation,
|
|
]);
|
|
}
|
|
|
|
if ($request->has('fact_sheet')) {
|
|
if (\File::exists(public_path('/uploads/product/fact_sheet/' . $product->fact_sheet))) {
|
|
\File::delete(public_path('/uploads/product/fact_sheet' . $product->fact_sheet));
|
|
}
|
|
$productfactsheet = time() . '_factsheet' . '.' . $request->fact_sheet->extension();
|
|
$request->fact_sheet->move(public_path('uploads/product/fact_sheet'), $productfactsheet);
|
|
$updatefactsheet = Product::where('id', $request->product_realestate_id)->update([
|
|
'fact_sheet' => $productfactsheet,
|
|
]);
|
|
}
|
|
|
|
return response()->json(['status' => 200, 'message' => 'Real Estate Updated Successfully']);
|
|
}
|
|
|
|
public function uploadPhotosDocuments($documents, $realEstateID, $type)
|
|
{
|
|
$folder = $type == 0 ? 'photos' : 'documents';
|
|
|
|
if ($documents) {
|
|
|
|
$photosDocuments = ProductPhotoDocuments::where([
|
|
'type' => $type,
|
|
'real_estates_id' => $realEstateID
|
|
])->get();
|
|
|
|
if ($photosDocuments) {
|
|
foreach ($photosDocuments as $delete) {
|
|
if (\File::exists(public_path("/uploads/real_estate/$folder/" . $delete->file_name . ""))) {
|
|
\File::delete(public_path("/uploads/real_estate/$folder/" . $delete->file_name . ""));
|
|
}
|
|
ProductPhotoDocuments::find($delete->id)->delete();
|
|
}
|
|
};
|
|
|
|
$no = 1;
|
|
foreach ($documents as $document) {
|
|
$photosDocumentsStorageName = time() . '.' . $folder . $no . $document->extension();
|
|
$document->move(public_path("/uploads/real_estate/$folder"), $photosDocumentsStorageName);
|
|
$addPhotosDocuments = ProductPhotoDocuments::create([
|
|
'type' => $type,
|
|
'real_estates_id' => $realEstateID,
|
|
'file_name' => $photosDocumentsStorageName,
|
|
]);
|
|
$no++;
|
|
}
|
|
}
|
|
}
|
|
|
|
public function uploadIFA()
|
|
{
|
|
$slug = basename(request()->path());
|
|
$category = Category::where('slug', $slug)->first();
|
|
$text = $category->category_name;
|
|
$category_id = $category->id;
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.indian-financial-assets', compact('text', 'category_id'));
|
|
}
|
|
|
|
public function uploadIFAFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
$category = Category::find($request->category_id);
|
|
Excel::import(new IndianFinancialAssetsImport($category_type), $request->file('productFile'));
|
|
return back()->with('success', "$category->category_name Imported Successfully.");
|
|
}
|
|
|
|
public function viewIndianFinancialAssets($id)
|
|
{
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
$ifa = Product::with('category', 'indianFinancialAssets')->indianFinancialAssets()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.indian-financial-assets', compact('ifa'));
|
|
}
|
|
|
|
public function editIndianFinancialAssetsProduct($id)
|
|
{
|
|
// $categories = Category::all();
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
$ifa = Product::with('category', 'indianFinancialAssets')->indianFinancialAssets()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.edit-product.indian-financial-assets', compact('ifa'));
|
|
}
|
|
|
|
public function updateIndianFinancialAssetsProduct(Request $request)
|
|
{
|
|
$request->validate([
|
|
'product_name' => 'required'
|
|
]);
|
|
|
|
$ifa = IndianFinancialAssets::where('id', $request->ifa_id)->update([
|
|
'product_name' => $request->product_name,
|
|
// 'companies_id' => $request->companies_id,
|
|
'investment_platform' => $request->investment_platform,
|
|
'counter_party' => $request->counter_party,
|
|
'investment_date' => $request->investment_date,
|
|
'amount_invested' => $request->amount_invested,
|
|
'total_gross_repaid_amount' => $request->total_gross_repaid_amount,
|
|
'tenure' => $request->tenure,
|
|
'principal_payment_frequency' => $request->principal_payment_frequency,
|
|
'interest_payment_frequency' => $request->interest_payment_frequency,
|
|
'next_repayment_due_date' => $request->next_repayment_due_date,
|
|
'maturity_date' => $request->maturity_date,
|
|
'next_repayment_amount' => $request->next_repayment_amount,
|
|
'expected_irr' => $request->expected_irr,
|
|
]);
|
|
|
|
return response()->json(['status' => 200, 'message' => 'Indian Financial Assets Details Updated Successfully']);
|
|
}
|
|
|
|
|
|
public function uploadPeerToPeer()
|
|
{
|
|
$slug = basename(request()->path());
|
|
$category = Category::where('slug', $slug)->first();
|
|
$text = $category->category_name;
|
|
$category_id = $category->id;
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.peer-to-peer-lending', compact('text', 'category_id'));
|
|
}
|
|
|
|
public function uploadPeerToPeerFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
$category = Category::find($request->category_id);
|
|
Excel::import(new PeerToPeerLendingImport($category_type), $request->file('productFile'));
|
|
return back()->with('success', "$category->category_name Imported Successfully.");
|
|
}
|
|
|
|
public function viewPeerToPeerAssets($id)
|
|
{
|
|
$p2p = Product::with('category', 'peerToPeers')->peerToPeers()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.peer-to-peer-lending', compact('p2p'));
|
|
}
|
|
|
|
public function editPeerToPeerProduct($id)
|
|
{
|
|
// $categories = Category::all();
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
$p2p = Product::with('category', 'peerToPeers')->peerToPeers()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.edit-product.peer-to-peer-lending', compact('p2p'));
|
|
}
|
|
|
|
public function updatePeerToPeerLendingProduct(Request $request)
|
|
{
|
|
$request->validate([
|
|
'scheme' => 'required'
|
|
]);
|
|
|
|
$p2p = PeerToPeerLending::where('id', $request->p2p_id)->update([
|
|
'scheme' => $request->scheme,
|
|
'slug' => Str::slug($request->scheme),
|
|
'tenure' => $request->tenure,
|
|
'minimum_investment' => $request->minimum_investment,
|
|
'maximum_investment' => $request->maximum_investment,
|
|
'returns' => $request->returns,
|
|
]);
|
|
|
|
return response()->json(['status' => 200, 'message' => 'Peer To Peer Details Updated Successfully']);
|
|
}
|
|
|
|
|
|
public function uploadSecuritizedDebtInstrument()
|
|
{
|
|
$slug = basename(request()->path());
|
|
$category = Category::where('slug', $slug)->first();
|
|
$text = $category->category_name;
|
|
$category_id = $category->id;
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.securitized-debt-instrument', compact('text', 'category_id'));
|
|
}
|
|
|
|
public function uploadSecuritizedDebtInstrumentFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
$category = Category::find($request->category_id);
|
|
Excel::import(new SecuritizedDebtInstrumentImport($category_type), $request->file('productFile'));
|
|
return back()->with('success', "$category->category_name Imported Successfully.");
|
|
}
|
|
|
|
public function viewSecuritizedDebtInstrumentAssets($id)
|
|
{
|
|
$securitizedDebtInstrument = Product::with('category', 'securitizedDebtInstruments')->securitizedDebtInstruments()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.securitized-debt-instrument', compact('securitizedDebtInstrument'));
|
|
}
|
|
|
|
public function editSecuritizedDebtInstrumentProduct($id)
|
|
{
|
|
// $categories = Category::all();
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
$securitizedDebtInstrument = Product::with('category', 'securitizedDebtInstruments')->securitizedDebtInstruments()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.edit-product.securitized-debt-instrument', compact('securitizedDebtInstrument'));
|
|
}
|
|
|
|
public function updateSecuritizedDebtInstrumentProduct(Request $request)
|
|
{
|
|
$request->validate([
|
|
'product_name' => 'required'
|
|
]);
|
|
|
|
$securitizedDebtInstrument = SecuritizedDebtInstrument::where('id', $request->sdi_id)->update([
|
|
'product_name' => $request->product_name,
|
|
'slug' => Str::slug($request->product_name),
|
|
'total_deal_size' => $request->total_deal_size,
|
|
'minimum_investment' => $request->minimum_investment,
|
|
'credit_rating' => $request->credit_rating,
|
|
'deal_tenure' => $request->deal_tenure,
|
|
'target_irr' => $request->target_irr,
|
|
'target_multiple' => $request->target_multiple,
|
|
'payout_frequency' => $request->payout_frequency,
|
|
'principal_returned_in' => $request->principal_returned_in,
|
|
'average_annual_payback' => $request->average_annual_payback,
|
|
'security_enhancement' => $request->security_enhancement,
|
|
'listing_details' => $request->listing_details,
|
|
]);
|
|
|
|
return response()->json(['status' => 200, 'message' => 'Securitized Debt Instrument Details Updated Successfully']);
|
|
}
|
|
|
|
public function uploadHighYieldFinance()
|
|
{
|
|
$slug = basename(request()->path());
|
|
$category = Category::where('slug', $slug)->first();
|
|
$text = $category->category_name;
|
|
$category_id = $category->id;
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.high-yield-finance', compact('text', 'category_id'));
|
|
}
|
|
|
|
public function uploadHighYieldFinanceFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
$category = Category::find($request->category_id);
|
|
Excel::import(new HighYieldFinanceImport($category_type), $request->file('productFile'));
|
|
return back()->with('success', "$category->category_name Imported Successfully.");
|
|
}
|
|
|
|
public function viewHighYieldFinanceAssets($id)
|
|
{
|
|
$highYieldFinance = Product::with('category', 'highYieldFinances')->highYieldFinances()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.high-yield-finance', compact('highYieldFinance'));
|
|
}
|
|
|
|
public function editHighYieldFinanceProduct($id)
|
|
{
|
|
// $categories = Category::all();
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
$highYieldFinance = Product::with('category', 'highYieldFinances')->highYieldFinances()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.edit-product.high-yield-finance', compact('highYieldFinance'));
|
|
}
|
|
|
|
public function updateHighYieldFinanceProduct(Request $request)
|
|
{
|
|
$request->validate([
|
|
'security_name' => 'required'
|
|
]);
|
|
|
|
$highYieldFinance = HighYieldFinance::where('id', $request->hyf_id)->update([
|
|
'security_name' => $request->security_name,
|
|
'security_type' => $request->security_type,
|
|
'isin' => $request->isin,
|
|
'issuer_company' => $request->issuer_company,
|
|
'issue_size' => $request->issue_size,
|
|
'issue_type' => $request->issue_type,
|
|
'listing_details' => $request->listing_details,
|
|
'rating_category' => $request->rating_category,
|
|
'minimum_investment' => $request->minimum_investment,
|
|
'coupon_rate' => $request->coupon_rate,
|
|
'yield_to_maturity' => $request->yield_to_maturity,
|
|
'interest_payment_frequency' => $request->interest_payment_frequency,
|
|
'allotment_date' => $request->allotment_date,
|
|
'maturity_date' => $request->maturity_date,
|
|
]);
|
|
|
|
return response()->json(['status' => 200, 'message' => 'High Yield Finance Details Updated Successfully']);
|
|
}
|
|
|
|
public function uploadFractionalRealEstate()
|
|
{
|
|
$slug = basename(request()->path());
|
|
$category = Category::where('slug', $slug)->first();
|
|
$text = $category->category_name;
|
|
$category_id = $category->id;
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.fractional-real-estate', compact('text', 'category_id'));
|
|
}
|
|
|
|
public function uploadFractionalRealEstateFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
$category = Category::find($request->category_id);
|
|
Excel::import(new FractionalRealEstateImport($category_type), $request->file('productFile'));
|
|
return back()->with('success', "$category->category_name Imported Successfully.");
|
|
}
|
|
|
|
public function viewFractionalRealEstateAssets($id)
|
|
{
|
|
$fractionalRealEstate = Product::with('category', 'fractional_real_estate')->fractionalrealestate()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.fractional-real-estate', compact('fractionalRealEstate'));
|
|
}
|
|
|
|
public function editFractionalRealEstateProduct($id)
|
|
{
|
|
// $categories = Category::all();
|
|
// $products = Product::with('category', 'fractional_real_estate.companies')->fractionalrealestate()->find($id);
|
|
$fractionalRealEstate = Product::with('category', 'fractional_real_estate')->fractionalrealestate()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.edit-product.fractional-real-estate', compact('fractionalRealEstate'));
|
|
}
|
|
|
|
public function updateFractionalRealEstateProduct(Request $request)
|
|
{
|
|
$request->validate([
|
|
'property_name_and_location' => 'required'
|
|
]);
|
|
|
|
$fractionalRealEstate = FractionalRealEstate::where('id', $request->fre_id)->update([
|
|
'slug' => Str::slug($request->property_name_and_location),
|
|
'property_name_and_location' => $request->property_name_and_location,
|
|
'property_description' => $request->property_description,
|
|
'property_grade' => $request->property_grade,
|
|
'asset_type' => $request->asset_type,
|
|
'tenant' => $request->tenant,
|
|
'deal_size_in_crore' => $request->deal_size_in_crore,
|
|
'coupon_rate_on_ccd' => $request->coupon_rate_on_ccd,
|
|
'rental_escalation' => $request->rental_escalation,
|
|
'capital_appreciation' => $request->capital_appreciation,
|
|
'expected_irr' => $request->expected_irr,
|
|
'cagr' => $request->cagr,
|
|
'minimum_investment' => $request->minimum_investment,
|
|
'minimum_investment_lockin' => $request->minimum_investment_lockin,
|
|
'tenant_lease_term' => $request->tenant_lease_term,
|
|
'tenant_lock_in' => $request->tenant_lock_in,
|
|
'tenant_security_deposit' => $request->tenant_security_deposit,
|
|
'annual_management_fee' => $request->annual_management_fee,
|
|
'performance_fees' => $request->performance_fees,
|
|
'hurdle_rate' => $request->hurdle_rate,
|
|
]);
|
|
|
|
return response()->json(['status' => 200, 'message' => 'Fractional Real Estate Details Updated Successfully']);
|
|
}
|
|
|
|
public function uploadCleanAndGreenAsset()
|
|
{
|
|
$slug = basename(request()->path());
|
|
$category = Category::where('slug', $slug)->first();
|
|
$text = $category->category_name;
|
|
$category_id = $category->id;
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.clean-and-green-asset', compact('text', 'category_id'));
|
|
}
|
|
|
|
public function uploadCleanAndGreenAssetFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
$category = Category::find($request->category_id);
|
|
Excel::import(new CleanAndGreenAssetImport($category_type), $request->file('productFile'));
|
|
return back()->with('success', "$category->category_name Imported Successfully.");
|
|
}
|
|
|
|
public function viewCleanAndGreenAssets($id)
|
|
{
|
|
$cleanAndGreenAsset = Product::with('category', 'cleanAndGreenAssets')->cleanAndGreenAssets()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.clean-and-green-asset', compact('cleanAndGreenAsset'));
|
|
}
|
|
|
|
public function editCleanAndGreenProduct($id)
|
|
{
|
|
$cleanAndGreenAsset = Product::with('category', 'cleanAndGreenAssets')->cleanAndGreenAssets()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.edit-product.clean-and-green-asset', compact('cleanAndGreenAsset'));
|
|
}
|
|
|
|
public function updateCleanAndGreenProduct(Request $request)
|
|
{
|
|
$request->validate([
|
|
'project_name' => 'required'
|
|
]);
|
|
|
|
$cleanAndGreenAsset = CleanAndGreenAsset::where('id', $request->caga_id)->update([
|
|
'slug' => Str::slug($request->project_name),
|
|
'project_name' => $request->project_name,
|
|
'focus_area' => $request->focus_area,
|
|
'asset_value' => $request->asset_value,
|
|
'asset_life' => $request->asset_life,
|
|
'entry_load' => $request->entry_load,
|
|
'lockin_period' => $request->lockin_period,
|
|
'minimum_investment' => $request->minimum_investment,
|
|
'maximum_investment' => $request->maximum_investment,
|
|
'expected_returns_irr' => $request->expected_returns_irr,
|
|
'payouts' => $request->payouts,
|
|
]);
|
|
|
|
return response()->json(['status' => 200, 'message' => 'Clean And Green Asset Details Updated Successfully']);
|
|
}
|
|
|
|
public function uploadLeaseBasedFinancing()
|
|
{
|
|
$slug = basename(request()->path());
|
|
$category = Category::where('slug', $slug)->first();
|
|
$text = $category->category_name;
|
|
$category_id = $category->id;
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.lease-based-financing', compact('text', 'category_id'));
|
|
}
|
|
|
|
public function uploadLeaseBasedFinancingFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
$category = Category::find($request->category_id);
|
|
Excel::import(new LeaseBasedFinancingImport($category_type), $request->file('productFile'));
|
|
return back()->with('success', "$category->category_name Imported Successfully.");
|
|
}
|
|
|
|
public function viewLeaseBasedFinancingAssets($id)
|
|
{
|
|
$leaseBasedFinancing = Product::with('category', 'leaseBasedFinancing')->leaseBasedFinancing()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.lease-based-financing', compact('leaseBasedFinancing'));
|
|
}
|
|
|
|
public function editLeaseBasedFinancingProduct($id)
|
|
{
|
|
$leaseBasedFinancing = Product::with('category', 'leaseBasedFinancing')->leaseBasedFinancing()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.edit-product.lease-based-financing', compact('leaseBasedFinancing'));
|
|
}
|
|
|
|
public function updateLeaseBasedFinancingProduct(Request $request)
|
|
{
|
|
$request->validate([
|
|
'company' => 'required'
|
|
]);
|
|
|
|
$leaseBasedFinancing = LeaseBasedFinancing::where('id', $request->lbf_id)->update([
|
|
'slug' => Str::slug($request->company),
|
|
'company' => $request->company,
|
|
'asset_class' => $request->asset_class,
|
|
'underlying_asset' => $request->underlying_asset,
|
|
'sector' => $request->sector,
|
|
'mobility_platform' => $request->mobility_platform,
|
|
'total_deal_size' => $request->total_deal_size,
|
|
'minimum_investment' => $request->minimum_investment,
|
|
'tenure' => $request->tenure,
|
|
'payout_frequency' => $request->payout_frequency,
|
|
'pre_tax_return' => $request->pre_tax_return,
|
|
]);
|
|
|
|
return response()->json(['status' => 200, 'message' => 'Lease Based Financing Details Updated Successfully']);
|
|
}
|
|
|
|
public function uploadInvoiceDiscounting()
|
|
{
|
|
$slug = basename(request()->path());
|
|
$category = Category::where('slug', $slug)->first();
|
|
$text = $category->category_name;
|
|
$category_id = $category->id;
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.invoice-discounting', compact('text', 'category_id'));
|
|
}
|
|
|
|
public function uploadInvoiceDiscountingFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
$category = Category::find($request->category_id);
|
|
Excel::import(new InvoiceDiscountingImport($category_type), $request->file('productFile'));
|
|
return back()->with('success', "$category->category_name Imported Successfully.");
|
|
}
|
|
|
|
public function viewInvoiceDiscountingAssets($id)
|
|
{
|
|
$invoiceDiscounting = Product::with('category', 'invoiceDiscounting')->invoiceDiscounting()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.invoice-discounting', compact('invoiceDiscounting'));
|
|
}
|
|
|
|
public function editInvoiceDiscountingProduct($id)
|
|
{
|
|
$invoiceDiscounting = Product::with('category', 'invoiceDiscounting')->invoiceDiscounting()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.edit-product.invoice-discounting', compact('invoiceDiscounting'));
|
|
}
|
|
|
|
public function updateInvoiceDiscountingProduct(Request $request)
|
|
{
|
|
$request->validate([
|
|
'company_name' => 'required'
|
|
]);
|
|
|
|
$invoiceDiscounting = InvoiceDiscounting::where('id', $request->id)->update([
|
|
'slug' => Str::slug($request->company_name),
|
|
'company_name' => $request->company_name,
|
|
'sector' => $request->sector,
|
|
'about_company' => $request->about_company,
|
|
'key_performance_metrics' => $request->key_performance_metrics,
|
|
'minimum_investment' => $request->minimum_investment,
|
|
'total_deal_size' => $request->total_deal_size,
|
|
'tenure' => $request->tenure,
|
|
'pre_tax_irr' => $request->pre_tax_irr,
|
|
'coupon_rate' => $request->coupon_rate,
|
|
'vendor' => $request->vendor,
|
|
'recourse_on' => $request->recourse_on,
|
|
'settlement_date' => $request->settlement_date,
|
|
'payout_frequency' => $request->payout_frequency,
|
|
'payment_obligor' => $request->payment_obligor,
|
|
'security_structure' => $request->security_structure,
|
|
]);
|
|
|
|
return response()->json(['status' => 200, 'message' => 'Invoice Discounting Details Updated Successfully']);
|
|
}
|
|
|
|
public function uploadAIF()
|
|
{
|
|
$slug = basename(request()->path());
|
|
$category = Category::where('slug', $slug)->first();
|
|
$text = $category->category_name;
|
|
$category_id = $category->id;
|
|
return view('Admin.Pages.manage_freeu_investment.upload-product.alternative-investment-fund', compact('text', 'category_id'));
|
|
}
|
|
|
|
public function uploadAIFFile(Request $request)
|
|
{
|
|
request()->validate([
|
|
'productFile' => 'required|mimes:xlx,xls,xlsx|max:2048'
|
|
]);
|
|
$category_type = $request->category_id;
|
|
$category = Category::find($request->category_id);
|
|
Excel::import(new AlternativeInvestmentFundImport($category_type), $request->file('productFile'));
|
|
return back()->with('success', "$category->category_name Imported Successfully.");
|
|
}
|
|
|
|
public function viewAIFAssets($id)
|
|
{
|
|
$alternativeInvestmentFund = Product::with('category', 'alternativeInvestmentFund')->alternativeInvestmentFund()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.view-product.alternative-investment-fund', compact('alternativeInvestmentFund'));
|
|
}
|
|
|
|
public function editAIFProduct($id)
|
|
{
|
|
$alternativeInvestmentFund = Product::with('category', 'alternativeInvestmentFund')->alternativeInvestmentFund()->find($id);
|
|
return view('Admin.Pages.manage_freeu_investment.edit-product.alternative-investment-fund', compact('alternativeInvestmentFund'));
|
|
}
|
|
|
|
public function updateAIFProduct(Request $request)
|
|
{
|
|
$request->validate([
|
|
'fund_name' => 'required'
|
|
]);
|
|
|
|
$alternativeInvestmentFund = AlternativeInvestmentFund::where('id', $request->id)->update([
|
|
'slug' => Str::slug($request->fund_name),
|
|
'fund_name' => $request->fund_name,
|
|
'registration_number' => $request->registration_number,
|
|
'fund_category' => $request->fund_category,
|
|
'fund_structure' => $request->fund_structure,
|
|
'fund_strategy' => $request->fund_strategy,
|
|
'fund_domicile' => $request->fund_domicile,
|
|
'fund_manager_name' => $request->fund_manager_name,
|
|
'website_of_the_fund' => $request->website_of_the_fund,
|
|
'fund_manager_experience' => $request->fund_manager_experience,
|
|
'sponsor' => $request->sponsor,
|
|
'manager' => $request->manager,
|
|
'trustee' => $request->trustee,
|
|
'auditor' => $request->auditor,
|
|
'valuer_tax_advisor' => $request->valuer_tax_advisor,
|
|
'credit_rating' => $request->credit_rating,
|
|
'open_date' => $request->open_date,
|
|
'first_close_date' => $request->first_close_date,
|
|
'final_close_date' => $request->final_close_date,
|
|
'tenure_from_final_date' => $request->tenure_from_final_date,
|
|
'commitment_period' => $request->commitment_period,
|
|
'native_currency' => $request->native_currency,
|
|
'target_corpus' => $request->target_corpus,
|
|
'investment_manager_contribution' => $request->investment_manager_contribution,
|
|
'minimum_capital_commitment' => $request->minimum_capital_commitment,
|
|
'intial_drawdown' => $request->intial_drawdown,
|
|
'accepting_overseas_investment' => $request->accepting_overseas_investment,
|
|
'target_irr' => $request->target_irr,
|
|
'management_fees_and_carry' => $request->management_fees_and_carry,
|
|
'hurdle_rate' => $request->hurdle_rate,
|
|
'other_expenses' => $request->other_expenses,
|
|
'focused_sectors_industries' => $request->focused_sectors_industries,
|
|
'regions_covered' => $request->regions_covered,
|
|
'isin_code' => $request->isin_code,
|
|
'focused_real_estate_sectors' => $request->focused_real_estate_sectors,
|
|
'rera_complied_property' => $request->rera_complied_property,
|
|
'return_on_investment' => $request->return_on_investment,
|
|
'valuation_per_sector' => $request->valuation_per_sector,
|
|
'focused_funds' => $request->focused_funds,
|
|
'trading_strategy' => $request->trading_strategy,
|
|
'involved_in_short_selling' => $request->involved_in_short_selling,
|
|
]);
|
|
|
|
return response()->json(['status' => 200, 'message' => 'Alternative Investment Fund Details Updated Successfully']);
|
|
}
|
|
}
|