demo20230512/Browser_Local/js/Directive/SideBar.js

78 lines
3.5 KiB
JavaScript
Raw Normal View History

2023-05-12 10:20:28 +08:00
/*
Logic Solution
WeeeCarbonFootprint
this directive is resiponsible for get/filter comments and provide isActive function for the view
the Comment.Category is defined in areas/certification/views/LCA/ProductLCADetail.cshtml
used by Normal company and Certificate company
possible value of Category:
LCI_Direct_Material,
LCI_Indirect_Material,
LCI_Wrap_Material,
WorkHour,
PowerUsage,
WaterUsage,
Waste_Water,
Waste_Other,
Transport,
WasteTransport,
Vehicle,
GasolineEquipment,
Kitchen_Company,
Kitchen_Outsourcing,
Kitchen_Other,
Refrigerant,
FireEquipment,
SteamUsage,
OtherCompound
*/
angular.module('View.Directive')
.directive('sideBar', function (CONSTANTS) {
return {
restrict: 'E',
templateUrl: CONSTANTS.TB + 'side_bar',
scope: {},
controller: function ($scope, $filter, $routeParams, LCADetailCacheService) {
LCADetailCacheService.getCommentsAsync($routeParams.LCAID).then(function (data) {
var comments = $scope.comments = data;
$scope.directMaterialCommits = $filter('filter')(comments, { Category: 'LCI_Direct_Material' });
$scope.indirectMaterialCommits = $filter('filter')(comments, { Category: 'LCI_Indirect_Material' });
$scope.wrapMaterialCommits = $filter('filter')(comments, { Category: 'LCI_Wrap_Material' });
$scope.workHourCommits = $filter('filter')(comments, { Category: 'WorkHour' });
$scope.powerUsageCommits = $filter('filter')(comments, { Category: 'PowerUsage' });
$scope.waterUsageCommits = $filter('filter')(comments, { Category: 'WaterUsage' });
$scope.wasteWaterCommits = $filter('filter')(comments, { Category: 'Waste_Water' });
$scope.wasteOtherCommits = $filter('filter')(comments, { Category: 'Waste_Other' });
$scope.transportCommits = $filter('filter')(comments, { Category: 'Transport' });
$scope.wasteTransportCommits = $filter('filter')(comments, { Category: 'WasteTransport' });
$scope.vehicleCommits = $filter('filter')(comments, { Category: 'Vehicle' });
$scope.gasolineEquipmentCommits = $filter('filter')(comments, { Category: 'GasolineEquipment' });
$scope.kitchenCommits = $filter('filter')(comments, { Category: 'Kitchen' });
$scope.refrigerantCommits = $filter('filter')(comments, { Category: 'Refrigerant' });
$scope.fireEquipmentCommits = $filter('filter')(comments, { Category: 'FireEquipment' });
$scope.steamUsageCommits = $filter('filter')(comments, { Category: 'SteamUsage' });
$scope.otherCompoundCommits = $filter('filter')(comments, { Category: 'OtherCompound' });
$scope.usageStageCommits = $filter('filter')(comments, { Category: 'UsageStage' });
$scope.abandonedStageCommits = $filter('filter')(comments, { Category: 'AbandonedStage' });;
$scope.employeeCommutingCommits = $filter('filter')(comments, { Category: 'EmployeeCommuting' });
})
$scope.isActive = function (path) {
if ($routeParams.DetailType == path) return true;
else return false;
}
}
};
})