Commit 4e8240e8 by Hussain Mohamed

changes

parent 623698fa
......@@ -9,6 +9,8 @@
use App\Models\Country;
use App\Models\Currency;
use App\Models\DistanceRequest;
use App\Models\EnquiryCatalogModel;
use App\Models\EnquiryModel;
use App\Models\IndustryProduct;
use App\Models\WebRequestModel;
use App\Models\LanguageModel;
......@@ -27,9 +29,11 @@
use App\Models\SizeModel;
use App\Models\SizeProduct;
use App\Models\SliderModel;
use Exception;
use Google\Service\AdExchangeBuyer\Product;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Str;
class FrontendController extends Controller
......@@ -94,6 +98,117 @@ public function getProduct($name = '')
}
public function submitEnquiry(Request $request)
{
$input = $request->all();
$name = isset($input['name']) ? $input['name']:'';
$email = isset($input['email']) ? $input['email']:'';
$phone = isset($input['phone']) ? $input['phone']:'';
$brand = isset($input['brand']) ? $input['brand']:'';
$size = isset($input['size']) ? $input['size']:'';
$industry = isset($input['industry']) ? $input['industry']:'';
if($brand != '')
{
$bname = ProductBrandModel::Where('id',$brand)->value('brand');
}
if($size != '')
{
$sname = SizeModel::Where('id',$size)->value('size');
}
if($industry != '')
{
$iname = ProductIndustryModel::Where('id',$industry)->value('industry');
}
$data = [
'name' => $name,
'email' => $email,
'phone' => $phone,
'brand' => $bname ?? '',
'size' => $sname ?? '',
'industry' => $iname ?? '',
'ip' => $request->ip()
];
try{
Mail::send('email.enquiry', ['data' => $data], function ($message) use ($data) {
$message->from('enquiry@palaniappaelectronics.in', 'Palaniappa Electronics');
$message->to('hussain@alphasoftz.in')
->subject('New Enquiry from Website');
// ->replyTo($data['email']);
});
EnquiryModel::create($data);
return response()->json(['status' => 1]);
}catch(Exception $e)
{
return response()->json(['status' => 0]);
}
}
public function download($token)
{
$id = EnquiryCatalogModel::Where('hash',$token)->value('id');
if($id != '')
{
$path = public_path('assets/catalog/catalog.pdf');
return response()->download($path);
}else{
return redirect()->back()->with('error', 'Token mismatching');;
}
}
public function downloadCatalog(Request $request)
{
$input = $request->all();
$phone = isset($input['phone']) ? $input['phone']:'';
$token = hash('sha256', Str::random(20));
$data = [
'mobile' => $phone,
'ip' => $request->ip(),
'hash' => $token
];
$insert = EnquiryCatalogModel::create($data);
$html = '<a href="'.route('download',['token'=>$token]).'">Click here to Download</a>';
if($insert['id'] > 0)
{
return response()->json(['status' => 1,'link' => $html]);
}
}
public function sendSms()
{
$payload = [
"sender" => "Myshop",
"recipient" => "9894764234",
"content" => "Your Id is KCT00012",
"type" => "marketing",
"unicodeEnabled" => true
];
$ch = curl_init("https://api.brevo.com/v3/transactionalSMS/send");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"accept: application/json",
"content-type: application/json",
"api-key: " . env('BREVO_API_KEY')
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
public function getAjaxProducts(Request $request)
{
$offset = $request->get('offset', 0);
......@@ -101,7 +216,8 @@ public function getAjaxProducts(Request $request)
$categoryId = $request->get('category');
$brandId = $request->get('brand');
$industryId = $request->get('industry');
$category_slug = $request->get('category_slug');
DB::enableQueryLog();
$products = ProductModel::query()->from('products as p')
->leftJoin('product_attributes as pi', 'pi.product_id', '=', 'p.id')
......@@ -111,6 +227,17 @@ public function getAjaxProducts(Request $request)
$products->where('p.category_id', $categoryId);
}
if($category_slug != '')
{
$cate = str_replace("-"," ",$category_slug);
$cateId = CategoryModel::Where('category_name',$cate)->value('id');
if($cateId != '')
{
$products->where('p.category_id', $cateId);
}
}
// Brand filter (pivot)
if ($brandId) {
......
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class EnquiryCatalogModel extends Model
{
use HasFactory;
protected $table = 'enquiry_catalog';
protected $guarded = ['id'];
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class EnquiryModel extends Model
{
use HasFactory;
protected $table = 'enquiry';
protected $guarded = ['id'];
}
......@@ -5271,6 +5271,8 @@ section,
.footer-social > a{
padding: 10px;
color: #fff;
font-size: 17px;
}
.form-control{
......@@ -5350,6 +5352,11 @@ section,
overflow-y: auto;
}
#type .accordion-body {
max-height: 250px;
overflow-y: auto;
}
.mb-10{
margin-bottom: 10rem;
}
......
</main>
<footer id="footer" class="footer dark-background">
<div class="container footer-top">
<div class="row gy-4">
<div class="col-lg-3 col-6 footer-links">
......@@ -13,8 +12,6 @@
</ul>
</div>
<div class="col-lg-3 col-6 footer-links">
<h4>HELP</h4>
<ul>
......@@ -27,7 +24,7 @@
<h4>REG. OFFICE</h4>
<p>No. 14/30, 2nd Main Road,</p>
<p>New Colony, Chromepet,</p>
<p>Chennai 600 044</p>
<p>Chennai - 600 044</p>
</div>
<div class="col-lg-3 col-md-12 footer-contact text-center text-md-start">
......@@ -36,12 +33,11 @@
<p>185/2, Abdul karam Street, Nagalkeni,</p>
<p>Chromepet, Chennai-600 044</p>
</div>
</div>
</div>
<hr>
<div class="container ">
Designed and developed by <b>Alpha</b>
Designed and developed by <b>Palaniappa Electornics</b>
<div class="text-right float-end footer-social">
<a href="#" class="facebook"><i class="bi bi-facebook"></i></a>
<a href="#" class="instagram"><i class="bi bi-instagram"></i></a>
......@@ -49,7 +45,6 @@
<a href="#" class="twitter"><i class="bi bi-youtube"></i></a>
</div>
</div>
</footer>
<!-- Scroll Top -->
......@@ -68,6 +63,7 @@
<!-- Main JS File -->
<script src="<?= asset('assets') ?>/js/main.js"></script>
<script src="<?= asset('assets') ?>/js/jquery.validate.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
new Swiper('.hero-slider', {
......@@ -90,6 +86,11 @@
$(function () {
$('[data-toggle="tooltip"]').tooltip();
});
$(document).ready(function () {
const lightbox = GLightbox({
selector: '.glightbox',
});
});
</script>
</body>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>New Enquiry</title>
</head>
<body style="margin:0;padding:0;background:#f5f5f5;font-family:Arial,Helvetica,sans-serif;">
<table width="100%" cellpadding="0" cellspacing="0" style="background:#f5f5f5;padding:20px;">
<tr>
<td align="center">
<table width="600" cellpadding="0" cellspacing="0" style="background:#ffffff;border-radius:6px;overflow:hidden;">
<tr> <td align="center" style="padding:15px;background:#ffffff;"> <img src="<?= asset('assets/img/') ?>/logo.png" alt="Company Logo" width="160" style="display:block;"> </td> </tr>
<!-- Header -->
<tr>
<td style="background:#024959;color:#ffffff;padding:15px 20px;">
<h2 style="margin:0;font-size:18px;">New Product Enquiry</h2>
</td>
</tr>
<!-- Content -->
<tr>
<td style="padding:20px;">
<p style="margin:0 0 15px;">
You have received a new enquiry. Details are below:
</p>
<table width="100%" cellpadding="8" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td style="border:1px solid #ddd;"><strong>Name</strong></td>
<td style="border:1px solid #ddd;">{{ $data['name'] }}</td>
</tr>
<tr>
<td style="border:1px solid #ddd;"><strong>Email</strong></td>
<td style="border:1px solid #ddd;">{{ $data['email'] }}</td>
</tr>
<tr>
<td style="border:1px solid #ddd;"><strong>Phone</strong></td>
<td style="border:1px solid #ddd;">{{ $data['phone'] }}</td>
</tr>
<?php if($data['brand'] != ''){ ?>
<tr>
<td style="border:1px solid #ddd;"><strong>Brand</strong></td>
<td style="border:1px solid #ddd;">{{ $data['brand'] }}</td>
</tr>
<?php }
if($data['size'] != ''){
?>
<tr>
<td style="border:1px solid #ddd;"><strong>Size</strong></td>
<td style="border:1px solid #ddd;">{{ $data['size'] }}</td>
</tr>
<?php }
if($data['industry'] != ''){
?>
<tr>
<td style="border:1px solid #ddd;"><strong>Industry</strong></td>
<td style="border:1px solid #ddd;">{{ $data['industry'] }}</td>
</tr>
<?php } ?>
</table>
<p style="margin-top:20px;font-size:13px;color:#555;">
This enquiry was submitted from the website enquiry form.
</p>
</td>
</tr>
<!-- Footer -->
<tr>
<td style="background:#f1f1f1;padding:10px 20px;font-size:12px;color:#555;text-align:center;">
© {{ date('Y') }} Palaniappa Electronics
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
......@@ -15,7 +15,7 @@
<div class="hero-content">
<h1><?php echo $row->slider_caption ?></h1>
<h4><?php echo $row->slider_type ?></h4>
<a href="#">View All</a>
<a href="<?= route('product',['prodcat'=>$row->url_slug]) ?>">View All</a>
</div>
</div>
</div>
......@@ -46,7 +46,7 @@
Our advanced visual display solutions are changing the landscape
of how we see and interact with the world around us.
</p>
<a href="#" class="btn view-all-btn">View All</a>
<a href="<?= route('product',['prodcat'=>'visual-display']) ?>" class="btn view-all-btn">View All</a>
</div>
</div>
......@@ -56,35 +56,35 @@
<div class="col-md-6">
<div class="display-card large">
<img src="<?php echo asset('assets') ?>/img/signage-tv.png" class="img-fluid" alt="">
<a href="<?= route('product',['prodcat'=>'visual-display']) ?>"><img src="<?php echo asset('assets') ?>/img/signage-tv.png" class="img-fluid" alt=""></a>
<div class="display-title">Signage Display</div>
</div>
</div>
<div class="col-md-6">
<div class="display-card large">
<img src="<?php echo asset('assets') ?>/img/portable-projectors.png" class="img-fluid" alt="">
<a href="<?= route('product',['prodcat'=>'visual-display']) ?>"><img src="<?php echo asset('assets') ?>/img/portable-projectors.png" class="img-fluid" alt=""></a>
<div class="display-title">Projectors</div>
</div>
</div>
<div class="col-md-4">
<div class="display-card small">
<img src="<?php echo asset('assets') ?>/img/led-wall.png" class="img-fluid" alt="">
<a href="<?= route('product',['prodcat'=>'visual-display']) ?>"><img src="<?php echo asset('assets') ?>/img/led-wall.png" class="img-fluid" alt=""></a>
<div class="display-title">LED Wall</div>
</div>
</div>
<div class="col-md-4">
<div class="display-card small">
<img src="<?php echo asset('assets') ?>/img/interactive-display.png" class="img-fluid" alt="">
<a href="<?= route('product',['prodcat'=>'visual-display']) ?>"><img src="<?php echo asset('assets') ?>/img/interactive-display.png" class="img-fluid" alt=""></a>
<div class="display-title">Interactive Displays</div>
</div>
</div>
<div class="col-md-4">
<div class="display-card small">
<img src="<?php echo asset('assets') ?>/img/digital-writing-pad.png" class="img-fluid" alt="">
<a href="<?= route('product',['prodcat'=>'visual-display']) ?>"><img src="<?php echo asset('assets') ?>/img/digital-writing-pad.png" class="img-fluid" alt=""></a>
<div class="display-title">Digital Writing Pad</div>
</div>
</div>
......@@ -142,7 +142,7 @@
<div class="col-md-6">
<h3>Monitors</h3>
<p>Perfect monitor for all Applications</p>
<a href="#" class="sand-btn">See All <i class="bi bi-arrow-right"></i></a>
<a href="<?= route('product',['prodcat'=>'visual-display']) ?>" class="sand-btn">See All <i class="bi bi-arrow-right"></i></a>
</div>
<div class="col-md-6 text-end">
<img src="<?php echo asset('assets') ?>/img/monitor-3.png" class="img-fluid" alt="Monitors">
......@@ -158,7 +158,7 @@
<div class="col-md-6">
<h3>Aircon</h3>
<p>Beat the heat, Stay cool!</p>
<a href="#" class="teal-btn">See All <i class="bi bi-arrow-right"></i></a>
<a href="<?= route('product',['prodcat'=>'aircon-solutions']) ?>" class="teal-btn">See All <i class="bi bi-arrow-right"></i></a>
</div>
<div class="col-md-6 text-end">
<img src="<?php echo asset('assets') ?>/img/aircon.png" class="img-fluid" alt="Aircon">
......@@ -174,7 +174,7 @@
<div class="col-md-6">
<h3>Small Appliances</h3>
<p>Small Appliances for Offices</p>
<a href="#" class="teal-btn">See All <i class="bi bi-arrow-right"></i></a>
<a href="<?= route('product',['prodcat'=>'in-room-appliances']) ?>" class="teal-btn">See All <i class="bi bi-arrow-right"></i></a>
</div>
<div class="col-md-6 text-end">
<img src="<?php echo asset('assets') ?>/img/small-appliances.png" class="img-fluid" alt="Appliances">
......@@ -190,7 +190,7 @@
<div class="col-md-6">
<h3>Accessories</h3>
<p>Accessories for your every need!</p>
<a href="#" class="sand-btn">See All <i class="bi bi-arrow-right"></i></a>
<a href="<?= route('product',['prodcat'=>'housekeeping-amenities']) ?>" class="sand-btn">See All <i class="bi bi-arrow-right"></i></a>
</div>
<div class="col-md-6 text-end">
<img src="<?php echo asset('assets') ?>/img/accessories.png" class="img-fluid" alt="Accessories">
......
......@@ -27,6 +27,7 @@
} ?>
</div>
<input name="category" type="hidden" id="filter-category" />
<input name="category_slug" type="hidden" id="category_slug" value="<?= request('prodcat') ?>" />
</div>
</div>
......@@ -120,6 +121,8 @@ function loadProducts(reset = false) {
var industry = $('#filter-industry').val();
var category = $('#filter-category').val();
var brand = $('#filter-brand').val();
var category_slug = $('#category_slug').val();
$.ajax({
url: '<?php echo route('getProducts') ?>',
type: 'GET',
......@@ -129,6 +132,7 @@ function loadProducts(reset = false) {
industry: industry,
category: category,
brand: brand,
category_slug:category_slug
},
success: function(data) {
......
......@@ -28,9 +28,12 @@
Route::get('about-us', [FrontendController::class, 'about'])->name('about-us');
Route::get('career', [FrontendController::class, 'career'])->name('career');
Route::get('product', [FrontendController::class, 'products'])->name('product');
Route::get('sendSms', [FrontendController::class, 'sendSms'])->name('sendSms');
Route::get('products/{name?}', [FrontendController::class, 'getProduct'])->name('products');
Route::get('download/{token?}', [FrontendController::class, 'download'])->name('download');
Route::match(['get','post'],'getProducts', [FrontendController::class, 'getAjaxProducts'])->name('getProducts');
Route::post('submit-enquiry', [FrontendController::class, 'submitEnquiry'])->name('submit-enquiry');
Route::post('download-catalog', [FrontendController::class, 'downloadCatalog'])->name('download-catalog');
Route::get('/request-waiting/{token}', [FrontendController::class, 'requestWaiting'])
->name('request.waiting');
......
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