corebalance commited on
Commit
4e7a8f5
·
verified ·
1 Parent(s): a7e93b4

Upload 103 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. QatarPOS/.gitignore +6 -0
  2. QatarPOS/.replit +36 -0
  3. QatarPOS/attached_assets/Pasted-You-are-a-senior-full-stack-developer-Generate-a-multi-tenant-cloud-native-Point-of-Sale-POS-mic-1752578171314_1752578171315.txt +36 -0
  4. QatarPOS/client/index.html +13 -0
  5. QatarPOS/client/public/images/butter-chicken.svg +33 -0
  6. QatarPOS/client/public/images/chicken-biryani.svg +46 -0
  7. QatarPOS/client/public/images/dal-makhani.svg +43 -0
  8. QatarPOS/client/public/images/garlic-naan.svg +44 -0
  9. QatarPOS/client/public/images/gulab-jamun.svg +44 -0
  10. QatarPOS/client/public/images/lamb-rogan-josh.svg +37 -0
  11. QatarPOS/client/public/images/mango-lassi.svg +43 -0
  12. QatarPOS/client/public/images/masala-tea.svg +49 -0
  13. QatarPOS/client/public/images/pakora.svg +47 -0
  14. QatarPOS/client/public/images/paneer-tikka.svg +54 -0
  15. QatarPOS/client/public/images/plain-naan.svg +37 -0
  16. QatarPOS/client/public/images/samosa.svg +42 -0
  17. QatarPOS/client/src/App.tsx +54 -0
  18. QatarPOS/client/src/components/BarcodeScanner.tsx +196 -0
  19. QatarPOS/client/src/components/OrderSummary.tsx +374 -0
  20. QatarPOS/client/src/components/POSHeader.tsx +131 -0
  21. QatarPOS/client/src/components/ProductCatalog.tsx +296 -0
  22. QatarPOS/client/src/components/ReceiptModal.tsx +241 -0
  23. QatarPOS/client/src/components/Sidebar.tsx +142 -0
  24. QatarPOS/client/src/components/ui/accordion.tsx +56 -0
  25. QatarPOS/client/src/components/ui/alert-dialog.tsx +139 -0
  26. QatarPOS/client/src/components/ui/alert.tsx +59 -0
  27. QatarPOS/client/src/components/ui/aspect-ratio.tsx +5 -0
  28. QatarPOS/client/src/components/ui/avatar.tsx +50 -0
  29. QatarPOS/client/src/components/ui/badge.tsx +36 -0
  30. QatarPOS/client/src/components/ui/breadcrumb.tsx +115 -0
  31. QatarPOS/client/src/components/ui/button.tsx +56 -0
  32. QatarPOS/client/src/components/ui/calendar.tsx +68 -0
  33. QatarPOS/client/src/components/ui/card.tsx +79 -0
  34. QatarPOS/client/src/components/ui/carousel.tsx +260 -0
  35. QatarPOS/client/src/components/ui/chart.tsx +365 -0
  36. QatarPOS/client/src/components/ui/checkbox.tsx +28 -0
  37. QatarPOS/client/src/components/ui/collapsible.tsx +11 -0
  38. QatarPOS/client/src/components/ui/command.tsx +151 -0
  39. QatarPOS/client/src/components/ui/context-menu.tsx +198 -0
  40. QatarPOS/client/src/components/ui/dialog.tsx +122 -0
  41. QatarPOS/client/src/components/ui/drawer.tsx +118 -0
  42. QatarPOS/client/src/components/ui/dropdown-menu.tsx +198 -0
  43. QatarPOS/client/src/components/ui/form.tsx +176 -0
  44. QatarPOS/client/src/components/ui/hover-card.tsx +29 -0
  45. QatarPOS/client/src/components/ui/input-otp.tsx +69 -0
  46. QatarPOS/client/src/components/ui/input.tsx +22 -0
  47. QatarPOS/client/src/components/ui/label.tsx +24 -0
  48. QatarPOS/client/src/components/ui/menubar.tsx +256 -0
  49. QatarPOS/client/src/components/ui/navigation-menu.tsx +128 -0
  50. QatarPOS/client/src/components/ui/pagination.tsx +117 -0
