PageSourceSearch

https://www.autobutler.dk/assets/controllers/sysadmin/expiring_sub…riptions_by_mechanic_controller-927c5009.js

js autobutler.dk collected 2026-10-05 04:44:33 UTC 1,432 bytes, 61 lines download raw bytes

1import { Controller } from "@hotwired/stimulus"
2
3export default class extends Controller {
4  static targets = ["content", "icon"]
5  static values = {
6    mechanicId: Number,
7    year: Number,
8    month: Number
9  }
10
11  connect() {
12    this.isOpen = false
13    this.isLoaded = false
14  }
15
16  toggle(event) {
17    event.preventDefault()
18
19    if (this.isOpen) {
20      this.close()
21    } else {
22      this.open()
23    }
24  }
25
26  open() {
27    this.isOpen = true
28    this.contentTarget.classList.remove("hidden")
29    this.iconTarget.classList.add("rotate-180")
30
31    if (!this.isLoaded) {
32      this.loadContent()
33    }
34  }
35
36  close() {
37    this.isOpen = false
38    this.contentTarget.classList.add("hidden")
39    this.iconTarget.classList.remove("rotate-180")
40  }
41
42  loadContent() {
43    const url = `/sysadmin/expiring_subscriptions/mechanic_subscriptions?mechanic_id=${this.mechanicIdValue}&year=${this.yearValue}&month=${this.monthValue}`
44
45    fetch(url, {
46      headers: {
47        'Accept': 'text/html',
48        'X-Requested-With': 'XMLHttpRequest'
49      }
50    })
51      .then(response => response.text())
52      .then(html => {
53        this.contentTarget.innerHTML = html
54        this.isLoaded = true
55      })
56      .catch(error => {
57        console.error('Error loading subscriptions:', error)
58        this.contentTarget.innerHTML = '<div class="text-center py-4 text-red-600">Error loading subscriptions. Please try again.</div>'
59      })
60  }
61}

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.