bugs solving
This commit is contained in:
33
app/Exports/UserProductExport.php
Normal file
33
app/Exports/UserProductExport.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\Admin\monthly_update_master;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
|
||||
class UserProductExport implements FromCollection, WithHeadings
|
||||
{
|
||||
// use Exportable;
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
|
||||
protected $data, $columns;
|
||||
function __construct($data, $columns)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->columns = $columns;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
// $data = monthly_update_master::select('')->get();
|
||||
return $this->data;
|
||||
}
|
||||
public function headings(): array
|
||||
{
|
||||
return $this->columns;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Exports\UserProductExport;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\MonthlyUpdateMaster;
|
||||
@@ -39,6 +40,33 @@ class ManageUserProductController extends Controller
|
||||
return view('Admin.Pages.manage_investors.manage_user_product.manage_user', compact('userProduct'));
|
||||
}
|
||||
|
||||
public function exportUserProduct()
|
||||
{
|
||||
// dd('hello');
|
||||
$data = MonthlyUpdateMaster::with(
|
||||
['investor' => function($query){
|
||||
$query->select('id','name');
|
||||
// },'products.categorys' => function($query){
|
||||
// $query->select('id','categories_id');
|
||||
// }])->select('id','users_id','products_id','custom_id')->get();
|
||||
},'products.categorys'])->get();
|
||||
// dd($data->toArray());
|
||||
$withClearData = collect();
|
||||
$new = [];
|
||||
$data->each(function($value) use($withClearData, $new){
|
||||
$new['user_name'] = $value->investor->name;
|
||||
$new['custom_id'] = $value->custom_id;
|
||||
$new['investor_name'] = $value->investor->name;
|
||||
$new['category'] = $value->products->categorys->category_name;
|
||||
$new['holding_status'] = $value->holding_status;
|
||||
$new['created_at'] = $value->created_at->format('d-m-Y');
|
||||
$withClearData->push($new);
|
||||
});
|
||||
$columns = ['User Name', 'CustomId', 'Investor Name', 'Category', 'Holding Status', 'Created At'];
|
||||
// dd($withClearData->sortByDesc('created_at'));
|
||||
return Excel::download(new UserProductExport($withClearData->sortByDesc('created_at'), $columns), 'UsersProduct.XLSX');
|
||||
}
|
||||
|
||||
public function redeemWithSoldAmount(Request $request)
|
||||
{
|
||||
// dd($request->all());
|
||||
|
||||
@@ -1028,7 +1028,7 @@ class AuthController extends Controller
|
||||
// 'otp' => $otp
|
||||
// ]);
|
||||
$insertOtp = User::where('contact_number', $contactNumber)->update([
|
||||
'expire_at' => Carbon::now()->addMinutes('5'),
|
||||
'expire_at' => Carbon::now()->addMinutes('2'),
|
||||
'otp' => $otp
|
||||
]);
|
||||
if (!$insertOtp) {
|
||||
|
||||
@@ -73,7 +73,7 @@ $("#addCategoryForm").validate({
|
||||
// $("#save_btn").text("Please wait...");
|
||||
// $("#save_btn").attr("disabled", true);
|
||||
$.ajax({
|
||||
url: "/freeU_investment/manage-investments/categories/add",
|
||||
url: "/manage-investments/categories/add",
|
||||
type: "POST",
|
||||
data: formData,
|
||||
processData: false,
|
||||
@@ -139,7 +139,8 @@ $("#editCategoryForm").validate({
|
||||
// $("#save_btn").text("Please wait...");
|
||||
// $("#save_btn").attr("disabled", true);
|
||||
$.ajax({
|
||||
url: "/freeU_investment/manage-investments/categories/edit",
|
||||
url: "/manage-investments/categories/edit",
|
||||
// url: "{{route('manage.categories.edit')}}",
|
||||
type: "POST",
|
||||
data: formData,
|
||||
headers: {
|
||||
@@ -174,7 +175,7 @@ $('#deleteCategoryForm').submit(function(e){
|
||||
e.preventDefault();
|
||||
var id = $('#delete_category_id').val();
|
||||
$.ajax({
|
||||
url: "/freeU_investment/manage-investments/categories/delete",
|
||||
url: "/manage-investments/categories/delete",
|
||||
type: "delete",
|
||||
headers: {
|
||||
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content"),
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
<div class="top_header d-flex justify-content-between">
|
||||
<p class='fs-2 fw-bold'>Manage User Product</p>
|
||||
<div class="table_right_options d-flex align-items-center">
|
||||
|
||||
<a class="action_icon" href="{{ route('store-user-product') }}">
|
||||
<button type="button" class="btn btn-light-primary me-3">
|
||||
<!--begin::Svg Icon | path: icons/duotune/arrows/arr075.svg-->
|
||||
@@ -90,6 +89,9 @@
|
||||
Financial Assets</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<a class="action_icon" href="{{ route('export-user-product') }}">
|
||||
<button type="button" class="btn btn-light-primary me-3">Export</button>
|
||||
</a>
|
||||
|
||||
<!--begin::Search-->
|
||||
<div class="d-flex align-items-center position-relative">
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
<div class="categeory">
|
||||
<div class="details aos-init aos-animate" data-aos="zoom-in">
|
||||
<div class="tables">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-12">
|
||||
<p>Description</p>
|
||||
<span>{{ $productData->description ?? '-' }}</span>
|
||||
</div>
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
@if ($logged_in)
|
||||
@if (!$ownProduct)
|
||||
@if (!$invested)
|
||||
<a href="{{ route('buyerForm', $offering->slug) }}" class="yellow-btn grow_skew_forward"
|
||||
{{-- <a href="{{ route('buyerForm', $offering->slug) }}" class="yellow-btn grow_skew_forward" --}}
|
||||
<a href="#" onclick="showDeactivatePopup('{{ route('buyerForm', $offering->slug) }}')" class="yellow-btn grow_skew_forward"
|
||||
id="" data-product-id="{{ $offering->products_id }}"
|
||||
data-bs-target="#recipes-pop-four">Show Interest</a>
|
||||
@else
|
||||
@@ -23,7 +24,8 @@
|
||||
id="" data-product-id="{{ $offering->products_id }}"
|
||||
data-bs-target="#recipes-pop-four">Added To
|
||||
Investment Watchlist!</a> --}}
|
||||
<a href="{{ route('editBuyerForm', $offering->slug) }}" class="yellow-btn grow_skew_forward"
|
||||
{{-- <a href="{{ route('editBuyerForm', $offering->slug) }}" class="yellow-btn grow_skew_forward" --}}
|
||||
<a href="#" onclick="showDeactivatePopup('{{ route('buyerForm', $offering->slug) }}')" class="yellow-btn grow_skew_forward"
|
||||
id="" data-product-id="{{ $offering->products_id }}"
|
||||
data-bs-target="#recipes-pop-four"
|
||||
style="
|
||||
|
||||
@@ -367,7 +367,13 @@
|
||||
</div>
|
||||
|
||||
</li>
|
||||
<li class="{{ Request::routeIs('market-list') ? 'active_page' : '' }}"><a href="{{ route('market-list') }}">List Your Asset</a></li>
|
||||
<li class="{{ Request::routeIs('market-list') ? 'active_page' : '' }}">
|
||||
@if(!auth()->guard('users')->check())
|
||||
<a href="{{ route('market-list') }}">List Your Asset</a>
|
||||
@else
|
||||
<a class="dropdown-item" href="#" onclick="showDeactivatePopup('{{ route('market-list') }}')">List Your Asset</a>
|
||||
@endif
|
||||
</li>
|
||||
{{-- href="{{ route('market-list') }}" --}}
|
||||
|
||||
|
||||
|
||||
@@ -601,6 +601,7 @@ Route::middleware([BackendAccess::class])->group(function () {
|
||||
Route::controller(ManageUserProductController::class)->group(function () {
|
||||
Route::get("manage-user-product", 'index')->name('manage-user-product');
|
||||
Route::get("store-user-product", 'storeUserProduct')->name('store-user-product');
|
||||
Route::get("export-user-product", 'exportUserProduct')->name('export-user-product');
|
||||
Route::get('userProduct/{id}', 'userProduct')->name('userProduct');
|
||||
Route::get("import-monthly-updates", 'importMonthlyUpdateBlade')->name('import-monthly-updates');
|
||||
Route::get("monthly-updates/{id}", 'monthlyUpdates')->name('monthly-updates');
|
||||
|
||||
Reference in New Issue
Block a user