QatarPOS/.gitignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ node_modules
2
+ dist
3
+ .DS_Store
4
+ server/public
5
+ vite.config.ts.*
6
+ *.tar.gz
QatarPOS/.replit ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ modules = ["nodejs-20", "web", "postgresql-16"]
2
+ run = "npm run dev"
3
+ hidden = [".config", ".git", "generated-icon.png", "node_modules", "dist"]
4
+
5
+ [nix]
6
+ channel = "stable-24_05"
7
+
8
+ [deployment]
9
+ deploymentTarget = "autoscale"
10
+ build = ["npm", "run", "build"]
11
+ run = ["npm", "run", "start"]
12
+
13
+ [[ports]]
14
+ localPort = 5000
15
+ externalPort = 80
16
+
17
+ [workflows]
18
+ runButton = "Project"
19
+
20
+ [[workflows.workflow]]
21
+ name = "Project"
22
+ mode = "parallel"
23
+ author = "agent"
24
+
25
+ [[workflows.workflow.tasks]]
26
+ task = "workflow.run"
27
+ args = "Start application"
28
+
29
+ [[workflows.workflow]]
30
+ name = "Start application"
31
+ author = "agent"
32
+
33
+ [[workflows.workflow.tasks]]
34
+ task = "shell.exec"
35
+ args = "npm run dev"
36
+ waitForPort = 5000
QatarPOS/attached_assets/Pasted-You-are-a-senior-full-stack-developer-Generate-a-multi-tenant-cloud-native-Point-of-Sale-POS-mic-1752578171314_1752578171315.txt ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are a senior full‐stack developer. Generate a multi‐tenant, cloud‐native Point-of-Sale (POS) microservice that integrates seamlessly into a GCC-focused ERP system (initial focus: Qatar).
2
+
3
+ Functional Requirements:
4
+ - Order Management: quick-serve and table-service workflows, table mapping, split/bill transfers
5
+ - Inventory Control: real-time stock tracking, barcode/QR scanning, low-stock alerts
6
+ - Pricing & Promotions: tiered pricing, time-based discounts (e.g., happy hour), bundle offers, coupon codes
7
+ - Payments & Receipts: cash, card, mobile wallet; fiscal receipt formats compliant with Qatari regulations; email/SMS e-receipts
8
+ - Offline Mode & Sync: local cache via IndexedDB, automatic two-way data reconciliation when back online
9
+ - Multi-store & Terminal: centralized dashboard, individual terminal login with RBAC (cashier, manager)
10
+
11
+ Non-Functional Requirements:
12
+ - Microservices architecture (Docker, Kubernetes) with API-first design (OpenAPI/Swagger)
13
+ - Domain-Driven Design and clear module boundaries
14
+ - Multi-tenant support (separate schemas per tenant or tenant_id isolation)
15
+ - High availability and horizontal scalability on AWS/Azure/GCP
16
+ - JWT authentication, encryption at rest and in transit, OWASP security best practices
17
+ - Logging & Monitoring (ELK stack, Prometheus/Grafana)
18
+
19
+ Tech Stack:
20
+ - Front-end: React + Next.js, TypeScript, react-i18next for bilingual (RTL/LTR) UI, IndexedDB for offline
21
+ - Back-end: NestJS (TypeScript) or Django + DRF (Python), PostgreSQL with partitioned tables, Redis for caching & job queuing
22
+ - DevOps: Docker & Helm charts, Kubernetes (EKS/AKS/GKE), Terraform for IaC, GitHub Actions CI/CD
23
+ - Testing: Jest for unit tests, Cypress for e2e, Supertest for API integration tests
24
+
25
+ Deliverables:
26
+ 1. Project scaffold with folder structure, package manifests, Dockerfiles, Helm charts
27
+ 2. Database schema (SQL migrations and ER diagrams for stores, terminals, products, orders, payments, promotions)
28
+ 3. RESTful API endpoints with full Swagger/OpenAPI docs
29
+ 4. Responsive React/Next.js UI components for desktop/tablet POS screens
30
+ 5. Offline sync logic with IndexedDB caching and conflict resolution
31
+ 6. Role-based RBAC middleware and JWT auth flows
32
+ 7. Automated test suites with coverage reports
33
+ 8. CI/CD pipeline configurations (build, test, deploy)
34
+ 9. Deployment guides for cloud environments
35
+
36
+ Ensure production-ready code, clear inline comments, and comprehensive README with setup instructions, environment variables, and architectural overview. Localize all UI text and date/number formats for Arabic/English support.
QatarPOS/client/index.html ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1" />
6
+ </head>
7
+ <body>
8
+ <div id="root"></div>
9
+ <script type="module" src="/src/main.tsx"></script>
10
+ <!-- This is a replit script which adds a banner on the top of the page when opened in development mode outside the replit environment -->
11
+ <script type="text/javascript" src="https://replit.com/public/js/replit-dev-banner.js"></script>
12
+ </body>
13
+ </html>
QatarPOS/client/public/images/butter-chicken.svg ADDED
QatarPOS/client/public/images/chicken-biryani.svg ADDED
QatarPOS/client/public/images/dal-makhani.svg ADDED
QatarPOS/client/public/images/garlic-naan.svg ADDED
QatarPOS/client/public/images/gulab-jamun.svg ADDED
QatarPOS/client/public/images/lamb-rogan-josh.svg ADDED
QatarPOS/client/public/images/mango-lassi.svg ADDED
QatarPOS/client/public/images/masala-tea.svg ADDED
QatarPOS/client/public/images/pakora.svg ADDED
QatarPOS/client/public/images/paneer-tikka.svg ADDED
QatarPOS/client/public/images/plain-naan.svg ADDED
QatarPOS/client/public/images/samosa.svg ADDED
QatarPOS/client/src/App.tsx ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Switch, Route } from "wouter";
2
+ import { queryClient } from "./lib/queryClient";
3
+ import { QueryClientProvider } from "@tanstack/react-query";
4
+ import { Toaster } from "@/components/ui/toaster";
5
+ import { TooltipProvider } from "@/components/ui/tooltip";
6
+ import { useAuth } from "@/hooks/useAuth";
7
+ import { POSProvider } from "@/contexts/POSContext";
8
+ import NotFound from "@/pages/not-found";
9
+ import Landing from "@/pages/Landing";
10
+ import POS from "@/pages/POS";
11
+ import TableService from "@/pages/TableService";
12
+ import Inventory from "@/pages/Inventory";
13
+ import Reports from "@/pages/Reports";
14
+ import { useEffect } from "react";
15
+ import { offlineStore } from "@/lib/offlineStore";
16
+
17
+ function Router() {
18
+ const { isAuthenticated, isLoading } = useAuth();
19
+
20
+ return (
21
+ <Switch>
22
+ {isLoading || !isAuthenticated ? (
23
+ <Route path="/" component={Landing} />
24
+ ) : (
25
+ <POSProvider>
26
+ <Route path="/" component={POS} />
27
+ <Route path="/pos" component={POS} />
28
+ <Route path="/table-service" component={TableService} />
29
+ <Route path="/inventory" component={Inventory} />
30
+ <Route path="/reports" component={Reports} />
31
+ </POSProvider>
32
+ )}
33
+ <Route component={NotFound} />
34
+ </Switch>
35
+ );
36
+ }
37
+
38
+ function App() {
39
+ useEffect(() => {
40
+ // Initialize offline store on app start
41
+ offlineStore.init().catch(console.error);
42
+ }, []);
43
+
44
+ return (
45
+ <QueryClientProvider client={queryClient}>
46
+ <TooltipProvider>
47
+ <Toaster />
48
+ <Router />
49
+ </TooltipProvider>
50
+ </QueryClientProvider>
51
+ );
52
+ }
53
+
54
+ export default App;
QatarPOS/client/src/components/BarcodeScanner.tsx ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState, useEffect, useRef } from "react";
2
+ import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
3
+ import { Button } from "@/components/ui/button";
4
+ import { Input } from "@/components/ui/input";
5
+ import { useTranslation } from "@/lib/i18n";
6
+ import { Camera, X, Type } from "lucide-react";
7
+
8
+ interface BarcodeScannerProps {
9
+ onScan: (barcode: string) => void;
10
+ onClose: () => void;
11
+ }
12
+
13
+ export function BarcodeScanner({ onScan, onClose }: BarcodeScannerProps) {
14
+ const { t, direction } = useTranslation();
15
+ const [manualEntry, setManualEntry] = useState("");
16
+ const [isManualMode, setIsManualMode] = useState(false);
17
+ const [hasCamera, setHasCamera] = useState(true);
18
+ const videoRef = useRef<HTMLVideoElement>(null);
19
+ const streamRef = useRef<MediaStream | null>(null);
20
+
21
+ useEffect(() => {
22
+ if (!isManualMode) {
23
+ startCamera();
24
+ }
25
+
26
+ return () => {
27
+ stopCamera();
28
+ };
29
+ }, [isManualMode]);
30
+
31
+ const startCamera = async () => {
32
+ try {
33
+ const stream = await navigator.mediaDevices.getUserMedia({
34
+ video: {
35
+ facingMode: 'environment',
36
+ width: { ideal: 1280 },
37
+ height: { ideal: 720 }
38
+ }
39
+ });
40
+
41
+ streamRef.current = stream;
42
+ if (videoRef.current) {
43
+ videoRef.current.srcObject = stream;
44
+ }
45
+ } catch (error) {
46
+ console.error('Error accessing camera:', error);
47
+ setHasCamera(false);
48
+ setIsManualMode(true);
49
+ }
50
+ };
51
+
52
+ const stopCamera = () => {
53
+ if (streamRef.current) {
54
+ streamRef.current.getTracks().forEach(track => track.stop());
55
+ streamRef.current = null;
56
+ }
57
+ };
58
+
59
+ const handleManualSubmit = () => {
60
+ if (manualEntry.trim()) {
61
+ onScan(manualEntry.trim());
62
+ }
63
+ };
64
+
65
+ const handleKeyPress = (e: React.KeyboardEvent) => {
66
+ if (e.key === 'Enter') {
67
+ handleManualSubmit();
68
+ }
69
+ };
70
+
71
+ // Simulate barcode detection (in a real app, you'd use a barcode scanning library)
72
+ const simulateBarcodeDetection = () => {
73
+ // This is a placeholder for actual barcode scanning
74
+ // In production, you would integrate with a library like @zxing/browser
75
+ const mockBarcode = "1234567890123";
76
+ onScan(mockBarcode);
77
+ };
78
+
79
+ return (
80
+ <Dialog open={true} onOpenChange={onClose}>
81
+ <DialogContent className="max-w-md mx-4" dir={direction}>
82
+ <DialogHeader>
83
+ <DialogTitle className="flex items-center justify-between">
84
+ {direction === 'rtl' ? 'مسح الباركود' : 'Barcode Scanner'}
85
+ <Button variant="ghost" size="sm" onClick={onClose}>
86
+ <X className="h-4 w-4" />
87
+ </Button>
88
+ </DialogTitle>
89
+ </DialogHeader>
90
+
91
+ <div className="space-y-4">
92
+ {/* Camera/Manual Toggle */}
93
+ <div className="flex space-x-2">
94
+ <Button
95
+ variant={!isManualMode ? "default" : "outline"}
96
+ size="sm"
97
+ onClick={() => setIsManualMode(false)}
98
+ disabled={!hasCamera}
99
+ className="flex-1"
100
+ >
101
+ <Camera className="h-4 w-4 mr-2" />
102
+ {direction === 'rtl' ? 'الكاميرا' : 'Camera'}
103
+ </Button>
104
+ <Button
105
+ variant={isManualMode ? "default" : "outline"}
106
+ size="sm"
107
+ onClick={() => setIsManualMode(true)}
108
+ className="flex-1"
109
+ >
110
+ <Type className="h-4 w-4 mr-2" />
111
+ {direction === 'rtl' ? 'إدخال يدوي' : 'Manual'}
112
+ </Button>
113
+ </div>
114
+
115
+ {/* Camera View */}
116
+ {!isManualMode && hasCamera && (
117
+ <div className="relative">
118
+ <video
119
+ ref={videoRef}
120
+ autoPlay
121
+ playsInline
122
+ className="w-full h-64 bg-black rounded-lg object-cover"
123
+ />
124
+ <div className="absolute inset-0 flex items-center justify-center">
125
+ <div className="w-48 h-32 border-2 border-white rounded-lg opacity-50"></div>
126
+ </div>
127
+ <div className="absolute bottom-4 left-1/2 transform -translate-x-1/2">
128
+ <Button
129
+ onClick={simulateBarcodeDetection}
130
+ className="pos-button"
131
+ >
132
+ {direction === 'rtl' ? 'مسح تجريبي' : 'Test Scan'}
133
+ </Button>
134
+ </div>
135
+ </div>
136
+ )}
137
+
138
+ {/* Manual Entry */}
139
+ {(isManualMode || !hasCamera) && (
140
+ <div className="space-y-3">
141
+ <div>
142
+ <label className="text-sm font-medium text-gray-700 block mb-2">
143
+ {direction === 'rtl' ? 'أدخل رمز الباركود:' : 'Enter barcode:'}
144
+ </label>
145
+ <Input
146
+ type="text"
147
+ value={manualEntry}
148
+ onChange={(e) => setManualEntry(e.target.value)}
149
+ onKeyPress={handleKeyPress}
150
+ placeholder={direction === 'rtl' ? 'مثال: 1234567890123' : 'e.g., 1234567890123'}
151
+ className="font-mono"
152
+ autoFocus
153
+ />
154
+ </div>
155
+ <Button
156
+ onClick={handleManualSubmit}
157
+ disabled={!manualEntry.trim()}
158
+ className="w-full pos-button"
159
+ >
160
+ {direction === 'rtl' ? 'إضافة المنتج' : 'Add Product'}
161
+ </Button>
162
+ </div>
163
+ )}
164
+
165
+ {/* Instructions */}
166
+ <div className="text-center text-sm text-gray-600">
167
+ {!isManualMode && hasCamera ? (
168
+ <p>
169
+ {direction === 'rtl'
170
+ ? 'وجه الكاميرا نحو الباركود للمسح التلقائي'
171
+ : 'Point camera at barcode for automatic scanning'
172
+ }
173
+ </p>
174
+ ) : (
175
+ <p>
176
+ {direction === 'rtl'
177
+ ? 'أدخل رمز الباركود يدوياً أو استخدم قارئ الباركود'
178
+ : 'Enter barcode manually or use barcode scanner'
179
+ }
180
+ </p>
181
+ )}
182
+ </div>
183
+
184
+ {!hasCamera && (
185
+ <div className="text-center text-sm text-yellow-600 bg-yellow-50 p-3 rounded-lg">
186
+ {direction === 'rtl'
187
+ ? 'لا يمكن الوصول للكاميرا. يرجى استخدام الإدخال اليدوي.'
188
+ : 'Camera not available. Please use manual entry.'
189
+ }
190
+ </div>
191
+ )}
192
+ </div>
193
+ </DialogContent>
194
+ </Dialog>
195
+ );
196
+ }
QatarPOS/client/src/components/OrderSummary.tsx ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from "react";
2
+ import { Button } from "@/components/ui/button";
3
+ import { Badge } from "@/components/ui/badge";
4
+ import { Input } from "@/components/ui/input";
5
+ import { Textarea } from "@/components/ui/textarea";
6
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
7
+ import { ReceiptModal } from "@/components/ReceiptModal";
8
+ import { usePOS } from "@/contexts/POSContext";
9
+ import { useTranslation } from "@/lib/i18n";
10
+ import { useToast } from "@/hooks/use-toast";
11
+ import {
12
+ Trash2,
13
+ Edit,
14
+ Minus,
15
+ Plus,
16
+ CreditCard,
17
+ Banknote,
18
+ Smartphone,
19
+ Scissors,
20
+ Check,
21
+ Pause,
22
+ User
23
+ } from "lucide-react";
24
+
25
+ export function OrderSummary() {
26
+ const { state, actions } = usePOS();
27
+ const { t, direction, formatCurrency } = useTranslation();
28
+ const { toast } = useToast();
29
+ const [showReceipt, setShowReceipt] = useState(false);
30
+ const [customerInfo, setCustomerInfo] = useState({
31
+ name: "",
32
+ phone: "",
33
+ email: ""
34
+ });
35
+ const [orderNotes, setOrderNotes] = useState("");
36
+ const [paymentMethod, setPaymentMethod] = useState<string>("cash");
37
+
38
+ const { currentOrder } = state;
39
+
40
+ const handleQuantityChange = (itemId: string, newQuantity: number) => {
41
+ if (newQuantity <= 0) {
42
+ actions.removeFromCart(itemId);
43
+ } else {
44
+ actions.updateCartItem(itemId, newQuantity);
45
+ }
46
+ };
47
+
48
+ const handleOrderTypeChange = (type: 'dine_in' | 'takeaway' | 'delivery') => {
49
+ actions.setOrderType(type);
50
+ };
51
+
52
+ const handleCustomerInfoChange = (field: string, value: string) => {
53
+ const updated = { ...customerInfo, [field]: value };
54
+ setCustomerInfo(updated);
55
+ actions.setCustomerInfo(updated);
56
+ };
57
+
58
+ const handleNotesChange = (notes: string) => {
59
+ setOrderNotes(notes);
60
+ actions.setOrderNotes(notes);
61
+ };
62
+
63
+ const handleCompleteOrder = async () => {
64
+ if (!currentOrder || currentOrder.items.length === 0) {
65
+ toast({
66
+ title: t('message.error'),
67
+ description: direction === 'rtl' ? 'لا توجد عناصر في الطلب' : 'No items in order',
68
+ variant: "destructive",
69
+ });
70
+ return;
71
+ }
72
+
73
+ try {
74
+ await actions.completeOrder();
75
+ setShowReceipt(true);
76
+ // Reset form
77
+ setCustomerInfo({ name: "", phone: "", email: "" });
78
+ setOrderNotes("");
79
+ setPaymentMethod("cash");
80
+ } catch (error) {
81
+ console.error('Error completing order:', error);
82
+ }
83
+ };
84
+
85
+ const handleHoldOrder = async () => {
86
+ if (!currentOrder || currentOrder.items.length === 0) {
87
+ toast({
88
+ title: t('message.error'),
89
+ description: direction === 'rtl' ? 'لا توجد عناصر في الطلب' : 'No items in order',
90
+ variant: "destructive",
91
+ });
92
+ return;
93
+ }
94
+
95
+ await actions.holdOrder();
96
+ // Reset form
97
+ setCustomerInfo({ name: "", phone: "", email: "" });
98
+ setOrderNotes("");
99
+ };
100
+
101
+ const getOrderTypeLabel = (type: string) => {
102
+ switch (type) {
103
+ case 'dine_in':
104
+ return direction === 'rtl' ? 'تناول في المكان' : 'Dine In';
105
+ case 'takeaway':
106
+ return direction === 'rtl' ? 'طلبات خارجية' : 'Takeaway';
107
+ case 'delivery':
108
+ return direction === 'rtl' ? 'توصيل' : 'Delivery';
109
+ default:
110
+ return direction === 'rtl' ? 'تناول في المكان' : 'Dine In';
111
+ }
112
+ };
113
+
114
+ if (!currentOrder) {
115
+ return (
116
+ <div className="h-full flex items-center justify-center p-6">
117
+ <div className="text-center text-gray-500">
118
+ <div className="text-lg font-medium mb-2">
119
+ {direction === 'rtl' ? 'لا يوجد طلب نشط' : 'No active order'}
120
+ </div>
121
+ <p className="text-sm">
122
+ {direction === 'rtl'
123
+ ? 'أضف منتجات لبدء طلب جديد'
124
+ : 'Add products to start a new order'
125
+ }
126
+ </p>
127
+ </div>
128
+ </div>
129
+ );
130
+ }
131
+
132
+ return (
133
+ <div className="h-full flex flex-col bg-white">
134
+ {/* Order Header */}
135
+ <div className="p-4 border-b border-gray-200">
136
+ <div className="flex items-center justify-between mb-3">
137
+ <h2 className="text-lg font-semibold text-neutral">
138
+ {t('order.current_order')}
139
+ </h2>
140
+ <Button
141
+ variant="ghost"
142
+ size="sm"
143
+ onClick={actions.clearOrder}
144
+ className="text-gray-500 hover:text-red-500"
145
+ >
146
+ <Trash2 className="h-4 w-4" />
147
+ </Button>
148
+ </div>
149
+
150
+ <div className="flex items-center justify-between">
151
+ <div className="flex items-center space-x-2">
152
+ <User className="h-4 w-4 text-gray-500" />
153
+ <span className="text-sm text-gray-600">
154
+ {state.selectedTable ? `${t('order.table')} ${state.selectedTable.name}` : getOrderTypeLabel(currentOrder.type)}
155
+ </span>
156
+ </div>
157
+ <Button
158
+ variant="ghost"
159
+ size="sm"
160
+ className="text-primary hover:text-primary-dark"
161
+ >
162
+ <Edit className="h-4 w-4" />
163
+ </Button>
164
+ </div>
165
+ </div>
166
+
167
+ {/* Order Type Selection */}
168
+ <div className="p-4 border-b border-gray-200">
169
+ <Select
170
+ value={currentOrder.type}
171
+ onValueChange={(value: 'dine_in' | 'takeaway' | 'delivery') => handleOrderTypeChange(value)}
172
+ >
173
+ <SelectTrigger>
174
+ <SelectValue />
175
+ </SelectTrigger>
176
+ <SelectContent>
177
+ <SelectItem value="dine_in">
178
+ {direction === 'rtl' ? 'تناول في المكان' : 'Dine In'}
179
+ </SelectItem>
180
+ <SelectItem value="takeaway">
181
+ {direction === 'rtl' ? 'طلبات خارجية' : 'Takeaway'}
182
+ </SelectItem>
183
+ <SelectItem value="delivery">
184
+ {direction === 'rtl' ? 'توصيل' : 'Delivery'}
185
+ </SelectItem>
186
+ </SelectContent>
187
+ </Select>
188
+ </div>
189
+
190
+ {/* Order Items */}
191
+ <div className="flex-1 order-summary p-4">
192
+ {currentOrder.items.length > 0 ? (
193
+ <div className="space-y-3">
194
+ {currentOrder.items.map((item) => (
195
+ <div key={item.id} className="order-item">
196
+ <div className="flex-1">
197
+ <h4 className="font-medium text-neutral">
198
+ {direction === 'rtl' && item.nameAr ? item.nameAr : item.name}
199
+ </h4>
200
+ <p className="text-sm text-gray-600">
201
+ {formatCurrency(parseFloat(item.price))}
202
+ </p>
203
+ {item.notes && (
204
+ <p className="text-xs text-gray-500 mt-1">{item.notes}</p>
205
+ )}
206
+ </div>
207
+ <div className="flex items-center space-x-2">
208
+ <Button
209
+ size="sm"
210
+ variant="ghost"
211
+ className="quantity-button quantity-button-decrease"
212
+ onClick={() => handleQuantityChange(item.id, item.quantity - 1)}
213
+ >
214
+ <Minus className="h-3 w-3" />
215
+ </Button>
216
+ <span className="w-8 text-center font-medium">{item.quantity}</span>
217
+ <Button
218
+ size="sm"
219
+ variant="ghost"
220
+ className="quantity-button quantity-button-increase"
221
+ onClick={() => handleQuantityChange(item.id, item.quantity + 1)}
222
+ >
223
+ <Plus className="h-3 w-3" />
224
+ </Button>
225
+ </div>
226
+ </div>
227
+ ))}
228
+ </div>
229
+ ) : (
230
+ <div className="text-center py-8 text-gray-500">
231
+ {direction === 'rtl' ? 'لا توجد عناصر في الطلب' : 'No items in order'}
232
+ </div>
233
+ )}
234
+
235
+ {/* Promotions */}
236
+ {parseFloat(currentOrder.discountAmount) > 0 && (
237
+ <div className="mt-4 p-3 bg-yellow-50 border border-yellow-200 rounded-lg">
238
+ <div className="flex items-center justify-between">
239
+ <span className="text-sm font-medium text-yellow-800">
240
+ {t('promo.discount_applied')}
241
+ </span>
242
+ <span className="text-sm font-medium text-yellow-800">
243
+ -{formatCurrency(parseFloat(currentOrder.discountAmount))}
244
+ </span>
245
+ </div>
246
+ </div>
247
+ )}
248
+
249
+ {/* Customer Information */}
250
+ <div className="mt-6 space-y-3">
251
+ <h4 className="font-medium text-neutral">
252
+ {direction === 'rtl' ? 'معلومات العميل' : 'Customer Information'}
253
+ </h4>
254
+ <Input
255
+ placeholder={direction === 'rtl' ? 'اسم العميل' : 'Customer Name'}
256
+ value={customerInfo.name}
257
+ onChange={(e) => handleCustomerInfoChange('name', e.target.value)}
258
+ />
259
+ <Input
260
+ placeholder={direction === 'rtl' ? 'رقم الهاتف' : 'Phone Number'}
261
+ value={customerInfo.phone}
262
+ onChange={(e) => handleCustomerInfoChange('phone', e.target.value)}
263
+ />
264
+ <Input
265
+ placeholder={direction === 'rtl' ? 'البريد الإلكتروني' : 'Email Address'}
266
+ value={customerInfo.email}
267
+ onChange={(e) => handleCustomerInfoChange('email', e.target.value)}
268
+ />
269
+ <Textarea
270
+ placeholder={direction === 'rtl' ? 'ملاحظات الطلب' : 'Order Notes'}
271
+ value={orderNotes}
272
+ onChange={(e) => handleNotesChange(e.target.value)}
273
+ rows={2}
274
+ />
275
+ </div>
276
+ </div>
277
+
278
+ {/* Order Total */}
279
+ <div className="p-4 border-t border-gray-200 space-y-2">
280
+ <div className="flex justify-between text-sm">
281
+ <span>{t('order.subtotal')}:</span>
282
+ <span>{formatCurrency(parseFloat(currentOrder.subtotal))}</span>
283
+ </div>
284
+
285
+ {parseFloat(currentOrder.discountAmount) > 0 && (
286
+ <div className="flex justify-between text-sm text-yellow-600">
287
+ <span>{t('order.discount')}:</span>
288
+ <span>-{formatCurrency(parseFloat(currentOrder.discountAmount))}</span>
289
+ </div>
290
+ )}
291
+
292
+ <div className="flex justify-between text-sm">
293
+ <span>{t('order.tax')} (5%):</span>
294
+ <span>{formatCurrency(parseFloat(currentOrder.taxAmount))}</span>
295
+ </div>
296
+
297
+ <div className="flex justify-between text-lg font-bold text-neutral border-t pt-2">
298
+ <span>{t('order.total')}:</span>
299
+ <span>{formatCurrency(parseFloat(currentOrder.total))}</span>
300
+ </div>
301
+ </div>
302
+
303
+ {/* Payment Methods */}
304
+ <div className="p-4 border-t border-gray-200">
305
+ <h3 className="text-sm font-semibold text-neutral mb-3">
306
+ {t('payment.method')}
307
+ </h3>
308
+ <div className="grid grid-cols-2 gap-2 mb-4">
309
+ <Button
310
+ variant={paymentMethod === "cash" ? "default" : "outline"}
311
+ className="touch-target flex items-center justify-center"
312
+ onClick={() => setPaymentMethod("cash")}
313
+ >
314
+ <Banknote className="h-4 w-4 mr-2" />
315
+ {t('payment.cash')}
316
+ </Button>
317
+ <Button
318
+ variant={paymentMethod === "card" ? "default" : "outline"}
319
+ className="touch-target flex items-center justify-center"
320
+ onClick={() => setPaymentMethod("card")}
321
+ >
322
+ <CreditCard className="h-4 w-4 mr-2" />
323
+ {t('payment.card')}
324
+ </Button>
325
+ <Button
326
+ variant={paymentMethod === "wallet" ? "default" : "outline"}
327
+ className="touch-target flex items-center justify-center"
328
+ onClick={() => setPaymentMethod("wallet")}
329
+ >
330
+ <Smartphone className="h-4 w-4 mr-2" />
331
+ {t('payment.wallet')}
332
+ </Button>
333
+ <Button
334
+ variant={paymentMethod === "split" ? "default" : "outline"}
335
+ className="touch-target flex items-center justify-center"
336
+ onClick={() => setPaymentMethod("split")}
337
+ >
338
+ <Scissors className="h-4 w-4 mr-2" />
339
+ {t('payment.split')}
340
+ </Button>
341
+ </div>
342
+
343
+ {/* Action Buttons */}
344
+ <div className="space-y-2">
345
+ <Button
346
+ className="w-full pos-button-success touch-target"
347
+ onClick={handleCompleteOrder}
348
+ disabled={currentOrder.items.length === 0}
349
+ >
350
+ <Check className="h-4 w-4 mr-2" />
351
+ {t('payment.complete_order')}
352
+ </Button>
353
+ <Button
354
+ variant="outline"
355
+ className="w-full touch-target"
356
+ onClick={handleHoldOrder}
357
+ disabled={currentOrder.items.length === 0}
358
+ >
359
+ <Pause className="h-4 w-4 mr-2" />
360
+ {t('payment.hold_order')}
361
+ </Button>
362
+ </div>
363
+ </div>
364
+
365
+ {/* Receipt Modal */}
366
+ {showReceipt && currentOrder && (
367
+ <ReceiptModal
368
+ order={currentOrder}
369
+ onClose={() => setShowReceipt(false)}
370
+ />
371
+ )}
372
+ </div>
373
+ );
374
+ }
QatarPOS/client/src/components/POSHeader.tsx ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from "react";
2
+ import { Button } from "@/components/ui/button";
3
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
4
+ import { Badge } from "@/components/ui/badge";
5
+ import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
6
+ import {
7
+ DropdownMenu,
8
+ DropdownMenuContent,
9
+ DropdownMenuItem,
10
+ DropdownMenuSeparator,
11
+ DropdownMenuTrigger
12
+ } from "@/components/ui/dropdown-menu";
13
+ import { Globe, Wifi, WifiOff, ChevronDown, ScanBarcode } from "lucide-react";
14
+ import { useAuth } from "@/hooks/useAuth";
15
+ import { useTranslation } from "@/lib/i18n";
16
+ import { usePOS } from "@/contexts/POSContext";
17
+ import { useQuery } from "@tanstack/react-query";
18
+
19
+ export function POSHeader() {
20
+ const { user } = useAuth();
21
+ const { t, language, toggleLanguage } = useTranslation();
22
+ const { state } = usePOS();
23
+ const [selectedStoreId, setSelectedStoreId] = useState<string>("");
24
+
25
+ const { data: stores } = useQuery({
26
+ queryKey: ["/api/stores"],
27
+ enabled: !!user,
28
+ });
29
+
30
+ const selectedStore = stores?.find((store: any) => store.id === selectedStoreId);
31
+
32
+ return (
33
+ <header className="bg-white shadow-sm border-b border-gray-200 sticky top-0 z-50">
34
+ <div className="px-4 py-3 flex items-center justify-between">
35
+ <div className="flex items-center space-x-4">
36
+ <div className="flex items-center space-x-2">
37
+ <ScanBarcode className="text-primary text-xl" />
38
+ <h1 className="text-xl font-semibold text-neutral">
39
+ {t('app.title')}
40
+ </h1>
41
+ <Badge variant="secondary" className="text-xs">
42
+ v2.1
43
+ </Badge>
44
+ </div>
45
+
46
+ {/* Store Selector */}
47
+ {stores && stores.length > 0 && (
48
+ <Select value={selectedStoreId} onValueChange={setSelectedStoreId}>
49
+ <SelectTrigger className="w-64">
50
+ <SelectValue placeholder="Select store..." />
51
+ </SelectTrigger>
52
+ <SelectContent>
53
+ {stores.map((store: any) => (
54
+ <SelectItem key={store.id} value={store.id}>
55
+ {store.name}
56
+ </SelectItem>
57
+ ))}
58
+ </SelectContent>
59
+ </Select>
60
+ )}
61
+ </div>
62
+
63
+ <div className="flex items-center space-x-4">
64
+ {/* Language Toggle */}
65
+ <Button
66
+ variant="outline"
67
+ size="sm"
68
+ onClick={toggleLanguage}
69
+ className="flex items-center space-x-2"
70
+ >
71
+ <Globe className="h-4 w-4" />
72
+ <span>{t('header.language')}</span>
73
+ </Button>
74
+
75
+ {/* Connection Status */}
76
+ <div className="flex items-center space-x-2">
77
+ {state.isOnline ? (
78
+ <>
79
+ <Wifi className="w-3 h-3 text-green-500" />
80
+ <span className="text-sm text-gray-600">{t('header.online')}</span>
81
+ </>
82
+ ) : (
83
+ <>
84
+ <WifiOff className="w-3 h-3 text-red-500" />
85
+ <span className="text-sm text-gray-600">{t('header.offline')}</span>
86
+ </>
87
+ )}
88
+ </div>
89
+
90
+ {/* Terminal Info */}
91
+ {state.selectedTerminal && (
92
+ <div className="text-sm text-gray-600">
93
+ {t('header.terminal')}: {state.selectedTerminal.name} |
94
+ {t('header.cashier')}: <span>{user?.firstName} {user?.lastName}</span>
95
+ </div>
96
+ )}
97
+
98
+ {/* User Profile */}
99
+ <DropdownMenu>
100
+ <DropdownMenuTrigger asChild>
101
+ <Button variant="ghost" className="flex items-center space-x-2">
102
+ <Avatar className="w-8 h-8">
103
+ <AvatarImage src={user?.profileImageUrl} alt="User profile" />
104
+ <AvatarFallback>
105
+ {user?.firstName?.[0]}{user?.lastName?.[0]}
106
+ </AvatarFallback>
107
+ </Avatar>
108
+ <ChevronDown className="h-4 w-4" />
109
+ </Button>
110
+ </DropdownMenuTrigger>
111
+ <DropdownMenuContent align="end" className="w-56">
112
+ <DropdownMenuItem>
113
+ <div className="flex flex-col">
114
+ <p className="font-medium">{user?.firstName} {user?.lastName}</p>
115
+ <p className="text-sm text-gray-500">{user?.email}</p>
116
+ <p className="text-xs text-gray-400 capitalize">{user?.role}</p>
117
+ </div>
118
+ </DropdownMenuItem>
119
+ <DropdownMenuSeparator />
120
+ <DropdownMenuItem asChild>
121
+ <a href="/api/logout" className="w-full">
122
+ {t('auth.logout')}
123
+ </a>
124
+ </DropdownMenuItem>
125
+ </DropdownMenuContent>
126
+ </DropdownMenu>
127
+ </div>
128
+ </div>
129
+ </header>
130
+ );
131
+ }
QatarPOS/client/src/components/ProductCatalog.tsx ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from "react";
2
+ import { Button } from "@/components/ui/button";
3
+ import { Input } from "@/components/ui/input";
4
+ import { Card, CardContent } from "@/components/ui/card";
5
+ import { Badge } from "@/components/ui/badge";
6
+ import { BarcodeScanner } from "@/components/BarcodeScanner";
7
+ import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
8
+ import { useAuth } from "@/hooks/useAuth";
9
+ import { useTranslation } from "@/lib/i18n";
10
+ import { usePOS } from "@/contexts/POSContext";
11
+ import { useToast } from "@/hooks/use-toast";
12
+ import { isUnauthorizedError } from "@/lib/authUtils";
13
+ import { apiRequest } from "@/lib/queryClient";
14
+ import { Search, Barcode, Clock, Star } from "lucide-react";
15
+
16
+ export function ProductCatalog() {
17
+ const { user } = useAuth();
18
+ const { t, direction } = useTranslation();
19
+ const { state, actions } = usePOS();
20
+ const { toast } = useToast();
21
+ const queryClient = useQueryClient();
22
+ const [searchQuery, setSearchQuery] = useState("");
23
+ const [selectedCategory, setSelectedCategory] = useState<string>("all");
24
+ const [showScanner, setShowScanner] = useState(false);
25
+
26
+ // Fetch products
27
+ const { data: products, isLoading: productsLoading } = useQuery({
28
+ queryKey: ["/api/products", selectedCategory !== "all" ? { category: selectedCategory } : {}],
29
+ enabled: !!user,
30
+ onError: (error: Error) => {
31
+ if (isUnauthorizedError(error)) {
32
+ toast({
33
+ title: t('message.unauthorized'),
34
+ description: t('message.logged_out'),
35
+ variant: "destructive",
36
+ });
37
+ setTimeout(() => {
38
+ window.location.href = "/api/login";
39
+ }, 500);
40
+ return;
41
+ }
42
+ },
43
+ });
44
+
45
+ // Fetch categories
46
+ const { data: categories } = useQuery({
47
+ queryKey: ["/api/categories"],
48
+ enabled: !!user,
49
+ });
50
+
51
+ // Search products mutation
52
+ const searchMutation = useMutation({
53
+ mutationFn: async (query: string) => {
54
+ const response = await apiRequest('GET', `/api/products/search?q=${encodeURIComponent(query)}`);
55
+ return response.json();
56
+ },
57
+ onError: (error: Error) => {
58
+ if (isUnauthorizedError(error)) {
59
+ toast({
60
+ title: t('message.unauthorized'),
61
+ description: t('message.logged_out'),
62
+ variant: "destructive",
63
+ });
64
+ setTimeout(() => {
65
+ window.location.href = "/api/login";
66
+ }, 500);
67
+ return;
68
+ }
69
+ },
70
+ });
71
+
72
+ // Barcode scan mutation
73
+ const barcodeMutation = useMutation({
74
+ mutationFn: async (barcode: string) => {
75
+ const response = await apiRequest('GET', `/api/products/barcode/${barcode}`);
76
+ return response.json();
77
+ },
78
+ onSuccess: (product) => {
79
+ actions.addToCart(product);
80
+ setShowScanner(false);
81
+ toast({
82
+ title: t('message.product_added'),
83
+ description: `${product.name} ${t('message.product_added')}`,
84
+ });
85
+ },
86
+ onError: (error: Error) => {
87
+ if (isUnauthorizedError(error)) {
88
+ toast({
89
+ title: t('message.unauthorized'),
90
+ description: t('message.logged_out'),
91
+ variant: "destructive",
92
+ });
93
+ setTimeout(() => {
94
+ window.location.href = "/api/login";
95
+ }, 500);
96
+ return;
97
+ }
98
+ toast({
99
+ title: t('message.error'),
100
+ description: "Product not found",
101
+ variant: "destructive",
102
+ });
103
+ },
104
+ });
105
+
106
+ const handleSearch = (query: string) => {
107
+ setSearchQuery(query);
108
+ if (query.trim()) {
109
+ searchMutation.mutate(query);
110
+ }
111
+ };
112
+
113
+ const handleBarcodeScanned = (barcode: string) => {
114
+ barcodeMutation.mutate(barcode);
115
+ };
116
+
117
+ const handleProductClick = (product: any) => {
118
+ if (product.stockQuantity <= 0 && product.trackInventory) {
119
+ toast({
120
+ title: t('message.error'),
121
+ description: t('products.out_of_stock'),
122
+ variant: "destructive",
123
+ });
124
+ return;
125
+ }
126
+ actions.addToCart(product);
127
+ };
128
+
129
+ const filteredProducts = searchQuery && searchMutation.data
130
+ ? searchMutation.data
131
+ : products?.filter((product: any) => {
132
+ if (!product.isActive) return false;
133
+ return true;
134
+ }) || [];
135
+
136
+ const getStockBadge = (product: any) => {
137
+ if (!product.trackInventory) return null;
138
+
139
+ if (product.stockQuantity <= 0) {
140
+ return (
141
+ <Badge variant="destructive" className="text-xs">
142
+ {t('products.out_of_stock')}
143
+ </Badge>
144
+ );
145
+ }
146
+
147
+ if (product.stockQuantity <= product.minStockLevel) {
148
+ return (
149
+ <Badge variant="secondary" className="text-xs bg-yellow-100 text-yellow-800">
150
+ {t('products.low_stock')}
151
+ </Badge>
152
+ );
153
+ }
154
+
155
+ return (
156
+ <Badge variant="secondary" className="text-xs bg-green-100 text-green-800">
157
+ {t('products.in_stock')}
158
+ </Badge>
159
+ );
160
+ };
161
+
162
+ return (
163
+ <div className="p-6 h-full flex flex-col">
164
+ {/* Search and Filters */}
165
+ <div className="mb-6">
166
+ <div className="flex items-center space-x-4 mb-4">
167
+ <div className="flex-1 relative">
168
+ <Search className="absolute left-3 top-3 h-4 w-4 text-gray-400" />
169
+ <Input
170
+ type="text"
171
+ placeholder={t('products.search_placeholder')}
172
+ value={searchQuery}
173
+ onChange={(e) => handleSearch(e.target.value)}
174
+ className="pl-10"
175
+ />
176
+ </div>
177
+ <Button
178
+ onClick={() => setShowScanner(true)}
179
+ className="pos-button flex items-center"
180
+ >
181
+ <Barcode className="h-4 w-4 mr-2" />
182
+ {t('products.scan')}
183
+ </Button>
184
+ </div>
185
+
186
+ {/* Category Filters */}
187
+ <div className="flex space-x-2 overflow-x-auto pb-2">
188
+ <Button
189
+ variant={selectedCategory === "all" ? "default" : "outline"}
190
+ size="sm"
191
+ onClick={() => setSelectedCategory("all")}
192
+ className="category-pill whitespace-nowrap"
193
+ >
194
+ {t('products.all_items')}
195
+ </Button>
196
+ {categories?.map((category: any) => (
197
+ <Button
198
+ key={category.id}
199
+ variant={selectedCategory === category.id ? "default" : "outline"}
200
+ size="sm"
201
+ onClick={() => setSelectedCategory(category.id)}
202
+ className="category-pill whitespace-nowrap"
203
+ >
204
+ {direction === 'rtl' && category.nameAr ? category.nameAr : category.name}
205
+ </Button>
206
+ ))}
207
+ </div>
208
+ </div>
209
+
210
+ {/* Products Grid */}
211
+ <div className="flex-1 overflow-y-auto">
212
+ {productsLoading || searchMutation.isPending ? (
213
+ <div className="flex items-center justify-center h-64">
214
+ <div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
215
+ </div>
216
+ ) : filteredProducts.length > 0 ? (
217
+ <div className="product-grid">
218
+ {filteredProducts.map((product: any) => (
219
+ <Card
220
+ key={product.id}
221
+ className="product-card"
222
+ onClick={() => handleProductClick(product)}
223
+ >
224
+ {product.imageUrl && (
225
+ <img
226
+ src={product.imageUrl}
227
+ alt={product.name}
228
+ className="w-full h-32 object-cover"
229
+ />
230
+ )}
231
+ <div className="p-4">
232
+ <div className="flex justify-between items-start mb-2">
233
+ <h3 className="font-semibold text-neutral mb-1 flex-1">
234
+ {direction === 'rtl' && product.nameAr ? product.nameAr : product.name}
235
+ </h3>
236
+ {getStockBadge(product)}
237
+ </div>
238
+
239
+ {product.description && (
240
+ <p className="text-sm text-gray-600 mb-2 line-clamp-2">
241
+ {direction === 'rtl' && product.descriptionAr ? product.descriptionAr : product.description}
242
+ </p>
243
+ )}
244
+
245
+ <div className="flex items-center justify-between">
246
+ <span className="text-lg font-bold text-primary">
247
+ {t('currency.format', { amount: product.price })}
248
+ </span>
249
+ {product.trackInventory && (
250
+ <span className="text-xs text-gray-500">
251
+ {t('products.stock')}: {product.stockQuantity}
252
+ </span>
253
+ )}
254
+ </div>
255
+ </div>
256
+ </Card>
257
+ ))}
258
+ </div>
259
+ ) : (
260
+ <div className="text-center py-12 text-gray-500">
261
+ {searchQuery
262
+ ? (direction === 'rtl' ? 'لا توجد منتجات تطابق البحث' : 'No products match your search')
263
+ : (direction === 'rtl' ? 'لا توجد منتجات' : 'No products available')
264
+ }
265
+ </div>
266
+ )}
267
+ </div>
268
+
269
+ {/* Quick Action Buttons */}
270
+ <div className="mt-6 grid grid-cols-2 gap-4">
271
+ <Button className="pos-button-warning p-4 h-auto">
272
+ <div className="text-center">
273
+ <Clock className="h-6 w-6 mx-auto mb-2" />
274
+ <div className="text-sm font-medium">{t('promo.happy_hour')}</div>
275
+ <div className="text-xs opacity-90">{t('promo.happy_hour_desc')}</div>
276
+ </div>
277
+ </Button>
278
+ <Button className="pos-button-success p-4 h-auto">
279
+ <div className="text-center">
280
+ <Star className="h-6 w-6 mx-auto mb-2" />
281
+ <div className="text-sm font-medium">{t('promo.loyalty_points')}</div>
282
+ <div className="text-xs opacity-90">{t('promo.scan_card')}</div>
283
+ </div>
284
+ </Button>
285
+ </div>
286
+
287
+ {/* Barcode Scanner Modal */}
288
+ {showScanner && (
289
+ <BarcodeScanner
290
+ onScan={handleBarcodeScanned}
291
+ onClose={() => setShowScanner(false)}
292
+ />
293
+ )}
294
+ </div>
295
+ );
296
+ }
QatarPOS/client/src/components/ReceiptModal.tsx ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from "react";
2
+ import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
3
+ import { Button } from "@/components/ui/button";
4
+ import { useTranslation } from "@/lib/i18n";
5
+ import { useToast } from "@/hooks/use-toast";
6
+ import { usePOS } from "@/contexts/POSContext";
7
+ import { Printer, Mail, MessageSquare, X } from "lucide-react";
8
+
9
+ interface ReceiptModalProps {
10
+ order: any;
11
+ onClose: () => void;
12
+ }
13
+
14
+ export function ReceiptModal({ order, onClose }: ReceiptModalProps) {
15
+ const { t, direction, formatCurrency, formatDate } = useTranslation();
16
+ const { state } = usePOS();
17
+ const { toast } = useToast();
18
+ const [isPrinting, setIsPrinting] = useState(false);
19
+ const [isSendingEmail, setIsSendingEmail] = useState(false);
20
+ const [isSendingSMS, setIsSendingSMS] = useState(false);
21
+
22
+ const handlePrint = async () => {
23
+ setIsPrinting(true);
24
+ try {
25
+ // In a real implementation, this would send to thermal printer
26
+ window.print();
27
+ toast({
28
+ title: t('message.success'),
29
+ description: direction === 'rtl' ? 'تم إرسال الإيصال للطباعة' : 'Receipt sent to printer',
30
+ });
31
+ } catch (error) {
32
+ toast({
33
+ title: t('message.error'),
34
+ description: direction === 'rtl' ? 'فشل في طباعة الإيصال' : 'Failed to print receipt',
35
+ variant: "destructive",
36
+ });
37
+ } finally {
38
+ setIsPrinting(false);
39
+ }
40
+ };
41
+
42
+ const handleEmailReceipt = async () => {
43
+ if (!order.customerEmail) {
44
+ toast({
45
+ title: t('message.error'),
46
+ description: direction === 'rtl' ? 'لا يوجد بريد إلكتروني للعميل' : 'No customer email provided',
47
+ variant: "destructive",
48
+ });
49
+ return;
50
+ }
51
+
52
+ setIsSendingEmail(true);
53
+ try {
54
+ // In a real implementation, this would call the email API
55
+ await new Promise(resolve => setTimeout(resolve, 2000)); // Simulate API call
56
+ toast({
57
+ title: t('message.success'),
58
+ description: direction === 'rtl' ? 'تم إرسال الإيصال بالبريد الإلكتروني' : 'Receipt sent via email',
59
+ });
60
+ } catch (error) {
61
+ toast({
62
+ title: t('message.error'),
63
+ description: direction === 'rtl' ? 'فشل في إرسال الإيصال' : 'Failed to send receipt',
64
+ variant: "destructive",
65
+ });
66
+ } finally {
67
+ setIsSendingEmail(false);
68
+ }
69
+ };
70
+
71
+ const handleSMSReceipt = async () => {
72
+ if (!order.customerPhone) {
73
+ toast({
74
+ title: t('message.error'),
75
+ description: direction === 'rtl' ? 'لا يوجد رقم هاتف للعميل' : 'No customer phone provided',
76
+ variant: "destructive",
77
+ });
78
+ return;
79
+ }
80
+
81
+ setIsSendingSMS(true);
82
+ try {
83
+ // In a real implementation, this would call the SMS API
84
+ await new Promise(resolve => setTimeout(resolve, 2000)); // Simulate API call
85
+ toast({
86
+ title: t('message.success'),
87
+ description: direction === 'rtl' ? 'تم إرسال الإيصال برسالة نصية' : 'Receipt sent via SMS',
88
+ });
89
+ } catch (error) {
90
+ toast({
91
+ title: t('message.error'),
92
+ description: direction === 'rtl' ? 'فشل في إرسال الإيصال' : 'Failed to send receipt',
93
+ variant: "destructive",
94
+ });
95
+ } finally {
96
+ setIsSendingSMS(false);
97
+ }
98
+ };
99
+
100
+ return (
101
+ <Dialog open={true} onOpenChange={onClose}>
102
+ <DialogContent className="max-w-md mx-4 max-h-screen overflow-y-auto" dir={direction}>
103
+ <DialogHeader>
104
+ <DialogTitle className="flex items-center justify-between">
105
+ {t('receipt.generated')}
106
+ <Button variant="ghost" size="sm" onClick={onClose}>
107
+ <X className="h-4 w-4" />
108
+ </Button>
109
+ </DialogTitle>
110
+ </DialogHeader>
111
+
112
+ {/* Receipt Preview */}
113
+ <div className="receipt-paper p-4 mb-4 text-sm receipt-content">
114
+ <div className="text-center mb-4">
115
+ <h4 className="font-bold text-lg">
116
+ {state.selectedStore?.name || (direction === 'rtl' ? 'مطعم مول قطر' : 'Qatar Mall Restaurant')}
117
+ </h4>
118
+ <p className="text-gray-600">
119
+ {direction === 'rtl' ? 'متجر #001 - طرفية POS-001' : 'Store #001 - Terminal POS-001'}
120
+ </p>
121
+ <p className="text-gray-600">
122
+ {direction === 'rtl' ? 'الرقم الضريبي: 123456789' : 'Tax ID: 123456789'}
123
+ </p>
124
+ <hr className="my-2" />
125
+ </div>
126
+
127
+ <div className="mb-4">
128
+ <p>
129
+ {direction === 'rtl' ? 'التاريخ:' : 'Date:'} {formatDate(new Date())}
130
+ </p>
131
+ <p>
132
+ {direction === 'rtl' ? 'الطلب:' : 'Order:'} #{order.orderNumber || `ORD-${Date.now()}`}
133
+ </p>
134
+ {order.customerName && (
135
+ <p>
136
+ {direction === 'rtl' ? 'العميل:' : 'Customer:'} {order.customerName}
137
+ </p>
138
+ )}
139
+ <p>
140
+ {direction === 'rtl' ? 'النوع:' : 'Type:'} {
141
+ order.type === 'dine_in' ?
142
+ (direction === 'rtl' ? 'تناول في المكان' : 'Dine In') :
143
+ order.type === 'takeaway' ?
144
+ (direction === 'rtl' ? 'طلبات خارجية' : 'Takeaway') :
145
+ (direction === 'rtl' ? 'توصيل' : 'Delivery')
146
+ }
147
+ </p>
148
+ </div>
149
+
150
+ <hr className="my-2" />
151
+
152
+ <div className="space-y-1">
153
+ {order.items.map((item: any, index: number) => (
154
+ <div key={index} className="flex justify-between">
155
+ <span>
156
+ {item.quantity}x {direction === 'rtl' && item.nameAr ? item.nameAr : item.name}
157
+ </span>
158
+ <span>{formatCurrency(parseFloat(item.totalPrice))}</span>
159
+ </div>
160
+ ))}
161
+ </div>
162
+
163
+ <hr className="my-2" />
164
+
165
+ <div className="space-y-1">
166
+ <div className="flex justify-between">
167
+ <span>{t('order.subtotal')}:</span>
168
+ <span>{formatCurrency(parseFloat(order.subtotal))}</span>
169
+ </div>
170
+
171
+ {parseFloat(order.discountAmount) > 0 && (
172
+ <div className="flex justify-between text-yellow-600">
173
+ <span>{t('order.discount')}:</span>
174
+ <span>-{formatCurrency(parseFloat(order.discountAmount))}</span>
175
+ </div>
176
+ )}
177
+
178
+ <div className="flex justify-between">
179
+ <span>{t('order.tax')} (5%):</span>
180
+ <span>{formatCurrency(parseFloat(order.taxAmount))}</span>
181
+ </div>
182
+
183
+ <div className="flex justify-between font-bold border-t pt-1">
184
+ <span>{t('order.total')}:</span>
185
+ <span>{formatCurrency(parseFloat(order.total))}</span>
186
+ </div>
187
+ </div>
188
+
189
+ <hr className="my-2" />
190
+
191
+ <div className="text-center text-xs text-gray-600">
192
+ <p>{t('receipt.thank_you')}</p>
193
+ <p>{t('receipt.visit_again')}</p>
194
+ {state.selectedStore?.email && (
195
+ <p>{state.selectedStore.email}</p>
196
+ )}
197
+ </div>
198
+ </div>
199
+
200
+ {/* Receipt Actions */}
201
+ <div className="space-y-3 no-print">
202
+ <div className="grid grid-cols-2 gap-3">
203
+ <Button
204
+ onClick={handlePrint}
205
+ disabled={isPrinting}
206
+ className="pos-button touch-target"
207
+ >
208
+ <Printer className="h-4 w-4 mr-2" />
209
+ {isPrinting ?
210
+ (direction === 'rtl' ? 'جار الطباعة...' : 'Printing...') :
211
+ t('receipt.print')
212
+ }
213
+ </Button>
214
+ <Button
215
+ onClick={handleEmailReceipt}
216
+ disabled={isSendingEmail || !order.customerEmail}
217
+ className="pos-button-success touch-target"
218
+ >
219
+ <Mail className="h-4 w-4 mr-2" />
220
+ {isSendingEmail ?
221
+ (direction === 'rtl' ? 'جار الإرسال...' : 'Sending...') :
222
+ t('receipt.email')
223
+ }
224
+ </Button>
225
+ </div>
226
+ <Button
227
+ onClick={handleSMSReceipt}
228
+ disabled={isSendingSMS || !order.customerPhone}
229
+ className="w-full pos-button-warning touch-target"
230
+ >
231
+ <MessageSquare className="h-4 w-4 mr-2" />
232
+ {isSendingSMS ?
233
+ (direction === 'rtl' ? 'جار الإرسال...' : 'Sending...') :
234
+ t('receipt.sms')
235
+ }
236
+ </Button>
237
+ </div>
238
+ </DialogContent>
239
+ </Dialog>
240
+ );
241
+ }
QatarPOS/client/src/components/Sidebar.tsx ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { cn } from "@/lib/utils";
2
+ import { Button } from "@/components/ui/button";
3
+ import { Badge } from "@/components/ui/badge";
4
+ import { useAuth } from "@/hooks/useAuth";
5
+ import { useTranslation } from "@/lib/i18n";
6
+ import { usePOS } from "@/contexts/POSContext";
7
+ import {
8
+ ShoppingCart,
9
+ Utensils,
10
+ Package,
11
+ Receipt,
12
+ Tag,
13
+ BarChart,
14
+ Users,
15
+ Settings
16
+ } from "lucide-react";
17
+ import { Link, useLocation } from "wouter";
18
+
19
+ interface SidebarProps {
20
+ className?: string;
21
+ }
22
+
23
+ export function Sidebar({ className }: SidebarProps) {
24
+ const { user } = useAuth();
25
+ const { t } = useTranslation();
26
+ const { state } = usePOS();
27
+ const [location] = useLocation();
28
+
29
+ const navigation = [
30
+ {
31
+ name: t('nav.pos'),
32
+ href: "/pos",
33
+ icon: ShoppingCart,
34
+ current: location === "/pos" || location === "/",
35
+ },
36
+ {
37
+ name: t('nav.table_service'),
38
+ href: "/table-service",
39
+ icon: Utensils,
40
+ current: location === "/table-service",
41
+ },
42
+ {
43
+ name: t('nav.inventory'),
44
+ href: "/inventory",
45
+ icon: Package,
46
+ current: location === "/inventory",
47
+ badge: state.lowStockProducts.length > 0 ? state.lowStockProducts.length : undefined,
48
+ },
49
+ {
50
+ name: t('nav.transactions'),
51
+ href: "/transactions",
52
+ icon: Receipt,
53
+ current: location === "/transactions",
54
+ },
55
+ {
56
+ name: t('nav.promotions'),
57
+ href: "/promotions",
58
+ icon: Tag,
59
+ current: location === "/promotions",
60
+ },
61
+ {
62
+ name: t('nav.reports'),
63
+ href: "/reports",
64
+ icon: BarChart,
65
+ current: location === "/reports",
66
+ },
67
+ ];
68
+
69
+ const managerNavigation = [
70
+ {
71
+ name: t('nav.staff_management'),
72
+ href: "/staff",
73
+ icon: Users,
74
+ current: location === "/staff",
75
+ },
76
+ {
77
+ name: t('nav.settings'),
78
+ href: "/settings",
79
+ icon: Settings,
80
+ current: location === "/settings",
81
+ },
82
+ ];
83
+
84
+ const isManager = user?.role === "manager" || user?.role === "admin";
85
+
86
+ return (
87
+ <aside className={cn("w-64 bg-white shadow-lg border-r border-gray-200", className)}>
88
+ <nav className="p-4 space-y-2">
89
+ {navigation.map((item) => {
90
+ const Icon = item.icon;
91
+ return (
92
+ <Link key={item.name} href={item.href}>
93
+ <Button
94
+ variant={item.current ? "default" : "ghost"}
95
+ className={cn(
96
+ "w-full justify-start",
97
+ item.current && "bg-primary text-primary-foreground"
98
+ )}
99
+ >
100
+ <Icon className="mr-3 h-5 w-5" />
101
+ {item.name}
102
+ {item.badge && (
103
+ <Badge variant="destructive" className="ml-auto">
104
+ {item.badge}
105
+ </Badge>
106
+ )}
107
+ </Button>
108
+ </Link>
109
+ );
110
+ })}
111
+
112
+ {/* Manager Only Section */}
113
+ {isManager && (
114
+ <>
115
+ <div className="border-t pt-4 mt-4">
116
+ <p className="text-xs text-gray-500 px-4 mb-2 font-medium">
117
+ {t('nav.manager')}
118
+ </p>
119
+ {managerNavigation.map((item) => {
120
+ const Icon = item.icon;
121
+ return (
122
+ <Link key={item.name} href={item.href}>
123
+ <Button
124
+ variant={item.current ? "default" : "ghost"}
125
+ className={cn(
126
+ "w-full justify-start",
127
+ item.current && "bg-primary text-primary-foreground"
128
+ )}
129
+ >
130
+ <Icon className="mr-3 h-5 w-5" />
131
+ {item.name}
132
+ </Button>
133
+ </Link>
134
+ );
135
+ })}
136
+ </div>
137
+ </>
138
+ )}
139
+ </nav>
140
+ </aside>
141
+ );
142
+ }
QatarPOS/client/src/components/ui/accordion.tsx ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import * as AccordionPrimitive from "@radix-ui/react-accordion"
3
+ import { ChevronDown } from "lucide-react"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ const Accordion = AccordionPrimitive.Root
8
+
9
+ const AccordionItem = React.forwardRef<
10
+ React.ElementRef<typeof AccordionPrimitive.Item>,
11
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
12
+ >(({ className, ...props }, ref) => (
13
+ <AccordionPrimitive.Item
14
+ ref={ref}
15
+ className={cn("border-b", className)}
16
+ {...props}
17
+ />
18
+ ))
19
+ AccordionItem.displayName = "AccordionItem"
20
+
21
+ const AccordionTrigger = React.forwardRef<
22
+ React.ElementRef<typeof AccordionPrimitive.Trigger>,
23
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
24
+ >(({ className, children, ...props }, ref) => (
25
+ <AccordionPrimitive.Header className="flex">
26
+ <AccordionPrimitive.Trigger
27
+ ref={ref}
28
+ className={cn(
29
+ "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
30
+ className
31
+ )}
32
+ {...props}
33
+ >
34
+ {children}
35
+ <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
36
+ </AccordionPrimitive.Trigger>
37
+ </AccordionPrimitive.Header>
38
+ ))
39
+ AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
40
+
41
+ const AccordionContent = React.forwardRef<
42
+ React.ElementRef<typeof AccordionPrimitive.Content>,
43
+ React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
44
+ >(({ className, children, ...props }, ref) => (
45
+ <AccordionPrimitive.Content
46
+ ref={ref}
47
+ className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
48
+ {...props}
49
+ >
50
+ <div className={cn("pb-4 pt-0", className)}>{children}</div>
51
+ </AccordionPrimitive.Content>
52
+ ))
53
+
54
+ AccordionContent.displayName = AccordionPrimitive.Content.displayName
55
+
56
+ export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
QatarPOS/client/src/components/ui/alert-dialog.tsx ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
3
+
4
+ import { cn } from "@/lib/utils"
5
+ import { buttonVariants } from "@/components/ui/button"
6
+
7
+ const AlertDialog = AlertDialogPrimitive.Root
8
+
9
+ const AlertDialogTrigger = AlertDialogPrimitive.Trigger
10
+
11
+ const AlertDialogPortal = AlertDialogPrimitive.Portal
12
+
13
+ const AlertDialogOverlay = React.forwardRef<
14
+ React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
15
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
16
+ >(({ className, ...props }, ref) => (
17
+ <AlertDialogPrimitive.Overlay
18
+ className={cn(
19
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
20
+ className
21
+ )}
22
+ {...props}
23
+ ref={ref}
24
+ />
25
+ ))
26
+ AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
27
+
28
+ const AlertDialogContent = React.forwardRef<
29
+ React.ElementRef<typeof AlertDialogPrimitive.Content>,
30
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
31
+ >(({ className, ...props }, ref) => (
32
+ <AlertDialogPortal>
33
+ <AlertDialogOverlay />
34
+ <AlertDialogPrimitive.Content
35
+ ref={ref}
36
+ className={cn(
37
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
38
+ className
39
+ )}
40
+ {...props}
41
+ />
42
+ </AlertDialogPortal>
43
+ ))
44
+ AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
45
+
46
+ const AlertDialogHeader = ({
47
+ className,
48
+ ...props
49
+ }: React.HTMLAttributes<HTMLDivElement>) => (
50
+ <div
51
+ className={cn(
52
+ "flex flex-col space-y-2 text-center sm:text-left",
53
+ className
54
+ )}
55
+ {...props}
56
+ />
57
+ )
58
+ AlertDialogHeader.displayName = "AlertDialogHeader"
59
+
60
+ const AlertDialogFooter = ({
61
+ className,
62
+ ...props
63
+ }: React.HTMLAttributes<HTMLDivElement>) => (
64
+ <div
65
+ className={cn(
66
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
67
+ className
68
+ )}
69
+ {...props}
70
+ />
71
+ )
72
+ AlertDialogFooter.displayName = "AlertDialogFooter"
73
+
74
+ const AlertDialogTitle = React.forwardRef<
75
+ React.ElementRef<typeof AlertDialogPrimitive.Title>,
76
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
77
+ >(({ className, ...props }, ref) => (
78
+ <AlertDialogPrimitive.Title
79
+ ref={ref}
80
+ className={cn("text-lg font-semibold", className)}
81
+ {...props}
82
+ />
83
+ ))
84
+ AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
85
+
86
+ const AlertDialogDescription = React.forwardRef<
87
+ React.ElementRef<typeof AlertDialogPrimitive.Description>,
88
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
89
+ >(({ className, ...props }, ref) => (
90
+ <AlertDialogPrimitive.Description
91
+ ref={ref}
92
+ className={cn("text-sm text-muted-foreground", className)}
93
+ {...props}
94
+ />
95
+ ))
96
+ AlertDialogDescription.displayName =
97
+ AlertDialogPrimitive.Description.displayName
98
+
99
+ const AlertDialogAction = React.forwardRef<
100
+ React.ElementRef<typeof AlertDialogPrimitive.Action>,
101
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
102
+ >(({ className, ...props }, ref) => (
103
+ <AlertDialogPrimitive.Action
104
+ ref={ref}
105
+ className={cn(buttonVariants(), className)}
106
+ {...props}
107
+ />
108
+ ))
109
+ AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
110
+
111
+ const AlertDialogCancel = React.forwardRef<
112
+ React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
113
+ React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
114
+ >(({ className, ...props }, ref) => (
115
+ <AlertDialogPrimitive.Cancel
116
+ ref={ref}
117
+ className={cn(
118
+ buttonVariants({ variant: "outline" }),
119
+ "mt-2 sm:mt-0",
120
+ className
121
+ )}
122
+ {...props}
123
+ />
124
+ ))
125
+ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
126
+
127
+ export {
128
+ AlertDialog,
129
+ AlertDialogPortal,
130
+ AlertDialogOverlay,
131
+ AlertDialogTrigger,
132
+ AlertDialogContent,
133
+ AlertDialogHeader,
134
+ AlertDialogFooter,
135
+ AlertDialogTitle,
136
+ AlertDialogDescription,
137
+ AlertDialogAction,
138
+ AlertDialogCancel,
139
+ }
QatarPOS/client/src/components/ui/alert.tsx ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ const alertVariants = cva(
7
+ "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default: "bg-background text-foreground",
12
+ destructive:
13
+ "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
14
+ },
15
+ },
16
+ defaultVariants: {
17
+ variant: "default",
18
+ },
19
+ }
20
+ )
21
+
22
+ const Alert = React.forwardRef<
23
+ HTMLDivElement,
24
+ React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
25
+ >(({ className, variant, ...props }, ref) => (
26
+ <div
27
+ ref={ref}
28
+ role="alert"
29
+ className={cn(alertVariants({ variant }), className)}
30
+ {...props}
31
+ />
32
+ ))
33
+ Alert.displayName = "Alert"
34
+
35
+ const AlertTitle = React.forwardRef<
36
+ HTMLParagraphElement,
37
+ React.HTMLAttributes<HTMLHeadingElement>
38
+ >(({ className, ...props }, ref) => (
39
+ <h5
40
+ ref={ref}
41
+ className={cn("mb-1 font-medium leading-none tracking-tight", className)}
42
+ {...props}
43
+ />
44
+ ))
45
+ AlertTitle.displayName = "AlertTitle"
46
+
47
+ const AlertDescription = React.forwardRef<
48
+ HTMLParagraphElement,
49
+ React.HTMLAttributes<HTMLParagraphElement>
50
+ >(({ className, ...props }, ref) => (
51
+ <div
52
+ ref={ref}
53
+ className={cn("text-sm [&_p]:leading-relaxed", className)}
54
+ {...props}
55
+ />
56
+ ))
57
+ AlertDescription.displayName = "AlertDescription"
58
+
59
+ export { Alert, AlertTitle, AlertDescription }
QatarPOS/client/src/components/ui/aspect-ratio.tsx ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
2
+
3
+ const AspectRatio = AspectRatioPrimitive.Root
4
+
5
+ export { AspectRatio }
QatarPOS/client/src/components/ui/avatar.tsx ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as AvatarPrimitive from "@radix-ui/react-avatar"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const Avatar = React.forwardRef<
9
+ React.ElementRef<typeof AvatarPrimitive.Root>,
10
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
11
+ >(({ className, ...props }, ref) => (
12
+ <AvatarPrimitive.Root
13
+ ref={ref}
14
+ className={cn(
15
+ "relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
16
+ className
17
+ )}
18
+ {...props}
19
+ />
20
+ ))
21
+ Avatar.displayName = AvatarPrimitive.Root.displayName
22
+
23
+ const AvatarImage = React.forwardRef<
24
+ React.ElementRef<typeof AvatarPrimitive.Image>,
25
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
26
+ >(({ className, ...props }, ref) => (
27
+ <AvatarPrimitive.Image
28
+ ref={ref}
29
+ className={cn("aspect-square h-full w-full", className)}
30
+ {...props}
31
+ />
32
+ ))
33
+ AvatarImage.displayName = AvatarPrimitive.Image.displayName
34
+
35
+ const AvatarFallback = React.forwardRef<
36
+ React.ElementRef<typeof AvatarPrimitive.Fallback>,
37
+ React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
38
+ >(({ className, ...props }, ref) => (
39
+ <AvatarPrimitive.Fallback
40
+ ref={ref}
41
+ className={cn(
42
+ "flex h-full w-full items-center justify-center rounded-full bg-muted",
43
+ className
44
+ )}
45
+ {...props}
46
+ />
47
+ ))
48
+ AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
49
+
50
+ export { Avatar, AvatarImage, AvatarFallback }
QatarPOS/client/src/components/ui/badge.tsx ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ const badgeVariants = cva(
7
+ "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8
+ {
9
+ variants: {
10
+ variant: {
11
+ default:
12
+ "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
13
+ secondary:
14
+ "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
15
+ destructive:
16
+ "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
17
+ outline: "text-foreground",
18
+ },
19
+ },
20
+ defaultVariants: {
21
+ variant: "default",
22
+ },
23
+ }
24
+ )
25
+
26
+ export interface BadgeProps
27
+ extends React.HTMLAttributes<HTMLDivElement>,
28
+ VariantProps<typeof badgeVariants> {}
29
+
30
+ function Badge({ className, variant, ...props }: BadgeProps) {
31
+ return (
32
+ <div className={cn(badgeVariants({ variant }), className)} {...props} />
33
+ )
34
+ }
35
+
36
+ export { Badge, badgeVariants }
QatarPOS/client/src/components/ui/breadcrumb.tsx ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import { Slot } from "@radix-ui/react-slot"
3
+ import { ChevronRight, MoreHorizontal } from "lucide-react"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ const Breadcrumb = React.forwardRef<
8
+ HTMLElement,
9
+ React.ComponentPropsWithoutRef<"nav"> & {
10
+ separator?: React.ReactNode
11
+ }
12
+ >(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />)
13
+ Breadcrumb.displayName = "Breadcrumb"
14
+
15
+ const BreadcrumbList = React.forwardRef<
16
+ HTMLOListElement,
17
+ React.ComponentPropsWithoutRef<"ol">
18
+ >(({ className, ...props }, ref) => (
19
+ <ol
20
+ ref={ref}
21
+ className={cn(
22
+ "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
23
+ className
24
+ )}
25
+ {...props}
26
+ />
27
+ ))
28
+ BreadcrumbList.displayName = "BreadcrumbList"
29
+
30
+ const BreadcrumbItem = React.forwardRef<
31
+ HTMLLIElement,
32
+ React.ComponentPropsWithoutRef<"li">
33
+ >(({ className, ...props }, ref) => (
34
+ <li
35
+ ref={ref}
36
+ className={cn("inline-flex items-center gap-1.5", className)}
37
+ {...props}
38
+ />
39
+ ))
40
+ BreadcrumbItem.displayName = "BreadcrumbItem"
41
+
42
+ const BreadcrumbLink = React.forwardRef<
43
+ HTMLAnchorElement,
44
+ React.ComponentPropsWithoutRef<"a"> & {
45
+ asChild?: boolean
46
+ }
47
+ >(({ asChild, className, ...props }, ref) => {
48
+ const Comp = asChild ? Slot : "a"
49
+
50
+ return (
51
+ <Comp
52
+ ref={ref}
53
+ className={cn("transition-colors hover:text-foreground", className)}
54
+ {...props}
55
+ />
56
+ )
57
+ })
58
+ BreadcrumbLink.displayName = "BreadcrumbLink"
59
+
60
+ const BreadcrumbPage = React.forwardRef<
61
+ HTMLSpanElement,
62
+ React.ComponentPropsWithoutRef<"span">
63
+ >(({ className, ...props }, ref) => (
64
+ <span
65
+ ref={ref}
66
+ role="link"
67
+ aria-disabled="true"
68
+ aria-current="page"
69
+ className={cn("font-normal text-foreground", className)}
70
+ {...props}
71
+ />
72
+ ))
73
+ BreadcrumbPage.displayName = "BreadcrumbPage"
74
+
75
+ const BreadcrumbSeparator = ({
76
+ children,
77
+ className,
78
+ ...props
79
+ }: React.ComponentProps<"li">) => (
80
+ <li
81
+ role="presentation"
82
+ aria-hidden="true"
83
+ className={cn("[&>svg]:w-3.5 [&>svg]:h-3.5", className)}
84
+ {...props}
85
+ >
86
+ {children ?? <ChevronRight />}
87
+ </li>
88
+ )
89
+ BreadcrumbSeparator.displayName = "BreadcrumbSeparator"
90
+
91
+ const BreadcrumbEllipsis = ({
92
+ className,
93
+ ...props
94
+ }: React.ComponentProps<"span">) => (
95
+ <span
96
+ role="presentation"
97
+ aria-hidden="true"
98
+ className={cn("flex h-9 w-9 items-center justify-center", className)}
99
+ {...props}
100
+ >
101
+ <MoreHorizontal className="h-4 w-4" />
102
+ <span className="sr-only">More</span>
103
+ </span>
104
+ )
105
+ BreadcrumbEllipsis.displayName = "BreadcrumbElipssis"
106
+
107
+ export {
108
+ Breadcrumb,
109
+ BreadcrumbList,
110
+ BreadcrumbItem,
111
+ BreadcrumbLink,
112
+ BreadcrumbPage,
113
+ BreadcrumbSeparator,
114
+ BreadcrumbEllipsis,
115
+ }
QatarPOS/client/src/components/ui/button.tsx ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import { Slot } from "@radix-ui/react-slot"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ const buttonVariants = cva(
8
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
9
+ {
10
+ variants: {
11
+ variant: {
12
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
13
+ destructive:
14
+ "bg-destructive text-destructive-foreground hover:bg-destructive/90",
15
+ outline:
16
+ "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
17
+ secondary:
18
+ "bg-secondary text-secondary-foreground hover:bg-secondary/80",
19
+ ghost: "hover:bg-accent hover:text-accent-foreground",
20
+ link: "text-primary underline-offset-4 hover:underline",
21
+ },
22
+ size: {
23
+ default: "h-10 px-4 py-2",
24
+ sm: "h-9 rounded-md px-3",
25
+ lg: "h-11 rounded-md px-8",
26
+ icon: "h-10 w-10",
27
+ },
28
+ },
29
+ defaultVariants: {
30
+ variant: "default",
31
+ size: "default",
32
+ },
33
+ }
34
+ )
35
+
36
+ export interface ButtonProps
37
+ extends React.ButtonHTMLAttributes<HTMLButtonElement>,
38
+ VariantProps<typeof buttonVariants> {
39
+ asChild?: boolean
40
+ }
41
+
42
+ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
43
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
44
+ const Comp = asChild ? Slot : "button"
45
+ return (
46
+ <Comp
47
+ className={cn(buttonVariants({ variant, size, className }))}
48
+ ref={ref}
49
+ {...props}
50
+ />
51
+ )
52
+ }
53
+ )
54
+ Button.displayName = "Button"
55
+
56
+ export { Button, buttonVariants }
QatarPOS/client/src/components/ui/calendar.tsx ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import { ChevronLeft, ChevronRight } from "lucide-react"
3
+ import { DayPicker } from "react-day-picker"
4
+
5
+ import { cn } from "@/lib/utils"
6
+ import { buttonVariants } from "@/components/ui/button"
7
+
8
+ export type CalendarProps = React.ComponentProps<typeof DayPicker>
9
+
10
+ function Calendar({
11
+ className,
12
+ classNames,
13
+ showOutsideDays = true,
14
+ ...props
15
+ }: CalendarProps) {
16
+ return (
17
+ <DayPicker
18
+ showOutsideDays={showOutsideDays}
19
+ className={cn("p-3", className)}
20
+ classNames={{
21
+ months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
22
+ month: "space-y-4",
23
+ caption: "flex justify-center pt-1 relative items-center",
24
+ caption_label: "text-sm font-medium",
25
+ nav: "space-x-1 flex items-center",
26
+ nav_button: cn(
27
+ buttonVariants({ variant: "outline" }),
28
+ "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
29
+ ),
30
+ nav_button_previous: "absolute left-1",
31
+ nav_button_next: "absolute right-1",
32
+ table: "w-full border-collapse space-y-1",
33
+ head_row: "flex",
34
+ head_cell:
35
+ "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
36
+ row: "flex w-full mt-2",
37
+ cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
38
+ day: cn(
39
+ buttonVariants({ variant: "ghost" }),
40
+ "h-9 w-9 p-0 font-normal aria-selected:opacity-100"
41
+ ),
42
+ day_range_end: "day-range-end",
43
+ day_selected:
44
+ "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
45
+ day_today: "bg-accent text-accent-foreground",
46
+ day_outside:
47
+ "day-outside text-muted-foreground aria-selected:bg-accent/50 aria-selected:text-muted-foreground",
48
+ day_disabled: "text-muted-foreground opacity-50",
49
+ day_range_middle:
50
+ "aria-selected:bg-accent aria-selected:text-accent-foreground",
51
+ day_hidden: "invisible",
52
+ ...classNames,
53
+ }}
54
+ components={{
55
+ IconLeft: ({ className, ...props }) => (
56
+ <ChevronLeft className={cn("h-4 w-4", className)} {...props} />
57
+ ),
58
+ IconRight: ({ className, ...props }) => (
59
+ <ChevronRight className={cn("h-4 w-4", className)} {...props} />
60
+ ),
61
+ }}
62
+ {...props}
63
+ />
64
+ )
65
+ }
66
+ Calendar.displayName = "Calendar"
67
+
68
+ export { Calendar }
QatarPOS/client/src/components/ui/card.tsx ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@/lib/utils"
4
+
5
+ const Card = React.forwardRef<
6
+ HTMLDivElement,
7
+ React.HTMLAttributes<HTMLDivElement>
8
+ >(({ className, ...props }, ref) => (
9
+ <div
10
+ ref={ref}
11
+ className={cn(
12
+ "rounded-lg border bg-card text-card-foreground shadow-sm",
13
+ className
14
+ )}
15
+ {...props}
16
+ />
17
+ ))
18
+ Card.displayName = "Card"
19
+
20
+ const CardHeader = React.forwardRef<
21
+ HTMLDivElement,
22
+ React.HTMLAttributes<HTMLDivElement>
23
+ >(({ className, ...props }, ref) => (
24
+ <div
25
+ ref={ref}
26
+ className={cn("flex flex-col space-y-1.5 p-6", className)}
27
+ {...props}
28
+ />
29
+ ))
30
+ CardHeader.displayName = "CardHeader"
31
+
32
+ const CardTitle = React.forwardRef<
33
+ HTMLDivElement,
34
+ React.HTMLAttributes<HTMLDivElement>
35
+ >(({ className, ...props }, ref) => (
36
+ <div
37
+ ref={ref}
38
+ className={cn(
39
+ "text-2xl font-semibold leading-none tracking-tight",
40
+ className
41
+ )}
42
+ {...props}
43
+ />
44
+ ))
45
+ CardTitle.displayName = "CardTitle"
46
+
47
+ const CardDescription = React.forwardRef<
48
+ HTMLDivElement,
49
+ React.HTMLAttributes<HTMLDivElement>
50
+ >(({ className, ...props }, ref) => (
51
+ <div
52
+ ref={ref}
53
+ className={cn("text-sm text-muted-foreground", className)}
54
+ {...props}
55
+ />
56
+ ))
57
+ CardDescription.displayName = "CardDescription"
58
+
59
+ const CardContent = React.forwardRef<
60
+ HTMLDivElement,
61
+ React.HTMLAttributes<HTMLDivElement>
62
+ >(({ className, ...props }, ref) => (
63
+ <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
64
+ ))
65
+ CardContent.displayName = "CardContent"
66
+
67
+ const CardFooter = React.forwardRef<
68
+ HTMLDivElement,
69
+ React.HTMLAttributes<HTMLDivElement>
70
+ >(({ className, ...props }, ref) => (
71
+ <div
72
+ ref={ref}
73
+ className={cn("flex items-center p-6 pt-0", className)}
74
+ {...props}
75
+ />
76
+ ))
77
+ CardFooter.displayName = "CardFooter"
78
+
79
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
QatarPOS/client/src/components/ui/carousel.tsx ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import useEmblaCarousel, {
3
+ type UseEmblaCarouselType,
4
+ } from "embla-carousel-react"
5
+ import { ArrowLeft, ArrowRight } from "lucide-react"
6
+
7
+ import { cn } from "@/lib/utils"
8
+ import { Button } from "@/components/ui/button"
9
+
10
+ type CarouselApi = UseEmblaCarouselType[1]
11
+ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
12
+ type CarouselOptions = UseCarouselParameters[0]
13
+ type CarouselPlugin = UseCarouselParameters[1]
14
+
15
+ type CarouselProps = {
16
+ opts?: CarouselOptions
17
+ plugins?: CarouselPlugin
18
+ orientation?: "horizontal" | "vertical"
19
+ setApi?: (api: CarouselApi) => void
20
+ }
21
+
22
+ type CarouselContextProps = {
23
+ carouselRef: ReturnType<typeof useEmblaCarousel>[0]
24
+ api: ReturnType<typeof useEmblaCarousel>[1]
25
+ scrollPrev: () => void
26
+ scrollNext: () => void
27
+ canScrollPrev: boolean
28
+ canScrollNext: boolean
29
+ } & CarouselProps
30
+
31
+ const CarouselContext = React.createContext<CarouselContextProps | null>(null)
32
+
33
+ function useCarousel() {
34
+ const context = React.useContext(CarouselContext)
35
+
36
+ if (!context) {
37
+ throw new Error("useCarousel must be used within a <Carousel />")
38
+ }
39
+
40
+ return context
41
+ }
42
+
43
+ const Carousel = React.forwardRef<
44
+ HTMLDivElement,
45
+ React.HTMLAttributes<HTMLDivElement> & CarouselProps
46
+ >(
47
+ (
48
+ {
49
+ orientation = "horizontal",
50
+ opts,
51
+ setApi,
52
+ plugins,
53
+ className,
54
+ children,
55
+ ...props
56
+ },
57
+ ref
58
+ ) => {
59
+ const [carouselRef, api] = useEmblaCarousel(
60
+ {
61
+ ...opts,
62
+ axis: orientation === "horizontal" ? "x" : "y",
63
+ },
64
+ plugins
65
+ )
66
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false)
67
+ const [canScrollNext, setCanScrollNext] = React.useState(false)
68
+
69
+ const onSelect = React.useCallback((api: CarouselApi) => {
70
+ if (!api) {
71
+ return
72
+ }
73
+
74
+ setCanScrollPrev(api.canScrollPrev())
75
+ setCanScrollNext(api.canScrollNext())
76
+ }, [])
77
+
78
+ const scrollPrev = React.useCallback(() => {
79
+ api?.scrollPrev()
80
+ }, [api])
81
+
82
+ const scrollNext = React.useCallback(() => {
83
+ api?.scrollNext()
84
+ }, [api])
85
+
86
+ const handleKeyDown = React.useCallback(
87
+ (event: React.KeyboardEvent<HTMLDivElement>) => {
88
+ if (event.key === "ArrowLeft") {
89
+ event.preventDefault()
90
+ scrollPrev()
91
+ } else if (event.key === "ArrowRight") {
92
+ event.preventDefault()
93
+ scrollNext()
94
+ }
95
+ },
96
+ [scrollPrev, scrollNext]
97
+ )
98
+
99
+ React.useEffect(() => {
100
+ if (!api || !setApi) {
101
+ return
102
+ }
103
+
104
+ setApi(api)
105
+ }, [api, setApi])
106
+
107
+ React.useEffect(() => {
108
+ if (!api) {
109
+ return
110
+ }
111
+
112
+ onSelect(api)
113
+ api.on("reInit", onSelect)
114
+ api.on("select", onSelect)
115
+
116
+ return () => {
117
+ api?.off("select", onSelect)
118
+ }
119
+ }, [api, onSelect])
120
+
121
+ return (
122
+ <CarouselContext.Provider
123
+ value={{
124
+ carouselRef,
125
+ api: api,
126
+ opts,
127
+ orientation:
128
+ orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
129
+ scrollPrev,
130
+ scrollNext,
131
+ canScrollPrev,
132
+ canScrollNext,
133
+ }}
134
+ >
135
+ <div
136
+ ref={ref}
137
+ onKeyDownCapture={handleKeyDown}
138
+ className={cn("relative", className)}
139
+ role="region"
140
+ aria-roledescription="carousel"
141
+ {...props}
142
+ >
143
+ {children}
144
+ </div>
145
+ </CarouselContext.Provider>
146
+ )
147
+ }
148
+ )
149
+ Carousel.displayName = "Carousel"
150
+
151
+ const CarouselContent = React.forwardRef<
152
+ HTMLDivElement,
153
+ React.HTMLAttributes<HTMLDivElement>
154
+ >(({ className, ...props }, ref) => {
155
+ const { carouselRef, orientation } = useCarousel()
156
+
157
+ return (
158
+ <div ref={carouselRef} className="overflow-hidden">
159
+ <div
160
+ ref={ref}
161
+ className={cn(
162
+ "flex",
163
+ orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
164
+ className
165
+ )}
166
+ {...props}
167
+ />
168
+ </div>
169
+ )
170
+ })
171
+ CarouselContent.displayName = "CarouselContent"
172
+
173
+ const CarouselItem = React.forwardRef<
174
+ HTMLDivElement,
175
+ React.HTMLAttributes<HTMLDivElement>
176
+ >(({ className, ...props }, ref) => {
177
+ const { orientation } = useCarousel()
178
+
179
+ return (
180
+ <div
181
+ ref={ref}
182
+ role="group"
183
+ aria-roledescription="slide"
184
+ className={cn(
185
+ "min-w-0 shrink-0 grow-0 basis-full",
186
+ orientation === "horizontal" ? "pl-4" : "pt-4",
187
+ className
188
+ )}
189
+ {...props}
190
+ />
191
+ )
192
+ })
193
+ CarouselItem.displayName = "CarouselItem"
194
+
195
+ const CarouselPrevious = React.forwardRef<
196
+ HTMLButtonElement,
197
+ React.ComponentProps<typeof Button>
198
+ >(({ className, variant = "outline", size = "icon", ...props }, ref) => {
199
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel()
200
+
201
+ return (
202
+ <Button
203
+ ref={ref}
204
+ variant={variant}
205
+ size={size}
206
+ className={cn(
207
+ "absolute h-8 w-8 rounded-full",
208
+ orientation === "horizontal"
209
+ ? "-left-12 top-1/2 -translate-y-1/2"
210
+ : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
211
+ className
212
+ )}
213
+ disabled={!canScrollPrev}
214
+ onClick={scrollPrev}
215
+ {...props}
216
+ >
217
+ <ArrowLeft className="h-4 w-4" />
218
+ <span className="sr-only">Previous slide</span>
219
+ </Button>
220
+ )
221
+ })
222
+ CarouselPrevious.displayName = "CarouselPrevious"
223
+
224
+ const CarouselNext = React.forwardRef<
225
+ HTMLButtonElement,
226
+ React.ComponentProps<typeof Button>
227
+ >(({ className, variant = "outline", size = "icon", ...props }, ref) => {
228
+ const { orientation, scrollNext, canScrollNext } = useCarousel()
229
+
230
+ return (
231
+ <Button
232
+ ref={ref}
233
+ variant={variant}
234
+ size={size}
235
+ className={cn(
236
+ "absolute h-8 w-8 rounded-full",
237
+ orientation === "horizontal"
238
+ ? "-right-12 top-1/2 -translate-y-1/2"
239
+ : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
240
+ className
241
+ )}
242
+ disabled={!canScrollNext}
243
+ onClick={scrollNext}
244
+ {...props}
245
+ >
246
+ <ArrowRight className="h-4 w-4" />
247
+ <span className="sr-only">Next slide</span>
248
+ </Button>
249
+ )
250
+ })
251
+ CarouselNext.displayName = "CarouselNext"
252
+
253
+ export {
254
+ type CarouselApi,
255
+ Carousel,
256
+ CarouselContent,
257
+ CarouselItem,
258
+ CarouselPrevious,
259
+ CarouselNext,
260
+ }
QatarPOS/client/src/components/ui/chart.tsx ADDED
@@ -0,0 +1,365 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as RechartsPrimitive from "recharts"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ // Format: { THEME_NAME: CSS_SELECTOR }
9
+ const THEMES = { light: "", dark: ".dark" } as const
10
+
11
+ export type ChartConfig = {
12
+ [k in string]: {
13
+ label?: React.ReactNode
14
+ icon?: React.ComponentType
15
+ } & (
16
+ | { color?: string; theme?: never }
17
+ | { color?: never; theme: Record<keyof typeof THEMES, string> }
18
+ )
19
+ }
20
+
21
+ type ChartContextProps = {
22
+ config: ChartConfig
23
+ }
24
+
25
+ const ChartContext = React.createContext<ChartContextProps | null>(null)
26
+
27
+ function useChart() {
28
+ const context = React.useContext(ChartContext)
29
+
30
+ if (!context) {
31
+ throw new Error("useChart must be used within a <ChartContainer />")
32
+ }
33
+
34
+ return context
35
+ }
36
+
37
+ const ChartContainer = React.forwardRef<
38
+ HTMLDivElement,
39
+ React.ComponentProps<"div"> & {
40
+ config: ChartConfig
41
+ children: React.ComponentProps<
42
+ typeof RechartsPrimitive.ResponsiveContainer
43
+ >["children"]
44
+ }
45
+ >(({ id, className, children, config, ...props }, ref) => {
46
+ const uniqueId = React.useId()
47
+ const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`
48
+
49
+ return (
50
+ <ChartContext.Provider value={{ config }}>
51
+ <div
52
+ data-chart={chartId}
53
+ ref={ref}
54
+ className={cn(
55
+ "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
56
+ className
57
+ )}
58
+ {...props}
59
+ >
60
+ <ChartStyle id={chartId} config={config} />
61
+ <RechartsPrimitive.ResponsiveContainer>
62
+ {children}
63
+ </RechartsPrimitive.ResponsiveContainer>
64
+ </div>
65
+ </ChartContext.Provider>
66
+ )
67
+ })
68
+ ChartContainer.displayName = "Chart"
69
+
70
+ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
71
+ const colorConfig = Object.entries(config).filter(
72
+ ([, config]) => config.theme || config.color
73
+ )
74
+
75
+ if (!colorConfig.length) {
76
+ return null
77
+ }
78
+
79
+ return (
80
+ <style
81
+ dangerouslySetInnerHTML={{
82
+ __html: Object.entries(THEMES)
83
+ .map(
84
+ ([theme, prefix]) => `
85
+ ${prefix} [data-chart=${id}] {
86
+ ${colorConfig
87
+ .map(([key, itemConfig]) => {
88
+ const color =
89
+ itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
90
+ itemConfig.color
91
+ return color ? ` --color-${key}: ${color};` : null
92
+ })
93
+ .join("\n")}
94
+ }
95
+ `
96
+ )
97
+ .join("\n"),
98
+ }}
99
+ />
100
+ )
101
+ }
102
+
103
+ const ChartTooltip = RechartsPrimitive.Tooltip
104
+
105
+ const ChartTooltipContent = React.forwardRef<
106
+ HTMLDivElement,
107
+ React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
108
+ React.ComponentProps<"div"> & {
109
+ hideLabel?: boolean
110
+ hideIndicator?: boolean
111
+ indicator?: "line" | "dot" | "dashed"
112
+ nameKey?: string
113
+ labelKey?: string
114
+ }
115
+ >(
116
+ (
117
+ {
118
+ active,
119
+ payload,
120
+ className,
121
+ indicator = "dot",
122
+ hideLabel = false,
123
+ hideIndicator = false,
124
+ label,
125
+ labelFormatter,
126
+ labelClassName,
127
+ formatter,
128
+ color,
129
+ nameKey,
130
+ labelKey,
131
+ },
132
+ ref
133
+ ) => {
134
+ const { config } = useChart()
135
+
136
+ const tooltipLabel = React.useMemo(() => {
137
+ if (hideLabel || !payload?.length) {
138
+ return null
139
+ }
140
+
141
+ const [item] = payload
142
+ const key = `${labelKey || item?.dataKey || item?.name || "value"}`
143
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
144
+ const value =
145
+ !labelKey && typeof label === "string"
146
+ ? config[label as keyof typeof config]?.label || label
147
+ : itemConfig?.label
148
+
149
+ if (labelFormatter) {
150
+ return (
151
+ <div className={cn("font-medium", labelClassName)}>
152
+ {labelFormatter(value, payload)}
153
+ </div>
154
+ )
155
+ }
156
+
157
+ if (!value) {
158
+ return null
159
+ }
160
+
161
+ return <div className={cn("font-medium", labelClassName)}>{value}</div>
162
+ }, [
163
+ label,
164
+ labelFormatter,
165
+ payload,
166
+ hideLabel,
167
+ labelClassName,
168
+ config,
169
+ labelKey,
170
+ ])
171
+
172
+ if (!active || !payload?.length) {
173
+ return null
174
+ }
175
+
176
+ const nestLabel = payload.length === 1 && indicator !== "dot"
177
+
178
+ return (
179
+ <div
180
+ ref={ref}
181
+ className={cn(
182
+ "grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
183
+ className
184
+ )}
185
+ >
186
+ {!nestLabel ? tooltipLabel : null}
187
+ <div className="grid gap-1.5">
188
+ {payload.map((item, index) => {
189
+ const key = `${nameKey || item.name || item.dataKey || "value"}`
190
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
191
+ const indicatorColor = color || item.payload.fill || item.color
192
+
193
+ return (
194
+ <div
195
+ key={item.dataKey}
196
+ className={cn(
197
+ "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
198
+ indicator === "dot" && "items-center"
199
+ )}
200
+ >
201
+ {formatter && item?.value !== undefined && item.name ? (
202
+ formatter(item.value, item.name, item, index, item.payload)
203
+ ) : (
204
+ <>
205
+ {itemConfig?.icon ? (
206
+ <itemConfig.icon />
207
+ ) : (
208
+ !hideIndicator && (
209
+ <div
210
+ className={cn(
211
+ "shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
212
+ {
213
+ "h-2.5 w-2.5": indicator === "dot",
214
+ "w-1": indicator === "line",
215
+ "w-0 border-[1.5px] border-dashed bg-transparent":
216
+ indicator === "dashed",
217
+ "my-0.5": nestLabel && indicator === "dashed",
218
+ }
219
+ )}
220
+ style={
221
+ {
222
+ "--color-bg": indicatorColor,
223
+ "--color-border": indicatorColor,
224
+ } as React.CSSProperties
225
+ }
226
+ />
227
+ )
228
+ )}
229
+ <div
230
+ className={cn(
231
+ "flex flex-1 justify-between leading-none",
232
+ nestLabel ? "items-end" : "items-center"
233
+ )}
234
+ >
235
+ <div className="grid gap-1.5">
236
+ {nestLabel ? tooltipLabel : null}
237
+ <span className="text-muted-foreground">
238
+ {itemConfig?.label || item.name}
239
+ </span>
240
+ </div>
241
+ {item.value && (
242
+ <span className="font-mono font-medium tabular-nums text-foreground">
243
+ {item.value.toLocaleString()}
244
+ </span>
245
+ )}
246
+ </div>
247
+ </>
248
+ )}
249
+ </div>
250
+ )
251
+ })}
252
+ </div>
253
+ </div>
254
+ )
255
+ }
256
+ )
257
+ ChartTooltipContent.displayName = "ChartTooltip"
258
+
259
+ const ChartLegend = RechartsPrimitive.Legend
260
+
261
+ const ChartLegendContent = React.forwardRef<
262
+ HTMLDivElement,
263
+ React.ComponentProps<"div"> &
264
+ Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
265
+ hideIcon?: boolean
266
+ nameKey?: string
267
+ }
268
+ >(
269
+ (
270
+ { className, hideIcon = false, payload, verticalAlign = "bottom", nameKey },
271
+ ref
272
+ ) => {
273
+ const { config } = useChart()
274
+
275
+ if (!payload?.length) {
276
+ return null
277
+ }
278
+
279
+ return (
280
+ <div
281
+ ref={ref}
282
+ className={cn(
283
+ "flex items-center justify-center gap-4",
284
+ verticalAlign === "top" ? "pb-3" : "pt-3",
285
+ className
286
+ )}
287
+ >
288
+ {payload.map((item) => {
289
+ const key = `${nameKey || item.dataKey || "value"}`
290
+ const itemConfig = getPayloadConfigFromPayload(config, item, key)
291
+
292
+ return (
293
+ <div
294
+ key={item.value}
295
+ className={cn(
296
+ "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
297
+ )}
298
+ >
299
+ {itemConfig?.icon && !hideIcon ? (
300
+ <itemConfig.icon />
301
+ ) : (
302
+ <div
303
+ className="h-2 w-2 shrink-0 rounded-[2px]"
304
+ style={{
305
+ backgroundColor: item.color,
306
+ }}
307
+ />
308
+ )}
309
+ {itemConfig?.label}
310
+ </div>
311
+ )
312
+ })}
313
+ </div>
314
+ )
315
+ }
316
+ )
317
+ ChartLegendContent.displayName = "ChartLegend"
318
+
319
+ // Helper to extract item config from a payload.
320
+ function getPayloadConfigFromPayload(
321
+ config: ChartConfig,
322
+ payload: unknown,
323
+ key: string
324
+ ) {
325
+ if (typeof payload !== "object" || payload === null) {
326
+ return undefined
327
+ }
328
+
329
+ const payloadPayload =
330
+ "payload" in payload &&
331
+ typeof payload.payload === "object" &&
332
+ payload.payload !== null
333
+ ? payload.payload
334
+ : undefined
335
+
336
+ let configLabelKey: string = key
337
+
338
+ if (
339
+ key in payload &&
340
+ typeof payload[key as keyof typeof payload] === "string"
341
+ ) {
342
+ configLabelKey = payload[key as keyof typeof payload] as string
343
+ } else if (
344
+ payloadPayload &&
345
+ key in payloadPayload &&
346
+ typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
347
+ ) {
348
+ configLabelKey = payloadPayload[
349
+ key as keyof typeof payloadPayload
350
+ ] as string
351
+ }
352
+
353
+ return configLabelKey in config
354
+ ? config[configLabelKey]
355
+ : config[key as keyof typeof config]
356
+ }
357
+
358
+ export {
359
+ ChartContainer,
360
+ ChartTooltip,
361
+ ChartTooltipContent,
362
+ ChartLegend,
363
+ ChartLegendContent,
364
+ ChartStyle,
365
+ }
QatarPOS/client/src/components/ui/checkbox.tsx ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox"
3
+ import { Check } from "lucide-react"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ const Checkbox = React.forwardRef<
8
+ React.ElementRef<typeof CheckboxPrimitive.Root>,
9
+ React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
10
+ >(({ className, ...props }, ref) => (
11
+ <CheckboxPrimitive.Root
12
+ ref={ref}
13
+ className={cn(
14
+ "peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
15
+ className
16
+ )}
17
+ {...props}
18
+ >
19
+ <CheckboxPrimitive.Indicator
20
+ className={cn("flex items-center justify-center text-current")}
21
+ >
22
+ <Check className="h-4 w-4" />
23
+ </CheckboxPrimitive.Indicator>
24
+ </CheckboxPrimitive.Root>
25
+ ))
26
+ Checkbox.displayName = CheckboxPrimitive.Root.displayName
27
+
28
+ export { Checkbox }
QatarPOS/client/src/components/ui/collapsible.tsx ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
4
+
5
+ const Collapsible = CollapsiblePrimitive.Root
6
+
7
+ const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger
8
+
9
+ const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent
10
+
11
+ export { Collapsible, CollapsibleTrigger, CollapsibleContent }
QatarPOS/client/src/components/ui/command.tsx ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import { type DialogProps } from "@radix-ui/react-dialog"
3
+ import { Command as CommandPrimitive } from "cmdk"
4
+ import { Search } from "lucide-react"
5
+
6
+ import { cn } from "@/lib/utils"
7
+ import { Dialog, DialogContent } from "@/components/ui/dialog"
8
+
9
+ const Command = React.forwardRef<
10
+ React.ElementRef<typeof CommandPrimitive>,
11
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive>
12
+ >(({ className, ...props }, ref) => (
13
+ <CommandPrimitive
14
+ ref={ref}
15
+ className={cn(
16
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
17
+ className
18
+ )}
19
+ {...props}
20
+ />
21
+ ))
22
+ Command.displayName = CommandPrimitive.displayName
23
+
24
+ const CommandDialog = ({ children, ...props }: DialogProps) => {
25
+ return (
26
+ <Dialog {...props}>
27
+ <DialogContent className="overflow-hidden p-0 shadow-lg">
28
+ <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
29
+ {children}
30
+ </Command>
31
+ </DialogContent>
32
+ </Dialog>
33
+ )
34
+ }
35
+
36
+ const CommandInput = React.forwardRef<
37
+ React.ElementRef<typeof CommandPrimitive.Input>,
38
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
39
+ >(({ className, ...props }, ref) => (
40
+ <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
41
+ <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
42
+ <CommandPrimitive.Input
43
+ ref={ref}
44
+ className={cn(
45
+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
46
+ className
47
+ )}
48
+ {...props}
49
+ />
50
+ </div>
51
+ ))
52
+
53
+ CommandInput.displayName = CommandPrimitive.Input.displayName
54
+
55
+ const CommandList = React.forwardRef<
56
+ React.ElementRef<typeof CommandPrimitive.List>,
57
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
58
+ >(({ className, ...props }, ref) => (
59
+ <CommandPrimitive.List
60
+ ref={ref}
61
+ className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
62
+ {...props}
63
+ />
64
+ ))
65
+
66
+ CommandList.displayName = CommandPrimitive.List.displayName
67
+
68
+ const CommandEmpty = React.forwardRef<
69
+ React.ElementRef<typeof CommandPrimitive.Empty>,
70
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
71
+ >((props, ref) => (
72
+ <CommandPrimitive.Empty
73
+ ref={ref}
74
+ className="py-6 text-center text-sm"
75
+ {...props}
76
+ />
77
+ ))
78
+
79
+ CommandEmpty.displayName = CommandPrimitive.Empty.displayName
80
+
81
+ const CommandGroup = React.forwardRef<
82
+ React.ElementRef<typeof CommandPrimitive.Group>,
83
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
84
+ >(({ className, ...props }, ref) => (
85
+ <CommandPrimitive.Group
86
+ ref={ref}
87
+ className={cn(
88
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
89
+ className
90
+ )}
91
+ {...props}
92
+ />
93
+ ))
94
+
95
+ CommandGroup.displayName = CommandPrimitive.Group.displayName
96
+
97
+ const CommandSeparator = React.forwardRef<
98
+ React.ElementRef<typeof CommandPrimitive.Separator>,
99
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
100
+ >(({ className, ...props }, ref) => (
101
+ <CommandPrimitive.Separator
102
+ ref={ref}
103
+ className={cn("-mx-1 h-px bg-border", className)}
104
+ {...props}
105
+ />
106
+ ))
107
+ CommandSeparator.displayName = CommandPrimitive.Separator.displayName
108
+
109
+ const CommandItem = React.forwardRef<
110
+ React.ElementRef<typeof CommandPrimitive.Item>,
111
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
112
+ >(({ className, ...props }, ref) => (
113
+ <CommandPrimitive.Item
114
+ ref={ref}
115
+ className={cn(
116
+ "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
117
+ className
118
+ )}
119
+ {...props}
120
+ />
121
+ ))
122
+
123
+ CommandItem.displayName = CommandPrimitive.Item.displayName
124
+
125
+ const CommandShortcut = ({
126
+ className,
127
+ ...props
128
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
129
+ return (
130
+ <span
131
+ className={cn(
132
+ "ml-auto text-xs tracking-widest text-muted-foreground",
133
+ className
134
+ )}
135
+ {...props}
136
+ />
137
+ )
138
+ }
139
+ CommandShortcut.displayName = "CommandShortcut"
140
+
141
+ export {
142
+ Command,
143
+ CommandDialog,
144
+ CommandInput,
145
+ CommandList,
146
+ CommandEmpty,
147
+ CommandGroup,
148
+ CommandItem,
149
+ CommandShortcut,
150
+ CommandSeparator,
151
+ }
QatarPOS/client/src/components/ui/context-menu.tsx ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
3
+ import { Check, ChevronRight, Circle } from "lucide-react"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ const ContextMenu = ContextMenuPrimitive.Root
8
+
9
+ const ContextMenuTrigger = ContextMenuPrimitive.Trigger
10
+
11
+ const ContextMenuGroup = ContextMenuPrimitive.Group
12
+
13
+ const ContextMenuPortal = ContextMenuPrimitive.Portal
14
+
15
+ const ContextMenuSub = ContextMenuPrimitive.Sub
16
+
17
+ const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
18
+
19
+ const ContextMenuSubTrigger = React.forwardRef<
20
+ React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
21
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
22
+ inset?: boolean
23
+ }
24
+ >(({ className, inset, children, ...props }, ref) => (
25
+ <ContextMenuPrimitive.SubTrigger
26
+ ref={ref}
27
+ className={cn(
28
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
29
+ inset && "pl-8",
30
+ className
31
+ )}
32
+ {...props}
33
+ >
34
+ {children}
35
+ <ChevronRight className="ml-auto h-4 w-4" />
36
+ </ContextMenuPrimitive.SubTrigger>
37
+ ))
38
+ ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
39
+
40
+ const ContextMenuSubContent = React.forwardRef<
41
+ React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
42
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
43
+ >(({ className, ...props }, ref) => (
44
+ <ContextMenuPrimitive.SubContent
45
+ ref={ref}
46
+ className={cn(
47
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",
48
+ className
49
+ )}
50
+ {...props}
51
+ />
52
+ ))
53
+ ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
54
+
55
+ const ContextMenuContent = React.forwardRef<
56
+ React.ElementRef<typeof ContextMenuPrimitive.Content>,
57
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
58
+ >(({ className, ...props }, ref) => (
59
+ <ContextMenuPrimitive.Portal>
60
+ <ContextMenuPrimitive.Content
61
+ ref={ref}
62
+ className={cn(
63
+ "z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",
64
+ className
65
+ )}
66
+ {...props}
67
+ />
68
+ </ContextMenuPrimitive.Portal>
69
+ ))
70
+ ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
71
+
72
+ const ContextMenuItem = React.forwardRef<
73
+ React.ElementRef<typeof ContextMenuPrimitive.Item>,
74
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
75
+ inset?: boolean
76
+ }
77
+ >(({ className, inset, ...props }, ref) => (
78
+ <ContextMenuPrimitive.Item
79
+ ref={ref}
80
+ className={cn(
81
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
82
+ inset && "pl-8",
83
+ className
84
+ )}
85
+ {...props}
86
+ />
87
+ ))
88
+ ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
89
+
90
+ const ContextMenuCheckboxItem = React.forwardRef<
91
+ React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
92
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
93
+ >(({ className, children, checked, ...props }, ref) => (
94
+ <ContextMenuPrimitive.CheckboxItem
95
+ ref={ref}
96
+ className={cn(
97
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
98
+ className
99
+ )}
100
+ checked={checked}
101
+ {...props}
102
+ >
103
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
104
+ <ContextMenuPrimitive.ItemIndicator>
105
+ <Check className="h-4 w-4" />
106
+ </ContextMenuPrimitive.ItemIndicator>
107
+ </span>
108
+ {children}
109
+ </ContextMenuPrimitive.CheckboxItem>
110
+ ))
111
+ ContextMenuCheckboxItem.displayName =
112
+ ContextMenuPrimitive.CheckboxItem.displayName
113
+
114
+ const ContextMenuRadioItem = React.forwardRef<
115
+ React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
116
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
117
+ >(({ className, children, ...props }, ref) => (
118
+ <ContextMenuPrimitive.RadioItem
119
+ ref={ref}
120
+ className={cn(
121
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
122
+ className
123
+ )}
124
+ {...props}
125
+ >
126
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
127
+ <ContextMenuPrimitive.ItemIndicator>
128
+ <Circle className="h-2 w-2 fill-current" />
129
+ </ContextMenuPrimitive.ItemIndicator>
130
+ </span>
131
+ {children}
132
+ </ContextMenuPrimitive.RadioItem>
133
+ ))
134
+ ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
135
+
136
+ const ContextMenuLabel = React.forwardRef<
137
+ React.ElementRef<typeof ContextMenuPrimitive.Label>,
138
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
139
+ inset?: boolean
140
+ }
141
+ >(({ className, inset, ...props }, ref) => (
142
+ <ContextMenuPrimitive.Label
143
+ ref={ref}
144
+ className={cn(
145
+ "px-2 py-1.5 text-sm font-semibold text-foreground",
146
+ inset && "pl-8",
147
+ className
148
+ )}
149
+ {...props}
150
+ />
151
+ ))
152
+ ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
153
+
154
+ const ContextMenuSeparator = React.forwardRef<
155
+ React.ElementRef<typeof ContextMenuPrimitive.Separator>,
156
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
157
+ >(({ className, ...props }, ref) => (
158
+ <ContextMenuPrimitive.Separator
159
+ ref={ref}
160
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
161
+ {...props}
162
+ />
163
+ ))
164
+ ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
165
+
166
+ const ContextMenuShortcut = ({
167
+ className,
168
+ ...props
169
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
170
+ return (
171
+ <span
172
+ className={cn(
173
+ "ml-auto text-xs tracking-widest text-muted-foreground",
174
+ className
175
+ )}
176
+ {...props}
177
+ />
178
+ )
179
+ }
180
+ ContextMenuShortcut.displayName = "ContextMenuShortcut"
181
+
182
+ export {
183
+ ContextMenu,
184
+ ContextMenuTrigger,
185
+ ContextMenuContent,
186
+ ContextMenuItem,
187
+ ContextMenuCheckboxItem,
188
+ ContextMenuRadioItem,
189
+ ContextMenuLabel,
190
+ ContextMenuSeparator,
191
+ ContextMenuShortcut,
192
+ ContextMenuGroup,
193
+ ContextMenuPortal,
194
+ ContextMenuSub,
195
+ ContextMenuSubContent,
196
+ ContextMenuSubTrigger,
197
+ ContextMenuRadioGroup,
198
+ }
QatarPOS/client/src/components/ui/dialog.tsx ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as DialogPrimitive from "@radix-ui/react-dialog"
5
+ import { X } from "lucide-react"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ const Dialog = DialogPrimitive.Root
10
+
11
+ const DialogTrigger = DialogPrimitive.Trigger
12
+
13
+ const DialogPortal = DialogPrimitive.Portal
14
+
15
+ const DialogClose = DialogPrimitive.Close
16
+
17
+ const DialogOverlay = React.forwardRef<
18
+ React.ElementRef<typeof DialogPrimitive.Overlay>,
19
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
20
+ >(({ className, ...props }, ref) => (
21
+ <DialogPrimitive.Overlay
22
+ ref={ref}
23
+ className={cn(
24
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
25
+ className
26
+ )}
27
+ {...props}
28
+ />
29
+ ))
30
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
31
+
32
+ const DialogContent = React.forwardRef<
33
+ React.ElementRef<typeof DialogPrimitive.Content>,
34
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
35
+ >(({ className, children, ...props }, ref) => (
36
+ <DialogPortal>
37
+ <DialogOverlay />
38
+ <DialogPrimitive.Content
39
+ ref={ref}
40
+ className={cn(
41
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
42
+ className
43
+ )}
44
+ {...props}
45
+ >
46
+ {children}
47
+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
48
+ <X className="h-4 w-4" />
49
+ <span className="sr-only">Close</span>
50
+ </DialogPrimitive.Close>
51
+ </DialogPrimitive.Content>
52
+ </DialogPortal>
53
+ ))
54
+ DialogContent.displayName = DialogPrimitive.Content.displayName
55
+
56
+ const DialogHeader = ({
57
+ className,
58
+ ...props
59
+ }: React.HTMLAttributes<HTMLDivElement>) => (
60
+ <div
61
+ className={cn(
62
+ "flex flex-col space-y-1.5 text-center sm:text-left",
63
+ className
64
+ )}
65
+ {...props}
66
+ />
67
+ )
68
+ DialogHeader.displayName = "DialogHeader"
69
+
70
+ const DialogFooter = ({
71
+ className,
72
+ ...props
73
+ }: React.HTMLAttributes<HTMLDivElement>) => (
74
+ <div
75
+ className={cn(
76
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
77
+ className
78
+ )}
79
+ {...props}
80
+ />
81
+ )
82
+ DialogFooter.displayName = "DialogFooter"
83
+
84
+ const DialogTitle = React.forwardRef<
85
+ React.ElementRef<typeof DialogPrimitive.Title>,
86
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
87
+ >(({ className, ...props }, ref) => (
88
+ <DialogPrimitive.Title
89
+ ref={ref}
90
+ className={cn(
91
+ "text-lg font-semibold leading-none tracking-tight",
92
+ className
93
+ )}
94
+ {...props}
95
+ />
96
+ ))
97
+ DialogTitle.displayName = DialogPrimitive.Title.displayName
98
+
99
+ const DialogDescription = React.forwardRef<
100
+ React.ElementRef<typeof DialogPrimitive.Description>,
101
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
102
+ >(({ className, ...props }, ref) => (
103
+ <DialogPrimitive.Description
104
+ ref={ref}
105
+ className={cn("text-sm text-muted-foreground", className)}
106
+ {...props}
107
+ />
108
+ ))
109
+ DialogDescription.displayName = DialogPrimitive.Description.displayName
110
+
111
+ export {
112
+ Dialog,
113
+ DialogPortal,
114
+ DialogOverlay,
115
+ DialogClose,
116
+ DialogTrigger,
117
+ DialogContent,
118
+ DialogHeader,
119
+ DialogFooter,
120
+ DialogTitle,
121
+ DialogDescription,
122
+ }
QatarPOS/client/src/components/ui/drawer.tsx ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Drawer as DrawerPrimitive } from "vaul"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const Drawer = ({
9
+ shouldScaleBackground = true,
10
+ ...props
11
+ }: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
12
+ <DrawerPrimitive.Root
13
+ shouldScaleBackground={shouldScaleBackground}
14
+ {...props}
15
+ />
16
+ )
17
+ Drawer.displayName = "Drawer"
18
+
19
+ const DrawerTrigger = DrawerPrimitive.Trigger
20
+
21
+ const DrawerPortal = DrawerPrimitive.Portal
22
+
23
+ const DrawerClose = DrawerPrimitive.Close
24
+
25
+ const DrawerOverlay = React.forwardRef<
26
+ React.ElementRef<typeof DrawerPrimitive.Overlay>,
27
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
28
+ >(({ className, ...props }, ref) => (
29
+ <DrawerPrimitive.Overlay
30
+ ref={ref}
31
+ className={cn("fixed inset-0 z-50 bg-black/80", className)}
32
+ {...props}
33
+ />
34
+ ))
35
+ DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName
36
+
37
+ const DrawerContent = React.forwardRef<
38
+ React.ElementRef<typeof DrawerPrimitive.Content>,
39
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
40
+ >(({ className, children, ...props }, ref) => (
41
+ <DrawerPortal>
42
+ <DrawerOverlay />
43
+ <DrawerPrimitive.Content
44
+ ref={ref}
45
+ className={cn(
46
+ "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
47
+ className
48
+ )}
49
+ {...props}
50
+ >
51
+ <div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" />
52
+ {children}
53
+ </DrawerPrimitive.Content>
54
+ </DrawerPortal>
55
+ ))
56
+ DrawerContent.displayName = "DrawerContent"
57
+
58
+ const DrawerHeader = ({
59
+ className,
60
+ ...props
61
+ }: React.HTMLAttributes<HTMLDivElement>) => (
62
+ <div
63
+ className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
64
+ {...props}
65
+ />
66
+ )
67
+ DrawerHeader.displayName = "DrawerHeader"
68
+
69
+ const DrawerFooter = ({
70
+ className,
71
+ ...props
72
+ }: React.HTMLAttributes<HTMLDivElement>) => (
73
+ <div
74
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
75
+ {...props}
76
+ />
77
+ )
78
+ DrawerFooter.displayName = "DrawerFooter"
79
+
80
+ const DrawerTitle = React.forwardRef<
81
+ React.ElementRef<typeof DrawerPrimitive.Title>,
82
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
83
+ >(({ className, ...props }, ref) => (
84
+ <DrawerPrimitive.Title
85
+ ref={ref}
86
+ className={cn(
87
+ "text-lg font-semibold leading-none tracking-tight",
88
+ className
89
+ )}
90
+ {...props}
91
+ />
92
+ ))
93
+ DrawerTitle.displayName = DrawerPrimitive.Title.displayName
94
+
95
+ const DrawerDescription = React.forwardRef<
96
+ React.ElementRef<typeof DrawerPrimitive.Description>,
97
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
98
+ >(({ className, ...props }, ref) => (
99
+ <DrawerPrimitive.Description
100
+ ref={ref}
101
+ className={cn("text-sm text-muted-foreground", className)}
102
+ {...props}
103
+ />
104
+ ))
105
+ DrawerDescription.displayName = DrawerPrimitive.Description.displayName
106
+
107
+ export {
108
+ Drawer,
109
+ DrawerPortal,
110
+ DrawerOverlay,
111
+ DrawerTrigger,
112
+ DrawerClose,
113
+ DrawerContent,
114
+ DrawerHeader,
115
+ DrawerFooter,
116
+ DrawerTitle,
117
+ DrawerDescription,
118
+ }
QatarPOS/client/src/components/ui/dropdown-menu.tsx ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
3
+ import { Check, ChevronRight, Circle } from "lucide-react"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ const DropdownMenu = DropdownMenuPrimitive.Root
8
+
9
+ const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger
10
+
11
+ const DropdownMenuGroup = DropdownMenuPrimitive.Group
12
+
13
+ const DropdownMenuPortal = DropdownMenuPrimitive.Portal
14
+
15
+ const DropdownMenuSub = DropdownMenuPrimitive.Sub
16
+
17
+ const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup
18
+
19
+ const DropdownMenuSubTrigger = React.forwardRef<
20
+ React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,
21
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {
22
+ inset?: boolean
23
+ }
24
+ >(({ className, inset, children, ...props }, ref) => (
25
+ <DropdownMenuPrimitive.SubTrigger
26
+ ref={ref}
27
+ className={cn(
28
+ "flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
29
+ inset && "pl-8",
30
+ className
31
+ )}
32
+ {...props}
33
+ >
34
+ {children}
35
+ <ChevronRight className="ml-auto" />
36
+ </DropdownMenuPrimitive.SubTrigger>
37
+ ))
38
+ DropdownMenuSubTrigger.displayName =
39
+ DropdownMenuPrimitive.SubTrigger.displayName
40
+
41
+ const DropdownMenuSubContent = React.forwardRef<
42
+ React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,
43
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>
44
+ >(({ className, ...props }, ref) => (
45
+ <DropdownMenuPrimitive.SubContent
46
+ ref={ref}
47
+ className={cn(
48
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
49
+ className
50
+ )}
51
+ {...props}
52
+ />
53
+ ))
54
+ DropdownMenuSubContent.displayName =
55
+ DropdownMenuPrimitive.SubContent.displayName
56
+
57
+ const DropdownMenuContent = React.forwardRef<
58
+ React.ElementRef<typeof DropdownMenuPrimitive.Content>,
59
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
60
+ >(({ className, sideOffset = 4, ...props }, ref) => (
61
+ <DropdownMenuPrimitive.Portal>
62
+ <DropdownMenuPrimitive.Content
63
+ ref={ref}
64
+ sideOffset={sideOffset}
65
+ className={cn(
66
+ "z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",
67
+ className
68
+ )}
69
+ {...props}
70
+ />
71
+ </DropdownMenuPrimitive.Portal>
72
+ ))
73
+ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName
74
+
75
+ const DropdownMenuItem = React.forwardRef<
76
+ React.ElementRef<typeof DropdownMenuPrimitive.Item>,
77
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {
78
+ inset?: boolean
79
+ }
80
+ >(({ className, inset, ...props }, ref) => (
81
+ <DropdownMenuPrimitive.Item
82
+ ref={ref}
83
+ className={cn(
84
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
85
+ inset && "pl-8",
86
+ className
87
+ )}
88
+ {...props}
89
+ />
90
+ ))
91
+ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName
92
+
93
+ const DropdownMenuCheckboxItem = React.forwardRef<
94
+ React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,
95
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>
96
+ >(({ className, children, checked, ...props }, ref) => (
97
+ <DropdownMenuPrimitive.CheckboxItem
98
+ ref={ref}
99
+ className={cn(
100
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
101
+ className
102
+ )}
103
+ checked={checked}
104
+ {...props}
105
+ >
106
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
107
+ <DropdownMenuPrimitive.ItemIndicator>
108
+ <Check className="h-4 w-4" />
109
+ </DropdownMenuPrimitive.ItemIndicator>
110
+ </span>
111
+ {children}
112
+ </DropdownMenuPrimitive.CheckboxItem>
113
+ ))
114
+ DropdownMenuCheckboxItem.displayName =
115
+ DropdownMenuPrimitive.CheckboxItem.displayName
116
+
117
+ const DropdownMenuRadioItem = React.forwardRef<
118
+ React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,
119
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>
120
+ >(({ className, children, ...props }, ref) => (
121
+ <DropdownMenuPrimitive.RadioItem
122
+ ref={ref}
123
+ className={cn(
124
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
125
+ className
126
+ )}
127
+ {...props}
128
+ >
129
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
130
+ <DropdownMenuPrimitive.ItemIndicator>
131
+ <Circle className="h-2 w-2 fill-current" />
132
+ </DropdownMenuPrimitive.ItemIndicator>
133
+ </span>
134
+ {children}
135
+ </DropdownMenuPrimitive.RadioItem>
136
+ ))
137
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName
138
+
139
+ const DropdownMenuLabel = React.forwardRef<
140
+ React.ElementRef<typeof DropdownMenuPrimitive.Label>,
141
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {
142
+ inset?: boolean
143
+ }
144
+ >(({ className, inset, ...props }, ref) => (
145
+ <DropdownMenuPrimitive.Label
146
+ ref={ref}
147
+ className={cn(
148
+ "px-2 py-1.5 text-sm font-semibold",
149
+ inset && "pl-8",
150
+ className
151
+ )}
152
+ {...props}
153
+ />
154
+ ))
155
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName
156
+
157
+ const DropdownMenuSeparator = React.forwardRef<
158
+ React.ElementRef<typeof DropdownMenuPrimitive.Separator>,
159
+ React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>
160
+ >(({ className, ...props }, ref) => (
161
+ <DropdownMenuPrimitive.Separator
162
+ ref={ref}
163
+ className={cn("-mx-1 my-1 h-px bg-muted", className)}
164
+ {...props}
165
+ />
166
+ ))
167
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName
168
+
169
+ const DropdownMenuShortcut = ({
170
+ className,
171
+ ...props
172
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
173
+ return (
174
+ <span
175
+ className={cn("ml-auto text-xs tracking-widest opacity-60", className)}
176
+ {...props}
177
+ />
178
+ )
179
+ }
180
+ DropdownMenuShortcut.displayName = "DropdownMenuShortcut"
181
+
182
+ export {
183
+ DropdownMenu,
184
+ DropdownMenuTrigger,
185
+ DropdownMenuContent,
186
+ DropdownMenuItem,
187
+ DropdownMenuCheckboxItem,
188
+ DropdownMenuRadioItem,
189
+ DropdownMenuLabel,
190
+ DropdownMenuSeparator,
191
+ DropdownMenuShortcut,
192
+ DropdownMenuGroup,
193
+ DropdownMenuPortal,
194
+ DropdownMenuSub,
195
+ DropdownMenuSubContent,
196
+ DropdownMenuSubTrigger,
197
+ DropdownMenuRadioGroup,
198
+ }
QatarPOS/client/src/components/ui/form.tsx ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react";
2
+ import * as LabelPrimitive from "@radix-ui/react-label";
3
+ import { Slot } from "@radix-ui/react-slot";
4
+ import {
5
+ Controller,
6
+ ControllerProps,
7
+ FieldPath,
8
+ FieldValues,
9
+ FormProvider,
10
+ useFormContext,
11
+ } from "react-hook-form";
12
+
13
+ import { cn } from "@/lib/utils";
14
+ import { Label } from "@/components/ui/label";
15
+
16
+ const Form = FormProvider;
17
+
18
+ type FormFieldContextValue<
19
+ TFieldValues extends FieldValues = FieldValues,
20
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
21
+ > = {
22
+ name: TName;
23
+ };
24
+
25
+ const FormFieldContext = React.createContext<FormFieldContextValue>(
26
+ {} as FormFieldContextValue
27
+ );
28
+
29
+ const FormField = <
30
+ TFieldValues extends FieldValues = FieldValues,
31
+ TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
32
+ >({
33
+ ...props
34
+ }: ControllerProps<TFieldValues, TName>) => {
35
+ return (
36
+ <FormFieldContext.Provider value={{ name: props.name }}>
37
+ <Controller {...props} />
38
+ </FormFieldContext.Provider>
39
+ );
40
+ };
41
+
42
+ const useFormField = () => {
43
+ const fieldContext = React.useContext(FormFieldContext);
44
+ const itemContext = React.useContext(FormItemContext);
45
+ const { getFieldState, formState } = useFormContext();
46
+
47
+ const fieldState = getFieldState(fieldContext.name, formState);
48
+
49
+ if (!fieldContext) {
50
+ throw new Error("useFormField should be used within <FormField>");
51
+ }
52
+
53
+ const { id } = itemContext;
54
+
55
+ return {
56
+ id,
57
+ name: fieldContext.name,
58
+ formItemId: `${id}-form-item`,
59
+ formDescriptionId: `${id}-form-item-description`,
60
+ formMessageId: `${id}-form-item-message`,
61
+ ...fieldState,
62
+ };
63
+ };
64
+
65
+ type FormItemContextValue = {
66
+ id: string;
67
+ };
68
+
69
+ const FormItemContext = React.createContext<FormItemContextValue>(
70
+ {} as FormItemContextValue
71
+ );
72
+
73
+ const FormItem = React.forwardRef<
74
+ HTMLDivElement,
75
+ React.HTMLAttributes<HTMLDivElement>
76
+ >(({ className, ...props }, ref) => {
77
+ const id = React.useId();
78
+
79
+ return (
80
+ <FormItemContext.Provider value={{ id }}>
81
+ <div ref={ref} className={cn("space-y-2", className)} {...props} />
82
+ </FormItemContext.Provider>
83
+ );
84
+ });
85
+ FormItem.displayName = "FormItem";
86
+
87
+ const FormLabel = React.forwardRef<
88
+ React.ElementRef<typeof LabelPrimitive.Root>,
89
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
90
+ >(({ className, ...props }, ref) => {
91
+ const { error, formItemId } = useFormField();
92
+
93
+ return (
94
+ <Label
95
+ ref={ref}
96
+ className={cn(error && "text-destructive", className)}
97
+ htmlFor={formItemId}
98
+ {...props}
99
+ />
100
+ );
101
+ });
102
+ FormLabel.displayName = "FormLabel";
103
+
104
+ const FormControl = React.forwardRef<
105
+ React.ElementRef<typeof Slot>,
106
+ React.ComponentPropsWithoutRef<typeof Slot>
107
+ >(({ ...props }, ref) => {
108
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
109
+
110
+ return (
111
+ <Slot
112
+ ref={ref}
113
+ id={formItemId}
114
+ aria-describedby={
115
+ !error
116
+ ? `${formDescriptionId}`
117
+ : `${formDescriptionId} ${formMessageId}`
118
+ }
119
+ aria-invalid={!!error}
120
+ {...props}
121
+ />
122
+ );
123
+ });
124
+ FormControl.displayName = "FormControl";
125
+
126
+ const FormDescription = React.forwardRef<
127
+ HTMLParagraphElement,
128
+ React.HTMLAttributes<HTMLParagraphElement>
129
+ >(({ className, ...props }, ref) => {
130
+ const { formDescriptionId } = useFormField();
131
+
132
+ return (
133
+ <p
134
+ ref={ref}
135
+ id={formDescriptionId}
136
+ className={cn("text-sm text-muted-foreground", className)}
137
+ {...props}
138
+ />
139
+ );
140
+ });
141
+ FormDescription.displayName = "FormDescription";
142
+
143
+ const FormMessage = React.forwardRef<
144
+ HTMLParagraphElement,
145
+ React.HTMLAttributes<HTMLParagraphElement>
146
+ >(({ className, children, ...props }, ref) => {
147
+ const { error, formMessageId } = useFormField();
148
+ const body = error ? String(error?.message) : children;
149
+
150
+ if (!body) {
151
+ return null;
152
+ }
153
+
154
+ return (
155
+ <p
156
+ ref={ref}
157
+ id={formMessageId}
158
+ className={cn("text-sm font-medium text-destructive", className)}
159
+ {...props}
160
+ >
161
+ {body}
162
+ </p>
163
+ );
164
+ });
165
+ FormMessage.displayName = "FormMessage";
166
+
167
+ export {
168
+ useFormField,
169
+ Form,
170
+ FormItem,
171
+ FormLabel,
172
+ FormControl,
173
+ FormDescription,
174
+ FormMessage,
175
+ FormField,
176
+ };
QatarPOS/client/src/components/ui/hover-card.tsx ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const HoverCard = HoverCardPrimitive.Root
9
+
10
+ const HoverCardTrigger = HoverCardPrimitive.Trigger
11
+
12
+ const HoverCardContent = React.forwardRef<
13
+ React.ElementRef<typeof HoverCardPrimitive.Content>,
14
+ React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>
15
+ >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
16
+ <HoverCardPrimitive.Content
17
+ ref={ref}
18
+ align={align}
19
+ sideOffset={sideOffset}
20
+ className={cn(
21
+ "z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-hover-card-content-transform-origin]",
22
+ className
23
+ )}
24
+ {...props}
25
+ />
26
+ ))
27
+ HoverCardContent.displayName = HoverCardPrimitive.Content.displayName
28
+
29
+ export { HoverCard, HoverCardTrigger, HoverCardContent }
QatarPOS/client/src/components/ui/input-otp.tsx ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import { OTPInput, OTPInputContext } from "input-otp"
3
+ import { Dot } from "lucide-react"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ const InputOTP = React.forwardRef<
8
+ React.ElementRef<typeof OTPInput>,
9
+ React.ComponentPropsWithoutRef<typeof OTPInput>
10
+ >(({ className, containerClassName, ...props }, ref) => (
11
+ <OTPInput
12
+ ref={ref}
13
+ containerClassName={cn(
14
+ "flex items-center gap-2 has-[:disabled]:opacity-50",
15
+ containerClassName
16
+ )}
17
+ className={cn("disabled:cursor-not-allowed", className)}
18
+ {...props}
19
+ />
20
+ ))
21
+ InputOTP.displayName = "InputOTP"
22
+
23
+ const InputOTPGroup = React.forwardRef<
24
+ React.ElementRef<"div">,
25
+ React.ComponentPropsWithoutRef<"div">
26
+ >(({ className, ...props }, ref) => (
27
+ <div ref={ref} className={cn("flex items-center", className)} {...props} />
28
+ ))
29
+ InputOTPGroup.displayName = "InputOTPGroup"
30
+
31
+ const InputOTPSlot = React.forwardRef<
32
+ React.ElementRef<"div">,
33
+ React.ComponentPropsWithoutRef<"div"> & { index: number }
34
+ >(({ index, className, ...props }, ref) => {
35
+ const inputOTPContext = React.useContext(OTPInputContext)
36
+ const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index]
37
+
38
+ return (
39
+ <div
40
+ ref={ref}
41
+ className={cn(
42
+ "relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",
43
+ isActive && "z-10 ring-2 ring-ring ring-offset-background",
44
+ className
45
+ )}
46
+ {...props}
47
+ >
48
+ {char}
49
+ {hasFakeCaret && (
50
+ <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
51
+ <div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
52
+ </div>
53
+ )}
54
+ </div>
55
+ )
56
+ })
57
+ InputOTPSlot.displayName = "InputOTPSlot"
58
+
59
+ const InputOTPSeparator = React.forwardRef<
60
+ React.ElementRef<"div">,
61
+ React.ComponentPropsWithoutRef<"div">
62
+ >(({ ...props }, ref) => (
63
+ <div ref={ref} role="separator" {...props}>
64
+ <Dot />
65
+ </div>
66
+ ))
67
+ InputOTPSeparator.displayName = "InputOTPSeparator"
68
+
69
+ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
QatarPOS/client/src/components/ui/input.tsx ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@/lib/utils"
4
+
5
+ const Input = React.forwardRef<HTMLInputElement, React.ComponentProps<"input">>(
6
+ ({ className, type, ...props }, ref) => {
7
+ return (
8
+ <input
9
+ type={type}
10
+ className={cn(
11
+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
12
+ className
13
+ )}
14
+ ref={ref}
15
+ {...props}
16
+ />
17
+ )
18
+ }
19
+ )
20
+ Input.displayName = "Input"
21
+
22
+ export { Input }
QatarPOS/client/src/components/ui/label.tsx ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import * as LabelPrimitive from "@radix-ui/react-label"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ const labelVariants = cva(
8
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
9
+ )
10
+
11
+ const Label = React.forwardRef<
12
+ React.ElementRef<typeof LabelPrimitive.Root>,
13
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
14
+ VariantProps<typeof labelVariants>
15
+ >(({ className, ...props }, ref) => (
16
+ <LabelPrimitive.Root
17
+ ref={ref}
18
+ className={cn(labelVariants(), className)}
19
+ {...props}
20
+ />
21
+ ))
22
+ Label.displayName = LabelPrimitive.Root.displayName
23
+
24
+ export { Label }
QatarPOS/client/src/components/ui/menubar.tsx ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as MenubarPrimitive from "@radix-ui/react-menubar"
5
+ import { Check, ChevronRight, Circle } from "lucide-react"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ function MenubarMenu({
10
+ ...props
11
+ }: React.ComponentProps<typeof MenubarPrimitive.Menu>) {
12
+ return <MenubarPrimitive.Menu {...props} />
13
+ }
14
+
15
+ function MenubarGroup({
16
+ ...props
17
+ }: React.ComponentProps<typeof MenubarPrimitive.Group>) {
18
+ return <MenubarPrimitive.Group {...props} />
19
+ }
20
+
21
+ function MenubarPortal({
22
+ ...props
23
+ }: React.ComponentProps<typeof MenubarPrimitive.Portal>) {
24
+ return <MenubarPrimitive.Portal {...props} />
25
+ }
26
+
27
+ function MenubarRadioGroup({
28
+ ...props
29
+ }: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {
30
+ return <MenubarPrimitive.RadioGroup {...props} />
31
+ }
32
+
33
+ function MenubarSub({
34
+ ...props
35
+ }: React.ComponentProps<typeof MenubarPrimitive.Sub>) {
36
+ return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />
37
+ }
38
+
39
+ const Menubar = React.forwardRef<
40
+ React.ElementRef<typeof MenubarPrimitive.Root>,
41
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>
42
+ >(({ className, ...props }, ref) => (
43
+ <MenubarPrimitive.Root
44
+ ref={ref}
45
+ className={cn(
46
+ "flex h-10 items-center space-x-1 rounded-md border bg-background p-1",
47
+ className
48
+ )}
49
+ {...props}
50
+ />
51
+ ))
52
+ Menubar.displayName = MenubarPrimitive.Root.displayName
53
+
54
+ const MenubarTrigger = React.forwardRef<
55
+ React.ElementRef<typeof MenubarPrimitive.Trigger>,
56
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger>
57
+ >(({ className, ...props }, ref) => (
58
+ <MenubarPrimitive.Trigger
59
+ ref={ref}
60
+ className={cn(
61
+ "flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
62
+ className
63
+ )}
64
+ {...props}
65
+ />
66
+ ))
67
+ MenubarTrigger.displayName = MenubarPrimitive.Trigger.displayName
68
+
69
+ const MenubarSubTrigger = React.forwardRef<
70
+ React.ElementRef<typeof MenubarPrimitive.SubTrigger>,
71
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & {
72
+ inset?: boolean
73
+ }
74
+ >(({ className, inset, children, ...props }, ref) => (
75
+ <MenubarPrimitive.SubTrigger
76
+ ref={ref}
77
+ className={cn(
78
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
79
+ inset && "pl-8",
80
+ className
81
+ )}
82
+ {...props}
83
+ >
84
+ {children}
85
+ <ChevronRight className="ml-auto h-4 w-4" />
86
+ </MenubarPrimitive.SubTrigger>
87
+ ))
88
+ MenubarSubTrigger.displayName = MenubarPrimitive.SubTrigger.displayName
89
+
90
+ const MenubarSubContent = React.forwardRef<
91
+ React.ElementRef<typeof MenubarPrimitive.SubContent>,
92
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubContent>
93
+ >(({ className, ...props }, ref) => (
94
+ <MenubarPrimitive.SubContent
95
+ ref={ref}
96
+ className={cn(
97
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-menubar-content-transform-origin]",
98
+ className
99
+ )}
100
+ {...props}
101
+ />
102
+ ))
103
+ MenubarSubContent.displayName = MenubarPrimitive.SubContent.displayName
104
+
105
+ const MenubarContent = React.forwardRef<
106
+ React.ElementRef<typeof MenubarPrimitive.Content>,
107
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content>
108
+ >(
109
+ (
110
+ { className, align = "start", alignOffset = -4, sideOffset = 8, ...props },
111
+ ref
112
+ ) => (
113
+ <MenubarPrimitive.Portal>
114
+ <MenubarPrimitive.Content
115
+ ref={ref}
116
+ align={align}
117
+ alignOffset={alignOffset}
118
+ sideOffset={sideOffset}
119
+ className={cn(
120
+ "z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-menubar-content-transform-origin]",
121
+ className
122
+ )}
123
+ {...props}
124
+ />
125
+ </MenubarPrimitive.Portal>
126
+ )
127
+ )
128
+ MenubarContent.displayName = MenubarPrimitive.Content.displayName
129
+
130
+ const MenubarItem = React.forwardRef<
131
+ React.ElementRef<typeof MenubarPrimitive.Item>,
132
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Item> & {
133
+ inset?: boolean
134
+ }
135
+ >(({ className, inset, ...props }, ref) => (
136
+ <MenubarPrimitive.Item
137
+ ref={ref}
138
+ className={cn(
139
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
140
+ inset && "pl-8",
141
+ className
142
+ )}
143
+ {...props}
144
+ />
145
+ ))
146
+ MenubarItem.displayName = MenubarPrimitive.Item.displayName
147
+
148
+ const MenubarCheckboxItem = React.forwardRef<
149
+ React.ElementRef<typeof MenubarPrimitive.CheckboxItem>,
150
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.CheckboxItem>
151
+ >(({ className, children, checked, ...props }, ref) => (
152
+ <MenubarPrimitive.CheckboxItem
153
+ ref={ref}
154
+ className={cn(
155
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
156
+ className
157
+ )}
158
+ checked={checked}
159
+ {...props}
160
+ >
161
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
162
+ <MenubarPrimitive.ItemIndicator>
163
+ <Check className="h-4 w-4" />
164
+ </MenubarPrimitive.ItemIndicator>
165
+ </span>
166
+ {children}
167
+ </MenubarPrimitive.CheckboxItem>
168
+ ))
169
+ MenubarCheckboxItem.displayName = MenubarPrimitive.CheckboxItem.displayName
170
+
171
+ const MenubarRadioItem = React.forwardRef<
172
+ React.ElementRef<typeof MenubarPrimitive.RadioItem>,
173
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.RadioItem>
174
+ >(({ className, children, ...props }, ref) => (
175
+ <MenubarPrimitive.RadioItem
176
+ ref={ref}
177
+ className={cn(
178
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
179
+ className
180
+ )}
181
+ {...props}
182
+ >
183
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
184
+ <MenubarPrimitive.ItemIndicator>
185
+ <Circle className="h-2 w-2 fill-current" />
186
+ </MenubarPrimitive.ItemIndicator>
187
+ </span>
188
+ {children}
189
+ </MenubarPrimitive.RadioItem>
190
+ ))
191
+ MenubarRadioItem.displayName = MenubarPrimitive.RadioItem.displayName
192
+
193
+ const MenubarLabel = React.forwardRef<
194
+ React.ElementRef<typeof MenubarPrimitive.Label>,
195
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Label> & {
196
+ inset?: boolean
197
+ }
198
+ >(({ className, inset, ...props }, ref) => (
199
+ <MenubarPrimitive.Label
200
+ ref={ref}
201
+ className={cn(
202
+ "px-2 py-1.5 text-sm font-semibold",
203
+ inset && "pl-8",
204
+ className
205
+ )}
206
+ {...props}
207
+ />
208
+ ))
209
+ MenubarLabel.displayName = MenubarPrimitive.Label.displayName
210
+
211
+ const MenubarSeparator = React.forwardRef<
212
+ React.ElementRef<typeof MenubarPrimitive.Separator>,
213
+ React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Separator>
214
+ >(({ className, ...props }, ref) => (
215
+ <MenubarPrimitive.Separator
216
+ ref={ref}
217
+ className={cn("-mx-1 my-1 h-px bg-muted", className)}
218
+ {...props}
219
+ />
220
+ ))
221
+ MenubarSeparator.displayName = MenubarPrimitive.Separator.displayName
222
+
223
+ const MenubarShortcut = ({
224
+ className,
225
+ ...props
226
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
227
+ return (
228
+ <span
229
+ className={cn(
230
+ "ml-auto text-xs tracking-widest text-muted-foreground",
231
+ className
232
+ )}
233
+ {...props}
234
+ />
235
+ )
236
+ }
237
+ MenubarShortcut.displayname = "MenubarShortcut"
238
+
239
+ export {
240
+ Menubar,
241
+ MenubarMenu,
242
+ MenubarTrigger,
243
+ MenubarContent,
244
+ MenubarItem,
245
+ MenubarSeparator,
246
+ MenubarLabel,
247
+ MenubarCheckboxItem,
248
+ MenubarRadioGroup,
249
+ MenubarRadioItem,
250
+ MenubarPortal,
251
+ MenubarSubContent,
252
+ MenubarSubTrigger,
253
+ MenubarGroup,
254
+ MenubarSub,
255
+ MenubarShortcut,
256
+ }
QatarPOS/client/src/components/ui/navigation-menu.tsx ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"
3
+ import { cva } from "class-variance-authority"
4
+ import { ChevronDown } from "lucide-react"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const NavigationMenu = React.forwardRef<
9
+ React.ElementRef<typeof NavigationMenuPrimitive.Root>,
10
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Root>
11
+ >(({ className, children, ...props }, ref) => (
12
+ <NavigationMenuPrimitive.Root
13
+ ref={ref}
14
+ className={cn(
15
+ "relative z-10 flex max-w-max flex-1 items-center justify-center",
16
+ className
17
+ )}
18
+ {...props}
19
+ >
20
+ {children}
21
+ <NavigationMenuViewport />
22
+ </NavigationMenuPrimitive.Root>
23
+ ))
24
+ NavigationMenu.displayName = NavigationMenuPrimitive.Root.displayName
25
+
26
+ const NavigationMenuList = React.forwardRef<
27
+ React.ElementRef<typeof NavigationMenuPrimitive.List>,
28
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.List>
29
+ >(({ className, ...props }, ref) => (
30
+ <NavigationMenuPrimitive.List
31
+ ref={ref}
32
+ className={cn(
33
+ "group flex flex-1 list-none items-center justify-center space-x-1",
34
+ className
35
+ )}
36
+ {...props}
37
+ />
38
+ ))
39
+ NavigationMenuList.displayName = NavigationMenuPrimitive.List.displayName
40
+
41
+ const NavigationMenuItem = NavigationMenuPrimitive.Item
42
+
43
+ const navigationMenuTriggerStyle = cva(
44
+ "group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[state=open]:text-accent-foreground data-[state=open]:bg-accent/50 data-[state=open]:hover:bg-accent data-[state=open]:focus:bg-accent"
45
+ )
46
+
47
+ const NavigationMenuTrigger = React.forwardRef<
48
+ React.ElementRef<typeof NavigationMenuPrimitive.Trigger>,
49
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Trigger>
50
+ >(({ className, children, ...props }, ref) => (
51
+ <NavigationMenuPrimitive.Trigger
52
+ ref={ref}
53
+ className={cn(navigationMenuTriggerStyle(), "group", className)}
54
+ {...props}
55
+ >
56
+ {children}{" "}
57
+ <ChevronDown
58
+ className="relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180"
59
+ aria-hidden="true"
60
+ />
61
+ </NavigationMenuPrimitive.Trigger>
62
+ ))
63
+ NavigationMenuTrigger.displayName = NavigationMenuPrimitive.Trigger.displayName
64
+
65
+ const NavigationMenuContent = React.forwardRef<
66
+ React.ElementRef<typeof NavigationMenuPrimitive.Content>,
67
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Content>
68
+ >(({ className, ...props }, ref) => (
69
+ <NavigationMenuPrimitive.Content
70
+ ref={ref}
71
+ className={cn(
72
+ "left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",
73
+ className
74
+ )}
75
+ {...props}
76
+ />
77
+ ))
78
+ NavigationMenuContent.displayName = NavigationMenuPrimitive.Content.displayName
79
+
80
+ const NavigationMenuLink = NavigationMenuPrimitive.Link
81
+
82
+ const NavigationMenuViewport = React.forwardRef<
83
+ React.ElementRef<typeof NavigationMenuPrimitive.Viewport>,
84
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Viewport>
85
+ >(({ className, ...props }, ref) => (
86
+ <div className={cn("absolute left-0 top-full flex justify-center")}>
87
+ <NavigationMenuPrimitive.Viewport
88
+ className={cn(
89
+ "origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",
90
+ className
91
+ )}
92
+ ref={ref}
93
+ {...props}
94
+ />
95
+ </div>
96
+ ))
97
+ NavigationMenuViewport.displayName =
98
+ NavigationMenuPrimitive.Viewport.displayName
99
+
100
+ const NavigationMenuIndicator = React.forwardRef<
101
+ React.ElementRef<typeof NavigationMenuPrimitive.Indicator>,
102
+ React.ComponentPropsWithoutRef<typeof NavigationMenuPrimitive.Indicator>
103
+ >(({ className, ...props }, ref) => (
104
+ <NavigationMenuPrimitive.Indicator
105
+ ref={ref}
106
+ className={cn(
107
+ "top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",
108
+ className
109
+ )}
110
+ {...props}
111
+ >
112
+ <div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
113
+ </NavigationMenuPrimitive.Indicator>
114
+ ))
115
+ NavigationMenuIndicator.displayName =
116
+ NavigationMenuPrimitive.Indicator.displayName
117
+
118
+ export {
119
+ navigationMenuTriggerStyle,
120
+ NavigationMenu,
121
+ NavigationMenuList,
122
+ NavigationMenuItem,
123
+ NavigationMenuContent,
124
+ NavigationMenuTrigger,
125
+ NavigationMenuLink,
126
+ NavigationMenuIndicator,
127
+ NavigationMenuViewport,
128
+ }
QatarPOS/client/src/components/ui/pagination.tsx ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as React from "react"
2
+ import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react"
3
+
4
+ import { cn } from "@/lib/utils"
5
+ import { ButtonProps, buttonVariants } from "@/components/ui/button"
6
+
7
+ const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => (
8
+ <nav
9
+ role="navigation"
10
+ aria-label="pagination"
11
+ className={cn("mx-auto flex w-full justify-center", className)}
12
+ {...props}
13
+ />
14
+ )
15
+ Pagination.displayName = "Pagination"
16
+
17
+ const PaginationContent = React.forwardRef<
18
+ HTMLUListElement,
19
+ React.ComponentProps<"ul">
20
+ >(({ className, ...props }, ref) => (
21
+ <ul
22
+ ref={ref}
23
+ className={cn("flex flex-row items-center gap-1", className)}
24
+ {...props}
25
+ />
26
+ ))
27
+ PaginationContent.displayName = "PaginationContent"
28
+
29
+ const PaginationItem = React.forwardRef<
30
+ HTMLLIElement,
31
+ React.ComponentProps<"li">
32
+ >(({ className, ...props }, ref) => (
33
+ <li ref={ref} className={cn("", className)} {...props} />
34
+ ))
35
+ PaginationItem.displayName = "PaginationItem"
36
+
37
+ type PaginationLinkProps = {
38
+ isActive?: boolean
39
+ } & Pick<ButtonProps, "size"> &
40
+ React.ComponentProps<"a">
41
+
42
+ const PaginationLink = ({
43
+ className,
44
+ isActive,
45
+ size = "icon",
46
+ ...props
47
+ }: PaginationLinkProps) => (
48
+ <a
49
+ aria-current={isActive ? "page" : undefined}
50
+ className={cn(
51
+ buttonVariants({
52
+ variant: isActive ? "outline" : "ghost",
53
+ size,
54
+ }),
55
+ className
56
+ )}
57
+ {...props}
58
+ />
59
+ )
60
+ PaginationLink.displayName = "PaginationLink"
61
+
62
+ const PaginationPrevious = ({
63
+ className,
64
+ ...props
65
+ }: React.ComponentProps<typeof PaginationLink>) => (
66
+ <PaginationLink
67
+ aria-label="Go to previous page"
68
+ size="default"
69
+ className={cn("gap-1 pl-2.5", className)}
70
+ {...props}
71
+ >
72
+ <ChevronLeft className="h-4 w-4" />
73
+ <span>Previous</span>
74
+ </PaginationLink>
75
+ )
76
+ PaginationPrevious.displayName = "PaginationPrevious"
77
+
78
+ const PaginationNext = ({
79
+ className,
80
+ ...props
81
+ }: React.ComponentProps<typeof PaginationLink>) => (
82
+ <PaginationLink
83
+ aria-label="Go to next page"
84
+ size="default"
85
+ className={cn("gap-1 pr-2.5", className)}
86
+ {...props}
87
+ >
88
+ <span>Next</span>
89
+ <ChevronRight className="h-4 w-4" />
90
+ </PaginationLink>
91
+ )
92
+ PaginationNext.displayName = "PaginationNext"
93
+
94
+ const PaginationEllipsis = ({
95
+ className,
96
+ ...props
97
+ }: React.ComponentProps<"span">) => (
98
+ <span
99
+ aria-hidden
100
+ className={cn("flex h-9 w-9 items-center justify-center", className)}
101
+ {...props}
102
+ >
103
+ <MoreHorizontal className="h-4 w-4" />
104
+ <span className="sr-only">More pages</span>
105
+ </span>
106
+ )
107
+ PaginationEllipsis.displayName = "PaginationEllipsis"
108
+
109
+ export {
110
+ Pagination,
111
+ PaginationContent,
112
+ PaginationEllipsis,
113
+ PaginationItem,
114
+ PaginationLink,
115
+ PaginationNext,
116
+ PaginationPrevious,
117
+ }