<style>
    table {
        font-family: arial, sans-serif;
        border-collapse: collapse;
        width: 100%;
        table-layout: fixed
    }

    td, th {
        border: 1px solid #000000;
        text-align: center;
        padding: 2px;
    }

    tr:nth-child(even) {
        background-color: #dddddd;
    }
</style>


<div class="page-content-wrapper">
    <div class="page-content">
        <div class="row">
            <div class="col-md-12 clinick invz" >
                <div class="portlet box blue">
                    <div class="portlet-title">
                        <div class="caption">

                            <i class="fa fa-user"></i>Organization
                        </div>
                        <div class="actions">
                            <a href="{$hosturl}/controllers/{$controllname}.php?ac=organizations"
                               class="btn btn-default btn-sm">
                                Show </a>
                        </div>
                    </div>

                    <div class="portlet-body all">
                        <div class="row">
                            <div class="portlet-body form">
                                <form action="{$hosturl}/controllers/{$controllname}.php?ac=org_update" method="post"
                                      id="org_add_form" >
                                    <div class="form-body">
                                        <div class="portlet box grey-cascade">
                                            <div class="portlet-body">
                                                <div class="row">
                                                    <input type="hidden" id="controllName" value="{$controllname}"/>
                                                    <table>
                                                        <tbody>
                                                            <tr>
                                                                <th class="wds20">Id</th>
                                                                <td>
                                                                    <input type="text" class="form-control " name="org_id"  id="org_id"
                                                                           value="{$org->org_id}"   required />
                                                                </td>
                                                            </tr>

                                                            <tr>
                                                                <th>Name</th>
                                                                <td>
                                                                    <input type="text" class="form-control " name="name"  id="name"
                                                                           value="{$org->organization_name}"  required />
                                                                </td>
                                                            </tr>

                                                            <tr>
                                                                <th>Related To.</th>
                                                                <td>
                                                                    <select class="form-control organizations_parents"
                                                                            id="organizations_parents{$data.id}" name="parent_id">
                                                                        <option value="">choose</option>
                                                                        {foreach  $orgParents as $single}
                                                                        <option value="{$single.id}" {if $org->parent_id == $single.id } selected {/if} >{$single.name}</option>
                                                                        {/foreach}
                                                                        <option value="-1" class="deleteoptincompo">تعديل </option>
                                                                    </select>
                                                                </td>
                                                            </tr>

                                                            <tr>
                                                                <th>Type</th>
                                                                <td>
                                                                    <div class="form-group ">
                                                                        <div class="col-md-6">
                                                                            <div class="col-md-3">
                                                                                <div class="md-radio-list">
                                                                                    <div class="md-radio">
                                                                                        <input type="radio" id="org_type0" name="org_type"
                                                                                               class="md-radiobtn org_type" value="0"
                                                                                               {if $org->org_type != 1 } checked {/if}>
                                                                                        <label for="org_type0">
                                                                                            <span></span>
                                                                                            <span class="check"></span>
                                                                                            <span class="box"></span>
                                                                                            Cash </label>
                                                                                    </div>
                                                                                </div>
                                                                            </div>

                                                                            <div class="col-md-3">
                                                                                <div class="md-radio-list">
                                                                                    <div class="md-radio">
                                                                                        <input type="radio" id="org_type1" name="org_type"
                                                                                               class="md-radiobtn org_type" value="1"
                                                                                               {if $org->org_type == 1 } checked {/if} >
                                                                                        <label for="org_type1">
                                                                                            <span></span>
                                                                                            <span class="check"></span>
                                                                                            <span class="box"></span>
                                                                                            Credit  </label>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                                </td>
                                                            </tr>

                                                            <tr>
                                                                <th>Address</th>
                                                                <td>
                                                                    <input type="text" class="form-control " name="location"  value="{$org->location}"  />
                                                                </td>
                                                            </tr>

                                                            <tr>
                                                                <th>Contact  No.</th>
                                                                <td>
                                                                    <input type="text" class="form-control " name="phone"  value="{$org->phone}"  />
                                                                </td>
                                                            </tr>



                                                            <tr>
                                                                <th>Contact Person  </th>
                                                                <td>
                                                                    <input type="text" class="form-control " name="contact_person"  value="{$org->contact_person}"  />
                                                                </td>
                                                            </tr>

                                                            <tr>
                                                                <th>Price List</th>
                                                                <td>
                                                                    <select  class="form-control select2h"  name="price_list">
                                                                        <option value="">choose</option>
                                                                        {foreach  $price_lists as $one}
                                                                        <option value="{$one.id}" {if $org->price_list == $one.id } selected {/if}  >{$one.name}</option>
                                                                        {/foreach}
                                                                    </select>
                                                                </td>
                                                            </tr>

                                                            <tr>
                                                                <th>Sales Person</th>
                                                                <td>
                                                                    <select  class="form-control sales_persons"  name="sales_persons"
                                                                             id="sales_persons">
                                                                        <option value="">choose</option>
                                                                        {foreach  $sales_persons as $one}
                                                                        <option value="{$one.id}" {if $org->sales_persons == $one.id } selected {/if} >{$one.name}</option>
                                                                        {/foreach}
                                                                        <option value="-1" class="deleteoptincompo">تعديل </option>
                                                                    </select>
                                                                </td>
                                                            </tr>

                                                            <tr>
                                                                <th>Contract Start</th>
                                                                <td>
                                                                    <input type="text" class="form-control datepicker " name="contract_start"   value="{$org->contract_start}" />
                                                                </td>

                                                            </tr>

                                                            <tr>
                                                                <th>Email</th>
                                                                <td>
                                                                    <input type="text" class="form-control " name="email"  value="{$org->email}"  />
                                                                </td>

                                                            </tr>

                                                            <tr>
                                                                <th>Vat No.</th>
                                                                <td>
                                                                    <input type="text" class="form-control " name="vat_no"  value="{$org->vat_no}"  />
                                                                </td>
                                                            </tr>

                                                            <tr>
                                                                <th>Credit Limit</th>
                                                                <td>
                                                                    <input type="text" class="form-control " name="credit_limit"
                                                                           value="{$org->credit_limit}" />
                                                                </td>
                                                            </tr>

                                                            <tr>
                                                                <th>User Name</th>
                                                                <td>
                                                                    <input type="text" class="form-control " name="username"
                                                                           id ="username" value="{$org->user_name}"  />

                                                                    <div class="alert alert-warning display-hide" id="showerrorusername">
                                                                        <button class="close" data-close="alert"></button>
                                                                        Use another one , this used before with other user.
                                                                    </div>
                                                                </td>
                                                            </tr>

                                                            <tr>
                                                                <th>Password</th>
                                                                <td>
                                                                    <input type="password" class="form-control " name="epassword"
                                                                           id ="epassword"  />
                                                                </td>
                                                            </tr>

                                                            <tr>
                                                                <th>Confirm  Password </th>
                                                                <td>
                                                                    <input type="password" class="form-control "
                                                                           name="econfirmpassword"    id ="confirmpassword"  />
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>

                                    </div>


                                    <div class="form-actions">
                                        <div class="row">
                                            <div class="col-md-offset-3 col-md-4 fright">
                                                <input type="hidden" id="id" name="id" value="{$org->id}"  />
                                                <button type="submit" class="btn green">Save</button>
                                                <a href="{$hosturl}/controllers/{$controllname}.php?ac=organizations"
                                                   class="btn default">
                                                    Cancel </a>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>



<div  id="editModalDiv"></div>