{include file="_partials/head.tpl"}

<div class="page-head">
  <div>
    <h1>[if {row.id}]{row.title}[else]{lang key="shop.payment_method.new"}[/if]</h1>
    <p class="muted"><a href="/admin/shop/payments">{lang key="shop.payment_method.back_to_list"}</a></p>
  </div>
</div>

<form method="post" action="{form_action}" class="card">
  {csrf}

  <div class="form-row">
    <div class="form-group">
      <label>{lang key="shop.common.title"} *</label>
      <input type="text" name="title" value="{row.title}" required placeholder="{lang key="shop.payment_method.title_placeholder"}">
    </div>
    <div class="form-group">
      <label>Slug</label>
      <input type="text" name="slug" value="{row.slug}" placeholder="cash">
    </div>
  </div>

  <div class="form-row">
    <div class="form-group">
      <label>{lang key="shop.payment_method.kind"}</label>
      <select name="kind">
        <option value="cash"           [if {row.kind}="cash"]selected[/if]>{lang key="shop.payment_method.kind_cash_short"}</option>
        <option value="card_offline"   [if {row.kind}="card_offline"]selected[/if]>{lang key="shop.payment_method.kind_card_short"}</option>
        <option value="online_gateway" [if {row.kind}="online_gateway"]selected[/if]>{lang key="shop.payment_method.kind_gateway_full"}</option>
        <option value="invoice"        [if {row.kind}="invoice"]selected[/if]>{lang key="shop.payment_method.kind_invoice_short"}</option>
      </select>
    </div>
    <div class="form-group">
      <label>Сорт.</label>
      <input type="number" name="sort_order" value="{row.sort_order}">
    </div>
    <div class="form-group" style="display:flex;align-items:end;gap:8px">
      <label class="checkbox">
        <input type="checkbox" name="is_active" value="1" [if {row.is_active}]checked[/if]>
        Активен
      </label>
    </div>
  </div>

  <div class="form-group">
    <label>{lang key="shop.payment_method.description_label"}</label>
    <textarea name="description" rows="4">{row.description}</textarea>
  </div>

  <div class="form-group">
    <label>{lang key="shop.payment_method.config_section"}</label>
    <textarea name="config" rows="6" style="font-family:ui-monospace,monospace;font-size:12px">{row.config}</textarea>
    <small class="help">{lang key="shop.payment_method.config_help"}</small>
  </div>

  <div class="form-actions">
    <button type="submit" class="btn btn-primary">{lang key="admin.save"}</button>
    <a href="/admin/shop/payments" class="btn btn-secondary">{lang key="admin.cancel"}</a>
  </div>
</form>

{include file="_partials/foot.tpl"}
