//~OPTIONS
{
  extends:          "@controls:form",
  include:          ["fcfSimpleAuthorization:css/styles.css"],
  clientRendering:  false,
}

//~ARGUMENTS
{
  fcfClass: "fcf-simple-authorization-form",
  error: "",
  fields:  [
    {
      alias: "user",
      type:  "string",
      notEmpty: true,
    },
    {
      alias: "email",
      type:  "string",
      notEmpty: true,
    },
    {
      alias: "password",
      type:  "password",
      notEmpty: true,
    },
    {
      alias: "confirm_password",
      type:  "password",
      notEmpty: true,
    },
  ]
}

//~TEMPLATE
%{{ if (!fcf.empty(args.error)) { }}%
<errors class="container">@{{args.error}}@</errors>
%{{ } }}%


<table class="fcf-simple-authorization-form-table">
<tr>
  <td>
    !{{User name}}!&nbsp;<span class="fcf-simple-authorization-required-field">*</span>:
  </td>
  <td>
    @{{render.view({view: args.fieldsMap.user, mode: args.mode, args: { value: fcf.argRef("value.user") } })}}@
    %{{ if (args.errorsMap.user) { }}%
    <div class="@{{decor.formElementError}}@">
        @{{ fcf.first(args.errorsMap.user) }}@
    </div>
    %{{ } }}%
  </td>
</tr>
<tr>
  <td>
    !{{E-mail}}!&nbsp;<span class="fcf-simple-authorization-required-field">*</span>:
  </td>
  <td>
    @{{render.view({view: args.fieldsMap.email, mode: args.mode, args: { value: fcf.argRef("value.email") } })}}@
    %{{ if (args.errorsMap.email) { }}%
    <div class="@{{decor.formElementError}}@">
        @{{ fcf.first(args.errorsMap.email) }}@
    </div>
    %{{ } }}%
  </td>
</tr>
<tr>
  <td>
    !{{Password}}!&nbsp;<span class="fcf-simple-authorization-required-field">*</span>:
  </td>
  <td>
    @{{render.view({view: args.fieldsMap.password, mode: args.mode, args: { value: fcf.argRef("value.password") } })}}@
    %{{ if (args.errorsMap.password) { }}%
    <div class="@{{decor.formElementError}}@">
        @{{ fcf.first(args.errorsMap.password) }}@
    </div>
    %{{ } }}%
  </td>
</tr>
<tr>
  <td>
    !{{Confirm password}}!&nbsp;<span class="fcf-simple-authorization-required-field">*</span>:
  </td>
  <td>
    @{{render.view({view: args.fieldsMap.confirm_password, mode: args.mode, args: { value: fcf.argRef("value.confirm_password") } })}}@
    %{{ if (args.errorsMap.confirm_password) { }}%
    <div class="@{{decor.formElementError}}@">
        @{{ fcf.first(args.errorsMap.confirm_password) }}@
    </div>
    %{{ } }}%
  </td>
</tr>
</table>

<description>!{{Instructions for further registration will be sent to your e-mail}}!</description>
