PageSourceSearch

https://ssoportal.dbkl.gov.my/assets/EndorsementsPage-B454YafW.js

js dbkl.gov.my collected 2026-09-24 09:24:55 UTC 8,369 bytes, 1 lines download raw bytes

1import{e as ue,a as ge,$ as fe,r as o,j as s,B as f}from"./index-C2Ck_hQk.js";import{a as S,g as U}from"./apiClient-C4N6sn9J.js";import{a as pe}from"./datetime-CDRYhGzF.js";import{s as l}from"./index-BqFznvHJ.js";import{S as L,T as me}from"./index-BHYvtf69.js";import{T as he,R as xe}from"./index-BGGN1bJc.js";import{T as W}from"./index-BozNo5lt.js";import{R as ye}from"./DownloadOutlined-C7kxJTu3.js";import{C as G}from"./index-BcIMf13e.js";import{R as H,C as w}from"./row-BWiv9UYE.js";import{E as J}from"./index-CpjAYDrg.js";import{I as je}from"./index-Dc88BRgm.js";import{R as Se}from"./SearchOutlined-a6Puw7u8.js";import{S as we}from"./index-DqPirz55.js";import{F as Re}from"./Table-GuT7WoYV.js";import{R as ve}from"./ReloadOutlined-Dv_zg7iL.js";import{M as Ce}from"./index-Cz-cqOE7.js";import{R as Te}from"./DeleteOutlined-_IRXCnBX.js";import{R as ke}from"./UploadOutlined-DxXfXhAb.js";import{s as be}from"./index-Domgm94v.js";import"./EllipsisOutlined-DIV8NI9X.js";import"./useBreakpoint-DlSAgkQ2.js";import"./Input-Do526fC5.js";import"./PurePanel-DPow7OQr.js";import"./DownOutlined-CKzy86DD.js";import"./index-DS7k8J1v.js";import"./useBubbleLock-_ftajmed.js";import"./index-BiViRNPP.js";import"./LeftOutlined-CHl-lZ_J.js";import"./index-CW8cQO-u.js";import"./Pagination-Bfup9OV4.js";const{Text:p,Paragraph:M}=he,Ie={Signed:"success",AwaitingApproval:"processing",Approved:"processing",Signing:"processing",Rejected:"error",Failed:"error",Expired:"default"},it=({memberView:m=!1})=>{const{slug:i}=ue(),{t:a}=ge(["endorsements","common"]),{token:A}=fe.useToken(),[K,X]=o.useState([]),[Y,q]=o.useState(0),[R,v]=o.useState(1),[C,Q]=o.useState(20),[h,Z]=o.useState(null),[x,V]=o.useState(""),[z,B]=o.useState(!1),[ee,T]=o.useState(!1),[k,te]=o.useState(null),[se,F]=o.useState(!1),c=o.useRef(null),P=o.useRef(null),b=o.useRef(!1),g=o.useRef(!1),I=o.useCallback(async()=>{if(i){B(!0);try{const e={page:R,pageSize:C};h&&(e.status=h),x&&(e.search=x);const{data:t}=await S.get(`/org/${i}/endorsements`,{params:e});X(t.data??[]),q(t.pagination?.totalCount??0)}catch(e){l.error(U(e,a("messages.loadFailed")))}finally{B(!1)}}},[i,R,C,h,x,a]);o.useEffect(()=>{I()},[I]);const E=o.useCallback(async()=>{if(i)try{const{data:e}=await S.get(`/org/${i}/signature-image`);te(e.data?.imageData??null)}catch{}},[i]);o.useEffect(()=>{E()},[E]);const ae=async e=>{try{const{data:t}=await S.get(`/org/${i}/endorsements/${e.id}/document`),r=t.data?.signedDocumentBase64;if(!r){l.error(a("messages.downloadUnavailable"));return}const n=Uint8Array.from(atob(r),y=>y.charCodeAt(0)),d=URL.createObjectURL(new Blob([n],{type:"application/pdf"})),u=document.createElement("a");u.href=d,u.download=`${e.refNo||e.id}-signed.pdf`,u.click(),URL.revokeObjectURL(d)}catch(t){l.error(U(t,a("messages.downloadUnavailable")))}},oe=()=>{T(!0),g.current=!1,setTimeout(()=>{const e=c.current;if(!e)return;const t=e.getContext("2d");t&&(t.fillStyle="#ffffff",t.fillRect(0,0,e.width,e.height),t.strokeStyle="#000000",t.lineWidth=2.5,t.lineJoin="round",t.lineCap="round")},50)},O=e=>{const t=c.current,r=t.getBoundingClientRect(),n="touches"in e?e.touches[0]:e;return{x:(n.clientX-r.left)/r.width*t.width,y:(n.clientY-r.top)/r.height*t.height}},D=e=>{b.current=!0,g.current=!0;const t=c.current?.getContext("2d"),{x:r,y:n}=O(e);t?.beginPath(),t?.moveTo(r,n)},N=e=>{if(!b.current)return;const t=c.current?.getContext("2d"),{x:r,y:n}=O(e);t?.lineTo(r,n),t?.stroke()},$=()=>{b.current=!1},re=()=>{const e=c.current,t=e?.getContext("2d");!e||!t||(t.fillStyle="#ffffff",t.fillRect(0,0,e.width,e.height),g.current=!1)},ne=async e=>{if(!e.type.startsWith("image/")){l.error(a("signature.uploadNotImage"));return}if(e.size>10*1024*1024){l.error(a("signature.uploadTooLarge"));return}const t=URL.createObjectURL(e);try{const r=await new Promise((le,de)=>{const j=new Image;j.onload=()=>le(j),j.onerror=()=>de(new Error("decode failed")),j.src=t}),n=c.current,d=n?.getContext("2d");if(!n||!d)return;d.fillStyle="#ffffff",d.fillRect(0,0,n.width,n.height);const u=Math.min(n.width/r.width,n.height/r.height),y=r.width*u,_=r.height*u;d.drawImage(r,(n.width-y)/2,(n.height-_)/2,y,_),g.current=!0}catch{l.error(a("signature.uploadFailed"))}finally{URL.revokeObjectURL(t)}},ie=async()=>{const e=c.current;if(e){if(!g.current){l.warning(a("signature.drawFirst"));return}F(!0);try{const t=e.toDataURL("image/png");await S.put(`/org/${i}/signature-image`,{imageData:t}),be.success({message:a("signature.saved"),placement:"topRight"}),T(!1),E()}catch(t){l.error(U(t,a("signature.saveFailed")))}finally{F(!1)}}},ce=[{title:a("columns.refNo"),dataIndex:"refNo",key:"refNo",width:160,render:(e,t)=>s.jsxs(L,{direction:"vertical",size:0,children:[s.jsx(p,{strong:!0,children:e||"—"}),t.docType&&s.jsx(p,{type:"secondary",style:{fontSize:11},children:t.docType})]})},{title:a("columns.status"),dataIndex:"status",key:"status",width:150,render:(e,t)=>s.jsx(me,{title:t.failReason||void 0,children:s.jsx(W,{color:Ie[e]??"default",children:a(`status.${e}`,{defaultValue:e})})})},{title:a("columns.factors"),dataIndex:"approvalFactors",key:"approvalFactors",width:150,render:e=>e?s.jsx(L,{size:4,wrap:!0,children:e.split(",").map(t=>s.jsx(W,{children:t},t))}):s.jsx(p,{type:"secondary",children:"—"})},{title:a("columns.placement"),key:"placement",width:110,render:(e,t)=>s.jsxs(p,{type:"secondary",style:{fontSize:12},children:[a("columns.page")," ",t.pageNo]})},{title:a("columns.created"),dataIndex:"createdAt",key:"createdAt",width:170,render:e=>pe(e)},{title:a("columns.actions"),key:"actions",width:130,render:(e,t)=>t.status==="Signed"?s.jsx(f,{type:"link",size:"small",icon:s.jsx(ye,{}),onClick:()=>{ae(t)},children:a("actions.download")}):s.jsx(p,{type:"secondary",style:{fontSize:12},children:"—"})}].filter(e=>e.key!=="actions");return s.jsxs("div",{children:[s.jsx(G,{title:a("signature.title"),extra:s.jsx(f,{icon:s.jsx(xe,{}),onClick:oe,children:a(k?"signature.change":"signature.create")}),style:{borderRadius:8,marginBottom:24},styles:{header:{flexWrap:"wrap",rowGap:8},title:{whiteSpace:"normal"}},children:s.jsxs(H,{gutter:[16,16],align:"middle",children:[s.jsx(w,{flex:"none",children:k?s.jsx("img",{src:k,alt:a("signature.title"),style:{height:80,background:"#fff",border:`1px solid ${A.colorBorderSecondary}`,borderRadius:6,padding:4}}):s.jsx(J,{image:J.PRESENTED_IMAGE_SIMPLE,description:a("signature.none")})}
1),s.jsx(w,{flex:"auto",children:s.jsx(M,{type:"secondary",style:{marginBottom:0},children:a("signature.help")})})]})}),s.jsxs(G,{title:a("title"),extra:s.jsx(f,{icon:s.jsx(ve,{}),onClick:()=>{I()},loading:z}),style:{borderRadius:8},children:[!m&&s.jsxs(H,{justify:"space-between",style:{marginBottom:16},gutter:[8,8],children:[s.jsx(w,{children:s.jsx(je,{placeholder:a("searchPlaceholder"),prefix:s.jsx(Se,{}),value:x,onChange:e=>{V(e.target.value),v(1)},allowClear:!0,style:{width:260}})}),s.jsx(w,{children:s.jsx(we,{placeholder:a("filterStatus"),value:h,onChange:e=>{Z(e),v(1)},allowClear:!0,style:{width:200},options:["AwaitingApproval","Signing","Signed","Rejected","Failed","Expired"].map(e=>({value:e,label:a(`status.${e}`,{defaultValue:e})}))})})]}),s.jsx(Re,{rowKey:"id",columns:ce,dataSource:K,loading:z,scroll:{x:"max-content"},size:"small",pagination:{current:R,pageSize:C,total:Y,showSizeChanger:!m,simple:m,showTotal:m?void 0:e=>a("totalItems",{total:e}),onChange:(e,t)=>{v(e),Q(t)}}})]}),s.jsxs(Ce,{title:a("signature.modalTitle"),open:ee,onCancel:()=>T(!1),onOk:()=>{ie()},confirmLoading:se,okText:a("signature.save"),destroyOnClose:!0,children:[s.jsx(M,{type:"secondary",children:a("signature.modalHelp")}),s.jsx("canvas",{ref:c,width:400,height:160,style:{width:"100%",height:"auto",touchAction:"none",cursor:"crosshair",border:`1px dashed ${A.colorBorder}`,borderRadius:6,background:"#fff"},onMouseDown:D,onMouseMove:N,onMouseUp:$,onMouseLeave:$,onTouchStart:D,onTouchMove:N,onTouchEnd:$}),s.jsxs(L,{style:{marginTop:12},children:[s.jsx(f,{icon:s.jsx(Te,{}),onClick:re,children:a("signature.clear")}),s.jsx(f,{icon:s.jsx(ke,{}),onClick:()=>P.current?.click(),children:a("signature.upload")}),s.jsx("input",{ref:P,type:"file",accept:"image/*",style:{display:"none"},onChange:e=>{const t=e.target.files?.[0];t&&ne(t),e.target.value=""}})]}),s.jsx(M,{type:"secondary",style:{marginTop:10,marginBottom:0,fontSize:12},children:a("signature.uploadHint")})]})]})};export{it 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.