diff --git a/app/services/tracking/[job_id]/page.tsx b/app/services/tracking/[job_id]/page.tsx
index 3b8fd88..01ffaa2 100644
--- a/app/services/tracking/[job_id]/page.tsx
+++ b/app/services/tracking/[job_id]/page.tsx
@@ -25,6 +25,8 @@ import {
Image as ImageIcon,
Maximize2,
KeyRound,
+ Download,
+ ExternalLink,
} from 'lucide-react';
import { BlurHashImage } from '@/components/ui/BlurHashImage';
import { AnnouncementBar } from '@/layout/AnnouncementBar';
@@ -61,6 +63,7 @@ export default function ServiceJobTrackingPage({
const { isAuthenticated, accessToken, authReady, bootstrapAuth } = useAuthStore();
const [job, setJob] = useState
(null);
+ const [calendarInvite, setCalendarInvite] = useState(null);
const [loading, setLoading] = useState(true);
const [errorMsg, setErrorMsg] = useState(null);
const [actionLoading, setActionLoading] = useState(false);
@@ -99,6 +102,13 @@ export default function ServiceJobTrackingPage({
job_id: item?.job_id || job_id,
job_no: item?.job_no,
});
+
+ if (item?.fulfillment_type === 'WALK_IN' || item?.appointment) {
+ serviceBookingService
+ .fetchCalendarInvite(item?.job_id || job_id)
+ .then((cal) => setCalendarInvite(cal))
+ .catch(() => setCalendarInvite(null));
+ }
} catch (err: any) {
setErrorMsg(err.message || 'Failed to retrieve tracking details.');
} finally {
@@ -533,10 +543,15 @@ export default function ServiceJobTrackingPage({
})()}
{job.appointment && (
-
-
- Booking Schedule
-
+
+
+
+ Booking Schedule
+
+
+ Walk-In
+
+
@@ -550,16 +565,46 @@ export default function ServiceJobTrackingPage({
})}
- Start:{' '}
+ Slot:{' '}
{new Date(
job.appointment.scheduled_start
).toLocaleTimeString('en-US', {
hour: '2-digit',
minute: '2-digit',
+ })}{' '}
+ –{' '}
+ {new Date(
+ job.appointment.scheduled_end
+ ).toLocaleTimeString('en-US', {
+ hour: '2-digit',
+ minute: '2-digit',
})}
+
+ {calendarInvite && (
+
+ )}
)}
diff --git a/components/pdp/QuickComparisonTable.tsx b/components/pdp/QuickComparisonTable.tsx
index 79154c9..b41e218 100644
--- a/components/pdp/QuickComparisonTable.tsx
+++ b/components/pdp/QuickComparisonTable.tsx
@@ -1,186 +1,213 @@
-'use client';
-
-import Link from 'next/link';
-import Image from 'next/image';
-import { useState } from 'react';
-import { Check, ShoppingCart } from 'lucide-react';
-import BlurHashImage from '@/components/ui/BlurHashImage';
-import { ProductResponse } from '@/services/api/catalogService';
-import { useCartStore } from '@/store/cartStore';
-import { formatCatalogPriceLabel, formatCurrency, getImageUrl } from '@/lib/utils';
-
-interface QuickComparisonTableProps {
- products: ProductResponse[];
-}
-
-function priceLabel(product: ProductResponse): string {
- const label = formatCatalogPriceLabel(product);
- return label === formatCurrency(0) ? '—' : label;
-}
-
-function productImage(product: ProductResponse): string {
- return getImageUrl(product.images?.[0]?.image_url || product.variants?.[0]?.images?.[0]?.image_url);
-}
-
-function extraAttributes(product: ProductResponse): { label: string; values: string[] }[] {
- const buckets: Record }> = {};
-
- (product.variants || []).forEach((variant) => {
- (variant.attributes || []).forEach((attr) => {
- const raw = attr.attribute_name || attr.attribute_code || '';
- const value = String(attr.attribute_value || '').trim();
- if (!raw || !value) return;
- const key = raw.trim().toLowerCase().replace(/[\s-]+/g, '_');
- if (!buckets[key]) {
- let label = raw.replace(/[_-]+/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
- if (['qul', 'qual'].includes(key)) label = 'Quality';
- else if (['clr'].includes(key)) label = 'Color';
- else if (['str'].includes(key)) label = 'Storage';
- buckets[key] = {
- label,
- values: new Set(),
- };
- }
- buckets[key].values.add(value);
- });
- });
-
- return Object.values(buckets)
- .map((item) => ({
- label: item.label,
- values: Array.from(item.values),
- }))
- .slice(0, 3);
-}
-
-function ctaKind(product: ProductResponse): 'view' | 'cart' {
- return (product.variants?.length || 0) > 1 ? 'view' : 'cart';
-}
-
-export function QuickComparisonTable({ products }: QuickComparisonTableProps) {
- const addToCart = useCartStore((state) => state.addToCart);
- const [addedId, setAddedId] = useState(null);
-
- if (!products.length) return null;
-
- const handleAdd = async (product: ProductResponse) => {
- const variant = product.variants?.[0];
- if (!variant) return;
- await addToCart(product, variant, 1);
- setAddedId(product.product_id);
- setTimeout(() => setAddedId(null), 1800);
- };
-
- const labelCls =
- 'sticky left-0 z-10 w-[150px] min-w-[150px] px-4 py-4 text-[13px] font-medium text-gray-500 text-left align-middle bg-[#f3f4f6]';
- const cellCls = 'px-5 py-4 min-w-[170px] align-middle text-center';
-
- return (
-
- Quick Comparison
-
-
-
-
- |
- {products.map((prod) => {
- const img = productImage(prod);
- return (
-
-
- {prod.name}
-
-
-
-
- |
- );
- })}
-
-
-
-
- | Price |
- {products.map((prod) => (
-
- {priceLabel(prod)}
- |
- ))}
-
-
-
- | Add to cart |
- {products.map((prod) => {
- const kind = ctaKind(prod);
- const justAdded = addedId === prod.product_id;
- return (
-
- {kind === 'view' ? (
-
- View Products
-
- ) : (
-
- )}
- |
- );
- })}
-
-
-
- | Additional information |
- {products.map((prod) => {
- const attrs = extraAttributes(prod);
- return (
-
- {attrs.length === 0 ? (
- —
- ) : (
-
- {attrs.map((attr) => (
-
- {attr.label}:
- {attr.values.map((value, i) => (
-
-
- {value}
-
- {i < attr.values.length - 1 ? , : null}
-
- ))}
-
- ))}
-
- )}
- |
- );
- })}
-
-
-
-
-
- );
-}
+'use client';
+
+import { useState } from 'react';
+import { Check, ShoppingCart, ShieldCheck, FileText } from 'lucide-react';
+import BlurHashImage from '@/components/ui/BlurHashImage';
+import { ProductResponse, ProductVariantResponse } from '@/services/api/catalogService';
+import { useCartStore } from '@/store/cartStore';
+import { formatCurrency, getImageUrl } from '@/lib/utils';
+
+interface QuickComparisonTableProps {
+ product: ProductResponse;
+}
+
+function getVariantTitle(variant: ProductVariantResponse, fallbackIndex: number): string {
+ const validAttrs = (variant.attributes || []).filter((a) => {
+ const key = (a.attribute_name || a.attribute_code || '').toLowerCase().trim();
+ return a.attribute_value && !['media_key', 'parent_media_key'].includes(key);
+ });
+
+ if (validAttrs.length > 0) {
+ return validAttrs
+ .map((a) => {
+ const name = a.attribute_name ? `${a.attribute_name}: ` : '';
+ return `${name}${a.attribute_value}`;
+ })
+ .join(' | ');
+ }
+
+ return variant.sku || `Variant ${fallbackIndex + 1}`;
+}
+
+function getVariantImage(product: ProductResponse, variant: ProductVariantResponse): string {
+ const img = variant.images?.[0]?.image_url || product.images?.[0]?.image_url;
+ return getImageUrl(img);
+}
+
+export function QuickComparisonTable({ product }: QuickComparisonTableProps) {
+ const addToCart = useCartStore((state) => state.addToCart);
+ const [addedVariantId, setAddedVariantId] = useState(null);
+
+ const variants = product?.variants || [];
+ // Strictly only show when the product has multiple variants (> 1)
+ if (variants.length <= 1) {
+ return null;
+ }
+
+ const handleAdd = async (variant: ProductVariantResponse) => {
+ await addToCart(product, variant, 1);
+ setAddedVariantId(variant.variant_id);
+ setTimeout(() => setAddedVariantId(null), 1800);
+ };
+
+ const labelCls =
+ 'sticky left-0 z-10 w-[160px] min-w-[160px] px-5 py-4 text-[13px] font-semibold text-gray-700 text-left align-middle bg-[#f3f4f6] border-b border-gray-200';
+ const cellCls = 'px-5 py-4 min-w-[200px] align-middle text-center border-b border-gray-200';
+
+ return (
+
+
+
Variant Comparison
+
+ {variants.length} Options
+
+
+
+
+
+ {/* Variant Header Row */}
+
+
+ | Option |
+ {variants.map((v, idx) => {
+ const img = getVariantImage(product, v);
+ const title = getVariantTitle(v, idx);
+ return (
+
+
+
+
+
+ {title}
+
+ |
+ );
+ })}
+
+
+
+
+ {/* 1. Name / Specifications Row */}
+
+ | Name / Specification |
+ {variants.map((v, idx) => (
+
+ {getVariantTitle(v, idx)}
+ |
+ ))}
+
+
+ {/* 2. Price Row */}
+
+ | Price |
+ {variants.map((v) => {
+ const price = Number(v.price) || 0;
+ const comparePrice = v.compare_price ? Number(v.compare_price) : 0;
+ const hasDiscount = comparePrice > price;
+ const discountPercent = hasDiscount
+ ? Math.round(((comparePrice - price) / comparePrice) * 100)
+ : 0;
+
+ return (
+
+
+
+ {formatCurrency(price)}
+
+ {hasDiscount && (
+ <>
+
+ {formatCurrency(comparePrice)}
+
+
+ {discountPercent}% OFF
+
+ >
+ )}
+
+ |
+ );
+ })}
+
+
+ {/* 3. Warranty Type Row */}
+
+ |
+
+
+ Warranty Type
+
+ |
+ {variants.map((v) => (
+
+ {product.warranty_type || 'Standard Warranty'}
+ |
+ ))}
+
+
+ {/* 4. Summary Row */}
+
+ |
+
+
+ Summary
+
+ |
+ {variants.map((v) => (
+
+ {product.warranty_summary || '100% Quality Tested & Brand Verified'}
+ |
+ ))}
+
+
+ {/* Action Row */}
+
+ | Action |
+ {variants.map((v) => {
+ const justAdded = addedVariantId === v.variant_id;
+ const isOutOfStock = v.status === 'inactive' || (v.available_stock !== undefined && v.available_stock <= 0);
+
+ return (
+
+
+ |
+ );
+ })}
+
+
+
+
+
+ );
+}
diff --git a/services/api/catalogService.ts b/services/api/catalogService.ts
index ea5f57a..e6ba0be 100644
--- a/services/api/catalogService.ts
+++ b/services/api/catalogService.ts
@@ -117,6 +117,8 @@ export interface ProductResponse {
created_at: string;
images: ProductImageResponse[];
variants: ProductVariantResponse[];
+ warranty_type?: string | null;
+ warranty_summary?: string | null;
rating?: number;
review_count?: number;
badge?: 'HOT' | 'NEW' | 'SALE' | null;
diff --git a/services/api/serviceBooking.ts b/services/api/serviceBooking.ts
index bcff09d..bb10261 100644
--- a/services/api/serviceBooking.ts
+++ b/services/api/serviceBooking.ts
@@ -496,6 +496,21 @@ export const serviceBookingService = {
});
},
+ fetchCalendarInvite(jobId: string): Promise<{
+ job_id: string;
+ job_no: string;
+ appointment_id: string;
+ scheduled_start: string;
+ scheduled_end: string;
+ device_name: string;
+ google_calendar_url: string;
+ store_name: string;
+ store_address: string;
+ ics_download_url: string;
+ }> {
+ return apiFetch(`/api/v1/service/jobs/${jobId}/calendar-invite`);
+ },
+
fetchServicePageLayout(): Promise {
return apiFetch('/api/v1/storefront/layout/services');
},