1import{b as x}from"./chunk-ASCTU2IS.js";import{a as Z}from"./chunk-PAVFT4J4.js";import"./chunk-7KPJFA5C.js";import"./chunk-4K5LXWL4.js";import"./chunk-654YIHYG.js";import"./chunk-ULBGQODG.js";import"./chunk-6EO2T4M5.js";import{b as H}from"./chunk-S4P6H7MK.js";import{a as J,e as K}from"./chunk-73QVY25U.js";import"./chunk-ZQXHAZQI.js";import"./chunk-GV7W7XKR.js";import"./chunk-NUZZ6PH3.js";import{a as z}from"./chunk-7M2WBX6P.js";import"./chunk-R5ZHDTQR.js";import"./chunk-UOXRFJCY.js";import"./chunk-6QKNDL2V.js";import"./chunk-VIJ5F57W.js";import"./chunk-ZRBSQ43T.js";import{a as W}from"./chunk-X5P2Z6N7.js";import"./chunk-U64RMDRX.js";import"./chunk-5PMZHJGF.js";import"./chunk-ZZF7BMWX.js";import"./chunk-T3VAGQUK.js";import"./chunk-YMOGQCDY.js";import"./chunk-Q6JEQE25.js";import"./chunk-57Y5PTEM.js";import"./chunk-3YQ6IE36.js";import"./chunk-OISL7O4V.js";import"./chunk-EW3JBSWB.js";import{a as $,b as G}from"./chunk-O2LGITWX.js";import"./chunk-B2S6P67A.js";import"./chunk-LZWDIUTK.js";import"./chunk-KI4MHBOS.js";import{c as j,d as N,g as A,i as D,m as q,r as R}from"./chunk-POFVLSYD.js";import{Y as Q}from"./chunk-3T73RG6L.js";import{f as M,h as P}from"./chunk-C6GPKFF7.js";import"./chunk-AFUKLOTS.js";import"./chunk-UFBG5AAV.js";import"./chunk-POTRYYGQ.js";import"./chunk-CEMD4S5I.js";import{l as L,w as V}from"./chunk-NFJZILLU.js";import{$b as a,Bb as g,Hc as f,Ic as k,Jc as w,Nc as F,Oc as B,Pc as O,Tb as m,Vb as p,Xb as y,Xc as E,Yb as S,Zb as T,_b as c,_c as I,ac as s,bc as b,ic as h,jb as o,qa as u,ra as _,rc as v,tc as d,wb as C}from"./chunk-Q4S2MI3I.js";import{f as Y}from"./chunk-5NAIRCPM.js";var U=Y(Z());var ee=(t,r)=>({"col-9":t,"col-12":r});function te(t,r){t&1&&(a(0,"span"),f(1,"L\xE6g i kurv"),s())}function ie(t,r){t&1&&(a(0,"span"),f(1,"Tilf\xF8jet"),s())}function ne(t,r){if(t&1){let i=h();a(0,"div",11)(1,"div")(2,"input",12),O("ngModelChange",function(n){u(i);let l=d().$implicit;return B(l.quantity,n)||(l.quantity=n),_(n)}),s()(),a(3,"button",5),v("click",function(){u(i);let n=d().$implicit,l=d(2);return _(l.addBasketLine(n))}),m(4,te,2,0,"span"),m(5,ie,2,0,"span"),s()()}if(t&2){let i=d().$implicit,e=d(2);o(2),F("ngModel",i.quantity),o(),c("disabled",e.adding||e.addedBasketLines.hasOwnProperty(i.id)),o(),p(e.addedBasketLines.hasOwnProperty(i.id)?-1:4),o(),p(e.addedBasketLines.hasOwnProperty(i.id)?5:-1)}}function oe(t,r){if(t&1&&(a(0,"div",9),b(1,"app-basket-line",10),s(),m(2,ne,6,4,"div",11)),t&2){let i=r.$implicit,e=d(2);c("ngClass",I(8,ee,e.offer.offer_type==="pluk",e.offer.offer_type!=="pluk")),o(),c("basket",e.offer.basket)("hideImage",!1)("hideProductDetails",!1)("readonly",!0)("hideQuantity",!0)("item",i),o(),p(e.offer.offer_type==="pluk"?2:-1)}}function re(t,r){if(t&1){let i=h();a(0,"div")(1,"h1"),f(2),a(3,"span",3),f(4),s()(),a(5,"div",4)(6,"button",5),v("click",function(){u(i);let n=d();return _(n.activateOffer())}),f(7,"Aktiver tilbud "),s(),a(8,"button",6),v("click",function(){u(i);let n=d();return _(n.export())}),b(9,"fa-icon",7),f(10," Eksporter til CSV "),s()(),a(11,"p"),f(12),s(),a(13,"div",8),S(14,oe,3,11,null,null,y),s()()}if(t&2){let i=d();o(2),w("Tilbud #",i.offer.offer_number," "),o(2),k(i.offer.offer_type==="pluk"?"Pluk":"Samlet"),o(2),c("disabled",!i.offer),o(3),c("icon",i.faFileExport),o(3),k(i.offer.description),o(2),T(i.offer.basket==null?null:i.offer.basket.basket_lines)}}function ae(t,r){t&1&&(a(0,"p",2),f(1,"Indl\xE6ser tilbud..."),s())}var Fe=(()=>{let r=class r{constructor(e,n,l,X){this.activatedRoute=e,this.router=n,this.offerService=l,this.tenFourBasketService=X,this.adding=!1,this.addedBasketLines={},this.addedBasketLineTimeouts=[],this.faFileExport=Q,this.offerId=e.snapshot.params.offerId}ngOnInit(){this.offerService.getOffer(this.offerId).subscribe(e=>{e.id||this.router.navigate(["/offers"]),this.offer=e})}addBasketLine(e){this.adding=!0,this.offerService.generateLine(e).subscribe(n=>{this.adding=!1,this.addedBasketLines[e.id]=!0;let l=setTimeout(()=>{delete this.addedBasketLines[e.id]},2500);this.addedBasketLineTimeouts.push(l)})}activateOffer(){this.offerService.generateBasket(this.offer).subscribe(e=>{this.tenFourBasketService.pushEvent({status:"ok",basket_lines:e.basket_lines})})}export(){this.offerService.exportOffer(this.offerId).subscribe(e=>{let n=new Blob([e],{type:"csv;charset=utf-8;"});U.default.saveAs(n,"tilbud-"+this.offer.offer_number+".csv")})}
1ngOnDestroy(){this.addedBasketLineTimeouts.forEach(e=>clearTimeout(e)),this.addedBasketLineTimeouts=[]}};r.\u0275fac=function(n){return new(n||r)(C(M),C(P),C(x),C(W))},r.\u0275cmp=g({type:r,selectors:[["app-offer"]],features:[E([x,H])],decls:6,vars:3,consts:[[3,"className"],[1,"bg-white","p-3","mb-3"],[1,"text-muted"],[1,"badge","rounded-pill","text-white","bg-primary","mr-1"],[1,"d-flex","justify-content-start","gap-2","mb-3"],[1,"TenFour-button","TenFour-button--extra-small",3,"click","disabled"],[1,"TenFour-button","TenFour-button--extra-small",3,"click"],[3,"icon"],[1,"row"],[2,"border-bottom","1px solid #eee",3,"ngClass"],[3,"basket","hideImage","hideProductDetails","readonly","hideQuantity","item"],[1,"col-3","d-flex","align-items-center","justify-content-end","gap-2",2,"border-bottom","1px solid #eee"],["type","number","name","quantity","min","0",1,"form-control","me-2",2,"width","5rem",3,"ngModelChange","ngModel"]],template:function(n,l){n&1&&(b(0,"app-global-banner"),a(1,"div",0),b(2,"app-header"),a(3,"main",1),m(4,re,16,5,"div"),m(5,ae,2,0,"p",2),s()()),n&2&&(o(),c("className","TenFour-app container-fluid- container"),o(3),p(l.offer?4:-1),o(),p(l.offer?-1:5))},dependencies:[J,K,V,L,z,G,$,R,j,D,N,q,A],encapsulation:2});let t=r;return t})();export{Fe as OfferComponent}; 2/**i18n:74b91f3a8d991142b0415c693c37e765ab650ba4d6cefc2a6b5930c023dd7c29*/
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.