File: D:/HostingSpaces/SBogers10/vebon.komma.pro/wwwroot/js/vebon.js.map
{"version":3,"sources":["auditApp.ng.js","main.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1kBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"vebon.js","sourcesContent":["'use strict';\n//inject directives and services.\nvar app = angular.module('auditApp', ['ngFileUpload', 'ngDialog']);\n\n\napp.service('DocumentGroups', function () {\n\n\n return {\n validateMemberSubmit: function () {\n var faults = {}\n\n //For an member audit to be ready to submit, we are going to check:\n //If all the required groups have files\n //If there are no rejected files\n //If a no required group has correct files or is not applicable\n angular.forEach(this.documentGroups, function (documentGroup, id) {\n\n //If there are no files, and there should be\n if (documentGroup.files.length == 0 && documentGroup.applicable && documentGroup.required) {\n //set no_files error\n faults[documentGroup.id] = 'no_files'\n //and stop this run\n return;\n }\n if (documentGroup.files.length == 0 && documentGroup.applicable) {\n //set no_files error\n faults[documentGroup.id] = 'no_files_or_not_applicable'\n //and stop this run\n return;\n }\n\n var fileError = false\n angular.forEach(documentGroup.files, function (file, id) {\n if (file.status == 1) fileError = true;\n })\n\n //If there is one ore more rejected fiels, set these fault\n if (fileError) {\n faults[documentGroup.id] = 'rejected_files'\n }\n })\n\n return faults;\n\n },\n validateAuditorReject: function () {\n var faults = {}\n\n angular.forEach(this.documentGroups, function (documentGroup, id) {\n\n var fileError = false\n angular.forEach(documentGroup.files, function (file, id) {\n if (file.status == 0 && documentGroup.applicable == true) fileError = true;\n })\n\n //If there is one ore more rejected fiels, set these fault\n if (fileError) {\n faults[documentGroup.id] = 'unchecked_files'\n }\n\n })\n return faults;\n },\n validateAuditorSubmit: function () {\n var faults = {}\n\n angular.forEach(this.documentGroups, function (documentGroup, id) {\n\n var fileError = false\n angular.forEach(documentGroup.files, function (file, id) {\n if (file.status != 2 && documentGroup.applicable == true) fileError = true;\n })\n\n //If there is one ore more rejected fiels, set these fault\n if (fileError) {\n faults[documentGroup.id] = 'not_all_files_approved'\n }\n\n })\n return faults;\n },\n //unchecked_or_rejected\n documentGroups: {}\n }\n\n})\n\n\napp.controller('documentGroupController', ['$scope', 'Upload', '$timeout', '$http', 'ngDialog', 'DocumentGroups', function ($scope, Upload, $timeout, $http, ngDialog, DocumentGroups) {\n\n $scope.files = [];\n\n $scope.errorMsg = {};\n\n $scope.path = '/ajax/documentGroup/{documentGroupId}'\n\n $scope.filePath = '/ajax/documentGroup/{documentGroupId}/files'\n\n\n /**------------------------------|\n | |\n | Global functions |\n | |\n |-------------------------------*/\n\n $scope.initialize = function (documentGroup, files) {\n\n //Set the documentGroupId\n $scope.documentGroupId = documentGroup.id;\n $scope.documentGroup = documentGroup;\n //Set the not_applicable as reverse of applicable\n $scope.not_applicable = !documentGroup.applicable\n\n //Add each file to the files array of the current scope\n angular.forEach(files, function (file, key) {\n $scope.files.push(file);\n }\n )\n\n\n //Add the local documentGroup to the global documentGroups\n\n $scope.updateGlobalDocumentGroup(documentGroup, files)\n\n }\n\n $scope.updateGlobalDocumentGroup = function (documentGroup, files, validate) {\n documentGroup.files = $scope.files\n DocumentGroups.documentGroups[documentGroup.id] = documentGroup;\n\n if (validate == 'member') {\n //Validate\n var faults = DocumentGroups.validateMemberSubmit()\n $scope.faults = faults;\n }\n\n }\n\n\n /**------------------------------|\n | |\n | Member functions |\n | |\n |-------------------------------*/\n\n\n /**\n * This function uploads files passed by ngf-select\n * @param files\n * @param errFiles\n * @param maximages\n */\n $scope.uploadFiles = function (files, errFiles, maximages) {\n\n //If files doesn exist, create new array\n if (typeof $scope.files == 'undefined') $scope.files = []\n\n //Set the errors\n $scope.errFiles = errFiles;\n\n //Foreach each file\n angular.forEach(files, function (file) {\n //check if the file exists in the files list\n var existingKey = $scope.getFileKey($scope.files, file);\n\n //If existingKey 0s not null, it is an existing file\n if (existingKey !== null) {\n //Create new ngDialog instance\n var dialog = ngDialog;\n //If the status of the existng file is 2 (approved)\n if ($scope.files[existingKey].status == 2) {\n //Open a dialog to show the file can not be overwritten\n dialog.open({\n //Get the template\n template: '/ajax/template/overWriteBlockedPopup',\n data: {file: file},\n scope: $scope,\n });\n //Stop this foreach instance\n return;\n }\n\n //This is a not approved file\n //Open a popup to ask if the file may be overwritten\n dialog.open({\n //Get the template\n template: '/ajax/template/overWritePopup',\n data: {\n //Set the file\n file: file,\n //Set the existingKey as the filesKey\n filesKey: existingKey\n },\n scope: $scope,\n });\n } else {\n //This is a new file\n\n //Get the key where the next item will be pushed\n var filesKey = $scope.files.length\n\n //New file, so upload this\n $scope.uploadFile(file, filesKey);\n }\n\n\n });\n\n }\n\n /**\n * This method saves the file to the server\n *\n * @param file\n * @param filesKey\n */\n $scope.uploadFile = function (file, filesKey) {\n\n //If it is not an existing file, create a new empty object\n if (!$scope.files[filesKey]) $scope.files.push({});\n\n //Set the file_name to the file name of file\n $scope.files[filesKey].file_name = file.name\n //Set the status to -1 (uploading)\n $scope.files[filesKey].status = -1\n\n //Set the documentGroupId to the upload path\n var uploadPath = $scope.setDocumentGroup($scope.filePath, $scope.documentGroupId)\n\n //Upload to the server\n file.upload = Upload.upload({\n url: uploadPath,\n data: {\n //Sent the data and the options\n file: file,\n uploadSizes: $scope.uploadSizes,\n }\n });\n\n //After uploading\n file.upload.then(function (response) {\n //Success\n $timeout(function () {\n //Set the response data to documents\n\n var documents = response.data;\n //Add the file to the current files\n angular.forEach(documents, function (document, key) {\n $scope.files[filesKey] = document\n })\n\n $scope.updateGlobalDocumentGroup($scope.documentGroup, $scope.files, 'member')\n\n });\n }, function (response) {\n //Fails\n if (response.status > 0)\n $scope.errorMsg = response.status + ': ' + response.data;\n });\n }\n\n\n /**\n * Show an popup to ask if\n * a file may be deleted\n * @param index\n */\n $scope.deleteFilePopup = function (index) {\n\n //Set the currentFileIndex to the scope\n $scope.currentIndex = index;\n //Open the popup dialog\n ngDialog.open({\n //Get the template\n template: '/ajax/template/deleteFilePopup',\n //Set the $scope\n scope: $scope\n });\n\n\n }\n\n /**\n * This function will delete a file\n * from the $scope.files with the index\n *\n * @param index\n */\n $scope.deleteFile = function (index) {\n var deletePath = $scope.setDocumentGroup($scope.filePath + '/' + index, $scope.documentGroupId)\n $http.delete(deletePath)\n .then(\n function (response) {\n //Success\n //The still existing documents will be returned as response.data\n var documents = response.data\n //Set these documents as $scope.files\n $scope.files = documents\n $scope.updateGlobalDocumentGroup($scope.documentGroup, documents, 'member')\n },\n function (response) {\n //Fault\n //console.log(response.data.message);\n }\n );\n\n }\n\n /**\n * Check if the file can be deleted\n *\n * @param file\n * @returns {boolean}\n */\n $scope.canIDelete = function (file) {\n //You can not delete when the status is 2 (accepted)\n if (file.status == 2) return false;\n //You can not delete when the status is -1 (placeholder)\n if (file.status == -1) return false;\n //Se can delete\n return true;\n }\n /**\n * Overwrite {documentGroupId}\n * with the $scope.documentGroupId\n *\n * @param string\n * @param documentGroupId\n * @returns {*}\n */\n $scope.setDocumentGroup = function (string, documentGroupId) {\n\n return string.replace('{documentGroupId}', documentGroupId)\n }\n\n /**\n * Save the applicable checkbox to the server\n * @param not_applicable\n */\n $scope.updateApplicable = function (not_applicable) {\n\n $http({\n method: 'POST',\n url: $scope.setDocumentGroup($scope.path, $scope.documentGroupId),\n data: {\n 'applicable': +!not_applicable\n }\n }).then(function successCallback(response) {\n\n $scope.documentGroup.applicable = response.data.applicable\n $scope.updateGlobalDocumentGroup($scope.documentGroup, $scope.files, 'member')\n // this callback will be called asynchronously\n // when the response is available\n }, function errorCallback(response) {\n // called asynchronously if an error occurs\n // or server returns response with an error status.\n });\n }\n\n\n /**------------------------------|\n | |\n | Auditor functions |\n | |\n |-------------------------------*/\n\n\n /**\n * Update a status for one file\n *\n * @param file\n * @param status\n */\n $scope.updateStatus = function (file, status) {\n //Set the docuemntGroup for the path\n var url = $scope.setDocumentGroup($scope.filePath + '/' + file.id, $scope.documentGroupId)\n //Create a put request (update)\n $http.put(url, {status: status})\n .then(\n function (response) {\n file.status = status\n //todo auditor functions\n $scope.updateGlobalDocumentGroup($scope.documentGroup, $scope.files, 'reject')\n },\n function (response) {\n // failure callback\n }\n );\n }\n\n /**\n * Update all statusses for one documentGroup at once\n * @param status\n */\n $scope.updateMultipleStatuses = function (status) {\n\n var url = $scope.setDocumentGroup($scope.filePath, $scope.documentGroupId)\n //Create a put request (update)\n $http.put(url, {status: status})\n .then(\n function (response) {\n //The documents will be returned as response.data\n var documents = response.data\n //Set these documents as $scope.files\n $scope.files = documents\n\n $scope.updateGlobalDocumentGroup($scope.documentGroup, $scope.files, 'reject')\n\n },\n function (response) {\n // failure callback\n }\n );\n }\n\n /**\n *\n * @param statusInt\n * @returns {string}\n */\n $scope.setStatus = function (statusInt) {\n var statusString = statusInt + '';\n return statusString;\n }\n\n /**\n *\n * @param files\n * @param file\n * @returns {boolean}\n */\n $scope.getFileKey = function (existingFiles, file) {\n\n var newKey = null;\n for (var i = 0; i < existingFiles.length; i++) {\n if (file.name == existingFiles[i].file_name) {\n newKey = i;\n break;\n }\n }\n return newKey;\n }\n\n $scope.makeDate = function (dateString) {\n var date = new Date(dateString)\n return date;\n }\n\n}])\n\napp.controller('auditTableController', ['$scope', 'ngDialog', function ($scope, ngDialog) {\n\n $scope.hide = false;\n\n $scope.toggleHide = function ($event) {\n $scope.hide = !$scope.hide\n }\n\n $scope.claimPopup = function ($event) {\n $event.preventDefault();\n\n ngDialog.open({\n //Get the template\n template: '/ajax/template/claimPopup',\n data: {event: $event},\n //Set the $scope\n scope: $scope\n });\n\n\n $scope.clickLink = function (event) {\n window.location = event.target.href;\n }\n }\n\n}])\n\napp.controller('auditController', ['$scope', 'Upload', '$timeout', '$http', 'ngDialog', 'DocumentGroups', function ($scope, Upload, $timeout, $http, ngDialog, DocumentGroups) {\n\n $scope.popup = function ($type, $event) {\n\n //Stop the form from submitting\n $event.preventDefault();\n\n\n if ($type == 'file') {\n var faults = DocumentGroups.validateMemberSubmit();\n if (!jQuery.isEmptyObject(faults)) {\n $type = 'filedError';\n $scope.faults = faults;\n }\n } else if ($type == 'reject') {\n var faults = DocumentGroups.validateAuditorReject();\n if (!jQuery.isEmptyObject(faults)) {\n $type = 'rejectError';\n $scope.faults = faults;\n }\n }\n else if ($type == 'approve') {\n var faults = DocumentGroups.validateAuditorSubmit();\n if (!jQuery.isEmptyObject(faults)) {\n $type = 'approveError';\n $scope.faults = faults;\n }\n }\n\n\n ngDialog.open({\n //Get the template\n template: '/ajax/template/' + $type + 'Popup',\n data: {type: $type},\n //Set the $scope\n scope: $scope\n });\n\n }\n\n /**\n * Scroll to the first document-group with an error\n */\n $scope.goToFirstError = function () {\n //Get the top offset of the first document-group with an error\n var offset = $('.document-group.group-error').offset().top\n //Get the topBar height\n var topBar = $('.topBar').height()\n //subract the (topBar height + 30 px for extra margin)\n offset -= topBar+30\n //Slowly scroll to the correct x value\n $('html,body').animate({scrollTop: offset}, \"slow\");\n\n }\n\n\n $scope.submitForm = function (id) {\n $(\"#\" + id).unbind('click').click(); // the html click submit work now !\n\n }\n\n\n}])\n\napp.controller('dateController', ['$scope', function ($scope) {\n $scope.makeDate = function (dateString) {\n var date = new Date(dateString)\n return date;\n }\n}])\n\napp.controller('popupController', ['$scope', 'Upload', '$timeout', '$http', 'ngDialog', 'DocumentGroups', function ($scope, Upload, $timeout, $http, ngDialog, DocumentGroups) {\n\n $scope.closedPopup = function () {\n var $type = 'save';\n ngDialog.open({\n //Get the template\n template: '/ajax/template/closedPopup',\n //Set the $scope\n scope: $scope,\n });\n }\n $scope.rejectedPopup = function () {\n var $type = 'save';\n ngDialog.open({\n //Get the template\n template: '/ajax/template/rejectedPopup',\n //Set the $scope\n scope: $scope,\n });\n }\n\n\n}])\n\napp.directive('closeDialog', function (ngDialog, $timeout) {\n return {\n link: function (scope, element, attrs) {\n if (attrs.closeDialog) {\n $timeout(function () {\n ngDialog.close()\n }, attrs.closeDialog * 1000);\n }\n element.bind('click', function (element) {\n ngDialog.close();\n })\n }\n }\n});","/**\n * Created by driesjanssen on 11/10/16.\n */\n\n$(document).ready(function(){\n\n $('.popup').on('click', function() {\n alert('test');\n });\n});"]}