<style>
    .clientAreaOption{
       background-color:#828282;
       color: whitesmoke;
    }
</style>


<div class="row">
  <div class="container">
    <ol class="breadcrumb">
      <li><a href="#">خصائص عامة</a></li>
      <li><a href="governmentController.php?do=show"> المحافظات التابع لها  الشركات</a></li>
      <li class="active">اضافة محافظة </li>
    </ol>
    
      <h3>اضافة  محافظة</h3>
      <hr/>
    
      {literal}
    <form class="governmentform form-horizontal" action="governmentController.php?do=add" method="post">
    
    <!--- onsubmit="if (Spry.Widget.Form.validate(this)) {checkName(event, 'clientarea', 'companyName'); return true;} else {return false;}"-->
          <!--validate the form before checking name--> 
          {/literal}
          
    
    <div class="row">
    	<div class="col-lg-8">
        
            
        <div class="form-group">
             <label for="governmentName" class="col-lg-2 control-label">اسم المحافظة </label>

            <div class="col-lg-4">
                <input type="text" name="governmentname" id="governmentname" class="form-control" placeholder="اسم المحافظة" />
                <div id="governmentnameError" class="alert alert-block alert-danger fade in" style="display:none"></div>
            </div>
        </div>
        
         <div class="form-group">
             <label style="font-size: 11px;" for="companyName" class="col-lg-2 control-label"> اسم شركة - منطقة </label>
            <div class="col-lg-4">
                <input type="hidden" name="area_itration" id="area_itration" value="0"/>
                <select data-placeholder="اختر الشركة" class="newArea" name="areaid_0" id="newArea">
                    <option value="-1"> اختر الشركة</option>
                    {if $flag eq 1}
                        {assign var=i value = 1}
                        {foreach $clientareaData as $area}
                                <option value="{$area->id}">{$area->name}</option>
                            {if  $i eq 1 }
                            <option class="clientAreaOption"  value="-2" >اضافة شركة جديدة</option>
                            {/if}
                        {assign var=i value=$i+1}
                        {/foreach}
                    {else}
                    <option class="clientAreaOption"  value="-2" >اضافة شركة جديدة</option>
                    {/if}
                </select>
              <div id="newAreaError" class="alert alert-block alert-danger fade in" style="display:none"> </div>
            </div>
          </div>
            <div class="newAreaDiv"></div>
            <button type="button" class="addArea btn btn-warning" style="margin-right: 134px;margin-bottom: 8px;" >اضافة اسم شركة - منطقة</button>
          
          
        	
        <div class="form-group">
            <label for="otherInfo" class="col-lg-2 control-label">بيانات أخرى</label>
            <div class="col-lg-4">
              <textarea  class="form-control" rows="3" name="comment"></textarea>
            </div>
          </div>
          
          <!--==============================-->
        

    	</div><!-- end of client info-->
    
    </div><!-- end of frist row-->
  
    <div class="row">
        <button type="button" style="margin-right: 147px;margin-top: 11px;"  class="btn btn-primary addbtn">حفظ</button>
    
    </div><!-- end of fifth row-->
     
      
    <!------------------------Client Model----------------------------->
<!-- Modal -->
<div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="background-color:transparent!important">
        <div class="modal-content bg-modal">
            <div class="modal-header">
                <button type="button" class="close pull-left savemodel2" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">اضافة شركة جديدة</h4>
            </div>
            <div class="modal-body">
                <form id="clientareaInfo" action="#" method="post" class="form-horizontal">
                    <div class="form-group">
                        <label for="newclientName" class="col-lg-2 control-label">اسم الشركة </label>
                        <div class="col-lg-4"> 
                                <input class="form-control" placeholder="اسم الشركة" id="newclientArea"   name="newclientArea" type="text"  required="required"/>
                            <div id="newclientAreaError" class="alert alert-block alert-danger fade in" style="display:none"></div>
                        </div>
                    </div>

     
                    <div class="form-group">
                        <label for="clientAreaDiscription" class="col-lg-2 control-label">الوصف</label>
                        <div class="col-lg-4">
                            <textarea  class="form-control" rows="3" name="clientAreaDiscription" id="clientAreaDiscription"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="webApiId" class="col-lg-2 control-label">id - الخارجي  </label>
                        <div class="col-lg-4"> 
                                <input class="form-control" placeholder="id - الخارجي " id="webApiId"   name="webApiId" type="text"  />
                            <!--<div id="newclientAreaError" class="alert alert-block alert-danger fade in" style="display:none"></div>-->
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <input type="hidden" name="selectionId" value="" id="selectionId" />
                <button type="button" class="btn btn-primary savemodel1" onClick="insertClientArea();">نعم</button>
                <button type="button" class="btn btn-default savemodel2" data-dismiss="modal">لا</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
 
<!------------------------------------------- area select  ------------------------------------------->
<div id="area_select" style="display:none">
                    <option value="-1"> اختر الشركة</option>
                    {if $flag eq 1}
                        {assign var=i value = 1}
                        {foreach $clientareaData as $area}
                              <option value="{$area->id}">{$area->name}</option>
                            {if  $i eq 1 }
                            <option class="clientAreaOption"  value="-2" >اضافة شركة جديدة</option>
                            {/if}
                        {assign var=i value=$i+1}
                        {/foreach}
                    {else}
                    <option class="clientAreaOption"  value="-2" >اضافة شركة جديدة</option>
                    {/if}
</div>
<!------------------------------------------- area select ------------------------------------------->

   	</form>
    </div><!-- end of container-->
</div><!-- end of main row-->



{literal} 
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");

</script>
{/literal} 

