<?php /* Smarty version Smarty-3.1.11, created on 2025-05-18 14:00:16
         compiled from "../views/default/sizecolorview/add.html" */ ?>
<?php /*%%SmartyHeaderCode:6963734686829bdc0b98cd6-56323394%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'cc1bcbfb7e517f3032d5a6a4971c6c78e8bf54e3' => 
    array (
      0 => '../views/default/sizecolorview/add.html',
      1 => 1740000155,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '6963734686829bdc0b98cd6-56323394',
  'function' => 
  array (
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.11',
  'unifunc' => 'content_6829bdc0d84950_05901511',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_6829bdc0d84950_05901511')) {function content_6829bdc0d84950_05901511($_smarty_tpl) {?>


<div class="row">
    <div class="container">

        <ol class="breadcrumb">
            <li><a href="#">المنتجات</a></li>
            <li><a href="sizecolorController.php?do=show">مقاسات والوان</a></li>
            <li class="active">اضافة</li>
        </ol>


        <div class="panel panel-default panel-m">
            <div class="panel-heading">
                <h3 class="panel-title">اضافة مقاس او لون</h3>
            </div>
            <div class="panel-body">


                <form class="nameToBeChecked form-horizontal" role="form" action="sizecolorController.php?do=add" method="post" id="spform">
                    <div class="form-group">
                        <label class="col-lg-2 control-label">الاسم</label>
                        <div class="col-lg-4">
                            <input type="text" name="name" id="name" class="form-control"/>
                            <div id="nameError" style="display:none;"></div>
                        </div>
                    </div>



                    <div class="form-group">
                        <label class="col-lg-2 control-label">النوع</label>
                        <div class="col-lg-4">
                            <div class="radio-inline">
                                <label>
                                    <input value="0"  class="noradioR" name="type"   checked="checked"  type="radio" />
                                    مقاس</label>
                            </div>
                            <div class="radio-inline">
                                <label>
                                    <input value="1"  class="radioR" name="type"   type="radio" />
                                    لون </label>
                            </div>
                        </div>
                    </div>

                    <!-- =================================================   -->

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="button"  class="btn btn-primary pull-left"  id="spbutton">حفظ الامر</button>
                        </div>
                    </div>


                </form>
            </div>
        </div>




    </div>
</div>


<script type="text/javascript">
    $('#spbutton').live('click', function (e) {
        if ($('#spform').validate().form()) {
            //ckeck name
            var tableName = 'sizecolor';
            var inputName = 'name';
            var name = $("#" + inputName).val();
            $.ajax({
                url: 'checkRedundantNames.php?name=' + name + '&tablename=' + tableName,
                success: function (data) {
                    //alert(data);
                    if (data == '0')
                    {
                        $("#nameError").css("display", "none");
                        var myForm = document.getElementById("spform");
                        var SS = Spry.Widget.Form.validate(myForm);
                        if (SS == true) {
                            if (!$('#spbutton').hasClass("processing"))
                            {
                                $('#spbutton').addClass("processing");
                                myForm.submit();
                                //$('#spbutton').unbind('click');
                            }
                        }
                        //return true;
                    } else if (data == '1')
                    {
                        $("#" + inputName).val("");
                        $("#" + inputName).focus();
                        $("#nameError").css("display", "block");
                        return false;
                    }
                }});
        } else {
            e.preventDefault();
        }
    });



</script>


<?php }} ?>