Commit 3e3455e5 by Dhanaraj

new changes

parent ed86bc4b
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class AdminAuthController extends Controller
{
public function showLoginForm()
{
return view('admin.auth.login');
}
public function login(Request $request)
{
$credentials = $request->validate([
'email' => ['required', 'string'],
'password' => ['required', 'string'],
]);
if (Auth::attempt($credentials, $request->boolean('remember'))) {
$request->session()->regenerate();
return redirect()->intended(url('/admin/dashboard'))->with('success', 'Logged in successfully!');
}
return back()->withErrors([
'email' => 'The provided credentials do not match our records.',
])->onlyInput('email');
}
public function logout(Request $request)
{
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect(url('/admin/login'))->with('success', 'Logged out securely.');
}
}
...@@ -7,10 +7,10 @@ use Illuminate\Http\Request; ...@@ -7,10 +7,10 @@ use Illuminate\Http\Request;
use App\Models\Country; use App\Models\Country;
use App\Models\State; use App\Models\State;
use App\Models\City; use App\Models\City;
use App\Models\Unit;
use App\Models\UnitSize;
use App\Models\Size; use App\Models\Size;
use App\Models\Category; use App\Models\Category;
use App\Models\Product;
use App\Models\ProductVariant;
class AdminMasterDataController extends Controller class AdminMasterDataController extends Controller
{ {
...@@ -19,20 +19,97 @@ class AdminMasterDataController extends Controller ...@@ -19,20 +19,97 @@ class AdminMasterDataController extends Controller
'country', 'countries' => Country::class, 'country', 'countries' => Country::class,
'state', 'states' => State::class, 'state', 'states' => State::class,
'city', 'cities' => City::class, 'city', 'cities' => City::class,
'unit', 'units' => Unit::class,
'unitsizes' => UnitSize::class,
'size', 'sizes' => Size::class, 'size', 'sizes' => Size::class,
'productprices', 'product_variants', 'product_variant' => ProductVariant::class,
'category', 'categories' => Category::class, 'category', 'categories' => Category::class,
'gallery', 'galleries' => \App\Models\Gallery::class, 'gallery', 'galleries' => \App\Models\Gallery::class,
'product', 'products' => Product::class,
default => null, default => null,
}; };
} }
private function saveProductImages(Request $request, $product)
{
$imageUrl = null;
if ($request->hasFile('primary_image_file')) {
$file = $request->file('primary_image_file');
$filename = time() . '_' . uniqid() . '.' . $file->getClientOriginalExtension();
$file->move(public_path('uploads/products'), $filename);
$imageUrl = '/uploads/products/' . $filename;
}
elseif ($request->filled('primary_image_url')) {
$imageUrl = $request->input('primary_image_url');
}
if ($imageUrl) {
$primaryImage = \App\Models\ProductImage::where('product_id', $product->id)
->where('is_primary', true)
->first();
if ($primaryImage) {
$primaryImage->update([
'image_url' => $imageUrl
]);
} else {
\App\Models\ProductImage::create([
'product_id' => $product->id,
'image_url' => $imageUrl,
'is_primary' => true
]);
}
}
}
public function store(Request $request, $type) public function store(Request $request, $type)
{ {
$modelClass = $this->getModelClass($type); $modelClass = $this->getModelClass($type);
if (!$modelClass) return back()->with('error', 'Invalid type'); if (!$modelClass) return back()->with('error', 'Invalid type');
if ($type === 'products' || $type === 'product') {
$productData = $request->only([
'category_id', 'name', 'slug', 'description', 'is_bestseller', 'status'
]);
$productData['price'] = 0.00;
$productData['stock_quantity'] = 0;
$product = Product::create($productData);
$this->saveProductImages($request, $product);
return redirect('/admin/products')->with('success', 'Product created successfully!');
}
if ($type === 'gallery' || $type === 'galleries') {
$data = $request->only(['filename', 'status']);
$url = null;
if ($request->hasFile('image_file')) {
$file = $request->file('image_file');
$filename = time() . '_' . uniqid() . '.' . $file->getClientOriginalExtension();
$file->move(public_path('uploads/gallery'), $filename);
$url = '/uploads/gallery/' . $filename;
} elseif ($request->filled('url')) {
$url = $request->input('url');
}
if (!$url) {
return back()->with('error', 'Please upload an image file or provide an Image URL.');
}
$data['url'] = $url;
\App\Models\Gallery::create($data);
return redirect('/admin/gallery')->with('success', 'Gallery entry created successfully!');
}
if ($type === 'productprices' || $type === 'product_variants' || $type === 'product_variant') {
$exists = ProductVariant::where('product_id', $request->product_id)
->where('size_id', $request->size_id)
->exists();
if ($exists) {
return back()->with('error', 'This size variant already exists for the selected product.');
}
}
$data = $request->except('_token'); $data = $request->except('_token');
$modelClass::create($data); $modelClass::create($data);
...@@ -45,6 +122,35 @@ class AdminMasterDataController extends Controller ...@@ -45,6 +122,35 @@ class AdminMasterDataController extends Controller
if (!$modelClass) return back()->with('error', 'Invalid type'); if (!$modelClass) return back()->with('error', 'Invalid type');
$record = $modelClass::findOrFail($id); $record = $modelClass::findOrFail($id);
if ($type === 'products' || $type === 'product') {
$productData = $request->only([
'category_id', 'name', 'slug', 'description', 'is_bestseller', 'status'
]);
$record->update($productData);
$this->saveProductImages($request, $record);
return redirect('/admin/products')->with('success', 'Product updated successfully!');
}
if ($type === 'gallery' || $type === 'galleries') {
$data = $request->only(['filename', 'status']);
$url = $record->url;
if ($request->hasFile('image_file')) {
$file = $request->file('image_file');
$filename = time() . '_' . uniqid() . '.' . $file->getClientOriginalExtension();
$file->move(public_path('uploads/gallery'), $filename);
$url = '/uploads/gallery/' . $filename;
} elseif ($request->filled('url')) {
$url = $request->input('url');
}
$data['url'] = $url;
$record->update($data);
return redirect('/admin/gallery')->with('success', 'Gallery entry updated successfully!');
}
$data = $request->except(['_token', '_method']); $data = $request->except(['_token', '_method']);
$record->update($data); $record->update($data);
......
...@@ -41,16 +41,6 @@ class AdminViewController extends Controller ...@@ -41,16 +41,6 @@ class AdminViewController extends Controller
return view('admin.city', compact('cities')); return view('admin.city', compact('cities'));
} }
public function units() {
$units = Unit::all();
return view('admin.unit', compact('units'));
}
public function unitsizes() {
$unitsizes = UnitSize::all();
return view('admin.unitsizes', compact('unitsizes'));
}
public function sizes() { public function sizes() {
$sizes = Size::all(); $sizes = Size::all();
return view('admin.sizes', compact('sizes')); return view('admin.sizes', compact('sizes'));
...@@ -66,9 +56,22 @@ class AdminViewController extends Controller ...@@ -66,9 +56,22 @@ class AdminViewController extends Controller
return view('admin.products', compact('products')); return view('admin.products', compact('products'));
} }
public function productsCreate() {
$categories = Category::all();
return view('admin.products_create', compact('categories'));
}
public function productsEdit($id) {
$product = Product::findOrFail($id);
$categories = Category::all();
return view('admin.products_edit', compact('product', 'categories'));
}
public function productprices() { public function productprices() {
$productprices = ProductVariant::with('product')->get(); $productprices = ProductVariant::with(['product', 'size'])->get();
return view('admin.productprices', compact('productprices')); $products = Product::orderBy('name')->get();
$sizes = Size::orderBy('name')->get();
return view('admin.productprices', compact('productprices', 'products', 'sizes'));
} }
public function orders() { public function orders() {
...@@ -91,6 +94,15 @@ class AdminViewController extends Controller ...@@ -91,6 +94,15 @@ class AdminViewController extends Controller
return view('admin.gallery', compact('gallery')); return view('admin.gallery', compact('gallery'));
} }
public function galleryCreate() {
return view('admin.gallery_create');
}
public function galleryEdit($id) {
$gallery = Gallery::findOrFail($id);
return view('admin.gallery_edit', compact('gallery'));
}
public function pincodes() { public function pincodes() {
$pincodes = Pincode::all(); $pincodes = Pincode::all();
return view('admin.pincodes', compact('pincodes')); return view('admin.pincodes', compact('pincodes'));
......
...@@ -26,7 +26,7 @@ class CatalogController extends Controller ...@@ -26,7 +26,7 @@ class CatalogController extends Controller
*/ */
public function products(Request $request): JsonResponse public function products(Request $request): JsonResponse
{ {
$query = Product::with(['primaryImage', 'category', 'variants']); $query = Product::with(['primaryImage', 'category', 'variants.size']);
// Filter by category slug // Filter by category slug
if ($request->has('category') && $request->input('category') !== 'all') { if ($request->has('category') && $request->input('category') !== 'all') {
...@@ -72,7 +72,7 @@ class CatalogController extends Controller ...@@ -72,7 +72,7 @@ class CatalogController extends Controller
*/ */
public function productDetails(string $slug): JsonResponse public function productDetails(string $slug): JsonResponse
{ {
$product = Product::with(['images', 'variants', 'category'])->where('slug', $slug)->first(); $product = Product::with(['images', 'variants.size', 'category'])->where('slug', $slug)->first();
if (!$product) { if (!$product) {
return response()->json([ return response()->json([
...@@ -82,7 +82,7 @@ class CatalogController extends Controller ...@@ -82,7 +82,7 @@ class CatalogController extends Controller
} }
// Fetch related products from same category (excluding current) // Fetch related products from same category (excluding current)
$relatedProducts = Product::with('primaryImage') $relatedProducts = Product::with(['primaryImage', 'variants.size'])
->where('category_id', $product->category_id) ->where('category_id', $product->category_id)
->where('id', '!=', $product->id) ->where('id', '!=', $product->id)
->limit(4) ->limit(4)
......
...@@ -56,7 +56,7 @@ class CheckoutController extends Controller ...@@ -56,7 +56,7 @@ class CheckoutController extends Controller
$price = $variant->price; $price = $variant->price;
} }
if ($variant->stock_quantity < $item['quantity']) { if ($variant->stock_quantity < $item['quantity']) {
throw new \Exception("Inadequate stock for product variant: {$product->name} ({$variant->size})"); throw new \Exception("Inadequate stock for product variant: {$product->name} ({$variant->size->name})");
} }
// Deduct variant stock // Deduct variant stock
$variant->decrement('stock_quantity', $item['quantity']); $variant->decrement('stock_quantity', $item['quantity']);
......
...@@ -19,10 +19,11 @@ class FrontendController extends Controller ...@@ -19,10 +19,11 @@ class FrontendController extends Controller
public function productDetail($slug) public function productDetail($slug)
{ {
$product = Product::with(['category'])->where('slug', $slug)->firstOrFail(); $product = Product::with(['category', 'variants.size'])->where('slug', $slug)->firstOrFail();
// Fetch related products (same category) // Fetch related products (same category)
$relatedProducts = Product::where('category_id', $product->category_id) $relatedProducts = Product::with(['primaryImage', 'variants.size'])
->where('category_id', $product->category_id)
->where('id', '!=', $product->id) ->where('id', '!=', $product->id)
->take(4) ->take(4)
->get(); ->get();
......
...@@ -20,6 +20,7 @@ class Product extends Model ...@@ -20,6 +20,7 @@ class Product extends Model
'strike_price', 'strike_price',
'stock_quantity', 'stock_quantity',
'is_bestseller', 'is_bestseller',
'status',
]; ];
protected $casts = [ protected $casts = [
......
...@@ -12,7 +12,7 @@ class ProductVariant extends Model ...@@ -12,7 +12,7 @@ class ProductVariant extends Model
protected $fillable = [ protected $fillable = [
'product_id', 'product_id',
'size', 'size_id',
'price', 'price',
'stock_quantity', 'stock_quantity',
]; ];
...@@ -28,4 +28,12 @@ class ProductVariant extends Model ...@@ -28,4 +28,12 @@ class ProductVariant extends Model
{ {
return $this->belongsTo(Product::class); return $this->belongsTo(Product::class);
} }
/**
* Get the size configuration for the variant.
*/
public function size(): BelongsTo
{
return $this->belongsTo(Size::class, 'size_id');
}
} }
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Unit extends Model
{
protected $guarded = [];
//
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class UnitSize extends Model
{
protected $guarded = [];
//
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option defines the default authentication "guard" and password
| reset "broker" for your application. You may change these values
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', App\Models\User::class),
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
// Insert default admin user
DB::table('users')->insert([
'name' => 'Admin',
'email' => 'admin', // use admin as email/username
'password' => Hash::make('admin123'),
'created_at' => now(),
'updated_at' => now(),
]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};
...@@ -11,11 +11,8 @@ return new class extends Migration ...@@ -11,11 +11,8 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('units', function (Blueprint $table) { Schema::table('products', function (Blueprint $table) {
$table->id(); $table->string('status')->default('Active')->after('is_bestseller');
$table->string('name');
$table->string('code')->unique();
$table->timestamps();
}); });
} }
...@@ -24,6 +21,8 @@ return new class extends Migration ...@@ -24,6 +21,8 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('units'); Schema::table('products', function (Blueprint $table) {
$table->dropColumn('status');
});
} }
}; };
...@@ -11,11 +11,9 @@ return new class extends Migration ...@@ -11,11 +11,9 @@ return new class extends Migration
*/ */
public function up(): void public function up(): void
{ {
Schema::create('unit_sizes', function (Blueprint $table) { Schema::table('product_variants', function (Blueprint $table) {
$table->id(); $table->dropColumn('size');
$table->string('identifier'); $table->foreignId('size_id')->after('product_id')->constrained('sizes')->onDelete('cascade');
$table->string('unit');
$table->timestamps();
}); });
} }
...@@ -24,6 +22,10 @@ return new class extends Migration ...@@ -24,6 +22,10 @@ return new class extends Migration
*/ */
public function down(): void public function down(): void
{ {
Schema::dropIfExists('unit_sizes'); Schema::table('product_variants', function (Blueprint $table) {
$table->dropForeign(['size_id']);
$table->dropColumn('size_id');
$table->string('size');
});
} }
}; };
<?php
namespace Database\Seeders;
use App\Models\Gallery;
use Illuminate\Database\Seeder;
class GallerySeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// Truncate existing gallery entries to avoid duplicates
Gallery::truncate();
$items = [
['filename' => 'Decorative Shell Wall Frame', 'url' => 'https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Shell Clock Frame', 'url' => 'https://images.unsplash.com/photo-1595855759920-86582396756a?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Starfish Lights Decor', 'url' => 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Shell Jewelry Box Open', 'url' => 'https://images.unsplash.com/photo-1599643478518-a784e5dc4c8f?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Shell Gift Hamper Box', 'url' => 'https://images.unsplash.com/photo-1542838132-92c53300491e?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Beach Mugs and Frames', 'url' => 'https://images.unsplash.com/photo-1549465220-1a8b9238cd48?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Seashell Wind Chime', 'url' => 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Shell Candle Holder', 'url' => 'https://images.unsplash.com/photo-1520038410233-7141be7e6f97?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Seashell Jewelry Box Closed', 'url' => 'https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Iridescent Conch Table Lamp', 'url' => 'https://images.unsplash.com/photo-1513519245088-0e12902e5a38?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Oyster Shell Ring Dish', 'url' => 'https://images.unsplash.com/photo-1535632066927-ab7c9ab60908?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Polished Nautilus Display', 'url' => 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Ocean Theme Bottle Art', 'url' => 'https://images.unsplash.com/photo-1526947425960-945c6e72858f?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Mussel Shell Wind Chime', 'url' => 'https://images.unsplash.com/photo-1513519245088-0e12902e5a38?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Scallop Shell Jewelry Holder', 'url' => 'https://images.unsplash.com/photo-1599643478518-a784e5dc4c8f?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Sea Glass Window Pendant', 'url' => 'https://images.unsplash.com/photo-154474655-9aed1e956bc2?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Cowrie Shell Tribal Necklace', 'url' => 'https://images.unsplash.com/photo-1599643478518-a784e5dc4c8f?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Abalone Shell Inlay Bangle', 'url' => 'https://images.unsplash.com/photo-1535632066927-ab7c9ab60908?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Polished Pearl Conch', 'url' => 'https://images.unsplash.com/photo-1544735716-392fe2489ffa?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Miniature Shell Message Bottle', 'url' => 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Seashell Bonsai Tree', 'url' => 'https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Hand-painted Oyster Coasters', 'url' => 'https://images.unsplash.com/photo-1595855759920-86582396756a?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Starfish Wall Tapestry', 'url' => 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Seashell Candle Pillar', 'url' => 'https://images.unsplash.com/photo-1603006905003-be475563bc59?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Clam Shell Centerpiece Bowl', 'url' => 'https://images.unsplash.com/photo-154474655-9aed1e956bc2?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Marine Theme Pen Stand', 'url' => 'https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Seashell Gift Box Ornament', 'url' => 'https://images.unsplash.com/photo-1549465220-1a8b9238cd48?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Ocean Theme Hanging Mirror', 'url' => 'https://images.unsplash.com/photo-1513519245088-0e12902e5a38?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Polished Scallop Shell Garland', 'url' => 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Pearlized Abalone Pendant', 'url' => 'https://images.unsplash.com/photo-1599643478518-a784e5dc4c8f?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Beach Sand & Shell Coaster', 'url' => 'https://images.unsplash.com/photo-1595855759920-86582396756a?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Seashell Windchime Large', 'url' => 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Ocean Resin Coaster', 'url' => 'https://images.unsplash.com/photo-154474655-9aed1e956bc2?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Sea Urchin Accent Light', 'url' => 'https://images.unsplash.com/photo-1513519245088-0e12902e5a38?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Clam Shell Dish Set', 'url' => 'https://images.unsplash.com/photo-1599643478518-a784e5dc4c8f?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Seashell Keychain Set', 'url' => 'https://images.unsplash.com/photo-1549465220-1a8b9238cd48?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Ocean Wave Acrylic Painting', 'url' => 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Golden Trim Oyster Dishes', 'url' => 'https://images.unsplash.com/photo-1535632066927-ab7c9ab60908?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Rustic Beach Wood Signboard', 'url' => 'https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Starfish Pattern Photo Frame', 'url' => 'https://images.unsplash.com/photo-1595855759920-86582396756a?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Handcrafted Shell Bookmark', 'url' => 'https://images.unsplash.com/photo-154474655-9aed1e956bc2?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Sea Glass Wrapped Bracelet', 'url' => 'https://images.unsplash.com/photo-1599643478518-a784e5dc4c8f?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Tropical Conch Wall Decor', 'url' => 'https://images.unsplash.com/photo-1513519245088-0e12902e5a38?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Seashell Embedded Coffin Box', 'url' => 'https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Starfish Table Runner', 'url' => 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Hanging Driftwood Chime', 'url' => 'https://images.unsplash.com/photo-154474655-9aed1e956bc2?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Iridescent Conch Nightlight', 'url' => 'https://images.unsplash.com/photo-1513519245088-0e12902e5a38?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Seashell Mosaic Mirror', 'url' => 'https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Ocean Reef Trinket Pot', 'url' => 'https://images.unsplash.com/photo-1599643478518-a784e5dc4c8f?w=600&auto=format&fit=crop&q=80'],
['filename' => 'Abalone Shell Inlay Coaster', 'url' => 'https://images.unsplash.com/photo-1535632066927-ab7c9ab60908?w=600&auto=format&fit=crop&q=80']
];
foreach ($items as $item) {
Gallery::create([
'filename' => $item['filename'],
'url' => $item['url'],
'status' => 'Active'
]);
}
}
}
...@@ -15,6 +15,13 @@ class ProductSeeder extends Seeder ...@@ -15,6 +15,13 @@ class ProductSeeder extends Seeder
*/ */
public function run(): void public function run(): void
{ {
// Ensure standard sizes exist
$sizesMap = [
'Small' => \App\Models\Size::firstOrCreate(['code' => 'S'], ['name' => 'Small', 'status' => 'Active']),
'Medium' => \App\Models\Size::firstOrCreate(['code' => 'M'], ['name' => 'Medium', 'status' => 'Active']),
'Large' => \App\Models\Size::firstOrCreate(['code' => 'L'], ['name' => 'Large', 'status' => 'Active']),
];
// 1. Ensure Categories exist // 1. Ensure Categories exist
$cats = [ $cats = [
'Seashell Hand Crafts' => 'seashell-hand-crafts', 'Seashell Hand Crafts' => 'seashell-hand-crafts',
...@@ -618,19 +625,19 @@ class ProductSeeder extends Seeder ...@@ -618,19 +625,19 @@ class ProductSeeder extends Seeder
// 4. Create Product Size and Price Variants dynamically // 4. Create Product Size and Price Variants dynamically
// Small variant (default base price) // Small variant (default base price)
\App\Models\ProductVariant::updateOrCreate( \App\Models\ProductVariant::updateOrCreate(
['product_id' => $product->id, 'size' => 'Small'], ['product_id' => $product->id, 'size_id' => $sizesMap['Small']->id],
['price' => $data['price'], 'stock_quantity' => 25] ['price' => $data['price'], 'stock_quantity' => 25]
); );
// Medium variant (+25% price) // Medium variant (+25% price)
\App\Models\ProductVariant::updateOrCreate( \App\Models\ProductVariant::updateOrCreate(
['product_id' => $product->id, 'size' => 'Medium'], ['product_id' => $product->id, 'size_id' => $sizesMap['Medium']->id],
['price' => $data['price'] * 1.25, 'stock_quantity' => 20] ['price' => $data['price'] * 1.25, 'stock_quantity' => 20]
); );
// Large variant (+50% price) // Large variant (+50% price)
\App\Models\ProductVariant::updateOrCreate( \App\Models\ProductVariant::updateOrCreate(
['product_id' => $product->id, 'size' => 'Large'], ['product_id' => $product->id, 'size_id' => $sizesMap['Large']->id],
['price' => $data['price'] * 1.50, 'stock_quantity' => 12] ['price' => $data['price'] * 1.50, 'stock_quantity' => 12]
); );
} }
......
...@@ -42,27 +42,37 @@ function saveCart() { ...@@ -42,27 +42,37 @@ function saveCart() {
$(document).ready(function() { $(document).ready(function() {
updateCartHeader(); updateCartHeader();
// Size Selection toggles // Size Selection toggles and price updates
$(document).on('click', '.size-btn', function() { $(document).on('click', '.size-btn', function() {
$(this).siblings().removeClass('active'); $(this).siblings().removeClass('active');
$(this).addClass('active'); $(this).addClass('active');
const newPrice = $(this).attr('data-price');
if (newPrice) {
const card = $(this).closest('.product-card-body, .product-card, .card-body, .product-detail-info');
card.find('.display-price, .product-price').text('₹' + parseInt(newPrice).toLocaleString());
card.find('.btn-add-to-cart-dynamic').attr('data-price', newPrice);
}
}); });
// Add to cart buttons (for bestsellers & product detail page) // Add to cart buttons (for bestsellers & product detail page)
$(document).on('click', '.btn-add-to-cart-dynamic', function() { $(document).on('click', '.btn-add-to-cart-dynamic', function() {
let card = $(this).closest('.product-card-body, .product-detail-info'); let card = $(this).closest('.product-card-body, .product-card, .card-body, .product-detail-info');
let id = $(this).data('id') || 'p1'; let id = $(this).data('id') || 'p1';
let name = $(this).data('name') || card.find('.product-title, h1').text().trim(); let name = $(this).data('name') || card.find('.product-title, h1').text().trim();
let price = parseInt($(this).data('price')) || 450; let price = parseInt($(this).data('price')) || 450;
let img = $(this).data('img') || ''; let img = $(this).data('img') || '';
let size = card.find('.size-btn.active').text() || 'Small';
let sizeBtn = card.find('.size-btn.active');
let size = sizeBtn.text().trim() || 'Small';
let variantId = sizeBtn.attr('data-variant-id') || null;
let quantity = parseInt($('#detail-qty').val()) || 1; let quantity = parseInt($('#detail-qty').val()) || 1;
let existing = cart.find(item => item.id === id && item.size === size); let existing = cart.find(item => item.id === id && item.size === size);
if (existing) { if (existing) {
existing.quantity += quantity; existing.quantity += quantity;
} else { } else {
cart.push({ id, name, price, img, size, quantity }); cart.push({ id, name, price, img, size, variantId, quantity });
} }
saveCart(); saveCart();
...@@ -195,6 +205,53 @@ $(document).ready(function() { ...@@ -195,6 +205,53 @@ $(document).ready(function() {
let subtotal = cart.reduce((sum, item) => sum + (item.price * item.quantity), 0); let subtotal = cart.reduce((sum, item) => sum + (item.price * item.quantity), 0);
$('#summary-subtotal').text('₹' + subtotal); $('#summary-subtotal').text('₹' + subtotal);
$('#summary-total').text('₹' + subtotal); $('#summary-total').text('₹' + subtotal);
// --- Dynamic State & City Dropdowns ---
$.ajax({
url: '/api/states',
method: 'GET',
success: function(res) {
if (res.success && res.data) {
res.data.forEach(function(state) {
$('#checkout_state').append(
$('<option>').val(state.name).text(state.name)
);
});
}
}
});
// When state changes, load cities
$('#checkout_state').on('change', function() {
let stateName = $(this).val();
let citySelect = $('#checkout_city');
citySelect.html('<option value="">Loading...</option>').prop('disabled', true);
if (!stateName) {
citySelect.html('<option value="">Select City</option>').prop('disabled', true);
return;
}
$.ajax({
url: '/api/cities',
method: 'GET',
data: { state: stateName },
success: function(res) {
citySelect.html('<option value="">Select City</option>');
if (res.success && res.data) {
res.data.forEach(function(city) {
citySelect.append(
$('<option>').val(city.name).text(city.name)
);
});
}
citySelect.prop('disabled', false);
},
error: function() {
citySelect.html('<option value="">Select City</option>').prop('disabled', true);
}
});
});
} }
// Payment Selection // Payment Selection
...@@ -205,13 +262,13 @@ $(document).ready(function() { ...@@ -205,13 +262,13 @@ $(document).ready(function() {
// Gallery Lightbox Modal // Gallery Lightbox Modal
let galleryImages = []; let galleryImages = [];
$('.gallery-grid .gallery-item img').each(function() { $('.gallery-masonry .gallery-masonry-item img').each(function() {
galleryImages.push($(this).attr('src')); galleryImages.push($(this).attr('src'));
}); });
let currentImgIdx = 0; let currentImgIdx = 0;
$('.gallery-grid .gallery-item').click(function() { $('.gallery-masonry .gallery-masonry-item').click(function() {
let imgUrl = $(this).find('img').attr('src'); let imgUrl = $(this).find('img').attr('src');
currentImgIdx = galleryImages.indexOf(imgUrl); currentImgIdx = galleryImages.indexOf(imgUrl);
$('#lightbox-img').attr('src', imgUrl); $('#lightbox-img').attr('src', imgUrl);
...@@ -262,7 +319,7 @@ $(document).ready(function() { ...@@ -262,7 +319,7 @@ $(document).ready(function() {
let items = cart.map(item => { let items = cart.map(item => {
return { return {
product_id: item.id, product_id: item.id,
variant_id: null, // simple override if custom variants needed variant_id: item.variantId || null,
quantity: item.quantity quantity: item.quantity
}; };
}); });
...@@ -280,8 +337,8 @@ $(document).ready(function() { ...@@ -280,8 +337,8 @@ $(document).ready(function() {
email: $('input[name="email"]').val(), email: $('input[name="email"]').val(),
phone: $('input[name="phone"]').val(), phone: $('input[name="phone"]').val(),
shipping_address: $('input[name="shipping_address"]').val(), shipping_address: $('input[name="shipping_address"]').val(),
city: $('input[name="city"]').val(), city: $('#checkout_city').val(),
state: $('input[name="state"]').val(), state: $('#checkout_state').val(),
pincode: $('input[name="pincode"]').val(), pincode: $('input[name="pincode"]').val(),
payment_method: paymentMethod, payment_method: paymentMethod,
coupon_code: appliedCoupon ? 'OCEAN10' : null, coupon_code: appliedCoupon ? 'OCEAN10' : null,
......
...@@ -21,27 +21,37 @@ function saveCart() { ...@@ -21,27 +21,37 @@ function saveCart() {
$(document).ready(function() { $(document).ready(function() {
updateCartHeader(); updateCartHeader();
// Size Selection toggles // Size Selection toggles and price updates
$(document).on('click', '.size-btn', function() { $(document).on('click', '.size-btn', function() {
$(this).siblings().removeClass('active'); $(this).siblings().removeClass('active');
$(this).addClass('active'); $(this).addClass('active');
const newPrice = $(this).attr('data-price');
if (newPrice) {
const card = $(this).closest('.product-card-body, .product-card, .card-body, .product-detail-info');
card.find('.display-price, .product-price').text('₹' + parseInt(newPrice).toLocaleString());
card.find('.btn-add-to-cart-dynamic').attr('data-price', newPrice);
}
}); });
// Add to cart buttons (for bestsellers & product detail page) // Add to cart buttons (for bestsellers & product detail page)
$(document).on('click', '.btn-add-to-cart-dynamic', function() { $(document).on('click', '.btn-add-to-cart-dynamic', function() {
let card = $(this).closest('.product-card-body, .product-detail-info'); let card = $(this).closest('.product-card-body, .product-card, .card-body, .product-detail-info');
let id = $(this).data('id') || 'p1'; let id = $(this).data('id') || 'p1';
let name = $(this).data('name') || card.find('.product-title, h1').text().trim(); let name = $(this).data('name') || card.find('.product-title, h1').text().trim();
let price = parseInt($(this).data('price')) || 450; let price = parseInt($(this).data('price')) || 450;
let img = $(this).data('img') || ''; let img = $(this).data('img') || '';
let size = card.find('.size-btn.active').text() || 'Small';
let sizeBtn = card.find('.size-btn.active');
let size = sizeBtn.text().trim() || 'Small';
let variantId = sizeBtn.attr('data-variant-id') || null;
let quantity = parseInt($('#detail-qty').val()) || 1; let quantity = parseInt($('#detail-qty').val()) || 1;
let existing = cart.find(item => item.id === id && item.size === size); let existing = cart.find(item => item.id === id && item.size === size);
if (existing) { if (existing) {
existing.quantity += quantity; existing.quantity += quantity;
} else { } else {
cart.push({ id, name, price, img, size, quantity }); cart.push({ id, name, price, img, size, variantId, quantity });
} }
saveCart(); saveCart();
...@@ -160,13 +170,13 @@ $(document).ready(function() { ...@@ -160,13 +170,13 @@ $(document).ready(function() {
// Gallery Lightbox Modal // Gallery Lightbox Modal
let galleryImages = []; let galleryImages = [];
$('.gallery-grid .gallery-item img').each(function() { $('.gallery-masonry .gallery-masonry-item img').each(function() {
galleryImages.push($(this).attr('src')); galleryImages.push($(this).attr('src'));
}); });
let currentImgIdx = 0; let currentImgIdx = 0;
$('.gallery-grid .gallery-item').click(function() { $('.gallery-masonry .gallery-masonry-item').click(function() {
let imgUrl = $(this).find('img').attr('src'); let imgUrl = $(this).find('img').attr('src');
currentImgIdx = galleryImages.indexOf(imgUrl); currentImgIdx = galleryImages.indexOf(imgUrl);
$('#lightbox-img').attr('src', imgUrl); $('#lightbox-img').attr('src', imgUrl);
......
...@@ -619,47 +619,104 @@ h1, h2, h3, h4, h5, h6 { ...@@ -619,47 +619,104 @@ h1, h2, h3, h4, h5, h6 {
line-height: 1.4; line-height: 1.4;
} }
/* Gallery Masonry Layout */ /* Gallery Page – Edge-to-Edge Masonry Collage */
.gallery-grid:not(.row) { .gallery-page-wrapper {
column-count: 4; padding: 0;
column-gap: 1.2rem; margin: 0;
width: 100%;
} }
@media (max-width: 992px) { .gallery-page-header {
.gallery-grid:not(.row) { padding: 2.5rem 1rem 1.5rem;
column-count: 3; background: #fafbfc;
}
} }
@media (max-width: 768px) {
.gallery-grid:not(.row) { .gallery-page-title {
column-count: 2; font-size: 2rem;
} font-weight: 800;
color: #3a3a3a;
font-family: 'Plus Jakarta Sans', sans-serif;
margin-bottom: 0.3rem;
} }
@media (max-width: 480px) {
.gallery-grid:not(.row) { .gallery-page-subtitle {
column-count: 1; color: #888;
} font-size: 0.95rem;
margin-bottom: 0;
} }
.gallery-item { .gallery-masonry {
column-count: 5;
column-gap: 6px;
padding: 6px;
background: #f0f0f0;
}
.gallery-masonry-item {
break-inside: avoid; break-inside: avoid;
margin-bottom: 1.2rem; margin-bottom: 6px;
border-radius: 12px; border-radius: 10px;
overflow: hidden; overflow: hidden;
position: relative;
cursor: pointer; cursor: pointer;
box-shadow: 0 4px 6px rgba(0,0,0,0.05); transition: transform 0.3s ease, box-shadow 0.3s ease;
transition: all 0.3s ease;
} }
.gallery-item:hover { .gallery-masonry-item:hover {
transform: scale(1.02); transform: scale(1.015);
box-shadow: 0 10px 20px rgba(0,0,0,0.12); box-shadow: 0 8px 24px rgba(0,0,0,0.18);
z-index: 2;
} }
.gallery-item img { .gallery-masonry-item img {
width: 100%; width: 100%;
height: auto; height: auto;
display: block; display: block;
transition: transform 0.4s ease;
}
.gallery-masonry-item:hover img {
transform: scale(1.05);
}
.gallery-masonry-overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 14px 12px 10px;
background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, transparent 100%);
opacity: 0;
transition: opacity 0.3s ease;
pointer-events: none;
}
.gallery-masonry-item:hover .gallery-masonry-overlay {
opacity: 1;
}
.gallery-masonry-label {
color: #fff;
font-size: 0.82rem;
font-weight: 600;
font-family: 'Plus Jakarta Sans', sans-serif;
text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
/* Gallery responsive breakpoints */
@media (max-width: 1200px) {
.gallery-masonry { column-count: 4; }
}
@media (max-width: 992px) {
.gallery-masonry { column-count: 3; }
}
@media (max-width: 768px) {
.gallery-masonry { column-count: 2; column-gap: 4px; padding: 4px; }
.gallery-masonry-item { margin-bottom: 4px; border-radius: 6px; }
}
@media (max-width: 480px) {
.gallery-masonry { column-count: 2; column-gap: 3px; padding: 3px; }
.gallery-masonry-item { margin-bottom: 3px; border-radius: 4px; }
} }
/* Lightbox Modal */ /* Lightbox Modal */
...@@ -1014,9 +1071,6 @@ footer a:hover { ...@@ -1014,9 +1071,6 @@ footer a:hover {
margin-bottom: 3rem; margin-bottom: 3rem;
max-width: 480px; max-width: 480px;
} }
.gallery-grid:not(.row) {
column-count: 2;
}
} }
@media (max-width: 768px) { @media (max-width: 768px) {
...@@ -1044,9 +1098,6 @@ footer a:hover { ...@@ -1044,9 +1098,6 @@ footer a:hover {
padding-top: 50px; padding-top: 50px;
padding-bottom: 50px; padding-bottom: 50px;
} }
.gallery-grid:not(.row) {
column-count: 1;
}
.feature-badge { .feature-badge {
flex-direction: column; flex-direction: column;
text-align: center; text-align: center;
......
# Placeholder for products upload directory
...@@ -498,8 +498,6 @@ ...@@ -498,8 +498,6 @@
<li><a href="#country" data-tab="country"><i class="fa-solid fa-globe"></i>Countries</a></li> <li><a href="#country" data-tab="country"><i class="fa-solid fa-globe"></i>Countries</a></li>
<li><a href="#state" data-tab="state"><i class="fa-solid fa-map"></i>States</a></li> <li><a href="#state" data-tab="state"><i class="fa-solid fa-map"></i>States</a></li>
<li><a href="#city" data-tab="city"><i class="fa-solid fa-city"></i>Cities</a></li> <li><a href="#city" data-tab="city"><i class="fa-solid fa-city"></i>Cities</a></li>
<li><a href="#unit" data-tab="unit"><i class="fa-solid fa-scale-balanced"></i>Units</a></li>
<li><a href="#unitsizes" data-tab="unitsizes"><i class="fa-solid fa-ruler-combined"></i>Unit Sizes</a></li>
<li><a href="#category" data-tab="category"><i class="fa-solid fa-list"></i>Categories</a></li> <li><a href="#category" data-tab="category"><i class="fa-solid fa-list"></i>Categories</a></li>
</ul> </ul>
</div> </div>
...@@ -565,16 +563,6 @@ ...@@ -565,16 +563,6 @@
@include('admin.city') @include('admin.city')
</div> </div>
<!-- Tab Pane: Unit -->
<div id="tab-unit" class="tab-pane-content d-none">
@include('admin.unit')
</div>
<!-- Tab Pane: Unit Sizes -->
<div id="tab-unitsizes" class="tab-pane-content d-none">
@include('admin.unitsizes')
</div>
<!-- Tab Pane: Category --> <!-- Tab Pane: Category -->
<div id="tab-category" class="tab-pane-content d-none"> <div id="tab-category" class="tab-pane-content d-none">
@include('admin.category') @include('admin.category')
......
@extends('layouts.admin') @extends('layouts.admin')
@section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Manage Portal</li>
<li class="breadcrumb-item active" aria-current="page">Announcements</li>
</ol>
</nav>
@endsection
@section('page_title', 'Announcements')
@section('page_description', 'Manage store announcements.')
@section('content') @section('content')
<div class="panel-card"> <div class="panel-card">
<div class="table-responsive"> <div class="table-responsive">
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Login - VSI Mart</title>
<!-- Bootstrap 5 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- FontAwesome 6 Icons -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Plus Jakarta Sans', sans-serif;
background-color: #03489F;
color: #1e293b;
margin: 0;
overflow-x: hidden;
}
.shells-ai-loader-container {
width: 140px;
height: 140px;
margin-bottom: 25px;
position: relative;
animation: shells-float 3.5s ease-in-out infinite;
}
.shells-ai-svg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
transition: opacity 0.8s ease-in-out;
}
.shells-ai-svg.shell-scallop {
animation: cycle-shell-1 8s infinite ease-in-out;
}
.shells-ai-svg.shell-conch {
animation: cycle-shell-2 8s infinite ease-in-out;
}
.shells-ai-svg.shell-cowrie {
animation: cycle-shell-3 8s infinite ease-in-out;
}
.shells-ai-svg.shell-snail {
animation: cycle-shell-4 8s infinite ease-in-out;
}
@keyframes shells-float {
0%, 100% { transform: translateY(0) scale(1); }
50% { transform: translateY(-18px) scale(1.05); }
}
@keyframes cycle-shell-1 {
0%, 20% { opacity: 1; filter: drop-shadow(0 0 18px rgba(227, 82, 107, 0.85)); }
25%, 95% { opacity: 0; }
100% { opacity: 1; }
}
@keyframes cycle-shell-2 {
0%, 20% { opacity: 0; }
25%, 45% { opacity: 1; filter: drop-shadow(0 0 20px rgba(255, 91, 0, 0.95)); }
50%, 100% { opacity: 0; }
}
@keyframes cycle-shell-3 {
0%, 45% { opacity: 0; }
50%, 70% { opacity: 1; filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.9)); }
75%, 100% { opacity: 0; }
}
@keyframes cycle-shell-4 {
0%, 70% { opacity: 0; }
75%, 95% { opacity: 1; filter: drop-shadow(0 0 20px rgba(76, 163, 117, 0.9)); }
100% { opacity: 0; }
}
/* Glassmorphism Login Container */
.login-overlay {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: linear-gradient(135deg, #03489F 0%, #2172E2 100%);
display: flex;
align-items: center;
justify-content: center;
z-index: 1500;
}
.login-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 24px;
padding: 40px;
width: 100%;
max-width: 440px;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
color: white;
text-align: center;
}
</style>
</head>
<body>
<div class="login-overlay">
<div class="login-card">
<div class="shells-ai-loader-container mx-auto">
<svg viewBox="0 0 100 100" class="shells-ai-svg shell-scallop">
<defs>
<linearGradient id="scallopGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#FF8A8A" />
<stop offset="50%" stop-color="#E3526B" />
<stop offset="100%" stop-color="#9C1E3E" />
</linearGradient>
</defs>
<path d="M50,12 C44,30 32,45 22,62 C16,72 19,82 30,84 C38,85 45,74 50,67 C55,74 62,85 70,84 C81,82 84,72 78,62 C68,45 56,30 50,12 Z" fill="url(#scallopGrad)"/>
<path d="M50,12 L50,67 M50,12 C47,30 43,48 40,65 M50,12 C53,30 57,48 60,65 M50,12 C40,30 30,48 26,67 M50,12 C60,30 70,48 74,67 M50,12 C35,30 22,48 18,70 M50,12 C65,30 78,48 82,70" stroke="rgba(255,255,255,0.45)" stroke-width="2" fill="none"/>
</svg>
<svg viewBox="0 0 100 100" class="shells-ai-svg shell-conch">
<defs>
<linearGradient id="conchGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#FFEED4" />
<stop offset="60%" stop-color="#FFBD8A" />
<stop offset="100%" stop-color="#FF5B00" />
</linearGradient>
</defs>
<path d="M45,15 C48,22 55,25 60,20 C65,15 58,10 50,8 C40,6 35,12 40,18 Z" fill="#FFEED4"/>
<path d="M40,18 C30,30 20,48 22,65 C24,80 40,82 50,75 C62,65 72,40 68,28 C64,18 52,15 40,18 Z" fill="url(#conchGrad)"/>
<path d="M48,32 C42,42 35,55 38,72 C40,80 50,82 54,75 C58,68 62,55 58,40 C55,32 50,30 48,32 Z" fill="#FF5B00" opacity="0.9"/>
<path d="M38,20 C32,32 26,45 28,60 M46,20 C42,32 38,48 40,65" stroke="rgba(255,255,255,0.3)" stroke-width="2.2" fill="none"/>
</svg>
<svg viewBox="0 0 100 100" class="shells-ai-svg shell-cowrie">
<defs>
<linearGradient id="cowrieGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#FFFFFF" />
<stop offset="70%" stop-color="#F2EFE9" />
<stop offset="100%" stop-color="#D9D0C1" />
</linearGradient>
</defs>
<path d="M50,15 C32,15 25,32 25,50 C25,68 32,85 50,85 C68,85 75,68 75,50 C75,32 68,15 50,15 Z" fill="url(#cowrieGrad)" stroke="#C4B9A3" stroke-width="1"/>
<path d="M50,22 C48,35 48,65 50,78" stroke="#877C68" stroke-width="4" stroke-linecap="round" fill="none"/>
<path d="M43,30 L48,30 M43,38 L48,38 M43,46 L48,46 M43,54 L48,54 M43,62 L48,62 M43,70 L48,70 M57,30 L52,30 M57,38 L52,38 M57,46 L52,46 M57,54 L52,54 M57,62 L52,62 M57,70 L52,70" stroke="#877C68" stroke-width="1.8"/>
</svg>
<svg viewBox="0 0 100 100" class="shells-ai-svg shell-snail">
<defs>
<linearGradient id="snailGrad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#9CDEB5" />
<stop offset="50%" stop-color="#4CA375" />
<stop offset="100%" stop-color="#216E45" />
</linearGradient>
</defs>
<path d="M50,18 C30,18 20,32 20,50 C20,68 35,82 50,82 C65,82 80,68 80,50 C80,35 70,22 55,20 C42,18 32,28 32,42 C32,54 42,62 52,60 C60,58 65,50 62,42 C60,35 52,32 48,38" fill="url(#snailGrad)"/>
<path d="M50,18 C30,18 20,32 20,50 C20,68 35,82 50,82 C65,82 80,68 80,50" stroke="#104A2B" stroke-width="2.5" fill="none"/>
<path d="M55,20 C42,18 32,28 32,42 C32,54 42,62 52,60" stroke="#104A2B" stroke-width="1.8" fill="none"/>
<path d="M22,40 L30,42 M22,60 L31,56 M35,76 L40,68 M55,80 L52,71 M72,70 L65,63 M78,50 L68,48 M70,32 L62,35 M55,20 L52,30" stroke="rgba(255,255,255,0.4)" stroke-width="2"/>
</svg>
</div>
<h3 class="fw-bold mb-2">VSI Mart Admin</h3>
<p class="text-white-50 mb-4">Please log in to manage your inventory and store operations.</p>
@if (session('success'))
<div class="alert alert-success py-2">{{ session('success') }}</div>
@endif
<form method="POST" action="{{ url('/admin/login') }}">
@csrf
<div class="mb-3 text-start">
<label class="form-label small fw-semibold text-white-50">Username</label>
<input type="text" name="email" class="form-control bg-transparent text-white border-white-50 rounded-pill px-3" value="{{ old('email', 'admin') }}" required autofocus>
@error('email')
<span class="text-warning small mt-1 d-block">{{ $message }}</span>
@enderror
</div>
<div class="mb-4 text-start">
<label class="form-label small fw-semibold text-white-50">Password</label>
<input type="password" name="password" class="form-control bg-transparent text-white border-white-50 rounded-pill px-3" value="admin123" required>
@error('password')
<span class="text-warning small mt-1 d-block">{{ $message }}</span>
@enderror
</div>
<div class="mb-3 text-start form-check ms-2">
<input type="checkbox" class="form-check-input border-white-50" name="remember" id="remember">
<label class="form-check-label text-white-50 small" for="remember">Remember me</label>
</div>
<button type="submit" class="btn btn-warning w-100 rounded-pill py-2.5 fw-bold text-dark mb-2">Login</button>
</form>
</div>
</div>
</body>
</html>
@extends('layouts.admin') @extends('layouts.admin')
@section('content') @section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Master Data</li>
<li class="breadcrumb-item active" aria-current="page">Categories</li>
</ol>
</nav>
@endsection
@section('page_title', 'Categories') @section('page_title', 'Categories')
@section('page_description', 'Manage master data for Categories')
@section('content')
@section('page_action') @section('page_action')
<button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add New</button> <button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add New</button>
......
@extends('layouts.admin') @extends('layouts.admin')
@section('content') @section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Master Data</li>
<li class="breadcrumb-item active" aria-current="page">Cities</li>
</ol>
</nav>
@endsection
@section('page_title', 'Cities') @section('page_title', 'Cities')
@section('page_description', 'Manage master data for Cities')
@section('content')
@section('page_action') @section('page_action')
<button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add New</button> <button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add New</button>
......
@extends('layouts.admin') @extends('layouts.admin')
@section('content') @section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Master Data</li>
<li class="breadcrumb-item active" aria-current="page">Countries</li>
</ol>
</nav>
@endsection
@section('page_title', 'Countries') @section('page_title', 'Countries')
@section('page_description', 'Manage master data for Countries')
@section('content')
@section('page_action') @section('page_action')
<button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add New</button> <button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add New</button>
......
@extends('layouts.admin') @extends('layouts.admin')
@section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Manage Portal</li>
<li class="breadcrumb-item active" aria-current="page">Coupons</li>
</ol>
</nav>
@endsection
@section('page_title', 'Coupons')
@section('page_description', 'Create and manage promotional discount coupons.')
@section('content') @section('content')
<div class="panel-card"> <div class="panel-card">
<div class="table-responsive"> <div class="table-responsive">
......
@extends('layouts.admin') @extends('layouts.admin')
@section('content') @section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Manage Portal</li>
<li class="breadcrumb-item active" aria-current="page">Gallery</li>
</ol>
</nav>
@endsection
@section('page_title', 'Gallery') @section('page_title', 'Gallery')
@section('page_description', 'Manage master data for Gallery Images') @section('page_description', 'Manage product images and promotional media.')
@section('page_action') @section('page_action')
<button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add New Image</button> <a href="{{ url('/admin/gallery/create') }}" class="btn btn-primary rounded-pill px-4">+ Add New Image</a>
@endsection @endsection
@push('scripts') @section('content')
<!-- CRUD Modal --> <div class="panel-card shadow-sm border-0 p-4">
<div class="modal fade" id="crudModal" tabindex="-1">
<div class="modal-dialog">
<form method="POST" action="" id="crudForm">
@csrf
<input type="hidden" name="_method" id="crudMethod" value="POST">
<div class="modal-content">
<div class="modal-header border-0 pb-0">
<h5 class="modal-title fw-bold" id="crudModalLabel">Create Gallery Entry</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body pt-4">
<div class="mb-3">
<label class="form-label">Filename (Title)</label>
<input type="text" class="form-control" name="filename" id="crud_filename" required>
</div>
<div class="mb-3">
<label class="form-label">Image URL</label>
<input type="url" class="form-control" name="url" id="crud_url" required placeholder="https://example.com/image.jpg">
</div>
<div class="mb-3">
<label class="form-label">Status</label>
<select class="form-select" name="status" id="crud_status">
<option value="Active">Active</option>
<option value="Inactive">Inactive</option>
</select>
</div>
</div>
<div class="modal-footer border-0 pt-0">
<button type="button" class="btn btn-light rounded-pill px-4" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary rounded-pill px-4" id="crudSubmitBtn">Save Changes</button>
</div>
</div>
</form>
</div>
</div>
<script>
const entityData = @json($gallery);
function openCreateModal() {
document.getElementById('crudModalLabel').innerText = 'Create Gallery Entry';
document.getElementById('crudMethod').value = 'POST';
document.getElementById('crudForm').action = '/admin/master/gallery';
document.getElementById('crudSubmitBtn').innerText = 'Create';
document.getElementById('crud_filename').value = '';
document.getElementById('crud_url').value = '';
document.getElementById('crud_status').value = 'Active';
}
function openEditModal(type, id) {
const item = entityData.find(x => x.id === id);
if (!item) return;
document.getElementById('crudModalLabel').innerText = 'Edit Gallery Entry';
document.getElementById('crudMethod').value = 'PUT';
document.getElementById('crudForm').action = '/admin/master/gallery/' + id;
document.getElementById('crudSubmitBtn').innerText = 'Update';
document.getElementById('crud_filename').value = item.filename || '';
document.getElementById('crud_url').value = item.url || '';
document.getElementById('crud_status').value = item.status || 'Active';
const modal = new bootstrap.Modal(document.getElementById('crudModal'));
modal.show();
}
</script>
@endpush
<div class="panel-card">
<div class="row row-cols-2 row-cols-md-4 g-4" id="gallery-grid-box"> <div class="row row-cols-2 row-cols-md-4 g-4" id="gallery-grid-box">
@foreach($gallery as $item) @foreach($gallery as $item)
<div class="col"> <div class="col">
...@@ -94,7 +33,7 @@ ...@@ -94,7 +33,7 @@
<div class="card-body p-2 d-flex justify-content-between align-items-center"> <div class="card-body p-2 d-flex justify-content-between align-items-center">
<span class="small text-muted text-truncate" style="max-width:110px;">{{ $item->filename }}</span> <span class="small text-muted text-truncate" style="max-width:110px;">{{ $item->filename }}</span>
<div class="d-flex gap-1"> <div class="d-flex gap-1">
<button class="btn btn-link text-primary p-0 me-1" onclick="openEditModal('gallery', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button> <a href="{{ url('/admin/gallery/' . $item->id . '/edit') }}" class="btn btn-link text-primary p-0 me-1"><i class="fa-solid fa-pen"></i></a>
<button class="btn btn-link text-danger p-0" onclick="deleteRecord('gallery', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button> <button class="btn btn-link text-danger p-0" onclick="deleteRecord('gallery', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</div> </div>
</div> </div>
...@@ -106,5 +45,4 @@ ...@@ -106,5 +45,4 @@
@endif @endif
</div> </div>
</div> </div>
@endsection @endsection
@extends('layouts.admin')
@section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item"><a href="{{ url('/admin/gallery') }}">Gallery</a></li>
<li class="breadcrumb-item active" aria-current="page">Add Image</li>
</ol>
</nav>
@endsection
@section('page_title', 'Add Gallery Image')
@section('content')
<form method="POST" action="{{ url('/admin/master/gallery') }}" enctype="multipart/form-data">
@csrf
<div class="row g-4">
<!-- Main Form Column (Left) -->
<div class="col-lg-8">
<div class="panel-card shadow-sm border-0 h-100 p-4">
<h5 class="fw-bold mb-4 text-dark"><i class="fa-solid fa-file-invoice me-2 text-primary"></i>Image Details</h5>
<div class="mb-4">
<label class="form-label small fw-semibold text-muted">Filename (Title)</label>
<input type="text" class="form-control rounded-3" name="filename" id="crud_filename" placeholder="Enter image title/filename..." required>
</div>
<div class="mb-0">
<label class="form-label small fw-semibold text-muted">Status</label>
<select class="form-select rounded-3" name="status" id="crud_status">
<option value="Active">Active</option>
<option value="Inactive">Inactive</option>
</select>
</div>
</div>
</div>
<!-- Sidebar Column (Right) -->
<div class="col-lg-4">
<div class="d-flex flex-column gap-4">
<!-- Image Upload Card -->
<div class="panel-card shadow-sm border-0 p-4">
<h5 class="fw-bold mb-4 text-dark"><i class="fa-solid fa-image me-2 text-success"></i>Media Upload</h5>
<!-- File Upload Container -->
<div class="mb-3">
<label class="form-label small fw-semibold text-muted">Upload Image File</label>
<div class="upload-dropzone text-center p-3 border border-dashed rounded-3 bg-light position-relative" style="border-color: #cbd5e1 !important; cursor: pointer; transition: all 0.2s ease;">
<i class="fa-solid fa-cloud-arrow-up text-muted mb-2 fs-2 d-block"></i>
<span class="small text-muted d-block mb-1">Choose file to upload</span>
<span class="x-small text-muted d-block opacity-75">(JPG, PNG, WEBP)</span>
<input type="file" name="image_file" id="image_file" class="position-absolute top-0 start-0 opacity-0 w-100 h-100" style="cursor: pointer;" onchange="previewUploadImage(this)">
</div>
<div id="file_preview_container" class="mt-3 d-none text-center">
<img id="file_preview" src="" alt="Preview" class="img-thumbnail" style="max-height: 120px; border-radius: 8px;">
<span class="small d-block text-success mt-1 fw-semibold"><i class="fa-solid fa-circle-check me-1"></i>File selected</span>
</div>
</div>
<div class="text-center my-3 text-muted small fw-bold">--- OR ---</div>
<!-- Remote URL input -->
<div class="mb-0">
<label class="form-label small fw-semibold text-muted">Stock Image URL</label>
<input type="url" class="form-control rounded-3" name="url" id="crud_url" placeholder="https://example.com/image.jpg" oninput="previewUrlImage(this.value)">
<div id="url_preview_container" class="mt-3 d-none text-center">
<img id="url_preview" src="" alt="URL Preview" class="img-thumbnail" style="max-height: 120px; border-radius: 8px;">
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Action buttons footer -->
<div class="panel-card shadow-sm border-0 mt-4 p-3 d-flex justify-content-end align-items-center bg-white rounded-3">
<a href="{{ url('/admin/gallery') }}" class="btn btn-light rounded-pill px-4 me-2 fw-semibold">Cancel</a>
<button type="submit" class="btn btn-primary rounded-pill px-4 py-2 fw-semibold shadow-sm"><i class="fa-solid fa-floppy-disk me-2"></i>Create Entry</button>
</div>
</form>
@push('scripts')
<script>
function previewUploadImage(input) {
if (input.files && input.files[0]) {
const reader = new FileReader();
reader.onload = function(e) {
document.getElementById('file_preview').src = e.target.result;
document.getElementById('file_preview_container').classList.remove('d-none');
document.getElementById('url_preview_container').classList.add('d-none');
document.getElementById('crud_url').value = '';
}
reader.readAsDataURL(input.files[0]);
}
}
function previewUrlImage(url) {
if (url && url.startsWith('http')) {
document.getElementById('url_preview').src = url;
document.getElementById('url_preview_container').classList.remove('d-none');
document.getElementById('file_preview_container').classList.add('d-none');
document.getElementById('image_file').value = '';
} else {
document.getElementById('url_preview_container').classList.add('d-none');
}
}
const zone = document.querySelector('.upload-dropzone');
if (zone) {
zone.addEventListener('dragover', () => zone.style.backgroundColor = '#e2e8f0');
zone.addEventListener('dragleave', () => zone.style.backgroundColor = '#f8fafc');
zone.addEventListener('drop', () => zone.style.backgroundColor = '#f8fafc');
}
</script>
@endpush
@endsection
@extends('layouts.admin')
@section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item"><a href="{{ url('/admin/gallery') }}">Gallery</a></li>
<li class="breadcrumb-item active" aria-current="page">Edit Image</li>
</ol>
</nav>
@endsection
@section('page_title', 'Edit Gallery Image')
@section('content')
<form method="POST" action="{{ url('/admin/master/gallery/' . $gallery->id) }}" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="row g-4">
<!-- Main Form Column (Left) -->
<div class="col-lg-8">
<div class="panel-card shadow-sm border-0 h-100 p-4">
<h5 class="fw-bold mb-4 text-dark"><i class="fa-solid fa-file-invoice me-2 text-primary"></i>Image Details</h5>
<div class="mb-4">
<label class="form-label small fw-semibold text-muted">Filename (Title)</label>
<input type="text" class="form-control rounded-3" name="filename" id="crud_filename" value="{{ $gallery->filename }}" placeholder="Enter image title/filename..." required>
</div>
<div class="mb-0">
<label class="form-label small fw-semibold text-muted">Status</label>
<select class="form-select rounded-3" name="status" id="crud_status">
<option value="Active" {{ $gallery->status === 'Active' ? 'selected' : '' }}>Active</option>
<option value="Inactive" {{ $gallery->status === 'Inactive' ? 'selected' : '' }}>Inactive</option>
</select>
</div>
</div>
</div>
<!-- Sidebar Column (Right) -->
<div class="col-lg-4">
<div class="d-flex flex-column gap-4">
<!-- Image Upload Card -->
<div class="panel-card shadow-sm border-0 p-4">
<h5 class="fw-bold mb-4 text-dark"><i class="fa-solid fa-image me-2 text-success"></i>Media Upload</h5>
<!-- File Upload Container -->
<div class="mb-3">
<label class="form-label small fw-semibold text-muted">Upload New Image File</label>
<div class="upload-dropzone text-center p-3 border border-dashed rounded-3 bg-light position-relative" style="border-color: #cbd5e1 !important; cursor: pointer; transition: all 0.2s ease;">
<i class="fa-solid fa-cloud-arrow-up text-muted mb-2 fs-2 d-block"></i>
<span class="small text-muted d-block mb-1">Choose file to upload</span>
<span class="x-small text-muted d-block opacity-75">(JPG, PNG, WEBP)</span>
<input type="file" name="image_file" id="image_file" class="position-absolute top-0 start-0 opacity-0 w-100 h-100" style="cursor: pointer;" onchange="previewUploadImage(this)">
</div>
<!-- Show current file path preview or fallback -->
<div id="file_preview_container" class="mt-3 text-center {{ $gallery->url && !str_starts_with($gallery->url, 'http') ? '' : 'd-none' }}">
<img id="file_preview" src="{{ $gallery->url && !str_starts_with($gallery->url, 'http') ? $gallery->url : '' }}" alt="Preview" class="img-thumbnail" style="max-height: 120px; border-radius: 8px;">
<span class="small d-block text-success mt-1 fw-semibold"><i class="fa-solid fa-circle-check me-1"></i>Current Uploaded File</span>
</div>
</div>
<div class="text-center my-3 text-muted small fw-bold">--- OR ---</div>
<!-- Remote URL input -->
<div class="mb-0">
<label class="form-label small fw-semibold text-muted">Stock Image URL</label>
<input type="url" class="form-control rounded-3" name="url" id="crud_url" value="{{ $gallery->url && str_starts_with($gallery->url, 'http') ? $gallery->url : '' }}" placeholder="https://example.com/image.jpg" oninput="previewUrlImage(this.value)">
<div id="url_preview_container" class="mt-3 text-center {{ $gallery->url && str_starts_with($gallery->url, 'http') ? '' : 'd-none' }}">
<img id="url_preview" src="{{ $gallery->url && str_starts_with($gallery->url, 'http') ? $gallery->url : '' }}" alt="URL Preview" class="img-thumbnail" style="max-height: 120px; border-radius: 8px;">
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Action buttons footer -->
<div class="panel-card shadow-sm border-0 mt-4 p-3 d-flex justify-content-end align-items-center bg-white rounded-3">
<a href="{{ url('/admin/gallery') }}" class="btn btn-light rounded-pill px-4 me-2 fw-semibold">Cancel</a>
<button type="submit" class="btn btn-primary rounded-pill px-4 py-2 fw-semibold shadow-sm"><i class="fa-solid fa-floppy-disk me-2"></i>Update Entry</button>
</div>
</form>
@push('scripts')
<script>
function previewUploadImage(input) {
if (input.files && input.files[0]) {
const reader = new FileReader();
reader.onload = function(e) {
document.getElementById('file_preview').src = e.target.result;
document.getElementById('file_preview_container').classList.remove('d-none');
document.getElementById('url_preview_container').classList.add('d-none');
document.getElementById('crud_url').value = '';
}
reader.readAsDataURL(input.files[0]);
}
}
function previewUrlImage(url) {
if (url && url.startsWith('http')) {
document.getElementById('url_preview').src = url;
document.getElementById('url_preview_container').classList.remove('d-none');
document.getElementById('file_preview_container').classList.add('d-none');
document.getElementById('image_file').value = '';
} else {
document.getElementById('url_preview_container').classList.add('d-none');
}
}
const zone = document.querySelector('.upload-dropzone');
if (zone) {
zone.addEventListener('dragover', () => zone.style.backgroundColor = '#e2e8f0');
zone.addEventListener('dragleave', () => zone.style.backgroundColor = '#f8fafc');
zone.addEventListener('drop', () => zone.style.backgroundColor = '#f8fafc');
}
</script>
@endpush
@endsection
@extends('layouts.admin') @extends('layouts.admin')
@section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Manage Portal</li>
<li class="breadcrumb-item active" aria-current="page">Orders</li>
</ol>
</nav>
@endsection
@section('page_title', 'Orders')
@section('page_description', 'Manage customer orders.')
@section('content') @section('content')
<div class="panel-card"> <div class="panel-card">
<div class="table-responsive"> <div class="table-responsive">
......
@extends('layouts.admin') @extends('layouts.admin')
@section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Manage Portal</li>
<li class="breadcrumb-item active" aria-current="page">Order Status Change</li>
</ol>
</nav>
@endsection
@section('page_title', 'Order Status')
@section('page_description', 'Update order statuses and track shipments.')
@section('content') @section('content')
<div class="panel-card"> <div class="panel-card">
<div class="table-responsive"> <div class="table-responsive">
......
@extends('layouts.admin') @extends('layouts.admin')
@section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item active" aria-current="page">Dashboard Overview</li>
</ol>
</nav>
@endsection
@section('page_title', 'Dashboard Overview')
@section('page_description', 'Manage and oversee your store operations.')
@section('content') @section('content')
<div class="row g-4 mb-5"> <div class="row g-4 mb-5">
<div class="col-md-4"> <div class="col-md-4">
......
@extends('layouts.admin') @extends('layouts.admin')
@section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Manage Portal</li>
<li class="breadcrumb-item active" aria-current="page">Pincodes</li>
</ol>
</nav>
@endsection
@section('page_title', 'Pincodes')
@section('page_description', 'Manage serviceable pin codes and delivery timelines.')
@section('content') @section('content')
<div class="panel-card"> <div class="panel-card">
<div class="table-responsive"> <div class="table-responsive">
......
@extends('layouts.admin') @extends('layouts.admin')
@section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Manage Portal</li>
<li class="breadcrumb-item active" aria-current="page">Product Prices</li>
</ol>
</nav>
@endsection
@section('page_title', 'Product Prices & Stock')
@section('page_description', 'Configure size-based pricing variants and inventory levels.')
@section('page_action')
<button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add Variant</button>
@endsection
@section('content') @section('content')
<div class="panel-card"> <div class="panel-card shadow-sm border-0">
<div class="table-responsive"> <div class="table-responsive">
<table class="table mb-0"> <table class="table mb-0 align-middle">
<thead> <thead>
<tr> <tr>
<th>Product Name</th> <th>Product Name</th>
<th>Size Variant</th> <th>Size Variant</th>
<th>Base Price</th> <th>Price</th>
<th>Discount</th> <th>Stock Quantity</th>
<th>Final Price</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
<tbody id="productprices-tbody"> <tbody id="productprices-tbody">
@foreach($productprices as $item) @foreach($productprices as $item)
<tr> <tr>
<td>{{ $item->name }}</td> <td class="fw-bold text-dark">{{ $item->product ? $item->product->name : 'N/A' }}</td>
<td>{{ $item->variant }}</td> <td>
<td>{{ $item->base }}</td> <span class="badge bg-light text-primary border border-primary-subtle px-3 py-2 rounded-pill">
<td>{{ $item->discount }}</td> <i class="fa-solid fa-ruler me-1"></i>{{ $item->size ? $item->size->name : 'N/A' }}
<td>{{ $item->final }}</td> </span>
</td>
<td class="fw-semibold text-success">₹{{ number_format($item->price, 2) }}</td>
<td>
@if($item->stock_quantity > 10)
<span class="text-dark fw-semibold"><i class="fa-solid fa-circle-check text-success me-1"></i>{{ $item->stock_quantity }} In Stock</span>
@elseif($item->stock_quantity > 0)
<span class="text-warning fw-semibold"><i class="fa-solid fa-circle-exclamation text-warning me-1"></i>{{ $item->stock_quantity }} Low Stock</span>
@else
<span class="text-danger fw-semibold"><i class="fa-solid fa-circle-xmark text-danger me-1"></i>Out of Stock</span>
@endif
</td>
<td> <td>
<button class="btn-action" onclick="openEditModal('productprices', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button> <button class="btn-action" onclick="openEditModal('productprices', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button>
<button class="btn-action" onclick="deleteRecord('productprices', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button> <button class="btn-action text-danger" onclick="deleteRecord('productprices', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</td> </td>
</tr> </tr>
@endforeach @endforeach
@if(count($productprices) === 0) @if(count($productprices) === 0)
<tr> <tr>
<td colspan="10" class="text-center text-muted py-4">No records found.</td> <td colspan="5" class="text-center text-muted py-4">No records found.</td>
</tr> </tr>
@endif @endif
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
@push('scripts')
<!-- CRUD Modal -->
<div class="modal fade" id="crudModal" tabindex="-1">
<div class="modal-dialog">
<form method="POST" action="" id="crudForm">
@csrf
<input type="hidden" name="_method" id="crudMethod" value="POST">
<div class="modal-content border-0 rounded-4 shadow">
<div class="modal-header border-0 pb-0">
<h5 class="modal-title fw-bold" id="crudModalLabel">Create Variant</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body pt-4">
<div class="mb-3">
<label class="form-label small fw-semibold text-muted">Select Product</label>
<select class="form-select rounded-3" name="product_id" id="crud_product_id" required>
<option value="">Select Product</option>
@foreach($products as $product)
<option value="{{ $product->id }}">{{ $product->name }}</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label class="form-label small fw-semibold text-muted">Select Size</label>
<select class="form-select rounded-3" name="size_id" id="crud_size_id" required>
<option value="">Select Size</option>
@foreach($sizes as $size)
<option value="{{ $size->id }}">{{ $size->name }} ({{ $size->code }})</option>
@endforeach
</select>
</div>
<div class="mb-3">
<label class="form-label small fw-semibold text-muted">Price (₹)</label>
<div class="input-group">
<span class="input-group-text bg-light border-end-0">₹</span>
<input type="number" step="0.01" class="form-control rounded-end-3" name="price" id="crud_price" required placeholder="0.00">
</div>
</div>
<div class="mb-3">
<label class="form-label small fw-semibold text-muted">Stock Quantity</label>
<input type="number" class="form-control rounded-3" name="stock_quantity" id="crud_stock_quantity" required placeholder="0">
</div>
</div>
<div class="modal-footer border-0 pt-0">
<button type="button" class="btn btn-light rounded-pill px-4 fw-semibold" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary rounded-pill px-4 fw-semibold shadow-sm" id="crudSubmitBtn">Save Changes</button>
</div>
</div>
</form>
</div>
<script>
const allSizes = @json($sizes);
const entityData = @json($productprices);
function filterSizesForSelectedProduct(selectedSizeId = null) {
const prodSelect = document.getElementById('crud_product_id');
const sizeSelect = document.getElementById('crud_size_id');
// If editing (product selection disabled) and no size_id was explicitly passed, ignore
// to prevent trigger('change') from clearing selected size.
if (prodSelect.disabled && !selectedSizeId) {
return;
}
const productId = parseInt(prodSelect.value);
// Destroy Select2 if initialized
if (typeof $ !== 'undefined' && $(sizeSelect).data('select2')) {
$(sizeSelect).select2('destroy');
}
// Clear existing options
sizeSelect.innerHTML = '<option value="">Select Size</option>';
// Get size IDs already taken by this product
const takenSizes = productId ? entityData
.filter(x => x.product_id === productId)
.map(x => x.size_id) : [];
// Append only non-taken sizes (or the currently selected size)
allSizes.forEach(size => {
const isTaken = takenSizes.includes(size.id);
const isCurrentlySelected = selectedSizeId && parseInt(selectedSizeId) === size.id;
if (!isTaken || isCurrentlySelected) {
const opt = document.createElement('option');
opt.value = size.id;
opt.textContent = `${size.name} (${size.code})`;
sizeSelect.appendChild(opt);
}
});
// Set value if provided
if (selectedSizeId) {
sizeSelect.value = selectedSizeId;
}
// Re-initialize Select2
if (typeof $ !== 'undefined') {
$(sizeSelect).select2({
theme: 'bootstrap-5',
width: '100%',
dropdownParent: $('#crudModal')
});
}
}
// Attach listener when jQuery is ready
if (typeof $ !== 'undefined') {
$(document).ready(function() {
$('#crud_product_id').on('change', function() {
filterSizesForSelectedProduct();
});
});
}
function openCreateModal() {
document.getElementById('crudModalLabel').innerText = 'Create Variant';
document.getElementById('crudMethod').value = 'POST';
document.getElementById('crudForm').action = '/admin/master/productprices';
document.getElementById('crudSubmitBtn').innerText = 'Create';
// Re-enable and require fields in create mode
const prodSelect = document.getElementById('crud_product_id');
const sizeSelect = document.getElementById('crud_size_id');
prodSelect.disabled = false;
sizeSelect.disabled = false;
prodSelect.required = true;
sizeSelect.required = true;
prodSelect.value = '';
sizeSelect.value = '';
document.getElementById('crud_price').value = '';
document.getElementById('crud_stock_quantity').value = '';
// Refresh Select2 dropdowns if active
if (typeof $ !== 'undefined') {
$('#crud_product_id').val('').trigger('change');
}
filterSizesForSelectedProduct();
}
function openEditModal(type, id) {
const item = entityData.find(x => x.id === id);
if (!item) return;
document.getElementById('crudModalLabel').innerText = 'Edit Variant';
document.getElementById('crudMethod').value = 'PUT';
document.getElementById('crudForm').action = '/admin/master/productprices/' + id;
document.getElementById('crudSubmitBtn').innerText = 'Update';
// Disable and un-require fields in edit mode
const prodSelect = document.getElementById('crud_product_id');
const sizeSelect = document.getElementById('crud_size_id');
prodSelect.disabled = true;
sizeSelect.disabled = true;
prodSelect.required = false;
sizeSelect.required = false;
prodSelect.value = item.product_id || '';
document.getElementById('crud_price').value = item.price || '';
document.getElementById('crud_stock_quantity').value = item.stock_quantity ?? 0;
// Refresh Select2 dropdowns if active
if (typeof $ !== 'undefined') {
$('#crud_product_id').val(item.product_id).trigger('change');
}
// Filter and set value
filterSizesForSelectedProduct(item.size_id);
const modal = new bootstrap.Modal(document.getElementById('crudModal'));
modal.show();
}
</script>
@endpush
@endsection @endsection
@extends('layouts.admin') @extends('layouts.admin')
@section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Manage Portal</li>
<li class="breadcrumb-item active" aria-current="page">Products</li>
</ol>
</nav>
@endsection
@section('page_title', 'Products')
@section('page_action')
<a href="{{ url('/admin/products/create') }}" class="btn btn-primary rounded-pill px-4">+ Add Product</a>
@endsection
@section('content') @section('content')
<div class="panel-card"> <div class="panel-card">
<div class="table-responsive"> <div class="table-responsive">
<table class="table mb-0"> <table class="table mb-0" style="table-layout: fixed; width: 100%;">
<thead> <thead>
<tr> <tr>
<th>Product Name</th> <th style="width: 40%;">Product Name</th>
<th>Category</th> <th style="width: 35%;">Category</th>
<th>Price</th> <th style="width: 13%;">Status</th>
<th>Stock</th> <th style="width: 12%; text-align: center;">Action</th>
<th>Action</th>
</tr> </tr>
</thead> </thead>
<tbody id="products-tbody"> <tbody id="products-tbody">
@foreach($products as $item) @foreach($products as $item)
<tr> <tr>
<td>{{ $item->name }}</td> <td class="text-wrap fw-semibold">{{ $item->name }}</td>
<td>{{ $item->category }}</td> <td>{{ $item->category ? $item->category->name : 'Uncategorized' }}</td>
<td>{{ $item->price }}</td>
<td>{{ $item->stock }}</td>
<td> <td>
<button class="btn-action" onclick="openEditModal('products', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button> @if(($item->status ?? 'Active') === 'Active')
<span class="badge bg-success rounded-pill px-3">Active</span>
@else
<span class="badge bg-secondary rounded-pill px-3">Inactive</span>
@endif
</td>
<td style="text-align: center;">
<a href="{{ url('/admin/products/' . $item->id . '/edit') }}" class="btn-action"><i class="fa-solid fa-pen"></i></a>
<button class="btn-action" onclick="deleteRecord('products', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button> <button class="btn-action" onclick="deleteRecord('products', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</td> </td>
</tr> </tr>
@endforeach @endforeach
@if(count($products) === 0) @if(count($products) === 0)
<tr> <tr>
<td colspan="10" class="text-center text-muted py-4">No records found.</td> <td colspan="4" class="text-center text-muted py-4">No records found.</td>
</tr> </tr>
@endif @endif
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
@endsection @endsection
@extends('layouts.admin')
@section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item"><a href="{{ url('/admin/products') }}">Products</a></li>
<li class="breadcrumb-item active" aria-current="page">Add Product</li>
</ol>
</nav>
@endsection
@section('page_title', 'Create New Product')
@section('content')
<form method="POST" action="{{ url('/admin/master/products') }}" enctype="multipart/form-data">
@csrf
<div class="row g-4">
<!-- Main Form Column (Left) -->
<div class="col-lg-8">
<div class="panel-card shadow-sm border-0 h-100 p-4">
<h5 class="fw-bold mb-4 text-dark"><i class="fa-solid fa-file-invoice me-2 text-primary"></i>Product Details</h5>
<div class="mb-4">
<label class="form-label small fw-semibold text-muted">Product Name</label>
<input type="text" class="form-control form-control-lg rounded-3 fs-6" name="name" id="crud_name" placeholder="Enter product name..." required oninput="generateSlug()">
</div>
<div class="mb-4">
<label class="form-label small fw-semibold text-muted">Slug</label>
<input type="text" class="form-control rounded-3" name="slug" id="crud_slug" placeholder="product-url-slug" required>
</div>
<div class="mb-4">
<label class="form-label small fw-semibold text-muted">Description</label>
<textarea class="form-control rounded-3" name="description" id="crud_description" rows="6" placeholder="Describe this beautiful seashell product..."></textarea>
</div>
<div class="mb-3">
<label class="form-label small fw-semibold text-muted">Category</label>
<select class="form-select rounded-3" name="category_id" id="crud_category_id" required>
<option value="">Select Category</option>
@foreach($categories as $category)
<option value="{{ $category->id }}">{{ $category->name }}</option>
@endforeach
</select>
</div>
</div>
</div>
<!-- Sidebar Column (Right) -->
<div class="col-lg-4">
<div class="d-flex flex-column gap-4">
<!-- Image Upload Card -->
<div class="panel-card shadow-sm border-0 p-4">
<h5 class="fw-bold mb-4 text-dark"><i class="fa-solid fa-image me-2 text-success"></i>Product Image</h5>
<!-- File Upload Container -->
<div class="mb-3">
<label class="form-label small fw-semibold text-muted">Upload Image File</label>
<div class="upload-dropzone text-center p-3 border border-dashed rounded-3 bg-light position-relative" style="border-color: #cbd5e1 !important; cursor: pointer; transition: all 0.2s ease;">
<i class="fa-solid fa-cloud-arrow-up text-muted mb-2 fs-2 d-block"></i>
<span class="small text-muted d-block mb-1">Choose file to upload</span>
<span class="x-small text-muted d-block opacity-75">(JPG, PNG, WEBP)</span>
<input type="file" name="primary_image_file" id="primary_image_file" class="position-absolute top-0 start-0 opacity-0 w-100 h-100" style="cursor: pointer;" onchange="previewUploadImage(this)">
</div>
<div id="file_preview_container" class="mt-3 d-none text-center">
<img id="file_preview" src="" alt="Preview" class="img-thumbnail" style="max-height: 120px; border-radius: 8px;">
<span class="small d-block text-success mt-1 fw-semibold"><i class="fa-solid fa-circle-check me-1"></i>File selected</span>
</div>
</div>
<div class="text-center my-3 text-muted small fw-bold">--- OR ---</div>
<!-- Remote URL input -->
<div class="mb-0">
<label class="form-label small fw-semibold text-muted">Stock Image URL</label>
<input type="url" class="form-control rounded-3" name="primary_image_url" id="crud_image_url" placeholder="https://example.com/image.jpg" oninput="previewUrlImage(this.value)">
<div id="url_preview_container" class="mt-3 d-none text-center">
<img id="url_preview" src="" alt="URL Preview" class="img-thumbnail" style="max-height: 120px; border-radius: 8px;">
</div>
</div>
</div>
<!-- Visibility & Tags -->
<div class="panel-card shadow-sm border-0 p-4">
<h5 class="fw-bold mb-4 text-dark"><i class="fa-solid fa-sliders me-2 text-info"></i>Status & Badges</h5>
<div class="mb-3">
<label class="form-label small fw-semibold text-muted">Is Bestseller?</label>
<select class="form-select rounded-3" name="is_bestseller" id="crud_is_bestseller">
<option value="0">No</option>
<option value="1">Yes</option>
</select>
</div>
<div class="mb-0">
<label class="form-label small fw-semibold text-muted">Status</label>
<select class="form-select rounded-3" name="status" id="crud_status">
<option value="Active">Active</option>
<option value="Inactive">Inactive</option>
</select>
</div>
</div>
</div>
</div>
</div>
<!-- Action buttons footer -->
<div class="panel-card shadow-sm border-0 mt-4 p-3 d-flex justify-content-end align-items-center bg-white rounded-3">
<a href="{{ url('/admin/products') }}" class="btn btn-light rounded-pill px-4 me-2 fw-semibold">Cancel</a>
<button type="submit" class="btn btn-primary rounded-pill px-4 py-2 fw-semibold shadow-sm"><i class="fa-solid fa-floppy-disk me-2"></i>Create Product</button>
</div>
</form>
@push('scripts')
<script>
function generateSlug() {
const name = document.getElementById('crud_name').value;
const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)+/g, '');
document.getElementById('crud_slug').value = slug;
}
function previewUploadImage(input) {
if (input.files && input.files[0]) {
const reader = new FileReader();
reader.onload = function(e) {
document.getElementById('file_preview').src = e.target.result;
document.getElementById('file_preview_container').classList.remove('d-none');
document.getElementById('url_preview_container').classList.add('d-none');
}
reader.readAsDataURL(input.files[0]);
}
}
function previewUrlImage(url) {
if (url && url.startsWith('http')) {
document.getElementById('url_preview').src = url;
document.getElementById('url_preview_container').classList.remove('d-none');
document.getElementById('file_preview_container').classList.add('d-none');
document.getElementById('primary_image_file').value = '';
} else {
document.getElementById('url_preview_container').classList.add('d-none');
}
}
const zone = document.querySelector('.upload-dropzone');
if (zone) {
zone.addEventListener('dragover', () => zone.style.backgroundColor = '#e2e8f0');
zone.addEventListener('dragleave', () => zone.style.backgroundColor = '#f8fafc');
zone.addEventListener('drop', () => zone.style.backgroundColor = '#f8fafc');
}
</script>
@endpush
@endsection
@extends('layouts.admin')
@section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item"><a href="{{ url('/admin/products') }}">Products</a></li>
<li class="breadcrumb-item active" aria-current="page">Edit Product</li>
</ol>
</nav>
@endsection
@section('page_title', 'Edit Product')
@section('content')
<form method="POST" action="{{ url('/admin/master/products/' . $product->id) }}" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="row g-4">
<!-- Main Form Column (Left) -->
<div class="col-lg-8">
<div class="panel-card shadow-sm border-0 h-100 p-4">
<h5 class="fw-bold mb-4 text-dark"><i class="fa-solid fa-file-invoice me-2 text-primary"></i>Product Details</h5>
<div class="mb-4">
<label class="form-label small fw-semibold text-muted">Product Name</label>
<input type="text" class="form-control form-control-lg rounded-3 fs-6" name="name" id="crud_name" required value="{{ $product->name }}" oninput="generateSlug()">
</div>
<div class="mb-4">
<label class="form-label small fw-semibold text-muted">Slug</label>
<input type="text" class="form-control rounded-3" name="slug" id="crud_slug" required value="{{ $product->slug }}">
</div>
<div class="mb-4">
<label class="form-label small fw-semibold text-muted">Description</label>
<textarea class="form-control rounded-3" name="description" id="crud_description" rows="6">{{ $product->description }}</textarea>
</div>
<div class="mb-3">
<label class="form-label small fw-semibold text-muted">Category</label>
<select class="form-select rounded-3" name="category_id" id="crud_category_id" required>
<option value="">Select Category</option>
@foreach($categories as $category)
<option value="{{ $category->id }}" {{ $product->category_id == $category->id ? 'selected' : '' }}>{{ $category->name }}</option>
@endforeach
</select>
</div>
</div>
</div>
<!-- Sidebar Column (Right) -->
<div class="col-lg-4">
<div class="d-flex flex-column gap-4">
<!-- Image Upload Card -->
<div class="panel-card shadow-sm border-0 p-4">
<h5 class="fw-bold mb-4 text-dark"><i class="fa-solid fa-image me-2 text-success"></i>Product Image</h5>
<!-- Display Current Image if exists -->
@if($product->primaryImage && $product->primaryImage->image_url)
<div class="mb-4 text-center" id="current_image_container" style="transition: opacity 0.2s ease;">
<label class="form-label small fw-semibold text-muted d-block text-start">Current Primary Image</label>
<img src="{{ $product->primaryImage->image_url }}" alt="Product Image" class="img-thumbnail" style="max-height: 140px; border-radius: 8px;">
</div>
@endif
<!-- File Upload Container -->
<div class="mb-3">
<label class="form-label small fw-semibold text-muted">Upload New Image File</label>
<div class="upload-dropzone text-center p-3 border border-dashed rounded-3 bg-light position-relative" style="border-color: #cbd5e1 !important; cursor: pointer; transition: all 0.2s ease;">
<i class="fa-solid fa-cloud-arrow-up text-muted mb-2 fs-2 d-block"></i>
<span class="small text-muted d-block mb-1">Choose new file...</span>
<input type="file" name="primary_image_file" id="primary_image_file" class="position-absolute top-0 start-0 opacity-0 w-100 h-100" style="cursor: pointer;" onchange="previewUploadImage(this)">
</div>
<div id="file_preview_container" class="mt-3 d-none text-center">
<img id="file_preview" src="" alt="Preview" class="img-thumbnail" style="max-height: 120px; border-radius: 8px;">
<span class="small d-block text-success mt-1 fw-semibold"><i class="fa-solid fa-circle-check me-1"></i>New file selected</span>
</div>
</div>
<div class="text-center my-3 text-muted small fw-bold">--- OR ---</div>
<!-- Remote URL input -->
<div class="mb-0">
<label class="form-label small fw-semibold text-muted">Update Stock Image URL</label>
<input type="url" class="form-control rounded-3" name="primary_image_url" id="crud_image_url" placeholder="https://example.com/image.jpg" value="{{ $product->primaryImage && !str_starts_with($product->primaryImage->image_url, '/uploads/') ? $product->primaryImage->image_url : '' }}" oninput="previewUrlImage(this.value)">
<div id="url_preview_container" class="mt-3 d-none text-center">
<img id="url_preview" src="" alt="URL Preview" class="img-thumbnail" style="max-height: 120px; border-radius: 8px;">
</div>
</div>
</div>
<!-- Visibility & Tags -->
<div class="panel-card shadow-sm border-0 p-4">
<h5 class="fw-bold mb-4 text-dark"><i class="fa-solid fa-sliders me-2 text-info"></i>Status & Badges</h5>
<div class="mb-3">
<label class="form-label small fw-semibold text-muted">Is Bestseller?</label>
<select class="form-select rounded-3" name="is_bestseller" id="crud_is_bestseller">
<option value="0" {{ !$product->is_bestseller ? 'selected' : '' }}>No</option>
<option value="1" {{ $product->is_bestseller ? 'selected' : '' }}>Yes</option>
</select>
</div>
<div class="mb-0">
<label class="form-label small fw-semibold text-muted">Status</label>
<select class="form-select rounded-3" name="status" id="crud_status">
<option value="Active" {{ ($product->status ?? 'Active') == 'Active' ? 'selected' : '' }}>Active</option>
<option value="Inactive" {{ ($product->status ?? 'Active') == 'Inactive' ? 'selected' : '' }}>Inactive</option>
</select>
</div>
</div>
</div>
</div>
</div>
<!-- Action buttons footer -->
<div class="panel-card shadow-sm border-0 mt-4 p-3 d-flex justify-content-end align-items-center bg-white rounded-3">
<a href="{{ url('/admin/products') }}" class="btn btn-light rounded-pill px-4 me-2 fw-semibold">Cancel</a>
<button type="submit" class="btn btn-primary rounded-pill px-4 py-2 fw-semibold shadow-sm"><i class="fa-solid fa-floppy-disk me-2"></i>Save Changes</button>
</div>
</form>
@push('scripts')
<script>
function generateSlug() {
const name = document.getElementById('crud_name').value;
const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)+/g, '');
document.getElementById('crud_slug').value = slug;
}
function previewUploadImage(input) {
if (input.files && input.files[0]) {
const reader = new FileReader();
reader.onload = function(e) {
document.getElementById('file_preview').src = e.target.result;
document.getElementById('file_preview_container').classList.remove('d-none');
document.getElementById('url_preview_container').classList.add('d-none');
if(document.getElementById('current_image_container')) {
document.getElementById('current_image_container').style.opacity = '0.3';
}
}
reader.readAsDataURL(input.files[0]);
}
}
function previewUrlImage(url) {
if (url && url.startsWith('http')) {
document.getElementById('url_preview').src = url;
document.getElementById('url_preview_container').classList.remove('d-none');
document.getElementById('file_preview_container').classList.add('d-none');
document.getElementById('primary_image_file').value = '';
if(document.getElementById('current_image_container')) {
document.getElementById('current_image_container').style.opacity = '0.3';
}
} else {
document.getElementById('url_preview_container').classList.add('d-none');
}
}
const zone = document.querySelector('.upload-dropzone');
if (zone) {
zone.addEventListener('dragover', () => zone.style.backgroundColor = '#e2e8f0');
zone.addEventListener('dragleave', () => zone.style.backgroundColor = '#f8fafc');
zone.addEventListener('drop', () => zone.style.backgroundColor = '#f8fafc');
}
</script>
@endpush
@endsection
@extends('layouts.admin') @extends('layouts.admin')
@section('content') @section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Master Data</li>
<li class="breadcrumb-item active" aria-current="page">Sizes</li>
</ol>
</nav>
@endsection
@section('page_title', 'Sizes') @section('page_title', 'Sizes')
@section('page_description', 'Manage master data for Sizes')
@section('content')
@section('page_action') @section('page_action')
<button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add New</button> <button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add New</button>
......
@extends('layouts.admin') @extends('layouts.admin')
@section('content') @section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Master Data</li>
<li class="breadcrumb-item active" aria-current="page">States</li>
</ol>
</nav>
@endsection
@section('page_title', 'States') @section('page_title', 'States')
@section('page_description', 'Manage master data for States')
@section('content')
@section('page_action') @section('page_action')
<button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add New</button> <button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add New</button>
......
@extends('layouts.admin')
@section('content')
@section('page_title', 'Measuring Units')
@section('page_description', 'Manage master data for Measuring Units')
@section('page_action')
<button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add New</button>
@endsection
@push('scripts')
<!-- CRUD Modal -->
<div class="modal fade" id="crudModal" tabindex="-1">
<div class="modal-dialog">
<form method="POST" action="" id="crudForm">
@csrf
<input type="hidden" name="_method" id="crudMethod" value="POST">
<div class="modal-content">
<div class="modal-header border-0 pb-0">
<h5 class="modal-title fw-bold" id="crudModalLabel">Create Measuring Units</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body pt-4">
<div class="mb-3">
<label class="form-label">Unit Name</label>
<input type="text" class="form-control" name="name" id="crud_name" required>
</div>
<div class="mb-3">
<label class="form-label">Unit Code</label>
<input type="text" class="form-control" name="code" id="crud_code" required>
</div>
</div>
<div class="modal-footer border-0 pt-0">
<button type="button" class="btn btn-light rounded-pill px-4" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary rounded-pill px-4" id="crudSubmitBtn">Save Changes</button>
</div>
</div>
</form>
</div>
</div>
<script>
const entityData = @json($units);
function openCreateModal() {
document.getElementById('crudModalLabel').innerText = 'Create Measuring Units';
document.getElementById('crudMethod').value = 'POST';
document.getElementById('crudForm').action = '/admin/master/units';
document.getElementById('crudSubmitBtn').innerText = 'Create';
document.getElementById('crud_name').value = '';
document.getElementById('crud_code').value = '';
}
function openEditModal(type, id) {
// Find the record
const item = entityData.find(x => x.id === id);
if (!item) return;
document.getElementById('crudModalLabel').innerText = 'Edit Measuring Units';
document.getElementById('crudMethod').value = 'PUT';
document.getElementById('crudForm').action = '/admin/master/units/' + id;
document.getElementById('crudSubmitBtn').innerText = 'Update';
document.getElementById('crud_name').value = item.name || '';
document.getElementById('crud_code').value = item.code || '';
const modal = new bootstrap.Modal(document.getElementById('crudModal'));
modal.show();
}
</script>
@endpush
<div class="panel-card">
<div class="table-responsive">
<table class="table mb-0">
<thead>
<tr>
<th>Unit Name</th>
<th>Code</th>
<th>Action</th>
</tr>
</thead>
<tbody id="unit-tbody">
@foreach($units as $item)
<tr>
<td>{{ $item->name }}</td>
<td>{{ $item->code }}</td>
<td>
<button class="btn-action" onclick="openEditModal('unit', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button>
<button class="btn-action" onclick="deleteRecord('unit', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</td>
</tr>
@endforeach
@if(count($units) === 0)
<tr>
<td colspan="10" class="text-center text-muted py-4">No records found.</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
@endsection
@extends('layouts.admin')
@section('content')
@section('page_title', 'Unit Sizes')
@section('page_description', 'Manage master data for Unit Sizes')
@section('page_action')
<button class="btn btn-primary rounded-pill px-4" data-bs-toggle="modal" data-bs-target="#crudModal" onclick="openCreateModal()">+ Add New</button>
@endsection
@push('scripts')
<!-- CRUD Modal -->
<div class="modal fade" id="crudModal" tabindex="-1">
<div class="modal-dialog">
<form method="POST" action="" id="crudForm">
@csrf
<input type="hidden" name="_method" id="crudMethod" value="POST">
<div class="modal-content">
<div class="modal-header border-0 pb-0">
<h5 class="modal-title fw-bold" id="crudModalLabel">Create Unit Sizes</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body pt-4">
<div class="mb-3">
<label class="form-label">Size Identifier</label>
<input type="text" class="form-control" name="identifier" id="crud_identifier" required>
</div>
<div class="mb-3">
<label class="form-label">Measuring Unit</label>
<input type="text" class="form-control" name="unit" id="crud_unit" required>
</div>
</div>
<div class="modal-footer border-0 pt-0">
<button type="button" class="btn btn-light rounded-pill px-4" data-bs-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary rounded-pill px-4" id="crudSubmitBtn">Save Changes</button>
</div>
</div>
</form>
</div>
</div>
<script>
const entityData = @json($unitsizes);
function openCreateModal() {
document.getElementById('crudModalLabel').innerText = 'Create Unit Sizes';
document.getElementById('crudMethod').value = 'POST';
document.getElementById('crudForm').action = '/admin/master/unitsizes';
document.getElementById('crudSubmitBtn').innerText = 'Create';
document.getElementById('crud_identifier').value = '';
document.getElementById('crud_unit').value = '';
}
function openEditModal(type, id) {
// Find the record
const item = entityData.find(x => x.id === id);
if (!item) return;
document.getElementById('crudModalLabel').innerText = 'Edit Unit Sizes';
document.getElementById('crudMethod').value = 'PUT';
document.getElementById('crudForm').action = '/admin/master/unitsizes/' + id;
document.getElementById('crudSubmitBtn').innerText = 'Update';
document.getElementById('crud_identifier').value = item.identifier || '';
document.getElementById('crud_unit').value = item.unit || '';
const modal = new bootstrap.Modal(document.getElementById('crudModal'));
modal.show();
}
</script>
@endpush
<div class="panel-card">
<div class="table-responsive">
<table class="table mb-0">
<thead>
<tr>
<th>Size Identifier</th>
<th>Measuring Unit</th>
<th>Action</th>
</tr>
</thead>
<tbody id="unitsizes-tbody">
@foreach($unitsizes as $item)
<tr>
<td>{{ $item->identifier }}</td>
<td>{{ $item->unit }}</td>
<td>
<button class="btn-action" onclick="openEditModal('unitsizes', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button>
<button class="btn-action" onclick="deleteRecord('unitsizes', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</td>
</tr>
@endforeach
@if(count($unitsizes) === 0)
<tr>
<td colspan="10" class="text-center text-muted py-4">No records found.</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
@endsection
@extends('layouts.admin') @extends('layouts.admin')
@section('breadcrumbs')
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item"><a href="{{ url('/admin/dashboard') }}">Admin</a></li>
<li class="breadcrumb-item">Manage Portal</li>
<li class="breadcrumb-item active" aria-current="page">Wishlist</li>
</ol>
</nav>
@endsection
@section('page_title', 'Wishlist')
@section('page_description', 'View items saved by customers in their wishlists.')
@section('content') @section('content')
<div class="panel-card"> <div class="panel-card">
<div class="table-responsive"> <div class="table-responsive">
......
...@@ -113,16 +113,20 @@ ...@@ -113,16 +113,20 @@
<input type="text" name="shipping_address" class="form-control checkout-form-control w-100" placeholder="Street address, Flat/Door number" required> <input type="text" name="shipping_address" class="form-control checkout-form-control w-100" placeholder="Street address, Flat/Door number" required>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label class="form-label checkout-form-label">City *</label> <label class="form-label checkout-form-label">State *</label>
<input type="text" name="city" class="form-control checkout-form-control w-100" placeholder="City" value="Chennai" required> <select name="state" id="checkout_state" class="form-select checkout-form-control w-100" required>
<option value="">Select State</option>
</select>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label class="form-label checkout-form-label">State *</label> <label class="form-label checkout-form-label">City *</label>
<input type="text" name="state" class="form-control checkout-form-control w-100" placeholder="State" value="Tamil Nadu" required> <select name="city" id="checkout_city" class="form-select checkout-form-control w-100" required disabled>
<option value="">Select City</option>
</select>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<label class="form-label checkout-form-label">PIN Code *</label> <label class="form-label checkout-form-label">PIN Code *</label>
<input type="text" name="pincode" class="form-control checkout-form-control w-100" placeholder="600001" value="600001" required> <input type="text" name="pincode" class="form-control checkout-form-control w-100" placeholder="600001" required>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -72,98 +72,30 @@ ...@@ -72,98 +72,30 @@
</header> </header>
<!-- Gallery Section --> <!-- Gallery Section -->
<main class="container py-5"> <main class="gallery-page-wrapper">
<div class="text-center mb-5"> <div class="text-center gallery-page-header">
<h2 class="h1 fw-bold" style="color: #717171;">Our Shell Art Gallery</h2> <h2 class="gallery-page-title">Our Shell Art Gallery</h2>
<p class="text-muted">Explore beautiful seashell creations and ocean-inspired fancy items designed with creativity and love.</p> <p class="gallery-page-subtitle">Explore beautiful seashell creations and ocean-inspired fancy items designed with creativity and love.</p>
</div> </div>
<!-- Collage/Grid of 18 items matching screenshot gallery layout --> @if(count($gallery) > 0)
<div class="row g-4 mb-5 gallery-grid"> <div class="gallery-masonry">
<!-- Row 1: 9 items --> @foreach($gallery as $item)
<!-- Column 1 --> <div class="gallery-masonry-item" style="cursor: pointer;">
<div class="col-lg-3 col-md-6 d-flex flex-column gap-4"> <img src="{{ $item->url }}" alt="{{ $item->filename }}" loading="lazy">
<div class="gallery-item"> <div class="gallery-masonry-overlay">
<img src="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=500&auto=format&fit=crop&q=80" alt="Decorative Shell Wall Frame" class="img-fluid rounded-3"> <span class="gallery-masonry-label">{{ $item->filename }}</span>
</div> </div>
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1595855759920-86582396756a?w=500&auto=format&fit=crop&q=80" alt="Shell Clock Frame" class="img-fluid rounded-3">
</div>
</div>
<!-- Column 2 -->
<div class="col-lg-3 col-md-6 d-flex flex-column gap-4">
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=500&auto=format&fit=crop&q=80" alt="Starfish Lights Decor" class="img-fluid rounded-3">
</div>
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1599643478518-a784e5dc4c8f?w=500&auto=format&fit=crop&q=80" alt="Shell Jewelry Box Open" class="img-fluid rounded-3">
</div>
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1542838132-92c53300491e?w=500&auto=format&fit=crop&q=80" alt="Shell Gift Hamper Box" class="img-fluid rounded-3">
</div>
</div>
<!-- Column 3 -->
<div class="col-lg-3 col-md-6 d-flex flex-column gap-4">
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1549465220-1a8b9238cd48?w=500&auto=format&fit=crop&q=80" alt="Beach Mugs and Frames" class="img-fluid rounded-3">
</div>
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=500&auto=format&fit=crop&q=80" alt="Seashell Wind Chime" class="img-fluid rounded-3">
</div>
</div>
<!-- Column 4 -->
<div class="col-lg-3 col-md-6 d-flex flex-column gap-4">
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1520038410233-7141be7e6f97?w=500&auto=format&fit=crop&q=80" alt="Shell Candle Holder" class="img-fluid rounded-3">
</div>
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=500&auto=format&fit=crop&q=80" alt="Seashell Jewelry Box Closed" class="img-fluid rounded-3">
</div> </div>
</div> @endforeach
</div> </div>
@else
<div class="row g-4 gallery-grid"> <div class="text-center text-muted py-5">
<!-- Row 2: 9 items duplicated --> <i class="bi bi-image fs-1 text-muted"></i>
<!-- Column 1 --> <h4 class="mt-3">No images found</h4>
<div class="col-lg-3 col-md-6 d-flex flex-column gap-4"> <p class="text-muted">Stay tuned for handcrafted ocean treasures!</p>
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=500&auto=format&fit=crop&q=80" alt="Decorative Shell Wall Frame" class="img-fluid rounded-3">
</div>
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1595855759920-86582396756a?w=500&auto=format&fit=crop&q=80" alt="Shell Clock Frame" class="img-fluid rounded-3">
</div>
</div>
<!-- Column 2 -->
<div class="col-lg-3 col-md-6 d-flex flex-column gap-4">
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=500&auto=format&fit=crop&q=80" alt="Starfish Lights Decor" class="img-fluid rounded-3">
</div>
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1599643478518-a784e5dc4c8f?w=500&auto=format&fit=crop&q=80" alt="Shell Jewelry Box Open" class="img-fluid rounded-3">
</div>
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1542838132-92c53300491e?w=500&auto=format&fit=crop&q=80" alt="Shell Gift Hamper Box" class="img-fluid rounded-3">
</div>
</div>
<!-- Column 3 -->
<div class="col-lg-3 col-md-6 d-flex flex-column gap-4">
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1549465220-1a8b9238cd48?w=500&auto=format&fit=crop&q=80" alt="Beach Mugs and Frames" class="img-fluid rounded-3">
</div>
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=500&auto=format&fit=crop&q=80" alt="Seashell Wind Chime" class="img-fluid rounded-3">
</div>
</div>
<!-- Column 4 -->
<div class="col-lg-3 col-md-6 d-flex flex-column gap-4">
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1520038410233-7141be7e6f97?w=500&auto=format&fit=crop&q=80" alt="Shell Candle Holder" class="img-fluid rounded-3">
</div>
<div class="gallery-item">
<img src="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=500&auto=format&fit=crop&q=80" alt="Seashell Jewelry Box Closed" class="img-fluid rounded-3">
</div>
</div>
</div> </div>
@endif
</main> </main>
<!-- Lightbox Modal Popup (Page 7) --> <!-- Lightbox Modal Popup (Page 7) -->
......
...@@ -578,7 +578,8 @@ ...@@ -578,7 +578,8 @@
let sizeButtons = ''; let sizeButtons = '';
if (p.variants && p.variants.length > 0) { if (p.variants && p.variants.length > 0) {
p.variants.forEach((v, idx) => { p.variants.forEach((v, idx) => {
sizeButtons += `<button class="size-btn ${idx === 0 ? 'active' : ''}" data-price="${Math.round(v.price)}" data-size="${v.size}">${v.size}</button> `; let sizeName = (v.size && v.size.name) ? v.size.name : (v.size || '');
sizeButtons += `<button class="size-btn ${idx === 0 ? 'active' : ''}" data-price="${Math.round(v.price)}" data-size="${sizeName}" data-variant-id="${v.id}">${sizeName}</button> `;
}); });
} else { } else {
sizeButtons = ` sizeButtons = `
...@@ -594,10 +595,14 @@ ...@@ -594,10 +595,14 @@
<div class="position-relative"> <div class="position-relative">
<span class="badge-bestseller">Best Seller</span> <span class="badge-bestseller">Best Seller</span>
<button class="btn-wishlist"><i class="fa-regular fa-heart"></i></button> <button class="btn-wishlist"><i class="fa-regular fa-heart"></i></button>
<img src="${imgUrl}" class="card-img-top object-fit-cover" alt="${p.name}" height="220"> <a href="/product-detail/${p.slug}">
<img src="${imgUrl}" class="card-img-top object-fit-cover" alt="${p.name}" height="220">
</a>
</div> </div>
<div class="card-body d-flex flex-column p-3"> <div class="card-body d-flex flex-column p-3">
<h5 class="product-title fw-bold mb-1" style="font-size: 0.95rem; color: #000000;">${p.name}</h5> <h5 class="product-title fw-bold mb-1" style="font-size: 0.95rem; color: #000000; height: 38px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;">
<a href="/product-detail/${p.slug}" class="text-decoration-none text-dark">${p.name}</a>
</h5>
<div class="d-flex align-items-center mb-2"> <div class="d-flex align-items-center mb-2">
<span class="product-price fw-bold text-dark fs-5 display-price">₹${Math.round(p.price)}</span> <span class="product-price fw-bold text-dark fs-5 display-price">₹${Math.round(p.price)}</span>
${strikePart} ${strikePart}
......
...@@ -6,6 +6,11 @@ ...@@ -6,6 +6,11 @@
<title>Admin Dashboard - VSI Mart</title> <title>Admin Dashboard - VSI Mart</title>
<!-- Bootstrap 5 CSS --> <!-- Bootstrap 5 CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- DataTables Bootstrap 5 CSS -->
<link href="https://cdn.datatables.net/1.13.7/css/dataTables.bootstrap5.min.css" rel="stylesheet">
<!-- Select2 CSS -->
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/select2-bootstrap-5-theme@1.3.0/dist/select2-bootstrap-5-theme.min.css" rel="stylesheet">
<!-- FontAwesome 6 Icons --> <!-- FontAwesome 6 Icons -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<!-- Google Fonts --> <!-- Google Fonts -->
...@@ -26,6 +31,29 @@ ...@@ -26,6 +31,29 @@
color: #1e293b; color: #1e293b;
margin: 0; margin: 0;
overflow-x: hidden; overflow-x: hidden;
font-size: 14px; /* Neater global font size */
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
/* Custom Breadcrumb Styling */
.custom-breadcrumb .breadcrumb-item {
font-size: 0.8rem;
font-weight: 500;
}
.custom-breadcrumb .breadcrumb-item a {
color: var(--primary-blue);
text-decoration: none;
transition: color 0.2s;
}
.custom-breadcrumb .breadcrumb-item a:hover {
color: var(--dark-blue);
text-decoration: underline;
}
.custom-breadcrumb .breadcrumb-item.active {
color: #64748b;
} }
/* Seashell Pre-loader overlay */ /* Seashell Pre-loader overlay */
...@@ -362,6 +390,101 @@ ...@@ -362,6 +390,101 @@
transform: translateY(0); transform: translateY(0);
opacity: 1; opacity: 1;
} }
/* Premium DataTables Controls Override */
.dataTables_wrapper .dataTables_length select {
border-radius: 30px !important;
padding: 0.375rem 1.75rem 0.375rem 1rem !important;
font-size: 0.85rem !important;
border: 1px solid #cbd5e1 !important;
background-color: white !important;
outline: none !important;
}
.dataTables_wrapper .dataTables_filter input {
border-radius: 30px !important;
padding: 0.4rem 1.25rem !important;
font-size: 0.85rem !important;
border: 1px solid #cbd5e1 !important;
background-color: white !important;
outline: none !important;
transition: all 0.2s ease !important;
width: 220px !important;
}
.dataTables_wrapper .dataTables_filter input:focus {
border-color: var(--primary-blue) !important;
box-shadow: 0 0 0 3px rgba(33, 114, 226, 0.15) !important;
}
.dataTables_wrapper .dataTables_info {
font-size: 0.82rem !important;
color: #64748b !important;
font-weight: 500 !important;
}
.dataTables_wrapper .pagination .page-link {
font-size: 0.82rem !important;
padding: 0.4rem 0.85rem !important;
border-radius: 30px !important;
margin: 0 3px !important;
color: #475569 !important;
border: 1px solid #e2e8f0 !important;
transition: all 0.2s ease !important;
}
.dataTables_wrapper .pagination .page-item.active .page-link {
background-color: var(--primary-blue) !important;
border-color: var(--primary-blue) !important;
color: white !important;
box-shadow: 0 4px 6px -1px rgba(33, 114, 226, 0.2) !important;
}
.dataTables_wrapper .pagination .page-link:hover {
background-color: #f1f5f9 !important;
color: var(--primary-blue) !important;
border-color: #cbd5e1 !important;
}
.dataTables_wrapper .pagination .page-item.disabled .page-link {
background-color: #f8fafc !important;
color: #94a3b8 !important;
border-color: #e2e8f0 !important;
}
.dataTables_wrapper .row {
--bs-gutter-x: 1.5rem;
}
/* Premium Select2 Custom Styling Overrides */
.select2-container--bootstrap-5 .select2-selection {
font-family: 'Plus Jakarta Sans', sans-serif !important;
font-size: 0.88rem !important;
border-radius: 12px !important;
border-color: #cbd5e1 !important;
min-height: 38px !important;
display: flex !important;
align-items: center !important;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
color: #1e293b !important;
padding-left: 15px !important;
}
.select2-container--bootstrap-5 .select2-dropdown {
border-radius: 12px !important;
border-color: #cbd5e1 !important;
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
overflow: hidden !important;
z-index: 1600 !important;
}
.select2-container--bootstrap-5 .select2-search__field {
font-family: 'Plus Jakarta Sans', sans-serif !important;
font-size: 0.85rem !important;
border-radius: 8px !important;
border: 1px solid #cbd5e1 !important;
padding: 5px 10px !important;
}
.select2-container--bootstrap-5 .select2-results__option {
font-family: 'Plus Jakarta Sans', sans-serif !important;
font-size: 0.88rem !important;
padding: 8px 15px !important;
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
background-color: var(--primary-blue) !important;
color: white !important;
}
</style> </style>
</head> </head>
<body> <body>
...@@ -498,8 +621,6 @@ ...@@ -498,8 +621,6 @@
<li class="{{ Request::is('admin/countries') ? 'active' : '' }}"><a href="{{ url('/admin/countries') }}"><i class="fa-solid fa-globe"></i>Countries</a></li> <li class="{{ Request::is('admin/countries') ? 'active' : '' }}"><a href="{{ url('/admin/countries') }}"><i class="fa-solid fa-globe"></i>Countries</a></li>
<li class="{{ Request::is('admin/states') ? 'active' : '' }}"><a href="{{ url('/admin/states') }}"><i class="fa-solid fa-map"></i>States</a></li> <li class="{{ Request::is('admin/states') ? 'active' : '' }}"><a href="{{ url('/admin/states') }}"><i class="fa-solid fa-map"></i>States</a></li>
<li class="{{ Request::is('admin/cities') ? 'active' : '' }}"><a href="{{ url('/admin/cities') }}"><i class="fa-solid fa-city"></i>Cities</a></li> <li class="{{ Request::is('admin/cities') ? 'active' : '' }}"><a href="{{ url('/admin/cities') }}"><i class="fa-solid fa-city"></i>Cities</a></li>
<li class="{{ Request::is('admin/units') ? 'active' : '' }}"><a href="{{ url('/admin/units') }}"><i class="fa-solid fa-scale-balanced"></i>Units</a></li>
<li class="{{ Request::is('admin/unitsizes') ? 'active' : '' }}"><a href="{{ url('/admin/unitsizes') }}"><i class="fa-solid fa-ruler-combined"></i>Unit Sizes</a></li>
<li class="{{ Request::is('admin/sizes') ? 'active' : '' }}"><a href="{{ url('/admin/sizes') }}"><i class="fa-solid fa-ruler"></i>Sizes</a></li> <li class="{{ Request::is('admin/sizes') ? 'active' : '' }}"><a href="{{ url('/admin/sizes') }}"><i class="fa-solid fa-ruler"></i>Sizes</a></li>
<li class="{{ Request::is('admin/categories') ? 'active' : '' }}"><a href="{{ url('/admin/categories') }}"><i class="fa-solid fa-list"></i>Categories</a></li> <li class="{{ Request::is('admin/categories') ? 'active' : '' }}"><a href="{{ url('/admin/categories') }}"><i class="fa-solid fa-list"></i>Categories</a></li>
</ul> </ul>
...@@ -526,7 +647,7 @@ ...@@ -526,7 +647,7 @@
<!-- LOGOUT CONTROL --> <!-- LOGOUT CONTROL -->
<ul class="sidebar-menu mt-4 border-top border-white-10"> <ul class="sidebar-menu mt-4 border-top border-white-10">
<li><a href="#" id="logoutBtn" class="text-warning"><i class="fa-solid fa-arrow-right-from-bracket"></i>Logout</a></li> <li><a href="{{ url('/admin/logout') }}" id="logoutBtn" class="text-warning"><i class="fa-solid fa-arrow-right-from-bracket"></i>Logout</a></li>
</ul> </ul>
</div> </div>
...@@ -534,13 +655,22 @@ ...@@ -534,13 +655,22 @@
<div class="main-content" id="adminMainContent"> <div class="main-content" id="adminMainContent">
<!-- Dynamic Header --> <!-- Dynamic Header -->
<div class="d-flex justify-content-between align-items-center mb-5"> <div class="mb-4">
<div> <!-- Breadcrumbs Area -->
<h1 class="fw-bold text-dark mb-1">@yield('page_title', 'Dashboard Overview')</h1> <div class="custom-breadcrumb">
<p class="text-muted mb-0">@yield('page_description', 'Manage and oversee VSI-MART seashell operations.')</p> @yield('breadcrumbs')
</div> </div>
<div>
@yield('page_action') <div class="d-flex justify-content-between align-items-center mt-2">
<div>
<h1 class="fw-bold text-dark mb-1">@yield('page_title', 'Dashboard Overview')</h1>
@if(trim(View::yieldContent('page_description')))
<p class="text-muted mb-0" style="font-size: 0.85rem;">@yield('page_description')</p>
@endif
</div>
<div>
@yield('page_action')
</div>
</div> </div>
</div> </div>
...@@ -559,6 +689,77 @@ ...@@ -559,6 +689,77 @@
<!-- MAIN CRUDS / MODALS / CONTROLLERS SCRIPT --> <!-- MAIN CRUDS / MODALS / CONTROLLERS SCRIPT -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<!-- DataTables JS -->
<script src="https://cdn.datatables.net/1.13.7/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.7/js/dataTables.bootstrap5.min.js"></script>
<!-- Select2 JS -->
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<!-- Global Select2 Initialization -->
<script>
$(document).ready(function() {
function initSelect2() {
$('select').not('.dataTables_length select').each(function() {
if ($(this).hasClass('select2-hidden-accessible')) {
return;
}
const parentModal = $(this).closest('.modal');
const options = {
theme: 'bootstrap-5',
width: '100%'
};
if (parentModal.length) {
options.dropdownParent = parentModal;
}
$(this).select2(options);
});
}
initSelect2();
$(document).on('shown.bs.modal', function() {
initSelect2();
});
});
</script>
<!-- Global DataTables Initialization -->
<script>
$(document).ready(function() {
const path = window.location.pathname;
const isOverview = path.endsWith('/admin/dashboard') || path.endsWith('/admin') || path.endsWith('/admin/');
if (!isOverview) {
$('.panel-card table').each(function() {
const table = $(this);
// Remove manual empty placeholder row if it exists so DataTables handles zero-state correctly
table.find('tbody tr td:contains("No records found.")').closest('tr').remove();
// Initialize DataTable
table.DataTable({
pageLength: 10,
responsive: true,
autoWidth: false,
language: {
search: "_INPUT_",
searchPlaceholder: "Search...",
lengthMenu: "Show _MENU_ entries"
},
dom: "<'row mb-3 align-items-center'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6 text-md-end'f>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row mt-3 align-items-center'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>"
});
});
}
});
</script>
<script> <script>
// Preloader fadeout // Preloader fadeout
window.addEventListener('load', () => { window.addEventListener('load', () => {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<meta name="keywords" content="seashell crafts, beach decor, shell gifts, handmade jewelry, Chennai crafts, VSI Mart"> <meta name="keywords" content="seashell crafts, beach decor, shell gifts, handmade jewelry, Chennai crafts, VSI Mart">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ ->name }} - VSI Mart</title> <title>{{ $product->name }} - VSI Mart</title>
<!-- Google Fonts --> <!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
...@@ -15,21 +15,21 @@ ...@@ -15,21 +15,21 @@
<!-- Bootstrap Icons --> <!-- Bootstrap Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
<!-- Custom CSS --> <!-- Custom CSS -->
<link rel="stylesheet" href="styles.css"> <link rel="stylesheet" href="/styles.css">
</head> </head>
<body> <body>
<!-- Top Pillayar Suzhi Bar --> <!-- Top Pillayar Suzhi Bar -->
<div class="top-suzhi-bar text-center py-1" style="background-color: #fcfbf0; border-bottom: 1.5px solid #ebdcb9; display: flex; align-items: center; justify-content: center; height: 42px;"> <div class="top-suzhi-bar text-center py-1" style="background-color: #fcfbf0; border-bottom: 1.5px solid #ebdcb9; display: flex; align-items: center; justify-content: center; height: 42px;">
<img src="pillayar_suzhi.png" alt="Pillayar Suzhi" style="height: 30px; object-fit: contain;"> <img src="/pillayar_suzhi.png" alt="Pillayar Suzhi" style="height: 30px; object-fit: contain;">
</div> </div>
<!-- Navigation Header --> <!-- Navigation Header -->
<nav class="navbar navbar-expand-lg navbar-dark navbar-custom sticky-top"> <nav class="navbar navbar-expand-lg navbar-dark navbar-custom sticky-top">
<div class="container"> <div class="container">
<a class="navbar-brand text-white fw-bold d-flex align-items-center" href="{{ url('/') }}"> <a class="navbar-brand text-white fw-bold d-flex align-items-center" href="{{ url('/') }}">
<img src="header_logo.png" alt="VSI Logo" style="height: 45px; margin-right: 10px; object-fit: contain;"> <img src="/header_logo.png" alt="VSI Logo" style="height: 45px; margin-right: 10px; object-fit: contain;">
<img src="footer_logo.png" alt="VSI MART" style="height: 24px; object-fit: contain;"> <img src="/footer_logo.png" alt="VSI MART" style="height: 24px; object-fit: contain;">
</a> </a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ url('/') }}" class="text-decoration-none">Home</a></li> <li class="breadcrumb-item"><a href="{{ url('/') }}" class="text-decoration-none">Home</a></li>
<li class="breadcrumb-item"><a href="{{ url('/shop') }}" class="text-decoration-none">All Products</a></li> <li class="breadcrumb-item"><a href="{{ url('/shop') }}" class="text-decoration-none">All Products</a></li>
<li class="breadcrumb-item active" aria-current="page">{{ ->name }}</li> <li class="breadcrumb-item active" aria-current="page">{{ $product->name }}</li>
</ol> </ol>
</nav> </nav>
...@@ -98,37 +98,45 @@ ...@@ -98,37 +98,45 @@
<!-- Left Side: Product Images --> <!-- Left Side: Product Images -->
<div class="col-lg-6"> <div class="col-lg-6">
<div class="card border-0 shadow-sm rounded-4 overflow-hidden position-relative mb-3"> <div class="card border-0 shadow-sm rounded-4 overflow-hidden position-relative mb-3">
<span class="badge-bestseller">Best Seller</span> @if($product->is_bestseller)
<img id="main-product-img" src="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=1600&auto=format&fit=crop&q=90" alt="{{ ->name }}" class="w-100 img-fluid" style="height: 630px; object-fit: cover;"> <span class="badge-bestseller">Best Seller</span>
@endif
<img id="main-product-img" src="{{ $product->primaryImage ? $product->primaryImage->image_url : 'https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=1600&auto=format&fit=crop&q=90' }}" alt="{{ $product->name }}" class="w-100 img-fluid" style="height: 630px; object-fit: cover;">
</div> </div>
<!-- Thumbnail carousel (5 images) --> <!-- Thumbnail carousel (5 images) -->
<div class="row g-2"> <div class="row g-2">
<div class="col"> @php
<img src="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=200&auto=format&fit=crop&q=80" alt="Thumb 1" class="img-fluid rounded-3 border border-primary thumbnail-img" style="height: 80px; width: 100%; object-fit: cover; cursor: pointer;"> $thumbImages = [
</div> $product->primaryImage ? $product->primaryImage->image_url : 'https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=1600&auto=format&fit=crop&q=90',
<div class="col"> 'https://images.unsplash.com/photo-1542838132-92c53300491e?w=800&auto=format&fit=crop&q=80',
<img src="https://images.unsplash.com/photo-1542838132-92c53300491e?w=200&auto=format&fit=crop&q=80" alt="Thumb 2" class="img-fluid rounded-3 thumbnail-img" style="height: 80px; width: 100%; object-fit: cover; cursor: pointer;"> 'https://images.unsplash.com/photo-1595855759920-86582396756a?w=800&auto=format&fit=crop&q=80',
</div> 'https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=800&auto=format&fit=crop&q=80',
<div class="col"> 'https://images.unsplash.com/photo-1549465220-1a8b9238cd48?w=800&auto=format&fit=crop&q=80'
<img src="https://images.unsplash.com/photo-1595855759920-86582396756a?w=200&auto=format&fit=crop&q=80" alt="Thumb 3" class="img-fluid rounded-3 thumbnail-img" style="height: 80px; width: 100%; object-fit: cover; cursor: pointer;"> ];
</div> @endphp
<div class="col"> @foreach($thumbImages as $idx => $thumb)
<img src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=200&auto=format&fit=crop&q=80" alt="Thumb 4" class="img-fluid rounded-3 thumbnail-img" style="height: 80px; width: 100%; object-fit: cover; cursor: pointer;"> <div class="col">
</div> <img src="{{ $thumb }}" alt="Thumb {{ $idx+1 }}" class="img-fluid rounded-3 thumbnail-img {{ $idx === 0 ? 'border border-primary' : '' }}" style="height: 80px; width: 100%; object-fit: cover; cursor: pointer;">
<div class="col"> </div>
<img src="https://images.unsplash.com/photo-1549465220-1a8b9238cd48?w=200&auto=format&fit=crop&q=80" alt="Thumb 5" class="img-fluid rounded-3 thumbnail-img" style="height: 80px; width: 100%; object-fit: cover; cursor: pointer;"> @endforeach
</div>
</div> </div>
</div> </div>
<!-- Right Side: Details & Configurator --> <!-- Right Side: Details & Configurator -->
<div class="col-lg-6"> <div class="col-lg-6">
<h1 class="fw-bold text-dark mb-2" style="font-size: 1.8rem;">{{ ->name }}</h1> <h1 class="fw-bold text-dark mb-2" style="font-size: 1.8rem;">{{ $product->name }}</h1>
@php
$firstVariant = $product->variants->first();
$price = $firstVariant ? $firstVariant->price : 0;
$strikePrice = $product->strike_price ?? ($price * 1.18);
$saveAmt = $strikePrice - $price;
@endphp
<div class="d-flex align-items-center mb-1"> <div class="d-flex align-items-center mb-1">
<span class="fs-2 fw-bold text-dark me-2">₹450</span> <span class="fs-2 fw-bold text-dark me-2" id="display-price">₹{{ number_format($price, 0) }}</span>
<span class="text-muted text-decoration-line-through fs-5 me-2">₹535</span> <span class="text-muted text-decoration-line-through fs-5 me-2" id="display-strike">₹{{ number_format($strikePrice, 0) }}</span>
<span class="badge bg-primary px-2 py-1" style="font-size: 0.72rem; background-color: var(--primary-blue) !important;">SAVE ₹85</span> <span class="badge bg-primary px-2 py-1" style="font-size: 0.72rem; background-color: var(--primary-blue) !important;" id="display-save">SAVE ₹{{ number_format($saveAmt, 0) }}</span>
</div> </div>
<div class="fw-bold mb-2" style="color: var(--primary-blue); font-size: 1.05rem; letter-spacing: 0.02em;">9% OFF</div> <div class="fw-bold mb-2" style="color: var(--primary-blue); font-size: 1.05rem; letter-spacing: 0.02em;">9% OFF</div>
...@@ -154,9 +162,17 @@ ...@@ -154,9 +162,17 @@
<div class="mb-3"> <div class="mb-3">
<h6 class="fw-bold mb-2">Size / Variant</h6> <h6 class="fw-bold mb-2">Size / Variant</h6>
<div class="size-select-group"> <div class="size-select-group">
<button class="size-btn active">Small</button> @foreach($product->variants as $index => $variant)
<button class="size-btn">Medium</button> @if($variant->size)
<button class="size-btn">Large</button> <button class="size-btn {{ $index === 0 ? 'active' : '' }}"
data-price="{{ round($variant->price) }}"
data-strike="{{ round($variant->price * 1.18) }}"
data-save="{{ round(($variant->price * 1.18) - $variant->price) }}"
data-variant-id="{{ $variant->id }}">
{{ $variant->size->name }}
</button>
@endif
@endforeach
</div> </div>
</div> </div>
...@@ -172,7 +188,12 @@ ...@@ -172,7 +188,12 @@
</div> </div>
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<button class="btn-add-cart-detail w-100 py-2.5 btn-add-to-cart-dynamic" data-id="p1" data-name="{{ ->name }}" data-price="450" data-img="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=800&auto=format&fit=crop&q=80"> <button class="btn-add-cart-detail w-100 py-2.5 btn-add-to-cart-dynamic"
data-id="{{ $product->id }}"
data-name="{{ $product->name }}"
data-price="{{ round($price) }}"
data-img="{{ $product->primaryImage ? $product->primaryImage->image_url : 'https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=800&auto=format&fit=crop&q=80' }}"
id="btn-add-to-cart">
Add to cart Add to cart
</button> </button>
</div> </div>
...@@ -206,7 +227,7 @@ ...@@ -206,7 +227,7 @@
<!-- Description Box --> <!-- Description Box -->
<div class="card border-0 shadow-sm rounded-4 p-4 mt-5"> <div class="card border-0 shadow-sm rounded-4 p-4 mt-5">
<h4 class="fw-bold text-dark mb-3">About this Product</h4> <h4 class="fw-bold text-dark mb-3">About this Product</h4>
<p class="text-muted" style="line-height: 1.7;">A beautiful handcrafted wall frame adorned with an array of premium seashells, creating a stunning coastal art piece perfect for living rooms and bedrooms.</p> <p class="text-muted" style="line-height: 1.7;">{{ $product->description }}</p>
<div class="row g-3 mt-2"> <div class="row g-3 mt-2">
<div class="col-md-4"> <div class="col-md-4">
<div class="d-flex align-items-center gap-3 p-3 rounded-3" style="background-color: #fdf8f4; border: 1.5px solid #fceadc; min-height: 80px;"> <div class="d-flex align-items-center gap-3 p-3 rounded-3" style="background-color: #fdf8f4; border: 1.5px solid #fceadc; min-height: 80px;">
...@@ -248,102 +269,66 @@ ...@@ -248,102 +269,66 @@
<section class="mt-5 pt-5 border-top"> <section class="mt-5 pt-5 border-top">
<h3 class="fw-bold text-dark mb-4">Related Products</h3> <h3 class="fw-bold text-dark mb-4">Related Products</h3>
<div class="row g-4"> <div class="row g-4">
<!-- Related 1 --> @foreach($relatedProducts as $related)
<div class="col-lg-4 col-md-6"> @php
<div class="product-card"> $rVariant = $related->variants->first();
<span class="badge-bestseller">Best Seller</span> $rPrice = $rVariant ? $rVariant->price : 0;
<button class="btn-wishlist"><i class="bi bi-heart"></i></button> $rStrike = $related->strike_price ?? ($rPrice * 1.18);
<img src="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=500&auto=format&fit=crop&q=80" alt="{{ ->name }}"> $rSave = $rStrike - $rPrice;
<div class="product-card-body"> @endphp
<h5 class="product-title">{{ ->name }}</h5> <div class="col-lg-4 col-md-6">
<div class="product-rating"> <div class="product-card">
<i class="bi bi-star-fill text-warning"></i> @if($related->is_bestseller)
<i class="bi bi-star-fill text-warning"></i> <span class="badge-bestseller">Best Seller</span>
<i class="bi bi-star-fill text-warning"></i> @endif
<i class="bi bi-star-fill text-warning"></i> <button class="btn-wishlist"><i class="bi bi-heart"></i></button>
<i class="bi bi-star text-warning"></i> <a href="{{ url('/product-detail/' . $related->slug) }}">
<span class="text-muted small ms-1">(32)</span> <img src="{{ $related->primaryImage ? $related->primaryImage->image_url : 'https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=500&auto=format&fit=crop&q=80' }}" alt="{{ $related->name }}">
</div> </a>
<div class="size-select-group"> <div class="product-card-body">
<button class="size-btn active">Small</button> <h5 class="product-title" style="height: 38px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;">
<button class="size-btn">Medium</button> <a href="{{ url('/product-detail/' . $related->slug) }}" class="text-decoration-none text-dark">{{ $related->name }}</a>
<button class="size-btn">Large</button> </h5>
</div> <div class="product-rating">
<div class="d-flex flex-column mt-auto pt-2 border-top"> <i class="bi bi-star-fill text-warning"></i>
<div class="d-flex align-items-center flex-wrap"> <i class="bi bi-star-fill text-warning"></i>
<span class="product-price">₹850</span> <i class="bi bi-star-fill text-warning"></i>
<span class="product-price-strike">₹935</span> <i class="bi bi-star-fill text-warning"></i>
<span class="badge bg-primary ms-2 px-2 py-1" style="font-size: 0.72rem; background-color: var(--primary-blue) !important;">SAVE ₹85</span> <i class="bi bi-star text-warning"></i>
<span class="text-muted small ms-1">(32)</span>
</div> </div>
<button class="btn btn-add-to-cart w-100 mt-3 btn-add-to-cart-dynamic" data-id="p1" data-name="{{ ->name }}" data-price="850" data-img="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=500&auto=format&fit=crop&q=80">Add to cart</button> <div class="size-select-group">
</div> @foreach($related->variants as $vIdx => $v)
</div> @if($v->size)
</div> <button class="size-btn {{ $vIdx === 0 ? 'active' : '' }}"
</div> data-price="{{ round($v->price) }}"
<!-- Related 2 --> data-variant-id="{{ $v->id }}"
<div class="col-lg-4 col-md-6"> data-size="{{ $v->size->name }}">
<div class="product-card"> {{ $v->size->name }}
<span class="badge-bestseller">Best Seller</span> </button>
<button class="btn-wishlist"><i class="bi bi-heart"></i></button> @endif
<img src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=500&auto=format&fit=crop&q=80" alt="Seashell Wind Chime"> @endforeach
<div class="product-card-body">
<h5 class="product-title">Seashell Wind Chime</h5>
<div class="product-rating">
<i class="bi bi-star-fill text-warning"></i>
<i class="bi bi-star-fill text-warning"></i>
<i class="bi bi-star-fill text-warning"></i>
<i class="bi bi-star-fill text-warning"></i>
<i class="bi bi-star text-warning"></i>
<span class="text-muted small ms-1">(32)</span>
</div>
<div class="size-select-group">
<button class="size-btn active">Small</button>
<button class="size-btn">Medium</button>
<button class="size-btn">Large</button>
</div>
<div class="d-flex flex-column mt-auto pt-2 border-top">
<div class="d-flex align-items-center flex-wrap">
<span class="product-price">₹450</span>
<span class="product-price-strike">₹535</span>
<span class="badge bg-primary ms-2 px-2 py-1" style="font-size: 0.72rem; background-color: var(--primary-blue) !important;">SAVE ₹85</span>
</div> </div>
<button class="btn btn-add-to-cart w-100 mt-3 btn-add-to-cart-dynamic" data-id="p2" data-name="Seashell Wind Chime" data-price="450" data-img="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=500&auto=format&fit=crop&q=80">Add to cart</button> <div class="d-flex flex-column mt-auto pt-2 border-top">
</div> <div class="d-flex align-items-center flex-wrap">
</div> <span class="product-price">₹{{ number_format($rPrice, 0) }}</span>
</div> @if($rStrike > $rPrice)
</div> <span class="product-price-strike">₹{{ number_format($rStrike, 0) }}</span>
<!-- Related 3 --> <span class="badge bg-primary ms-2 px-2 py-1" style="font-size: 0.72rem; background-color: var(--primary-blue) !important;">SAVE ₹{{ number_format($rSave, 0) }}</span>
<div class="col-lg-4 col-md-6"> @endif
<div class="product-card"> </div>
<span class="badge-bestseller">Best Seller</span> <button class="btn btn-add-to-cart w-100 mt-3 btn-add-to-cart-dynamic"
<button class="btn-wishlist"><i class="bi bi-heart"></i></button> data-id="{{ $related->id }}"
<img src="https://images.unsplash.com/photo-1549465220-1a8b9238cd48?w=500&auto=format&fit=crop&q=80" alt="Ocean Gift Hamper Box"> data-name="{{ $related->name }}"
<div class="product-card-body"> data-price="{{ round($rPrice) }}"
<h5 class="product-title">Ocean Gift Hamper Box</h5> data-img="{{ $related->primaryImage ? $related->primaryImage->image_url : '' }}">
<div class="product-rating"> Add to cart
<i class="bi bi-star-fill text-warning"></i> </button>
<i class="bi bi-star-fill text-warning"></i>
<i class="bi bi-star-fill text-warning"></i>
<i class="bi bi-star-fill text-warning"></i>
<i class="bi bi-star text-warning"></i>
<span class="text-muted small ms-1">(32)</span>
</div>
<div class="size-select-group">
<button class="size-btn active">Small</button>
<button class="size-btn">Medium</button>
<button class="size-btn">Large</button>
</div>
<div class="d-flex flex-column mt-auto pt-2 border-top">
<div class="d-flex align-items-center flex-wrap">
<span class="product-price">₹1,850</span>
<span class="product-price-strike">₹2,335</span>
<span class="badge bg-primary ms-2 px-2 py-1" style="font-size: 0.72rem; background-color: var(--primary-blue) !important;">SAVE ₹185</span>
</div> </div>
<button class="btn btn-add-to-cart w-100 mt-3 btn-add-to-cart-dynamic" data-id="p3" data-name="Ocean Gift Hamper Box" data-price="1850" data-img="https://images.unsplash.com/photo-1549465220-1a8b9238cd48?w=500&auto=format&fit=crop&q=80">Add to cart</button>
</div> </div>
</div> </div>
</div> </div>
</div> @endforeach
</div> </div>
</section> </section>
</main> </main>
...@@ -355,7 +340,7 @@ ...@@ -355,7 +340,7 @@
<!-- Brand Info --> <!-- Brand Info -->
<div class="col-lg-5 col-md-6"> <div class="col-lg-5 col-md-6">
<div class="mb-3"> <div class="mb-3">
<img src="footer_logo.png" alt="VSI MART Logo" style="height: 48px; max-width: 100%; object-fit: contain;"> <img src="/footer_logo.png" alt="VSI MART Logo" style="height: 48px; max-width: 100%; object-fit: contain;">
</div> </div>
<p class="pe-lg-5 text-white-50" style="font-size: 0.9rem; line-height: 1.6; color: rgba(255,255,255,0.85) !important;"> <p class="pe-lg-5 text-white-50" style="font-size: 0.9rem; line-height: 1.6; color: rgba(255,255,255,0.85) !important;">
Handmade seashell crafts and ocean-inspired décor,<br> Handmade seashell crafts and ocean-inspired décor,<br>
...@@ -393,7 +378,6 @@ ...@@ -393,7 +378,6 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>
<hr class="my-4" style="background-color: rgba(255,255,255,0.35); height: 2.5px; opacity: 1; border: none; margin-left: 0; margin-right: 0; width: 100%;"> <hr class="my-4" style="background-color: rgba(255,255,255,0.35); height: 2.5px; opacity: 1; border: none; margin-left: 0; margin-right: 0; width: 100%;">
<div class="container"> <div class="container">
...@@ -407,7 +391,7 @@ ...@@ -407,7 +391,7 @@
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
<!-- Custom JS --> <!-- Custom JS -->
<script src="main.js"></script> <script src="/main.js"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
// Switch main image on thumbnail click // Switch main image on thumbnail click
...@@ -429,10 +413,27 @@ ...@@ -429,10 +413,27 @@
$('#detail-qty').val(qty - 1); $('#detail-qty').val(qty - 1);
} }
}); });
// Switch price, strike price, save value based on variant size selection
$('.size-select-group').on('click', '.size-btn', function() {
const price = $(this).data('price');
const strike = $(this).data('strike');
const save = $(this).data('save');
if (price) {
$('#display-price').text('₹' + price.toLocaleString());
$('#btn-add-to-cart').data('price', price);
}
if (strike) {
$('#display-strike').text('₹' + strike.toLocaleString());
}
if (save && save > 0) {
$('#display-save').text('SAVE ₹' + save.toLocaleString()).show();
} else {
$('#display-save').hide();
}
});
}); });
</script> </script>
</body> </body>
</html> </html>
...@@ -316,7 +316,8 @@ ...@@ -316,7 +316,8 @@
let sizeButtons = ''; let sizeButtons = '';
if (p.variants && p.variants.length > 0) { if (p.variants && p.variants.length > 0) {
p.variants.forEach((v, idx) => { p.variants.forEach((v, idx) => {
sizeButtons += `<button class="size-btn ${idx === 0 ? 'active' : ''}" data-price="${Math.round(v.price)}" data-size="${v.size}">${v.size}</button> `; let sizeName = (v.size && v.size.name) ? v.size.name : (v.size || '');
sizeButtons += `<button class="size-btn ${idx === 0 ? 'active' : ''}" data-price="${Math.round(v.price)}" data-size="${sizeName}" data-variant-id="${v.id}">${sizeName}</button> `;
}); });
} else { } else {
sizeButtons = ` sizeButtons = `
...@@ -332,10 +333,14 @@ ...@@ -332,10 +333,14 @@
<div class="position-relative"> <div class="position-relative">
${p.is_bestseller ? '<span class="badge-bestseller">Best Seller</span>' : ''} ${p.is_bestseller ? '<span class="badge-bestseller">Best Seller</span>' : ''}
<button class="btn-wishlist"><i class="fa-regular fa-heart"></i></button> <button class="btn-wishlist"><i class="fa-regular fa-heart"></i></button>
<img src="${imgUrl}" class="card-img-top object-fit-cover" alt="${p.name}" height="220"> <a href="/product-detail/${p.slug}">
<img src="${imgUrl}" class="card-img-top object-fit-cover" alt="${p.name}" height="220">
</a>
</div> </div>
<div class="card-body d-flex flex-column p-3 product-card-body"> <div class="card-body d-flex flex-column p-3 product-card-body">
<h5 class="product-title fw-bold mb-1" style="font-size: 0.95rem; color: #000000; height: 38px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;">${p.name}</h5> <h5 class="product-title fw-bold mb-1" style="font-size: 0.95rem; color: #000000; height: 38px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;">
<a href="/product-detail/${p.slug}" class="text-decoration-none text-dark">${p.name}</a>
</h5>
<div class="d-flex align-items-center mb-2"> <div class="d-flex align-items-center mb-2">
<span class="product-price fw-bold text-dark fs-5 display-price">₹${Math.round(p.price)}</span> <span class="product-price fw-bold text-dark fs-5 display-price">₹${Math.round(p.price)}</span>
${strikePart} ${strikePart}
......
...@@ -33,6 +33,25 @@ Route::get('/customer/orders', [\App\Http\Controllers\CustomerAuthController::cl ...@@ -33,6 +33,25 @@ Route::get('/customer/orders', [\App\Http\Controllers\CustomerAuthController::cl
// Serviceability Pincode Endpoints // Serviceability Pincode Endpoints
Route::post('/check-pincode', [PincodeController::class, 'checkServiceability']); Route::post('/check-pincode', [PincodeController::class, 'checkServiceability']);
// States and Cities Endpoints
Route::get('/states', function () {
return response()->json([
'success' => true,
'data' => \App\Models\State::where('status', 'Active')->orderBy('name')->get()
]);
});
Route::get('/cities', function (\Illuminate\Http\Request $request) {
$state = $request->query('state');
$query = \App\Models\City::where('status', 'Active');
if ($state) {
$query->where('state', $state);
}
return response()->json([
'success' => true,
'data' => $query->orderBy('name')->get()
]);
});
// Checkout / Place Order // Checkout / Place Order
Route::post('/place-order', [CheckoutController::class, 'store']); Route::post('/place-order', [CheckoutController::class, 'store']);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
use App\Http\Controllers\Backend\AdminViewController; use App\Http\Controllers\Backend\AdminViewController;
use App\Http\Controllers\Backend\AdminMasterDataController; use App\Http\Controllers\Backend\AdminMasterDataController;
use App\Http\Controllers\Backend\AdminAuthController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
/* /*
...@@ -12,29 +13,37 @@ use Illuminate\Support\Facades\Route; ...@@ -12,29 +13,37 @@ use Illuminate\Support\Facades\Route;
Route::prefix('admin')->group(function () { Route::prefix('admin')->group(function () {
Route::get('/', [AdminViewController::class, 'dashboard']); // Auth Routes
Route::get('/dashboard', [AdminViewController::class, 'dashboard']); Route::get('/login', [AdminAuthController::class, 'showLoginForm'])->name('login');
Route::get('/countries', [AdminViewController::class, 'countries']); Route::post('/login', [AdminAuthController::class, 'login']);
Route::get('/states', [AdminViewController::class, 'states']); Route::get('/logout', [AdminAuthController::class, 'logout'])->name('logout');
Route::get('/cities', [AdminViewController::class, 'cities']);
Route::get('/units', [AdminViewController::class, 'units']);
Route::get('/unitsizes', [AdminViewController::class, 'unitsizes']);
Route::get('/sizes', [AdminViewController::class, 'sizes']);
Route::get('/categories', [AdminViewController::class, 'categories']);
// Master Data Write Operations Route::middleware('auth')->group(function () {
Route::post('/master/{type}', [AdminMasterDataController::class, 'store']); Route::get('/', [AdminViewController::class, 'dashboard']);
Route::put('/master/{type}/{id}', [AdminMasterDataController::class, 'update']); Route::get('/dashboard', [AdminViewController::class, 'dashboard']);
Route::delete('/master/{type}/{id}', [AdminMasterDataController::class, 'destroy']); Route::get('/countries', [AdminViewController::class, 'countries']);
Route::get('/states', [AdminViewController::class, 'states']);
Route::get('/cities', [AdminViewController::class, 'cities']);
Route::get('/sizes', [AdminViewController::class, 'sizes']);
Route::get('/categories', [AdminViewController::class, 'categories']);
Route::get('/products', [AdminViewController::class, 'products']); // Master Data Write Operations
Route::get('/productprices', [AdminViewController::class, 'productprices']); Route::post('/master/{type}', [AdminMasterDataController::class, 'store']);
Route::get('/orders', [AdminViewController::class, 'orders']); Route::put('/master/{type}/{id}', [AdminMasterDataController::class, 'update']);
Route::get('/orderstatuschange', [AdminViewController::class, 'orderstatuschange']); Route::delete('/master/{type}/{id}', [AdminMasterDataController::class, 'destroy']);
Route::get('/announcements', [AdminViewController::class, 'announcements']);
Route::get('/gallery', [AdminViewController::class, 'gallery']);
Route::get('/pincodes', [AdminViewController::class, 'pincodes']);
Route::get('/coupons', [AdminViewController::class, 'coupons']);
Route::get('/wishlist', [AdminViewController::class, 'wishlist']);
Route::get('/products', [AdminViewController::class, 'products']);
Route::get('/products/create', [AdminViewController::class, 'productsCreate']);
Route::get('/products/{id}/edit', [AdminViewController::class, 'productsEdit']);
Route::get('/productprices', [AdminViewController::class, 'productprices']);
Route::get('/orders', [AdminViewController::class, 'orders']);
Route::get('/orderstatuschange', [AdminViewController::class, 'orderstatuschange']);
Route::get('/announcements', [AdminViewController::class, 'announcements']);
Route::get('/gallery', [AdminViewController::class, 'gallery']);
Route::get('/gallery/create', [AdminViewController::class, 'galleryCreate']);
Route::get('/gallery/{id}/edit', [AdminViewController::class, 'galleryEdit']);
Route::get('/pincodes', [AdminViewController::class, 'pincodes']);
Route::get('/coupons', [AdminViewController::class, 'coupons']);
Route::get('/wishlist', [AdminViewController::class, 'wishlist']);
});
}); });
...@@ -33,7 +33,8 @@ Route::get('/checkout', function () { ...@@ -33,7 +33,8 @@ Route::get('/checkout', function () {
}); });
Route::get('/gallery', function () { Route::get('/gallery', function () {
return view('gallery'); $gallery = \App\Models\Gallery::where('status', 'Active')->get();
return view('gallery', compact('gallery'));
}); });
Route::get('/catalog', [FrontendController::class, 'ourCollection']); Route::get('/catalog', [FrontendController::class, 'ourCollection']);
......
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