Updates to the data tracking app; Updated the VAP list.
This commit is contained in:
@@ -4,12 +4,12 @@
|
||||
<!-- Main Page Content -->
|
||||
<h1><span class="fa fa-users"></span> Manage Users</h1>
|
||||
|
||||
<div class="col-sm-6">
|
||||
<div class="col-sm-12">
|
||||
<div class="dt-buttons btn-group">
|
||||
<a id="createButton" class="btn btn-default buttons-create" tabindex="0" href="javaScript:void(0);"><span>New</span></a>
|
||||
<a id="changeLoginButton" class="btn btn-default buttons-selected buttons-edit" style="visibility: hidden; display: none;" tabindex="0" href="javaScript:void(0);"><span>Change Login</span></a>
|
||||
<a id="resetPasswordButton" class="btn btn-default buttons-selected buttons-edit" style="visibility: hidden; display: none;" tabindex="0" href="javaScript:void(0);"><span>Reset Password</span></a>
|
||||
<a id="deleteButton" class="btn btn-default buttons-selected buttons-remove" style="visibility: hidden; display: none;" tabindex="0" href="javaScript:void(0);"><span>Delete</span></a>
|
||||
<a id="changeLoginButton" class="btn btn-default buttons-selected buttons-edit" tabindex="0" href="javaScript:void(0);"><span>Change Login</span></a>
|
||||
<a id="resetPasswordButton" class="btn btn-default buttons-selected buttons-edit" tabindex="0" href="javaScript:void(0);"><span>Reset Password</span></a>
|
||||
<a id="deleteButton" class="btn btn-default buttons-selected buttons-remove" tabindex="0" href="javaScript:void(0);"><span>Delete</span></a>
|
||||
</div>
|
||||
</div>
|
||||
<table id="dataTable" class="table table-striped table-hover">
|
||||
@@ -32,11 +32,11 @@
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label>Login</label>
|
||||
<input name="login" id="DFLogin" type="text" class="form-control" tabindex="0">
|
||||
<input name="login" id="DFLogin" type="text" class="form-control" tabindex="0" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Password</label>
|
||||
<input name="password" id="DFPassword" type="password" class="form-control" tabindex="0">
|
||||
<input name="password" id="DFPassword" type="password" class="form-control" tabindex="0" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
@@ -59,12 +59,12 @@
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label>Password</label>
|
||||
<input name="password" id="DFResetPassword" type="password" class="form-control" tabindex="0">
|
||||
<input name="password" id="DFResetPassword" type="password" class="form-control" tabindex="0" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="DFResetPasswordSave" type="button" class="btn btn-warning btn-md" tabindex="0">Save</button>
|
||||
<button id="DFResetPasswordCancel" type="button" class="btn btn-default" data-dismiss="modal" tabindex="0">Cancel</button>
|
||||
<button id="DFResetPasswordSave" type="button" class="btn btn-default btn-warning btn-md" tabindex="0">Save</button>
|
||||
<button id="DFResetPasswordCancel" type="button" class="btn" data-dismiss="modal" tabindex="0">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -81,12 +81,12 @@
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label>Login</label>
|
||||
<input name="login" id="DFChangeLogin" type="text" class="form-control" tabindex="0">
|
||||
<input name="login" id="DFChangeLogin" type="text" class="form-control" tabindex="0" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="DFChangeLoginSave" type="button" class="btn btn-warning btn-md" tabindex="0">Save</button>
|
||||
<button id="DFChangeLoginCancel" type="button" class="btn btn-default" data-dismiss="modal" tabindex="0">Cancel</button>
|
||||
<button id="DFChangeLoginSave" type="button" class="btn btn-default btn-warning btn-md" tabindex="0">Save</button>
|
||||
<button id="DFChangeLoginCancel" type="button" class="btn" data-dismiss="modal" tabindex="0">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -104,8 +104,8 @@
|
||||
Are you certain you wish to delete the user <span id="deleteUserDialogUserName"></span>?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="DFDeleteSave" type="button" class="btn btn-warning btn-md" tabindex="0">Delete</button>
|
||||
<button id="DFDeleteCancel" type="button" class="btn btn-default" data-dismiss="modal" tabindex="1">Cancel</button>
|
||||
<button id="DFDelete" type="button" class="btn btn-default btn-warning btn-md" tabindex="0">Delete</button>
|
||||
<button id="DFDeleteCancel" type="button" class="btn" data-dismiss="modal" tabindex="1">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -123,50 +123,62 @@
|
||||
var $changeLoginDialog = $page.find('#changeLoginDialog');
|
||||
var $deleteUserDialog = $page.find('#deleteUserDialog');
|
||||
|
||||
var $createUserForm = $createUserDialog.find('form');
|
||||
var $resetPasswordForm = $resetPasswordDialog.find('form');
|
||||
var $changeLoginForm = $changeLoginDialog.find('form');
|
||||
|
||||
$btnChangeLogin.disable(true);
|
||||
$btnDelete.disable(true);
|
||||
$btnResetPassword.disable(true);
|
||||
|
||||
var selectionChanged = function($tr, model) {
|
||||
if($tr && model) {
|
||||
$btnChangeLogin.disable(false);
|
||||
$btnResetPassword.disable(false);
|
||||
$btnDelete.disable(false);
|
||||
}
|
||||
else {
|
||||
$btnChangeLogin.disable(true);
|
||||
$btnResetPassword.disable(true);
|
||||
$btnDelete.disable(true);
|
||||
}
|
||||
};
|
||||
|
||||
var dataTable = new LinkedTable($page.find('#dataTable'), {
|
||||
url: "data/User/readAll",
|
||||
attr: "data-key-name",
|
||||
selection: "row",
|
||||
selectionChanged: function($tr, model) {
|
||||
if($tr && model) {
|
||||
$btnChangeLogin.show();
|
||||
$btnResetPassword.show();
|
||||
$btnDelete.show();
|
||||
}
|
||||
else {
|
||||
$btnChangeLogin.hide();
|
||||
$btnResetPassword.hide();
|
||||
$btnDelete.hide();
|
||||
}
|
||||
},
|
||||
selectionChanged: selectionChanged
|
||||
});
|
||||
|
||||
//Call the refresh user table function once initially.
|
||||
dataTable.refresh();
|
||||
dataTable.build();
|
||||
|
||||
//----------------------------
|
||||
//---- Create User Dialog ----
|
||||
|
||||
//Initialize the validator
|
||||
$createUserForm.validator();
|
||||
|
||||
$btnCreate.on("click", function(event) {
|
||||
$createUserDialog.modal();
|
||||
});
|
||||
$createUserDialog.find("#DFCreateSave").on("click", function(event) {
|
||||
try {
|
||||
$.post("data/User/create", {
|
||||
login: $createUserDialog.find("#loginDialogLogin").val(),
|
||||
password: $createUserDialog.find("#loginDialogPassword").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$createUserForm.data('bs.validator').validate(function(isValid) {
|
||||
if(isValid) {
|
||||
$.ajax({
|
||||
url: "data/User/create", type: "POST", dataType: "json", data: encodeData({
|
||||
login: $createUserDialog.find("#DFLogin").val(),
|
||||
password: $createUserDialog.find("#DFPassword").val()
|
||||
})
|
||||
}).done(function(data) {
|
||||
$createUserDialog.modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
alert(data.result);
|
||||
}
|
||||
}, "json");
|
||||
} catch(e) {
|
||||
alert(e);
|
||||
}
|
||||
}).fail(function(data) {
|
||||
alert("Server call failed.");
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
$createUserDialog.find("#DFCreateSave").on("click", function(event) {
|
||||
$createUserDialog.modal('hide');
|
||||
@@ -175,6 +187,77 @@
|
||||
$createUserDialog.find('#DFLogin').focus();
|
||||
});
|
||||
|
||||
//------------------------------
|
||||
//----- Change Login Dialog ----
|
||||
|
||||
//Initialize the validator
|
||||
$changeLoginForm.validator();
|
||||
|
||||
$btnChangeLogin.on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$changeLoginDialog.find('#changeLoginDialogLogin').val(dataTable.getSelectedRow().data("model").login);
|
||||
$changeLoginDialog.modal();
|
||||
}
|
||||
});
|
||||
$changeLoginDialog.find("#DFChangeLoginSave").on("click", function(event) {
|
||||
$changeLoginForm.data('bs.validator').validate(function(isValid) {
|
||||
if(isValid) {
|
||||
$.ajax({
|
||||
url: "data/User/update", type: "POST", dataType: "json", data: encodeData({
|
||||
id: dataTable.getSelectedRow().data("model").id,
|
||||
login: $changeLoginDialog("#DFChangeLogin").val()
|
||||
})
|
||||
}).done(function(data) {
|
||||
$changeLoginDialog.modal("hide");
|
||||
dataTable.refresh();
|
||||
}).fail(function(data) {
|
||||
alert("Server call failed.");
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
$changeLoginDialog.find("#DFChangeLoginCancel").on("click", function(event) {
|
||||
$changeLoginDialog.modal('hide');
|
||||
});
|
||||
$changeLoginDialog.on('shown.bs.modal', function() {
|
||||
$changeLoginDialog.find('#DFChangeLogin').focus().select();
|
||||
});
|
||||
|
||||
//-------------------------------
|
||||
//---- Reset Password Dialog ----
|
||||
|
||||
//Initialize the validator
|
||||
$resetPasswordForm.validator();
|
||||
|
||||
$btnResetPassword.on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$resetPasswordDialog.modal();
|
||||
}
|
||||
});
|
||||
$resetPasswordDialog.find("#DFResetPasswordSave").on("click", function(event) {
|
||||
$resetPasswordForm.data('bs.validator').validate(function(isValid) {
|
||||
if(isValid) {
|
||||
$.ajax({
|
||||
url: "data/User/update", type: "POST", dataType: "json", data: encodeData({
|
||||
id: dataTable.getSelectedRow().data("model").id,
|
||||
password: $resetPasswordDialog.find("#DFResetPassword").val()
|
||||
})
|
||||
}).done(function(data) {
|
||||
$resetPasswordDialog.modal("hide");
|
||||
dataTable.refresh();
|
||||
}).fail(function(data) {
|
||||
alert("Server call failed.");
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
$resetPasswordDialog.find("#DFResetPasswordCancel").on("click", function(event) {
|
||||
$resetPasswordDialog.modal('hide');
|
||||
});
|
||||
$resetPasswordDialog.on('shown.bs.modal', function() {
|
||||
$resetPasswordDialog.find('#DFResetPassword').focus();
|
||||
});
|
||||
|
||||
//----------------------------
|
||||
//---- Delete User Dialog ----
|
||||
|
||||
@@ -188,17 +271,12 @@
|
||||
}
|
||||
});
|
||||
$deleteUserDialog.find("#DFDelete").on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$.post("data/User/delete", {where: {id: dataTable.getSelectedRow().data("model").id}}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$deleteUserDialog.modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
alert(data.result);
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
$.ajax({url: "data/User/delete", type: "POST", dataType: "json", data: encodeData({where: {id: dataTable.getSelectedRow().data("model").id}})}).done(function(data) {
|
||||
$deleteUserDialog.modal("hide");
|
||||
dataTable.refresh();
|
||||
}).fail(function(data) {
|
||||
alert("Server call failed.");
|
||||
});
|
||||
});
|
||||
$deleteUserDialog.find("#DFDeleteCancel").on("click", function(event) {
|
||||
$deleteUserDialog.modal('hide');
|
||||
@@ -206,69 +284,6 @@
|
||||
$deleteUserDialog.on('shown.bs.modal', function() {
|
||||
$deleteUserDialog.find('#DFDeleteCancel').focus();
|
||||
});
|
||||
|
||||
//------------------------------
|
||||
//----- Change Login Dialog ----
|
||||
|
||||
$btnChangeLogin.on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$changeLoginDialog.find('#changeLoginDialogLogin').val(dataTable.getSelectedRow().data("model").login);
|
||||
$changeLoginDialog.modal();
|
||||
}
|
||||
});
|
||||
$changeLoginDialog.find("#DFChangeLoginSave").on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$.post("data/User/update", {
|
||||
id: dataTable.getSelectedRow().data("model").id,
|
||||
login: $changeLoginDialog("#DFChangeLogin").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$changeLoginDialog.modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
alert(data.result);
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
$changeLoginDialog.find("#DFChangeLoginCancel").on("click", function(event) {
|
||||
$changeLoginDialog.modal('hide');
|
||||
});
|
||||
$changeLoginDialog.on('shown.bs.modal', function() {
|
||||
$changeLoginDialog.find('#DFChangeLogin').focus().select();
|
||||
});
|
||||
|
||||
//-------------------------------
|
||||
//---- Reset Password Dialog ----
|
||||
|
||||
$btnResetPassword.on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$resetPasswordDialog.modal();
|
||||
}
|
||||
});
|
||||
$resetPasswordDialog.find("#DFResetPasswordSave").on("click", function(event) {
|
||||
if(dataTable.getSelectedRow() != null) {
|
||||
$.post("data/User/update", {
|
||||
id: dataTable.getSelectedRow().data("model").id,
|
||||
password: $resetPasswordDialog.find("#DFResetPassword").val()
|
||||
}, function(data) {
|
||||
if(data.result == "success") {
|
||||
$resetPasswordDialog.modal("hide");
|
||||
dataTable.refresh();
|
||||
}
|
||||
else {
|
||||
alert(data.result);
|
||||
}
|
||||
}, "json");
|
||||
}
|
||||
});
|
||||
$resetPasswordDialog.find("#DFResetPasswordCancel").on("click", function(event) {
|
||||
$resetPasswordDialog.modal('hide');
|
||||
});
|
||||
$resetPasswordDialog.on('shown.bs.modal', function() {
|
||||
$resetPasswordDialog.find('#DFResetPassword').focus();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user