
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">{$smarty.const.EXPENSES_REVENUE}</a></li>
            <li><a href="#"> {$smarty.const.REVENUE} </a></li>
            <li class="active"> {$smarty.const.REVENUE_EDIT} </li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <h3 class="panel-title">{$smarty.const.REVENUE_EDIT}</h3>
            </div>
            <div class="panel-body">
                {literal}
                <form id="incform" class="form-horizontal" action="incomeController.php?do=update" method="post" >
                    <!--validate the form before checking name-->
                    {/literal}
                    <div class="form-group">
                        <label class="col-lg-2 control-label">{$smarty.const.REVENUE_MAIN_CLASSIFICATION}</label>
                        <input type="hidden" name="incomeId" id="incomeId" value="{$incomedata->incomeId}"/>
                        <div class="col-lg-4">
                            <select name="parent" id="parent" class="select2 wdt100">
                                <option value="0" selected="selected">{$smarty.const.REVENUE_NO_MAIN_CLASSIFICATION}</option>
                                {foreach $alldata as $parent}
                                <option value="{$parent->incomeTypeId}" {if $incomedata->incomeTypeId == $parent->incomeTypeId}  selected="selected" {/if}>{$parent->incomeTypeName}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>

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

                    <div  {if $Programsettingdata->costcenter neq 0 && $Programsettingdata->realestatedev neq 0 } style="display:none" {/if}>
                        <div class="form-group"   >
                            <label class="col-lg-2 control-label">{$smarty.const.REVENUE_COST_CENTER}</label>
                            <div class="col-lg-4">
                                <select class="select2 wdt100" name="Costcenterid" id="Costcenterid" >
                                    <option value="-1">{$smarty.const.REVENUE_CHOOSE_COST_CENTER}</option>
                                    {foreach $allCostcenter as $myallCostcenter}
                                    <option  {if {$incomedata->costcenterid} eq {$myallCostcenter->id} } selected="selected"  {/if} value="{$myallCostcenter->id}">{$myallCostcenter->name}</option>
                                    {/foreach}
                                </select>
                                <div id="parentError" style="display:none;"></div>
                            </div>
                        </div>
                    </div>
                      <div  {if $Programsettingdata->incomeclient eq 0} {else} style="display:none" {/if}>
                        <div class="form-group"   >
                            <label class="col-lg-2 control-label">{$smarty.const.REVENUE_CLIENTS}</label>
                            <div class="col-lg-4">
                                <select class="select2 wdt100" name="clientid" id="clientid" >
                                   <option value="-1">{$smarty.const.REVENUE_CHOOSE_CLIENT}</option>
                                    {foreach $clientsData as $data }
                                    <option value="{$data->clientid}" {if {$incomedata->clientid} eq {$data->clientid} } selected="selected"  {/if}>{$data->clientname}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                    </div>

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

                    <div class="form-group">
                        <label class="col-lg-2 control-label">{$smarty.const.REVENUE_NAME}</label>
                        <div class="col-lg-4">
                            <input type="text" name="name" id="name" class="form-control" value="{$incomedata->incomeName}"/>
                            <input type="hidden" name="oldname" id="oldname" class="form-control" value="{$incomedata->incomeName}"/>
                            <div id="nameError" style="display:none;"></div>

                        </div>
                    </div>

                    <!--==============================-->
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> {$smarty.const.REVENUE_VALUE}</label>
                        <div class="col-lg-4">
                            <input name="Value" required="required" id="defaultValue" type="text" class="form-control numberinput" value="{$incomedata->incomeValue}"/>
                            <input type="hidden" value="{$incomedata->dailyentryid}" name="dailyentryid"/>
                            <div id="valueError" style="display:none;"></div>

                        </div>
                    </div>
                    <!--==============================-->
                   <!--  <div class="form-group">
                        <label class="col-lg-2 control-label">{$smarty.const.REVENUE_SAFE}</label>
                        <div class="col-lg-4">
                            <span id="spryselect3">
                                <select name="saveid"  id="saveid" class="select2">
                                    <option value="-1">{$smarty.const.REVENUE_CHOOSE_SAFE}</option>
                                    {foreach $allSave as $data}
                                    <option value="{$data->saveid}" {if $incomedata->saveid == $data->saveid}selected{/if}>{$data->savename}</option>
                                    {/foreach}
                                </select>
                                <span class="selectInvalidMsg">{$smarty.const.REVENUE_CHOOSE_SAFE}</span></span>
                        </div>
                    </div> -->


                       {if $searchinonesave == 1}
                    <input type="hidden" name="saveid" id="saveid" value="{$saves}" />
                    {else}
                    <div class="form-group">
                        <label class="col-lg-2 control-label">{$smarty.const.REVENUE_SAFE}</label>
                        <div class="col-lg-4">
                            <select name="saveid" id="saveid" class="select2 wdt100">
                                    <option value="-1">{$smarty.const.REVENUE_CHOOSE_SAFE}</option>
                                {foreach $saves as $data}
                                <option value="{$data->saveid}" {if $saveid == $data->saveid}selected{/if}>{$data->savename}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    {/if}
                    
                    <div class="form-group">
                        <label class="col-lg-2 control-label"> {$smarty.const.REVENUE_COMMIT} </label>
                        <div class="col-lg-4">
                            <textarea cols="20" rows="5" name="comment" id="comment" class="form-control">{$incomedata->incomeDetails}</textarea>
                        </div>
                    </div>

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

                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-4">
                            <button type="button" id="saveIncBtn" class="btn btn-primary pull-left">{$smarty.const.REVENUE_EDIT}</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{literal}
<script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
</script> {/literal}