PageSourceSearch

https://riederalm.lovable.app/assets/SlaughterCalendar-BUeecetS.js

js riederalm.lovable.app collected 2026-10-03 03:43:43 UTC 7,100 bytes, 1 lines download raw bytes

1import{u as A,r as l,j as e,L as B}from"./react-vendor-CShGlGts.js";import{ak as I,cI as $,dD as V,dE as _,am as R,cn as F,B as o,bq as P,a_ as v,an as z,t as i,ac as G,a7 as W,ap as h,C as w,a as S,w as x}from"./index-BYC0bmF9.js";import{a as Y,T as p,g as q}from"./types-B64xs56M.js";import{N as U}from"./NewBatchDialog-B1WMr-Ep.js";import{e as H}from"./eachDayOfInterval-D5-p0Ane.js";import{s as C}from"./startOfMonth-B-rb6ulI.js";import{e as J,i as Q}from"./isSameMonth-CQvZjdv-.js";import{a as T}from"./addMonths-CxZqvFR-.js";import{i as X}from"./isToday-BtUqHBn8.js";import"./query-BUBuIGkW.js";import"./shared-utils--gW9Kwo0.js";import"./supabase-C0joAID3.js";import"./slaughterService-BQrS1Jze.js";import"./ProducerFormDialog-C9bgIx9w.js";import"./isSameDay-C8GttKCU.js";const u=c=>i(c,"yyyy-MM-dd"),Z={slaughter:"slaughter",offal_pickup:"offal",offal_processing:"offal",meat_pickup:"meat",meat_allocation:"meat",external_handover:"external_handover",external_return:"external_return",completion:"meat"},L={slaughter:"bg-destructive/10 text-destructive border-destructive/30",offal:"bg-amber-500/10 text-amber-700 border-amber-500/30 dark:text-amber-400",meat:"bg-primary/10 text-primary border-primary/30",external_handover:"bg-blue-500/10 text-blue-700 border-blue-500/30 dark:text-blue-400",external_return:"bg-emerald-500/10 text-emerald-700 border-emerald-500/30 dark:text-emerald-400"},M={slaughter:"Schlachtung",offal:"Innereien",meat:"Fleisch",external_handover:"Externe Übergabe",external_return:"Rücklieferung"};function ue(){const c=A(),[r,g]=l.useState(()=>C(new Date)),[k,m]=l.useState(!1),[D,f]=l.useState(void 0),[j,E]=l.useState("calendar"),b=I(C(r),{weekStartsOn:1}),N=J($(r),{weekStartsOn:1}),O=H({start:b,end:N}),{data:d=[]}=Y(u(b),u(N)),K=l.useMemo(()=>{const a=new Map;for(const t of d){if(!t.planned_date)continue;const n=a.get(t.planned_date)??[];n.push(t),a.set(t.planned_date,n)}return a},[d]),y=l.useMemo(()=>[...d].filter(a=>!!a.planned_date).sort((a,t)=>a.planned_date.localeCompare(t.planned_date)||a.sort_order-t.sort_order),[d]);return e.jsxs("div",{className:"container mx-auto space-y-4 p-4 md:p-6",children:[e.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold md:text-3xl",children:"Schlacht-Kalender"}),e.jsx("p",{className:"text-muted-foreground",children:"Alle Termine aus den Schlachtvorgängen."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 print:hidden",children:[e.jsxs(V,{type:"single",value:j,onValueChange:a=>a&&E(a),variant:"outline",children:[e.jsxs(_,{value:"calendar","aria-label":"Kalenderansicht",children:[e.jsx(R,{className:"mr-2 h-4 w-4"}),"Kalender"]}),e.jsxs(_,{value:"table","aria-label":"Tabellenansicht",children:[e.jsx(F,{className:"mr-2 h-4 w-4"}),"Tabelle"]})]}),e.jsxs(o,{variant:"outline",onClick:()=>window.print(),children:[e.jsx(P,{className:"mr-2 h-4 w-4"}),"Drucken"]}),e.jsx(o,{variant:"outline",asChild:!0,children:e.jsx(B,{to:"/kitchen/schlachtung",children:"Übersicht"})}),e.jsxs(o,{onClick:()=>{f(void 0),m(!0)},children:[e.jsx(v,{className:"mr-2 h-4 w-4"}),"Neuer Vorgang"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between print:hidden",children:[e.jsx(o,{variant:"outline",size:"icon",onClick:()=>g(T(r,-1)),"aria-label":"Vorheriger Monat",children:e.jsx(z,{className:"h-4 w-4"})}),e.jsx("h2",{className:"text-lg font-semibold",children:i(r,"LLLL yyyy",{locale:x})}),e.jsx(o,{variant:"outline",size:"icon",onClick:()=>g(T(r,1)),"aria-label":"Nächster Monat",children:e.jsx(G,{className:"h-4 w-4"})})]}),e.jsxs("h2",{className:"hidden text-lg font-semibold print:block",children:["Schlacht-Termine ",i(r,"LLLL yyyy",{locale:x})]}),e.jsx("div",{className:"flex flex-wrap gap-2 print:hidden",children:Object.keys(M).map(a=>e.jsx(W,{variant:"outline",className:h("text-xs",L[a]),children:M[a]},a))}),j==="calendar"?e.jsx(w,{className:"print:border-0 print:shadow-none",children:e.jsxs(S,{className:"p-2 md:p-4",children:[e.jsx("div",{className:"grid grid-cols-7 gap-1 text-center text-xs font-medium text-muted-foreground",children:["Mo","Di","Mi","Do","Fr","Sa","So"].map(a=>e.jsx("div",{className:"py-1",children:a},a))}),e.jsx("div",{className:"grid grid-cols-7 gap-1",children:O.map(a=>{const t=u(a),n=K.get(t)??[];return e.jsxs("div",{className:h("min-h-[92px] rounded-md border p-1 text-left align-top",!Q(a,r)&&"bg-muted/40 text-muted-foreground",X(a)&&"ring-2 ring-primary"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold",children:i(a,"d")}),e.jsx("button",{type:"button",className:"text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus:opacity-100 group-hover:opacity-100 md:opacity-60","aria-label":`Vorgang am ${i(a,"dd.MM.yyyy")} anlegen`,onClick:()=>{f(t),m(!0)},children:e.jsx(v,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"mt-1 space-y-1",children:[n.slice(0,3).map(s=>e.jsxs("button",{type:"button",onClick:()=>c(`/kitchen/schlachtung/vorgang/${s.slaughter_batch_id}`),className:h("w-full truncate rounded border px-1 py-0.5 text-left text-[11px] leading-tight",L[Z[s.task_type]],s.status==="erledigt"&&"line-through opacity-60"),title:`${p[s.task_type]} · ${s.batch.animal_count}× ${s.batch.animal_type_name}`,children:[s.batch.animal_type_name,": ",p[s.task_type]]},s.id)),n.length>3&&e.jsxs("p",{className:"px-1 text-[11px] text-muted-foreground",children:["+",n.length-3," weitere"]})]})]},t)})})]})}):e.jsx(w,{className:"print:border-0 print:shadow-none",children:e.jsx(S,{className:"overflow-x-auto p-0 md:p-2",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"border-b text-left text-xs uppercase text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"p-2",children:"Datum"}),e.jsx("th",{className:"p-2",children:"Tiere"}),e.jsx("th",{className:"p-2",children:"Schritt"}),e.jsx("th",{className:"p-2",children:"Bauer"}),e.jsx("th",{className:"p-2",children:"Fleischer"}),e.jsx("th",{className:"p-2",children:"Status"})]})}),e.jsxs("tbody",{children:[y.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"p-4 text-center text-muted-foreground",children:"Keine Termine in diesem Monat."})}),y.map(a=>e.jsxs("tr",{className:"cursor-pointer border-b hover:bg-muted/50",onClick:()=>c(`/kitchen/schlachtung/vorgang/${a.slaughter_batch_id}`),children:[e.jsx("td",{className:"whitespace-nowrap p-2 font-medium",children:i(new Date(`${a.planned_date}T00:00:00`),"EEE dd.MM.yyyy",{locale:x})}),e.jsxs("td",{className:"p-2",children:[a.batch.animal_count," ",a.batch.animal_type_name]}),e.jsx("td",{className:"p-2",children:p[a.task_type]}),e.jsx("td",{className:"p-2",children:a.batch.producer_name??"–"}),e.jsx("td",{className:"p-2",children:a.batch.slaughterer_name??"–"}),e.jsx("td",{className:"p-2",children:q[a.status]})]},a.id))]})]})})}),e.jsx(U,{open:k,onOpenChange:m,defaultDate:D,onCreated:a=>c(`/kitchen/schlachtung/vorgang/${a}`)})]})}export{ue 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.