<div class="form_wrapper">
    <form method="post">
    <div class="buttons">
        <a href="/admin/delete_money_deposit/{$mod->get_mod_id()}" class="addbutton delete-big">Befizetés törlése</a>
    </div>
        <input type="hidden" name="action" value="money_deposit_update">
        <input type="hidden" name="mod_id" value="{$mod->get_mod_id()}">
        <input type="hidden" name="mi_id" value="{$mod->get_mod_money_income_mi_id()}">
        <input type="hidden" name="mod_user_kid_uk_id" value="{$mod->get_mod_user_kid_uk_id()}">

        <div>
            <label class="desc" id="title1" for="">Befizető:</label>
            <div>
                <select name="" id="" disabled>
                    {foreach $user_kids as $user_kid}
                        <option value="{$user_kid->get_uk_id()}"{if $user_kid->get_uk_id() == $mod->get_mod_user_kid_uk_id()} selected{/if}>{$user_kid->get_uk_name()}</option>>
                    {/foreach}
                </select>
            </div>
        </div>

        {* <div>
            <label class="desc" for="mod_payment_type">Fizetés típusa:</label>
            <div>
                <select name="mod_payment_type" id="mod_payment_type">
                    {foreach $pt_assoc_array as $pt_array}
                        <option value="{$pt_array.pt_id}"{if $pt_array.pt_id == $mod->get_mod_money_income()->get_mi_payment_type_pt_id()} selected{/if}>
                            {$pt_array.pt_name}
                        </option>
                    {/foreach}
                </select>
            </div>
        </div> *}

        <div>
            <label class="desc" id="title1" for="mod_date">Dátum:</label>
            <div><input type="text" name="mod_date" id="mod_date" value="{$mod->get_mod_money_income()->get_mi_date()}" required></div>
        </div>

        <div>
            <label for="mod_lease_l_id">Bérlettípus:</label>
            <div>
                <select name="mod_lease_l_id" id="mod_lease_l_id" disabled>
                    <option value="null">Nincs beállítva</option>
                    {foreach $lease_array as $lease}
                        <option value="{$lease->get_l_id()}" {if $mod->get_mod_lease_l_id() != null && $lease->get_l_id() == $mod->get_mod_lease_l_id()->get_l_id()}selected{/if}>
                            {$lease->get_l_name()}
                        </option>
                    {/foreach}
                </select>
            </div>
        </div>

        <div>
            <label class="desc" id="title1" for="mod_sum">Összeg:</label>
            <div><input type="text" name="mod_sum" id="mod_sum" value="{$mod->get_mod_money_income()->get_mi_sum()}" required></div>
        </div>

        <div>
            <label for="mod_sum">Lejár:</label>
            <div id="expire_date" style="padding-top: 6px;">{$mod->get_mod_expire_date()}</div>
        </div>

        <div>
            <div>
                <input class="button black" type="submit" value="Mentés">
            </div>
        </div>

    </form>
</div>

<script type="text/javascript">
    $('#mod_lease_l_id').on('change', function() {
        var leaseId = $('#mod_lease_l_id option:selected').val();
        $.ajax({
            url: '/_ajax/get_lease_sum.php',
            data: {
                'lease_id' : leaseId
            },
            success: function(data, status, jqXHR) {
                var pdata = JSON.parse(data);

                if (null == pdata) {
                    $('#mod_sum').val('');
                }
                else {
                    $('#mod_sum').val(pdata);
                }
            }
        });
    });
</script>

