PageSourceSearch

https://www.gymfit.by/assets/client/controllers/landing_company_su…09cf0c6660a3f9d6d862e6685e9646d6c6d41767.js

js gymfit.by collected 2026-10-02 00:26:54 UTC 1,985 bytes, 75 lines download raw bytes

1import { Controller } from "@hotwired/stimulus"
2import { applyPhoneMask } from "helpers/phone_mask"
3import AirDatepicker from "air-datepicker"
4
5export default class extends Controller {
6  static targets = ["confirmation", "phone", "email", "fullName", "planType", "submit", "month"]
7
8  connect() {
9    this.initDatepicker()
10    this.toggleSubmitState()
11  }
12
13  handlePhoneInput(event) {
14    this.phoneTarget.value = applyPhoneMask(event.target.value)
15    this.toggleSubmitState()
16  }
17
18  handleInputChange() {
19    this.toggleSubmitState()
20  }
21
22  initDatepicker() {
23    if (!this.hasMonthTarget) return
24
25    this.picker?.destroy()
26
27    this.picker = new AirDatepicker(this.monthTarget, {
28      container: document.body,
29      view: "months",
30      minView: "months",
31      dateFormat: "yyyy-MM",
32      autoClose: true,
33
34      onSelect: ({ date }) => {
35        if (!date) return
36        if (Array.isArray(date)) return
37
38        const value = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}`
39        this.monthTarget.value = value
40        this.monthTarget.dispatchEvent(new Event("change", { bubbles: true }))
41      }
42    })
43  }
44
45  isDataValid() {
46    const phoneNumbers = this.phoneTarget.value.replace(/\D/g, "")
47    const nameValid = this.fullNameTarget.value.trim().length > 2
48    const planSelected = Array.from(this.planTypeTargets).some(input => input.checked)
49    const monthValid = this.monthTarget?.value?.length > 0
50    const email = this.emailTarget.value.trim()
51    const emailValid = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)
52
53    const confirmationValid =
54      !this.hasConfirmationTarget ||
55      this.confirmationTarget.checked
56
57    return (
58      nameValid &&
59      phoneNumbers.length === 12 &&
60      emailValid &&
61      planSelected &&
62      monthValid &&
63      confirmationValid
64    )
65  }
66
67  toggleSubmitState() {
68    this.submitTarget.disabled = !this.isDataValid()
69  }
70
71  disconnect() {
72    this.picker?.destroy()
73    this.picker = null
74  }
75};

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.