mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
28 lines
617 B
JavaScript
28 lines
617 B
JavaScript
import BulkActionsController from "./bulk_actions_controller";
|
|
|
|
export default class extends BulkActionsController {
|
|
static targets = ["extraParams"]
|
|
|
|
connect() {
|
|
super.connect();
|
|
}
|
|
|
|
confirm() {
|
|
let data = { order_ids: super.getOrdersIds() };
|
|
|
|
if (this.hasExtraParamsTarget) {
|
|
Object.assign(data, this.extraFormData())
|
|
}
|
|
|
|
this.stimulate("CancelOrdersReflex#confirm", data);
|
|
}
|
|
|
|
// private
|
|
|
|
extraFormData() {
|
|
if (this.extraParamsTarget.constructor.name !== "HTMLFormElement") { return {} }
|
|
|
|
return Object.fromEntries(new FormData(this.extraParamsTarget).entries())
|
|
}
|
|
}
|