PageSourceSearch

https://sanay3i-project.vercel.app/assets/CraftsmanProfilePage-DuBPu1mI.js

js sanay3i-project.vercel.app collected 2026-10-03 07:40:27 UTC 16,276 bytes, 1 lines download raw bytes

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.