Commit 0152d951 authored by rammula-nisum-com's avatar rammula-nisum-com Committed by tdutta-nisum-com

changes due to change in Backend MT_78 and MT_82 (#46)

* changes due to change in Backend MT_78 and MT_82

* changes in domain controller

* changes for account disabling

* newDomain file changed
parent 1e85ec4f
......@@ -3,6 +3,7 @@ myApp.controller("domainController",
$scope.records = [];
$scope.empSearchId = "";
$scope.parentData = {};
$scope.isDisabled = false;
$window.addEventListener('click', function(e) {
if (e.target.type !== 'search') {
......@@ -71,7 +72,7 @@ myApp.controller("domainController",
};
$scope.getRowData = function(row, action) {
$scope.parentData.id = row.entity.id;
$scope.parentData.id = row.entity._id;
$scope.parentData.domainId = row.entity.domainId;
$scope.parentData.domainName = row.entity.domainName;
$scope.parentData.account = row.entity.accountName;
......@@ -278,9 +279,9 @@ myApp.controller("domainController",
}
function updatingGridBasedOnStatus(status, response,result) {
if (response == "Saved Succesfully") {
if (response == "Domain saved succesfully") {
updateGrid("Add", result);
} else if (response == "Updated Succesfully") {
} else if (response == "Domain updated successfully") {
updateGrid("Update", result);
} else if (response == "Domain already exists") {
$scope.alertMsg = "Domain already exist,Please enter new matching";
......@@ -288,10 +289,15 @@ myApp.controller("domainController",
}
$scope.addOrUpdateDomain = function(record) {
$scope.addOrUpdateDomain = function(record,action) {
if(action == "Update"){
methodType = "PUT";
}
else if(action == "Add"){
methodType = "POST"
}
$http({
method : "POST",
method : methodType,
url : appConfig.appUri + "/domains",
headers : {
"Content-type" : "application/json"
......@@ -308,11 +314,12 @@ myApp.controller("domainController",
showAlert("Something went wrong while fetching data!!!");
});
}
if (dataToPass.action == "Assign") {
if (dataToPass.action == "Add") {
$scope.domainName = "";
$scope.accountName = "";
$scope.deliveryManagers = "";
} else if (dataToPass.action == "Update") {
$scope.isDisabled = true;
$scope.id = dataToPass.id;
$scope.domainId = dataToPass.domainId;
$scope.domainName = dataToPass.domainName;
......@@ -343,7 +350,7 @@ myApp.controller("domainController",
"accountName" : $scope.account.accountName,
"deliveryManagers" : $scope.deliveryHeads()
};
$scope.addOrUpdateDomain(record);
$scope.addOrUpdateDomain(record,action);
}
}else{
$scope.alertMsg = "";
......@@ -365,10 +372,10 @@ myApp.controller("domainController",
"domainName" : $scope.domainName,
"accountName" : $scope.account.accountName,
"deliveryManagers" : $scope.deliveryHeads(),
"id" : dataToPass.id,
"id" : $scope.id,
"domainId" : dataToPass.domainId
};
$scope.addOrUpdateDomain(record);
$scope.addOrUpdateDomain(record,action);
}
}
......
......@@ -26,10 +26,10 @@
</tr>
<tr>
<td colspan="4"><b>Account</b></td>
<td colspan="8"><md-select ng-model="account"
<td colspan="8"><md-select ng-model="account" ng-disabled= "isDisabled"
md-selected-text="getAccountText()" id="account"> <md-optgroup
label="account"> <md-option ng-value="account1"
ng-repeat="account1 in accounts">{{account1.accountName}}</md-option>
ng-repeat="account1 in accounts" >{{account1.accountName}}</md-option>
</md-optgroup> </md-select></td>
</tr>
<tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment