3import React, { useState, useEffect } from 'react';
4import { Icon } from '@/contexts/IconContext';
6export default function CustomerDisplaysPage() {
7 const [idleUrl, setIdleUrl] = useState('');
8 const [previewUrl, setPreviewUrl] = useState('');
14 const loadSettings = () => {
15 // API call: /BUCK?3=retailmax.elink.config.basesetting&112=1&112=999&9=f100,0,CustomerDisplay1.IdleURL
16 console.log('Loading customer display settings...');
17 // Mock data - would load actual idle URL
20 const saveSetting = (value: string) => {
21 // API call: /DATI with XML payload
23 <f8_s>retailmax.elink.config.basesetting.edit</f8_s>
25 <f100_s>CustomerDisplay1.IdleURL</f100_s>
26 <f101_s>${value}</f101_s>
30 console.log('Saving CustomerDisplay1.IdleURL =', value);
31 console.log('XML:', xml);
34 const handleUrlChange = (value: string) => {
36 // Update preview if URL is substantial
37 if (value.length > 10) {
42 const handleUrlBlur = () => {
49 <div className="p-6 min-h-screen bg-bg">
51 <div className="mb-6">
52 <h1 className="text-3xl font-bold text-text mb-2 flex items-center gap-2">
53 <Icon name="monitor" size={32} />
56 <p className="text-muted">
57 Configure pole displays and customer-facing screens
61 <div className="max-w-7xl mx-auto">
63 <div className="mb-6">
64 <h1 className="text-2xl font-bold text-text mb-2">Customer Display Setup</h1>
65 <p className="text-sm text-muted">
66 Configure what customers see on pole displays and customer-facing screens
71 <div className="grid lg:grid-cols-3 gap-6">
72 {/* Settings Panel */}
73 <div className="lg:col-span-2 space-y-6">
74 {/* Idle Screen URL */}
75 <div className="bg-surface rounded-lg shadow p-6">
76 <h2 className="text-lg font-semibold text-text mb-4">Idle Screen Configuration</h2>
78 <div className="space-y-4">
80 <label className="block text-sm font-medium text-text mb-2">
86 onChange={(e) => handleUrlChange(e.target.value)}
87 onBlur={handleUrlBlur}
88 placeholder="https://example.com/customer-display"
89 className="w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-brand focus:border-transparent"
91 <p className="mt-2 text-sm text-muted">
92 This URL is displayed when PosGreen is idle. The content will be displayed in an iframe on the customer display.
96 <div className="bg-info/10 border border-info/30 rounded-lg p-4">
97 <h3 className="text-sm font-semibold text-text mb-2">URL Requirements</h3>
98 <ul className="text-sm text-text space-y-1">
99 <li>• Must be a valid HTTPS URL for security</li>
100 <li>• Page should be optimized for customer display dimensions</li>
101 <li>• Content should auto-refresh or be dynamic</li>
102 <li>• Avoid pages that require user interaction</li>
109 <div className="bg-surface rounded-lg shadow p-6">
110 <h2 className="text-lg font-semibold text-text mb-4">About Customer Displays</h2>
112 <div className="space-y-4 text-sm text-text">
114 <h3 className="font-semibold text-text mb-2">Display Types</h3>
115 <ul className="space-y-1 ml-4">
116 <li>• <strong>Pole Displays:</strong> Small LED/LCD displays showing price and product info</li>
117 <li>• <strong>Secondary Monitors:</strong> Full screens showing promotional content</li>
118 <li>• <strong>Tablet Displays:</strong> Interactive displays for customer engagement</li>
123 <h3 className="font-semibold text-text mb-2">Idle Screen Usage</h3>
125 When no transaction is active, the customer display shows the idle screen content. Common uses include:
127 <ul className="space-y-1 ml-4">
128 <li>• Store promotions and special offers</li>
129 <li>• Brand messaging and advertising</li>
130 <li>• Social media feeds or news</li>
131 <li>• Product catalogs and featured items</li>
132 <li>• Store information (hours, services, etc.)</li>
137 <h3 className="font-semibold text-text mb-2">During Transactions</h3>
139 When a sale is active, the customer display automatically switches to show transaction details
140 (items being scanned, prices, totals). The idle screen resumes when the transaction completes.
146 {/* Lane Reporting Link */}
147 <div className="bg-success/10 border border-success/30 rounded-lg p-4">
148 <h3 className="text-sm font-semibold text-text mb-2">View Active Displays</h3>
149 <p className="text-sm text-text mb-3">
150 Links to currently active customer displays are available in Lane Reporting.
151 You can view what customers see on each lane in real-time.
154 href="/pages/settings/lanes"
155 className="inline-flex items-center text-sm font-medium text-brand hover:text-brand/80"
158 <svg className="ml-1 w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
159 <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
165 {/* Preview Panel */}
166 <div className="lg:col-span-1">
167 <div className="bg-surface rounded-lg shadow p-6 sticky top-24">
168 <h2 className="text-lg font-semibold text-text mb-4">Preview</h2>
170 <div className="border-2 border-text rounded-lg overflow-hidden bg-surface-2">
174 className="w-full h-64"
175 title="Customer Display Preview"
176 sandbox="allow-scripts allow-same-origin"
180 <div className="w-full h-64 flex items-center justify-center text-muted">
181 <div className="text-center">
182 <svg className="mx-auto h-12 w-12 mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
183 <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
185 <p className="text-sm">Enter a URL to preview</p>
191 <p className="mt-3 text-xs text-muted">
192 Preview shows how the idle screen will appear on customer displays.
193 Actual display may vary based on screen size and orientation.
199 {/* Best Practices */}
200 <div className="mt-6 bg-surface rounded-lg shadow p-6">
201 <h2 className="text-lg font-semibold text-text mb-4">Best Practices</h2>
203 <div className="grid md:grid-cols-2 gap-6 text-sm text-text">
205 <h3 className="font-semibold text-text mb-2">Content Guidelines</h3>
206 <ul className="space-y-1 ml-4">
207 <li>• Keep content simple and easy to read from a distance</li>
208 <li>• Use high contrast colors for better visibility</li>
209 <li>• Rotate content every 10-15 seconds to maintain interest</li>
210 <li>• Avoid small text that customers cannot read</li>
211 <li>• Test content at actual display size before deploying</li>
216 <h3 className="font-semibold text-text mb-2">Technical Considerations</h3>
217 <ul className="space-y-1 ml-4">
218 <li>• Ensure reliable internet connection for hosted content</li>
219 <li>• Use caching to minimize loading times</li>
220 <li>• Monitor display uptime and connectivity</li>
221 <li>• Have a fallback image for connection failures</li>
222 <li>• Update content regularly to keep it fresh</li>
229 <div className="mt-6 bg-warn/10 border border-warn/30 rounded-lg p-4">
230 <h3 className="text-sm font-semibold text-text mb-2">Example URLs</h3>
231 <div className="text-sm text-text space-y-1">
232 <p><strong>Digital signage:</strong> https://yourstore.com/displays/lane1</p>
233 <p><strong>Promotional content:</strong> https://yourstore.com/promos/weekly-specials</p>
234 <p><strong>Product showcase:</strong> https://yourstore.com/featured-products</p>