var $ = jQuery; $(document).ready(function () { $('#services_search').dataTable(); $('#kontrahent_search').dataTable(); $('select.select2').select2(); $('#addService').click(function (event) { event.preventDefault(); $('#dialogAddService').load("/main/services.ajax.php"); $('#dialogAddService').dialog({ width: 735, height: 180 }); }); }); $(document).ready(function () { $(document).on('click', '.kontrahent_selected', function () { kon_id = $(this).closest('tr').find('input[name=search_id]').val(); $('#select_kon').find('option[value="' + kon_id + '"]').prop('selected', true); $("#dialog_kontrahent_search").dialog("close"); }); }); $(document).ready(function () { $(document).on('click', '.services_selected', function () { search_name = $(this).closest('tr').find('#search_name').html(); search_note = $(this).closest('tr').find('#search_note').html(); search_quantity = $(this).closest('tr').find('#search_quantity').html(); search_unit = $(this).closest('tr').find('#search_unit').html(); search_price = $(this).closest('tr').find('#search_price').html(); search_vat = $(this).closest('tr').find('#search_vat').html(); search_fk = $(this).closest('tr').find('#search_fk').html(); var type = $(this).data('type'); var f5 = ''; //policz ile jest wierszy w tabeli var liczba = $('#tabela tr').length; if (liczba === 2 && $('input[name="fvo_name[1]"]').val() === '') { $('input[name="fvo_name[1]"]').closest('tr').remove(); liczba = 1; } var f1 = ''; var f2 = ''; var f3 = ''; var f4 = ''; if(type != 2){ f5 = ''; } var f6 = ''; if (acc_raks === 7) var f7 = ''; else var f7 = ''; var f8 = '