Employer form mostly working with persist to db
This commit is contained in:
@@ -1,20 +1,30 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["template", "container"]
|
||||
|
||||
connect() {
|
||||
console.log("connect")
|
||||
static values = {
|
||||
parentColor: String
|
||||
}
|
||||
|
||||
static targets = ["template", "container"]
|
||||
|
||||
add(event) {
|
||||
console.log("start")
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
const content = this.templateTarget.innerHTML.replace(/NEW_EXC_RECORD/g, new Date().getTime())
|
||||
const content = this.#updateTemplateException()
|
||||
|
||||
this.containerTarget.insertAdjacentHTML("beforeend", content)
|
||||
console.log("end")
|
||||
|
||||
}
|
||||
|
||||
#updateTemplateException() {
|
||||
const nextIndex = new Date().getTime()
|
||||
console.log("~~ " + this.parentColorValue)
|
||||
return this.templateTarget.innerHTML
|
||||
.replace(/NEW_EXC_RECORD/g, nextIndex)
|
||||
.replace(/PARENT_SECONDARY_COLOR/g, this.parentColorValue)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user