1import{d as E,u as P,j as e,g as m,bE as $,bF as A,Y as I,B as u,cq as L,y,b8 as j,aW as f,n as z,r as d,S as R,L as w,cr as _,aA as k}from"./index-P4ZdD-Xo.js";import{u as U,R as J}from"./ReviewsTab-D518ZzJ8.js";import{c as W}from"./index-BPZEbioo.js";import{P as q}from"./PointsBadge-29k1G0fP.js";/* empty css */import{P as G}from"./ProfileSkeleton-NWyI1GCG.js";import"./profileWorker.api-BSqmoIct.js";import"./technicians.api-G_7cx-LJ.js";import"./governorates.api-UcsS4G4u.js";import"./index-MLDGE6eO.js";import"./Skeleton-Bj86ex42.js";const M=({craftsman:s,isOwnProfile:a})=>{const{user:t,userType:i,isAuthenticated:n}=E(),r=P(),c=()=>{if(!n){y.info("Ù
Ù ÙØ¶Ù٠سج٠دخÙÙ٠أÙÙØ§Ù ð"),r("/login",{state:{from:"request-service"}});return}if(i==="craftsman"&&t?.service_id&&s.serviceId&&t.service_id===s.serviceId){y.warning("Ø¹Ø°Ø±Ø§ÙØ ÙØ§ ÙÙ
ÙÙÙ Ø·ÙØ¨ خدÙ
Ø© Ù
Ù ØµÙØ§Ùع٠ÙÙ ÙÙØ³ Ù
جا٠تخصص٠ð ï¸");return}r("/request-service",{state:{industrial_type:s.id?.toString(),industrial_name:s.name,service_type:s.serviceId?.toString(),price:s.priceRange}})};return e.jsxs("div",{className:"craftsman-card",children:[e.jsx("div",{className:"craftsman-img-wrapper",children:e.jsx("img",{src:m(s.avatarUrl,s.name),alt:s.name,className:"craftsman-img",onError:o=>{o.currentTarget.src=m(null,s.name)}})}),e.jsx("h2",{className:"craftsman-name",children:s.name}),e.jsxs("p",{className:"craftsman-job",children:[s.jobTitle,s.governorate&&e.jsxs("span",{style:{fontSize:"0.9rem",color:"#777",marginRight:"5px"},children:["(",s.governorate,")"]})]}),e.jsx("div",{className:"craftsman-points-row",children:e.jsx(q,{points:s.points||0,size:"md",variant:"detailed"})}),e.jsx("div",{className:"craftsman-rating",children:Array.from({length:5}).map((o,p)=>e.jsx(W,{color:p<s.rating?"#FF8031":"#e4e5e9"},p))}),e.jsxs("p",{className:"craftsman-exp",children:["خبرة ",s.experienceYears," سÙÙØ§Øª"]}),e.jsxs("div",{className:"craftsman-stats-strip",children:[e.jsxs("div",{className:"craftsman-stat-pill",children:[e.jsx("strong",{children:s.stats.completedJobsCount}),e.jsx("span",{children:"أعÙ
ا٠Ù
ÙØªÙ
ÙØ©"})]}),e.jsxs("div",{className:"craftsman-stat-pill",children:[e.jsx("strong",{children:s.stats.activeJobsCount}),e.jsx("span",{children:"أعÙ
Ø§Ù Ø¬Ø§Ø±ÙØ©"})]}),e.jsxs("div",{className:"craftsman-stat-pill",children:[e.jsx("strong",{children:s.stats.communityOffersCount}),e.jsx("span",{children:"Ø¹Ø±ÙØ¶ Ù
جتÙ
ع"})]})]}),a&&s.manager?.name&&e.jsxs("div",{className:"craftsman-manager-box",children:[e.jsx("div",{className:"cmb-icon",children:e.jsx($,{})}),e.jsxs("div",{className:"cmb-content",children:[e.jsx("span",{children:s.manager.message||"Ù
Ø¯ÙØ±Ù اÙÙ
سؤÙ٠داخ٠Ù
ÙØµØ© ØµÙØ§ÙعÙ"}),e.jsx("strong",{children:s.manager.name}),s.manager.phone&&e.jsxs("a",{href:`tel:${s.manager.phone}`,children:[e.jsx(A,{size:12}),s.manager.phone]})]})]}),s.walletId&&!a&&e.jsxs("div",{className:"craftsman-wallet-transfer-box",children:[e.jsxs("div",{className:"cwt-label",children:[e.jsx(I,{size:13}),e.jsx("span",{children:"رÙÙ
اÙÙ
ØÙظة ÙÙØªØÙÙÙ"})]}),e.jsxs("div",{className:"cwt-number",children:["#",s.walletId]}),e.jsx("small",{className:"cwt-hint",children:"Ø¹ÙØ¯ Ø§ÙØ¯ÙØ¹Ø ØÙÙÙ ÙÙÙ
Ø© Ø§ÙØ®Ø¯Ù
Ø© ÙÙØ°Ø§ Ø§ÙØ±ÙÙ
"})]}),e.jsx("div",{className:"card-actions",children:a?e.jsx("div",{style:{marginTop:"10px",width:"100%"},children:e.jsx(u,{to:"/craftsman/profile/edit",variant:"outline",className:"w-100 btn-sm",children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",justifyContent:"center"},children:[e.jsx(L,{size:18}),"تعدÙÙ Ø¨ÙØ§ÙاتÙ"]})})}):e.jsxs(e.Fragment,{children:[e.jsx(u,{onClick:c,variant:"primary",children:"Ø·ÙØ¨ خدÙ
Ø©"}),e.jsx(u,{to:"/dashboard/messages",variant:"outline",state:{contact:{id:s.id,name:s.name,avatar:s.avatarUrl,type:"craftsman"}},children:"Ø¥Ø±Ø³Ø§Ù Ø±Ø³Ø§ÙØ©"})]})})]})},B=({activeTab:s,setActiveTab:a,isOwnProfile:t})=>{const i=[{id:"about",label:"Ø¹Ù Ø§ÙØµÙØ§ÙØ¹Ù"},{id:"services",label:"Ø§ÙØ®Ø¯Ù
ات"},{id:"reviews",label:"أراء Ø§ÙØ¹Ù
ÙØ§Ø¡"},{id:"portfolio",label:"Ù
عرض Ø§ÙØ£Ø¹Ù
اÙ"},{id:"completed",label:"Ø§ÙØ£Ø¹Ù
ا٠اÙÙ
ÙØ¬Ø²Ø©"},...t?[{id:"active",label:"Ø§ÙØ£Ø¹Ù
Ø§Ù Ø§ÙØ¬Ø§Ø±ÙØ©"},{id:"offers",label:"Ø¹Ø±ÙØ¶Ù Ù٠اÙÙ
جتÙ
ع"}]:[]];return e.jsx("div",{className:"profile-tabs",children:i.map(n=>e.jsx("button",{className:`tab-btn ${s===n.id?"active":""}`,onClick:()=>
1a(n.id),children:n.label},n.id))})},b=({data:s})=>e.jsxs("div",{className:"tab-content",children:[e.jsxs("div",{className:"info-section",children:[e.jsxs("h3",{className:"info-title",children:[e.jsx(j,{})," Ø§ÙØªØ®ØµØµ اÙÙ
ÙÙÙ"]}),e.jsxs("ul",{className:"info-list",children:[e.jsxs("li",{children:["⢠",s.jobTitle]}),s.specialization&&s.specialization.filter(a=>a!==s.jobTitle).map((a,t)=>e.jsxs("li",{children:["⢠",a]},t))]})]}),e.jsxs("div",{className:"info-section",children:[e.jsxs("h3",{className:"info-title",children:[e.jsx(j,{})," ÙØ¨Ø°Ø© Ø¹Ù Ø§ÙØµÙØ§ÙØ¹Ù"]}),e.jsx("p",{className:"description-text",children:s.about})]}),e.jsxs("div",{className:"info-grid-row",children:[e.jsxs("div",{className:"info-section half",children:[e.jsxs("h3",{className:"info-title",children:[e.jsx(f,{})," أسعار Ø§ÙØ®Ø¯Ù
ات"]}),s.servicePrices.length>0?e.jsx("ul",{className:"info-list",children:s.servicePrices.filter(a=>a.isActive!==!1).map((a,t)=>e.jsxs("li",{children:["⢠",a.name,": ",(a.client_price||a.price).toLocaleString()," ج.Ù
"]},a.id||t))}):e.jsx("p",{className:"info-text-val",children:s.priceRange||"ØØ³Ø¨ Ø§ÙØ§ØªÙاÙ"})]}),e.jsxs("div",{className:"info-section half",children:[e.jsxs("h3",{className:"info-title",children:[e.jsx(j,{})," Ø£ÙØ§Ù
Ø§ÙØ¹Ù
Ù"]}),e.jsx("p",{className:"info-text-val",children:s.workDays&&s.workDays.length>0?s.workDays.join(" - "):"Ø·ÙØ§Ù Ø£ÙØ§Ù
Ø§ÙØ£Ø³Ø¨Ùع"})]})]}),e.jsxs("div",{className:"info-section",children:[e.jsxs("h3",{className:"info-title",children:[e.jsx(f,{})," Ø·Ø±Ù Ø§ÙØ¯Ùع اÙÙ
ÙØ¶ÙØ©"]}),e.jsx("ul",{className:"info-list",children:s.paymentMethods&&s.paymentMethods.map((a,t)=>e.jsxs("li",{children:["⢠",a]},t))})]})]}),O=({services:s})=>e.jsx("div",{className:"tab-content",children:e.jsxs("div",{className:"info-section",children:[e.jsx("h3",{className:"info-title",children:"Ø§ÙØ®Ø¯Ù
ات اÙÙ
ÙØ¯Ù
Ø©"}),e.jsx("ul",{className:"info-list",children:s&&s.length>0?s.map((a,t)=>e.jsxs("li",{children:[e.jsx(z,{className:"icon-check"}),a]},t)):e.jsx("p",{children:"ÙØ§ ØªÙØ¬Ø¯ خدÙ
ات Ù
Ø¶Ø§ÙØ© ØØ§ÙÙØ§Ù."})})]})}),V=({portfolio:s})=>{const a=s||[],[t,i]=d.useState(6),[n,r]=d.useState(0);d.useEffect(()=>{const l=()=>{window.innerWidth<768?i(1):i(6)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]);const c=Math.ceil(a.length/t),o=a.slice(n*t,(n+1)*t),[p,T]=d.useState(null),[v,g]=d.useState(null),N=50,C=l=>{g(null),T(l.targetTouches[0].clientX)},S=l=>g(l.targetTouches[0].clientX),F=()=>{if(!p||!v)return;const l=p-v,h=l>N,D=l<-N;h&&n>0&&r(x=>x-1),D&&n<c-1&&r(x=>x+1)};return a.length===0?e.jsx("p",{children:"ÙØ§ ØªÙØ¬Ø¯ أعÙ
ا٠Ù
Ø¶Ø§ÙØ© Ù٠اÙÙ
عرض."}):e.jsxs("div",{children:[e.jsx("div",{className:"portfolio-grid fade-enter",onTouchStart:C,onTouchMove:S,onTouchEnd:F,children:o.map(l=>e.jsxs("div",{className:"portfolio-item",children:[e.jsx("img",{src:l.imageUrl,alt:l.title}),e.jsx("div",{className:"portfolio-overlay",children:e.jsx("span",{children:l.title})})]},l.id))},n),e.jsx("div",{className:"view-all-container",children:e.jsx("button",{className:"view-all-btn",children:"عرض ÙÙ Ø§ÙØ£Ø¹Ù
اÙ"})}),s.length>t&&e.jsx("div",{className:"pagination-container",children:Array.from({length:c}).map((l,h)=>e.jsx("button",{className:`pagination-dot ${h===n?"active":""}`,onClick:()=>r(h),"aria-label":`Go to page ${h+1}`},h))})]})},X=s=>{if(!s)return"ØºÙØ± Ù
ØØ¯Ø¯";const a=new Date(s);return Number.isNaN(a.getTime())?s:new Intl.DateTimeFormat("ar-EG",{year:"numeric",month:"long",day:"numeric"}).format(a)},Y=({jobs:s})=>{const[a,t]=d.useState(null),[i,n]=d.useState(3);return s.length?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"work-history-list",children:[s.slice(0,i).map(r=>e.jsxs("article",{className:"work-history-card",children:[e.jsxs("div",{className:"work-history-header",children:[e.jsxs("div",{children:[e.jsx("div",{className:"work-history-source",children:r.sourceLabel}),e.jsx("h3",{children:r.title})]}),e.jsx("span",{className:"work-history-status success",children:r.statusLabel})]}),r.description?e.jsx("p",{className:"work-history-description",children:r.description}):null,e.jsxs("div",{className:"work-history-meta",children:[e.jsx("span",{children:r.service?.
1name||"خدÙ
Ø© عاÙ
Ø©"}),e.jsx("span",{children:r.location||"اÙÙ
ÙÙØ¹ ØºÙØ± Ù
ØØ¯Ø¯"}),e.jsxs("span",{children:["آخر ØªØØ¯ÙØ«: ",X(r.updatedAt||r.createdAt)]}),r.price?e.jsxs("span",{children:["Ø§ÙØ³Ø¹Ø±: ",r.price," ج.Ù
"]}):null]}),r.counterparty?e.jsxs("div",{className:"work-history-party",children:[e.jsx("img",{src:m(r.counterparty.avatar,r.counterparty.name),alt:r.counterparty.name,onError:c=>{c.currentTarget.src=m(null,r.counterparty?.name||"Ø")}}),e.jsxs("div",{children:[e.jsx("strong",{children:r.counterparty.name}),e.jsx("span",{children:r.counterparty.type==="company"?"Ø´Ø±ÙØ©":r.counterparty.type==="craftsman"?"ØµÙØ§ÙعÙ":"عÙ
ÙÙ"})]})]}):null,(r.beforeImages.length>0||r.afterImages.length>0)&&e.jsxs("div",{className:"work-history-gallery",children:[r.beforeImages.slice(0,2).map((c,o)=>e.jsxs("div",{className:"work-history-image",onClick:()=>t(c),children:[e.jsx("img",{src:c,alt:`before-${r.title}-${o+1}`}),e.jsx("span",{children:"ÙØ¨Ù"})]},`before-${o}`)),r.afterImages.slice(0,2).map((c,o)=>e.jsxs("div",{className:"work-history-image",onClick:()=>t(c),children:[e.jsx("img",{src:c,alt:`after-${r.title}-${o+1}`}),e.jsx("span",{children:"بعد"})]},`after-${o}`))]})]},r.id)),a&&e.jsx("div",{className:"image-modal-overlay",onClick:()=>t(null),children:e.jsx("img",{src:a,alt:"Enlarged view",className:"image-modal-content"})})]}),s.length>i&&e.jsx("div",{className:"view-all-container",children:e.jsx("button",{type:"button",className:"view-all-btn",onClick:()=>n(r=>r+3),children:"عرض اÙÙ
Ø²ÙØ¯"})})]}):e.jsx("div",{className:"empty-history-state",children:"ÙØ§ ØªÙØ¬Ø¯ أعÙ
ا٠Ù
ÙØªÙ
ÙØ© ÙØ¹Ø±Ø¶Ùا ØØ§ÙÙØ§Ù."})},H=s=>{if(!s)return"ØºÙØ± Ù
ØØ¯Ø¯";const a=new Date(s);return Number.isNaN(a.getTime())?s:new Intl.DateTimeFormat("ar-EG",{year:"numeric",month:"short",day:"numeric"}).format(a)},K=({jobs:s})=>{const[a,t]=d.useState(3);return s.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"work-history-list",children:s.slice(0,a).map(i=>e.jsxs("article",{className:"work-history-card active",children:[e.jsxs("div",{className:"work-history-header",children:[e.jsxs("div",{children:[e.jsx("div",{className:"work-history-source",children:i.sourceLabel}),e.jsx("h3",{children:i.title})]}),e.jsx("span",{className:"work-history-status pending",children:i.statusLabel})]}),i.description?e.jsx("p",{className:"work-history-description",children:i.description}):null,e.jsxs("div",{className:"work-history-meta",children:[e.jsx("span",{children:i.service?.name||"خدÙ
Ø© عاÙ
Ø©"}),e.jsx("span",{children:i.location||"اÙÙ
ÙÙØ¹ ØºÙØ± Ù
ØØ¯Ø¯"}),e.jsxs("span",{children:["ØªØ§Ø±ÙØ® Ø§ÙØ¨Ø¯Ø¡: ",H(i.createdAt)]}),i.scheduledDate?e.jsxs("span",{children:["اÙÙ
ÙØ¹Ø¯: ",i.scheduledDate]}):null,i.deliveryDays?e.jsxs("span",{children:["Ù
دة Ø§ÙØªÙÙÙØ°: ",i.deliveryDays," ÙÙÙ
"]}):null]}),i.counterparty?e.jsxs("div",{className:"work-history-party",children:[e.jsx("img",{src:m(i.counterparty.avatar,i.counterparty.name),alt:i.counterparty.name,onError:n=>{n.currentTarget.src=m(null,i.counterparty?.name||"Ø")}}),e.jsxs("div",{children:[e.jsx("strong",{children:i.counterparty.name}),e.jsx("span",{children:i.counterparty.type==="company"?"Ø´Ø±ÙØ©":i.counterparty.type==="craftsman"?"ØµÙØ§ÙعÙ":"عÙ
ÙÙ"})]})]}):null]},i.id))}),s.length>a&&e.jsx("div",{className:"view-all-container",children:e.jsx("button",{type:"button",className:"view-all-btn",onClick:()=>t(i=>i+3),children:"عرض اÙÙ
Ø²ÙØ¯"})})]}):e.jsx("div",{className:"empty-history-state",children:"ÙØ§ ØªÙØ¬Ø¯ أعÙ
Ø§Ù Ø¬Ø§Ø±ÙØ© Ø§ÙØ¢Ù."})},Q=s=>{if(!s)return"ØºÙØ± Ù
ØØ¯Ø¯";const a=new Date(s);return Number.isNaN(a.getTime())?s:new Intl.DateTimeFormat("ar-EG",{year:"numeric",month:"long",day:"numeric"}).format(a)},Z=({offers:s})=>{const[a,t]=d.useState(3);return s.length?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"community-offers-list",children:s.slice(0,a).map(i=>e.jsxs("article",{className:"community-offer-card",children:[e.jsxs("div",{className:"community-offer-top",children:[e.jsxs("div",{children:[e.jsx("span",{className:"community-offer-label",children:"عرض Ù
جتÙ
ع"}),e.jsx("h3",{children:i.post?.title||"Ø·ÙØ¨ بدÙ٠عÙÙØ§Ù"})]}),e.jsx("span",{className:`work-history-status ${i.status==="accepted"?"success":i.status==="rejected"?"danger":"pending"}`,children:i.statusLabel})]}),e.jsx("p",{className:"work-history-description",children:i.description||i.post?.description||"ÙØ§ ÙÙØ¬Ø¯ ÙØµÙ إضاÙÙ ÙÙØ°Ø§ Ø§ÙØ¹Ø±Ø¶."}),e.jsxs("div",{className:"work-history-meta",children:[e.jsxs("span",{children:["اÙÙÙÙ
Ø© اÙÙ
ÙØªØ±ØØ©: ",i.price," ج.Ù
"]}),e.jsxs("span",{children:["Ù
دة Ø§ÙØªÙÙÙØ°: ",i.deliveryDays," ÙÙÙ
"]}),e.jsx("span",{children:i.post?.location||"اÙÙ
ÙÙØ¹ ØºÙØ± Ù
ØØ¯Ø¯"}),e.jsxs("span",{children:["ØªØ§Ø±ÙØ® Ø§ÙØªÙدÙÙ
: ",Q(i.createdAt)]})]}),i.post?.owner?e.jsxs("div",{className:"work-history-party",children:[e.jsx("img",{src:m(i.post.owner.avatar,i.post.owner.name),alt:i.post.owner.name}),e.jsxs("div",{children:[e.jsx("strong",{children:i.post.owner.name}),e.jsx("span",{children:i.post.owner.type==="company"?"ØµØ§ØØ¨ Ø§ÙØ·Ùب: Ø´Ø±ÙØ©":"ØµØ§ØØ¨ Ø§ÙØ·Ùب: Ù
ستخدÙ
"})]})]}):null]},i.id))}),s.length>a&&e.jsx("div",{className:"view-all-container",children:e.jsx("button",{type:"button",className:"view-all-btn",onClick:()=>t(i=>i+3),children:"عرض اÙÙ
Ø²ÙØ¯"})})]}):e.jsx("div",{className:"empty-history-state",children:"ÙÙ
ØªÙØ¯Ù
Ø¹Ø±ÙØ¶Ùا عÙÙ Ø·ÙØ¨Ø§Øª اÙÙ
جتÙ
ع بعد."})},me=()=>{const{craftsman:s,loading:a,error:t,activeTab:i,setActiveTab:n,isOwnProfile:r}=U();if(a)return e.jsx(G,{});if(t||!s)return e.jsx("div",{className:"profile-page-wrapper",style:{textAlign:"center",padding:"50px"},children:t||"ÙÙ
ÙØªÙ
Ø§ÙØ¹Ø«Ùر عÙÙ Ø§ÙØµÙØ§ÙØ¹Ù"});const c=()=>{switch(i){case"about":return e.jsx(b,{data:s});case"services":return e.jsx(O,{services:s.services});case"reviews":return e.jsx(J,{reviews:s.reviews});case"portfolio":return e.jsx(V,{portfolio:s.portfolio});case"completed":return e.jsx(Y,{jobs:s.completedJobs});case"active":return e.jsx(K,{jobs:s.activeJobs});case"offers":return e.jsx(Z,{offers:s.communityOffers});default:return e.jsx(b,{data:s})}};return e.jsxs("div",{className:"profile-page-wrapper",children:[e.jsx(R,{title:`${s.name} | ${s.jobTitle||"ØµÙØ§Ùع٠Ù
ØØªØ±Ù"}`,description:`${s.name} ØµÙØ§Ùع٠Ù
ØØªØ±Ù ÙÙ ${s.governorate}. Ù
تخصص ÙÙ ${s.specialization.join("Ø ")||"خدÙ
ات Ø§ÙØµÙØ§ÙØ©"}. ØØ§ØµÙ عÙ٠تÙÙÙÙ
${s.rating} ÙØ¬ÙÙ
. ØªÙØ§ØµÙ Ù
Ø¹Ù Ø§ÙØ¢Ù عبر Ù
ÙØµØ© ØµÙØ§ÙعÙ.`,ogImage:s.avatarUrl,ogType:"profile"}),e.jsxs("nav",{className:"profile-breadcrumbs",children:[e.jsxs(w,{to:"/",children:[e.jsx(_,{})," Ø§ÙØ±Ø¦ÙØ³ÙØ©"]}),e.jsx(k,{className:"sep"}),e.jsx(w,{to:"/technicians",children:"Ø§ÙØµÙØ§ÙØ¹ÙØ©"}),e.jsx(k,{className:"sep"}),e.jsx("span",{children:s.name})]}),e.jsx("div",{className:"profile-cover",style:{backgroundColor:"var(--color-primary)",o
1pacity:.8,background:"linear-gradient(45deg, #4A5D6E, #5FA8D3)"}}),e.jsxs("div",{className:"profile-container",children:[e.jsx("aside",{className:"profile-sidebar",children:e.jsx(M,{craftsman:s,isOwnProfile:r})}),e.jsxs("main",{className:"profile-content-area",children:[e.jsx(B,{activeTab:i,setActiveTab:n,isOwnProfile:r}),e.jsx("div",{className:"tab-content-wrapper",children:c()})]})]})]})};export{me as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.