2 lines
7.1 KiB
JavaScript
2 lines
7.1 KiB
JavaScript
import{r as k,b as T,j as e,bP as F}from"./vendor-BKmmeuxg.js";import{I as S}from"./input-error-LaPr_4wd.js";import{B as w}from"./button-BpNwv2aE.js";import{C as d,a as i,c as n,d as c,b as m}from"./card-D9_SJYq6.js";import{I as t}from"./input-DM0goJrn.js";import{L as o}from"./label-HmIcv5Yx.js";import{S as C,a as y,b as v,c as f,d as p}from"./select-CD9o3HN1.js";import{T as M}from"./textarea-CyndvowL.js";import I from"./marksheet-preview-C4ax8MzP.js";import"./utils-DxSsnXxD.js";import"./index-WW_1X1qx.js";const J=({template:r})=>{const[j,N]=k.useState(r==null?void 0:r.logo_path),{data:s,setData:l,post:u,processing:g,errors:h}=T({type:(r==null?void 0:r.type)||"course",name:(r==null?void 0:r.name)||"My Marksheet Template",logo:null,template_data:(r==null?void 0:r.template_data)||{primaryColor:"#1e40af",secondaryColor:"#475569",backgroundColor:"#ffffff",borderColor:"#2563eb",headerText:"Course Marksheet",institutionName:"Institute Name",footerText:"This is an official marksheet",fontFamily:"sans-serif"}}),_=(a,x)=>{l(a,x),N(URL.createObjectURL(x))},b=a=>{a.preventDefault(),u(r?route("marksheet.templates.update",r.id):route("marksheet.templates.store"))};return e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs(d,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Basic Information"}),e.jsx(c,{children:"Set the template name"})]}),e.jsxs(m,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"type",children:"Template Type"}),e.jsxs(C,{value:s.type,onValueChange:a=>l("type",a),children:[e.jsx(y,{children:e.jsx(v,{placeholder:"Select template type"})}),e.jsx(f,{children:e.jsx(p,{value:"course",children:"Course"})})]}),h.type&&e.jsx("p",{className:"text-sm text-red-500",children:h.type})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"name",children:"Template Name"}),e.jsx(t,{id:"name",value:s.name,onChange:a=>l("name",a.target.value),placeholder:"e.g., Modern Blue Marksheet"}),h.name&&e.jsx("p",{className:"text-sm text-red-500",children:h.name})]})]})]}),e.jsxs(d,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Logo & Branding"}),e.jsx(c,{children:"Upload your institution logo"})]}),e.jsx(m,{className:"space-y-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"logo",children:"Logo Image"}),e.jsxs("div",{className:"space-y-2",children:[j&&e.jsx("div",{className:"h-20 w-20 overflow-hidden rounded border",children:e.jsx("img",{src:j,alt:"Logo preview",className:"h-full w-full object-contain"})}),e.jsx("div",{className:"flex-1",children:e.jsx(t,{id:"logo",type:"file",accept:"image/*",onChange:a=>{var x;return _("logo",(x=a.target.files)==null?void 0:x[0])}})})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Recommended: PNG or SVG, max 1MB"}),e.jsx(S,{message:h.logo})]})})]}),e.jsxs(d,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Colors"}),e.jsx(c,{children:"Customize the marksheet color scheme"})]}),e.jsx(m,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"primaryColor",children:"Primary Color"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(t,{id:"primaryColor",type:"color",value:s.template_data.primaryColor,onChange:a=>l("template_data",{...s.template_data,primaryColor:a.target.value}),className:"h-10 w-16"}),e.jsx(t,{value:s.template_data.primaryColor,onChange:a=>l("template_data",{...s.template_data,primaryColor:a.target.value}),placeholder:"#1e40af"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"secondaryColor",children:"Secondary Color"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(t,{id:"secondaryColor",type:"color",value:s.template_data.secondaryColor,onChange:a=>l("template_data",{...s.template_data,secondaryColor:a.target.value}),className:"h-10 w-16"}),e.jsx(t,{value:s.template_data.secondaryColor,onChange:a=>l("template_data",{...s.template_data,secondaryColor:a.target.value}),placeholder:"#475569"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"backgroundColor",children:"Background Color"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(t,{id:"backgroundColor",type:"color",value:s.template_data.backgroundColor,onChange:a=>l("template_data",{...s.template_data,backgroundColor:a.target.value}),className:"h-10 w-16"}),e.jsx(t,{value:s.template_data.backgroundColor,onChange:a=>l("template_data",{...s.template_data,backgroundColor:a.target.value}),placeholder:"#ffffff"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"borderColor",children:"Border Color"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(t,{id:"borderColor",type:"color",value:s.template_data.borderColor,onChange:a=>l("template_data",{...s.template_data,borderColor:a.target.value}),className:"h-10 w-16"}),e.jsx(t,{value:s.template_data.borderColor,onChange:a=>l("template_data",{...s.template_data,borderColor:a.target.value}),placeholder:"#2563eb"})]})]})]})})]}),e.jsxs(d,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Typography"}),e.jsx(c,{children:"Choose the font style for your marksheet"})]}),e.jsx(m,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"fontFamily",children:"Font Family"}),e.jsxs(C,{value:s.template_data.fontFamily,onValueChange:a=>l("template_data",{...s.template_data,fontFamily:a}),children:[e.jsx(y,{children:e.jsx(v,{})}),e.jsxs(f,{children:[e.jsx(p,{value:"serif",children:"Serif (Classic)"}),e.jsx(p,{value:"sans-serif",children:"Sans Serif (Modern)"}),e.jsx(p,{value:"monospace",children:"Monospace (Technical)"})]})]})]})})]}),e.jsxs(d,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Marksheet Content"}),e.jsx(c,{children:"Customize the text content of your marksheet"})]}),e.jsxs(m,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"headerText",children:"Header Text"}),e.jsx(t,{id:"headerText",value:s.template_data.headerText,onChange:a=>l("template_data",{...s.template_data,headerText:a.target.value}),placeholder:"Course Marksheet"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"institutionName",children:"Institution Name"}),e.jsx(t,{id:"institutionName",value:s.template_data.institutionName,onChange:a=>l("template_data",{...s.template_data,institutionName:a.target.value}),placeholder:"Institute Name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{htmlFor:"footerText",children:"Footer Text"}),e.jsx(M,{id:"footerText",value:s.template_data.footerText,onChange:a=>l("template_data",{...s.template_data,footerText:a.target.value}),placeholder:"This is an official marksheet",rows:3})]})]})]}),e.jsxs(w,{onClick:b,disabled:g,className:"w-full",children:[e.jsx(F,{className:"mr-2 h-4 w-4"}),g?"Saving...":r?"Update Template":"Create Template"]})]}),e.jsx("div",{className:"lg:sticky lg:top-6",children:e.jsxs(d,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Live Preview"}),e.jsx(c,{children:"See how your marksheet will look"})]}),e.jsx(m,{children:e.jsx(I,{template:s,studentName:"John Doe",courseName:"Sample Course Name",completionDate:"January 1, 2025",logoUrl:j})})]})})]})};export{J as default};
|