//~OPTIONS
{

}

//~ARGUMENTS
{
  query:     "",
  error:     "",
  result:    [],
  columns:   [],
  arguments: [],
}

//~TEMPLATE
<h4>!{{FSQL Query}}!:</h4>
@{{ render.template("@controls:textarea", { width: "100%", height: "3em", value: fcf.argRef("query")}) }}@
<h4>!{{Arguments}}!:</h4>
%{{
  for(let i = 0; i == 0 || i < args.arguments.length; ++i) {
}}%
    <p>
      @{{ render.template("@controls:text-edit", { index: i, value: fcf.argRef("arguments[" + i + "]") }) }}@
      @{{ render.template("@controls:button",    { title: fcf.t("Remove"), fcfEventClick: "parent.onRemoveArg(" + i + ")" }) }}@
    </p>
%{{
  }
}}%

<p>
@{{ render.template("@controls:button",   { title: fcf.t("Append argument"), fcfEventClick: "parent.onAppendArgument()"}) }}@
@{{ render.template("@controls:button",   { title: fcf.t("Execute"), fcfEventClick: "parent.onExecute()"}) }}@
@{{ render.template("@controls:button",   { title: fcf.t("Clear"), fcfEventClick: "parent.onClear()"}) }}@
</p>
<div class="fcf-red">@{{args.error}}@</div>
<h4>!{{Result}}!:</h4>
@{{ render.template("@controls:table", {
      value: fcf.argRef("result"),
      columns: fcf.argRef("columns"),
      outputRowCount: 10,
    });
}}@
