[add] Loading views
This commit is contained in:
parent
0ec20a4c67
commit
b03d152f11
38
api-payroll/public/html/NewEmployee.php
Normal file
38
api-payroll/public/html/NewEmployee.php
Normal file
@ -0,0 +1,38 @@
|
||||
<script src="../js/NewEmployee.js"></script>
|
||||
|
||||
<form class="form-horizontal" id="newEmployeeForm">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">New employee</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="newEmployeeFirstName">First name</label>
|
||||
<div class="col-md-5">
|
||||
<input id="newEmployeeFirstName" name="newEmployeeFirstName" type="text" class="form-control input-md">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<label class="col-md-4 control-label" for="newEmployeeMiddleName">Middle name</label>
|
||||
<div class="col-md-5">
|
||||
<input id="newEmployeeMiddleName" name="newEmployeeMiddleName" type="number" class="form-control input-md">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="form-group">
|
||||
<a href="#" class="btn btn-lg btn-success" onclick="saveNewEmployee();">Save</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
@ -26,28 +26,28 @@ if(!isset($_SESSION['userName'])){
|
||||
</button>
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navbar-menubuilder">
|
||||
<ul class="nav navbar-nav navbar-left">
|
||||
<ul class="nav navbar-nav navbar-left" id="nevatation-options">
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-user"></span> Employees<span class="caret"></span></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#" data-nav_accion="views/cliente.php" onclick="vista_crear_nuevo_salon_evento();"> New employee</a></li>
|
||||
<li><a href="#" data-nav_accion="views/clientess.php" onclick="vista_crear_nuevo_coach();"> Modify employee</a></li>
|
||||
<li><a href="#" data-nav_accion="NewEmployee.php"> New employee</a></li>
|
||||
<li><a href="#" data-nav_accion="EditEmployee.php"> Modify employee</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<a href="#" onclick="vista_calendario();"><span class="glyphicon glyphicon-tasks"></span> Management</a>
|
||||
<a href="#" onclick="loadView();"><span class="glyphicon glyphicon-tasks"></span> Management</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="#" onclick="vista_calendario();"><span class="glyphicon glyphicon-wrench"></span> Change password</a>
|
||||
<a href="#" onclick="loadView();"><span class="glyphicon glyphicon-wrench"></span> Change password</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>
|
||||
<a href="#" onclick="logout();"><span class="fa fa-fw fa-power-off"></span> Cerrar Sesión</a>
|
||||
<a href="#" onclick="logout();"><span class="fa fa-fw fa-power-off"></span> logout</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
3
api-payroll/public/js/NewEmployee.js
Normal file
3
api-payroll/public/js/NewEmployee.js
Normal file
@ -0,0 +1,3 @@
|
||||
function saveNewEmployee(){
|
||||
console.log('saving...');
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
* back to the login form
|
||||
*/
|
||||
function logout() {
|
||||
var baseUrl = getbaseUrl();
|
||||
let baseUrl = getbaseUrl();
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl + '/api/session/logout',
|
||||
@ -29,3 +29,49 @@ function logout() {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry point for loading elements from the navatation var, this functuion
|
||||
* will filter the junk clicks that have landed in a dropdown menu and pass
|
||||
* only the ones containing an action to the actual view loader
|
||||
*/
|
||||
$('#nevatation-options li a').click(function(){
|
||||
|
||||
let view = $(this).data('nav_accion');
|
||||
|
||||
if (view != "#" && view != undefined) {
|
||||
loadView(view);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Will fetch the html of the desired view and load it into the landing page
|
||||
*
|
||||
* @param requestedView string
|
||||
*/
|
||||
function loadView(requestedView){
|
||||
let baseUrl = getbaseUrl();
|
||||
|
||||
$.ajax({
|
||||
url: baseUrl + '/html/' + requestedView,
|
||||
type: 'get',
|
||||
success:function(data){
|
||||
$("#newViewBody").hide().html(data).show('slow');
|
||||
},
|
||||
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');
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user