Created
April 15, 2014 08:46
-
-
Save mizanRahman/10714744 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('relitagApp') | |
.controller('AssetInventoryCtrl', ['$scope', 'assetInventory', 'Grid', | |
function($scope, assetInventory, Grid) { | |
assetInventory.query({ | |
from: 1, | |
to: 50 | |
}, | |
function(assets) { | |
$scope.myData = assets; | |
}); | |
$scope.gridOptions = Grid.options(); | |
$scope.gridOptions.columnDefs = assetInventory.getColumnDefs(); | |
$scope.gridOptions.callbacks={ | |
onTotalScroll: function(){ | |
alert("ok"); | |
} | |
}; | |
$scope.viewModes = ["show all", "tagged items"]; | |
$scope.selectedViewMode = $scope.viewModes[0]; | |
$scope.select2Options = { | |
minimumResultsForSearch: -1 | |
}; | |
// $scope.changeGrid = function(item){ | |
// Grid.shuffleArray(assetInventory.getAssets(function(assets){ | |
// $scope.myData = assets; | |
// })); | |
// }; | |
} | |
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('relitagApp') | |
.constant('API_ENDPOINTS',{ | |
login_url : "192.168.1.33:9001/api/users/login", | |
nodeserverapi : "http://localhost:3500/api/assets", | |
url : "http://192.168.1.33:9000/api/assets/getAll", | |
url118 : "http://192.168.1.118:9004/api/assets/getAll", | |
dummyurl : "data/assets.json", | |
dummyassetsurl : "data/server_assets.json" | |
}) | |
.factory('assetInventory', function($resource, API_ENDPOINTS) { | |
var assetInventory = $resource(API_ENDPOINTS.dummyassetsurl, { | |
from: 1, | |
to: 10 | |
},{ | |
//creating a custom method | |
'update': { method:'PUT' } | |
}); | |
assetInventory.getColumnDefs = function(){ | |
return [{ | |
field: 'description', | |
groupable: false, | |
cellClass: 'blue-text', | |
displayName: 'Asset Desc.', | |
cellTemplate: '<div class="ngCellText" ng-class="col.colIndex()"><span ng-cell-text>{{row.getProperty(col.field)}}</span></div>' | |
}, { | |
field: 'id', | |
groupable: false, | |
displayName: 'Asset ID #' | |
}, { | |
field: 'dateOfPurchase', | |
groupable: false, | |
displayName: 'PO Date', | |
cellFilter: 'date' | |
},{ | |
field: 'assetStatus.status', | |
groupable: false, | |
displayName: 'Status' | |
},{ | |
field: 'tag.tagId', | |
groupable: false, | |
cellClass: 'blue-text', | |
displayName: 'Tag #' | |
},{ | |
field: 'project.grants[0].grantId', | |
groupable: false, | |
displayName: 'Grunt #' | |
}, { | |
field: 'sla_expiry', | |
groupable: false, | |
displayName: 'SLA Expiry' | |
}, { | |
field: 'sla', | |
groupable: false, | |
cellClass: 'blue-text underlined', | |
displayName: 'SLA Doc', | |
cellTemplate: '<div class="ngCellText" ng-class="col.colIndex()"><span ng-cell-text> <a ng-href="{{row.entity[col.field].slaLink}}" target="_blank">{{row.entity[col.field].flieName}}</a></span></div>' | |
},{ | |
field: 'project.piUnitSite.unitSite.unit.groupUnits[0].group.name', | |
groupable: false, | |
displayName: 'Group', | |
visible: false | |
}, { | |
field: 'project.piUnitSite.unitSite.unit.name', | |
groupable: false, | |
displayName: 'Unit', | |
visible: false | |
}, { | |
field: 'cost', | |
groupable: false, | |
displayName: 'Asset Cost', | |
visible: false | |
}, { | |
field: 'model', | |
groupable: false, | |
displayName: 'Model', | |
visible: false | |
}, { | |
field: 'project.piUnitSite.piId', | |
groupable: false, | |
displayName: 'PI', | |
visible: false | |
}, { | |
field: 'descriptor', | |
groupable: false, | |
displayName: 'descriptor', | |
visible: false | |
}, { | |
field: 'tag.location.campus', | |
groupable: false, | |
displayName: 'Location', | |
visible: false | |
}, { | |
field: 'vendor.name', | |
groupable: false, | |
displayName: 'Manufacturar', | |
visible: false | |
}, { | |
field: 'sla.serviceProvider.name', | |
groupable: false, | |
displayName: 'Service Provider', | |
visible: false | |
}]; | |
}; | |
return assetInventory; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment