1"use strict";(self.webpackChunkstem_xpert=self.webpackChunkstem_xpert||[]).push([[118],{7999:(e,n,o)=>{var s=o(24994);n.A=void 0;var r=s(o(79526)),i=o(44414);n.A=(0,r.default)((0,i.jsx)("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Edit")},70118:(e,n,o)=>{o.r(n),o.d(n,{default:()=>I});var s=o(9950),r=o(82569),i=o(28429),c=o(99532),a=o(7999),d=o(57988),t=o(19808),l=o(34276),h=o(48089),x=o(1320),A=o(15769),p=o(69780),u=o(10371),j=o(68605),g=o(34075),_=o(87233),v=o(12257),m=o(87299),f=o(83274),C=o(57073),P=o(16491),w=o(91434),y=o(73123),b=o(30090),k=o(47084),D=o(48398),E=o(82925),z=o(44414);const R=e=>e?new Date(e).toLocaleDateString():"-";function I(){const e=(0,r.wA)(),n=(0,i.Zp)(),o=(0,k.K2)({defaultOrderBy:"createdAt",defaultRowsPerPage:10}),{coupons:I,loading:L}=(0,r.d4)(e=>({coupons:e.coupon.coupons,loading:e.coupon.loading}));(0,s.useEffect)(()=>{e((0,D.DB)({page:o.page+1,limit:o.rowsPerPage,dispatch:e}))},[e,o.page,o.rowsPerPage]);const N=(null===I||void 0===I?void 0:I.coupons)||[];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(b.t,{title:"Coupons"}),(0,z.jsxs)(t.A,{maxWidth:"xl",children:[(0,z.jsx)(E.A,{heading:"Coupons",links:[{name:"Dashboard",href:y.f.dashboard.root},{name:"Coupons"}],action:(0,z.jsx)(l.A,{variant:"contained",startIcon:(0,z.jsx)(c.A,{}),onClick:()=>n(y.f.dashboard.coupon_create),children:"New Coupon"}),sx:{mb:{xs:3,md:5}}}),(0,z.jsxs)(h.A,{children:[(0,z.jsx)(x.A,{children:(0,z.jsxs)(A.A,{children:[(0,z.jsx)(p.A,{children:(0,z.jsxs)(u.A,{children:[(0,z.jsx)(j.A,{children:"Code"}),(0,z.jsx)(j.A,{children:"Title"}),(0,z.jsx)(j.A,{children:"Category"}),(0,z.jsx)(j.A,{children:"Type"}),(0,z.jsx)(j.A,{children:"Value"}),(0,z.jsx)(j.A,{children:"Used"}),(0,z.jsx)(j.A,{children:"Expiry"}),(0,z.jsx)(j.A,{children:"Status"}),(0,z.jsx)(j.A,{align:"right",children:"Actions"})]})}),(0,z.jsxs)(g.A,{children:[N.map(o=>{const s=o.expiry_date&&new Date(o.expiry_date)<=new Date;return(0,z.jsxs)(u.A,{hover:!0,children:[(0,z.jsx)(j.A,{children:(0,z.jsx)(_.A,{variant:"subtitle2",children:o.code})}),(0,z.jsx)(j.A,{children:o.title}),(0,z.jsx)(j.A,{children:o.category}),(0,z.jsx)(j.A,{children:o.type}),(0,z.jsx)(j.A,{children:"PERCENTAGE"===o.type?"".concat(o.standard_value,"%"):o.standard_value}),(0,z.jsxs)(j.A,{children:[o.used_count>0?(0,z.jsx)(_.A,{component:"span",variant:"body2",onClick:()=>n("".concat(y.f.dashboard.course_orders,"?coupon_code=").concat(o.code)),sx:{cursor:"pointer",color:"primary.main",textDecoration:"underline",fontWeight:"bold","&:hover":{color:"primary.dark"}},children:o.used_count}):0,o.usage_limit?" / ".concat(o.usage_limit):""]}),(0,z.jsx)(j.A,{children:R(o.expiry_date)}),(0,z.jsx)(j.A,{children:(0,z.jsxs)(v.A,{direction:"row",spacing:1,children:[(0,z.jsx)(m.A,{size:"small",label:o.is_active?"Active":"Inactive",color:o.is_active?"success":"default"}),s&&(0,z.jsx)(m.A,{size:"small",label:"Expired",color:"error"})]})}),(0,z.jsxs)(j.A,{align:"right",children:[(0,z.jsx)(f.A,{title:"Edit",children:(0,z.jsx)(C.A,{onClick:()=>n(y.f.dashboard.coupon_update(o._id)),children:(0,z.jsx)(a.A,{})})}),(0,z.jsx)(f.A,{title:"Delete",children:(0,z.jsx)(C.A,{color:"error",onClick:()=>e((0,D.W_)({couponId:o._id,dispatch:e})),children:(0,z.jsx)(d.A,{})})})]})]},o._id)}),!N.length&&(0,z.jsx)(u.A,{children:(0,z.jsx)(j.A,{colSpan:9,children:(0,z.jsx)(P.A,{sx:{py:6,textAlign:"center",color:"text.secondary"},children:L?"Loading coupons...":"No coupons found"})})})]})]})}),(0,z.jsx)(w.A,{component:"div",count:(null===I||void 0===I?void 0:I.total)||0,page:o.page,rowsPerPage:o.rowsPerPage,onPageChange:o.onChangePage,onRowsPerPageChange:o.onChangeRowsPerPage})]})]})]})}}}]);
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.