1import{_ as b,c as a,a as t,d as _,t as n,b as g,w,s as C,E as M,f as u,G as h,H as p,B as x,l as P,o as l,n as k,F as L,K as v}from"./index.gEWZ_ovx.js";const F={name:"Productions",metaInfo(){return{title:"Productions Agricoles - Jangolo"}},data(){return{productions:[],ready:!1,searchQuery:"",activeFilter:"ALL"}},computed:{filters(){return[{value:"ALL",labelKey:"filter_all",tone:"neutral"},{value:"OPEN",labelKey:"filter_open",tone:"green"},{value:"EXPIRED",labelKey:"filter_expired",tone:"gray"}]},filteredProductions(){let s=this.productions;if(this.activeFilter!=="ALL"&&(s=s.filter(e=>e.status===this.activeFilter)),this.searchQuery){const e=this.searchQuery.toLowerCase();s=s.filter(i=>(i.product||"").toLowerCase().includes(e)||(i.reference||"").toLowerCase().includes(e))}return s},localeCode(){const s={fr:"fr-FR",en:"en-GB",nl:"nl-NL",de:"de-DE"},e=this.$vuetify&&this.$vuetify.lang&&this.$vuetify.lang.current||"fr";return s[e]||"fr-FR"}},methods:{t(s){return this.$vuetify.lang.t("$vuetify.farmerProductions."+s)},tArgs(s,...e){return this.$vuetify.lang.t("$vuetify.farmerProductions."+s,...e)},countFor(s){return s==="ALL"?this.productions.length:this.productions.filter(e=>e.status===s).length},countLabel(s){return this.t(s===1?"count_singular":"count_plural")},formatNum(s){const e=Number(s);return isFinite(e)?e.toLocaleString(this.localeCode):s},formatShort(s){if(!s)return"â";const e=new Date(s);return isNaN(e.getTime())?"â":e.toLocaleDateString(this.localeCode,{day:"2-digit",month:"short",year:"2-digit"})},progressPct(s){if(!s.start_date||!s.end_date)return 0;const e=new Date(s.start_date).getTime(),i=new Date(s.end_date).getTime(),c=Date.now();return!isFinite(e)||!isFinite(i)||i<=e||c<=e?0:c>=i?100:Math.round((c-e)/(i-e)*100)},cycleStatusLabel(s){if(!s.start_date||!s.end_date)return"â";const e=new Date(s.end_date).getTime(),i=Date.now(),c=1e3*60*60*24;if(s.status==="EXPIRED"||i>=e){if(i>e+c){const r=Math.round((i-e)/c);return this.tArgs("cycle_overdue",r)}return this.t("cycle_done")}const d=Math.max(0,Math.round((e-i)/c));return this.tArgs("cycle_remaining",d)},resetFilters(){this.searchQuery="",this.activeFilter="ALL"},getProductions(){window.axios.get("https://vanilla.jangolo.com/productions").then(e=>{this.productions=e.data&&e.data.data||[],this.ready=!0}).catch(()=>{this.ready=!0})}},mounted(){this.getProductions()}},B={class:"prods-page"},D={class:"prods-shell"},N={class:"masthead"},E={class:"masthead__kicker"},S={class:"masthead__row"},j={class:"masthead__title"},A={class:"masthead__title-a"},z={class:"masthead__title-b"},K={class:"masthead__tagline"},Q={class:"rail","aria-label":"Filtres"},V={class:"rail__search"},I=["placeholder"],R={class:"rail__filters"},T=["onClick"],X={class:"rail__pill-count"},q={key:0,class:"action-bar"},H={key:0,class:"action-bar__count"},G={class:"action-bar__count-num"},J={key:1,class:"prods-loading"},O={key:2,class:"empty"},U={class:"empty__title"},W={class:"empty__hint"},Y={key:3,class:"no-results"},Z={class:"no-results__title"},$={class:"no-results__hint"},tt={key:4,class:"prods-grid",role:"list"},et=["onClick","onKeydown"],rt={class:"prod__status"},st={class:"prod__status-label"},ot={class:"prod__head"},nt={class:"prod__thumb"},at=["src","alt"],lt={key:1,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},it={class:"prod__title-block"},dt={class:"prod__name"},ct={key:0,class:"prod__ref"},ut={class:"prod__cycle"},_t={class:"prod__cycle-head"},ht={class:"prod__cycle-label"},pt={class:"prod__cycle-status"},kt={class:"prod__cycle-bar"},vt={class:"prod__cycle-dates"},yt={class:"prod__foot"},ft={class:"prod__stats"},gt={key:0,class:"prod__stat"},wt={class:"prod__stat-num"},mt={class:"prod__stat-unit"},bt={key:1,class:"prod__stat"},Ct={class:"prod__stat-num"},Mt={class:"prod__stat-unit"},xt={class:"prod__view"};function Pt(s,e,i,c,d,r){const y=P("router-link");return l(),a("div",B,[t("div",D,[t("header",N,[t("span",E,[e[3]||(e[3]=t("span",{class:"masthead__kicker-mark"},null,-1)),_(" "+n(r.t("kicker")),1)]),t("div",S,[t("h1",j,[t("span",A,n(r.t("title_a")),1),t("span",z,[_("Â "+n(r.t("title_b")),1),e[4]||(e[4]=t("span",{class:"masthead__dot"},".",-1))])]),g(y,{to:"/farmer/productions/create",class:"prods-cta-pill"},{default:w(()=>[e[5]||(e[5]=t("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[t("path",{d:"M12 5v14M5 12h14",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})],-1)),t("span",null,n(r.t("cta_new")),1)]),_:1})]),t("p",K,n(r.t("tagline")),1)]),t("section",Q,[t("div",V,[e[7]||(e[7]=t("svg",{class:"rail__search-icon",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[t("circle",{cx:"11",cy:"11",r:"7",stroke:"currentColor","stroke-width":"1.7"}),t("path",{d:"M20 20l-3-3",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round"})],-1)),C(t("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>d.searchQuery=o),type:"text",placeholder:r.t("search_placeholder"),class:"rail__search-input"},null,8,I),[[M,d.searchQuery]]),d.searchQuery?(l(),a("button",{key:0,t
1ype:"button",class:"rail__clear-input",onClick:e[1]||(e[1]=o=>d.searchQuery=""),"aria-label":"clear"},[...e[6]||(e[6]=[t("svg",{viewBox:"0 0 24 24",fill:"none"},[t("path",{d:"M18 6L6 18M6 6l12 12",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"})],-1)])])):u("",!0)]),t("div",R,[(l(!0),a(h,null,p(r.filters,o=>(l(),a("button",{key:o.value,type:"button",class:k(["rail__pill",{"is-active":d.activeFilter===o.value}]),onClick:f=>d.activeFilter=o.value},[t("span",{class:k(["rail__pill-dot","rail__pill-dot--"+o.tone])},null,2),t("span",null,n(r.t(o.labelKey)),1),t("span",X,n(r.countFor(o.value)),1)],10,T))),128))])]),d.ready?(l(),a("div",q,[r.filteredProductions.length>0?(l(),a("p",H,[t("span",G,n(r.filteredProductions.length),1),_(" "+n(r.countLabel(r.filteredProductions.length)),1)])):u("",!0)])):u("",!0),d.ready?d.productions.length?r.filteredProductions.length?(l(),a("ul",tt,[(l(!0),a(h,null,p(r.filteredProductions,(o,f)=>(l(),a("li",{key:o.id,class:k(["prod",["prod--"+(o.status==="EXPIRED"?"closed":"open")]]),style:v({"--i":f}),onClick:m=>s.$router.push("/farmer/productions/"+o.id),tabindex:"0",onKeydown:L(m=>s.$router.push("/farmer/productions/"+o.id),["enter"])},[t("div",rt,[e[11]||(e[11]=t("span",{class:"prod__status-dot"},null,-1)),t("span",st,n(o.status==="EXPIRED"?r.t("status_expired"):r.t("status_open")),1)]),t("div",ot,[t("div",nt,[o.product_img?(l(),a("img",{key:0,src:o.product_img,alt:o.product||"Production",loading:"lazy"},null,8,at)):(l(),a("svg",lt,[...e[12]||(e[12]=[t("path",{d:"M12 4c-3 2-5 5-5 8 0 4 2 8 5 8s5-4 5-8c0-3-2-6-5-8z",stroke:"currentColor","stroke-width":"1.6","stroke-linejoin":"round"},null,-1),t("path",{d:"M12 12v8",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},null,-1)])]))]),t("div",it,[t("h3",dt,n(o.product||"â"),1),o.reference?(l(),a("span",ct,"#"+n(o.reference),1)):u("",!0)])]),t("div",ut,[t("div",_t,[t("span",ht,n(r.t("cycle")),1),t("span",pt,n(r.cycleStatusLabel(o)),1)]),t("div",kt,[t("span",{class:"prod__cycle-bar-fill",style:v({width:r.progressPct(o)+"%"})},null,4),e[13]||(e[13]=t("span",{class:"prod__cycle-bar-marker prod__cycle-bar-marker--start"},null,-1)),r.progressPct(o)>0&&r.progressPct(o)<100?(l(),a("span",{key:0,class:"prod__cycle-bar-marker prod__cycle-bar-marker--now",style:v({left:r.progressPct(o)+"%"})},null,4)):u("",!0),e[14]||(e[14]=t("span",{class:"prod__cycle-bar-marker prod__cycle-bar-marker--end"},null,-1))]),t("div",vt,[t("time",null,n(r.formatShort(o.start_date)),1),t("time",null,n(r.formatShort(o.end_date)),1)])]),t("footer",yt,[t("div",ft,[o.land_surface?(l(),a("span",gt,[e[15]||(e[15]=t("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[t("rect",{x:"3",y:"3",width:"18",height:"18",rx:"1.5",stroke:"currentColor","stroke-width":"1.6"}),t("path",{d:"M3 9h18M9 21V3",stroke:"currentColor","stroke-width":"1.6"})],-1)),t("span",wt,n(r.formatNum(o.land_surface)),1),t("span",mt,n(r.t("unit_surface")),1)])):u("",!0),o.quantity?(l(),a("span",bt,[e[16]||(e[16]=t("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[t("path",{d:"M4 7h16l-1 13H5L4 7z",stroke:"currentColor","stroke-width":"1.6","stroke-linejoin":"round"}),t("path",{d:"M9 7V4h6v3",stroke:"currentColor","stroke-width":"1.6","stroke-linejoin":"round"})],-1)),t("span",Ct,n(r.formatNum(o.quantity)),1),t("span",Mt,n(r.t("unit_units")),1)])):u("",!0)]),t("span",xt,[_(n(r.t("view"))+" ",1),e[17]||(e[17]=t("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[t("path",{d:"M5 12h14M13 6l6 6-6 6",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"})],-1))])])],46,et))),128))])):(l(),a("div",Y,[e[10]||(e[10]=t("svg",{viewBox:"0 0 48 48",fill:"none","aria-hidden":"true"},[t("circle",{cx:"22",cy:"22",r:"14",stroke:"currentColor","stroke-width":"2"}),t("path",{d:"M42 42l-8-8",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}),t("path",{d:"M16 22h12",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})],-1)),t("h3",Z,n(r.t("no_results")),1),t("p",$,n(r.t("no_results_hint")),1),t("button",{type:"button",class:"btn btn--outline",onClick:e[2]||(e[2]=(...o)=>r.resetFilters&&r.resetFilters(...o))},n(r.t("clear_filters")),1)])):(l(),a("div",O,[e[9]||(e[9]=x('<svg viewBox="0 0 64 64" fill="none" aria-hidden="true" data-v-069275b0><path d="M8 28c0-3 3-6 8-6s8 3 8 6c0 6-4 11-8 11s-8-5-8-11z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" data-v-069275b0></path><path d="M40 28c0-3 3-6 8-6s8 3 8 6c0 6-4 11-8 11s-8-5-8-11z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" data-v-069275b0></path><path d="M32 4v32" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" data-v-069275b0></path><path d="M22 12c4 2 8 6 10 12c2-6 6-10 10-12" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" data-v-069275b0></path><path d="M14 50h36v10H14z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" data-v-069275b0></path></svg>',1)),t("h3",U,n(r.t("empty_title")),1),t("p",W,n(r.t("empty_hint")),1),g(y,{to:"/farmer/productions/create",class:"btn btn--primary"},{default:w(()=>[e[8]||(e[8]=t("svg",{viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[t("path",{d:"M12 5v14M5 12h14",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})],-1)),_(" "+n(r.t("cta_new")),1)]),_:1})])):(l(),a("div",J,[(l(),a(h,null,p(4,o=>t("div",{class:"prods-loading__card",key:"sk_"+o})),64))]))])])}const Ft=b(F,[["render",Pt],["__scopeId","data-v-069275b0"]]);export{Ft 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.