1 line
3.7 KiB
JavaScript
1 line
3.7 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,49143,e=>{"use strict";var s=e.i(43476),t=e.i(71645),a=e.i(94327),l=e.i(56322);e.s(["default",0,function(){let{language:e}=(0,l.useDashboardI18n)(),[i,c]=(0,t.useState)([]),[n,d]=(0,t.useState)(null),r={en:{title:"Customers",subtitle:"A company CRM with license validation and risk flags.",customer:"Customer",contact:"Contact",license:"License",flags:"Flags",imageUploaded:"Image uploaded",imageMissing:"No image",noPhone:"No phone",flagged:"Flagged",clear:"Clear",empty:"No customers yet."},fr:{title:"Clients",subtitle:"CRM de l’entreprise avec validation des permis et indicateurs de risque.",customer:"Client",contact:"Contact",license:"Permis",flags:"Signalements",imageUploaded:"Image téléversée",imageMissing:"Aucune image",noPhone:"Pas de téléphone",flagged:"Signalé",clear:"Aucun risque",empty:"Aucun client pour le moment."},ar:{title:"العملاء",subtitle:"نظام إدارة عملاء خاص بالشركة مع التحقق من الرخص ومؤشرات المخاطر.",customer:"العميل",contact:"التواصل",license:"الرخصة",flags:"العلامات",imageUploaded:"تم رفع الصورة",imageMissing:"لا توجد صورة",noPhone:"لا يوجد هاتف",flagged:"تم تمييزه",clear:"لا توجد مخاطر",empty:"لا يوجد عملاء حتى الآن."}}[e];return(0,t.useEffect)(()=>{(0,a.apiFetch)("/customers?pageSize=100").then(e=>c(e??[])).catch(e=>d(e.message))},[]),(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-xl font-semibold text-slate-900",children:r.title}),(0,s.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:r.subtitle})]}),(0,s.jsx)("div",{className:"card overflow-hidden",children:n?(0,s.jsx)("div",{className:"p-8 text-sm text-red-600",children:n}):(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"w-full",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{className:"bg-slate-50 border-b border-slate-200",children:[(0,s.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-slate-500 uppercase tracking-wide",children:r.customer}),(0,s.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-slate-500 uppercase tracking-wide",children:r.contact}),(0,s.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-slate-500 uppercase tracking-wide",children:r.license}),(0,s.jsx)("th",{className:"text-left px-6 py-3 text-xs font-medium text-slate-500 uppercase tracking-wide",children:r.flags})]})}),(0,s.jsxs)("tbody",{className:"divide-y divide-slate-100",children:[i.map(e=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{className:"px-6 py-4 text-sm font-semibold text-slate-900",children:[e.firstName," ",e.lastName]}),(0,s.jsxs)("td",{className:"px-6 py-4",children:[(0,s.jsx)("p",{className:"text-sm text-slate-700",children:e.email}),(0,s.jsx)("p",{className:"text-xs text-slate-500",children:e.phone??r.noPhone})]}),(0,s.jsx)("td",{className:"px-6 py-4",children:(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"badge-gray",children:e.licenseValidationStatus}),(0,s.jsx)("span",{className:e.licenseImageUrl?"badge-green":"badge-gray",children:e.licenseImageUrl?r.imageUploaded:r.imageMissing})]})}),(0,s.jsx)("td",{className:"px-6 py-4",children:e.flagged?(0,s.jsx)("span",{className:"badge-red",children:r.flagged}):(0,s.jsx)("span",{className:"badge-green",children:r.clear})})]},e.id)),0===i.length&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:4,className:"px-6 py-10 text-center text-sm text-slate-400",children:r.empty})})]})]})})})]})}])}]); |