PageSourceSearch

https://www.odense-marcipan.se/DWlP1Zth.js

js odense-marcipan.se collected 2026-09-27 06:44:52 UTC 11,623 bytes, 151 lines download raw bytes

1import{b as d,T as k,s as f,I as b,a as g,d as T,m as v,f as y,p as s}from"./om.js";import{e as p,n as $}from"./DgQ5HKbj.js";import{e as w,i as D,t as n,r as x,s as P,c as C}from"./SzrX-MJo.js";import{f as i,a as m}from"./CTFBKmgB.js";/**
2 * @license
3 * Copyright 2020 Google LLC
4 * SPDX-License-Identifier: BSD-3-Clause
5 */const B=w(class extends D{constructor(t){if(super(t),t.type!==n.PROPERTY&&t.type!==n.ATTRIBUTE&&t.type!==n.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!x(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===d||e===k)return e;const c=t.element,a=t.name;if(t.type===n.PROPERTY){if(e===c[a])return d}else if(t.type===n.BOOLEAN_ATTRIBUTE){if(!!e===c.hasAttribute(a))return d}else if(t.type===n.ATTRIBUTE&&c.getAttribute(a)===e+"")return d;return P(t),e}});var E=Object.defineProperty,O=Object.getOwnPropertyDescriptor,l=(t,e,c,a)=>{for(var o=a>1?void 0:a?O(e,c):e,h=t.length-1,u;h>=0;h--)(u=t[h])&&(o=(a?u(e,c,o):u(o))||o);return a&&o&&E(e,c,o),o};let r=class extends f{constructor(t=b.get("dictionary"),e=b.get("basketService")){super(),this.dictionary=t,this.basketService=e,this.isTableView=window.innerWidth>960,this.displayDiscountField=!1,this.discountCode=""}get basket(){return this._basket}set basket(t){const e=this._basket;this._basket=t,this.requestUpdate("basket",e)}connectedCallback(){super.connectedCallback(),g(window,"resize").pipe(T(30)).pipe(v(()=>window.innerWidth>960)).pipe(y(t=>this.isTableView!=t)).subscribe(t=>{const e=this.isTableView;this.requestUpdate("basket",e),this.isTableView=t}),this.basketSubscription=this.basketService.stream.subscribe(t=>this.basket=t)}disconnectedCallback(){super.disconnectedCallback(),this.basketSubscription.unsubscribe()}render(){return this.basket==null?s`
6                <div class="loader">
7                    <div></div>
8                    <div></div>
9                    <div></div>
10                    <div></div>
11                </div>
12            `:s`
13            ${this.isTableView?s`
14                      <table class="table table-stripe orderline-table">
15                          <thead>
16                              <tr>
17                                  <th class="orderline-cell-th" colspan="2" style="padding-left: 0;">
18                                      <span class="h3">${this.dictionary.get("Marcipan.basket.title")}</span>
19                                  </th>
20                                  <th class="orderline-cell-th text-center"><span class="h5">Pr. stk.</span></th>
21                                  <th class="orderline-cell-th text-center"><span class="h5">Antal</span></th>
22                                  <th class="orderline-cell-th text-right"><span class="h5">I alt</span></th>
23                              </tr>
24                          </thead>
25                          ${C(this.basket.items,t=>t.key,t=>s`
26                                  <tr>
27                                      <td class="orderline-cell-image">
28                                          ${t.metaData.image?s` <picture class="orderline-item-picture theme-pattern-triangles embed-responsive-1by1">
29                                                    <img
30                                                        class="orderline-item-image object-fit-contain embed-responsive-item"
31                                                        src="${t.metaData.image}?height=180"
32                                                        alt="${t.metaData.title}"
33                                                    />
34                                                </picture>`:""}
35                                      </td>
36                                      <td class="orderline-cell">
37                                          <h5 class="mb-0">${t.metaData.title}</h5>
38                                          ${t.discounts.map(e=>s`<p class="orderline-discount">${e.title}</p>`)}
39                                      </td>
40                                      <td class="orderline-cell text-center">
41                                          ${i(t.priceBeforeDiscount.withTax,t.priceBeforeDiscount.formatTemplate)}
42                                      </td>
43                                      <td class="orderline-cell">
44                                          <add-to-basket key="${t.key}" stock="${t.stock}"></add-to-basket>
45                                      </td>
46                                      <td class="orderline-cell text-right">
47                                          <span
48                                              >${i(t.priceBeforeDiscount.withTax*t.quantity,t.priceBeforeDiscount.formatTemplate)}
49                                          </span>
50                                          ${t.discounts.map(e=>s`<p class="orderline-discount">
51                                                      ${i(e.discount.withTax,e.discount.formatTemplate)}
52                                                  </p>`)}
53                                      </td>
54                                  </tr>
55                              `)}
56                      </table>
57                  `:s`<div>
58                      <ul class="orderline-list">
59                          ${this.basket.items.map(t=>s`
60                                  <li class="orderline-item">
61                                      ${t.metaData.image?s` <picture class="orderline-item-picture theme-pattern-triangles embed-responsive-1by1">
62                                                <img
63                                                    class="orderline-item-image object-fit-contain embed-responsive-item"
64                                                    src="${t.metaData.image}?height=180"
65                                                    alt="${t.metaData.title}"
66                                                />
67                                            </picture>`:""}
68                                      <div class="orderline-item-content">
69                                          <h3>${t.metaData.title}</h3>
70                                          ${t.discounts.map(e=>s`<p class="orderline-discount">${e.title}</p>`)}
71                                          <p class="small">
72                                              <span class="h5">I alt: </span>
73                                              <span
74                                                  >${i(t.priceBeforeDiscount.withTax*t.quantity,t.priceBeforeDiscount.formatTemplate)}
75                                              </span>
76                                          </p>
77                                          <add-to-basket key="${t.key}" stock="${t.stock}"></add-to-basket>
78                                      </div>
79                                  </li>
80                              `)}
81                      </ul>
82                  </div> `}
83            ${this.basket.subTotalPrice.withTax<=m?s`
84                      <div class="notch mt-3 mb-3">
85                          <h5>
86                              ${i(m-this.basket.subTotalPrice.withTax,this.dictionary.get("Marcipan.basket.free-shipping"))}
87                          </h5>
88                      </div>
89                  `:""}
90            <div class="row">
91                ${this.displayDiscountField?s`
92                          <div class="col-12 col-md-6 mt-0 mt-md-1">
93                              <label for="discountCode">${this.dictionary.get("Marcipan.checkout.discountCode")}</label>
94                              <input
95                                  class="form-control mb-2"
96                                  placeholder=""
97                                  name="discountCode"
98                                  id="discountCode"
99                                  .value=${B(this.discountCode)}
100                                  @change="${t=>this.updateDiscountCode(t)}"
101                              />
102                              <button class="btn btn-secondary" @click="${()=>this.addDiscount()}">
103                                  ${this.dictionary.get("Marcipan.checkout.discountCode-add")}
104                              </button>
105                          </div>
106                      `:s`
107                          <div class="col-12 col-md-6 mt-0 mt-md-1">
108                              <a href="javascript:void(0);" class="btn btn-secondary" @click="${t=>this.showDiscount(t)}"
109                                  >${this.dictionary.get("Marcipan.checkout.discountCode-show")}</a
110                              >
111                          </div>
112                      `}
113
114                <div class="col-12 col-md-6 mt-3 mt-md-0">
115                    <table class="total-table">
116                        ${this.basket.totalPriceBeforeDiscount!==null?s`
117                            <tr>
118                                <td>${this.dictionary.get("Marcipan.basket.subtotal-price")}</td>
119                                <td class="text-right">
120                                    ${i(this.basket.totalPriceBeforeDiscount.withTax,this.basket.totalPriceBeforeDiscount.formatTemplate)}
121                                </td>
122                            </tr>
123                            ${this.basket.totalPriceBeforeDiscount.withTax!==this.basket.totalPrice.withTax?s`
124                                    <tr>
125                                        <td>
126                                            <p class="text-danger">${this.dictionary.get("Marcipan.basket.total-discount")}</p>
127                                            ${this.basket.discounts.map(t=>s`<p class="order-discount">${t.title}</p> `)}
128                                        </td>
129                                        <td class="text-danger text-right">
130                                            ${i(this.basket.totalPriceBeforeDiscount.withTax-this.basket.subTotalPrice.withTax,this.basket.totalPrice.formatTemplate)}
131
132                                        </td>
133                                    </tr>
134                                `:""}
135                        `:""}
136                        <tr>
137                            <td>${this.dictionary.get("Marcipan.basket.shipping-price")}</td>
138                            <td class="text-right">
139                                ${i(this.basket.shippingPrice.withTax,this.basket.shippingPrice.formatTemplate)}
140                            </td>
141                        </tr>
142                        <tr>
143                            <td><b>${this.dictionary.get("Marcipan.basket.total-price")}</b></td>
144                            <td class="text-right">
145                                <b>${i(this.basket.totalPrice.withTax,this.basket.totalPrice.formatTemplate)}</b>
146                            </td>
147                        </tr>
148                    </table>
149                </div>
150            </div>
151        `}createRenderRoot(){return this}updateDiscountCode(t){const e=t.target;this.discountCode=e.value}showDiscount(t){t.stopPropagation(),t.preventDefault(),this.displayDiscountField=!0}addDiscount(){this.basketService.addDiscountCode(this.discountCode).then(()=>{this.discountCode="",window.location.reload()},()=>{alert('Koden "'+this.discountCode+'" kunne ikke tilføjes.')}
151)}};r.register=()=>{};l([p({type:Boolean})],r.prototype,"isTableView",2);l([p({type:Boolean})],r.prototype,"displayDiscountField",2);l([p({type:String})],r.prototype,"discountCode",2);l([p({type:Object})],r.prototype,"basket",1);r=l([$("checkout-basket")],r);export{r as CheckoutBasketElement};

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.