{* Smarty *}

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

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

$(function() {
  $("input[name='repairstatus_name']").css("width","400px");
  $("input[name='repairstatus_color']").css("width","400px");
  $("input[name='repairstatus_order']").css("width","400px");
});

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

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

$(function(){
  $('#repairstatus_color').colorPicker();
});

//]]>
</script>
{/literal}

<form action="{$MS_SP->Sp_PathTop}{$MS_SP->Sp_PathToSite}/AjaxServer/RepairStatusSave.ajax.php" method="post" name="FormRepairStatusAdd" id="FormRepairStatusAdd">
  <input id="repairstatus_id" name="repairstatus_id" type="hidden" value="{if isset($ArrRepairStatus.repairstatus_id)}{$ArrRepairStatus.repairstatus_id}{/if}" />
  <table>
    <tr>
      <td><label for="repairstatus_name">Наименование <span class="ui-state-error">* </span>:&nbsp;</label><span></span></td>
      <td colspan="2"><input type="text" id="repairstatus_name" name="repairstatus_name" value="{if isset($ArrRepairStatus.repairstatus_name)}{$ArrRepairStatus.repairstatus_name}{/if}" /></td>
    </tr>
    <tr>
      <td><label for="repairstatus_color">Цвет для отображения <span class="ui-state-error">* </span>:&nbsp;</label><span></span></td>
      <td colspan="2"><input type="text" id="repairstatus_color" name="repairstatus_color" value="{if isset($ArrRepairStatus.repairstatus_color)}{$ArrRepairStatus.repairstatus_color}{/if}" /></td>
    </tr>
    <tr>
      <td><label for="repairstatus_order">Сортировка <span class="ui-state-error">* </span>:&nbsp;</label><span></span></td>
      <td colspan="2"><input type="text" id="repairstatus_order" name="repairstatus_order" value="{if isset($ArrRepairStatus.repairstatus_order)}{$ArrRepairStatus.repairstatus_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>