41 lines
1.0 KiB

var AddDialog = function (parent) {
this.Parent = parent;
this.Setup = function () {
$("#sure-btn").on("click", this.OnSureButtonClick.bind(this));
$("#cancel-btn").on("click", this.HideDialog.bind(this));
$("#close").on("click", this.HideDialog.bind(this));
};
this.Show = function () {
$('#add-dialog').show();
};
this.OnSureButtonClick = function () {
this.AddOrg();
this.HideDialog();
};
this.AddOrg = function () {
$.ajax({
type: "POST",
dataType: 'text',
url: '/OrgManagement/Add',
data: {
Name: $("#name").textbox('getValue')
},
success: function () {
this.Parent.ReLoadTableData();
}.bind(this)
});
};
this.HideDialog = function () {
$('#add-dialog').hide();
this.clearInput();
};
this.clearInput = function () {
$("#name").textbox('setValue', '');
};
};