Files
boc/backups/2026-07-12-1023/landvex-prod/assets/OrdererDashboard-5y9XrRsn.js
T

17 lines
29 KiB
JavaScript
Raw Normal View History

import{o as M,j as e,aU as ne,aV as le,v as i,aW as de,u as oe,a as z,p as me,n as xe,r as $,L as W,aX as V,x as s,ag as x,ah as h,ak as j,y as a,B as G,q as u,aY as C,A as he,C as pe,M as q,af as K,aZ as je,t as ue,z as ge}from"./index-oAPVDf-r.js";import{B as d}from"./badge-Qwi4CUXx.js";import{T as Ne,a as fe,b as S,c as ye}from"./tabs-CYk3p-Aj.js";import{u as ve}from"./useQuery-BxfmyRLz.js";import{R as be}from"./ROICalculator-DVEYTdny.js";import{E as we}from"./external-link-C86N9iPS.js";import{Z as B}from"./zap-RaPdKGJZ.js";import{C as U,D as X,L as ke}from"./layers-DZd3aBRI.js";import{T as E}from"./trending-up-Be0ZnpBQ.js";import{S as A}from"./shield-BWGzcrms.js";import{C as Se}from"./circle-alert-C1Hs9zwh.js";import{A as Ce}from"./arrow-left-m6EiMbb-.js";import{A as Ae}from"./index-B-MEeiYV.js";import{C as L}from"./clock-DRtqJZUo.js";import{A as P}from"./activity-B0zyNqjw.js";import{T as J}from"./triangle-alert-B87swlNS.js";import{V as De}from"./video-D6Sip5Dx.js";import{R as Ie}from"./radio-G_rzhIIH.js";import{R as H}from"./refresh-cw-DEBvxUr1.js";import{I as Q}from"./image-DuU1QaV8.js";import{E as y}from"./eye-G89nJUb2.js";import{S as Z}from"./send-DsElwFaU.js";import{F as Te}from"./file-text-CyDVAB5w.js";import{D as Y}from"./download-B0vydl5E.js";import{S as Le}from"./server-BrxxSdWs.js";import{K as Pe}from"./key-BAzZqC6d.js";import{B as qe}from"./building-2-w77rCUKE.js";import"./index-DGH-oZ97.js";import"./select-Bi-TzF3J.js";import"./chevron-down-QDDHZwZg.js";import"./check-CG8zylH4.js";import"./megaphone-CztbyYca.js";/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ee=M("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const se=M("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Me=M("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);function ze({url:t,title:c,className:o}){const v=()=>{const g=(window.screen.width-1200)/2,m=(window.screen.height-800)/2;window.open(t,c,`width=1200,height=800,left=${g},top=${m},menubar=no,toolbar=no,location=no,status=no`)};return e.jsxs(ne,{children:[e.jsx(le,{asChild:!0,children:e.jsx(i,{variant:"ghost",size:"icon",onClick:v,className:o,children:e.jsx(we,{className:"h-4 w-4"})})}),e.jsx(de,{children:e.jsx("p",{children:"Öppna i eget fönster"})})]})}const Be=t=>[{id:"operations",label:t("orderer.sections.operations"),icon:B,description:t("orderer.sections.operationsDesc")},{id:"analytics",label:t("orderer.sections.analytics"),icon:U,description:t("orderer.sections.analyticsDesc")},{id:"ads",label:"Ads",icon:E,description:t("orderer.sections.adsDesc")},{id:"integrations",label:t("orderer.sections.integrations"),icon:se,description:t("orderer.sections.integrationsDesc")},{id:"compliance",label:t("orderer.sections.compliance"),icon:A,description:t("orderer.sections.complianceDesc")}],ys=()=>{const t=oe(),{t:c}=z(),{user:o,isLoading:v}=me(),{ordererProfile:b,isLoading:D,isActiveOrderer:g}=xe(),[m,w]=$.useState("operations"),[N,I]=$.useState("active"),k=Be(c),{data:p=[],isLoading:T,refetch:n}=ve({queryKey:["orderer-missions",o==null?void 0:o.id],queryFn:async()=>{if(!o)return[];const{data:r,error:f}=await ge.from("missions").select("*").eq("created_by",o.id).order("created_at",{ascending:!1});if(f)throw f;return r},enabled:!!o}),l=p.filter(r=>r.status==="active"),_=p.filter(r=>r.status==="completed"),F=p.filter(r=>r.status==="active"&&new Date(r.created_at)>new Date(Date.now()-24*60*60*1e3)),ae=[],re=p.reduce((r,f)=>r+f.reward_credits,0);if(v||D)return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(W,{className:"w-8 h-8 animate-spin text-primary"})});if(!o)return e.jsx(V,{to:"/auth",replace:!0});if(!b)return e.jsx(V,{to:"/orderer/register",replace:!0});if(!g)return e.jsxs("div",{className:"min-h-screen bg-background text-foreground pb-24",children:[e.jsx("main",{className:"p-4 space-y-6 pt-6",children:e.jsxs(s,{className:"glass-card border-amber-500/30",children:[e.jsxs(x,{children:[e.jsxs(h,{className:"flex items-center gap-2",children:[e.jsx(Se,{className:"w-5 h-5 text-amber-500"}),c("orderer.status.accountPendingApproval")]}),e.jsx(j,{children:c("orderer.status.profileBeingProcessed")})]}),e.jsx(a,{children:e.jsx(i,{variant:"outline",onClick:()=>t("/orderer/register"),children:c("orderer.status.viewStatus")})})]})}),e.jsx(G,{})]});const te=r=>{if(!r||r==="once")return c("orderer.frequency.once");switch(r){case"daily":return c("orderer.frequency.daily");case"weekly":return c("orderer.frequency.weekly");case"biweekly":return c("orderer.frequency.biweekly");case"monthly":return c("orderer.frequency.monthly");default:return r}},ie=r=>{switch(r){case"active":return e.jsx(d,{className:"bg-success text-success-foreground",children:c("orderer.missionStatus.active")});case"completed":return e.jsx(d,{variant:"secondary",children:c("orderer.missionStatus.delivered")});case"cancelled":return e.jsx(d,{variant:"destructive",children:c("orderer.missionStatus.cancelled")});case"pending":return e.jsx(d,{className:"bg-warning text-warning-foreground",children:c("orderer.missionStatus.pending")});case"disputed":return e.jsx(d,{variant:"destructive",children:c("orderer.missionStatus.disputed")});default:return e.jsx(d,{variant:"outline",children:r})}},ce=N==="active"?l:N==="delivered"?_:N==="pending"?F:p;return e.jsxs("div",{className:"min-h-screen-safe bg-background text-foreground pb-24 safe-area-x",children:[e.jsxs("main",{className:"p-4 space-y-6 safe-area-top",children:[e.jsxs(u.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"flex items-center justify-between",children:[