Commit d88e8a2a by Dhanaraj

added new design

parent 215d2695
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Country;
use App\Models\State;
use App\Models\City;
use App\Models\Unit;
use App\Models\UnitSize;
use App\Models\Size;
use App\Models\Category;
class AdminMasterDataController extends Controller
{
private function getModelClass($type) {
return match($type) {
'country', 'countries' => Country::class,
'state', 'states' => State::class,
'city', 'cities' => City::class,
'unit', 'units' => Unit::class,
'unitsizes' => UnitSize::class,
'size', 'sizes' => Size::class,
'category', 'categories' => Category::class,
'gallery', 'galleries' => \App\Models\Gallery::class,
default => null,
};
}
public function store(Request $request, $type)
{
$modelClass = $this->getModelClass($type);
if (!$modelClass) return back()->with('error', 'Invalid type');
$data = $request->except('_token');
$modelClass::create($data);
return back()->with('success', 'Record created successfully!');
}
public function update(Request $request, $type, $id)
{
$modelClass = $this->getModelClass($type);
if (!$modelClass) return back()->with('error', 'Invalid type');
$record = $modelClass::findOrFail($id);
$data = $request->except(['_token', '_method']);
$record->update($data);
return back()->with('success', 'Record updated successfully!');
}
public function destroy($type, $id)
{
$modelClass = $this->getModelClass($type);
if (!$modelClass) return back()->with('error', 'Invalid type');
$record = $modelClass::findOrFail($id);
$record->delete();
return back()->with('success', 'Record deleted successfully!');
}
}
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Country;
use App\Models\State;
use App\Models\City;
use App\Models\Unit;
use App\Models\UnitSize;
use App\Models\Size;
use App\Models\Category;
use App\Models\Product;
use App\Models\ProductVariant;
use App\Models\Order;
use App\Models\Announcement;
use App\Models\Gallery;
use App\Models\Pincode;
use App\Models\Coupon;
use App\Models\Wishlist;
class AdminViewController extends Controller
{
public function dashboard() {
return view('admin.overview');
}
public function countries() {
$countries = Country::all();
return view('admin.country', compact('countries'));
}
public function states() {
$states = State::all();
return view('admin.state', compact('states'));
}
public function cities() {
$cities = City::all();
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() {
$sizes = Size::all();
return view('admin.sizes', compact('sizes'));
}
public function categories() {
$categories = Category::all();
return view('admin.category', compact('categories'));
}
public function products() {
$products = Product::with('category')->get();
return view('admin.products', compact('products'));
}
public function productprices() {
$productprices = ProductVariant::with('product')->get();
return view('admin.productprices', compact('productprices'));
}
public function orders() {
$orders = Order::all();
return view('admin.orders', compact('orders'));
}
public function orderstatuschange() {
$orders = Order::all();
return view('admin.orderstatuschange', compact('orders'));
}
public function announcements() {
$announcements = Announcement::all();
return view('admin.announcements', compact('announcements'));
}
public function gallery() {
$gallery = Gallery::all();
return view('admin.gallery', compact('gallery'));
}
public function pincodes() {
$pincodes = Pincode::all();
return view('admin.pincodes', compact('pincodes'));
}
public function coupons() {
$coupons = Coupon::all();
return view('admin.coupons', compact('coupons'));
}
public function wishlist() {
$wishlists = Wishlist::with('product')->get();
return view('admin.wishlist', compact('wishlists'));
}
}
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
class CategoryController extends Controller
{
/**
* Get categories list.
*/
public function index(): JsonResponse
{
return response()->json([
'success' => true,
'message' => 'Categories inventory operations endpoint.'
]);
}
}
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use App\Models\Order;
use App\Models\Product;
use Illuminate\Http\JsonResponse;
use Illuminate\View\View;
class DashboardController extends Controller
{
/**
* Render the admin dashboard master view.
*/
public function index(): View
{
return view('admin');
}
/**
* Get overview dashboard metrics.
*/
public function metrics(): JsonResponse
{
$totalSales = Order::where('payment_status', 'paid')->sum('total');
$activeOrders = Order::whereIn('order_status', ['pending', 'processing', 'shipped'])->count();
$totalProducts = Product::count();
$recentOrders = Order::latest()->limit(5)->get();
return response()->json([
'success' => true,
'data' => [
'metrics' => [
'total_sales' => $totalSales,
'active_orders' => $activeOrders,
'total_products' => $totalProducts,
],
'recent_orders' => $recentOrders
]
]);
}
}
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
class GalleryController extends Controller
{
/**
* Get gallery assets list.
*/
public function index(): JsonResponse
{
return response()->json([
'success' => true,
'message' => 'Showcase gallery media manager endpoint.'
]);
}
}
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class GeographyController extends Controller
{
/**
* Get geographical list.
*/
public function index(): JsonResponse
{
return response()->json([
'success' => true,
'message' => 'Geographical data access endpoint.'
]);
}
}
<?php <?php
namespace App\Http\Controllers; namespace App\Http\Controllers\Backend;
use App\Models\Order; use App\Http\Controllers\Controller;
use App\Models\Product; use App\Models\Product;
use App\Models\Pincode;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class AdminController extends Controller class InventoryController extends Controller
{ {
/** /**
* Get overview dashboard metrics.
*/
public function metrics(): JsonResponse
{
$totalSales = Order::where('payment_status', 'paid')->sum('total');
$activeOrders = Order::whereIn('order_status', ['pending', 'processing', 'shipped'])->count();
$totalProducts = Product::count();
$recentOrders = Order::latest()->limit(5)->get();
return response()->json([
'success' => true,
'data' => [
'metrics' => [
'total_sales' => $totalSales,
'active_orders' => $activeOrders,
'total_products' => $totalProducts,
],
'recent_orders' => $recentOrders
]
]);
}
/**
* Store a newly created product. * Store a newly created product.
*/ */
public function storeProduct(Request $request): JsonResponse public function storeProduct(Request $request): JsonResponse
...@@ -43,11 +18,8 @@ class AdminController extends Controller ...@@ -43,11 +18,8 @@ class AdminController extends Controller
'category_id' => 'required|exists:categories,id', 'category_id' => 'required|exists:categories,id',
'name' => 'required|string|max:255', 'name' => 'required|string|max:255',
'slug' => 'required|string|unique:products,slug', 'slug' => 'required|string|unique:products,slug',
'description' => 'nullable|string',
'price' => 'required|numeric|min:0', 'price' => 'required|numeric|min:0',
'strike_price' => 'nullable|numeric|min:0',
'stock_quantity' => 'required|integer|min:0', 'stock_quantity' => 'required|integer|min:0',
'is_bestseller' => 'boolean'
]); ]);
$product = Product::create($request->all()); $product = Product::create($request->all());
...@@ -65,14 +37,6 @@ class AdminController extends Controller ...@@ -65,14 +37,6 @@ class AdminController extends Controller
public function updateProduct(Request $request, $id): JsonResponse public function updateProduct(Request $request, $id): JsonResponse
{ {
$product = Product::findOrFail($id); $product = Product::findOrFail($id);
$request->validate([
'name' => 'sometimes|string|max:255',
'slug' => 'sometimes|string|unique:products,slug,' . $product->id,
'price' => 'sometimes|numeric|min:0',
'stock_quantity' => 'sometimes|integer|min:0',
]);
$product->update($request->all()); $product->update($request->all());
return response()->json([ return response()->json([
...@@ -95,36 +59,4 @@ class AdminController extends Controller ...@@ -95,36 +59,4 @@ class AdminController extends Controller
'message' => 'Product removed successfully!' 'message' => 'Product removed successfully!'
]); ]);
} }
/**
* Get list of orders.
*/
public function orders(): JsonResponse
{
$orders = Order::with('items.product')->latest()->paginate(15);
return response()->json([
'success' => true,
'data' => $orders
]);
}
/**
* Update delivery status of an order.
*/
public function updateOrderStatus(Request $request, $id): JsonResponse
{
$request->validate([
'order_status' => 'required|string|in:pending,processing,shipped,delivered,cancelled',
'payment_status' => 'sometimes|string|in:pending,paid,failed'
]);
$order = Order::findOrFail($id);
$order->update($request->only(['order_status', 'payment_status']));
return response()->json([
'success' => true,
'message' => 'Order status updated successfully!',
'data' => $order
]);
}
} }
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
use App\Models\Announcement;
use Illuminate\Http\Request;
class MarketingController extends Controller
{
/**
* Get list of announcements.
*/
public function announcements(): JsonResponse
{
$announcements = Announcement::latest()->get();
return response()->json([
'success' => true,
'data' => $announcements
]);
}
/**
* Get active announcements for the homepage ticker.
*/
public function activeAnnouncements(): JsonResponse
{
$announcements = Announcement::where('status', 'Active')->latest()->get();
return response()->json([
'success' => true,
'data' => $announcements
]);
}
/**
* Store a new announcement.
*/
public function storeAnnouncement(Request $request): JsonResponse
{
$request->validate([
'content' => 'required|string|max:255',
'icon' => 'nullable|string|max:50',
'status' => 'nullable|string|in:Active,Inactive'
]);
$announcement = Announcement::create($request->all());
return response()->json([
'success' => true,
'message' => 'Announcement added successfully!',
'data' => $announcement
], 201);
}
/**
* Update an announcement.
*/
public function updateAnnouncement(Request $request, $id): JsonResponse
{
$announcement = Announcement::findOrFail($id);
$request->validate([
'content' => 'sometimes|required|string|max:255',
'icon' => 'nullable|string|max:50',
'status' => 'sometimes|required|string|in:Active,Inactive'
]);
$announcement->update($request->all());
return response()->json([
'success' => true,
'message' => 'Announcement updated successfully!',
'data' => $announcement
]);
}
/**
* Delete an announcement.
*/
public function destroyAnnouncement($id): JsonResponse
{
$announcement = Announcement::findOrFail($id);
$announcement->delete();
return response()->json([
'success' => true,
'message' => 'Announcement deleted successfully!'
]);
}
/**
* Get active marketing campaign details.
*/
public function campaigns(): JsonResponse
{
return response()->json([
'success' => true,
'message' => 'Active marketing systems operations endpoint.'
]);
}
}
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use App\Models\Order;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
class OrderController extends Controller
{
/**
* Get list of orders.
*/
public function index(): JsonResponse
{
$orders = Order::with('items.product')->latest()->paginate(15);
return response()->json([
'success' => true,
'data' => $orders
]);
}
/**
* Update delivery status of an order.
*/
public function updateOrderStatus(Request $request, $id): JsonResponse
{
$request->validate([
'order_status' => 'required|string|in:pending,processing,shipped,delivered,cancelled',
]);
$order = Order::findOrFail($id);
$order->update($request->only(['order_status']));
return response()->json([
'success' => true,
'message' => 'Order status updated successfully!',
'data' => $order
]);
}
}
<?php
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
class ShippingController extends Controller
{
/**
* Get serviceable regions.
*/
public function index(): JsonResponse
{
return response()->json([
'success' => true,
'message' => 'Serviceable regions shipping operations endpoint.'
]);
}
}
...@@ -14,7 +14,7 @@ class CatalogController extends Controller ...@@ -14,7 +14,7 @@ class CatalogController extends Controller
*/ */
public function categories(): JsonResponse public function categories(): JsonResponse
{ {
$categories = Category::all(); $categories = Category::withCount('products')->get();
return response()->json([ return response()->json([
'success' => true, 'success' => true,
'data' => $categories 'data' => $categories
...@@ -26,10 +26,10 @@ class CatalogController extends Controller ...@@ -26,10 +26,10 @@ class CatalogController extends Controller
*/ */
public function products(Request $request): JsonResponse public function products(Request $request): JsonResponse
{ {
$query = Product::with(['primaryImage', 'category']); $query = Product::with(['primaryImage', 'category', 'variants']);
// Filter by category slug // Filter by category slug
if ($request->has('category')) { if ($request->has('category') && $request->input('category') !== 'all') {
$query->whereHas('category', function ($q) use ($request) { $query->whereHas('category', function ($q) use ($request) {
$q->where('slug', $request->input('category')); $q->where('slug', $request->input('category'));
}); });
...@@ -40,6 +40,25 @@ class CatalogController extends Controller ...@@ -40,6 +40,25 @@ class CatalogController extends Controller
$query->where('is_bestseller', true); $query->where('is_bestseller', true);
} }
// Search filter
if ($request->has('search') && !empty($request->input('search'))) {
$searchTerm = $request->input('search');
$query->where(function ($q) use ($searchTerm) {
$q->where('name', 'like', '%' . $searchTerm . '%')
->orWhere('description', 'like', '%' . $searchTerm . '%');
});
}
// Sorting
$sort = $request->input('sort', 'latest');
if ($sort === 'price_low') {
$query->orderBy('price', 'asc');
} elseif ($sort === 'price_high') {
$query->orderBy('price', 'desc');
} else {
$query->orderBy('id', 'desc');
}
$products = $query->paginate(12); $products = $query->paginate(12);
return response()->json([ return response()->json([
......
...@@ -100,6 +100,7 @@ class CheckoutController extends Controller ...@@ -100,6 +100,7 @@ class CheckoutController extends Controller
$order = Order::create([ $order = Order::create([
'order_number' => $orderNumber, 'order_number' => $orderNumber,
'customer_id' => $request->session()->get('customer_id'),
'customer_name' => $request->input('customer_name'), 'customer_name' => $request->input('customer_name'),
'email' => $request->input('email'), 'email' => $request->input('email'),
'phone' => $request->input('phone'), 'phone' => $request->input('phone'),
......
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}
<?php
namespace App\Http\Controllers;
use App\Models\Customer;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
class CustomerAuthController extends Controller
{
/**
* Register a new customer.
*/
public function register(Request $request): JsonResponse
{
$request->validate([
'name' => 'required|string|max:255',
'email' => 'required|email|unique:customers,email|max:255',
'password' => 'required|string|min:6',
]);
$customer = Customer::create([
'name' => $request->input('name'),
'email' => $request->input('email'),
'password' => $request->input('password'), // Will be hashed automatically by the cast in the model
]);
// Put customer into session
$request->session()->put('customer_id', $customer->id);
$request->session()->put('customer_name', $customer->name);
$request->session()->put('customer_email', $customer->email);
return response()->json([
'success' => true,
'message' => 'Registration successful!',
'data' => [
'name' => $customer->name,
'email' => $customer->email,
]
], 201);
}
/**
* Log in a customer.
*/
public function login(Request $request): JsonResponse
{
$request->validate([
'email' => 'required|email',
'password' => 'required|string',
]);
$customer = Customer::where('email', $request->input('email'))->first();
if (!$customer || !Hash::check($request->input('password'), $customer->password)) {
return response()->json([
'success' => false,
'message' => 'Invalid email or password.'
], 401);
}
// Put customer into session
$request->session()->put('customer_id', $customer->id);
$request->session()->put('customer_name', $customer->name);
$request->session()->put('customer_email', $customer->email);
return response()->json([
'success' => true,
'message' => 'Login successful!',
'data' => [
'name' => $customer->name,
'email' => $customer->email,
]
]);
}
/**
* Log out a customer.
*/
public function logout(Request $request): JsonResponse
{
$request->session()->forget(['customer_id', 'customer_name', 'customer_email']);
return response()->json([
'success' => true,
'message' => 'Logged out successfully.'
]);
}
/**
* Get active login status of customer.
*/
public function status(Request $request): JsonResponse
{
if ($request->session()->has('customer_id')) {
return response()->json([
'success' => true,
'logged_in' => true,
'data' => [
'name' => $request->session()->get('customer_name'),
'email' => $request->session()->get('customer_email'),
]
]);
}
return response()->json([
'success' => true,
'logged_in' => false,
]);
}
/**
* Get orders for the logged-in customer.
*/
public function orders(Request $request): JsonResponse
{
if (!$request->session()->has('customer_id')) {
return response()->json([
'success' => false,
'message' => 'Unauthorized.',
], 401);
}
$customerId = $request->session()->get('customer_id');
$customer = Customer::with('orders.items')->find($customerId);
if (!$customer) {
return response()->json([
'success' => false,
'message' => 'Customer not found.',
], 404);
}
return response()->json([
'success' => true,
'data' => $customer->orders
]);
}
}
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Product;
use App\Models\Category;
class FrontendController extends Controller
{
public function ourCollection()
{
$categories = Category::all();
// Assuming we show products with their category
$products = Product::with('category')->where('stock_quantity', '>', 0)->get();
return view('catalog', compact('categories', 'products'));
}
public function productDetail($slug)
{
$product = Product::with(['category'])->where('slug', $slug)->firstOrFail();
// Fetch related products (same category)
$relatedProducts = Product::where('category_id', $product->category_id)
->where('id', '!=', $product->id)
->take(4)
->get();
return view('product-detail', compact('product', 'relatedProducts'));
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Announcement extends Model
{
protected $fillable = ['content', 'icon', 'status'];
}
...@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany; ...@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
class Category extends Model class Category extends Model
{ {
protected $guarded = [];
use HasFactory; use HasFactory;
protected $fillable = [ protected $fillable = [
......
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class City extends Model
{
protected $guarded = [];
//
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Country 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 Customer 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',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'password' => 'hashed',
];
/**
* Get the orders for the customer.
*/
public function orders()
{
return $this->hasMany(Order::class);
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Gallery extends Model
{
protected $guarded = [];
}
...@@ -12,6 +12,7 @@ class Order extends Model ...@@ -12,6 +12,7 @@ class Order extends Model
protected $fillable = [ protected $fillable = [
'order_number', 'order_number',
'customer_id',
'customer_name', 'customer_name',
'email', 'email',
'phone', 'phone',
...@@ -29,6 +30,14 @@ class Order extends Model ...@@ -29,6 +30,14 @@ class Order extends Model
]; ];
/** /**
* Get the customer that owns the order.
*/
public function customer()
{
return $this->belongsTo(Customer::class);
}
/**
* Get the items for the order. * Get the items for the order.
*/ */
public function items(): HasMany public function items(): HasMany
......
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Size extends Model
{
protected $guarded = [];
//
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class State extends Model
{
protected $guarded = [];
//
}
<?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 = [];
//
}
...@@ -6,7 +6,10 @@ use Illuminate\Foundation\Configuration\Middleware; ...@@ -6,7 +6,10 @@ use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__)) return Application::configure(basePath: dirname(__DIR__))
->withRouting( ->withRouting(
web: __DIR__.'/../routes/web.php', web: [
__DIR__.'/../routes/web.php',
__DIR__.'/../routes/backend.php',
],
api: __DIR__.'/../routes/api.php', api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php', commands: __DIR__.'/../routes/console.php',
health: '/up', health: '/up',
......
<?php return array (
'laravel/tinker' =>
array (
'providers' =>
array (
0 => 'Laravel\\Tinker\\TinkerServiceProvider',
),
),
'nesbot/carbon' =>
array (
'providers' =>
array (
0 => 'Carbon\\Laravel\\ServiceProvider',
),
),
'nunomaduro/termwind' =>
array (
'providers' =>
array (
0 => 'Termwind\\Laravel\\TermwindServiceProvider',
),
),
);
\ No newline at end of file
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration');
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('announcements', function (Blueprint $table) {
$table->id();
$table->string('content');
$table->string('icon')->default('fa-bullhorn');
$table->string('status')->default('Active'); // Active, Inactive
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('announcements');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('customers', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('customers');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('orders', function (Blueprint $table) {
$table->unsignedBigInteger('customer_id')->nullable()->after('id');
$table->foreign('customer_id')->references('id')->on('customers')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('orders', function (Blueprint $table) {
$table->dropForeign(['customer_id']);
$table->dropColumn('customer_id');
});
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('countries', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('code')->unique();
$table->string('status')->default('Active');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('countries');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('states', function (Blueprint $table) {
$table->id();
$table->string('country');
$table->string('name');
$table->string('status')->default('Active');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('states');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cities', function (Blueprint $table) {
$table->id();
$table->string('state');
$table->string('name');
$table->string('status')->default('Active');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cities');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('units', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('code')->unique();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('units');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('unit_sizes', function (Blueprint $table) {
$table->id();
$table->string('identifier');
$table->string('unit');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('unit_sizes');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('sizes', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('code')->unique();
$table->string('status')->default('Active');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('sizes');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('galleries', function (Blueprint $table) {
$table->id();
$table->string('filename');
$table->string('url');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('galleries');
}
};
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('galleries', function (Blueprint $table) {
$table->string('status')->default('Active');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('galleries', function (Blueprint $table) {
$table->dropColumn('status');
});
}
};
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class AnnouncementSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
\App\Models\Announcement::create([
'content' => 'Delivered within 3 days in Chennai',
'icon' => 'fa-truck',
'status' => 'Active'
]);
\App\Models\Announcement::create([
'content' => 'New arrivals every week check them out!',
'icon' => 'fa-star',
'status' => 'Active'
]);
\App\Models\Announcement::create([
'content' => 'Use code OCEAN10 for 10% off your first order',
'icon' => 'fa-tag',
'status' => 'Active'
]);
\App\Models\Announcement::create([
'content' => '4-7 days all-India shipping available',
'icon' => 'fa-box',
'status' => 'Active'
]);
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
@extends('layouts.admin')
@section('content')
<div class="panel-card">
<div class="table-responsive">
<table class="table mb-0">
<thead>
<tr>
<th>Icon</th>
<th>Content Announcement</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody id="announcements-tbody">
@foreach($announcements as $item)
<tr>
<td>{{ $item->icon }}</td>
<td>{{ $item->content }}</td>
<td>{{ $item->status }}</td>
<td>
<button class="btn-action" onclick="openEditModal('announcements', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button>
<button class="btn-action" onclick="deleteRecord('announcements', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</td>
</tr>
@endforeach
@if(count($announcements) === 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', 'Categories')
@section('page_description', 'Manage master data for Categories')
@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 Categories</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">Category Name</label>
<input type="text" class="form-control" name="name" id="crud_name" required>
</div>
<div class="mb-3">
<label class="form-label">Slug</label>
<input type="text" class="form-control" name="slug" id="crud_slug" 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($categories);
function openCreateModal() {
document.getElementById('crudModalLabel').innerText = 'Create Categories';
document.getElementById('crudMethod').value = 'POST';
document.getElementById('crudForm').action = '/admin/master/categories';
document.getElementById('crudSubmitBtn').innerText = 'Create';
document.getElementById('crud_name').value = '';
document.getElementById('crud_slug').value = '';
}
function openEditModal(type, id) {
// Find the record
const item = entityData.find(x => x.id === id);
if (!item) return;
document.getElementById('crudModalLabel').innerText = 'Edit Categories';
document.getElementById('crudMethod').value = 'PUT';
document.getElementById('crudForm').action = '/admin/master/categories/' + id;
document.getElementById('crudSubmitBtn').innerText = 'Update';
document.getElementById('crud_name').value = item.name || '';
document.getElementById('crud_slug').value = item.slug || '';
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>Name</th>
<th>Slug</th>
<th>Product Count</th>
<th>Action</th>
</tr>
</thead>
<tbody id="category-tbody">
@foreach($categories as $item)
<tr>
<td>{{ $item->name }}</td>
<td>{{ $item->slug }}</td>
<td>{{ $item->count }}</td>
<td>
<button class="btn-action" onclick="openEditModal('category', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button>
<button class="btn-action" onclick="deleteRecord('category', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</td>
</tr>
@endforeach
@if(count($categories) === 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', 'Cities')
@section('page_description', 'Manage master data for Cities')
@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 Cities</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">Parent State</label>
<input type="text" class="form-control" name="state" id="crud_state" required>
</div>
<div class="mb-3">
<label class="form-label">City Name</label>
<input type="text" class="form-control" name="name" id="crud_name" required>
</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($cities);
function openCreateModal() {
document.getElementById('crudModalLabel').innerText = 'Create Cities';
document.getElementById('crudMethod').value = 'POST';
document.getElementById('crudForm').action = '/admin/master/cities';
document.getElementById('crudSubmitBtn').innerText = 'Create';
document.getElementById('crud_state').value = '';
document.getElementById('crud_name').value = '';
document.getElementById('crud_status').value = '';
}
function openEditModal(type, id) {
// Find the record
const item = entityData.find(x => x.id === id);
if (!item) return;
document.getElementById('crudModalLabel').innerText = 'Edit Cities';
document.getElementById('crudMethod').value = 'PUT';
document.getElementById('crudForm').action = '/admin/master/cities/' + id;
document.getElementById('crudSubmitBtn').innerText = 'Update';
document.getElementById('crud_state').value = item.state || '';
document.getElementById('crud_name').value = item.name || '';
document.getElementById('crud_status').value = item.status || '';
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>City Name</th>
<th>Parent State</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody id="city-tbody">
@foreach($cities as $item)
<tr>
<td>{{ $item->name }}</td>
<td>{{ $item->state }}</td>
<td>{{ $item->status }}</td>
<td>
<button class="btn-action" onclick="openEditModal('city', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button>
<button class="btn-action" onclick="deleteRecord('city', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</td>
</tr>
@endforeach
@if(count($cities) === 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', 'Countries')
@section('page_description', 'Manage master data for Countries')
@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 Countries</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">Country Name</label>
<input type="text" class="form-control" name="name" id="crud_name" required>
</div>
<div class="mb-3">
<label class="form-label">Country Code</label>
<input type="text" class="form-control" name="code" id="crud_code" required>
</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($countries);
function openCreateModal() {
document.getElementById('crudModalLabel').innerText = 'Create Countries';
document.getElementById('crudMethod').value = 'POST';
document.getElementById('crudForm').action = '/admin/master/countries';
document.getElementById('crudSubmitBtn').innerText = 'Create';
document.getElementById('crud_name').value = '';
document.getElementById('crud_code').value = '';
document.getElementById('crud_status').value = '';
}
function openEditModal(type, id) {
// Find the record
const item = entityData.find(x => x.id === id);
if (!item) return;
document.getElementById('crudModalLabel').innerText = 'Edit Countries';
document.getElementById('crudMethod').value = 'PUT';
document.getElementById('crudForm').action = '/admin/master/countries/' + id;
document.getElementById('crudSubmitBtn').innerText = 'Update';
document.getElementById('crud_name').value = item.name || '';
document.getElementById('crud_code').value = item.code || '';
document.getElementById('crud_status').value = item.status || '';
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>Country Name</th>
<th>Code</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody id="country-tbody">
@foreach($countries as $c)
<tr>
<td class="fw-bold">{{ $c->name }}</td>
<td><code>{{ $c->code }}</code></td>
<td><span class="badge bg-success-subtle text-success">{{ $c->status ?? 'Active' }}</span></td>
<td>
<button class="btn-action" onclick="openEditModal('country', {{ $c->id }})"><i class="fa-solid fa-pen"></i></button>
<button class="btn-action" onclick="deleteRecord('countries', {{ $c->id }})"><i class="fa-solid fa-trash"></i></button>
</td>
</tr>
@endforeach
@if(count($countries) === 0)
<tr>
<td colspan="4" class="text-center text-muted py-4">No countries found in database.</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
@endsection
@extends('layouts.admin')
@section('content')
<div class="panel-card">
<div class="table-responsive">
<table class="table mb-0">
<thead>
<tr>
<th>Code</th>
<th>Type</th>
<th>Value</th>
<th>Min Purchase</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody id="coupons-tbody">
@foreach($coupons as $item)
<tr>
<td>{{ $item->code }}</td>
<td>{{ $item->type }}</td>
<td>{{ $item->value }}</td>
<td>{{ $item->min }}</td>
<td>{{ $item->status }}</td>
<td>
<button class="btn-action" onclick="openEditModal('coupons', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button>
<button class="btn-action" onclick="deleteRecord('coupons', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</td>
</tr>
@endforeach
@if(count($coupons) === 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', 'Gallery')
@section('page_description', 'Manage master data for Gallery Images')
@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>
@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 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">
@foreach($gallery as $item)
<div class="col">
<div class="card h-100 border rounded-3 overflow-hidden position-relative shadow-sm">
<img src="{{ $item->url }}" class="card-img-top object-fit-cover" height="150" alt="Gallery">
<!-- Status Badge overlay -->
@if($item->status == 'Inactive')
<span class="position-absolute top-0 start-0 m-2 badge bg-secondary">Inactive</span>
@else
<span class="position-absolute top-0 start-0 m-2 badge bg-success">Active</span>
@endif
<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>
<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>
<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>
@endforeach
@if(count($gallery) === 0)
<div class="col-12 text-center text-muted py-4">No records found.</div>
@endif
</div>
</div>
@endsection
@extends('layouts.admin')
@section('content')
<div class="panel-card">
<div class="table-responsive">
<table class="table mb-0">
<thead>
<tr>
<th>Order ID</th>
<th>Customer</th>
<th>Phone</th>
<th>Total</th>
<th>Pincode</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody id="orders-tbody">
@foreach($orders as $item)
<tr>
<td>{{ $item->orderId }}</td>
<td>{{ $item->customer }}</td>
<td>{{ $item->phone }}</td>
<td>{{ $item->total }}</td>
<td>{{ $item->pincode }}</td>
<td>{{ $item->status }}</td>
<td>
<button class="btn-action" onclick="openEditModal('orders', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button>
<button class="btn-action" onclick="deleteRecord('orders', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</td>
</tr>
@endforeach
@if(count($orders) === 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')
<div class="panel-card">
<div class="table-responsive">
<table class="table mb-0">
<thead>
<tr>
<th>Order ID</th>
<th>Customer Name</th>
<th>Current Status</th>
<th>Change State</th>
</tr>
</thead>
<tbody id="orderstatuschange-tbody">
@foreach($orders as $item)
<tr>
<td>{{ $item->orderId }}</td>
<td>{{ $item->customer }}</td>
<td>{{ $item->status }}</td>
<td>
<div class="d-flex gap-2">
<select id="selStatus-{{ $item->id }}" class="form-select form-select-sm" style="max-width:180px;">
<option value="Pending" {{ $item->status === 'Pending' ? 'selected' : '' }}>Pending</option>
<option value="Shipped" {{ $item->status === 'Shipped' ? 'selected' : '' }}>Shipped</option>
<option value="Delivered" {{ $item->status === 'Delivered' ? 'selected' : '' }}>Delivered</option>
</select>
<button class="btn btn-sm btn-primary rounded-pill px-3" onclick="updateOrderStatus({{ $item->id }})">Update</button>
</div>
</td>
</tr>
@endforeach
@if(count($orders) === 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')
<div class="row g-4 mb-5">
<div class="col-md-4">
<div class="stat-card">
<div class="stat-icon sales"><i class="fa-solid fa-indian-rupee-sign"></i></div>
<h6 class="text-muted fw-bold small text-uppercase">Total Sales</h6>
<h2 class="fw-bold mb-0">₹45,850</h2>
<span class="text-success small fw-semibold"><i class="fa-solid fa-arrow-up me-1"></i>+12% vs last week</span>
</div>
</div>
<div class="col-md-4">
<div class="stat-card">
<div class="stat-icon orders"><i class="fa-solid fa-truck"></i></div>
<h6 class="text-muted fw-bold small text-uppercase">Active Orders</h6>
<h2 class="fw-bold mb-0">18</h2>
<span class="text-success small fw-semibold"><i class="fa-solid fa-arrow-up me-1"></i>+4 today</span>
</div>
</div>
<div class="col-md-4">
<div class="stat-card">
<div class="stat-icon products"><i class="fa-solid fa-box"></i></div>
<h6 class="text-muted fw-bold small text-uppercase">Products Sold</h6>
<h2 class="fw-bold mb-0">124</h2>
<span class="text-muted small">Catalog: 3 Items</span>
</div>
</div>
</div>
<div class="panel-card">
<h5 class="fw-bold mb-4">Recent Sales Transactions</h5>
<div class="table-responsive">
<table class="table mb-0">
<thead>
<tr>
<th>Order ID</th>
<th>Customer Name</th>
<th>Payment Method</th>
<th>Amount</th>
<th>Status</th>
</tr>
</thead>
<tbody id="overview-orders-tbody">
<!-- Orders data is fetched dynamically later in MPA phase,
or statically injected. Currently left as placeholder -->
<tr>
<td colspan="5" class="text-center text-muted py-4">No recent transactions.</td>
</tr>
</tbody>
</table>
</div>
</div>
@endsection
@extends('layouts.admin')
@section('content')
<div class="panel-card">
<div class="table-responsive">
<table class="table mb-0">
<thead>
<tr>
<th>Pincode</th>
<th>Serviceable Region</th>
<th>Est. Days</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody id="pincodes-tbody">
@foreach($pincodes as $item)
<tr>
<td>{{ $item->pincode }}</td>
<td>{{ $item->region }}</td>
<td>{{ $item->days }}</td>
<td>{{ $item->status }}</td>
<td>
<button class="btn-action" onclick="openEditModal('pincodes', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button>
<button class="btn-action" onclick="deleteRecord('pincodes', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</td>
</tr>
@endforeach
@if(count($pincodes) === 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')
<div class="panel-card">
<div class="table-responsive">
<table class="table mb-0">
<thead>
<tr>
<th>Product Name</th>
<th>Size Variant</th>
<th>Base Price</th>
<th>Discount</th>
<th>Final Price</th>
<th>Action</th>
</tr>
</thead>
<tbody id="productprices-tbody">
@foreach($productprices as $item)
<tr>
<td>{{ $item->name }}</td>
<td>{{ $item->variant }}</td>
<td>{{ $item->base }}</td>
<td>{{ $item->discount }}</td>
<td>{{ $item->final }}</td>
<td>
<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>
</td>
</tr>
@endforeach
@if(count($productprices) === 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')
<div class="panel-card">
<div class="table-responsive">
<table class="table mb-0">
<thead>
<tr>
<th>Product Name</th>
<th>Category</th>
<th>Price</th>
<th>Stock</th>
<th>Action</th>
</tr>
</thead>
<tbody id="products-tbody">
@foreach($products as $item)
<tr>
<td>{{ $item->name }}</td>
<td>{{ $item->category }}</td>
<td>{{ $item->price }}</td>
<td>{{ $item->stock }}</td>
<td>
<button class="btn-action" onclick="openEditModal('products', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button>
<button class="btn-action" onclick="deleteRecord('products', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</td>
</tr>
@endforeach
@if(count($products) === 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', 'Sizes')
@section('page_description', 'Manage master data for 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 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 Name</label>
<input type="text" class="form-control" name="name" id="crud_name" required>
</div>
<div class="mb-3">
<label class="form-label">Size Code</label>
<input type="text" class="form-control" name="code" id="crud_code" required>
</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($sizes);
function openCreateModal() {
document.getElementById('crudModalLabel').innerText = 'Create Sizes';
document.getElementById('crudMethod').value = 'POST';
document.getElementById('crudForm').action = '/admin/master/sizes';
document.getElementById('crudSubmitBtn').innerText = 'Create';
document.getElementById('crud_name').value = '';
document.getElementById('crud_code').value = '';
document.getElementById('crud_status').value = '';
}
function openEditModal(type, id) {
// Find the record
const item = entityData.find(x => x.id === id);
if (!item) return;
document.getElementById('crudModalLabel').innerText = 'Edit Sizes';
document.getElementById('crudMethod').value = 'PUT';
document.getElementById('crudForm').action = '/admin/master/sizes/' + id;
document.getElementById('crudSubmitBtn').innerText = 'Update';
document.getElementById('crud_name').value = item.name || '';
document.getElementById('crud_code').value = item.code || '';
document.getElementById('crud_status').value = item.status || '';
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 Name</th>
<th>Size Code</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody id="sizes-tbody">
@foreach($sizes as $item)
<tr>
<td>{{ $item->name }}</td>
<td>{{ $item->code }}</td>
<td>{{ $item->status }}</td>
<td>
<button class="btn-action" onclick="openEditModal('sizes', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button>
<button class="btn-action" onclick="deleteRecord('sizes', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</td>
</tr>
@endforeach
@if(count($sizes) === 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', 'States')
@section('page_description', 'Manage master data for States')
@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 States</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">Parent Country</label>
<input type="text" class="form-control" name="country" id="crud_country" required>
</div>
<div class="mb-3">
<label class="form-label">State Name</label>
<input type="text" class="form-control" name="name" id="crud_name" required>
</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($states);
function openCreateModal() {
document.getElementById('crudModalLabel').innerText = 'Create States';
document.getElementById('crudMethod').value = 'POST';
document.getElementById('crudForm').action = '/admin/master/states';
document.getElementById('crudSubmitBtn').innerText = 'Create';
document.getElementById('crud_country').value = '';
document.getElementById('crud_name').value = '';
document.getElementById('crud_status').value = '';
}
function openEditModal(type, id) {
// Find the record
const item = entityData.find(x => x.id === id);
if (!item) return;
document.getElementById('crudModalLabel').innerText = 'Edit States';
document.getElementById('crudMethod').value = 'PUT';
document.getElementById('crudForm').action = '/admin/master/states/' + id;
document.getElementById('crudSubmitBtn').innerText = 'Update';
document.getElementById('crud_country').value = item.country || '';
document.getElementById('crud_name').value = item.name || '';
document.getElementById('crud_status').value = item.status || '';
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>State Name</th>
<th>Parent Country</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody id="state-tbody">
@foreach($states as $item)
<tr>
<td>{{ $item->name }}</td>
<td>{{ $item->country }}</td>
<td>{{ $item->status }}</td>
<td>
<button class="btn-action" onclick="openEditModal('state', {{ $item->id }})"><i class="fa-solid fa-pen"></i></button>
<button class="btn-action" onclick="deleteRecord('state', {{ $item->id }})"><i class="fa-solid fa-trash"></i></button>
</td>
</tr>
@endforeach
@if(count($states) === 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', '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')
@section('content')
<div class="panel-card">
<div class="table-responsive">
<table class="table mb-0">
<thead>
<tr>
<th>Product Title</th>
<th>Saves count</th>
<th>Stock Status</th>
<th>Catalog Price</th>
</tr>
</thead>
<tbody id="wishlist-tbody">
@foreach($wishlists as $item)
<tr>
<td>{{ $item->name }}</td>
<td>{{ $item->saves }}</td>
<td>{{ $item->status }}</td>
<td>{{ $item->price }}</td>
</tr>
@endforeach
@if(count($wishlists) === 0)
<tr>
<td colspan="10" class="text-center text-muted py-4">No records found.</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
@endsection
...@@ -98,27 +98,31 @@ ...@@ -98,27 +98,31 @@
<div class="row g-3"> <div class="row g-3">
<div class="col-12"> <div class="col-12">
<label class="form-label checkout-form-label">Full Name *</label> <label class="form-label checkout-form-label">Full Name *</label>
<input type="text" class="form-control checkout-form-control w-100" placeholder="Your full name" required> <input type="text" name="customer_name" class="form-control checkout-form-control w-100" placeholder="Your full name" required>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<label class="form-label checkout-form-label">Email *</label> <label class="form-label checkout-form-label">Email *</label>
<input type="email" class="form-control checkout-form-control w-100" placeholder="your@email.com" required> <input type="email" name="email" class="form-control checkout-form-control w-100" placeholder="your@email.com" required>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<label class="form-label checkout-form-label">Phone *</label> <label class="form-label checkout-form-label">Phone *</label>
<input type="tel" class="form-control checkout-form-control w-100" placeholder="+91 XXXXX XXXXX" required> <input type="tel" name="phone" class="form-control checkout-form-control w-100" placeholder="+91 XXXXX XXXXX" required>
</div> </div>
<div class="col-12"> <div class="col-12">
<label class="form-label checkout-form-label">Address *</label> <label class="form-label checkout-form-label">Address *</label>
<input type="text" 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-6"> <div class="col-md-4">
<label class="form-label checkout-form-label">City *</label> <label class="form-label checkout-form-label">City *</label>
<input type="text" class="form-control checkout-form-control w-100" placeholder="City" required> <input type="text" name="city" class="form-control checkout-form-control w-100" placeholder="City" value="Chennai" required>
</div> </div>
<div class="col-md-6"> <div class="col-md-4">
<label class="form-label checkout-form-label">State *</label>
<input type="text" name="state" class="form-control checkout-form-control w-100" placeholder="State" value="Tamil Nadu" required>
</div>
<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" 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" value="600001" required>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -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>Decorative Shell Wall Frame - VSI Mart</title> <title>{{ ->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>
...@@ -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">Decorative Shell Wall Frame</li> <li class="breadcrumb-item active" aria-current="page">{{ ->name }}</li>
</ol> </ol>
</nav> </nav>
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
<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> <span class="badge-bestseller">Best Seller</span>
<img id="main-product-img" src="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=1600&auto=format&fit=crop&q=90" alt="Decorative Shell Wall Frame" class="w-100 img-fluid" style="height: 630px; object-fit: cover;"> <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;">
</div> </div>
<!-- Thumbnail carousel (5 images) --> <!-- Thumbnail carousel (5 images) -->
<div class="row g-2"> <div class="row g-2">
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
<!-- 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;">Decorative Shell Wall Frame</h1> <h1 class="fw-bold text-dark mb-2" style="font-size: 1.8rem;">{{ ->name }}</h1>
<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">₹450</span>
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
</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="Decorative Shell Wall Frame" 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="p1" data-name="{{ ->name }}" data-price="450" data-img="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=800&auto=format&fit=crop&q=80">
Add to cart Add to cart
</button> </button>
</div> </div>
...@@ -253,9 +253,9 @@ ...@@ -253,9 +253,9 @@
<div class="product-card"> <div class="product-card">
<span class="badge-bestseller">Best Seller</span> <span class="badge-bestseller">Best Seller</span>
<button class="btn-wishlist"><i class="bi bi-heart"></i></button> <button class="btn-wishlist"><i class="bi bi-heart"></i></button>
<img src="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=500&auto=format&fit=crop&q=80" alt="Decorative Shell Wall Frame"> <img src="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=500&auto=format&fit=crop&q=80" alt="{{ ->name }}">
<div class="product-card-body"> <div class="product-card-body">
<h5 class="product-title">Decorative Shell Wall Frame</h5> <h5 class="product-title">{{ ->name }}</h5>
<div class="product-rating"> <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>
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
<span class="product-price-strike">₹935</span> <span class="product-price-strike">₹935</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> <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="p1" data-name="Decorative Shell Wall Frame" data-price="850" data-img="https://images.unsplash.com/photo-1618221195710-dd6b41faaea6?w=500&auto=format&fit=crop&q=80">Add to cart</button> <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> </div>
</div> </div>
</div> </div>
......
<?php <?php
use App\Http\Controllers\AdminController;
use App\Http\Controllers\CatalogController; use App\Http\Controllers\CatalogController;
use App\Http\Controllers\CheckoutController; use App\Http\Controllers\CheckoutController;
use App\Http\Controllers\CouponController; use App\Http\Controllers\CouponController;
...@@ -24,6 +23,13 @@ Route::get('/categories', [CatalogController::class, 'categories']); ...@@ -24,6 +23,13 @@ Route::get('/categories', [CatalogController::class, 'categories']);
Route::get('/products', [CatalogController::class, 'products']); Route::get('/products', [CatalogController::class, 'products']);
Route::get('/products/{slug}', [CatalogController::class, 'productDetails']); Route::get('/products/{slug}', [CatalogController::class, 'productDetails']);
// Customer Auth Endpoints
Route::post('/customer/register', [\App\Http\Controllers\CustomerAuthController::class, 'register']);
Route::post('/customer/login', [\App\Http\Controllers\CustomerAuthController::class, 'login']);
Route::post('/customer/logout', [\App\Http\Controllers\CustomerAuthController::class, 'logout']);
Route::get('/customer/status', [\App\Http\Controllers\CustomerAuthController::class, 'status']);
Route::get('/customer/orders', [\App\Http\Controllers\CustomerAuthController::class, 'orders']);
// Serviceability Pincode Endpoints // Serviceability Pincode Endpoints
Route::post('/check-pincode', [PincodeController::class, 'checkServiceability']); Route::post('/check-pincode', [PincodeController::class, 'checkServiceability']);
...@@ -37,15 +43,3 @@ Route::post('/validate-coupon', [CouponController::class, 'validateCoupon']); ...@@ -37,15 +43,3 @@ Route::post('/validate-coupon', [CouponController::class, 'validateCoupon']);
Route::get('/wishlist', [WishlistController::class, 'index']); Route::get('/wishlist', [WishlistController::class, 'index']);
Route::post('/wishlist', [WishlistController::class, 'store']); Route::post('/wishlist', [WishlistController::class, 'store']);
Route::delete('/wishlist/{productId}', [WishlistController::class, 'destroy']); Route::delete('/wishlist/{productId}', [WishlistController::class, 'destroy']);
// Admin Dashboard Endpoints
Route::prefix('admin')->group(function () {
Route::get('/metrics', [AdminController::class, 'metrics']);
Route::post('/products', [AdminController::class, 'storeProduct']);
Route::put('/products/{id}', [AdminController::class, 'updateProduct']);
Route::delete('/products/{id}', [AdminController::class, 'destroyProduct']);
Route::get('/orders', [AdminController::class, 'orders']);
Route::put('/orders/{id}/status', [AdminController::class, 'updateOrderStatus']);
});
<?php
use App\Http\Controllers\Backend\AdminViewController;
use App\Http\Controllers\Backend\AdminMasterDataController;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Backend Routes
|--------------------------------------------------------------------------
*/
Route::prefix('admin')->group(function () {
Route::get('/', [AdminViewController::class, 'dashboard']);
Route::get('/dashboard', [AdminViewController::class, 'dashboard']);
Route::get('/countries', [AdminViewController::class, 'countries']);
Route::get('/states', [AdminViewController::class, 'states']);
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::post('/master/{type}', [AdminMasterDataController::class, 'store']);
Route::put('/master/{type}/{id}', [AdminMasterDataController::class, 'update']);
Route::delete('/master/{type}/{id}', [AdminMasterDataController::class, 'destroy']);
Route::get('/products', [AdminViewController::class, 'products']);
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('/pincodes', [AdminViewController::class, 'pincodes']);
Route::get('/coupons', [AdminViewController::class, 'coupons']);
Route::get('/wishlist', [AdminViewController::class, 'wishlist']);
});
<?php <?php
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
use App\Http\Controllers\FrontendController;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
...@@ -21,9 +22,7 @@ Route::get('/shop', function () { ...@@ -21,9 +22,7 @@ Route::get('/shop', function () {
return view('shop'); return view('shop');
}); });
Route::get('/product-detail', function () { Route::get('/product-detail/{slug}', [FrontendController::class, 'productDetail']);
return view('product-detail');
});
Route::get('/cart', function () { Route::get('/cart', function () {
return view('cart'); return view('cart');
...@@ -37,10 +36,10 @@ Route::get('/gallery', function () { ...@@ -37,10 +36,10 @@ Route::get('/gallery', function () {
return view('gallery'); return view('gallery');
}); });
Route::get('/catalog', function () { Route::get('/catalog', [FrontendController::class, 'ourCollection']);
return view('catalog');
});
Route::get('/admin', function () { Route::get('/dashboard', function () {
return view('admin'); return view('dashboard');
}); });
const fs = require('fs');
let c = fs.readFileSync('resources/views/catalog.blade.php', 'utf8');
const startStr = '<!-- Product Card 1 -->';
const endStr = '<!-- Pagination -->';
let startIndex = c.indexOf(startStr);
let endIndex = c.indexOf(endStr);
if (startIndex !== -1 && endIndex !== -1) {
let replacement = `@foreach($products as $product)
<div class="col-lg-4 col-md-6 mb-4">
<div class="product-card">
@if($product->is_bestseller)
<span class="badge-bestseller">Best Seller</span>
@endif
<button class="btn-wishlist"><i class="bi bi-heart"></i></button>
<a href="/product-detail/{{ $product->slug }}">
<img src="https://images.unsplash.com/photo-1544474655-9aed1e956bc2?w=500&auto=format&fit=crop&q=80" alt="{{ $product->name }}">
</a>
<div class="product-card-body">
<h5 class="product-title"><a href="/product-detail/{{ $product->slug }}" class="text-decoration-none text-dark">{{ $product->name }}</a></h5>
<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">₹{{ number_format($product->price, 2) }}</span>
@if($product->strike_price)
<span class="product-price-strike ms-2">₹{{ number_format($product->strike_price, 2) }}</span>
@endif
</div>
<button class="btn btn-add-to-cart w-100 mt-3">Add to cart</button>
</div>
</div>
</div>
</div>
@endforeach\n`;
c = c.substring(0, startIndex) + replacement + c.substring(endIndex);
fs.writeFileSync('resources/views/catalog.blade.php', c);
console.log('Success');
} else {
console.log('Could not find bounds');
}
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