D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
local
/
psa
/
admin
/
cp
/
public
/
javascript
/
components
/
pages
/
Filename :
MassMailPage.js
back
Copy
"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["components/pages/MassMailPage"],{2550:(e,t,s)=>{s.r(t),s.d(t,{default:()=>T});var n=s(286),a=s(89),l=s(285),i=s(1120),o=s(628),r=s(1101),c=s(1278),d=s.n(c),m=s(646),p=s(583),u=s(536);const x=i.gql` mutation DeleteMassEmailTemplateMutation($input: DeleteMassEmailTemplateInput!) { deleteMassEmailTemplate(input: $input) { ids } } `,j=a.Locale.getTranslate("components.pages.MassMailPage"),h=a.Locale.getSection("components.pages.MassMailPage"),g=[{key:"name",sortable:!0,title:(0,l.jsx)(j,{content:"name"}),render:({name:e,templateId:t})=>(0,l.jsx)(m.default,{to:`${t}/edit`,children:e})},{key:"fromEmail",sortable:!0,title:(0,l.jsx)(j,{content:"sender"})},{key:"sendToResellersMode",title:(0,l.jsx)(j,{content:"recipients"}),width:"350px",render:({sendToAdmins:e,sendToResellers:t,sendToResellersMode:s,sendToClients:n,sendToClientsMode:a})=>{if(!e&&!t&&!n)return(0,l.jsx)(j,{content:"recipientsNone"});const i=[];return e&&i.push(h.lmsg("recipientsAdmins")),t&&("all"===s?i.push(h.lmsg("recipientsResellers")):i.push(h.lmsg("select"===s?"recipientsResellersSelected":"recipientsResellersExcept"))),n&&("all"===a?i.push(h.lmsg("recipientsClients")):i.push(h.lmsg("select"===a?"recipientsClientsSelected":"recipientsClientsExcept"))),i.join(", ")}},{title:(0,l.jsx)(j,{content:"subject"}),key:"subject",sortable:!0},{title:(0,l.jsx)(j,{content:"created"}),key:"created",sortable:!0,render:({created:e})=>(0,p.formatDateFromTimestamp)(e)},{title:(0,l.jsx)(j,{content:"send"}),key:"send",render:({templateId:e})=>(0,l.jsx)(n.Button,{component:m.default,to:`send?templateId=${e}`,ghost:!0,icon:"mail"})}],T=()=>{const[e,t]=(0,l.useState)([]),{queryResult:{refetch:s},listProps:a,listInput:i}=(0,r.useGraphQlList)({key:"MassMailPage",onListInputChange:()=>t([]),query:d(),extractList:e=>e.massEmail.templates}),c=!!i.searchFilters?.query,[p,{loading:T}]=(0,o.useMutation)(x,{onCompleted:()=>{(0,u.addToast)({intent:"success",message:h.formatMessage("templatesRemoved",{count:e.length})}),t([]),s()}});return(0,l.jsx)(r.GraphQlList,{selection:e,rowKey:"templateId",filtered:c,onSelectionChange:e=>t(e),emptyView:(0,l.jsx)(n.ListEmptyView,{title:(0,l.jsx)(j,{content:"emptyViewTitle"}),actions:c?void 0:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.Button,{"data-testid":"new-mass-mail-template",component:m.default,to:"create",intent:"primary",children:(0,l.jsx)(j,{content:"addNew"})}),(0,l.jsx)(n.Button,{"data-testid":"send-mass-mail",component:m.default,to:"send",intent:"secondary",children:(0,l.jsx)(j,{content:"sendEmail"})})]})}),toolbar:(0,l.jsxs)(n.Toolbar,{children:[(0,l.jsx)(n.ToolbarGroup,{title:h.lmsg("addNew"),children:(0,l.jsx)(n.Button,{"data-testid":"new-mass-mail-template",component:m.default,to:"create",icon:"plus",intent:"primary"})}),(0,l.jsx)(n.ToolbarGroup,{title:h.lmsg("addNew"),children:(0,l.jsx)(n.Button,{"data-testid":"send-mass-mail",component:m.default,to:"send",intent:"primary",children:(0,l.jsx)(j,{content:"sendEmail"})})}),(0,l.jsx)(n.ToolbarGroup,{title:h.lmsg("actions"),children:(0,l.jsx)(n.ListOperation,{critical:!0,noSelectionText:(0,l.jsx)(j,{content:"selectAtLeastOneTemplate"}),confirmationText:h.formatMessage("confirmRemoval",{count:e.length}),actionButtonText:(0,l.jsx)(j,{content:"remove"}),children:(0,l.jsx)(n.Button,{onClick:async()=>{await p({variables:{input:{ids:e.map((e=>btoa(`MassEmailTemplate:${e}`)))}}})},state:T?"loading":void 0,children:(0,l.jsx)(j,{content:"remove"})})})}),(0,l.jsx)(n.ToolbarExpander,{}),(0,l.jsx)(n.ToolbarGroup,{title:(0,l.jsx)(j,{content:"filters"}),groupable:!1,children:(0,l.jsx)(r.GraphQlList.SearchBar,{name:"query"})})]}),columns:g,...a})}}}]); //# sourceMappingURL=MassMailPage.js.map?febb6d43c514e42c800b