editRoleLayoutForm = (role, layouts, layout_by_role, req) => {
  //console.log(layouts);
  let edit_link = "";
  const current_layout = layout_by_role[role.id] || layouts[layouts.length - 1];
  let plugin = getState().plugins[current_layout];

  if (plugin?.configuration_workflow)
    edit_link = a(
      { href: `/plugins/configure/${encodeURIComponent(current_layout)}` },
      i({ class: "fa fa-cog ms-2" })
    );

  return form(
    {
      action: `/roleadmin/setrolelayout/${role.id}`,
      method: "post",
    },
    csrfField(req),
    select(
      {
        name: "layout",
        onchange: "form.submit()",
        class: "form-select form-select-sm w-unset d-inline",
      },
      layouts.map((layout, ix) =>
        option(
          {
            value: layout,
            ...((layout_by_role[role.id]
              ? layout_by_role[role.id] === layout
              : ix === layouts.length - 1) && { selected: true }),
          },
          text(layout)
        )
      )
    ),
    edit_link
  );
}
@param {Role} role
@param {Layout[]} layouts
@param {*} layout_by_role
@param {object} req
@returns {Form}