48ea61cdcc
- Product documentation in docs/products/ - Updated MEMORY.md with product info - quiXzoom Auth Core as AAMOS Identity product
3 lines
15 KiB
JavaScript
3 lines
15 KiB
JavaScript
import{u as le,a as me,o as he,n as xe,r as t,j as e,v as p,y as o,ag as g,ah as u,F as B,ak as f,z as n,B as J,L as F,p as S,q as a,I as d,w as l}from"./index-CZD3_4lD.js";import{R as K,a as D}from"./radio-group-BcmHTP2Q.js";import{A as Q}from"./arrow-left-DyClWdEf.js";import{C as U}from"./circle-alert-DFiBooaQ.js";import{B as pe}from"./building-2-BpMHggJ8.js";import{L as ge}from"./landmark-pzfm3gLZ.js";import{C as W}from"./credit-card-C9X53A_j.js";import{F as ue}from"./file-text-I90VDyBK.js";import"./index-C6sfL5Wv.js";import"./circle-CNf9xg3I.js";const ze=()=>{const j=le(),{t:r}=me(),{user:m}=he(),{ordererProfile:c,isLoading:_,createOrdererProfile:X,isPendingOrderer:Y,isActiveOrderer:y}=xe(),[h,O]=t.useState(1),[L,V]=t.useState(!1),[b,$]=t.useState(!1),[N,E]=t.useState(null),[C,R]=t.useState("company"),[x,Z]=t.useState(""),[v,ee]=t.useState(""),[k,re]=t.useState(""),[P,q]=t.useState(""),[G,se]=t.useState(""),[T,te]=t.useState(""),[I,ae]=t.useState(""),[M,ie]=t.useState(""),[i,oe]=t.useState("stripe");if(t.useEffect(()=>{!m&&!_&&j("/auth")},[m,_,j]),t.useEffect(()=>{m!=null&&m.email&&q(m.email)},[m]),c)return e.jsxs("div",{className:"min-h-screen bg-background text-foreground pb-24",children:[e.jsx("header",{className:"sticky top-0 z-10 bg-background/80 backdrop-blur-xl border-b border-border",children:e.jsxs("div",{className:"flex items-center gap-3 px-4 py-4",children:[e.jsx(p,{variant:"ghost",size:"icon",onClick:()=>j(-1),children:e.jsx(Q,{className:"w-5 h-5"})}),e.jsx("h1",{className:"text-xl font-bold",children:r("orderer.registration.ordererStatus")})]})}),e.jsx("main",{className:"p-4 space-y-6",children:e.jsxs(o,{className:`glass-card ${y?"border-green-500/30":"border-amber-500/30"}`,children:[e.jsxs(g,{children:[e.jsxs(u,{className:"flex items-center gap-2",children:[y?e.jsx(B,{className:"w-5 h-5 text-green-500"}):e.jsx(U,{className:"w-5 h-5 text-amber-500"}),c.organization_name]}),e.jsx(f,{children:r(y?"orderer.registration.activeDescription":Y?"orderer.registration.pendingDescription":"orderer.registration.pausedDescription")})]}),e.jsxs(n,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:r("orderer.registration.orgNumber")}),e.jsx("p",{className:"font-mono",children:c.organization_number})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:r("orderer.registration.paymentMethod")}),e.jsx("p",{children:c.payment_method==="stripe"?r("orderer.registration.cardPayment"):r("orderer.registration.invoicePayment")})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:r("orderer.status.active")}),e.jsx("p",{className:y?"text-green-500":"text-amber-500",children:c.status==="active"?r("orderer.status.active"):c.status==="pending"?r("orderer.status.waitingForApproval"):r("orderer.status.paused")})]}),c.payment_method==="invoice"&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground",children:r("orderer.registration.creditCheckApproved")}),e.jsx("p",{className:c.credit_approved?"text-green-500":"text-red-500",children:c.credit_approved?r("orderer.registration.creditCheckApproved"):r("orderer.registration.creditCheckNotApproved")})]})]}),y&&e.jsx(p,{onClick:()=>j("/"),className:"w-full",children:r("orderer.registration.goToMissions")})]})]})}),e.jsx(J,{})]});const ne=()=>x.trim()?!v.trim()||v.length<10?(l.error(r("orderer.registration.validation.enterValidOrgNumber")),!1):!0:(l.error(r("orderer.registration.validation.enterOrgName")),!1),H=()=>k.trim()?!P.trim()||!P.includes("@")?(l.error(r("orderer.registration.validation.enterValidEmail")),!1):!T.trim()||!I.trim()||!M.trim()?(l.error(r("orderer.registration.validation.enterFullAddress")),!1):!0:(l.error(r("orderer.registration.validation.enterContactPerson")),!1),ce=async()=>{$(!0),E("pending"),await new Promise(A=>setTimeout(A,2500));const z=parseInt(v.replace(/\D/g,"").slice(-1))%2===0;return $(!1),E(z?"approved":"denied"),z},w=async s=>{oe(s),E(null),s==="invoice"&&await ce()},de=async()=>{if(!H())return;if(i==="invoice"&&N!=="approved"){l.error(r("orderer.registration.validation.creditCheckRequired"));return}V(!0);const s=i==="stripe"||N==="approved",z={organization_type:C,organization_name:x.trim(),organization_number:v.replace(/\D/g,""),contact_person:k.trim(),contact_email:P.trim(),contact_phone:G.trim()||null,street_address:T.trim(),postal_code:I.trim(),city:M.trim(),payment_method:i,credit_approved:i==="invoice"?N==="approved":!1,status:s?"active":"pending"},{error:A}=await X(z);V(!1),A?l.error(A):(l.success(r("orderer.registration.profileCreated")),j("/orderer/create-mission"))};return _?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(F,{className:"w-8 h-8 animate-spin text-primary"})}):e.jsxs("div",{className:"min-h-screen bg-background text-foreground pb-24",children:[e.jsxs("header",{className:"sticky top-0 z-10 bg-background/80 backdrop-blur-xl border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 py-4",children:[e.jsx(p,{variant:"ghost",size:"icon",onClick:()=>h>1?O(h-1):j(-1),children:e.jsx(Q,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold",children:r("orderer.registration.title")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r("orderer.registration.stepOf",{step:h,total:3})})]})]}),e.jsx("div",{className:"h-1 bg-muted",children:e.jsx(S.div,{className:"h-full bg-primary",initial:{width:0},animate:{width:`${h/3*100}%`}})})]}),e.jsxs("main",{className:"p-4 space-y-6",children:[h===1&&e.jsxs(S.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},className:"space-y-6",children:[e.jsxs(o,{className:"glass-card",children:[e.jsxs(g,{children:[e.jsx(u,{children:r("orderer.registration.organizationType")}),e.jsx(f,{children:r("orderer.registration.selectOrgType")})]}),e.jsx(n,{children:e.jsxs(K,{value:C,onValueChange:s=>R(s),children:[e.jsxs("div",{className:"flex items-center space-x-3 p-4 rounded-lg border border-border hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>R("company"),children:[e.jsx(D,{value:"company",id:"company"}),e.jsx(pe,{className:"w-5 h-5 text-muted-foreground"}),e.jsxs(a,{htmlFor:"company",className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:r("orderer.registration.company")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r("orderer.registration.companyDesc")})]})]}),e.jsxs("div",{className:"flex items-center space-x-3 p-4 rounded-lg border border-border hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>R("authority"),children:[e.jsx(D,{value:"authority",id:"authority"}),e.jsx(ge,{className:"w-5 h-5 text-muted-foreground"}),e.jsxs(a,{htmlFor:"authority",className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:r("orderer.registration.authority")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r("orderer.registration.authorityDesc")})]})]})]})})]}),e.jsxs(o,{className:"glass-card",children:[e.jsxs(g,{children:[e.jsx(u,{children:r("orderer.registration.organizationDetails")}),e.jsx(f,{children:r("orderer.registration.basicInfo")})]}),e.jsxs(n,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(a,{htmlFor:"orgName",children:[r(C==="company"?"orderer.registration.companyName":"orderer.registration.authorityName")," *"]}),e.jsx(d,{id:"orgName",value:x,onChange:s=>Z(s.target.value),placeholder:r(C==="company"?"orderer.registration.companyPlaceholder":"orderer.registration.authorityPlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(a,{htmlFor:"orgNumber",children:[r("orderer.registration.organizationNumber")," *"]}),e.jsx(d,{id:"orgNumber",value:v,onChange:s=>ee(s.target.value),placeholder:r("orderer.registration.orgNumberPlaceholder"),className:"font-mono"})]})]})]}),e.jsx(p,{onClick:()=>ne()&&O(2),className:"w-full",size:"lg",children:r("orderer.registration.continue")})]}),h===2&&e.jsxs(S.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},className:"space-y-6",children:[e.jsxs(o,{className:"glass-card",children:[e.jsxs(g,{children:[e.jsx(u,{children:r("orderer.registration.contactDetails")}),e.jsx(f,{children:r("orderer.registration.contactDetailsDesc")})]}),e.jsxs(n,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(a,{htmlFor:"contactPerson",children:[r("orderer.registration.contactPerson")," *"]}),e.jsx(d,{id:"contactPerson",value:k,onChange:s=>re(s.target.value),placeholder:r("orderer.registration.contactPersonPlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(a,{htmlFor:"contactEmail",children:[r("orderer.registration.email")," *"]}),e.jsx(d,{id:"contactEmail",type:"email",value:P,onChange:s=>q(s.target.value),placeholder:r("orderer.registration.emailPlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a,{htmlFor:"contactPhone",children:r("orderer.registration.phone")}),e.jsx(d,{id:"contactPhone",type:"tel",value:G,onChange:s=>se(s.target.value),placeholder:r("orderer.registration.phonePlaceholder")})]})]})]}),e.jsxs(o,{className:"glass-card",children:[e.jsxs(g,{children:[e.jsx(u,{children:r("orderer.registration.billingAddress")}),e.jsx(f,{children:r("orderer.registration.billingAddressDesc")})]}),e.jsxs(n,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(a,{htmlFor:"streetAddress",children:[r("orderer.registration.streetAddress")," *"]}),e.jsx(d,{id:"streetAddress",value:T,onChange:s=>te(s.target.value),placeholder:r("orderer.registration.streetAddressPlaceholder")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(a,{htmlFor:"postalCode",children:[r("orderer.registration.postalCode")," *"]}),e.jsx(d,{id:"postalCode",value:I,onChange:s=>ae(s.target.value),placeholder:r("orderer.registration.postalCodePlaceholder")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(a,{htmlFor:"city",children:[r("orderer.registration.city")," *"]}),e.jsx(d,{id:"city",value:M,onChange:s=>ie(s.target.value),placeholder:r("orderer.registration.cityPlaceholder")})]})]})]})]}),e.jsx(p,{onClick:()=>H()&&O(3),className:"w-full",size:"lg",children:r("orderer.registration.continue")})]}),h===3&&e.jsxs(S.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},className:"space-y-6",children:[e.jsxs(o,{className:"glass-card",children:[e.jsxs(g,{children:[e.jsx(u,{children:r("orderer.registration.paymentMethod")}),e.jsx(f,{children:r("orderer.registration.choosePaymentMethod")})]}),e.jsx(n,{children:e.jsxs(K,{value:i,onValueChange:s=>w(s),children:[e.jsxs("div",{className:`flex items-start space-x-3 p-4 rounded-lg border transition-colors cursor-pointer ${i==="stripe"?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,onClick:()=>w("stripe"),children:[e.jsx(D,{value:"stripe",id:"stripe",className:"mt-1"}),e.jsx(W,{className:"w-5 h-5 text-muted-foreground mt-0.5"}),e.jsxs(a,{htmlFor:"stripe",className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:r("orderer.registration.cardPayment")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r("orderer.registration.cardPaymentDesc")})]})]}),e.jsxs("div",{className:`flex items-start space-x-3 p-4 rounded-lg border transition-colors cursor-pointer ${i==="invoice"?"border-primary bg-primary/5":"border-border hover:border-primary/50"}`,onClick:()=>w("invoice"),children:[e.jsx(D,{value:"invoice",id:"invoice",className:"mt-1"}),e.jsx(ue,{className:"w-5 h-5 text-muted-foreground mt-0.5"}),e.jsxs(a,{htmlFor:"invoice",className:"flex-1 cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:r("orderer.registration.invoicePayment")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r("orderer.registration.invoiceDesc")})]})]})]})})]}),i==="invoice"&&e.jsxs(e.Fragment,{children:[b&&e.jsx(o,{className:"glass-card border-primary/30",children:e.jsx(n,{className:"pt-6",children:e.jsxs("div",{className:"flex gap-3 items-center",children:[e.jsx(F,{className:"w-5 h-5 text-primary animate-spin shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium text-primary",children:r("orderer.registration.creditCheckInProgress")}),e.jsx("p",{className:"text-muted-foreground mt-1",children:r("orderer.registration.checkingVia",{orgName:x})})]})]})})}),N==="approved"&&!b&&e.jsx(o,{className:"glass-card border-green-500/30",children:e.jsx(n,{className:"pt-6",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(B,{className:"w-5 h-5 text-green-500 shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium text-green-500",children:r("orderer.registration.creditCheckApproved")}),e.jsx("p",{className:"text-muted-foreground mt-1",children:r("orderer.registration.creditCheckApprovedDesc",{orgName:x})})]})]})})}),N==="denied"&&!b&&e.jsx(o,{className:"glass-card border-amber-500/30",children:e.jsx(n,{className:"pt-6",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(U,{className:"w-5 h-5 text-amber-500 shrink-0"}),e.jsxs("div",{className:"text-sm",children:[e.jsx("p",{className:"font-medium text-amber-500",children:r("orderer.registration.creditCheckNotApproved")}),e.jsx("p",{className:"text-muted-foreground mt-1",children:r("orderer.registration.creditCheckNotApprovedDesc",{orgName:x})}),e.jsxs(p,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>w("stripe"),children:[e.jsx(W,{className:"w-4 h-4 mr-2"}),r("orderer.registration.chooseCardPayment")]})]})]})})})]}),e.jsxs(o,{className:"glass-card",children:[e.jsx(g,{children:e.jsx(u,{children:r("orderer.registration.summary")})}),e.jsxs(n,{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:r("orderer.registration.organization")}),e.jsx("span",{children:x})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:r("orderer.registration.orgNumber")}),e.jsx("span",{className:"font-mono",children:v})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:r("orderer.registration.contact")}),e.jsx("span",{children:k})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-muted-foreground",children:r("orderer.registration.paymentMethod")}),e.jsx("span",{children:r(i==="stripe"?"orderer.registration.card":"orderer.registration.invoicePayment")})]})]})]}),e.jsx(p,{onClick:de,className:"w-full",size:"lg",disabled:L||b||i==="invoice"&&N!=="approved",children:L?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-4 h-4 mr-2 animate-spin"}),r("orderer.registration.registering")]}):b?e.jsxs(e.Fragment,{children:[e.jsx(F,{className:"w-4 h-4 mr-2 animate-spin"}),r("orderer.registration.waitingForCreditCheck")]}):e.jsxs(e.Fragment,{children:[e.jsx(B,{className:"w-4 h-4 mr-2"}),r("orderer.registration.completeRegistration")]})})]})]}),e.jsx(J,{})]})};export{ze as default};
|
|
//# sourceMappingURL=OrdererRegistration-BiflvXWp.js.map
|