
<div class="row">
    <div class="container {if $lang_code == 'en'} gt4-ltr{/if}">
        <ol class="breadcrumb">
            <li><a href="#">{$smarty.const.EXPENSES_REVENUE}</a></li>
            <li><a href="#">{$smarty.const.EXPENSES}</a></li>
            <li class="active">{$smarty.const.EXPENSES_EDIT}</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">
                <h3 class="panel-title">{$smarty.const.EXPENSES_EDIT}</h3>
            </div>
            <div class="panel-body">
                <form class="nameToBeChecked form-horizontal" action="expensesController.php?do=update"  method="post" enctype="multipart/form-data">
                    <!--validate the form before checking name-->

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

                    <form  action="expensesController.php?do=add"  method="post" class=" form-horizontal" id="myExpenseForm" name="myExpenseForm" enctype="multipart/form-data" >

                        <div  {if $Programsettingdata->costcenter eq 0} {else} style="display:none" {/if}>
                            <div class="form-group"   >
                                <label class="col-lg-2 control-label">{$smarty.const.EXPENSES_COST_CENTER}</label>
                                <div class="col-lg-4">


                                    {foreach $allCostcenter as $myallCostcenter}



                                    {if {$Expensealldata->costcenterid} eq {$myallCostcenter->id} } {$myallCostcenter->name} {/if}
                                    {/foreach}
                                </div>
                            </div>

                        </div>


                           <div class="form-group">
                            <label class="col-lg-2 control-label">{$smarty.const.EXPENSES_PAYMENT_METHOD}</label>
                            <div class="col-lg-4">
                                <div class="radio-inline">
                                    <label>
                                        <input value="0"  name="paymethod" id="PMSave" class="PMethod" {if $Expensealldata->saveid > 0}checked="checked"{/if}  type="radio" />

                                        {$smarty.const.EXPENSES_SAFE} </label>
                                </div>
                                <div class="radio-inline">
                                    <label>
                                        <input value="1" name="paymethod" id="PMBank" class="PMethod" {if $Expensealldata->bankid > 0}checked="checked"{/if} type="radio" />
                                        {$smarty.const.EXPENSES_BANK} </label>
                                </div>

                            </div>
                        </div>



                        <div id="bank-div" style="display: none">
                            <div class="form-group">
                                <label class="col-lg-2 control-label">{$smarty.const.EXPENSES_ELBANK}</label>
                                <div class="col-lg-4">
                                    <span id="spryselect4">
                                        <select name="bankid"  id="bankid" class="select2">
                                            <option value="-1">{$smarty.const.EXPENSES_CHOOSE_ELBANK}</option>

                                            {foreach $bank as $data}
                                            <option value="{$data->bankid}" {if $Expensealldata->bankid == $data->bankid}selected{/if}>{$data->bankname}</option>
                                            {/foreach}

                                        </select>
                                        <span class="selectInvalidMsg">{$smarty.const.EXPENSES_CHOOSE_ELBANK}</span></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">{$smarty.const.EXPENSES_ACCOUNT}</label>
                                <div class="col-lg-4">
                                    <span id="spryselect5">
                                        <select name="bankaccountid"  id="bankaccountid" class="">
                                            {foreach $bankAccount as $data}
                                            <option value="{$data->accountid}" {if $Expensealldata->bankaccountid == $data->accountid}selected{/if}>{$data->accountname}</option>
                                            {/foreach}
                                        </select>
                                        <span class="selectInvalidMsg">{$smarty.const.EXPENSES_CHOOSE_ACCOUNT}</span></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 control-label">{$smarty.const.EXPENSES_CHECK_NUMBER}</label>
                                <div class="col-lg-4">
                                    <span id="sprytextfield3">
                                        <input name="checkNo" id="checkNo" type="text"   class="form-control" value="{$Expensealldata->checknum}"/>
                                        <span class="textfieldRequiredMsg">*</span></span>
                                </div>
                            </div>
                        </div>




                        <div id="save-div"><!--$Expensealldata->saveid-->

                           {if $searchinonesave == 1}
                            <input type="hidden" name="saveid" id="saveid" value="{$Expensealldata->saveid}" />
                            {else}
                            <div class="form-group">
                                <label class="col-lg-2 control-label">{$smarty.const.EXPENSES_SAFE}</label>
                                <div class="col-lg-4">
                                    <select name="saveid" id="saveid" class="select2">
                                        <option value="-1">{$smarty.const.EXPENSES_CHOOSE_SAFE}</option>
                                        {foreach $allSave as $data}
                                        <option value="{$data->saveid}" {if $Expensealldata->saveid == $data->saveid}selected{/if}>{$data->savename}</option>
                                        {/foreach}
                                    </select>
                                </div>
                            </div>
                            {/if}



                           <!--  {if $userData->searchinonesave eq 0}
                            <div class="form-group">
                                <label class="col-lg-2 control-label">{$smarty.const.EXPENSES_SAFE}</label>
                                <div class="col-lg-4">
                                    <span id="spryselect3">
                                        <select name="saveid"  id="saveid" class="select2">
                                            <option value="-1">{$smarty.const.EXPENSES_CHOOSE_SAFE}</option>
                                            {foreach $allSave as $data}
                                            <option value="{$data->saveid}" {if $Expensealldata->saveid == $data->saveid}selected{/if}>{$data->savename}</option>
                                            {/foreach}
                                        </select>
                                        <span class="selectInvalidMsg">{$smarty.const.EXPENSES_CHOOSE_SAFE}</span></span>
                                </div>
                            </div>
                            {else}
                            <div class="form-group">
                                <label class="col-lg-2 control-label">{$smarty.const.EXPENSES_SAFE}</label>
                                <div class="col-lg-4">
                                    {foreach $allSave as $data}
                                    {if $Expensealldata->saveid == $data->saveid}{$data->savename}{/if}
                                    <input type="hidden" name="saveid" id="saveid" value="{$userData->saveid}"/>
                                    {/foreach}
                                </div>
                            </div>
                            {/if}
 -->

                        </div>



                       <!--  <div class="form-group">
                            <label for="inputEmail1" class="col-lg-2 control-label">{$smarty.const.EXPENSES_TYPE_NAME}</label>
                            <div class="col-lg-4">
                                <select name="expensetype" required="" data-placeholder="{$smarty.const.EXPENSES_CHOOSE_TYPE}"  class="select2 wdt100">
                                    {foreach $alldata as $data}
                                    <option  {if {$Expensealldata->expensestypeid} eq {$data->expensestypeid}}  selected="selected" {/if} value="{$data->expensestypeid}">{$data->expensestypename}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div> -->


                        <div class="form-group">
                                <label class="col-lg-2 control-label">{$smarty.const.EXPENSES_TYPE}</label>
                                <div class="col-lg-4">
                                    <input type="text" name="expensetype"  class="wdt100" id="expensetype" data-placeholder="{$smarty.const.EXPENSES_CHOOSE_TYPE} " />
                                    <input type="hidden" id="expensetypeid" value="{$Expensealldata->expensestypeid}" />
                                    <input type="hidden" id="expensetypetext" value="{$expensetype->expensestypename}" />
                                </div>
                            </div>
                     
                        <!--==============================-->

                        <input type="hidden" name="dailyentryid" value="{$Expensealldata->dailyentryid}"/>
                        <input type="hidden" name="oldExpensestypeid" value="{$Expensealldata->expensestypeid}"/>

                        <div class="form-group">
                            <label for="inputEmail1" class="col-lg-2 control-label">{$smarty.const.EXPENSES_NAME}</label>
                            <div class="col-lg-4">
                                <input type="text"  name="expensesname" id="expensesname" required="required" value="{$Expensealldata->expensesname}" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group"   {if $Expensealldata->productid eq 0} style="display:none" {/if}>
                            <label class="col-lg-2 control-label">{$smarty.const.EXPENSES_PRODUCTS}</label>
                            <div class="col-lg-4">
                                <input type="hidden" name="searchvalue" id="searchvalue" value="{$Programsettingdata->searchvalue}"/>
                                <input type="text" name="productid" id="productid" class="select2product wdt100 clas_offerproduct" data-itr='1'  data-placeholder="{$smarty.const.EXPENSES_CHOOSE_PRODUCT}" tabindex="301"/>
                                <input type="hidden"  id="oldid"  value="{$Expensealldata->productid}" />
                                <input type="hidden" id="oldname"  value="{$productdata->parcode} / {$productdata->productName}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputEmail1" class="col-lg-2 control-label">{$smarty.const.EXPENSES_VALUE}</label>
                            <div class="col-lg-4"> <span id="name">
                                    <input type="text" value="{$Expensealldata->expensesValue}" name="expensevalue" id="expensevalue" class="form-control numberinput calcExpensevalueAfterTax"/>
                                    <input name="expenseid" id="expenseid" type="hidden" value="{$Expensealldata->expensesid}" />
                                    <span class="textfieldInvalidFormatMsg">{$smarty.const.EXPENSES_MUST_ENTER_AMOUNT}.....</span></span> </div>
                        </div>
                        <div class="form-group">
                            <label for="inputEmail1" class="col-lg-2 control-label">يوجد قيمة مضافة</label>
                            <div class="col-lg-4">
                                <input type="hidden" id="taxValue_Setting_h" value="{$Programsettingdata->taxValue}">
                                <input type="checkbox" name="taxExist" class="calcExpensevalueAfterTax" id="taxExist" value="1" {if $Expensealldata->taxPer > 0}checked{/if}>
                            </div>
                        </div>
                        <div class="form-group vatDiv" {if $Expensealldata->taxPer > 0}{else}style="display: none"{/if}>
                            <label for="inputEmail1" class="col-lg-2 control-label">  ضريبه القيمة المضافة</label>
                            <div class="col-lg-4">
                                <div class="input-group">
                                    <input type="text" name="tax" class="form-control numberinput positiveNo calcExpensevalueAfterTax" id="tax" value="{$Expensealldata->taxPer}">
                                    <span class="input-group-addon">%</span>
                                </div>
                                <div class="input-group" style="padding-top: 1px;">
                                    <input type="text" name="taxVal" class="form-control numberinput positivefloat" id="taxVal" value="{$Expensealldata->taxVal}" readonly="">
                                    <span class="input-group-addon">جنيه</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group vatDiv" {if $Expensealldata->taxPer > 0}{else}style="display: none"{/if}>
                            <label for="inputEmail1" class="col-lg-2 control-label">قيمة المصروف بعد الضريبة</label>
                            <div class="col-lg-4">
                                <div class="input-group" style="padding-top: 1px;">
                                    <input type="text" name="expensevalueAfterTax" id="expensevalueAfterTax"   class="form-control positivefloat"  value="{$Expensealldata->expensesValue+$Expensealldata->taxVal}" readonly="">
                                    <span class="input-group-addon">جنيه</span>
                                </div>
                            </div>
                        </div>

                        {if $Programsettingdata->expensesupplier eq 1}

                        <div class="form-group">
                            <label class="col-lg-2 control-label">المورد</label>
                            <div class="col-lg-4">
                                <select class="select2 wdt100" name="supplier" id="supplier" >
                                    <option value="0"></option>
                                    {foreach $suppliersData as $data}
                                    <option value="{$data->supplierid}" {if $Expensealldata->supplier==$data->supplierid}selected{/if}>{$data->suppliername}</option>
                                    {/foreach}
                                </select>
                                <div id="supplierError" style="display:none;"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputEmail1" class="col-lg-2 control-label">المتبقى على المورد</label>
                            <div class="col-lg-4">
                                <input type="text" name="suppRemainingVal" id="suppRemainingVal"   class="form-control positivefloat" value="{$Expensealldata->suppRemainingVal}">
                                <div id="valueError" style="display:none;"></div>
                            </div>
                        </div>
                        {/if}

                        {if $Programsettingdata->specialexpenses eq 0}
                        <div class="form-group">
                            <label for="inputEmail1" class="col-lg-2 control-label">{$smarty.const.EXPENSES_NUMBER}</label>
                            <div class="col-lg-4">
                                <input type="text" name="expensenumbrt" id="expensenumbrt"  value="{$Expensealldata->expensenumbrt}"  class="form-control positivefloat"  placeholder="{$smarty.const.EXPENSES_NUMBER}">
                                <div id="valueError" style="display:none;"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputEmail1" class="col-lg-2 control-label">{$smarty.const.EXPENSES_PRICE}</label>
                            <div class="col-lg-4">
                                <input type="text" name="expenseprice" id="expenseprice"  value="{$Expensealldata->expenseprice}"  class="form-control positivefloat"  placeholder="{$smarty.const.EXPENSES_PRICE}">
                                <div id="valueError" style="display:none;"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputEmail1" class="col-lg-2 control-label">{$smarty.const.EXPENSES_TOTALN}</label>
                            <div class="col-lg-4">
                                <input type="text" name="expensetotaln" id="expensetotaln" readonly value="{$Expensealldata->expensetotaln}"  class="form-control positivefloat"  placeholder="{$smarty.const.EXPENSES_TOTALN}">
                                <div id="valueError" style="display:none;"></div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="inputEmail1" class="col-lg-2 control-label">{$smarty.const.EXPENSES_SHORTFALLS}</label>
                            <div class="col-lg-4">
                                <input type="text" name="expenseshortfalls" id="expenseshortfalls" value="{$Expensealldata->expenseshortfalls}"   class="form-control positivefloat"  placeholder="{$smarty.const.EXPENSES_SHORTFALLS}">
                                <div id="valueError" style="display:none;"></div>
                            </div>
                        </div>
                        {/if}
                        {if $Programsettingdata->clientsell eq 1}
                        <div class="form-group">
                            <label for="txtName" class="col-lg-2 control-label">العملاء</label>
                            <div class="col-lg-4">
                                <input type="text" name="clientid" class="wdt100" id="select2client" data-placeholder="اختر " />
                                <input type="hidden" id="clientid" value="{$Clientdata->clientid}">
                                <input type="hidden" id="clienttext" value="{$Clientdata->clientname}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="txtName" class="col-lg-2 control-label">الفواتير </label>
                            <div class="col-lg-4">
                                <input type="text" name="sellbillid"  class="wdt100" id="select2sellbill" data-placeholder="اختر " />
                                <input type="hidden" id="executorssellid" value="{$sellbilldata->sellbillid}">
                                <input type="hidden" id="selltext" value="{$sellbilldata->sellbillid} / {$sellbilldata->datestarting}">
                            </div>
                        </div>
                        {/if}


                        {if $Programsettingdata->realestateunits eq 1}
                        <div class="form-group">
                            <label for="txtName" class="col-lg-2 control-label">العقارات</label>
                            <div class="col-lg-4">
                                <input type="text" name="realestateid" class="wdt100" id="select2realestates" data-placeholder="اختر " />
                                <input type="hidden" id="realestateid" value="{$realestate->id}">
                                <input type="hidden" id="realestatetext" value="{$realestate->realestatename}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="txtName" class="col-lg-2 control-label">الوحدات </label>
                            <div class="col-lg-4">
                                <input type="text" name="realestateunitid" class="wdt100" id="select2realestatesunits" data-placeholder="اختر " />
                                <input type="hidden" id="realestateunitid" value="{$realestateunit->id}">
                                <input type="hidden" id="realestateunittext" value="{$realestateunit->unitname} / {$realestateunit->unitarea}">
                            </div>
                        </div>
                        {/if}


                        <div class="form-group">
                            <label for="inputEmail1" class="col-lg-2 control-label">{$smarty.const.EXPENSES_COMMENT}</label>
                            <div class="col-lg-4">
                                <textarea  name="expensecomment" class="form-control">{$Expensealldata->expensesdetails}</textarea>
                            </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 name="conditions" type="radio" value="1" {if {$Expensealldata->
                                                                conditions} eq 1} checked="checked" {/if} />
                                                                نعم </label>
                                                        </div>
                                                        <div class="radio-inline">
                                                            <label>
                                                                <input name="conditions" type="radio" {if {$Expensealldata->
                                                                conditions} eq 0} checked="checked" {/if} value="0" />
                                                                لا </label>
                                                        </div>
                                                    </div>
                                                </div>-->

                        <div class="form-group">
                            <label class="col-lg-2 control-label">الملف</label>
                            <div class="col-lg-4">
                                {if $Expensealldata->file != "" && $Expensealldata->file !="." && $Expensealldata->file !="no image"}
                                <img src="../upload/expenseFile/{$Expensealldata->file}" alt="" width="122" height="75"/>
                                {/if}
                                <input type="file" name="file" id="file"/>
                                <input type="hidden" name="oldfile" id="oldfile" value="{$Expensealldata->file}"/>
                            </div>
                        </div>
                        <!--==============================-->

                        <div class="form-group">
                            <div class="col-lg-offset-2 col-lg-4">
                                <button type="submit" class="btn btn-primary pull-left">{$smarty.const.EDIT}</button>
                            </div>
                        </div>
                    </form>
            </div>
        </div>
    </div>
