Adjusted inventory suppliers screens to match the other screens.

Sat, 26 Jan 2019 11:59:15 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 26 Jan 2019 11:59:15 +0100
changeset 208
578c78abf058
parent 207
f87ff15be531
child 209
dc30801e6961

Adjusted inventory suppliers screens to match the other screens.

www/inv_suppliers.php file | annotate | diff | comparison | revisions
www/js/inv_suppliers.js file | annotate | diff | comparison | revisions
--- a/www/inv_suppliers.php	Sat Jan 26 11:34:04 2019 +0100
+++ b/www/inv_suppliers.php	Sat Jan 26 11:59:15 2019 +0100
@@ -13,7 +13,7 @@
    <div id="popupWindow">
     <div>Wijzig leverancier.</div>
     <div style="overflow: hidden;">
-     <table class="popupTable">
+     <table style="width: 100%;">
       <tr>
        <td align="right" style="vertical-align: top; padding: 3px;">Leverancier naam:</td>
        <td colspan="3" style="vertical-align: top; padding: 3px;"><input id="name" /></td>
@@ -49,12 +49,12 @@
        <td align="left" colspan="3" style=" padding: 3px;"><textarea id="notes"></textarea></td>
       </tr>
       <tr>
-       <td style="padding-top: 10px;" align="right"><input type="button" id="Delete" value="Delete" /></td>
+       <td style="padding-top: 110px;" align="right"><input type="button" id="Delete" value="Verwijder" /></td>
        <td align="right"></td>
        <td align="right"></td>
-       <td style="padding-top: 10px;" align="right">
-        <input style="margin-right: 5px;" type="button" id="Save" value="Save" />
-        <input id="Cancel" type="button" value="Cancel" />
+       <td style="padding-top: 110px;" align="left">
+        <input style="margin-right: 5px;" type="button" id="Save" value="Sla op" />
+        <input id="Cancel" type="button" value="Annuleer" />
        </td>
       </tr>
      </table>
--- 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 <mbroek at mbse dot eu>
  *
@@ -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 = $("<div style='float: right; margin-right: 15px;'><img style='position: relative; margin-top: 2px;' src='images/add.png'/><span style='margin-left: 4px; position: relative; top: -3px;'>Nieuw</span></div>");
 			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();
 });

mercurial