////// function MainCtrl() { /** * daterange - Used as initial model for data range picker in Advanced form view */ this.daterange = { startDate: null, endDate: null } /** * slideInterval - Interval for bootstrap Carousel, in milliseconds: */ this.slideInterval = 5000; /** * states - Data used in Advanced Form view for Chosen plugin */ this.states = [ 'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming' ]; /** * check's - Few variables for checkbox input used in iCheck plugin. Only for demo purpose */ this.checkOne = true; this.checkTwo = true; this.checkThree = true; this.checkFour = true; /** * knobs - Few variables for knob plugin used in Advanced Plugins view */ this.knobOne = 75; this.knobTwo = 25; this.knobThree = 50; /** * Variables used for Ui Elements view */ this.bigTotalItems = 175; this.bigCurrentPage = 1; this.maxSize = 5; this.singleModel = 1; this.radioModel = 'Middle'; this.checkModel = { left: false, middle: true, right: false }; /** * groups - used for Collapse panels in Tabs and Panels view */ this.groups = [{ title: 'Dynamic Group Header - 1', content: 'Dynamic Group Body - 1' }, { title: 'Dynamic Group Header - 2', content: 'Dynamic Group Body - 2' } ]; /** * alerts - used for dynamic alerts in Notifications and Tooltips view */ this.alerts = [ { type: 'danger', msg: 'Oh snap! Change a few things up and try submitting again.' }, { type: 'success', msg: 'Well done! You successfully read this important alert message.' }, { type: 'info', msg: 'OK, You are done a great job man.' } ]; /** * addAlert, closeAlert - used to manage alerts in Notifications and Tooltips view */ this.addAlert = function() { this.alerts.push({ msg: 'Another alert!' }); }; this.closeAlert = function(index) { this.alerts.splice(index, 1); }; /** * randomStacked - used for progress bar (stacked type) in Badges adn Labels view */ this.randomStacked = function() { this.stacked = []; var types = ['success', 'info', 'warning', 'danger']; for (var i = 0, n = Math.floor((Math.random() * 4) + 1); i < n; i++) { var index = Math.floor((Math.random() * 4)); this.stacked.push({ value: Math.floor((Math.random() * 30) + 1), type: types[index] }); } }; /** * initial run for random stacked value */ this.randomStacked(); /** * summernoteText - used for Summernote plugin */ this.summernoteText = ['

Hello Jonathan!

', '

dummy text of the printing and typesetting industry. Lorem Ipsum has been the dustrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more', 'recently with

