Skip to content

Commit

Permalink
MyDnn LiveChat v01.01.00 released!
Browse files Browse the repository at this point in the history
  • Loading branch information
mydnn committed Feb 11, 2016
1 parent e0256b4 commit e4bff90
Show file tree
Hide file tree
Showing 72 changed files with 6,122 additions and 53,497 deletions.
1,126 changes: 563 additions & 563 deletions LiveChat/App_LocalResources/AdminPanel.resx

Large diffs are not rendered by default.

982 changes: 500 additions & 482 deletions LiveChat/App_LocalResources/SharedResources.resx

Large diffs are not rendered by default.

176 changes: 94 additions & 82 deletions LiveChat/ClientApp/Controllers/agent-controller.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
app.controller("agentController", function ($scope, $http, $timeout, $filter, cfpLoadingBar, activeMenu) {
app.controller("agentController", function ($scope, $http, $timeout, $filter, cfpLoadingBar, activeMenu) {
activeMenu.setActiveMenu({ Parent: 'manage', Child: 'agents' });

var timeOut = false;
var $self = {
Headers: {
var $self = {
Headers: {
ModuleId: mydnnSupportLiveChat.ModuleID,
TabId: mydnnSupportLiveChat.TabID,
}
TabId: mydnnSupportLiveChat.TabID,
}
};

$scope.localizeString = mydnnSupportLiveChat.SharedResources;
Expand All @@ -16,42 +16,42 @@
$scope.isSearchReady = false;
$scope.isAgentEdit = false;

$http.get(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/GetAgents", { headers: $self.Headers }).success(function (data) {
$http.get(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/GetAgents", { headers: $self.Headers }).success(function (data) {
$scope.agents = data;
$timeout(function () { $scope.isSearchReady = true; }, 1000);
}).error(function (data, status, headers, config) {
angular.element('#tblagents > tbody').html('<tr><td colspan="7"><div role="alert" class="alert alert-danger">{0}</div></td></tr>'.replace("{0}", data));
$timeout(function () { $scope.isSearchReady = true; }, 1000);
}).error(function (data, status, headers, config) {
angular.element('#tblagents > tbody').html('<tr><td colspan="7"><div role="alert" class="alert alert-danger">{0}</div></td></tr>'.replace("{0}", data));
});

$http.get(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/GetNamesOfDepartments", { headers: $self.Headers }).success(function (data) {
$scope.departments = data;
$http.get(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/GetNamesOfDepartments", { headers: $self.Headers }).success(function (data) {
$scope.departments = data;
});

//page events
$scope.onEditAgentClick = function (agent) {
if (!agent) {
$scope.agent = {
Enabled: true
$scope.onEditAgentClick = function (agent) {
if (!agent) {
$scope.agent = {
Enabled: true
};
$scope.winTitle = $scope.localizeString["AddNewAgent.Text"];
$scope.isAgentEdit = false;
$scope.isAgentEdit = false;
}
else {
else {
$scope.agent = angular.copy(agent);
$scope.winTitle = $scope.localizeString["Edit.Text"] + " " + $scope.agent.DisplayName;
$scope.isAgentEdit = true;
$scope.isAgentEdit = true;
}

$scope.checkValidate = false;
$('#wnEditAgent').modal('show');

setTimeout(function () {
$scope.$broadcast('newItemAdded');
}, 500);
setTimeout(function () {
$scope.$broadcast('newItemAdded');
}, 500);
};

$scope.onDeleteAgentClick = function (agentID, index) {
swal({
$scope.onDeleteAgentClick = function (agentID, index) {
swal({
title: $scope.localizeString["AreYouSure.Text"],
text: $scope.localizeString["DeleteAgentConfirm.Text"],
type: "warning",
Expand All @@ -60,41 +60,47 @@
confirmButtonText: $scope.localizeString["Yes.Text"],
cancelButtonText: $scope.localizeString["No.Text"],
closeOnConfirm: false,
animation: false
}, function () {
var data = {
ID: agentID
animation: false
}, function () {
var data = {
ID: agentID
};
$http.post(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/DeleteAgent", data, { headers: $self.Headers }).success(function (data) {
$http.post(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/DeleteAgent", data, { headers: $self.Headers }).success(function (data) {
$scope.agents.splice(index, 1);
$scope.agent = {};
swal({
swal({
title: $scope.localizeString["Done.Text"],
text: $scope.localizeString["DeleteAgentMsg.Text"],
type: "success",
timer: 3000
});
}).error(function (data, status, headers, config) {
swal({
timer: 3000
});
}).error(function (data, status, headers, config) {
swal({
title: $scope.localizeString["Error.Text"],
text: data,
type: "error",
type: "error",
});
swal($scope.localizeString["Error.Text"], data, "error");
});
});
swal($scope.localizeString["Error.Text"], data, "error");
});
});
};

$scope.onUpdateAgentClick = function () {
$scope.onUpdateAgentClick = function () {
$scope.checkValidate = true;
if ($scope.agentForm.$valid && $scope.agent.UserID) {
if ($scope.agentForm.$valid && $scope.agent.UserID) {
if ($scope.agent.AgentID)
$http.post(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/UpdateAgent", $scope.agent, { headers: $self.Headers }).success(function (data) {
swal({
$http.post(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/UpdateAgent", $scope.agent, { headers: $self.Headers }).success(function (data) {
swal({
title: $scope.localizeString["Done.Text"],
text: $scope.localizeString["UpdateAgentMsg.Text"],
type: "success",
timer: 3000
showCancelButton: true,
confirmButtonColor: "#4E9A36",
confirmButtonText: $scope.localizeString["RefreshPage.Text"],
cancelButtonText: $scope.localizeString["No.Text"],
closeOnConfirm: false,
}, function () {
location.reload();
});

$('#wnEditAgent').modal('hide');
Expand All @@ -103,82 +109,88 @@
var index = $scope.agents.indexOf(agent);
$scope.agents[index] = $scope.agent;

$scope.agent = {};
}).error(function (data, status, headers, config) {
swal({
$scope.agent = {};
}).error(function (data, status, headers, config) {
swal({
title: $scope.localizeString["Error.Text"],
text: data,
type: "error",
});
type: "error",
});
});
else
$http.post(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/AddAgent", $scope.agent, { headers: $self.Headers }).success(function (data) {
swal({
$http.post(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/AddAgent", $scope.agent, { headers: $self.Headers }).success(function (data) {
swal({
title: $scope.localizeString["Done.Text"],
text: $scope.localizeString["AddAgentMsg.Text"],
type: "success",
timer: 3000
showCancelButton: true,
confirmButtonColor: "#4E9A36",
confirmButtonText: $scope.localizeString["RefreshPage.Text"],
cancelButtonText: $scope.localizeString["No.Text"],
closeOnConfirm: false,
}, function () {
location.reload();
});

$('#wnEditAgent').modal('hide');

$scope.agent = data.Agent;
$scope.agents.push($scope.agent);

$scope.agent = {};
}).error(function (data, status, headers, config) {
swal({
$scope.agent = {};
}).error(function (data, status, headers, config) {
swal({
title: $scope.localizeString["Error.Text"],
text: data,
type: "error",
});
type: "error",
});
});

$scope.departmentsFilter = undefined;
}
$scope.departmentsFilter = undefined;
}
};

// autocomplete for displayname
$scope.getUserByDisplayName = function (val) {
return $http.get(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/GetUserByDisplayName", {
$scope.getUserByDisplayName = function (val) {
return $http.get(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/GetUserByDisplayName", {
headers: $self.Headers,
params: {
name: val
}
}).then(function (response) {
return response.data;
params: {
name: val
}
}).then(function (response) {
return response.data;
});

$scope.agent.UserID = 0;
$scope.agent.UserID = 0;
};

$scope.setUserID = function (agent) {
$scope.agent.UserID = agent.UserID;
$scope.setUserID = function (agent) {
$scope.agent.UserID = agent.UserID;
}

//Search functions
$scope.filterModel = '';
$scope.$watch('filterModel', function () {
$scope.$watch('filterModel', function () {
if (timeOut) $timeout.cancel(timeOut)

timeOut = $timeout(function () {
timeOut = $timeout(function () {
if ($scope.isSearchReady)
$http.get(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/SearchAgents", { params: { searchType: 1, filter: $scope.filterModel }, headers: $self.Headers }).success(function (data) {
$scope.agents = data;
});
}, 500)
$http.get(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/SearchAgents", { params: { searchType: 1, filter: $scope.filterModel }, headers: $self.Headers }).success(function (data) {
$scope.agents = data;
});
}, 500)
});

$scope.onClearFilterClick = function () {
$scope.filterModel = "";
$scope.onClearFilterClick = function () {
$scope.filterModel = "";
};

$scope.$watch('departmentsFilter', function () {
if ($scope.departmentsFilter) {
$http.get(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/SearchAgents", { params: { searchType: 2, filter: $scope.departmentsFilter.join(",") }, headers: $self.Headers }).success(function (data) {
$scope.agents = data;
});
}
});
$scope.$watch('departmentsFilter', function () {
if ($scope.departmentsFilter) {
$http.get(mydnnGetServiceRoot("MyDnnSupport.LiveChat") + "AgentService/SearchAgents", { params: { searchType: 2, filter: $scope.departmentsFilter.join(",") }, headers: $self.Headers }).success(function (data) {
$scope.agents = data;
});
}
});
});

Loading

0 comments on commit e4bff90

Please sign in to comment.