1import{n as s,ay as B}from"./antdProComponents-6rzHkKcZ.js";import{j as C,r as c,L as b}from"./react-_5RlvHhi.js";import{b as g,dX as x,o as w,e4 as f,d as F,P as v,aJ as I}from"./index-C8gtYebm.js";import{a1 as d,a3 as S,S as k}from"./antdForm-ZZ85gsAg.js";import{aG as j}from"./antdBase-DlFOY6T8.js";import{c as q,b as M,u as L}from"./query-Bn7EN5Pb.js";import{M as N}from"./antdModal-Dh46Xjql.js";/* empty css */import{u as O,k as $}from"./antdIcons-DhY_pOHd.js";import"./antdTable-Cz58L6xH.js";import"./pdfjs-Jc8nWIli.js";import"./jspdf-B1PPRTPs.js";import"./utils-D8nkOfAZ.js";import"./tiptap-IID5qgYO.js";import"./reactPdf-ChLvjV_L.js";import"./antdMaskInput-f6hZ1glU.js";import"./antdProTable-Ch7uEBlj.js";import"./chart-DuBnvqdM.js";import"./others-6CDmzJG5.js";import"./pdfLib-_sLH-ZSH.js";import"./x6-CTQrGuB4.js";const E=({open:a,onClose:r,departments:u})=>{const{t}=g(),[o]=d.useForm(),i=C(),p=q();c.useEffect(()=>{a&&o.resetFields()},[a,o]);const{mutate:n,isLoading:h}=M({mutationFn:e=>x.createLessonBell(e),onSuccess:e=>{w("success",t("schedule.bell_created")),p.invalidateQueries({queryKey:["lesson-bells"]}),r(),e!=null&&e.id&&i(`${f}/${e.id}`)}}),m=async()=>{const e=await o.validateFields().catch(()=>null);e&&n({name:e.name,department_id:e.department_id||null})},_=u.map(e=>({value:e.id,label:e.short_name||e.name}));return s.jsx(N,{title:t("schedule.add_lesson_bell"),open:a,onOk:m,onCancel:r,okText:t("base.add"),cancelText:t("base.cancel"),confirmLoading:h,destroyOnHidden:!0,children:s.jsxs(d,{form:o,layout:"vertical",name:"create_lesson_bell_form",children:[s.jsx(d.Item,{name:"name",label:t("schedule.lesson_bell_name"),rules:[{required:!0,message:t("base.required")}],children:s.jsx(S,{placeholder:t("schedule.input")})}),s.jsx(d.Item,{name:"department_id",label:t("schedule.faculty"),children:s.jsx(k,{showSearch:!0,allowClear:!0,optionFilterProp:"label",options:_,placeholder:t("schedule.select_placeholder"),notFoundContent:s.jsx("div",{children:t("base.empty_data")})})})]})})},{Search:T}=S,ne=()=>{const{t:a}=g(),[r,u]=c.useState(""),[t,o]=c.useState(!1);F("sidebar.timetable");const{data:i,isFetching:p}=L({queryKey:["lesson-bells"],queryFn:()=>x.getLessonBells(void 0,1e3)}),{data:n}=L({queryKey:["department",""],queryFn:()=>x.getDepartments("")}),h=c.useMemo(()=>{const e={};return((n==null?void 0:n.items)||[]).forEach(l=>{e[l.id]=l.short_name||l.name}),e},[n]),m=c.useMemo(()=>{const e=(i==null?void 0:i.items)||[];return r?e.filter(l=>{var y;return(y=l.name)==null?void 0:y.toLowerCase().includes(r.toLowerCase())}):e},[i,r]),_=[{title:a("schedule.lesson_bell_name"),dataIndex:"name",key:"name",render:(e,l)=>s.jsx(b,{to:`${f}/${l.id}`,children:l.name})},{title:a("schedule.faculty"),dataIndex:"department_id",key:"department_id",render:e=>h[e]||"-"},{title:"",key:"open",align:"right",width:60,render:(e,l)=>s.jsx(b,{to:`${f}/${l.id}`,children:s.jsx(j,{type:"text",icon:s.jsx(O,{})})})}];return s.jsxs("div",{className:"LessonBells",children:[s.jsx(v,{text:a("schedule.lesson_bells_page_title")}),s.jsxs(B,{justify:"space-between",align:"center",gap:"small",wrap:"wrap",className:"LessonBells__parameters",children:[s.jsx(T,{placeholder:a("schedule.search_name"),allowClear:!0,enterButton:s.jsx($,{}),size:"middle",onSearch:u,className:"LessonBells__search"}),s.jsx(j,{type:"primary",onClick:()=>o(!0),children:a("schedule.add_lesson_bell")})]}),s.jsx(I,{rowKey:"id",count:m.length,dataSource:m,columns:_,loading:p,className:"LessonBells__table"}),s.jsx(E,{open:t,onClose:()=>o(!1),departments:(n==null?void 0:n.items)||[]})]})};export{ne 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.