{* Smarty *}

{literal}
<script type="text/javascript">
//<![CDATA[

$(function() {
  AltButtons();
});

$(function() {
  $("input[name='svtgiveoutstatus_name']").css("width","400px");
  $("input[name='svtgiveoutstatus_color']").css("width","400px");
  $("input[name='svtgiveoutstatus_order']").css("width","400px");
});

function showResponseFormSvtGiveoutStatusAdd(responseText){
  if(typeof(responseText['error'])=='undefined'){
    $("#GridSvtGiveoutStatus").trigger("reloadGrid");
    $("#SvtGiveoutStatusEditFrm").dialog("destroy");
    DialogStandartMessageOpen("message", responseText['message']);
  }
  else{
    DialogStandartMessageOpen("error", responseText['error']);
  }
}

$(function(){
  var options = {
    success: showResponseFormSvtGiveoutStatusAdd,
    timeout: 3000
  };
  $("#FormSvtGiveoutStatusAdd").validate({
    submitHandler: function(form) {
      $(form).ajaxSubmit(options);
    },
    ignore: "",
    rules : {
      "svtgiveoutstatus_name" : {required : true},
      "svtgiveoutstatus_color" : {required : true},
      "svtgiveoutstatus_order" : {
        required : true,
        number: true
      }
    },
    errorPlacement: function(error, element) {
      var er = element.attr("name");
      error.appendTo($("label[for='" + er + "']").next() );
    }
  });
});

$(function(){
  $('#svtgiveoutstatus_color').colorPicker();
});
//]]>
</script>
{/literal}

<form action="{$MS_SP->Sp_PathTop}{$MS_SP->Sp_PathToSite}/AjaxServer/SvtGiveoutStatusSave.ajax.php" method="post" name="FormSvtGiveoutStatusAdd" id="FormSvtGiveoutStatusAdd">
  <input id="svtgiveoutstatus_id" name="svtgiveoutstatus_id" type="hidden" value="{if isset($ArrSvtGiveoutStatus.svtgiveoutstatus_id)}{$ArrSvtGiveoutStatus.svtgiveoutstatus_id}{/if}" />
  <table>
    <tr>
      <td><label for="svtgiveoutstatus_name">Наименование <span class="ui-state-error">* </span>:&nbsp;</label><span></span></td>
      <td colspan="2"><input type="text" id="svtgiveoutstatus_name" name="svtgiveoutstatus_name" value="{if isset($ArrSvtGiveoutStatus.svtgiveoutstatus_name)}{$ArrSvtGiveoutStatus.svtgiveoutstatus_name}{/if}" /></td>
    </tr>
    <tr>
      <td><label for="svtgiveoutstatus_color">Цвет для отображения <span class="ui-state-error">* </span>:&nbsp;</label><span></span></td>
      <td colspan="2"><input type="text" id="svtgiveoutstatus_color" name="svtgiveoutstatus_color" value="{if isset($ArrSvtGiveoutStatus.svtgiveoutstatus_color)}{$ArrSvtGiveoutStatus.svtgiveoutstatus_color}{/if}" /></td>
    </tr>
    <tr>
      <td><label for="svtgiveoutstatus_order">Сортировка <span class="ui-state-error">* </span>:&nbsp;</label><span></span></td>
      <td colspan="2"><input type="text" id="svtgiveoutstatus_order" name="svtgiveoutstatus_order" value="{if isset($ArrSvtGiveoutStatus.svtgiveoutstatus_order)}{$ArrSvtGiveoutStatus.svtgiveoutstatus_order}{/if}" /></td>
    </tr>
    <tr>
      <td colspan="3">
        <span class="ui-state-error"> * </span>поля обязательные для заполнения
      </td>
    </tr>
    <tr>
      <td colspan="3" class="MsFormSubmit"><input class="AltButtons" name="FormSubmit" value="сохранить" type="submit" /></td>
    </tr>
  </table>
</form>