</div>
{literal}
<script type="text/javascript">
    var name = new Spry.Widget.ValidationTextField("name", "currency");
</script>
<script type="text/javascript">
    var spryselect3 = '';
    var spryselect4 = '';
    var spryselect5 = '';
    var sprytextfield3 = '';

    $(".PMethod").live('change', function () {
        var whatis = $(".PMethod:checked").first().val();
        if (whatis == 0) {
            $('#save-div').show();
            $('#bank-div').hide();
            try {
                spryselect3 = new Spry.Widget.ValidationSelect("spryselect3", {invalidValue: "-1", isRequired: false});
                spryselect4.destroy();
                spryselect5.destroy();
                sprytextfield3.destroy();
            } catch (exception) {

            }
        } else if (whatis == 1) {
            $('#save-div').hide();
            $('#bank-div').show();
            try {
                spryselect3.destroy();
                spryselect4 = new Spry.Widget.ValidationSelect("spryselect4", {invalidValue: "-1", isRequired: false});
                spryselect5 = new Spry.Widget.ValidationSelect("spryselect5");
                sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3");
            } catch (exception) {

            }

        }

    });
    $(".PMethod:checked").first().change();
    $("#bankid").live('change', function () {
        var id = $(this).val();
        $.post("projectControllerAjax.php?do=getbankaccount", {id: id}, function (data) {
            $("#bankaccountid").html(data);
        });
    });


