feat: groups price calculator admin crud, booking/offer flow and api
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
|
||||
static values = {
|
||||
content: String,
|
||||
label: String,
|
||||
}
|
||||
|
||||
connect() {
|
||||
this.originalLabel = this.element.innerText
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
clearTimeout(this.resetTimer)
|
||||
}
|
||||
|
||||
copy() {
|
||||
navigator.clipboard.writeText(this.contentValue).then(() => {
|
||||
this.dispatch('copied', {
|
||||
detail: {
|
||||
content: this.contentValue,
|
||||
}
|
||||
})
|
||||
}).catch((error) => {
|
||||
console.error('Failed to copy to clipboard:', error)
|
||||
})
|
||||
|
||||
if (this.hasLabelValue) {
|
||||
this.element.innerText = this.labelValue
|
||||
clearTimeout(this.resetTimer)
|
||||
this.resetTimer = setTimeout(() => {
|
||||
this.element.innerText = this.originalLabel
|
||||
}, 3000)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user