1import{a as e,n as t}from"./standalone-app-Bj-IdwrG.js";import{E as n,_ as r,x as i}from"./institution-DyFDvNu6.js";import{Sr as a,W as o,o as s}from"./main-5Sl8yySz.js";import"./jha-card-header-D2XWRnD9.js";import"./jha-button-Dyau4S4K.js";import"./jha-form-floating-group-DqE4-9IH.js";import{i as c}from"./bannoweb-report-date-periods-BxcqNFHb.js";var l=[`Unknown`,`All`,`Debits`,`Credits`];function u(e){return e===o.SUB_REPORT_TYPES_EDI.DETAILS?`detail`:e}window.BannowebReportsSaveDialog=class extends r{static get is(){return`bannoweb-reports-save-dialog`}static get properties(){return{name:{type:String},report:{type:String},filters:{type:Object},subReports:{type:Object},loading:{type:Boolean},error:{type:Boolean},errorMessage:{type:String}}}constructor(){super(),e(()=>import(`./icon-circle-exclamation-CPV1Eg_u.js`).then(e=>e.t),[]),this.controller=s.reportsController,this.loading=!1,this.error=!1,this.errorMessage=``,this.name=``,this.report=``,this.filters=null,this.subReports=null}handleCloseModal(){this.dispatchEvent(new CustomEvent(`closeModal`,{bubbles:!0}))}
1get reportType(){if(this.report===o.REPORTS.EDI)return`Edi`;if(this.report===o.REPORTS.SUMMARY)return`Summary`;if(this.report===o.REPORTS.POSITIVE_PAY){if(this.subReports.positivePay===o.SUB_REPORT_TYPES_POSITIVE_PAY.ITEMS)return`PosPayItems`;if(this.subReports.positivePay===o.SUB_REPORT_TYPES_POSITIVE_PAY.MAINTENANCE)return`PosPayMaintenance`;if(this.subReports.positivePay===o.SUB_REPORT_TYPES_POSITIVE_PAY.EXCEPTIONS)return`PosPayExceptions`}return o.REPORTS.ACTIVITY}get isValid(){return this.name&&/^[\w\s]+$/.test(this.name)}async handleSaveReport(e){e.preventDefault(),this.loading=!0,this.error=!1,this.errorMessage=``;try{let{dateType:e,dayRange:t}=c(this.filters.datePeriod),n=this.filters.datePeriod===`pending`,r=n?new Date:this.filters.beginDate,i=n?new Date:this.filters.endDate,o={CriteriaName:this.name,AccountIds:this.filters.accountIds,DateType:e,DayRange:t,BeginDate:r,EndDate:i,BeginAmount:this.filters.fromAmount.toFixed(2),EndAmount:this.filters.toAmount.toFixed(2),BeginCheckNumber:this.filters.startCheckNumber,EndCheckNumber:this.filters.endCheckNumber,ReportType:this.reportType,PendingFlag:this.filters.datePeriod===`pending`?!0:void 0,TransactionType:this.filters.transactionType,TransactionTypeCodes:this.filters.transactionCodes||[]};this.reportType===`Edi`&&(o.EdiReportType=u(this.subReports.edi),o.EdiReportTransactionType=l[this.filters.transactionTypeEdi??1]),this.reportType===`PosPayItems`&&(o.PositivePayStatus=this.filters.status,o.PositivePayExceptionReason=this.filters.exceptionReason);let{ok:s,message:d,code:f}=await this.controller.createSavedReports(o);s?(this.dispatchEvent(new CustomEvent(`closeModal`,{bubbles:!0})),setTimeout(()=>{this.dispatchEvent(new a(`Your report was saved successfully.`))},250)):(this.error=!0,f===1010&&(this.errorMessage=d))}catch{this.error=!0,t.console.log(`There was an error saving the report.`),this.dispatchEvent(new a(`There was an error saving this report`))}finally{this.loading=!1}}onInput(e){let{value:t}=e.target;this.name=t}static get styles(){return[n`.box{padding:48px 80px}.input{border-bottom:1px solid var(--jha-border-color);margin-left:var(--jha-card-header-margin-left,26px);padding:24px var(--jha-card-header-padding-right,26px) 24px 0}.input-box{gap:8px;max-width:424px;margin:0 auto;display:grid}.actions{justify-content:center;gap:8px;padding:24px 80px;display:flex}.notification{background-color:var(--secondary-content-background-color);color:var(--body-text-secondary-color);justify-content:flex-start;align-items:center;gap:16px;padding:12px 16px;display:flex}.notification .icon{fill:var(--body-text-secondary-color)}.notification.error{background:var(--error-background-color);color:var(--error-text-color)}.notification.error .icon{fill:var(--error-text-color)}`]}render(){return i`<div> <jha-card-header center-header="">${`Save report`}</jha-card-header> <form @submit="${this.handleSaveReport}" class="form"> <div class="input"> <div class="input-box"> ${this.error?i`<div class="notification error"> <jh-icon-circle-exclamation class="icon"></jh-icon-circle-exclamation> ${this.errorMessage?this.errorMessage:`There was an error saving this report`} </div>`:i`<div class="notification"> <jh-icon-circle-exclamation class="icon"></jh-icon-circle-exclamation> ${`Save the search and filter criteria for this report for later.`} </div>`} <jha-form-floating-group outline> <input name="name" .value="${this.name}" @input="${this.onInput}"> <div class="label">${`Report name`}</div> </jha-form-floating-group> ${this.name.length>1&&!this.isValid?i`<div class="notification error"> <jh-icon-circle-exclamation class="icon"></jh-icon-circle-exclamation> Only letters, numbers, and spaces are allowed. </div>`:``} </div> </div> <div class="actions"> <jha-button type="button" @click="${this.handleCloseModal}" outline> ${`Cancel`} </jha-button> <jha-button type="submit" .isLoading="${this.loading}" .disabled="${this.loading||!this.isValid}"> ${`Save`} </jha-button> </div> </form> </div>`}},customElements.define(window.BannowebReportsSaveDialog.is,window.BannowebReportsSaveDialog);var d=window.BannowebReportsSaveDialog;export{d 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.