' ].join(''); /** * General variables for Peity Charts * used in many view so this is in Main controller */ }; /** * dashboardFlotOne - simple controller for data * for Flot chart in Dashboard view */ function dashboardFlotOne() { var data1 = [ [0, 4], [1, 8], [2, 5], [3, 10], [4, 4], [5, 16], [6, 5], [7, 11], [8, 6], [9, 11], [10, 30], [11, 10], [12, 13], [13, 4], [14, 3], [15, 3], [16, 6] ]; var data2 = [ [0, 1], [1, 0], [2, 2], [3, 0], [4, 1], [5, 3], [6, 1], [7, 5], [8, 2], [9, 3], [10, 2], [11, 1], [12, 0], [13, 2], [14, 8], [15, 0], [16, 0] ]; var options = { series: { lines: { show: false, fill: true }, splines: { show: true, tension: 0.4, lineWidth: 1, fill: 0.4 }, points: { radius: 0, show: true }, shadowSize: 2, grow: { stepMode: "linear", stepDirection: "up", steps: 80 } }, grow: { stepMode: "linear", stepDirection: "up", steps: 80 }, grid: { hoverable: true, clickable: true, tickColor: "#d5d5d5", borderWidth: 1, color: '#d5d5d5' }, colors: ["#1ab394", "#1C84C6"], xaxis: {}, yaxis: { ticks: 4 }, tooltip: false }; /** * Definition of variables * Flot chart */ this.flotData = [data1, data2]; this.flotOptions = options; } /** * sparklineChartCtrl - Controller for data for all Sparkline chart * used in Sparkline chart view */ function sparklineChartCtrl() { /** * Inline chart */ var inlineData = [34, 43, 43, 35, 44, 32, 44, 52, 25]; var inlineOptions = { type: 'line', lineColor: '#17997f', fillColor: '#1ab394' }; /** * Bar chart */ var barSmallData = [5, 6, 7, 2, 0, -4, -2, 4]; var barSmallOptions = { type: 'bar', barColor: '#1ab394', negBarColor: '#c6c6c6' }; /** * Pie chart */ var smallPieData = [1, 1, 2]; var smallPieOptions = { type: 'pie', sliceColors: ['#1ab394', '#b3b3b3', '#e4f0fb'] }; /** * Long line chart */ var longLineData = [34, 43, 43, 35, 44, 32, 15, 22, 46, 33, 86, 54, 73, 53, 12, 53, 23, 65, 23, 63, 53, 42, 34, 56, 76, 15, 54, 23, 44]; var longLineOptions = { type: 'line', lineColor: '#17997f', fillColor: '#ffffff' }; /** * Tristate chart */ var tristateData = [1, 1, 0, 1, -1, -1, 1, -1, 0, 0, 1, 1]; var tristateOptions = { type: 'tristate', posBarColor: '#1ab394', negBarColor: '#bfbfbf' }; /** * Discrate chart */ var discreteData = [4, 6, 7, 7, 4, 3, 2, 1, 4, 4, 5, 6, 3, 4, 5, 8, 7, 6, 9, 3, 2, 4, 1, 5, 6, 4, 3, 7, ]; var discreteOptions = { type: 'discrete', lineColor: '#1ab394' }; /** * Pie chart */ var pieCustomData = [52, 12, 44]; var pieCustomOptions = { type: 'pie', height: '150px', sliceColors: ['#1ab394', '#b3b3b3', '#e4f0fb'] }; /** * Bar chart */ var barCustomData = [5, 6, 7, 2, 0, 4, 2, 4, 5, 7, 2, 4, 12, 14, 4, 2, 14, 12, 7]; var barCustomOptions = { type: 'bar', barWidth: 8, height: '150px', barColor: '#1ab394', negBarColor: '#c6c6c6' }; /** * Line chart */ var lineCustomData = [34, 43, 43, 35, 44, 32, 15, 22, 46, 33, 86, 54, 73, 53, 12, 53, 23, 65, 23, 63, 53, 42, 34, 56, 76, 15, 54, 23, 44]; var lineCustomOptions = { type: 'line', lineWidth: 1, height: '150px', lineColor: '#17997f', fillColor: '#ffffff' }; /** * Definition of variables * Flot chart */ this.inlineData = inlineData; this.inlineOptions = inlineOptions; this.barSmallData = barSmallData; this.barSmallOptions = barSmallOptions; this.pieSmallData = smallPieData; this.pieSmallOptions = smallPieOptions; this.discreteData = discreteData; this.discreteOptions = discreteOptions; this.longLineData = longLineData; this.longLineOptions = longLineOptions; this.tristateData = tristateData; this.tristateOptions = tristateOptions; this.pieCustomData = pieCustomData; this.pieCustomOptions = pieCustomOptions; this.barCustomData = barCustomData; this.barCustomOptions = barCustomOptions; this.lineCustomData = lineCustomData; this.lineCustomOptions = lineCustomOptions; } /** * widgetFlotChart - Data for Flot chart * used in Widget view */ function widgetFlotChart() { /** * Flot chart data and options */ var d1 = [ [1262304000000, 6], [1264982400000, 3057], [1267401600000, 20434], [1270080000000, 31982], [1272672000000, 26602], [1275350400000, 27826], [1277942400000, 24302], [1280620800000, 24237], [1283299200000, 21004], [1285891200000, 12144], [1288569600000, 10577], [1291161600000, 10295] ]; var d2 = [ [1262304000000, 5], [1264982400000, 200], [1267401600000, 1605], [1270080000000, 6129], [1272672000000, 11643], [1275350400000, 19055], [1277942400000, 30062], [1280620800000, 39197], [1283299200000, 37000], [1285891200000, 27000], [1288569600000, 21000], [1291161600000, 17000] ]; var flotChartData1 = [ { label: "Data 1", data: d1, color: '#17a084' }, { label: "Data 2", data: d2, color: '#127e68' } ]; var flotChartOptions1 = { xaxis: { tickDecimals: 0 }, series: { lines: { show: true, fill: true, fillColor: { colors: [{ opacity: 1 }, { opacity: 1 }] } }, points: { width: 0.1, show: false } }, grid: { show: false, borderWidth: 0 }, legend: { show: false } }; var flotChartData2 = [ { label: "Data 1", data: d1, color: '#19a0a1' } ]; var flotChartOptions2 = { xaxis: { tickDecimals: 0 }, series: { lines: { show: true, fill: true, fillColor: { colors: [{ opacity: 1 }, { opacity: 1 }] } }, points: { width: 0.1, show: false } }, grid: { show: false, borderWidth: 0 }, legend: { show: false } }; var flotChartData3 = [ { label: "Data 1", data: d1, color: '#fbbe7b' }, { label: "Data 2", data: d2, color: '#f8ac59' } ]; var flotChartOptions3 = { xaxis: { tickDecimals: 0 }, series: { lines: { show: true, fill: true, fillColor: { colors: [{ opacity: 1 }, { opacity: 1 }] } }, points: { width: 0.1, show: false } }, grid: { show: false, borderWidth: 0 }, legend: { show: false } }; /** * Definition of variables * Flot chart */ this.flotChartData1 = flotChartData1; this.flotChartOptions1 = flotChartOptions1; this.flotChartData2 = flotChartData2; this.flotChartOptions2 = flotChartOptions2; this.flotChartData3 = flotChartData3; this.flotChartOptions3 = flotChartOptions3; } /** * loginRegisterCtrl - Controller used to run modal view * used in Basic form view */ function loginRegisterCtrl($scope, $modal, ServiceFactory, $location) { var vm = this; vm.login = {}; vm.StartUpMessages = false; vm.UserProjectListStatus = {}; vm.Messagenotifications = []; vm.login.status = "Login | Register"; vm.loginUser = function() { var modalInstance = $modal.open({ templateUrl: 'views/Login_Register.html', controller: ModalInstanceCtrl, controllerAs: 'vm' }); }; var unbindResults = $scope.$on("LoginResult", handleResultSet); var unbindResults = $scope.$on("Feeds", handleResultSet1); function handleResultSet(event, id) { vm.login.status = ServiceFactory.holdContent.LoginStatus; } function handleResultSet1(event, id) { vm.Feeds = ServiceFactory.holdContent.Feeds; } vm.Read = (function(endpoint) { ServiceFactory.Create(endpoint, ServiceFactory.Header, ServiceFactory.Header).then(function(response) { ServiceFactory.holdContent.Feeds = response; ServiceFactory.Subscription("Feeds"); }); }); if (localStorage.getItem("login") != "undefined") { ServiceFactory.holdContent = JSON.parse(localStorage.getItem("login")); ServiceFactory.Subscription("LoginResult"); if ($location.path() == '/dashboards/dashboard_1') { vm.Read(ServiceFactory.endpoints.Emails); } } } function ModalInstanceCtrl($scope, $modalInstance, ServiceFactory, $log) { var vm = this; vm.login = {}; vm.authenticate = function() { ServiceFactory.Create(ServiceFactory.endpoints.Authenticate, vm.login, null).then(function(response) { $log.log(response); if (response != null) { localStorage.setItem('login', JSON.stringify(response)); ServiceFactory.holdContent = response; ServiceFactory.Subscription("LoginResult"); $modalInstance.close(); } }); }; vm.cancel = function() { $modalInstance.close(); }; vm.Register = function () { alert('here'); ServiceFactory.Create(ServiceFactory.endpoints.Register, vm.login, null).then(function(response) { $log.log(response); if (response != null) { ServiceFactory.put("login", response); $modalInstance.close(); } }); }; }; /** * ionSlider - Controller for data for Ion Slider plugin * used in Advanced plugin view */ function ionSlider() { this.ionSliderOptions1 = { min: 0, max: 5000, type: 'double', prefix: "$", maxPostfix: "+", prettify: false, hasGrid: true }; this.ionSliderOptions2 = { min: 0, max: 10, type: 'single', step: 0.1, postfix: " carats", prettify: false, hasGrid: true }; this.ionSliderOptions3 = { min: -50, max: 50, from: 0, postfix: "°", prettify: false, hasGrid: true }; this.ionSliderOptions4 = { values: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], type: 'single', hasGrid: true }; this.ionSliderOptions5 = { min: 10000, max: 100000, step: 100, postfix: " km", from: 55000, hideMinMax: true, hideFromTo: false }; } /** * wizardCtrl - Controller for wizard functions * used in Wizard view */ function wizardCtrl($scope, $rootScope) { // All data will be store in this object $scope.formData = {}; // After process wizard $scope.processForm = function() { alert('Wizard completed'); }; } /** * CalendarCtrl - Controller for Calendar * Store data events for calendar */ function CalendarCtrl($scope) { var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); // Events $scope.events = [ { title: 'All Day Event', start: new Date(y, m, 1) }, { title: 'Long Event', start: new Date(y, m, d - 5), end: new Date(y, m, d - 2) }, { id: 999, title: 'Repeating Event', start: new Date(y, m, d - 3, 16, 0), allDay: false }, { id: 999, title: 'Repeating Event', start: new Date(y, m, d + 4, 16, 0), allDay: false }, { title: 'Birthday Party', start: new Date(y, m, d + 1, 19, 0), end: new Date(y, m, d + 1, 22, 30), allDay: false }, { title: 'Click for Google', start: new Date(y, m, 28), end: new Date(y, m, 29), url: 'http://google.com/' } ]; /* message on eventClick */ $scope.alertOnEventClick = function(event, allDay, jsEvent, view) { $scope.alertMessage = (event.title + ': Clicked '); }; /* message on Drop */ $scope.alertOnDrop = function(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) { $scope.alertMessage = (event.title + ': Droped to make dayDelta ' + dayDelta); }; /* message on Resize */ $scope.alertOnResize = function(event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view) { $scope.alertMessage = (event.title + ': Resized to make dayDelta ' + minuteDelta); }; /* config object */ $scope.uiConfig = { calendar: { height: 450, editable: true, header: { left: 'prev,next', center: 'title', right: 'month,agendaWeek,agendaDay' }, eventClick: $scope.alertOnEventClick, eventDrop: $scope.alertOnDrop, eventResize: $scope.alertOnResize } }; /* Event sources array */ $scope.eventSources = [$scope.events]; } /** * GoogleMaps - Controller for data google maps */ function GoogleMaps($scope) { $scope.mapOptions = { zoom: 11, center: new google.maps.LatLng(40.6700, -73.9400), // Style for Google Maps styles: [{ "featureType": "water", "stylers": [{ "saturation": 43 }, { "lightness": -11 }, { "hue": "#0088ff" }] }, { "featureType": "road", "elementType": "geometry.fill", "stylers": [{ "hue": "#ff0000" }, { "saturation": -100 }, { "lightness": 99 }] }, { "featureType": "road", "elementType": "geometry.stroke", "stylers": [{ "color": "#808080" }, { "lightness": 54 }] }, { "featureType": "landscape.man_made", "elementType": "geometry.fill", "stylers": [{ "color": "#ece2d9" }] }, { "featureType": "poi.park", "elementType": "geometry.fill", "stylers": [{ "color": "#ccdca1" }] }, { "featureType": "road", "elementType": "labels.text.fill", "stylers": [{ "color": "#767676" }] }, { "featureType": "road", "elementType": "labels.text.stroke", "stylers": [{ "color": "#ffffff" }] }, { "featureType": "poi", "stylers": [{ "visibility": "off" }] }, { "featureType": "landscape.natural", "elementType": "geometry.fill", "stylers": [{ "visibility": "on" }, { "color": "#b8cb93" }] }, { "featureType": "poi.park", "stylers": [{ "visibility": "on" }] }, { "featureType": "poi.sports_complex", "stylers": [{ "visibility": "on" }] }, { "featureType": "poi.medical", "stylers": [{ "visibility": "on" }] }, { "featureType": "poi.business", "stylers": [{ "visibility": "simplified" }] }], mapTypeId: google.maps.MapTypeId.ROADMAP }; $scope.mapOptions2 = { zoom: 11, center: new google.maps.LatLng(40.6700, -73.9400), // Style for Google Maps styles: [{ "featureType": "all", "elementType": "all", "stylers": [{ "invert_lightness": true }, { "saturation": 10 }, { "lightness": 30 }, { "gamma": 0.5 }, { "hue": "#435158" }] }], mapTypeId: google.maps.MapTypeId.ROADMAP }; $scope.mapOptions3 = { center: new google.maps.LatLng(36.964645, -122.01523), zoom: 18, // Style for Google Maps MapTypeId: google.maps.MapTypeId.SATELLITE, styles: [{ "featureType": "road", "elementType": "geometry", "stylers": [{ "visibility": "off" }] }, { "featureType": "poi", "elementType": "geometry", "stylers": [{ "visibility": "off" }] }, { "featureType": "landscape", "elementType": "geometry", "stylers": [{ "color": "#fffffa" }] }, { "featureType": "water", "stylers": [{ "lightness": 50 }] }, { "featureType": "road", "elementType": "labels", "stylers": [{ "visibility": "off" }] }, { "featureType": "transit", "stylers": [{ "visibility": "off" }] }, { "featureType": "administrative", "elementType": "geometry", "stylers": [{ "lightness": 40 }] }], mapTypeId: google.maps.MapTypeId.SATELLITE }; $scope.mapOptions4 = { zoom: 11, center: new google.maps.LatLng(40.6700, -73.9400), // Style for Google Maps styles: [{ "stylers": [{ "hue": "#18a689" }, { "visibility": "on" }, { "invert_lightness": true }, { "saturation": 40 }, { "lightness": 10 }] }], mapTypeId: google.maps.MapTypeId.ROADMAP }; } /** * nestableCtrl - Controller for nestable list */ function nestableCtrl($scope) { $scope.remove = function(scope) { scope.remove(); }; $scope.toggle = function(scope) { scope.toggle(); }; $scope.moveLastToTheBeginning = function() { var a = $scope.data.pop(); $scope.data.splice(0, 0, a); }; $scope.newSubItem = function(scope) { var nodeData = scope.$modelValue; nodeData.nodes.push({ id: nodeData.id * 10 + nodeData.nodes.length, title: nodeData.title + '.' + (nodeData.nodes.length + 1), nodes: [] }); }; $scope.collapseAll = function() { $scope.$broadcast('collapseAll'); }; $scope.expandAll = function() { $scope.$broadcast('expandAll'); }; $scope.data = [{ "id": 1, "title": "node1", "nodes": [{ "id": 11, "title": "node1.1", "nodes": [{ "id": 111, "title": "node1.1.1", "nodes": [] }] }, { "id": 12, "title": "node1.2", "nodes": [] } ] }, { "id": 2, "title": "node2", "nodes": [{ "id": 21, "title": "node2.1", "nodes": [] }, { "id": 22, "title": "node2.2", "nodes": [] } ] }, { "id": 3, "title": "node3", "nodes": [{ "id": 31, "title": "node3.1", "nodes": [] }] }]; } /** * codeEditorCtrl - Controller for code editor - Code Mirror */ function codeEditorCtrl($scope) { $scope.editorOptions = { lineNumbers: true, matchBrackets: true, styleActiveLine: true, theme: "ambiance" }; $scope.editorOptions2 = { lineNumbers: true, matchBrackets: true, styleActiveLine: true }; } /** * ngGridCtrl - Controller for code ngGrid */ function ngGridCtrl($scope) { $scope.ngData = [ { Name: "Moroni", Age: 50, Position: 'PR Menager', Status: 'active', Date: '12.12.2014' }, { Name: "Teancum", Age: 43, Position: 'CEO/CFO', Status: 'deactive', Date: '10.10.2014' }, { Name: "Jacob", Age: 27, Position: 'UI Designer', Status: 'active', Date: '09.11.2013' }, { Name: "Nephi", Age: 29, Position: 'Java programmer', Status: 'deactive', Date: '22.10.2014' }, { Name: "Joseph", Age: 22, Position: 'Marketing manager', Status: 'active', Date: '24.08.2013' }, { Name: "Monica", Age: 43, Position: 'President', Status: 'active', Date: '11.12.2014' }, { Name: "Arnold", Age: 12, Position: 'CEO', Status: 'active', Date: '07.10.2013' }, { Name: "Mark", Age: 54, Position: 'Analyst', Status: 'deactive', Date: '03.03.2014' }, { Name: "Amelia", Age: 33, Position: 'Sales manager', Status: 'deactive', Date: '26.09.2013' }, { Name: "Jesica", Age: 41, Position: 'Ruby programmer', Status: 'active', Date: '22.12.2013' }, { Name: "John", Age: 48, Position: 'Marketing manager', Status: 'deactive', Date: '09.10.2014' }, { Name: "Berg", Age: 19, Position: 'UI/UX Designer', Status: 'active', Date: '12.11.2013' } ]; $scope.ngOptions = { data: 'ngData' }; $scope.ngOptions2 = { data: 'ngData', showGroupPanel: true, jqueryUIDraggable: true }; } /** * notifyCtrl - Controller angular notify */ function notifyCtrl($scope, notify) { $scope.msg = 'Hello! This is a sample message!'; $scope.demo = function() { notify({ message: $scope.msg, classes: $scope.classes, templateUrl: $scope.template }); }; $scope.closeAll = function() { notify.closeAll(); }; $scope.inspiniaTemplate = 'views/common/notify.html'; $scope.inspiniaDemo1 = function() { notify({ message: 'Info - This is a Inspinia info notification', classes: 'alert-info', templateUrl: $scope.inspiniaTemplate }); } $scope.inspiniaDemo2 = function() { notify({ message: 'Success - This is a Inspinia success notification', classes: 'alert-success', templateUrl: $scope.inspiniaTemplate }); } $scope.inspiniaDemo3 = function() { notify({ message: 'Warning - This is a Inspinia warning notification', classes: 'alert-warning', templateUrl: $scope.inspiniaTemplate }); } $scope.inspiniaDemo4 = function() { notify({ message: 'Danger - This is a Inspinia danger notification', classes: 'alert-danger', templateUrl: $scope.inspiniaTemplate }); } } /** * translateCtrl - Controller for translate */ function translateCtrl($translate, $scope) { $scope.changeLanguage = function(langKey) { $translate.use(langKey); $scope.language = langKey; }; } /** * diff - Controller for diff function */ function diff($scope) { $scope.oldText = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only centuries, but also the leap into electronic typesetting.'; $scope.newText = 'Lorem Ipsum is simply typesetting dummy text of the printing and has been the industry\'s typesetting. Lorem Ipsum has been the industry\'s standard dummy text ever the 1500s, when an printer took a galley of type and simply it to make a type. It has survived not only five centuries, but survived not also the leap into electronic typesetting.'; $scope.oldText1 = 'Lorem Ipsum is simply printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text eve'; $scope.newText1 = 'Ting dummy text of the printing and has been the industry\'s typesetting. Lorem Ipsum has been the industry\'s'; } /** * idleTimer - Controller for Idle Timer */ function idleTimer($scope, Idle, notify) { // Custm alter $scope.customAlert = false; // Start watching idle Idle.watch(); // Config notify behavior notify.config({ duration: '5000' }); // function you want to fire when the user goes idle $scope.$on('IdleStart', function() { notify({ message: 'Idle time - You can call any function after idle timeout.', classes: 'alert-warning', templateUrl: 'views/common/notify.html' }); $scope.customAlert = true; }); // function you want to fire when the user becomes active again $scope.$on('IdleEnd', function() { notify({ message: 'You are back, Great that you decided to move a mouse.', classes: 'alert-success', templateUrl: 'views/common/notify.html' }); $scope.customAlert = false; }); } /** * liveFavicon - Controller for live favicon */ function liveFavicon($scope) { $scope.example1 = function() { Tinycon.setBubble(1); Tinycon.setOptions({ background: '#f03d25' }); } $scope.example2 = function() { Tinycon.setBubble(1000); Tinycon.setOptions({ background: '#f03d25' }); } $scope.example3 = function() { Tinycon.setBubble('In'); Tinycon.setOptions({ background: '#f03d25' }); } $scope.example4 = function() { Tinycon.setOptions({ background: '#e0913b' }); Tinycon.setBubble(8); } } /** * formValidation - Controller for validation example */ function formValidation($scope) { $scope.signupForm = function() { if ($scope.signup_form.$valid) { // Submit as normal } else { $scope.signup_form.submitted = true; } } $scope.signupForm2 = function() { if ($scope.signup_form.$valid) { // Submit as normal } } }; /** * agileBoard - Controller for agile Board view */ function agileBoard($scope, ServiceFactory, $timeout, $modal) { var vm = this; vm.visible = false; vm.agile = {}; vm.todoList = []; vm.inProgressList = []; vm.completedList = []; vm.subscriptionName = "ProjectResults"; Refresh(); vm.Add = function() { vm.visible = true; ServiceFactory.Create(ServiceFactory.endpoints.Agile, vm.agile, ServiceFactory.Header).then(function(response) { if (response = "sucess") { Refresh(); } }); } vm.form = function(currentState) { vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl: 'views/create_agileboard.html', windowClass: "animated fadeIn", size: "lg", controller: 'addEditCtrl', controllerAs: 'vm', resolve: { items: function () { return ObjInfo = { EndpointUrl: vm.Status == "Add" ? ServiceFactory.endpoints.Agile : ServiceFactory.endpoints.UpdateAgile, Read: ServiceFactory.endpoints.Agiles, PublisherUrl: vm.subscriptionName, Status: vm.Status, ViewModel: currentState, Header: ServiceFactory.Header } } } }); }; vm.Delete = function(value) { vm.visible = true; ServiceFactory.Create(ServiceFactory.endpoints.DeleteAgile, value, ServiceFactory.Header).then(function(response) { if (response = "Sucess") { Refresh(); } }); } vm.ProjectSnippets = function() { vm.visible = true; ServiceFactory.Create(ServiceFactory.endpoints.ProjectLimits, ServiceFactory.Header, ServiceFactory.Header).then(function(response) { ServiceFactory.holdContent = response; }); } vm.ProjectSnippets(); function Refresh() { vm.visible = true; ServiceFactory.Create(ServiceFactory.endpoints.Agiles, { "entityName": "Agile" }, ServiceFactory.Header).then(function(response) { vm.todoList = response.todoList; vm.inProgressList = response.inProgressList; vm.completedList = response.completedList; vm.visible = false; }); } vm.ProjectSnippets $scope.sortableOptions = { connectWith: ".connectList" }; } /** * draggablePanels - Controller for draggable panels example */ function draggablePanels($scope) { $scope.sortableOptions = { connectWith: ".connectPanels", handler: ".ibox-title" }; } /** * chartistCtrl - Controller for Chartist library */ function chartistCtrl() { this.lineData = { labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'], series: [ [12, 9, 7, 8, 5], [2, 1, 3.5, 7, 3], [1, 3, 4, 5, 6] ] } this.lineOptions = { fullWidth: true, chartPadding: { right: 40 } } var times = function(n) { return Array.apply(null, new Array(n)); }; var prepareData = times(26).map(Math.random).reduce(function(data, rnd, index) { data.labels.push(index + 1); data.series.forEach(function(series) { series.push(Math.random() * 100) }); return data; }, { labels: [], series: times(4).map(function() { return new Array() }) }); this.scatterData = prepareData; this.scatterOptions = { showLine: false, axisX: { labelInterpolationFnc: function(value, index) { return index % 13 === 0 ? 'W' + value : null; } } } this.stackedData = { labels: ['Q1', 'Q2', 'Q3', 'Q4'], series: [ [800000, 1200000, 1400000, 1300000], [200000, 400000, 500000, 300000], [100000, 200000, 400000, 600000] ] } this.stackedOptions = { stackBars: true, axisY: { labelInterpolationFnc: function(value) { return (value / 1000) + 'k'; } } } this.horizontalData = { labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'], series: [ [5, 4, 3, 7, 5, 10, 3], [3, 2, 9, 5, 4, 6, 4] ] } this.horizontalOptions = { seriesBarDistance: 10, reverseData: true, horizontalBars: true, axisY: { offset: 70 } } var prepareData = { series: [5, 3, 4] } this.pieData = prepareData var sum = function(a, b) { return a + b }; this.pieOptions = { labelInterpolationFnc: function(value) { return Math.round(value / prepareData.series.reduce(sum) * 100) + '%'; } } this.gaugeData = { series: [20, 10, 30, 40] } this.gaugeOptions = { donut: true, donutWidth: 60, startAngle: 270, total: 200, showLabel: false } } /** * metricsCtrl - Controller for data for all Sparkline chart * used in Metrics view */ function metricsCtrl() { this.demo1Data = [34, 43, 43, 35, 44, 32, 44, 52]; this.demo1Options = { type: 'line', width: '100%', height: '60', lineColor: '#1ab394', fillColor: "#ffffff" }; this.demo2Data = [24, 43, 43, 55, 44, 62, 44, 72]; this.demo2Options = { type: 'line', width: '100%', height: '60', lineColor: '#1ab394', fillColor: "#ffffff" }; this.demo3Data = [74, 43, 23, 55, 54, 32, 24, 12]; this.demo3Options = { type: 'line', width: '100%', height: '60', lineColor: '#ed5565', fillColor: "#ffffff" }; this.demo4Data = [24, 43, 33, 55, 64, 72, 44, 22]; this.demo4Options = { type: 'line', width: '100%', height: '60', lineColor: '#ed5565', fillColor: "#ffffff" }; this.demo5Data = [1, 4]; this.demo5Options = { type: 'pie', height: '140', sliceColors: ['#1ab394', '#F5F5F5'] }; this.demo6Data = [5, 3]; this.demo6Options = { type: 'pie', height: '140', sliceColors: ['#1ab394', '#F5F5F5'] }; this.demo7Data = [2, 2]; this.demo7Options = { type: 'pie', height: '140', sliceColors: ['#ed5565', '#F5F5F5'] }; this.demo8Data = [2, 3]; this.demo8Options = { type: 'pie', height: '140', sliceColors: ['#ed5565', '#F5F5F5'] }; } function selectCtrl($scope) { $scope.person = {}; $scope.people = [ { name: 'Adam', email: 'adam@email.com', age: 12, country: 'United States' }, { name: 'Amalie', email: 'amalie@email.com', age: 12, country: 'Argentina' }, { name: 'Estefanía', email: 'estefania@email.com', age: 21, country: 'Argentina' }, { name: 'Adrian', email: 'adrian@email.com', age: 21, country: 'Ecuador' }, { name: 'Wladimir', email: 'wladimir@email.com', age: 30, country: 'Ecuador' }, { name: 'Samantha', email: 'samantha@email.com', age: 30, country: 'United States' }, { name: 'Nicole', email: 'nicole@email.com', age: 43, country: 'Colombia' }, { name: 'Natasha', email: 'natasha@email.com', age: 54, country: 'Ecuador' }, { name: 'Michael', email: 'michael@email.com', age: 15, country: 'Colombia' }, { name: 'Nicolás', email: 'nicolas@email.com', age: 43, country: 'Colombia' } ]; $scope.option = {}; $scope.options = [ { number: '1', text: 'Option 1' }, { number: '2', text: 'Option 2' }, { number: '3', text: 'Option 3' }, { number: '4', text: 'Option 4' }, { number: '5', text: 'Option 5' }, { number: '6', text: 'Option 6' } ]; $scope.availableColors = ['Red', 'Green', 'Blue', 'Yellow', 'Magenta', 'Maroon', 'Umbra', 'Turquoise']; $scope.multipleDemo = {}; $scope.multipleDemo.colors = ['Blue', 'Red']; } function loginCtrl($scope, ServiceFactory, $log) { var vm = this; vm.login = {}; vm.authenticate = function() { ServiceFactory.Create(ServiceFactory.endpoints.Login, vm.login).then(function(response) { $log.log(response); vm.authenticate = response; //Store the cookie information for the session se }); }; } function toastrCtrl($scope, toaster) { $scope.demo1 = function() { toaster.success({ body: "Hi, welcome to Inspinia. This is example of Toastr notification box." }); }; $scope.demo2 = function() { toaster.warning({ title: "Title example", body: "This is example of Toastr notification box." }); }; $scope.demo3 = function() { toaster.pop({ type: 'info', title: 'Title example', body: 'This is example of Toastr notification box.', showCloseButton: true }); }; $scope.demo4 = function() { toaster.pop({ type: 'error', title: 'Title example', body: 'This is example of Toastr notification box.', showCloseButton: true, timeout: 600 }); }; } function datatablesCtrl($scope, DTOptionsBuilder) { $scope.dtOptions = DTOptionsBuilder.newOptions() .withDOM('<"html5buttons"B>lTfgitp') .withButtons([ { extend: 'copy' }, { extend: 'csv' }, { extend: 'excel', title: 'ExampleFile' }, { extend: 'pdf', title: 'ExampleFile' }, { extend: 'print', customize: function(win) { $(win.document.body).addClass('white-bg'); $(win.document.body).css('font-size', '10px'); $(win.document.body).find('table') .addClass('compact') .css('font-size', 'inherit'); } } ]); /** * persons - Data used in Tables view for Data Tables plugin */ $scope.persons = [{ id: '1', firstName: 'Monica', lastName: 'Smith' }, { id: '2', firstName: 'Sandra', lastName: 'Jackson' }, { id: '3', firstName: 'John', lastName: 'Underwood' }, { id: '4', firstName: 'Chris', lastName: 'Johnatan' }, { id: '5', firstName: 'Kim', lastName: 'Rosowski' } ]; } function timeLineCtrl($scope, ServiceFactory, $log, $modal) { var vm = this; vm.Results = {}; vm.Timeline = ServiceFactory.holdContent; vm.SubscriberName = "TimelineResults"; var unbindResults = $scope.$on(vm.SubscriberName, handleResultSet); vm.form = function(currentState) { vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl: 'views/create_timeline.html', windowClass: "animated fadeIn", size: "lg", controller: 'addEditCtrl', controllerAs: 'vm', resolve: { items: function() { return ObjInfo = { EndpointUrl: vm.Status == "Add" ? ServiceFactory.endpoints.Timeline : ServiceFactory.endpoints.UpdateTimeline, Read: ServiceFactory.endpoints.Timelines, PublisherUrl: vm.SubscriberName, Status: vm.Status, ViewModel: currentState, Header: ServiceFactory.Header } } } }); }; function handleResultSet(event, id) { vm.Results = ServiceFactory.holdContent; } vm.makeServiceCall = (function(endPoint, serviceObject) { ServiceFactory.Invoke(endPoint, serviceObject, ServiceFactory.Header).then(function(response) { $log.log(response); if (response == "Success") { vm.Read(); vm.cancel(); } return response; }); }); vm.Delete = function(removeIssue) { ServiceFactory.Create(ServiceFactory.endpoints.DeleteTimeline, removeIssue, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); } }); } vm.Read = (function() { ServiceFactory.Create(ServiceFactory.endpoints.Timelines, ServiceFactory.Header, ServiceFactory.Header).then(function(response) { ServiceFactory.holdContent = response; ServiceFactory.Subscription(vm.SubscriberName); return response; }); }); vm.Read(); } function blogCtrl($scope, ServiceFactory, $log, $modal) { var vm = this; vm.loadingDemo = {}; vm.Results = {}; vm.Blog = ServiceFactory.holdContent; vm.SubscriberName = "BlogResults"; var unbindResults = $scope.$on(vm.SubscriberName, handleResultSet); vm.form = function(currentState) { vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl: 'views/create_Blog.html', windowClass: "animated fadeIn", size: "lg", controller: 'addEditCtrl', controllerAs: 'vm', resolve: { items: function() { return ObjInfo = { EndpointUrl: vm.Status == "Add" ? ServiceFactory.endpoints.Blog : ServiceFactory.endpoints.UpdateBlog, Read: ServiceFactory.endpoints.Blogs, PublisherUrl: vm.SubscriberName, Status: vm.Status, ViewModel: currentState, Header: ServiceFactory.Header } } } }); }; function handleResultSet(event, id) { vm.Results = ServiceFactory.holdContent; } vm.makeServiceCall = (function(endPoint, serviceObject) { ServiceFactory.Invoke(endPoint, serviceObject, ServiceFactory.Header).then(function(response) { $log.log(response); if (response == "Success") { vm.Read(); vm.cancel(); } return response; }); }); vm.Delete = function(removeIssue) { ServiceFactory.Create(ServiceFactory.endpoints.DeleteBlog, removeIssue, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); } }); } vm.Read = (function() { ServiceFactory.Create(ServiceFactory.endpoints.Blogs, ServiceFactory.Header, ServiceFactory.Header).then(function(response) { ServiceFactory.holdContent = response; ServiceFactory.Subscription(vm.SubscriberName); return response; }); }); vm.Read(); } function CtrlManageUserAccess($scope, ServiceFactory, $log, $modal, notifierService) { var vm = this; vm.tab = ServiceFactory.SelectedTab; vm.tabStatus = false; vm.Read = (function () { vm.visible = true; ServiceFactory.Create(vm.Action.read, ServiceFactory.Header, ServiceFactory.Header).then(function (response) { ServiceFactory.holdContent = response; ServiceFactory.Subscription(vm.Action.subscription); return response; }); }); vm.Getusers = (function () { vm.visible = true; ServiceFactory.Create(ServiceFactory.endpoints.Users, ServiceFactory.Header, ServiceFactory.Header).then(function (response) { ServiceFactory.HoldUsers = response; return response; }); }); $scope.$watch("vm.tab", function () { if (vm.tab == 1) { ServiceFactory.SelectedTab = vm.tab vm.Action = { button: "Add User", url: "views/create_user.html", create: ServiceFactory.endpoints.Register, read: ServiceFactory.endpoints.Users, update: ServiceFactory.endpoints.UpdateUser, subscription: "UserResults" }; } if (vm.tab == 2) { ServiceFactory.SelectedTab = vm.tab; vm.Action = { button: "Add Subscriber", url: "views/create_subscription.html", create: ServiceFactory.endpoints.Subscription, read: ServiceFactory.endpoints.Subscriptions, update: ServiceFactory.endpoints.UpdateSubscription, subscription: "SubscriptionResults" }; vm.Getusers(); } vm.tabStatus = false; var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.Read(); }); vm.View = function(selectedUser) { ServiceFactory.Create(ServiceFactory.endpoints.GetUsersPermission, selectedUser, ServiceFactory.Header).then(function(response) { if (response.length > 0) { vm.UserDetails = response; vm.tabname = selectedUser.DisplayName; vm.tab = 3; vm.tabStatus = true; } else { notifierService.notify(selectedUser.DisplayName + " does not have an assigned Role"); } }); } vm.openForm = function (currentState) { $log.log(currentState); vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl: vm.Action.url, windowClass: "animated fadeIn", size: "lg", controller: 'addEditCtrl', controllerAs: 'vm', resolve: { items: function() { return ObjInfo = { EndpointUrl: vm.Status == "Add" ? vm.Action.create : vm.Action.update, Read: vm.Action.read, PublisherUrl: vm.Action.subscription, Status: vm.Status, ViewModel: currentState, Header: ServiceFactory.Header } } } }); } function handleResultSet(event, id) { vm.visible = false; vm.Results = ServiceFactory.holdContent; } } function InformationCtrl($scope, ServiceFactory, $log, $modal, notifierService) { var vm = this; vm.tab = ServiceFactory.SelectedTab; vm.tabStatus = false; vm.Read = (function () { vm.visible = true; ServiceFactory.Create(vm.Action.read, ServiceFactory.Header, ServiceFactory.Header).then(function (response) { ServiceFactory.holdContent = response; ServiceFactory.Subscription(vm.Action.subscription); return response; }); }); $scope.$watch("vm.tab", function() { if (vm.tab == 1) { ServiceFactory.SelectedTab = vm.tab vm.Action = { button: "Add User", url: "views/create_user.html", create: ServiceFactory.endpoints.Register, read: ServiceFactory.endpoints.Users, update: ServiceFactory.endpoints.UpdateUser, subscription: "UserResults" }; vm.tabStatus = false; var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.Read(); } }); vm.View = function(selectedUser) { ServiceFactory.Create(ServiceFactory.endpoints.GetUsersPermission, selectedUser, ServiceFactory.Header).then(function(response) { if (response.length > 0) { vm.UserDetails = response; vm.tabname = selectedUser.DisplayName; vm.tab = 2; vm.tabStatus = true; } else { notifierService.notify(selectedUser.DisplayName + " does not have an assigned Role"); } }); } vm.openForm = function(currentState) { vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl: vm.Action.url, windowClass: "animated fadeIn", size: "lg", controller: 'addEditCtrl', controllerAs: 'vm', resolve: { items: function() { return ObjInfo = { EndpointUrl: vm.Status == "Add" ? vm.Action.create : vm.Action.update, Read: vm.Action.read, PublisherUrl: vm.Action.subscription, Status: vm.Status, ViewModel: currentState, Header: ServiceFactory.Header } } } }); } function handleResultSet(event, id) { vm.visible = false; vm.Results = ServiceFactory.holdContent; } } function CtrlRolesPermissions($scope, ServiceFactory, $log, $modal) { var vm = this; vm.tab = ServiceFactory.SelectedTab; vm.Read = (function () { vm.visible = true; ServiceFactory.Create(vm.Action.read, ServiceFactory.Header, ServiceFactory.Header).then(function (response) { vm.visible = false; ServiceFactory.holdContent = response; ServiceFactory.Subscription(vm.Action.subscription); return response; }); }); vm.options = (function() { ServiceFactory.Create(ServiceFactory.endpoints.Permissions, ServiceFactory.Header, ServiceFactory.Header).then(function(response) { ServiceFactory.OptionContent = response; ServiceFactory.Subscription("PermissionOptionResults"); return response; }); }); vm.Getusers = (function () { vm.visible = true; ServiceFactory.Create(ServiceFactory.endpoints.Users, ServiceFactory.Header, ServiceFactory.Header).then(function (response) { ServiceFactory.HoldUsers = response; return response; }); }); $scope.$watch("vm.tab", function() { if (vm.tab == 1) { ServiceFactory.SelectedTab = vm.tab vm.Action = { button: "Add Role", url: "views/create_role.html", create: ServiceFactory.endpoints.Role, read: ServiceFactory.endpoints.Roles, update: ServiceFactory.endpoints.UpdateRole, deleted: ServiceFactory.endpoints.DeleteRole, subscription: "RoleResults", }; var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.Read(); vm.options(); vm.Getusers(); } if (vm.tab == 2) { ServiceFactory.SelectedTab = vm.tab; vm.Action = { button: "Add Permission", url: "views/create_permission.html", create: ServiceFactory.endpoints.Permission, read: ServiceFactory.endpoints.Permissions, update: ServiceFactory.endpoints.UpdatePermission, deleted: ServiceFactory.endpoints.DeletePermission, subscription: "PermissionResults" }; var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.Read(); } }); vm.openForm = function(currentState) { vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl: vm.Action.url, windowClass: "animated fadeIn", size: "lg", controller: 'addEditCtrl', controllerAs: 'vm', resolve: { items: function() { return ObjInfo = { EndpointUrl: vm.Status == "Add" ? vm.Action.create : vm.Action.update, Read: vm.Action.read, PublisherUrl: vm.Action.subscription, Status: vm.Status, ViewModel: currentState, Header: ServiceFactory.Header } } } }); }; function handleResultSet(event, id) { vm.visible = false; vm.Results = ServiceFactory.holdContent; } vm.Delete = function(removeObject) { ServiceFactory.Create(vm.Action.deleted, removeObject, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); } }); } } function clientCtrl($scope, ServiceFactory, $log, $modal, notifierService) { var vm = this; vm.tab = ServiceFactory.SelectedTab; vm.EndPointToUse = {}; $scope.client = 1; vm.response = { "success": false }; if (ServiceFactory.EditContent.Edit != null) { if (ServiceFactory.EditContent.Object = " Contact") { vm.contact = ServiceFactory.EditContent.Edit; vm.EndPointToUse = ServiceFactory.endpoints.UpdateContact; } if (ServiceFactory.EditContent.Object = "Company") { vm.company = ServiceFactory.EditContent.Edit; vm.EndPointToUse = ServiceFactory.endpoints.UpdateCompany; } } $scope.$watch("vm.tab", function() { if (vm.tab == 1) { ServiceFactory.SelectedTab = vm.tab vm.Action = { button: "Add Contact", url: "views/create_contact.html", create: ServiceFactory.endpoints.Contact, read: ServiceFactory.endpoints.Contacts, update: ServiceFactory.endpoints.UpdateContact, deleted: ServiceFactory.endpoints.DeleteContact, subscription: "ContactResults", }; var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.Read(); } if (vm.tab == 2) { ServiceFactory.SelectedTab = vm.tab; vm.Action = { button: "Add Company", url: "views/create_company.html", create: ServiceFactory.endpoints.Company, read: ServiceFactory.endpoints.Companys, update: ServiceFactory.endpoints.UpdateCompany, deleted: ServiceFactory.endpoints.DeleteCompany, subscription: "CompanyResults" }; var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.Read(); } }); function handleResultSet(event, id) { vm.Results = ServiceFactory.holdContent; } vm.statusCheck = function(contact) { if (contact.Status == "Inactive") return "label label-primary"; if (contact.Status == "Active") return "label label-warning"; if (contact.Status == "Waiting") return "label label-info"; if (contact.Status == "Phoned") return "label label-success"; if (contact.Status == "Emailed") return "label label-success"; return ""; } vm.openForm = function(currentState) { vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl:vm.Action.url, windowClass: "animated fadeIn", size: "lg", controller: 'addEditCtrl', controllerAs: 'vm', resolve: { items: function() { return ObjInfo = { EndpointUrl: vm.Status == "Add" ? vm.Action.create : vm.Action.update, Read: vm.Action.read, PublisherUrl: vm.Action.subscription, Status: vm.Status, ViewModel: currentState, Header: ServiceFactory.Header } } } }); }; vm.cancel = function() { ServiceFactory.assignModal.close(); }; vm.makeServiceCall = (function(endPoint, serviceObject) { serviceObject.Session = ServiceFactory.Header.Session; ServiceFactory.Invoke(endPoint, serviceObject, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); vm.cancel(); } return response; }); }); vm.create = function(record) { if (record.Session != null) { vm.update(record); } else { record.Session = ServiceFactory.Header.Session; record.Api_Key = ServiceFactory.Header.Api_Key; ServiceFactory.Create(vm.Action.create, record, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); vm.cancel(); } }); } }; vm.update = function(record) { var response = vm.makeServiceCall(vm.EndPointToUse, record); }; vm.Read = (function() { vm.Results = {}; vm.visible = true ServiceFactory.Create(vm.Action.read, ServiceFactory.Header, ServiceFactory.Header).then(function(response) { vm.visible = false; ServiceFactory.holdContent = response; ServiceFactory.Subscription(vm.Action.subscription); return response; }); }); vm.Delete = function(removecontact) { ServiceFactory.Create(vm.Action.deleted, removecontact, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); } }); } } function contactCtrl($scope, ServiceFactory, $log, $modal) { var vm = this; vm.Results = {}; vm.response = { "success": false }; vm.makeServiceCall = (function(endPoint, serviceObject) { serviceObject.Session = ServiceFactory.Header.Session; ServiceFactory.Invoke(endPoint, serviceObject, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); } return response; }); }); vm.form = function() { ServiceFactory.assignModal = $modal.open({ templateUrl: 'views/create_contact.html', windowClass: "animated fadeIn", size: "lg", controller: contactCtrl, controllerAs: 'vm' }); }; var unbindResults = $scope.$on("contactResults", handleResultSet); function handleResultSet(event, id) { vm.Results = ServiceFactory.holdContent; } vm.cancel = function() { ServiceFactory.assignModal.close(); }; // Create, Read,Update,Delete Operations. vm.create = function() { vm.contact.Session = header.Session; ServiceFactory.Create(ServiceFactory.endpoints.Contact, vm.contact, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); vm.cancel(); } }); }; vm.update = function() { var response = vm.makeServiceCall(ServiceFactory.endpoints.UpdateContact, vm.contact); }; vm.Delete = function(removecontact) { var response = vm.makeServiceCall(ServiceFactory.endpoints.DeleteContact, removecontact); }; vm.Read = (function() { ServiceFactory.Create(ServiceFactory.endpoints.Contacts, ServiceFactory.Header, ServiceFactory.Header).then(function(response) { ServiceFactory.holdContent = response; ServiceFactory.Subscription(ContactResults); return response; }); }); vm.Read(); } function companyCtrl($scope, ServiceFactory, $log, $modal) { var vm = this; vm.Results = {}; vm.response = { "success": false }; vm.makeServiceCall = (function(endPoint, serviceObject) { serviceObject.Session = ServiceFactory.Header.Session; ServiceFactory.Invoke(endPoint, serviceObject, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); } return response; }); }); vm.form = function() { ServiceFactory.assignModal = $modal.open({ templateUrl: 'views/create_company.html', windowClass: "animated fadeIn", size: "lg", controller: companyCtrl, controllerAs: 'vm' }); }; var unbindResults = $scope.$on("companyResults", handleResultSet); function handleResultSet(event, id) { vm.Results = ServiceFactory.holdContent; } vm.cancel = function() { ServiceFactory.assignModal.close(); }; // Create, Read,Update,Delete Operations. vm.create = function() { vm.company.Session = ServiceFactory.Header.Session; ServiceFactory.Create(ServiceFactory.endpoints.company, vm.company, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); vm.cancel(); } }); }; vm.update = function() { var response = vm.makeServiceCall(ServiceFactory.endpoints.Updatecompany, vm.company); }; vm.Delete = function(removecompany) { var response = vm.makeServiceCall(ServiceFactory.endpoints.Deletecompany, removecompany); }; vm.Read = (function() { ServiceFactory.Create(ServiceFactory.endpoints.companys, ServiceFactory.Header, ServiceFactory.Header).then(function(response) { ServiceFactory.holdContent = response; ServiceFactory.Subscription("companyResults"); return response; }); }); vm.Read(); } function pinBoardCtrl($scope, ServiceFactory, $log, $modal) { var vm = this; vm.Results = {}; vm.response = { "success": false }; vm.pinBoardline = {}; vm.makeServiceCall = (function(endPoint, serviceObject) { ServiceFactory.Invoke(endPoint, serviceObject, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); } return response; }); }); vm.form = function() { ServiceFactory.assignModal = $modal.open({ templateUrl: 'views/create_pinboard.html', windowClass: "animated fadeIn", size: "lg", controller: pinBoardCtrl, controllerAs: 'vm' }); }; var unbindResults = $scope.$on("PinBoardResults", handleResultSet); function handleResultSet(event, id) { vm.Results = ServiceFactory.holdContent; } vm.cancel = function() { ServiceFactory.assignModal.close(); }; // Create, Read,Update,Delete Operations. vm.create = function() { vm.pinBoard.Session = ServiceFactory.Header.Session; ServiceFactory.Create(ServiceFactory.endpoints.PinBoard, vm.pinBoard, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); vm.cancel(); } }); }; vm.update = function() { var response = vm.makeServiceCall(ServiceFactory.endpoints.UpdatePinBoard, vm.pinBoard); }; vm.Delete = function(remotePin) { var response = vm.makeServiceCall(ServiceFactory.endpoints.DeletePinBoard, remotePin); }; vm.Read = (function() { ServiceFactory.Create(ServiceFactory.endpoints.PinBoards, ServiceFactory.Header, ServiceFactory.Header).then(function(response) { ServiceFactory.holdContent = response; ServiceFactory.Subscription("PinBoardResults"); return response; }); }); vm.Read(); } function FileManagerCtrl($scope, ServiceFactory, $log) { var vm = this; vm.response = { "success": false }; vm.payload = {"User" : ""}; vm.fileManager = {}; var header = { "Api_Key": localStorage.getItem("login") != null ? localStorage.getItem("login").id : "", "Session": localStorage.getItem("login") != null ? localStorage.getItem("login").sessionToken : "" } vm.Read = (function () { vm.visible = true; ServiceFactory.Create(vm.Action.read, ServiceFactory.Header, ServiceFactory.Header).then(function (response) { ServiceFactory.holdContent = response; ServiceFactory.Subscription(vm.Action.subscription); return response; }); }); vm.create = function () { vm.payload.User = document.getElementById('file').files[0]; var f = vm.payload.User, r = new FileReader(); r.onloadend = function (e) { // $scope.data = e.target.result; vm.payload.User = e.target.result $log.log(vm.payload.User); } r.readAsBinaryString(f); } $scope.$watch("vm.tab", function () { if (vm.tab == 1) { ServiceFactory.SelectedTab = vm.tab vm.Action = { button: "Add Contact", url: "views/create_contact.html", create: ServiceFactory.endpoints.Contact, read: ServiceFactory.endpoints.Contacts, update: ServiceFactory.endpoints.UpdateContact, deleted: ServiceFactory.endpoints.DeleteContact, subscription: "ContactResults", }; var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.Read(); } if (vm.tab == 2) { ServiceFactory.SelectedTab = vm.tab; vm.Action = { button: "Add Company", url: "views/create_company.html", create: ServiceFactory.endpoints.Company, read: ServiceFactory.endpoints.Companys, update: ServiceFactory.endpoints.UpdateCompany, deleted: ServiceFactory.endpoints.DeleteCompany, subscription: "CompanyResults" }; var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.Read(); } }); vm.View = function(selectedUser) { ServiceFactory.Create(ServiceFactory.endpoints.GetUsersPermission, selectedUser, ServiceFactory.Header).then(function(response) { if (response.length > 0) { vm.UserDetails = response; vm.tabname = selectedUser.DisplayName; vm.tab = 3; vm.tabStatus = true; } else { notifierService.notify(selectedUser.DisplayName + " does not have an assigned Role"); } }); } vm.openForm = function (currentState) { $log.log(currentState); vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl: vm.Action.url, windowClass: "animated fadeIn", size: "lg", controller: 'addEditCtrl', controllerAs: 'vm', resolve: { items: function () { return ObjInfo = { EndpointUrl: vm.Status == "Add" ? vm.Action.create : vm.Action.update, Read: vm.Action.read, PublisherUrl: vm.Action.subscription, Status: vm.Status, ViewModel: currentState, Header: ServiceFactory.Header } } } }); } function handleResultSet(event, id) { vm.visible = false; vm.Results = ServiceFactory.holdContent; } } function createEmailCtrl($scope, ServiceFactory, $log, $timeout, $location) { var vm = this; vm.loadingDemo = {}; vm.readloginInfo = localStorage.getItem("login") vm.Email = {}; if (ServiceFactory.UserInfo != null) vm.userResult = ServiceFactory.UserInfo; var unbindResults = $scope.$on("EmailResults", handleResultSet); vm.formatted = function(defaultDate) { return $.datepicker.formatDate("M d, yy", new Date(defaultDate)); } function handleResultSet(event, id) { vm.Results = ServiceFactory.holdContent; } vm.makeServiceCall = (function(endPoint, serviceObject) { ServiceFactory.Invoke(endPoint, serviceObject, ServiceFactory.Header).then(function(response) { $log.log(response); if (response == "Success") { vm.Read(); vm.cancel(); } return response; }); }); vm.MarkRow = function(SelectedRow) { $log.log(SelectedRow); } vm.Create = function() { ServiceFactory.Create(ServiceFactory.endpoints.Email, vm.Email, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); } }); } vm.Delete = function (removeEmail) { ServiceFactory.Create(ServiceFactory.endpoints.DeleteEmail, removeEmail, ServiceFactory.Header).then(function (response) { if (response == "Success") { vm.Read(); } }); } vm.Read = (function() { ServiceFactory.Create(ServiceFactory.endpoints.Emails, vm.readloginInfo, ServiceFactory.Header).then(function(response) { ServiceFactory.holdContent = response; ServiceFactory.Subscription("EmailResults"); return response; }); }); vm.GetAllUsersWithEmail = (function() { ServiceFactory.Create(ServiceFactory.endpoints.Users, ServiceFactory.Header, ServiceFactory.Header).then(function(response) { ServiceFactory.UserInfo = response; }); }); vm.GetAllUsersWithEmail(); if ($location.path() == '/mailbox/inbox') { vm.Read(); } } function EditProjectCtrl($scope, ServiceFactory, $log,$modal) { var vm = this; vm.todoList = []; vm.inProgressList = []; vm.completedList = []; vm.ProjectDetails = ServiceFactory.holdContent; vm.measurePercentCompleted = { 'value': Math.floor((Math.random() * 100) + 1) }; vm.projectAssignedTasks = function () { vm.visible = true; vm.Results = {}; ServiceFactory.Create(ServiceFactory.endpoints.ProjectTasks, vm.ProjectDetails, ServiceFactory.Header).then(function (response) { ServiceFactory.StoreProjectData = response; ServiceFactory.Subscription(vm.Action.subscription); $log.log(vm.Action.subscription); return response; }); } $scope.$watch("vm.tab", function () { if (vm.tab == 1) { ServiceFactory.SelectedTab = vm.tab vm.Action = { button: "", url: "views/create_contact.html", create: ServiceFactory.endpoints.Contact, read: ServiceFactory.endpoints.Contacts, update: ServiceFactory.endpoints.UpdateContact, deleted: ServiceFactory.endpoints.DeleteContact, subscription: "ActivityResults", }; var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.projectAssignedTasks(); } if (vm.tab == 2) { ServiceFactory.SelectedTab = vm.tab; vm.Action = { button: "Add Task", url: "views/create_task.html", create: ServiceFactory.endpoints.Agile, read: ServiceFactory.endpoints.Agiles, update: ServiceFactory.endpoints.UpdateAgiles, deleted: ServiceFactory.endpoints.DeleteAgile, subscription: "TaskResults" }; var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.AgileList(); } }); vm.openForm = function(currentState) { vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl: vm.Action.url, windowClass: "animated fadeIn", size: "lg", controller: 'addEditCtrl', controllerAs: 'vm', resolve: { items: function() { return ObjInfo = { EndpointUrl: vm.Status == "Add" ? vm.Action.create : vm.Action.update, Read: vm.Action.read, PublisherUrl: vm.Action.subscription, Status: vm.Status, ViewModel: currentState == undefined ? {"ProjectId" : vm.ProjectDetails.id} : currentState, Header: ServiceFactory.Header } } } }); } vm.AgileList = function () { vm.visible = true; ServiceFactory.Create(ServiceFactory.endpoints.Agiles, { "entityName": "Agile", "ProjectId": vm.ProjectDetails.id }, ServiceFactory.Header).then(function (response) { ServiceFactory.StoreProjectData = response; ServiceFactory.Subscription(vm.Action.subscription); }); } function handleResultSet(event, id) { vm.visible = false; if (vm.Action.subscription == "TaskResults") { vm.todoList = ServiceFactory.StoreProjectData.todoList; vm.inProgressList = ServiceFactory.StoreProjectData.inProgressList; vm.completedList = ServiceFactory.StoreProjectData.completedList; } else vm.Results = ServiceFactory.StoreProjectData; } $scope.sortableOptions = { connectWith: ".connectList" }; } function createProjectCtrl($scope, ServiceFactory, $log, $modal, $timeout, toaster) { var vm = this; vm.loadingDemo = {}; vm.project = {}; vm.FormTitle = { "Name": "Add Project" }; var type = ['img/a1.jpg', 'img/a2.jpg', 'img/a3.jpg', 'img/a4.jpg', 'img/a5.jpg']; var unbindResults = $scope.$on("ProjectResults", handleResultSet); vm.formatted = function(defaultDate) { return $.datepicker.formatDate("M d, yy", new Date(defaultDate)); } vm.RandomTypes = [ {'image': type[Math.floor((Math.random() * 4))]}, {'image': type[Math.floor((Math.random() * 4))]}, {'image': type[Math.floor((Math.random() * 4))]}, {'image': type[Math.floor((Math.random() * 4))]}, {'image': type[Math.floor((Math.random() * 4))]} ]; vm.measurePercentCompleted = { 'value': Math.floor((Math.random() * 100) + 1)}; vm.form = function (currentState) { vm.Status = currentState == undefined ? "Add" : "Edit"; if (vm.Status == "Edit") { vm.FormTitle = { "Name": "Edit Project" } } else { vm.FormTitle = { "Name": "Add Project" } } var modalInstance = $modal.open({ templateUrl: 'views/create_project.html', windowClass: "animated fadeIn", size: "lg", controller: 'addEditCtrl', controllerAs: 'vm', resolve: { items: function () { return ObjInfo = { EndpointUrl: vm.Status == "Add" ? ServiceFactory.endpoints.Project : ServiceFactory.endpoints.UpdateProject, Read: ServiceFactory.endpoints.Projects, PublisherUrl: "ProjectResults", Status: vm.Status, ViewModel: currentState, Header: ServiceFactory.Header, FormTitle: vm.FormTitle } } } }); }; vm.view = function(selected) { ServiceFactory.holdContent = selected; window.location = '#/app/project_detail'; } function handleResultSet(event, id) { vm.Results = ServiceFactory.holdContent; } vm.makeServiceCall = (function(endPoint, serviceObject) { ServiceFactory.Invoke(endPoint, serviceObject, ServiceFactory.Header).then(function(response) { $log.log(response); if (response == "Success") { vm.Read(); vm.cancel(); } return response; }); }); vm.Delete = function(removeProject) { ServiceFactory.Create(ServiceFactory.endpoints.DeleteProject, removeProject, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); } }); } vm.Read = (function () { vm.visible = true; ServiceFactory.Create(ServiceFactory.endpoints.Projects, ServiceFactory.Header, ServiceFactory.Header).then(function (response) { vm.visible = false; ServiceFactory.holdContent = response; ServiceFactory.Subscription("ProjectResults"); return response; }); }); vm.Read(); } function addEditCtrl($scope, items, $modalInstance, ServiceFactory, $log) { var vm = this; vm.payload = items.ViewModel; vm.Results = ServiceFactory.OptionContent; vm.RegisteredUsers = ServiceFactory.HoldUsers; vm.item = items; vm.AdditonalInfo = []; vm.makeServiceCall = (function (endPoint, serviceObject) { ServiceFactory.Invoke(endPoint, serviceObject, vm.item.Header).then(function (response) { if (response == "Success") { vm.Read(); vm.cancel(); } return response; }); }); vm.ActionRows = function () { var item = { "note": "" }; vm.AdditonalInfo.push(item); } vm.create = function () { if (vm.item.Status == "Edit") vm.update(); if (vm.item.Status == "Add") { if (items.ParentId != null) vm.payload.ParentId = items.ParentId; if (vm.AdditonalInfo.length > 0) vm.payload.AdditonalInfos = vm.AdditonalInfo; vm.payload.Session = vm.item.Header.Session; vm.payload.Api_Key = vm.item.Header.Api_Key; ServiceFactory.Create(vm.item.EndpointUrl, vm.payload, vm.item.Header).then(function (response) { if (response == "Success") { vm.Read(); vm.cancel(); } }); } }; vm.update = function() { var response = vm.makeServiceCall(vm.item.EndpointUrl, vm.payload); }; vm.Read = (function() { ServiceFactory.Create(vm.item.Read, vm.item.Header, vm.item.Header).then(function(response) { ServiceFactory.holdContent = response; ServiceFactory.StoreProjectData = response; ServiceFactory.Subscription(vm.item.PublisherUrl); return response; }); }); vm.cancel = function() { $modalInstance.close(); }; } function issueTrackertCtrl($scope, ServiceFactory, $log, $modal) { var vm = this; vm.loadingDemo = {}; vm.Results = {}; var unbindResults = $scope.$on("IssueTrackerResults", handleResultSet); vm.formatted = function(defaultDate) { return $.datepicker.formatDate("M d, yy", new Date(defaultDate)); } vm.form = function(currentState) { vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl: 'views/create_issue.html', windowClass: "animated fadeIn", size: "lg", controller: 'addEditCtrl', controllerAs: 'vm', resolve: { items: function() { return ObjInfo = { EndpointUrl: vm.Status == "Add" ? ServiceFactory.endpoints.IssueTracker : ServiceFactory.endpoints.UpdateIssueTracker, Read: ServiceFactory.endpoints.IssueTrackers, PublisherUrl: "IssueTrackerResults", Status: vm.Status, ViewModel: currentState, Header: ServiceFactory.Header } } } }); }; function handleResultSet(event, id) { vm.Results = ServiceFactory.holdContent; } vm.makeServiceCall = (function(endPoint, serviceObject) { ServiceFactory.Invoke(endPoint, serviceObject, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); vm.cancel(); } return response; }); }); vm.Delete = function(removeIssue) { ServiceFactory.Create(ServiceFactory.endpoints.DeleteIssueTracker, removeIssue, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); } }); } vm.Read = (function() { ServiceFactory.Create(ServiceFactory.endpoints.IssueTrackers, ServiceFactory.Header, ServiceFactory.Header).then(function(response) { ServiceFactory.holdContent = response; ServiceFactory.Subscription("IssueTrackerResults"); return response; }); }); vm.Read(); } function editInvoiceCtrl($scope, ServiceFactory, $log, $modal, $window) { var vm = this; vm.loadingDemo = {}; vm.Results = {}; vm.Invoice = ServiceFactory.holdContent; vm.SubscriberName = "StatementResults"; var unbindResults = $scope.$on(vm.SubscriberName, handleResultSet); vm.form = function(currentState) { vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl: 'views/create_statement.html', windowClass: "animated fadeIn", size: "lg", controller: 'addEditCtrl', controllerAs: 'vm', resolve: { items: function() { return ObjInfo = { EndpointUrl: vm.Status == "Add" ? ServiceFactory.endpoints.Statement : ServiceFactory.endpoints.UpdateStatement, Read: ServiceFactory.endpoints.Statements, PublisherUrl: vm.SubscriberName, Status: vm.Status, ViewModel: currentState, ParentId: vm.Invoice.id, Header: ServiceFactory.Header } } } }); }; function handleResultSet(event, id) { vm.Results = ServiceFactory.holdContent; Subtotal(vm.Results); } var Subtotal = function(result) { var localResult = 0; for (var i = 0; i < result.length; i++) { localResult = localResult + result[i].Rate * result[i].Hours; } vm.Subtotal = localResult; vm.Total = localResult; }; vm.makeServiceCall = (function(endPoint, serviceObject) { ServiceFactory.Invoke(endPoint, serviceObject, ServiceFactory.Header).then(function(response) { $log.log(response); if (response == "Success") { vm.Read(); vm.cancel(); } return response; }); }); vm.Delete = function(removeIssue) { ServiceFactory.Create(ServiceFactory.endpoints.DeleteStatement, removeIssue, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); } }); } vm.Read = (function() { ServiceFactory.Header.ParentId = vm.Invoice.id; ServiceFactory.Create(ServiceFactory.endpoints.Statements, ServiceFactory.Header, ServiceFactory.Header).then(function(response) { ServiceFactory.holdContent = response; ServiceFactory.Subscription(vm.SubscriberName); // Subtotal(response); return response; }); }); vm.Read(); } function invoiceCtrl($scope, ServiceFactory, $log, $modal, $window) { var vm = this; vm.loadingDemo = {}; vm.Results = {}; vm.statusCheck = function(invoice) { if (invoice.Status == "Added") return "label label-primary"; if (invoice.Status == "Pending") return "label label-warning"; if (invoice.Status == "Paid") return "label label-success"; return ""; } var unbindResults = $scope.$on("InvoiceResults", handleResultSet); vm.formatted = function(defaultDate) { return $.datepicker.formatDate("M d, yy", new Date(defaultDate)); } vm.form = function(currentState) { vm.Status = currentState == undefined ? "Add" : "Edit"; var modalInstance = $modal.open({ templateUrl: 'views/create_invoice.html', windowClass: "animated fadeIn", size: "lg", controller: 'addEditCtrl', controllerAs: 'vm', resolve: { items: function() { return ObjInfo = { EndpointUrl: vm.Status == "Add" ? ServiceFactory.endpoints.Invoice : ServiceFactory.endpoints.UpdateInvoice, Read: ServiceFactory.endpoints.Invoices, PublisherUrl: "InvoiceResults", Status: vm.Status, ViewModel: currentState, Header: ServiceFactory.Header } } } }); }; vm.view = function(selectedInvoice) { $log.log(selectedInvoice); ServiceFactory.holdContent = selectedInvoice; window.location = '#/app/invoice'; } function handleResultSet(event, id) { vm.Results = ServiceFactory.holdContent; } vm.makeServiceCall = (function(endPoint, serviceObject) { ServiceFactory.Invoke(endPoint, serviceObject, ServiceFactory.Header).then(function(response) { $log.log(response); if (response == "Success") { vm.Read(); vm.cancel(); } return response; }); }); vm.Delete = function(removeIssue) { ServiceFactory.Create(ServiceFactory.endpoints.DeleteInvoice, removeIssue, ServiceFactory.Header).then(function(response) { if (response == "Success") { vm.Read(); } }); } vm.Read = (function() { ServiceFactory.Create(ServiceFactory.endpoints.Invoices, ServiceFactory.Header, ServiceFactory.Header).then(function(response) { ServiceFactory.holdContent = response; ServiceFactory.Subscription("InvoiceResults"); return response; }); }); vm.Read(); } function messagesCtrl($scope, $log, $modal, $stateParams, ServiceFactory) { var vm = this; vm.payload = {}; vm.search = {}; vm.Action = { subscription: "messageResults", endpoint: ServiceFactory.endpoints.Message, endpointStore: ServiceFactory.endpoints.Store } var unbindResults = $scope.$on(vm.Action.subscription, handleResultSet); vm.read = (function () { vm.headers = { 'Content-type': 'application/json', 'filename': '0D944292BA4440B5862FA7D52EEFE000' }; vm.search.id = $stateParams.id; vm.payload.ReferenceNo = $stateParams.id; ServiceFactory.SecureConnection(vm.Action.endpoint, vm.payload, vm.headers).then(function (response) { ServiceFactory.StoreData = response; ServiceFactory.Subscription(vm.Action.subscription); return response; }); }); vm.submit = function () { ServiceFactory.SecureConnection(vm.Action.endpoint, vm.message, vm.headers).then(function (response) { if (response.StatusCode == "Success") { ServiceFactory.StoreData = response; ServiceFactory.Subscription(vm.Action.subscription); vm.message = {}; vm.read(); } }); } vm.AddNewDocument = function () { vm.Action = { subscription: "binaryResults" } var f = document.getElementById('file').files[0]; r = new FileReader(); r.onloadend = function (e) { var dataResults = e.target.result; ServiceFactory.UpdateWithApiKey(vm.Action.endpointStore, dataResults, 'POST').then(function (response) { vm.read(); return response; }); } r.readAsBinaryString(f); }; vm.read(); vm.ViewDetails = function (details) { console.log(details); vm.visible = false; vm.Details = details; vm.visible = true; } function handleResultSet(event, id) { vm.results = ServiceFactory.StoreData; } } /** * * Pass all functions into module */ angular .module('parknewlondon') .controller('MainCtrl', MainCtrl) .controller('dashboardFlotOne', dashboardFlotOne) .controller('createProjectCtrl', createProjectCtrl) .controller('sparklineChartCtrl', sparklineChartCtrl) .controller('widgetFlotChart', widgetFlotChart) .controller('loginRegisterCtrl', loginRegisterCtrl) .controller('ionSlider', ionSlider) .controller('wizardCtrl', wizardCtrl) .controller('CalendarCtrl', CalendarCtrl) .controller('GoogleMaps', GoogleMaps) .controller('ngGridCtrl', ngGridCtrl) .controller('codeEditorCtrl', codeEditorCtrl) .controller('nestableCtrl', nestableCtrl) .controller('notifyCtrl', notifyCtrl) .controller('translateCtrl', translateCtrl) .controller('diff', diff) .controller('idleTimer', idleTimer) .controller('liveFavicon', liveFavicon) .controller('formValidation', formValidation) .controller('agileBoard', agileBoard) .controller('draggablePanels', draggablePanels) .controller('chartistCtrl', chartistCtrl) .controller('metricsCtrl', metricsCtrl) .controller('selectCtrl', selectCtrl) .controller('toastrCtrl', toastrCtrl) .controller('datatablesCtrl', datatablesCtrl) .controller('pinBoardCtrl', pinBoardCtrl) .controller('blogCtrl', blogCtrl) .controller('timeLineCtrl', timeLineCtrl) .controller('contactCtrl', contactCtrl) .controller('loginCtrl', loginCtrl) .controller('issueTrackertCtrl', issueTrackertCtrl) .controller('invoiceCtrl', invoiceCtrl) .controller('clientCtrl', clientCtrl) .controller('addEditCtrl', addEditCtrl) .controller('editInvoiceCtrl', editInvoiceCtrl) .controller('createEmailCtrl', createEmailCtrl) .controller('EditProjectCtrl', EditProjectCtrl) .controller('CtrlRolesPermissions', CtrlRolesPermissions) .controller('CtrlManageUserAccess', CtrlManageUserAccess) .controller('FileManagerCtrl', FileManagerCtrl) .controller('messagesCtrl', messagesCtrl)