-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
58 lines (52 loc) · 1.76 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
var app = angular.module('myApp', []);
app.factory("ClientService", function($http) {
return {
getFilesList: function() {
return $http.get('clientList.json');
},
getFileDetails: function() {
return $http.get('fileList.json');
}
};
});
app.controller('controller', function ($scope, ClientService) {
ClientService.getFilesList().success(function (res) {
$scope.clientList = res;
});
$scope.clientName = "NA";
$scope.expected = "00";
$scope.received = "00";
$scope.failed = "00";
$scope.files = [];
$scope.SelectedclientID = 0;
$scope.showDetails = function (clientID) {
$scope.getSummary(clientID);
$scope.getFilesList(clientID);
$scope.error =[];
$scope.SelectedclientID = clientID;
};
$scope.getSummary = function (clientID) {
ClientService.getFilesList().success(function (client) {
var clientFileDetails = client[clientID - 1];
$scope.expected = clientFileDetails.expected;
$scope.received = clientFileDetails.received;
$scope.failed = clientFileDetails.failed;
});
};
$scope.getFilesList = function (clientID) {
ClientService.getFilesList().success(function (client) {
$scope.files = client[clientID - 1].files;
});
};
$scope.getFileData = function (fName) {
ClientService.getFileDetails().then(function (res) {
$scope.filesList = res.data;
for (i = 0; i < $scope.filesList.length; i++) {
var result = $scope.filesList[i].fileName;
if(fName === result){
$scope.error = $scope.filesList[i].errors;
}
}
});
};
});