From 54ef088fe04b51937d82958d0176e13de82bf26d Mon Sep 17 00:00:00 2001 From: Jose Pabl Domingo Aramburo Sanchez Date: Sun, 12 Aug 2018 14:39:47 -0600 Subject: [PATCH] [add] New employee form layout --- api-payroll/public/html/NewEmployee.php | 77 +++++++++++++++++++++---- api-payroll/public/js/NewEmployee.js | 42 ++++++++++++++ api-payroll/public/js/login.js | 4 +- 3 files changed, 110 insertions(+), 13 deletions(-) diff --git a/api-payroll/public/html/NewEmployee.php b/api-payroll/public/html/NewEmployee.php index 209f019..4e7603f 100644 --- a/api-payroll/public/html/NewEmployee.php +++ b/api-payroll/public/html/NewEmployee.php @@ -1,13 +1,14 @@ +
-
-
-
-

New employee

-
-
+
+
+

New employee

+
+
+
@@ -20,17 +21,71 @@
- +
-
-
-
- Save +
+
+ +
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+ Create +
diff --git a/api-payroll/public/js/NewEmployee.js b/api-payroll/public/js/NewEmployee.js index 2a8797a..1ec8e88 100644 --- a/api-payroll/public/js/NewEmployee.js +++ b/api-payroll/public/js/NewEmployee.js @@ -1,3 +1,45 @@ +/** + * Bootstrapping the starting actions for the module + */ +$(document).ready(function(){ + loadEmployeeTypes(); +}); + +/** + * Loads the the enmployee types into their select option + */ +function loadEmployeeTypes(){ + let baseUrl = getbaseUrl(); + + $.ajax({ + url: baseUrl + '/api/employee/types', + type: 'GET', + dataType: 'json', + success:function(data){ + $(data).each(function(i,v){ + $('#employeeType').append( + '' + ); + }); + }, + error:function(x,e) { + if (x.status==0) { + $('#modal_error_internet').modal('show'); + } else if(x.status==404) { + $('#modal_error_404').modal('show'); + } else if(x.status==500) { + $('#modal_error_500').modal('show'); + } else if(e=='parsererror') { + $('#modal_error_parsererror').modal('show'); + } else if(e=='timeout'){ + $('#modal_error_timeout').modal('show'); + } else { + $('#modal_error_otro').modal('show'); + } + }, + }); +} + function saveNewEmployee(){ console.log('saving...'); } \ No newline at end of file diff --git a/api-payroll/public/js/login.js b/api-payroll/public/js/login.js index 384f3d0..fb9b011 100644 --- a/api-payroll/public/js/login.js +++ b/api-payroll/public/js/login.js @@ -16,9 +16,9 @@ $(document).keypress(function(e) { * display errors to the user */ function processLogin() { - var baseUrl = getbaseUrl(); + let baseUrl = getbaseUrl(); - var parameters = { + let parameters = { "userName":$('#userName').val(), "password":$('#password').val() };