Your IP : 18.222.24.28
import{a as pe,b as le}from"./chunk-DFRPFY7B.js";import{a as de,b as fe}from"./chunk-4YFWGFYZ.js";import{b as oe,c as ne}from"./chunk-KOPGM7TY.js";import{a as ae,b as se,o as me}from"./chunk-YEF45YHO.js";import"./chunk-HDHDVZQK.js";import"./chunk-PK74BOF4.js";import"./chunk-UIMIPCPG.js";import"./chunk-H3YY3OLT.js";import"./chunk-BKOP7W6P.js";import"./chunk-EI5KBZMB.js";import"./chunk-WDCLQCI6.js";import{a as ce}from"./chunk-VX77VCCO.js";import"./chunk-WUJDRKKX.js";import"./chunk-25EXV7IU.js";import"./chunk-CPXWTLES.js";import"./chunk-KU75D4PT.js";import"./chunk-BATIAXZ4.js";import"./chunk-KX5BXGZT.js";import{s as Z,t as ee,u as ie,y as re,z as x}from"./chunk-M6DH5DPB.js";import{$a as h,$b as M,Bb as J,Bc as te,Cb as K,Cc as k,Ia as G,L as u,M as b,Sb as B,Wa as U,Yb as s,Z as S,_a as f,ba as d,c as V,d as v,da as W,f as m,fc as Q,k as D,l as g,ma as w,na as C,oa as L,oc as X,pa as R,q as p,qa as E,qc as Y,r as l,sa as $,ub as q,va as y,vb as H,x as z,xa as c}from"./chunk-SXUPRFOU.js";import{G as O,a as _,b as N,m as j,t as I,xa as A}from"./chunk-ERDNNTNA.js";var T=(()=>{let t=class t{get tab(){return this.tabContextService.tab}get doc(){return this.tabContextService.doc}constructor(e,i,r,a,F,_e,be){this.tabContextService=e,this.tabService=i,this.actionService=r,this.drawerManagerService=a,this.confirmService=F,this.appService=_e,this.destroyRef=be,this.formLoading$=new I(!1),this.tab$=this.tabContextService.tab$,this.doc$=this.tabContextService.doc$,this.subscribeToTabChange()}subscribeToTabChange(){this.tabContextService.previousAndNextTab$.pipe(A(([e,i])=>{ee(i,e)&&setTimeout(()=>{ie(i,e)})}),Y(this.destroyRef)).subscribe()}openTab(e,i,r=!1){let a=r?this.tab:null;this.actionService.loadAndOpen({params:_({func:e},i),parent:a})}submitForm(e){this.formLoading$.next(e.button),this.actionService.prepareAndSubmitForm$({form:e.model,button:e.button,tab:this.tab,emitOnError:!0,additionalParams:e.additionalParams}).subscribe(()=>this.formLoading$.next(!1))}handleFormButtonClick(e){return j(this,null,function*(){let i=this.doc?.metadata?.form?.$target==="blank",r=e.button;if(!(r.$confirm==="yes"&&!(yield this.confirmService.confirmFormButton(r,this.doc,e.entityName)))){if(r.$type===s.Ok&&(r.$act==="blank"||i)){this.submitAndOpenNewWindow(e);return}if(r.$drawer){this.drawerManagerService.openDrawer$({type:"form",func:r.$func,size:r.$drawer});return}switch(r.$type){case s.Ok:case s.Next:case s.Back:case s.Submit:case void 0:this.submitForm(e);return;case s.Cancel:this.closeByCancel(),r?.$func&&this.openTab(r?.$func,e.model);return;case s.Blank:this.submitAndOpenNewWindow(e);return;case s.Func:this.openTab(r?.$func,e.additionalParams,!0);return;case s.Reset:this.resetForm();return;case s.Tab:this.goToFormTab(r.$func,e.model);return;default:}}})}submitAndOpenNewWindow(e){Z({doc:this.tab.doc,form:e.model,button:e.button,func:this.tab.func,elid:this.tab.elid,plid:this.tab.plid,sok:!0,openNewWindow:!0}),e.button.$keepform!=="blank"&&this.tabService.close(this.tab,!0)}resetForm(){console.warn("\u0441\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0444\u043E\u0440\u043C\u0443 \u043D\u0430 \u0434\u0435\u0444\u043E\u043B\u0442\u043D\u044B\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F")}goToFormTab(e,i){let r={func:e};i.elid&&(r.elid=i.elid),i.plid&&(r.elid=i.plid);let a=this.tabService.activeGroup.indexOf(this.tabService.activeTab)?this.tabService.activeGroup[0]:null;this.actionService.loadAndOpen({params:r,parent:a})}handleWizardClick(e){this.actionService.prepareAndSubmitForm$({form:e.model,tab:this.tab,sok:!1,additionalParams:{func:e.func}}).subscribe()}closeByCancel(){if(this.tab.isSame)this.tabService.resetSameTab(this.tab);else{let e=this.tab.doc.metadata?.form?.$cancelrefresh==="yes";this.tabService.close(this.tab,e)}}handleResponseAfterProgress(e){this.actionService.handleResponseAfterProgress(this.tab,e)}openNewTabByLinkClick({isNewTab:e,func:i,drawer:r}){let a=_({},Q(`func=${i}`));if(r){this.drawerManagerService.openDrawer$({type:"form",func:a.func,elid:a.elid,plid:a.plid,size:r});return}e?this.actionService.handleAction(a,null,!0):this.actionService.loadAndOpen({params:a,parent:this.tab})}reloadTab(){this.actionService.updateTab(this.tab?.func,this.tab?.q,this.tab)}};t.\u0275fac=function(i){return new(i||t)(m(ce),m(k),m(x),m(te),m(re),m(X),m(z))},t.\u0275prov=V({token:t,factory:t.\u0275fac});let o=t;return o})();var Se=o=>[o];function we(o,t){if(o&1){let n=$();w(0,"isp-new-dynamic-form",9),f(1,"async"),f(2,"async"),y("buttonClick",function(i){p(n);let r=c(3);return l(r.handleFormButtonClick(i))})("linkClick",function(i){p(n);let r=c(3);return l(r.openNewTab(i))})("headerClick",function(){p(n);let i=c(3);return l(i.reloadTab())})("wizardClick",function(i){p(n);let r=c(3);return l(r.handleWizardClick(i))}),C()}if(o&2){let n=t.$implicit,e=c(3);d("doc",h(1,4,e.doc$))("id",n)("place","standard")("loading",h(2,6,e.formLoading$))}}function ye(o,t){if(o&1&&(R(0),S(1,we,3,8,"isp-new-dynamic-form",8),f(2,"async"),E()),o&2){let n=c(2);u(),d("ngForOf",U(3,Se,h(2,1,n.cacheId$)))}}function ke(o,t){if(o&1){let n=$();w(0,"div",2)(1,"div",3)(2,"isp-close",4),y("click",function(){p(n);let i=c();return l(i.exit())}),C(),w(3,"isp-progress-task-modal",5),y("finish",function(i){p(n);let r=c();return l(r.handleProgressFinish(i))}),C(),L(4,"isp-progress-modal",6,0),f(6,"async"),S(7,ye,3,5,"ng-container",7),f(8,"async"),C()()}if(o&2){let n=t.ngIf,e=G(5),i=c();u(2),W("form__close-button_not-clickable",e.isVisible),u(),d("tab",n),u(),d("state",h(6,5,n.state.progressModalUploadStateSubject)),u(3),d("ngIf",h(8,7,i.doc$))}}var he=(()=>{let t=class t{constructor(e,i,r,a){this.formService=e,this.tabService=i,this.actionService=r,this.formCacheService=a,this.doc$=this.formService.doc$,this.formLoading$=this.formService.formLoading$,this.tab$=this.formService.tab$,this.cacheId$=this.tab$.pipe(O(F=>this.formCacheService.getId(F)))}exit(){this.formService.closeByCancel()}ngOnInit(){this.formService.doc$.subscribe(e=>{let i=M.getNotificationBanners(e);i.length&&(this.actionService.handleNotificationBanners(i),this.tabService.update(this.formService.tab,N(_({},e),{banner:M.getNormalBanners(e)}),!1))})}handleWizardClick(e){this.formService.handleWizardClick(e)}handleFormButtonClick(e){this.formService.handleFormButtonClick(e)}openNewTab(e){this.formService.openNewTabByLinkClick(e)}handleProgressFinish(e){this.formService.handleResponseAfterProgress(e)}reloadTab(){this.formService.reloadTab()}};t.\u0275fac=function(i){return new(i||t)(b(T),b(k),b(x),b(ae))},t.\u0275cmp=D({type:t,selectors:[["isp-form"]],decls:2,vars:3,consts:[["uploadFileProgressModal",""],["class","form-container",4,"ngIf"],[1,"form-container"],[1,"form"],[1,"form__close-button",3,"click"],[3,"finish","tab"],[3,"state"],[4,"ngIf"],["class","form__dynamic-form ispui-scrollbar_gray",3,"doc","id","place","loading","buttonClick","linkClick","headerClick","wizardClick",4,"ngFor","ngForOf"],[1,"form__dynamic-form","ispui-scrollbar_gray",3,"buttonClick","linkClick","headerClick","wizardClick","doc","id","place","loading"]],template:function(i,r){i&1&&(S(0,ke,9,9,"div",1),f(1,"async")),i&2&&d("ngIf",h(1,1,r.tab$))},dependencies:[q,H,oe,de,se,pe,J],styles:[".form-container[_ngcontent-%COMP%]{position:relative;display:flex;flex-flow:row nowrap;width:100%;height:100%}.form[_ngcontent-%COMP%]{flex:1;min-width:0;max-width:100%;overflow-y:auto}.form__dynamic-form[_ngcontent-%COMP%]{height:100%}.form__close-button[_ngcontent-%COMP%]{position:absolute;top:6px;left:-15px;z-index:var(--isp-z-index-form-close-button)}.form__close-button_not-clickable[_ngcontent-%COMP%]{pointer-events:none;cursor:default}"],changeDetection:0});let o=t;return o})();var xe=[{path:"",component:he}],ue=(()=>{let t=class t{};t.\u0275fac=function(i){return new(i||t)},t.\u0275mod=g({type:t}),t.\u0275inj=v({imports:[B.forChild(xe),B]});let o=t;return o})();var ni=(()=>{let t=class t{};t.\u0275fac=function(i){return new(i||t)},t.\u0275mod=g({type:t}),t.\u0275inj=v({providers:[T],imports:[K,ne,fe,ue,me,le]});let o=t;return o})();export{ni as FormModule};