</script>
<script type="text/javascript">

    $(document).ready(function () {
        var formatResult;
        formatResult = function (data) {
            return  data.text;
        }


        $("#expensetype").select2({
            placeholder: "إسم  المشروع",
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "expensesControllerajex.php?do=expensetypesave",
                type: "post",
                dataType: 'json',
                data: function (term, page) {
                    var saveid = Number($('#saveid').val());
                    if (!saveid) {
                        alert('يجب اختيار الخزنه اولا');
                        return false;
                    }
                    return {
                        searchTerm: term,
                        saveid: saveid,
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });
        $('#expensetype').select2('data', {id: $('#expensetypeid').val(), text: $('#expensetypetext').val()});



        $("#select2realestates").select2({
            placeholder: "العقار",
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "realestateunits.php?do=select2realestates",
                type: "post",
                dataType: 'json',
                data: function (term, page) {
                    $('#select2realestatesunits').val("").trigger("change");
                    return {
                        searchTerm: term,
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });

        $('#select2realestates').select2('data', {id: $('#realestateid').val(), text: $('#realestatetext').val()});

        $("#select2realestatesunits").select2({
            placeholder: "الوحده",
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "realestateunits.php?do=select2realestatesunits",
                type: "post",
                dataType: 'json',
                data: function (term, page) {
                    var select2realestates = Number($('#select2realestates').val());
                    if (!select2realestates) {
                        alert('يجب اختيار العقار اولا');
                        return false;
                    }
                    return {
                        searchTerm: term,
                        realestateid: select2realestates,
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });


        $('#select2realestatesunits').select2('data', {id: $('#realestateunitid').val(), text: $('#realestateunittext').val()});

        $("#select2client").select2({
            placeholder: "إسم  المشروع",
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "tasksController.php?do=select2client",
                type: "post",
                dataType: 'json',
                data: function (term, page) {
                    return {
                        searchTerm: term,
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });

        $('#select2client').select2('data', {id: $('#clientid').val(), text: $('#clienttext').val()});

        $("#select2sellbill").select2({
            placeholder: "إسم  المشروع",
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "executors.php?do=select2sellbill",
                type: "post",
                dataType: 'json',
                data: function (term, page) {
                    var select2client = Number($('#select2client').val());
                    if (!select2client) {
                        alert('يجب اختيار العميل اولا');
                        return false;
                    }
                    return {
                        searchTerm: term,
                        clientid: select2client,
                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });
        $('#select2sellbill').select2('data', {id: $('#executorssellid').val(), text: $('#selltext').val()});


        $("#expenseprice,#expensenumbrt").live('change', function () {
            var expensenumbrt = $('#expensenumbrt').val();
            var expenseprice = $('#expenseprice').val();
            $('#expensetotaln').val(expensenumbrt * expenseprice);
        });

        $('body').on('change', '#select2realestates', function () {
            var id = $(this).val();
            var thisinput = $(this);
            $.post('realestateunits.php?do=getexpenstype', {id: id}, function (result) {
                if (result) {
                    $('#expensetype').val(result.trim()).trigger('change');
                }
            });

        });

        $(".positiveNo").forcepositiveNum();
        var formatResult;
        formatResult = function (data) {

            return  data.text;
        }
        $("#productid").select2({
            placeholder: "إسم المنتج",
            width: '100%',
            minimumInputLength: document.getElementById("searchvalue").value,
            multiple: false,
            quietMillis: 100,
            ajax: {
                url: "sellbillAjaxController.php?do=getProductsexpenses",
                dataType: 'json',
                data: function (term, page) {
                    return {
                        term: term, //search term
                        page_limit: 10,

                    };
                },
                results: function (data) {
                    return {results: data};
                }
            },
            formatResult: formatResult,
            initSelection: function (element, callback) {
                var item = element.val().split(':');
                var data = {id: item[0], text: item[1]};
                callback(data);
            }
        });


        getCkeditor();

        function getCkeditor() {
            $("#productid").select2("data", {id: $('#oldid').val(), text: $('#oldname').val()});

        }


    });
</script>
{/literal}