diff -r f87ff15be531 -r 578c78abf058 www/js/inv_suppliers.js --- a/www/js/inv_suppliers.js Sat Jan 26 11:34:04 2019 +0100 +++ b/www/js/inv_suppliers.js Sat Jan 26 11:59:15 2019 +0100 @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2014-2018 + * Copyright (C) 2014-2019 * * Michiel Broek * @@ -135,7 +135,7 @@ $("#website").jqxInput({ theme: theme, width: 640, height: 23 }); $("#email").jqxInput({ theme: theme, width: 640, height: 23 }); $("#phone").jqxInput({ theme: theme, width: 175, height: 23 }); - $("#notes").jqxInput({ theme: theme, width: 640, height: 48 }); + $("#notes").jqxInput({ theme: theme, width: 800, height: 100 }); var dataAdapter = new $.jqx.dataAdapter(source); var editrow = -1; @@ -151,16 +151,16 @@ var addButton = $("
Nieuw
"); container.append(addButton); statusbar.append(container); - addButton.jqxButton({ theme: theme, width: 120, height: 20 }); + addButton.jqxButton({ theme: theme, width: 90, height: 20 }); // add new row. addButton.click(function (event) { editrow = -1; - $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); - $("#name").val(''); + $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } }); + $("#name").val('Nieuwe leverancier'); $("#address").val(''); $("#city").val(''); $("#zip").val(''); - $("#country").val(''); + $("#country").val('Nederland'); $("#website").val(''); $("#email").val(''); $("#phone").val(''); @@ -168,20 +168,19 @@ $("#popupWindow").jqxWindow('open'); }); }, - filterable: true, - filtermode: 'excel', + filterable: false, columns: [ { text: 'Leverancier naam', datafield: 'name' }, { text: 'Adres', datafield: 'address', width: 300 }, { text: 'Plaats', datafield: 'city', width: 250 }, { text: 'Land', datafield: 'country', width: 200 }, { text: 'Telefoon', datafield: 'phone', width: 175 }, - { text: 'Wijzig', datafield: 'Edit', width: 120, align: 'center', columntype: 'button', cellsrenderer: function () { + { text: 'Wijzig', datafield: 'Edit', width: 100, align: 'center', columntype: 'button', cellsrenderer: function () { return "Wijzig"; }, buttonclick: function (row) { // open the popup window when the user clicks a button. editrow = row; - $("#popupWindow").jqxWindow({ position: { x: 230, y: 30 } }); + $("#popupWindow").jqxWindow({ position: { x: 110, y: 30 } }); // get the clicked row's data and initialize the input fields. var dataRecord = $("#jqxgrid").jqxGrid('getrowdata', editrow); $("#name").val(dataRecord.name); @@ -201,12 +200,19 @@ }); // initialize the popup window and buttons. $("#popupWindow").jqxWindow({ - width: 860, resizable: false, theme: theme, isModal: true, autoOpen: false, cancelButton: $("#Cancel"), modalOpacity: 0.40 + width: 1050, + height: 550, + resizable: false, + theme: theme, + isModal: true, + autoOpen: false, + cancelButton: $("#Cancel"), + modalOpacity: 0.40 }); $("#popupWindow").on('open', function () { $("#name").jqxInput('selectAll'); }); - $("#Delete").jqxButton({ template: "danger", width: '80px', theme: theme }); + $("#Delete").jqxButton({ template: "danger", width: '90px', theme: theme }); $("#Delete").click(function () { if (editrow >= 0) { // Open a popup to confirm this action. @@ -218,43 +224,33 @@ } $("#popupWindow").jqxWindow('hide'); }); - $("#Cancel").jqxButton({ template: "primary", width: '80px', theme: theme }); - $("#Save").jqxButton({ template: "success", width: '80px', theme: theme }); + $("#Cancel").jqxButton({ template: "primary", width: '90px', theme: theme }); + $("#Save").jqxButton({ template: "success", width: '90px', theme: theme }); // update the edited row when the user clicks the 'Save' button. $("#Save").click(function () { + var rowID = -1; if (editrow >= 0) { - var rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); - var row = { - record: rowID, - name: $("#name").val(), - address: $("#address").val(), - city: $("#city").val(), - zip: $("#zip").val(), - country: $("#country").val(), - website: $("#website").val(), - email: $("#email").val(), - phone: $("#phone").val(), - notes: $("#notes").val() - }; + rowID = $('#jqxgrid').jqxGrid('getrowid', editrow); + } + var row = { + record: rowID, + name: $("#name").val(), + address: $("#address").val(), + city: $("#city").val(), + zip: $("#zip").val(), + country: $("#country").val(), + website: $("#website").val(), + email: $("#email").val(), + phone: $("#phone").val(), + notes: $("#notes").val() + }; + if (editrow >= 0) { $('#jqxgrid').jqxGrid('updaterow', rowID, row); - $("#popupWindow").jqxWindow('hide'); } else { - // Insert a record - var newrow = { - record: -1, - name: $("#name").val(), - address: $("#address").val(), - city: $("#city").val(), - zip: $("#zip").val(), - country: $("#country").val(), - website: $("#website").val(), - email: $("#email").val(), - phone: $("#phone").val(), - notes: $("#notes").val() - }; - $('#jqxgrid').jqxGrid('addrow', null, newrow); - $("#popupWindow").jqxWindow('hide'); + $('#jqxgrid').jqxGrid('addrow', null, row); } + $("#popupWindow").jqxWindow('hide'); + location.reload( true ); // reload ourself. }); createDelElements(); });