import { Controller } from "@hotwired/stimulus";
export default class OrderableFormController extends Controller {
add(item) {
const { id_name, id_value, index_name } = item.paramsValue;
this.element.insertAdjacentHTML(
"beforeend",
`
`,
);
}
submit() {
if (this.inputs.length === 0) return;
this.element.requestSubmit();
}
clear() {
this.inputs.forEach((input) => input.remove());
}
get inputs() {
return this.element.querySelectorAll("input[data-generated]");
}
}