Commit 0a74ca97 by Hussain Mohamed

chnages

parent 617c3fde
......@@ -5,6 +5,7 @@
use App\Http\Controllers\Controller;
use App\Models\BrandProduct;
use App\Models\CategoryModel;
use App\Models\Country;
use App\Models\Currency;
use App\Models\DistanceRequest;
......@@ -33,11 +34,11 @@
class FrontendController extends Controller
{
public function index(Request $request)
{
$slidersData = SliderModel::Where('status',1)->get();
return view('index',compact('slidersData'));
{
$slidersData = SliderModel::Where('status', 1)->get();
return view('index', compact('slidersData'));
// return view('maintain');
}
......@@ -48,50 +49,48 @@ public function contact()
public function products()
{
$productType = ProductTypeModel::Where('status',1)->get();
$brandData = ProductBrandModel::Where('status',1)->get();
$industryData = ProductIndustryModel::Where('status',1)->get();
return view('products',compact('productType','brandData','industryData'));
$productType = CategoryModel::Where('status', 1)->get();
$brandData = ProductBrandModel::Where('status', 1)->get();
$industryData = ProductIndustryModel::Where('status', 1)->get();
return view('products', compact('productType', 'brandData', 'industryData'));
}
public function getProduct($name='')
public function getProduct($name = '')
{
$product = ProductModel::Where('product_slug',$name)->first();
$id = isset($product->id) ? $product->id:0;
if($id != '')
{
$record = ProductModel::with('category')->Where('id',$id)->first();
$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();
$product = ProductModel::Where('product_slug', $name)->first();
$id = isset($product->id) ? $product->id : 0;
if ($id != '') {
$record = ProductModel::with('category')->Where('id', $id)->first();
$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();
$productItems = ProductAttributeModel::Where('product_id', $id)->get();
$productItems = ProductAttributeModel::Where('product_id', $id)->get();
return view('product_detail', compact('record', 'size', 'industrys', 'brands', 'productItems'));
}
return view('product_detail',compact('record','size','industrys','brands','productItems'));
// $records = ProductModel::get();
// foreach($records as $row)
// {
// ProductModel::Where('id',$row->id)->update(array('product_slug'=>Str::slug($row->product_name)));
// }
}
// $records = ProductModel::get();
// foreach($records as $row)
// {
// ProductModel::Where('id',$row->id)->update(array('product_slug'=>Str::slug($row->product_name)));
// }
}
......@@ -99,31 +98,45 @@ public function getAjaxProducts(Request $request)
{
$offset = $request->get('offset', 0);
$limit = $request->get('limit', 12);
$categoryId = $request->get('category_id');
$brandId = $request->get('brand_id');
$industryId = $request->get('industry_id');
$categoryId = $request->get('category');
$brandId = $request->get('brand');
$industryId = $request->get('industry');
DB::enableQueryLog();
$products = ProductModel::query()->from('products as p')
->leftJoin('product_attributes as pi', 'pi.product_id', '=', 'p.id')
->select(['p.id', 'p.product_name', 'pi.product_image']);
// 🔹 Filter: Category
if ($categoryId) {
$products->where('p.category_id', $categoryId);
}
$products = ProductModel::query()->from('products as p')
->leftJoin('product_attributes as pi','pi.product_id','=','p.id')
->select(['p.id','p.product_name','pi.product_image']);
// 🔹 Filter: Category
if ($categoryId) {
$products->where('p.category_id', $categoryId);
}
// 🔹 Filter: Brand
if ($brandId) {
$products->where('pa.brand_id', $brandId);
}
// Brand filter (pivot)
if ($brandId) {
$products->whereExists(function ($q) use ($brandId) {
$q->select(DB::raw(1))
->from('product_brand as pb')
->whereColumn('pb.product_id', 'p.id')
->where('pb.brand_id', $brandId);
});
}
// 🔹 Filter: Industry
if ($industryId) {
$products->where('pa.industry_id', $industryId);
}
// Industry filter (pivot)
if ($industryId) {
$products->whereExists(function ($q) use ($industryId) {
$q->select(DB::raw(1))
->from('product_industry as pi2')
->whereColumn('pi2.product_id', 'p.id')
->where('pi2.industry_id', $industryId);
});
}
$records = $products->offset($offset)
->limit($limit)->get();
return view('ajax_products',compact('records','offset','limit'));
$records = $products->offset($offset)
->limit($limit)->get();
// $d = DB::getRawQueryLog();
//dd($d);
return view('ajax_products', compact('records', 'offset', 'limit'));
}
public function career()
......@@ -133,16 +146,16 @@ public function career()
public function privacy_policy()
{
$record = PagesModel::Where('type',1)->first();
$type = 1;
return view('pages',compact('record','type'));
$record = PagesModel::Where('type', 1)->first();
$type = 1;
return view('pages', compact('record', 'type'));
}
public function terms_condition()
{
$record = PagesModel::Where('type',2)->first();
$type = 2;
return view('pages',compact('record','type'));
$record = PagesModel::Where('type', 2)->first();
$type = 2;
return view('pages', compact('record', 'type'));
}
public function about()
......@@ -154,495 +167,4 @@ public function vendor()
{
return view('vendor');
}
public function getCurrencyByCountry(Request $request)
{
$countryId = $request->country_id;
$country = Country::where('iso3', $countryId)->first();
if (!$country) {
return response()->json(['status' => false, 'message' => 'Country not found']);
}
$currencyCode = $country->currency_code;
$currency = Currency::where('code', $currencyCode)->first();
if (!$currency) {
return response()->json(['status' => false, 'message' => 'Currency not found']);
}
return response()->json([
'status' => true,
'currency' => $currency
]);
}
public function requestWaiting($token)
{
try {
$data = Crypt::decrypt($token);
} catch (\Exception $e) {
return redirect('/'); // bad token -> redirect
}
$request_id = $data['request_id'];
$web_time = $data['web_time'];
$service = $data['service'];
// Fetch request data with joins
$data = WebRequestModel::leftJoin('service_type', 'service_type.id', '=', 'web_request.service_type')
->leftJoin('countries', 'countries.id', '=', 'web_request.country')
->select([
'web_request.service_type as service_type_id',
'service_type.service_type as service_type',
'countries.name as country',
'countries.id as countryId',
'web_request.location',
'web_request.day_rate_min',
'web_request.day_rate_max',
'web_request.night_rate_min',
'web_request.night_rate_max',
'web_request.availability',
'web_request.language',
])
->where('web_request.request_id', $request_id)
->first();
//dd($data);
// --------------------- Language ---------------------
// If language column has IDs like "1,2", fetch names
$languageNames = [];
if (isset($data->language)) {
$languageIds = explode(',', $data->language); // ["1", "2"]
$languageNames = LanguageModel::whereIn('id', $languageIds)->pluck('name')->toArray();
}
$languages = !empty($languageNames) ? implode(', ', $languageNames) : 'N/A';
// --------------------- Availability ---------------------
// Now pass to Blade
$requestData = (object) [
'service_type' => $data->service_type ?? 'N/A',
'service_type_id' => $data->service_type_id,
'countryId' => $data->countryId ?? 'India',
'location' => $data->location ?? 'N/A',
'hour_min' => $data->day_rate_min ?? 0,
'hour_max' => $data->day_rate_max ?? 0,
'night_min' => $data->night_rate_min ?? 0,
'night_max' => $data->night_rate_max ?? 0,
'availability' => $data->availability,
'languages' => $languages
];
//dd($data);
$countryModels = Country::get();
$languageModels = LanguageModel::get();
$serviceTypeModels = ServiceTypeModel::get();
return view('request-waiting', compact('serviceTypeModels', 'countryModels', 'languageModels', 'request_id', 'web_time', 'service', 'requestData'));
}
public function sendRequest(Request $request)
{
$service = $request->input('service') == 5 ? 1 : $request->input('service');
$languages = $request->input('languages');
$languages_csv = !empty($languages) ? implode(',', $languages) : null;
$countryInput = $request->input('country'); // can be name, iso2, or iso3
$country_id = null;
// If country is sent, find country by name OR iso2 OR iso3
if (!empty($countryInput)) {
$country = DB::table('countries')
->where('name', $countryInput)
->orWhere('iso2', $countryInput)
->orWhere('iso3', $countryInput)
->first();
if ($country) {
$country_id = $country->id;
}
}
// Now $country_id contains the final ID FROM table
$preferred_location = $request->input('preferred_location');
$latitude = $request->input('latitude');
$longitude = $request->input('longitude');
$hourly_min = $request->input('hourly_min');
$hourly_max = $request->input('hourly_max');
$nightly_min = $request->input('nightly_min');
$nightly_max = $request->input('nightly_max');
$availability = $request->input('availability', 3);
$request_id = strtoupper(uniqid());
$app_time = Settings::value('app_time');
// $start_time = now()->timezone('Asia/Kolkata');
// $end_time = now()->timezone('Asia/Kolkata')->addSeconds($app_time);
$timezone = DB::table('country_timezones as ct')
->join('timezones as t', 't.id', '=', 'ct.timezone_id')
->where('ct.country_iso3', $countryInput)
->where('ct.is_default', 1)
->value('t.timezone'); // ✅ string
$timezone = $timezone ?? 'IND';
$start_time = now($timezone);
$end_time = now($timezone)->addSeconds($app_time);
//dd($start_time, $start_time1, $end_time, $end_time1);
$insertArray = array(
'request_id' => $request_id,
'service_type' => $service,
'country' => $country_id,
'day_rate_min' => $hourly_min,
'day_rate_max' => $hourly_max,
'night_rate_min' => $nightly_min,
'night_rate_max' => $nightly_max,
'availability' => $availability,
'language' => $languages_csv,
'location' => $preferred_location,
'latitude' => $latitude,
'longitude' => $longitude,
'start_time' => $start_time,
'end_time' => $end_time,
);
WebRequestModel::create($insertArray);
$km = $request->input('service') != 4 ? 5 : 0;
$getServicesUserIds = $this->getrequestBasedServices($request_id, $km);
if ($getServicesUserIds) {
sendTestRequestNotification('FindFlicker', 'New-request notification from FindFlicker', $getServicesUserIds);
}
// $request_id = "692AA2759D1E5";
$web_time = Settings::value('web_time');
$encrypted = Crypt::encrypt([
'request_id' => $request_id,
'web_time' => $web_time,
'service' => $service,
]);
// return redirect()->route('request.waiting', [
// 'request_id' => $request_id,
// 'web_time' => $web_time,
// 'service' => $service
// ]);
return redirect()->route('request.waiting', ['token' => $encrypted]);
//return view('request-waiting', compact('request_id', 'web_time', 'service'));
}
public function getrequestBasedServices($requestId, $distance = null)
{
try {
$requestModel = WebRequestModel::where('request_id', $requestId)->first();
if (!$requestModel) {
return []; // return empty array
}
$serviceType = $requestModel->service_type;
if ($serviceType != 4) {
$range = $this->rangeController->getLatLngRange(
$requestModel->latitude,
$requestModel->longitude,
$distance
);
}
$availability = $requestModel->availability;
$languagesCsv = $requestModel->language ?? null;
$country = $requestModel->country;
$hourly_min = $requestModel->day_rate_min;
$hourly_max = $requestModel->day_rate_max;
$nightly_min = $requestModel->night_rate_min;
$nightly_max = $requestModel->night_rate_max;
$languages = $languagesCsv ? explode(',', $languagesCsv) : [];
// dd([
// 'all_fields' => $requestModel->toArray(),
// 'languages_value' => $requestModel->language,
// 'language_value' => $requestModel->language ?? null
// ]);
$query = DB::table('service')
->leftJoin('advertisement as ad', 'ad.service_id', '=', 'service.id')
->where('service_type', $serviceType);
if (in_array($availability, [1, 2])) {
$query->where('availability', $availability);
}
if ($country) {
$query->where('country_id', $country);
}
if ($serviceType != 4) {
$query->whereBetween('ad.latitiude', [$range['min_lat'], $range['max_lat']]);
$query->whereBetween('ad.logitude', [$range['min_lng'], $range['max_lng']]);
}
if (!empty($languages)) {
$query->where(function ($q) use ($languages) {
foreach ($languages as $lang) {
$q->orWhereRaw("FIND_IN_SET(?, language)", [$lang]);
}
});
}
// Day rate overlap
if ($hourly_min && $hourly_max) {
$query->where(function ($q) use ($hourly_min, $hourly_max) {
$q->where('day_rate_min', '<=', $hourly_max)
->where('day_rate_max', '>=', $hourly_min);
});
}
// Night rate overlap
if ($nightly_min && $nightly_max) {
$query->where(function ($q) use ($nightly_min, $nightly_max) {
$q->where('night_rate_min', '<=', $nightly_max)
->where('night_rate_max', '>=', $nightly_min);
});
}
// Fetch services
$services = $query->select(
'service.id as service_id',
'service.country_id',
'service.user_id',
'service.service_type',
'service.title',
'service.description',
'service.photo',
'service.day_rate_min',
'service.day_rate_max',
'service.night_rate_min',
'service.night_rate_max',
'service.availability',
'service.language',
'service.created_at',
'service.updated_at',
)
->groupBy('service.id')
->get();
// ->pluck('user_id')
// ->toArray();
$app_time = Settings::value('app_time');
// $start_time = now()->timezone('Asia/Kolkata');
// $end_time = now()->timezone('Asia/Kolkata')->addSeconds($app_time);
$iso3 = Country::where('id', $requestModel->country)->value('iso3');
// get default timezone
$timezone = DB::table('country_timezones as ct')
->join('timezones as t', 't.id', '=', 'ct.timezone_id')
->where('ct.country_iso3', $iso3)
->where('ct.is_default', 1)
->value('t.timezone') ?? 'UTC';
$start_time = now($timezone);
$end_time = now($timezone)->addSeconds($app_time);
$createdUserIds = []; // store only created ones
for ($i = 0; $i < count($services); $i++) {
if ($serviceType != 4) {
$exists = DistanceRequest::where('requestId', $requestId)
->where('service_id', $services[$i]->service_id)
->where('distance', $distance)
->exists();
if (! $exists) {
DistanceRequest::create([
'requestId' => $requestId,
'distance' => $distance,
'service_id' => $services[$i]->service_id,
'range_km' => json_encode($range),
'userIds' => $services[$i]->user_id,
'start_time' => $start_time,
'end_time' => $end_time,
]);
// store only new created userId
$createdUserIds[] = $services[$i]->user_id;
}
} else {
$inserted = DistanceRequest::create([
'requestId' => $requestId,
'distance' => $distance,
'service_id' => $services[$i]->service_id,
'range_km' => null,
'userIds' => $services[$i]->user_id,
'start_time' => $start_time,
'end_time' => $end_time,
]);
// store only new created userId
$createdUserIds[] = $services[$i]->user_id;
}
}
$createdUserIds = array_values(array_unique($createdUserIds));
// remove duplicates (if any)
// return only created user IDs
return $createdUserIds;
} catch (\Exception $e) {
// log error
Log::error("getrequestBasedServices error: " . $e->getMessage(), [
'request_id' => $requestId,
'distance' => $distance
]);
return []; // safe fallback
}
}
public function getAcceptedrequests(Request $request)
{
$id = $request->query('id'); // GET parameter 'id' // get only active records
$models = ManageRequestModel::where('request_id', $id)->where('type', 1)->get();
if ($models->isEmpty()) {
return response()->json([
'data' => []
]);
}
$serviceIds = $models->pluck('service_id')->unique()->toArray();
$services = Service::whereIn('id', $serviceIds)->get()->keyBy('id');
$responseData = [];
foreach ($models as $model) {
$service = $services[$model->service_id] ?? null;
$serviceType = ServiceTypeModel::find($service->service_type);
$languageIds = !empty($service->language)
? explode(',', $service->language)
: [];
$languageNames = LanguageModel::whereIn('id', $languageIds)
->pluck('name')
->toArray();
$languageText = implode(', ', $languageNames);
$firstImage = null;
if (!empty($service->photo)) {
$images = explode(',', $service->photo);
$firstImage = trim($images[0]);
}
$badgePath = null;
if (isset($serviceType->id)) {
switch ($serviceType->id) {
case 1:
$badgePath = asset('assets/image/svg/escordagency.svg');
break;
case 2:
$badgePath = asset('assets/image/svg/indipentant_badge.svg');
break;
case 3:
$badgePath = asset('assets/image/svg/message_badge.svg');
break;
default:
$badgePath = asset('assets/image/svg/audio_video_call_badge.svg'); // or some default badge
break;
}
}
$responseData[] = [
'request_id' => $model->request_id,
'id' => $service->id ?? null,
'title' => $service->title ?? null,
'serviceImage' => $firstImage,
'badge_image' => $badgePath,
'language' => $languageText ?? null,
'service_type' => $serviceType->service_type ?? null,
];
}
return response()->json([
'data' => $responseData
]);
}
public function showVendor(Request $request, $serviceId)
{
$requestId = $request->input('request_id');
$serviceModel = Service::where('id', $serviceId)->first();
$requestModel = WebRequestModel::where('request_id', $requestId)
->first();
//dd($requestModel);
// Your logic here
return view('vendor', compact('serviceId', 'requestId', 'serviceModel', 'requestModel'));
}
public function storeUserVendorView(Request $request)
{
$request_id = $request->request_id;
$service_id = $request->service_id;
// Check if already exists
$exists = DB::table('user_view_vendor')
->where('request_id', $request_id)
->where('service_id', $service_id)
->exists();
if (!$exists) {
DB::table('user_view_vendor')->insert([
'request_id' => $request_id,
'service_id' => $service_id,
'created_at' => now(),
'updated_at' => now()
]);
}
return response()->json(['status' => 'success']);
}
}
......@@ -2402,6 +2402,33 @@ section,
margin: 10px 0 20px;
}
.category-card a {
padding: 5px 5px;
padding-left: 20px;
display: inline-flex;
font-size:12px;
align-items: center;
position: relative;
transition: background-color 0.3s ease, color 0.3s ease;
}
.category-card a i {
font-size: 14px;
text-align: center;
opacity: 0; /* Hide arrow by default */
transition: opacity 0.3s ease, transform 0.3s ease;
}
.category-card .teal-btn {
border: 2px solid rgb(255, 255, 255);
color: #ffffff;
}
.category-card .sand-btn {
border: 2px solid black;
color: #000;
}
.bg-sand {
background-color: #E4D8D3;
}
......@@ -2410,10 +2437,15 @@ section,
background-color: #1f9c96;
}
.category-card img {
max-height: 180px;
.category-card a:hover i {
opacity: 1; /* Show the arrow */
transform: translateX(5px); /* Move the arrow slightly to the right */
}
.category-card img {
max-height: 230px;
}
/*--------------------------------------------------------------
# Team Section
......@@ -4421,7 +4453,17 @@ section,
background-color: transparent;
}
.contact ,.form-container ,.btn-submit {
.contact .form-container .btn-submit {
background-color: #038c7f;
border: 2px solid #038c7f;
padding: 12px 30px;
color: #ffffff;
border-radius: 0;
transition: 0.3s;
width: 150px;
}
.btnsubmit {
background-color: #038c7f;
border: 2px solid #038c7f;
padding: 12px 30px;
......
public/assets/img/accessories.png

61.8 KB | W: | H:

public/assets/img/accessories.png

332 KB | W: | H:

public/assets/img/accessories.png
public/assets/img/accessories.png
public/assets/img/accessories.png
public/assets/img/accessories.png
  • 2-up
  • Swipe
  • Onion skin
public/assets/img/aircon.png

57 KB | W: | H:

public/assets/img/aircon.png

247 KB | W: | H:

public/assets/img/aircon.png
public/assets/img/aircon.png
public/assets/img/aircon.png
public/assets/img/aircon.png
  • 2-up
  • Swipe
  • Onion skin
public/assets/img/monitor-3.png

79.8 KB | W: | H:

public/assets/img/monitor-3.png

503 KB | W: | H:

public/assets/img/monitor-3.png
public/assets/img/monitor-3.png
public/assets/img/monitor-3.png
public/assets/img/monitor-3.png
  • 2-up
  • Swipe
  • Onion skin
@include('base.header')
<style>
#ageModal {
display: none;
/* important */
}
.alertpopup {
z-index: 9999;
margin-top: -10px !important;
}
.location-search-container {
/* New styles for centering the input within its container */
display: flex;
/* Enable Flexbox */
justify-content: center;
/* Center horizontally */
align-items: center;
/* Center vertically (if needed) */
}
/* Ensure the input itself doesn't stretch beyond a readable width,
or allow it to take the full width if that's desired for mobile UX */
.location-search-container input {
max-width: 80%;
/* Limit width to 80% of the container for a centered look */
}
.select2-container {
width: 374.604px !important;
}
</style>
@if (session('no_data'))
<div class="toast-container position-fixed top-0 start-50 translate-middle-x p-3 mt-4 alertpopup" style="">
<div id="errorToast" class="toast show" role="alert"
style="min-width: 250px; border-radius:10px; box-shadow:0 4px 12px rgba(0,0,0,0.2);">
<div class="d-flex align-items-center p-3">
<span class="me-3 text-danger fs-3">❗</span>
<span class="flex-grow-1 fs-5">{{ session('no_data') }}</span>
<button type="button" class="btn-close ms-2" data-bs-dismiss="toast"></button>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<script>
var toastEl = document.getElementById('errorToast');
var toast = new bootstrap.Toast(toastEl, {
delay: 3000
});
toast.show();
</script>
@endif
<!-- ================= SERVICE FORM START ================= -->
<!-- jQuery FIRST -->
<div class="request_container">
<div class="request_container">
</div>
<div class="request_heading_bold"></div>
<div class="home-title">
<p class="form-title text-center mb-4 mt-5">Welcome to <strong>Find Flicker</strong><br> Your Convenient
Service
Connection</>
</div>
<form action="{{ route('sendRequest') }}" method="POST">
@csrf
<div class="row main_form-con px-4 py-4 ">
<input type="hidden" id="full_address">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<label class="form-label">Service*</label>
<select id="service_input" class="custom-input " name="service">
<button>
<selectedcontent></selectedcontent>
</button>
{{-- <option value="Escorts">Escorts </option>
<option value="Individual">Individual </option>
<option value="Spa&Massage">Spa & Massage </option>
<option value="Audio&VideoCalls">Audio & Video Calls </option>
<option value="All">All </option> --}}
@foreach ($serviceTypeModels as $serviceTypeModel)
<option value="{{ $serviceTypeModel->id }}">{{ $serviceTypeModel->service_type }}</option>
@endforeach
</select>
</div>
</div>
<div class="row country-section mt-3">
<div class="col-md-4"></div>
<div class="col-md-4">
<label class="form-label">Country*</label>
<select class="custom-input" id="countrySelect" name="country" style="width: 374.604px!important;">
<option value="">Select Country</option>
@foreach ($countryModels as $country)
<option value="{{ $country->iso3 }}" data-flag="{{ $country->country_flag }}">
{{ $country->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="row language-section mt-3" style="display:none!important">
<div class="col-md-4"></div>
<div class="col-md-5">
<label class="form-label">Language</label>
<div class="multi-select-box">
<select class="custom-input" id="languageSelect" name="languages[]" multiple
style="width: 374.604px!important;">
<option value="">Select Language</option>
@foreach ($languageModels as $languageModel)
<option value="{{ $languageModel->id }}">{{ $languageModel->name }}</option>
@endforeach
</select>
</div>
</div>
</div>
<div class="row location-section mt-3">
<div class="col-md-4"></div>
<div class="col-md-4">
<label class="form-label">Location*</label>
<div class="input-group">
<span class="input-group-text icon-bg">
<i class="fa-solid fa-location-dot"></i>
</span>
<input type="text" id="preferred_location" name="preferred_location"
oninput="getPreferedLocation()" class="form-control custom-input"
placeholder="Enter your preferred location" autocomplete="off" value="">
</div>
<div style="display: flex; align-items: center; gap: 5px;margin-top:15px">
<img class="location-icon" src="{{ asset('assets') }}/image/icon 2.png" alt="Location Icon"
style="height: 20px; width: 20px;">
<a href="javascript:void(0)" class="current-location" onclick="fetchAddress()">
<h6 style="margin: 0; text-decoration: underline;">Use current location</h6>
</a>
</div>
</div>
</div>
<div class="row price-section mt-3">
<div class="col-md-4"> </div>
<div class="col-md-8 mb-1 ">
<label class="form-label">Hourly Price</label>
</div>
<div class="col-md-4"> </div>
<div class="col-md-2 mb-3">
<div class="input-group">
<span class="input-group-text icon-bg PriceSymbol">$</span>
<input type="text" name="hourly_min" id="hourly_min" class="form-control custom-input"
placeholder="1000" oninput="this.value = this.value.replace(/[^0-9]/g, '');">
</div>
</div>
<div class="col-md-2 mb-3">
<div class="input-group">
<span class="input-group-text icon-bg PriceSymbol">$</span>
<input type="text" name="hourly_max" id="hourly_max" class="form-control custom-input"
placeholder="10000" oninput="this.value = this.value.replace(/[^0-9]/g, '');">
</div>
</div>
<div class="col-md-4"> </div>
<div class="col-md-4"> </div>
<div class="col-md-8 mt-2 mb-1 ">
<label class="form-label ">Nightly Price</label>
</div>
<div class="col-md-4"> </div>
<div class="col-md-2 mb-3 ">
<div class="input-group ">
<span class="input-group-text icon-bg PriceSymbol">$</span>
<input type="text" name="nightly_min" id="nightly_min"class="form-control custom-input"
placeholder="10000">
</div>
</div>
<div class="col-md-2 mb-3 ">
<div class="input-group">
<span class="input-group-text icon-bg PriceSymbol">$</span>
<input type="text" name="nightly_max" id="nightly_max" class="form-control custom-input"
placeholder="20000">
</div>
</div>
<input type="hidden" name="latitude" value="" id="formLatitude">
<input type="hidden" name="longitude" value="" id="formLangValue">
<!-- SERVICE AVAILABILITY -->
<div class="row mb-3">
<div class="col-md-4"></div>
<div class="col-md-4">
<label class="form-label">Service Availability</label>
<div class="d-flex gap-4 align-items-center">
<label class="mb-0">
<input type="radio" name="availability" value="1"> Incall
</label>
<label class="mb-0">
<input type="radio" name="availability" value="2"> Outcall
</label>
<label class="mb-0">
<input type="radio" name="availability" value="3"> Both
</label>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-4 "> </div>
<div class="col-lg-4 mt-3 text-center ">
<button class="submit-btn w-100" id="sendRequestBtn">Send Request</button>
</div>
</div>
</div>
</form>
</div>
<div id="ageModal" class="age-overlay">
<div class="age-popup">
<div class="age-icon">18+</div>
<h2 class="age-title">ADULTS ONLY</h2>
<p class="age-text">
This website contains content intended for adults 18 years and older.
By entering, you confirm that you are at least 18 years old and understand
that this site may contain adult-oriented material.
</p>
<h3 class="age-question">Are you 18 years of age or older?</h3>
<div class="age-btn-group">
<button class="btn-no" id="btnNo">No, Take Me Back</button>
<button class="btn-yes" id="btnYes">Yes, I'm 18+</button>
</div>
</div>
</div>
<div id="mapModal" class="modal" style="display:none;">
<div class="modal-content p-3">
<div class="modal-title">
Pick your places
<button class="close-modal-btn" onclick="closeMapModal()">×</button>
</div>
<div class="location-search-container mt-3 mb-3">
<input type="text" id="locationSearchInput" placeholder="Search for a location..."
class="form-control custom-input">
</div>
<div class="map-modal-div mt-2" id="map"></div>
<p class="mt-2"><b>Full Address:</b> <br><span class="address-text" id="fullAddress"></span></p>
<p><b>Short Address:</b> <br> <span class="address-text" id="shortAddress"></span></p>
{{-- <p style="display: none"><b>Latitude:</b> <span id="latValue">--</span></p>
<p style="display: none"><b>Longitude:</b> <span id="lngValue">--</span></p> --}}
<button onclick="saveLocation()" class="btn map-button">Save location</button>
</div>
</div>
@include('base.footer')
<script>
// Run on page load
</script>
<script>
let map, marker, geocoder;
let selectedLat = null;
let selectedLng = null;
function formatCountry(option) {
if (!option.id) return option.text;
const flag = $(option.element).data('flag');
return $(`
<span style="display:flex;align-items:center;gap:8px;">
<img src="${flag}"
style="width:18px;height:14px;border-radius:2px;object-fit:cover;" />
<span>${option.text}</span>
</span>
`);
}
function validateForm() {
console.log("working");
const service = $('#service_input').val();
const languageVals = $('#languageSelect').val();
const country = $('#countrySelect').val();
let locationRaw = $('#preferred_location').val();
console.log("RAW =", JSON.stringify(locationRaw));
let location = locationRaw.trim();
console.log("TRIM =", JSON.stringify(location));
location = location === "" ? false : location;
console.log("FINAL =", location);
let latitude = $("#formLatitude").val();
let longitude = $("#formLangValue").val();
const mandatory1_2_5 = ["1", "2", "5"];
let valid = false;
// --------- COMMON FIELD VALUES ----------
const hourlyMin = $('#hourly_min').val().trim();
const hourlyMax = $('#hourly_max').val().trim();
const nightlyMin = $('#nightly_min').val().trim();
const nightlyMax = $('#nightly_max').val().trim();
const availability = $('input[name="availability"]:checked').length > 0;
// ============================
// VALIDATION FOR HOURLY RANGE
// ============================
let hourlyValid = true;
if (hourlyMin || hourlyMax) {
// If any one value exists → both required
if (!hourlyMin || !hourlyMax) {
hourlyValid = false;
} else {
const minH = parseInt(hourlyMin);
const maxH = parseInt(hourlyMax);
if (!Number.isInteger(minH) || !Number.isInteger(maxH) ||
minH <= 0 || maxH <= 0 || maxH <= minH) {
hourlyValid = false;
}
}
}
// =============================
// VALIDATION FOR NIGHTLY RANGE
// =============================
let nightlyValid = true;
if (nightlyMin || nightlyMax) {
if (!nightlyMin || !nightlyMax) {
nightlyValid = false;
} else {
const minN = parseInt(nightlyMin);
const maxN = parseInt(nightlyMax);
if (!Number.isInteger(minN) || !Number.isInteger(maxN) ||
minN <= 0 || maxN <= 0 || maxN <= minN) {
nightlyValid = false;
}
}
}
// ===============================
// SERVICE TYPE 1, 2, 5 VALIDATION
// ===============================
console.log("===== FORM DEBUG LOG =====");
console.log({
country: country,
location: location,
latitude: latitude,
longitude: longitude,
hourlyValid: hourlyValid,
nightlyValid: nightlyValid
});
console.log("==========================");
if (mandatory1_2_5.includes(service)) {
if (
country &&
location &&
hourlyValid && latitude && longitude &&
nightlyValid
) {
valid = true;
}
console.log("valid value", valid);
// ===============================
// SERVICE TYPE 3 → Only country + location
// ===============================
} else if (service == "3") {
if (country && (location)) {
valid = true;
}
// ===============================
// SERVICE TYPE 4 → Only language required
// ===============================
} else if (service == "4") {
if (languageVals && languageVals.length > 0) {
valid = true;
}
}
// Enable / Disable Button
if (valid == true) {
$('#sendRequestBtn')
.prop('disabled', false)
.css('background', 'linear-gradient(rgb(168, 28, 52) 0%, rgb(168, 28, 52) 100%)');
} else {
$('#sendRequestBtn').prop('disabled', true);
}
return valid;
}
// localStorage.removeItem("ageVerified");
$('#service_input').select2({
placeholder: "Select Service Type",
});
$('#languageSelect').select2({
placeholder: "Select languages",
});
// $('#countrySelect').select2({
// placeholder: "Select Country",
// width: "100%"
// });
$('#countrySelect').select2({
templateResult: formatCountry,
templateSelection: formatCountry,
placeholder: "Select Country",
// allowClear: true,
width: '100%'
});
$(document).ready(function() {
loadDefaultCountry();
$('#sendRequestBtn').prop('disabled', true);
// wire many input events to validation
$(document).on('input change',
'#hourly_min, #hourly_max, #nightly_min, #nightly_max,#countrySelect, #languageSelect, input[name="availability"]',
function() {
validateForm();
});
$(document).on('blur',
'#preferred_location',
function() {
getPreferedLocation();
});
let minValue = 1; // Set your global minimum
if (localStorage.getItem("ageVerified") === "yes") {
document.getElementById("ageModal").classList.add("hide");
}
document.getElementById("btnYes").onclick = function() {
localStorage.setItem("ageVerified", "yes");
document.getElementById("ageModal").classList.add("hide");
};
document.getElementById("btnNo").onclick = function() {
window.location.href = "https://google.com";
};
function updateSections() {
var value = $("#service_input").val().trim();
console.log(value);
// Default show
$(".price-section").show();
$(".country-section").show();
$(".location-section").show();
$(".language-section").hide();
// $("#languageSelect").css("display", "none");
if (value == "3") {
$(".price-section").hide();
}
if (value == "4") {
if (!$("#countrySelect").val()) {
loadDefaultCountry();
}
//loadDefaultCountry();
$(".price-section").hide();
$(".country-section").hide();
$(".location-section").hide();
$(".language-section").show();
}
}
updateSections();
$("#service_input").on("change", function() {
console.log("this worked ");
updateSections();
});
});
// $("#countrySelect").on("change", function() {
// let countryId = $(this).val();
// if (countryId === "") return;
// $.ajax({
// url: "/get-currency",
// type: "POST",
// data: {
// country_id: countryId,
// _token: "{{ csrf_token() }}"
// },
// success: function(response) {
// console.log(response);
// if (response.status) {
// let currency = response.currency;
// console.log(currency);
// // Auto-fill your currency input box
// $(".PriceSymbol").text(currency.symbol);
// console.log("Currency Loaded:", currency);
// } else {
// console.log(response.message);
// }
// }
// });
// });
$("#countrySelect").on("change", function() {
console.log("check id", $(this).val());
loadCurrencyByCountry();
});
function loadCurrencyByCountry() {
let countryId = $('#countrySelect').val();
console.log(countryId);
if (!countryId) return;
$.ajax({
url: "/get-currency",
type: "POST",
data: {
country_id: countryId,
_token: "{{ csrf_token() }}"
},
success: function(response) {
if (response.status) {
$(".PriceSymbol").text(response.currency.symbol);
} else {
console.log(response.message);
}
},
error: function(err) {
console.error("Currency load failed", err);
}
});
}
</script>
<script
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyABOyILyRqsygsw6SVGj_kVNwi_x0CVzVI&libraries=places,marker"
async defer></script>
<script src="{{ asset('assets/js/location.js') }}"></script>
<script>
let country = null;
// main.js
function fetchAddress() {
getCurrentAddress()
.then(function(res) {
console.log(res);
document.getElementById("formLatitude").value = res.latitude;
document.getElementById("formLangValue").value = res.longitude;
setCountryDropdown(res.country);
$('#preferred_location').val(res.address);
validateForm();
})
.catch(function(err) {
console.log(err);
document.getElementById("preferred_location").innerHTML = err;
});
}
function loadDefaultCountry() {
console.log("thats mine");
getCurrentAddress()
.then(function(res) {
console.log("Address:", res.address);
console.log("Country:", res.country);
console.log("Lat:", res.latitude);
console.log("Lng:", res.longitude);
country = res.country;
setCountryDropdown(res.country);
loadCurrencyByCountry();
//document.getElementById("preferred_location").value = res.address;
})
.catch(function(err) {
console.log(err);
// document.getElementById("preferred_location").innerHTML = err;
});
}
function openMapModal() {
document.getElementById("mapModal").style.display = "block";
setTimeout(() => {
initMap(); // first time user
}, 100);
}
function closeMapModal() {
document.getElementById("mapModal").style.display = "none";
}
function getPreferedLocation() {
const input = document.getElementById("preferred_location");
const country = document.getElementById("countrySelect").value;
if (country) {
setupSearchBox(input, country);
} // Country code must be 2 letters
}
function setupSearchBox(input, country = null) {
let options = {
fields: ["formatted_address", "geometry", "name"],
};
if (country) {
options.componentRestrictions = {
country: country
};
options.strictBounds = true; // enforce country boundaries
}
const autocomplete = new google.maps.places.Autocomplete(input, options);
autocomplete.addListener("place_changed", function() {
const place = autocomplete.getPlace();
if (!place || !place.geometry) return;
let lat1 = place.geometry.location.lat();
let lng1 = place.geometry.location.lng();
// console.log(place);
// console.log(lat1.toFixed(6), lng1.toFixed(6),country);
// Move map and marker
// map.setCenter({ lat: lat, lng: lng });
// map.setZoom(15);
// marker.setPosition(place.geometry.location);
// Update address + lat/lng
$("#formLatitude").val(lat1.toFixed(6));
$("#formLangValue").val(lng1.toFixed(6));
// getAddress({ lat: lat1, lng: lng1 });
validateForm();
});
}
function setCountryDropdown(countryName) {
console.log("testing....");
console.log($('#preferred_location').val());
const select = document.getElementById("countrySelect");
if (!select) return;
const currentText = select.options[select.selectedIndex]?.text.trim().toLowerCase();
const targetText = countryName.trim().toLowerCase();
console.log("currentText", currentText);
console.log("targetText", targetText);
// ✅ If already selected, stop execution
if (currentText === targetText) {
loadCurrencyByCountry();
console.log("Already selected, no change.");
return;
}
for (let option of select.options) {
if (option.text.trim().toLowerCase() === countryName.trim().toLowerCase()) {
option.selected = true;
// select.dispatchEvent(new Event("change"));
console.log("selected, new change.");
// $('#countrySelect').trigger('change');
// ✅ set value (important)
select.value = option.value;
// ✅ trigger native + jQuery change
select.dispatchEvent(new Event('change', {
bubbles: true
}));
// for jQuery safety
break;
}
}
}
function getAddress(latlng) {
console.log(latlng);
//updateLatLngDisplay(latlng);
$("#formLatitude").val(lat.toFixed(6));
$("#formLangValue").val(lng.toFixed(6));
// geocoder.geocode({
// location: latlng
// }, function(results, status) {
// if (status === "OK" && results[0]) {
// console.log(results[0]);
// const components = results[0].address_components;
// // Get country
// const country = components.find(c => c.types.includes("country"));
// const countryName = country ? country.long_name : null;
// console.log("User Country:", countryName);
// if (countryName) {
// setCountryDropdown(countryName); // Auto-select country
// }
// document.getElementById("fullAddress").innerHTML = results[0].formatted_address;
// const locality = results[0].address_components.find(c =>
// c.types.includes("locality") ||
// c.types.includes("sublocality") ||
// c.types.includes("postal_town")
// );
// const shortText = locality ? locality.long_name : results[0].address_components[1]?.long_name;
// document.getElementById("shortAddress").innerHTML = shortText;
// selectedAddress = shortText;
// }
//});
}
function updateLatLngDisplay(latlng) {
let lat, lng;
console.log(latlng);
// // CASE 1: Google LatLng object → use lat()/lng()
// if (typeof latlng.lat === "function") {
// lat = latlng.lat();
// lng = latlng.lng();
// }
// // CASE 2: Plain object → use lat/lng directly
// else {
// lat = latlng.lat;
// lng = latlng.lng;
// }
// selectedLat = typeof latlng.lat === "function" ? latlng.lat() : latlng.lat;
// selectedLng = typeof latlng.lng === "function" ? latlng.lng() : latlng.lng;
// document.getElementById("latValue").innerHTML = lat.toFixed(6);
// document.getElementById("lngValue").innerHTML = lng.toFixed(6);
$("#formLatitude").val(lat.toFixed(6));
$("#formLangValue").val(lng.toFixed(6));
}
function initMap() {
geocoder = new google.maps.Geocoder();
if (selectedLat && selectedLng) {
console.log("work this first if");
console.log(selectedLat);
console.log(selectedLng);
const loc = {
lat: selectedLat,
lng: selectedLng
};
loadMap(loc);
loadMap({
lat: selectedLat,
lng: selectedLng
});
}
// Try to get current location
else if (navigator.geolocation) {
console.log("work this else if");
navigator.geolocation.getCurrentPosition(
function(position) {
const loc = {
lat: position.coords.latitude,
lng: position.coords.longitude
};
loadMap(loc);
},
function() {
loadMap({
lat: 13.0827,
lng: 80.2707
}); // Chennai fallback
}
);
} else {
console.log("work this else");
loadMap({
lat: 13.0827,
lng: 80.2707
});
}
}
function loadMap(center) {
console.log("loadMapData ", center);
map = new google.maps.Map(document.getElementById("map"), {
center: center,
zoom: 14,
mapTypeControl: false, // Hide "Map / Satellite"
streetViewControl: false, // Optional: Hide street view icon
fullscreenControl: false // Optional: Hide full-screen button
});
// Draggable marker
marker = new google.maps.Marker({
position: center,
map: map,
draggable: true
});
getAddress(center);
// Update address when marker is dragged
google.maps.event.addListener(marker, "dragend", function() {
getAddress(marker.getPosition());
});
// Update marker when map is dragged
google.maps.event.addListener(map, "idle", function() {
const center = map.getCenter();
marker.setPosition(center);
getAddress(center);
});
const input = document.getElementById("locationSearchInput");
setupSearchBox(input);
}
function setupSearchBoxOld() {
const input = document.getElementById("locationSearchInput");
const searchBox = new google.maps.places.SearchBox(input);
map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);
searchBox.addListener("places_changed", function() {
const places = searchBox.getPlaces();
if (places.length === 0) return;
const place = places[0];
if (!place.geometry) return;
map.setCenter(place.geometry.location);
map.setZoom(15);
marker.setPosition(place.geometry.location);
getAddress(place.geometry.location);
});
}
// function saveLocation() {
// document.getElementById("preferred_location").value = selectedAddress;
// // selectedLat = typeof latlng.lat === "function" ? latlng.lat() : latlng.lat;
// // selectedLng = typeof latlng.lng === "function" ? latlng.lng() : latlng.lng;
// let formLat = document.getElementById("latValue").textContent;
// let formLang = document.getElementById("lngValue").textContent;
// // console.log(selectedLng);
// document.getElementById("formLatitude").value = formLat;
// document.getElementById("formLangValue").value = formLang;
// closeMapModal();
// }
</script>
......@@ -98,34 +98,36 @@
<section class="container">
<div class="achievements-banner" data-aos="zoom-in" data-aos-delay="700">
<div class="row text-center">
<div class="col-lg-3 col-sm-6">
<div class="col-lg-2 col-sm-6"></div>
<div class="col-lg-2 col-sm-6">
<div class="achievement-item">
<img src="<?= asset('assets/img/') ?>/g2.png" />
<p>NUMBER OF <br>BRANDS </p>
<h4>20+</h4>
</div>
</div>
<div class="col-lg-3 col-sm-6">
<div class="col-lg-2 col-sm-6">
<div class="achievement-item">
<img src="<?= asset('assets/img/') ?>/g3.png" />
<p>NUMBER OF <br>DEALERS</p>
<h4>350+</h4>
</div>
</div>
<div class="col-lg-3 col-sm-6">
<div class="col-lg-2 col-sm-6">
<div class="achievement-item">
<img src="<?= asset('assets/img/') ?>/g4.png" />
<p>EXPERIENCE</p>
<h4>15+</h4>
</div>
</div>
<div class="col-lg-3 col-sm-6">
<div class="col-lg-2 col-sm-6">
<div class="achievement-item">
<img src="<?= asset('assets/img/') ?>/g1.png" />
<p>SUCCESSFULL PROJECTS<br></p>
<h4>2000+</h4>
</div>
</div>
<div class="col-lg-1 col-sm-6"></div>
</div>
</div>
</section>
......@@ -133,16 +135,16 @@
<section class="container" data-aos="fade-up" data-aos-delay="100">
<div class="row g-4">
<!-- Monitors -->
<!-- Monitors -->
<div class="col-lg-6" data-aos="zoom-in" data-aos-delay="100">
<div class="category-card bg-sand">
<div class="row align-items-center h-100">
<div class="col-md-7">
<div class="col-md-6">
<h3>Monitors</h3>
<p>Perfect monitor for all Applications</p>
<a href="#" class="btn btn-outline-dark">See All</a>
<a href="#" class="sand-btn">See All <i class="bi bi-arrow-right"></i></a>
</div>
<div class="col-md-5 text-end">
<div class="col-md-6 text-end">
<img src="<?php echo asset('assets') ?>/img/monitor-3.png" class="img-fluid" alt="Monitors">
</div>
</div>
......@@ -153,12 +155,12 @@
<div class="col-lg-6" data-aos="zoom-in" data-aos-delay="200">
<div class="category-card bg-teal text-white">
<div class="row align-items-center h-100">
<div class="col-md-7">
<div class="col-md-6">
<h3>Aircon</h3>
<p>Beat the heat, Stay cool!</p>
<a href="#" class="btn btn-outline-light">See All</a>
<a href="#" class="teal-btn">See All <i class="bi bi-arrow-right"></i></a>
</div>
<div class="col-md-5 text-end">
<div class="col-md-6 text-end">
<img src="<?php echo asset('assets') ?>/img/aircon.png" class="img-fluid" alt="Aircon">
</div>
</div>
......@@ -169,12 +171,12 @@
<div class="col-lg-6" data-aos="zoom-in" data-aos-delay="300">
<div class="category-card bg-teal text-white">
<div class="row align-items-center h-100">
<div class="col-md-7">
<div class="col-md-6">
<h3>Small Appliances</h3>
<p>Small Appliances for Offices</p>
<a href="#" class="btn btn-outline-light">See All</a>
<a href="#" class="teal-btn">See All <i class="bi bi-arrow-right"></i></a>
</div>
<div class="col-md-5 text-end">
<div class="col-md-6 text-end">
<img src="<?php echo asset('assets') ?>/img/small-appliances.png" class="img-fluid" alt="Appliances">
</div>
</div>
......@@ -185,12 +187,12 @@
<div class="col-lg-6" data-aos="zoom-in" data-aos-delay="100">
<div class="category-card bg-sand">
<div class="row align-items-center h-100">
<div class="col-md-7">
<div class="col-md-6">
<h3>Accessories</h3>
<p>Accessories for your every need!</p>
<a href="#" class="btn btn-outline-dark">See All</a>
<a href="#" class="sand-btn">See All <i class="bi bi-arrow-right"></i></a>
</div>
<div class="col-md-5 text-end">
<div class="col-md-6 text-end">
<img src="<?php echo asset('assets') ?>/img/accessories.png" class="img-fluid" alt="Accessories">
</div>
</div>
......
......@@ -47,7 +47,7 @@
<label for="messageInput">Phone *</label>
</div>
<div class="d-grid mt-5">
<button type="submit" class="btn-submit">Submit</button>
<button type="submit" class="btnsubmit">Submit</button>
</div>
</form>
<form action="" method="post" class="catalogForm">
......@@ -58,14 +58,15 @@
<label for="messageInput">Phone *</label>
</div>
<div class="d-grid mt-5">
<button type="submit" class="btn-submit">Submit</button>
<button type="submit" class="btnsubmit">Submit</button>
</div>
</form>
<div class="mb-1">
<h6 class=" text-muted">Brand</h6>
<?php foreach($brands as $val){ ?>
<a href=""><span data-toggle="tooltip" title="<?= $val->brand ?>" data-placement="top" class="tag-box-brand"><?= $val->brand ?></span></a>
<a href="javascript:void(0)" ><span data-toggle="tooltip" title="<?= $val->brand ?>" data-placement="top" class="tag-box-brand"><?= $val->brand ?></span></a>
<?php } ?>
<input name="brand" type="hidden" id="filter-brand" />
</div>
<hr>
......@@ -74,8 +75,9 @@
<h6 class=" text-muted">Size/Range/Capacity</h6>
<div class="d-flex flex-wrap gap-2">
<?php foreach($size as $val){ ?>
<a href=""><span data-toggle="tooltip" title="<?= $val->size ?>" data-placement="top" class="tag-box-size"><?= $val->size ?></span></a>
<a href="javascript:void(0)" ><span data-toggle="tooltip" title="<?= $val->size ?>" data-placement="top" class="tag-box-size"><?= $val->size ?></span></a>
<?php } ?>
</div>
</div>
......@@ -85,8 +87,9 @@
<h6 class=" text-muted">Industry</h6>
<div class="d-flex flex-wrap gap-2">
<?php foreach($industrys as $val){ ?>
<a href=""><span data-toggle="tooltip" title="<?= $val->industry ?>" data-placement="top" class="tag-box-indus"><?= ucwords($val->industry) ?></span></a>
<a href="javascript:void(0)" ><span data-toggle="tooltip" title="<?= $val->industry ?>" data-placement="top" class="tag-box-indus"><?= ucwords($val->industry) ?></span></a>
<?php } ?>
</div>
</div>
......@@ -104,5 +107,7 @@ function showForm(showid,hideid)
$('.'+showid).show();
$('.'+hideid).hide();
}
</script>
@endsection
\ No newline at end of file
......@@ -22,10 +22,11 @@
<div class="accordion-body">
<?php if (isset($productType)) {
foreach ($productType as $row) { ?>
<div><?php echo $row->type ?></div>
<div onclick="filterCatgory('<?= $row->id ?>')"><?php echo $row->category_name ?></div>
<?php }
} ?>
</div>
<input name="category" type="hidden" id="filter-category" />
</div>
</div>
......@@ -42,10 +43,11 @@
<div class="accordion-body">
<?php if (isset($industryData)) {
foreach ($industryData as $row) { ?>
<div><?php echo $row->industry ?></div>
<div onclick="filterIndustry('<?= $row->id ?>')"><?php echo $row->industry ?></div>
<?php }
} ?>
</div>
<input name="industry" type="hidden" id="filter-industry" />
</div>
</div>
......@@ -62,10 +64,12 @@
<div class="accordion-body">
<?php if (isset($brandData)) {
foreach ($brandData as $row) { ?>
<div><?php echo $row->brand ?></div>
<div onclick="filterBrand('<?= $row->id ?>')" ><?php echo $row->brand ?></div>
<?php }
} ?>
</div>
<input name="brand" type="hidden" id="filter-brand" />
</div>
</div>
......@@ -113,12 +117,18 @@ function loadProducts(reset = false) {
$('#productList').html('');
}
$('#loadMore').show();
var industry = $('#filter-industry').val();
var category = $('#filter-category').val();
var brand = $('#filter-brand').val();
$.ajax({
url: '<?php echo route('getProducts') ?>',
type: 'GET',
data: {
offset: offset,
limit: limit
limit: limit,
industry: industry,
category: category,
brand: brand,
},
success: function(data) {
......@@ -149,6 +159,22 @@ function loadProducts(reset = false) {
// $('#loadMore').on('click', function () {
// loadProducts();
// });
function filterIndustry(id)
{
$('#filter-industry').val(id);
loadProducts(true);
}
function filterCatgory(id)
{
$('#filter-category').val(id);
loadProducts(true);
}
function filterBrand(id)
{
$('#filter-brand').val(id);
loadProducts(true);
}
</script>
......
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