Commit 4c4e5f7c by Hussain Mohamed

changes

parent 1ba39d4d
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\BrandProduct;
use App\Models\Country; use App\Models\Country;
use App\Models\Currency; use App\Models\Currency;
use App\Models\DistanceRequest; use App\Models\DistanceRequest;
use App\Models\IndustryProduct;
use App\Models\WebRequestModel; use App\Models\WebRequestModel;
use App\Models\LanguageModel; use App\Models\LanguageModel;
use App\Models\ManageRequestModel; use App\Models\ManageRequestModel;
...@@ -20,9 +22,13 @@ ...@@ -20,9 +22,13 @@
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use App\Models\Settings; use App\Models\Settings;
use App\Models\SizeModel;
use App\Models\SizeProduct;
use App\Models\SliderModel; use App\Models\SliderModel;
use Google\Service\AdExchangeBuyer\Product;
use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
class FrontendController extends Controller class FrontendController extends Controller
{ {
...@@ -47,6 +53,42 @@ public function products() ...@@ -47,6 +53,42 @@ public function products()
return view('products',compact('productType','brandData','industryData')); return view('products',compact('productType','brandData','industryData'));
} }
public function getProduct($name='')
{
$product = ProductModel::Where('product_slug',$name)->first();
$id = isset($product->id) ? $product->id:0;
if($id != '')
{
$brands = BrandProduct::from('product_brand as pb')
->leftJoin('brand as b', 'b.id', '=', 'pb.brand_id')
->where('pb.product_id', $id)
->select('b.brand','b.id')
->get();
$industrys = IndustryProduct::from('product_industry as pb')
->leftJoin('industry as b', 'b.id', '=', 'pb.industry_id')
->where('pb.product_id', $id)
->select('b.industry','b.id')
->get();
$size = SizeProduct::from('product_size as pb')
->leftJoin('size as b', 'b.id', '=', 'pb.size_id')
->where('pb.product_id', $id)
->select('b.size','b.id')
->get();
return view('product_detail',compact('product','size','industrys','brands'));
}
// $records = ProductModel::get();
// foreach($records as $row)
// {
// ProductModel::Where('id',$row->id)->update(array('product_slug'=>Str::slug($row->product_name)));
// }
}
public function getAjaxProducts(Request $request) public function getAjaxProducts(Request $request)
{ {
$offset = $request->get('offset', 0); $offset = $request->get('offset', 0);
......
...@@ -17,5 +17,11 @@ public function category() ...@@ -17,5 +17,11 @@ public function category()
} }
// public function brand()
// {
// return $this->belongsToMany(ProductBrandModel::class,'product_brand','product_id', 'brand_id');
// }
} }
...@@ -5263,11 +5263,12 @@ section, ...@@ -5263,11 +5263,12 @@ section,
} }
.filter-accordion .accordion-body div.active { .filter-accordion .accordion-body div.active {
font-weight: 600; color: #282828;
color: #fff; background: #eeeeee;
background: #024959; margin-right: 5px;
text-align: center;
border-radius: 12px; border-radius: 12px;
font-weight: 400;
width: 60%;
} }
...@@ -5276,6 +5277,11 @@ section, ...@@ -5276,6 +5277,11 @@ section,
overflow-y: auto; overflow-y: auto;
} }
#industry .accordion-body {
max-height: 250px;
overflow-y: auto;
}
.mb-10{ .mb-10{
margin-bottom: 10rem; margin-bottom: 10rem;
} }
...@@ -5309,6 +5315,19 @@ h2.htwo { ...@@ -5309,6 +5315,19 @@ h2.htwo {
animation: dotPulse .65s 0s infinite cubic-bezier(.21, .53, .56, .8); animation: dotPulse .65s 0s infinite cubic-bezier(.21, .53, .56, .8);
} }
/* Infinite Scrolling */
.et-loader {
position: relative;
padding-bottom: 30px;
margin-bottom: 30px;
}
.et-loader:after {
top: auto;
bottom: 0;
}
@keyframes dotPulse { @keyframes dotPulse {
0% { 0% {
-webkit-transform:scale(.1); -webkit-transform:scale(.1);
...@@ -5329,3 +5348,11 @@ h2.htwo { ...@@ -5329,3 +5348,11 @@ h2.htwo {
transform:scale(1.2); transform:scale(1.2);
opacity:0 } opacity:0 }
} }
.plink{
color:#282828;
font-size: 14px;;
}
.plink:hover{
color:#282828;
}
\ No newline at end of file
<?php <?php
use Illuminate\Support\Str;
if (isset($records)) { if (isset($records)) {
foreach ($records as $key => $row) { ?> foreach ($records as $key => $row) { ?>
<div class="col-lg-4 col-md-6 col-sm-12"> <div class="col-lg-4 col-md-6 col-sm-12">
<div class="product-card text-center"> <a class="plink" href="<?= route('products',[Str::slug($row->product_name)]) ?>"><div class="product-card text-center">
<img src="<?= ($row->product_image == '') ? asset('assets/img/placeholder.png'):$row->product_image ?>" class="img-fluid product-img" alt="Product"> <img src="<?= ($row->product_image == '') ? asset('assets/img/placeholder.png'):$row->product_image ?>" class="img-fluid product-img" alt="Product">
<h6 class="product-title mt-3"><?= ucwords($row->product_name) ?></h6> <h6 class="product-title mt-3"><?= ucwords($row->product_name) ?></h6>
</div> </div>
</a>
</div> </div>
<?php } <?php }
} }
......
@extends('app_layout')
@section('title','Contact Us')
@section('content')
<main class="main">
<div class="page-title ">
<div class="container">
<div class="row g-4">
<h1 class="hfive text-center">Products</h1>
<div class="col-lg-6">
</div>
<div class="col-lg-6">
<div class="container py-4">
<div class="row g-4" id="productList">
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
\ No newline at end of file
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<div class="accordion-body"> <div class="accordion-body">
<?php if (isset($productType)) { <?php if (isset($productType)) {
foreach ($productType as $row) { ?> foreach ($productType as $row) { ?>
<div><?= $row->type ?></div> <div><?php echo $row->type ?></div>
<?php } <?php }
} ?> } ?>
</div> </div>
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<div class="accordion-body"> <div class="accordion-body">
<?php if (isset($industryData)) { <?php if (isset($industryData)) {
foreach ($industryData as $row) { ?> foreach ($industryData as $row) { ?>
<div><?= $row->industry ?></div> <div><?php echo $row->industry ?></div>
<?php } <?php }
} ?> } ?>
</div> </div>
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<div class="accordion-body"> <div class="accordion-body">
<?php if (isset($brandData)) { <?php if (isset($brandData)) {
foreach ($brandData as $row) { ?> foreach ($brandData as $row) { ?>
<div><?= $row->brand ?></div> <div><?php echo $row->brand ?></div>
<?php } <?php }
} ?> } ?>
</div> </div>
...@@ -79,10 +79,7 @@ ...@@ -79,10 +79,7 @@
</div> </div>
<div class="text-center mt-4"> <div class="text-center mt-4">
<button id="loadMore" <span id="loadMore" class="btn et-loader"></span>
class="btn btn-outline-dark">
Load More
</button>
</div> </div>
</div> </div>
...@@ -106,41 +103,52 @@ ...@@ -106,41 +103,52 @@
let offset = 0; let offset = 0;
const limit = 6; const limit = 6;
$('#loadMore').hide();
function loadProducts(reset = false) { function loadProducts(reset = false) {
if (reset) { if (reset) {
offset = 0; offset = 0;
$('#productList').html(''); $('#productList').html('');
} }
$('#loadMore').show();
$.ajax({ $.ajax({
url: '<?= route('getProducts') ?>', url: '<?php echo route('getProducts') ?>',
type: 'GET', type: 'GET',
data: { data: {
offset: offset, offset: offset,
limit: limit limit: limit
}, },
success: function (data) { success: function(data) {
// if (data.length === 0) { // if (data.length === 0) {
// $('#loadMore').hide(); // $('#loadMore').hide();
// return; // return;
// } // }
$('#loadMore').hide();
$('#productList').append(data); $('#productList').append(data);
offset += limit; offset += limit;
} }
}); });
} }
// Initial Load // Initial Load
loadProducts(); loadProducts();
// Load More Click $(window).on('scroll', function() {
$('#loadMore').on('click', function () { if (
$(window).scrollTop() + $(window).height() >=
$(document).height() - 100
) {
loadProducts(); loadProducts();
}); }
});
// Load More Click
// $('#loadMore').on('click', function () {
// loadProducts();
// });
</script> </script>
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
Route::get('about-us', [FrontendController::class, 'about'])->name('about-us'); Route::get('about-us', [FrontendController::class, 'about'])->name('about-us');
Route::get('career', [FrontendController::class, 'career'])->name('career'); Route::get('career', [FrontendController::class, 'career'])->name('career');
Route::get('product', [FrontendController::class, 'products'])->name('product'); Route::get('product', [FrontendController::class, 'products'])->name('product');
Route::get('products/{name?}', [FrontendController::class, 'getProduct'])->name('products');
Route::match(['get','post'],'getProducts', [FrontendController::class, 'getAjaxProducts'])->name('getProducts'); Route::match(['get','post'],'getProducts', [FrontendController::class, 'getAjaxProducts'])->name('getProducts');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment