fng-reports 0.12.0-beta.230 → 0.12.0-beta.232

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- /*! forms-angular 2023-09-01 */
1
+ /*! forms-angular 2023-10-22 */
2
2
  'use strict';
3
3
 
4
- formsAngular.controller('AnalysisCtrl', ['$rootScope', '$window', '$filter', '$scope', '$http', '$location', 'CssFrameworkService', 'RoutingService',
5
- function ($rootScope, $window, $filter, $scope, $http, $location, CssFrameworkService, RoutingService) {
4
+ formsAngular.controller('AnalysisCtrl', ['$rootScope', '$window', '$q', '$filter', '$scope', '$http', '$location', 'CssFrameworkService', 'RoutingService',
5
+ function ($rootScope, $window, $q, $filter, $scope, $http, $location, CssFrameworkService, RoutingService) {
6
6
  /*jshint newcap: false */
7
7
  var firstTime = true,
8
8
  pdfPlugIn = new ngGridPdfExportPlugin({inhibitButton: true}),
@@ -12,20 +12,19 @@ formsAngular.controller('AnalysisCtrl', ['$rootScope', '$window', '$filter', '$s
12
12
  angular.extend($scope, RoutingService.parsePathFunc()($location.$$path));
13
13
 
14
14
  $scope.reportSchema = {
15
- columnDefs: []
15
+ columnDefs: [
16
+ { name: 'dummy', field: 'dummy' },
17
+ ]
16
18
  };
17
19
  $scope.gridOptions = {
20
+ enableFiltering: false,
18
21
  data: 'report',
19
22
  columnDefs: $scope.reportSchema.columnDefs,
20
23
  showColumnMenu: true,
21
24
  enableRowHeaderSelection: false,
22
- enableFiltering: false,
23
- showGridFooter: false,
24
25
  reallyShowFooter: false, // this determines whether it is actually displayed or not
25
26
  showTotals: true,
26
27
  enableColumnResizing: true,
27
- // enableColumnReordering: true,
28
- // jqueryUIDraggable: true,
29
28
  footerRowHeight: 65,
30
29
  multiSelect: false,
31
30
  plugins: [pdfPlugIn, csvPlugIn],
@@ -206,7 +205,7 @@ ${e.message}`);
206
205
  }
207
206
  var dateTest = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3})(Z|[+ -]\d{4})$/.exec(thisPart.value);
208
207
  if (dateTest) {
209
- thisPart.value = new Date(dateTest[1]);
208
+ thisPart.value = new Date(dateTest[0]);
210
209
  }
211
210
  $scope.record[param] = thisPart.value;
212
211
  }
@@ -249,10 +248,38 @@ ${e.message}`);
249
248
  $scope.refreshQuery = function () {
250
249
 
251
250
  function substituteParams(str) {
252
- return str.replace(/\|.+?\|/g, function (match) {
253
- var param = match.slice(1, -1);
254
- var isParamTest = /\((.+)\)/.exec(param);
255
- return isParamTest ? $scope.reportSchema.params[isParamTest[1]].value : '';
251
+ return $q(function (resolve) {
252
+ let promises = [];
253
+ str.replace(/\|.+?\|/g, function (match) {
254
+ var param = match.slice(1, -1);
255
+ var isParamTest = /\((.+)\)/.exec(param);
256
+ if (isParamTest[1]) {
257
+ const paramValue = $scope.reportSchema.params[isParamTest[1]].value;
258
+ if (isParamTest.index > 0) {
259
+ // We have a title function to run
260
+ promises.push($http.get(`/api/${'organisation'}/${paramValue}/list`).then(function (response) {
261
+ if (response && response.status === 200 && response.data) {
262
+ return response.data.list;
263
+ } else {
264
+ return '';
265
+ }
266
+ }));
267
+ } else {
268
+ promises.push(paramValue);
269
+ }
270
+ } else {
271
+ promises.push('');
272
+ }
273
+ return match;
274
+ });
275
+ Promise.all(promises).then(function (results) {
276
+ let index = 0;
277
+ resolve(str.replace(/\|.+?\|/g, function () {
278
+ let retVal = results[index];
279
+ index += 1;
280
+ return retVal;
281
+ }));
282
+ });
256
283
  });
257
284
  }
258
285
 
@@ -304,13 +331,18 @@ ${e.message}`);
304
331
  $scope.report = data.report;
305
332
  $scope.reportSchema = data.schema;
306
333
  $scope.reportSchema.title = $scope.reportSchema.title || $scope.modelName;
307
- $scope.titleWithSubstitutions = substituteParams($scope.reportSchema.title);
334
+ substituteParams($scope.reportSchema.title)
335
+ .then(function (str) {
336
+ $scope.titleWithSubstitutions = str;
337
+ });
308
338
  $scope.gridOptions.enableFiltering = !!$scope.reportSchema.filter;
309
339
  if (navScope && navScope.items) {
310
340
  navScope.items.length = 2;
311
341
  if ($scope.reportSchema.menu) {
312
342
  $scope.reportSchema.menu.forEach(function (m) {
313
- navScope.items.push(JSON.parse(substituteParams(JSON.stringify(m))));
343
+ substituteParams(JSON.stringify(m)).then(function (str) {
344
+ navScope.items.push(JSON.parse(str));
345
+ });
314
346
  });
315
347
  }
316
348
  }
@@ -323,19 +355,25 @@ ${e.message}`);
323
355
  firstTime = false;
324
356
 
325
357
  $scope.$watch('reportSchema.columnDefs', function (newValue) {
326
- var columnTotals = false;
358
+ // var columnTotals = false;
327
359
  if (newValue) {
328
- for (var i = 0; i < newValue.length; i++) {
329
- if (newValue[i].totalsRow) {
330
- columnTotals = true;
331
- }
332
- if (newValue[i].align) {
333
- var alignClass = 'fng-' + newValue[i].align;
334
- newValue[i].cellClass = newValue[i].cellClass || '';
335
- if (newValue[i].cellClass.indexOf(alignClass) === -1) {
336
- newValue[i].cellClass = newValue[i].cellClass + ' ' + alignClass;
360
+ $scope.gridOptions.columnDefs.length = 0;
361
+ for (const colDef of newValue) {
362
+ if (colDef.align) {
363
+ var alignClass = 'fng-' + colDef.align;
364
+ colDef.cellClass = colDef.cellClass || '';
365
+ if (colDef.cellClass.indexOf(alignClass) === -1) {
366
+ colDef.cellClass = colDef.cellClass + ' ' + alignClass;
337
367
  }
338
368
  }
369
+ if (colDef.aggregationTypeStr) {
370
+ $scope.gridOptions.showColumnFooter = true;
371
+ colDef.aggregationType = uiGridConstants.aggregationTypes[colDef.aggregationTypeStr];
372
+ colDef.aggregationHideLabel = colDef.aggregationTypeStr === 'sum';
373
+ colDef.footerCellFilter = colDef.cellFilter;
374
+ colDef.footerCellClass = colDef.cellClass;
375
+ }
376
+ $scope.gridOptions.columnDefs.push(colDef);
339
377
  }
340
378
  // Auto-upgrade from ng-grid to ui-grid
341
379
  newValue.forEach(function (def) {
@@ -344,11 +382,7 @@ ${e.message}`);
344
382
  def.width = parseInt(def.width.slice(0, -2));
345
383
  }
346
384
  });
347
- $scope.gridOptions.columnDefs = newValue;
348
385
  }
349
- $scope.gridOptions.showTotals = columnTotals;
350
- $scope.gridOptions.reallyShowFooter = columnTotals;
351
- $scope.gridOptions.footerRowHeight = 55 + (columnTotals ? 10 : 0);
352
386
  }, true);
353
387
 
354
388
  if (!$scope.paramSchema && data.schema.params) {
@@ -391,7 +425,7 @@ ${e.message}`);
391
425
  });
392
426
 
393
427
  // Error handling, stolen quickly from forms-angular record-handler
394
- $scope.showError = function(error, alertTitle) {
428
+ $scope.showError = function (error, alertTitle) {
395
429
  $scope.alertTitle = alertTitle ? alertTitle : 'Error!';
396
430
  if (typeof error === 'string') {
397
431
  $scope.errorMessage = error;
@@ -408,7 +442,7 @@ ${e.message}`);
408
442
  $scope.errorMessage = error;
409
443
  }
410
444
  }
411
- $scope.errorHideTimer = window.setTimeout(function() {
445
+ $scope.errorHideTimer = window.setTimeout(function () {
412
446
  $scope.dismissError();
413
447
  $scope.$digest();
414
448
  }, 3500 + (1000 * ($scope.alertTitle + $scope.errorMessage).length / 50));
@@ -418,21 +452,21 @@ ${e.message}`);
418
452
  });
419
453
  };
420
454
 
421
- $scope.clearTimeout = function() {
455
+ $scope.clearTimeout = function () {
422
456
  if ($scope.errorHideTimer) {
423
457
  clearTimeout($scope.errorHideTimer);
424
458
  delete $scope.errorHideTimer;
425
459
  }
426
460
  };
427
461
 
428
- $scope.dismissError = function() {
462
+ $scope.dismissError = function () {
429
463
  $scope.clearTimeout;
430
464
  $scope.errorVisible = false;
431
465
  delete $scope.errorMessage;
432
466
  delete $scope.alertTitle;
433
467
  };
434
468
 
435
- $scope.stickError = function() {
469
+ $scope.stickError = function () {
436
470
  clearTimeout($scope.errorHideTimer);
437
471
  };
438
472
 
@@ -1,3 +1,3 @@
1
- /*! forms-angular 2023-09-01 */
2
- "use strict";formsAngular.controller("AnalysisCtrl",["$rootScope","$window","$filter","$scope","$http","$location","CssFrameworkService","RoutingService",function(e,r,a,l,s,c,i,t){var p=!0,o=new ngGridPdfExportPlugin({inhibitButton:!0}),n=new ngGridCsvExportPlugin({inhibitButton:!0});function d(r){try{return JSON.parse(r)}catch(e){throw new Error(`Invalid JSON ${r}
3
- `+e.message)}}if(angular.extend(l,t.parsePathFunc()(c.$$path)),l.reportSchema={columnDefs:[]},l.gridOptions={data:"report",columnDefs:l.reportSchema.columnDefs,showColumnMenu:!0,enableRowHeaderSelection:!1,enableFiltering:!1,showGridFooter:!1,reallyShowFooter:!1,showTotals:!0,enableColumnResizing:!0,footerRowHeight:65,multiSelect:!1,plugins:[o,n],onRegisterApi:function(r){l.gridApi=r,l.gridOptions.plugins.forEach(function(e){e.init(l,r.grid,null)}),r.selection.on.rowSelectionChanged(l,function(o){var e=l.reportSchema.drilldown;e&&("string"==typeof e?(e=t.buildUrl(e.replace(/\|.+?\|/g,function(e){var r,e=e.slice(1,-1),t=/\((.+)\)/.exec(e);return t?(r=l.reportSchema.params[t[1]])?(l.param=l.record[t[1]],r.conversionExpression?l.$eval(r.conversionExpression):r.value):l.reportSchema.params[t[1]].value:o.entity[e]})),window.location=e):console.error("Was expecting drilldown to be string but it was "+typeof e+" ("+e+")"))})},appScopeProvider:{http:function(r,e,t){r.currentTarget.getAttributeNames().forEach(e=>{e.startsWith("data-")&&(t=t.replace(":"+e.slice(5),r.currentTarget.getAttribute(e)))});var o=r.currentTarget.getAttribute("data-disable-button"),o=(o&&(r.currentTarget.setAttribute("disabled","disabled"),"true"!==o)&&(r.currentTarget.innerText=o),{method:e,url:t});-1!==["POST","PUT","PATCH"].indexOf(e)&&(o.data={val:r.currentTarget.getAttribute("data-data")||{}}),s(o),r.stopPropagation()}}},l.report=[],!l.reportSchemaName&&c.$$search.r)switch(c.$$search.r.slice(0,1)){case"[":l.reportSchema.pipeline=d(c.$$search.r);break;case"{":angular.extend(l.reportSchema,d(c.$$search.r));break;default:throw new Error("No report instructions specified")}function u(e){for(var r in l.paramSchema=[],l.record={},e){var t,o;e.hasOwnProperty(r)&&((t=e[r]).noInput||(o=l.paramSchema.push({name:r,id:"fp_"+r,label:t.label||a("titleCase")(r),type:t.type||"text",required:!0,add:t.add||void 0,size:t.size||("bs3"===i.frameWork?"large":"medium")}),"select"===t.type&&(l[r+"_Opts"]=t.enum,l.paramSchema[o-1].options=r+"_Opts")),(o=/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3})(Z|[+ -]\d{4})$/.exec(t.value))&&(t.value=new Date(o[1])),l.record[r]=t.value)}l.$watch("record",function(e,r){r!==e&&l.refreshQuery()},!0)}l.getTotalVal=function(r,e){var t="",o=_.find(l.reportSchema.columnDefs,function(e){return e.field===r});if(o)switch(o.totalsRow){case void 0:break;case"$SUM":for(var i=0,n=0;n<l.report.length;n++)i+=l.report[n][r];t=i,e&&(t=a(e)(t));break;default:t=o.totalsRow}return t},l.$on("exportToPDF",function(){o.createPDF()}),l.$on("exportToCSV",function(){n.createCSV()}),l.extractFilter=function(e,r){var t,o,i;e.cellFilter&&(-1===(i=e.cellFilter.indexOf(":"))?t=e.cellFilter:(t=e.cellFilter.slice(0,i).trim(),"'"!==(o=e.cellFilter.slice(i+1,999).trim())[0]&&'"'!==o[0]||(o=o.slice(1,-1))),i=angular.element(document.body).injector().get("$filter")(t.trim()),r[e.field]={filter:i,filterParam:o})};var f,m,g,h=document.querySelector("div.report-grow"),S=(h&&(f=h.offsetLeft,m=h.offsetTop+f,g=(g=document.querySelector("div.ui-grid-header"))?g.clientHeight:31,r=Math.floor((r.innerHeight-m-g-f)/30),angular.element(h).css("height",30*r+"px")),e.navScope);S.items=[{fn:o.createPDF,text:"Save as PDF"},{fn:n.createCSV,text:"Export as CSV"}],S.contextMenu="Report",S.contextMenuId="reportMenu",l.titleWithSubstitutions=l.reportSchema.title,l.inhibitRefresh||(l.refreshQuery=function(){function t(e){return e.replace(/\|.+?\|/g,function(e){e=e.slice(1,-1),e=/\((.+)\)/.exec(e);return e?l.reportSchema.params[e[1]].value:""})}var e="/api/report/"+l.modelName,r="?",o=!1,i=c.$$url.match(/\?.*/);if(l.reportSchemaName?e+="/"+l.reportSchemaName:i&&(p&&(l.paramSchema=JSON.parse(c.search().r).params,u(l.paramSchema)),e+=r+i[0].slice(1),r="&",o=!0),l.paramSchema){for(var n in l.record)if(l.record.hasOwnProperty(n)){var a=l.reportSchema.params[n];if(l.record[n]&&""!==l.record[n])l.param=l.record[n],a.conversionExpression&&(l.param=l.$eval(a.conversionExpression)),e+=r+n+"="+l.param,r="&";else if(a.required)return}}else!o&&i&&(e+=r+i[0].slice(1),r="&");return s.get(e).then(function(e){var r;e&&e.data&&e.data.success?(r=e.data,l.report=r.report,l.reportSchema=r.schema,l.reportSchema.title=l.reportSchema.title||l.modelName,l.titleWithSubstitutions=t(l.reportSchema.title),l.gridOptions.enableFiltering=!!l.reportSchema.filter,S&&S.items&&(S.items.length=2,l.reportSchema.menu)&&l.reportSchema.menu.forEach(function(e){S.items.push(JSON.parse(t(JSON.stringify(e))))}),p&&(p=!1,l.$watch("reportSchema.columnDefs",function(e){var r=!1;if(e){for(var t,o=0;o<e.length;o++)e[o].totalsRow&&(r=!0),e[o].align&&(t="fng-"+e[o].align,e[o].cellClass=e[o].cellClass||"",-1===e[o].cellClass.indexOf(t))&&(e[o].cellClass=e[o].cellClass+" "+t);e.forEach(function(e){e.width&&"string"==typeof e.width&&-1!==e.width.indexOf("px")&&(e.width=parseInt(e.width.slice(0,-2)))}),l.gridOptions.columnDefs=e}l.gridOptions.showTotals=r,l.gridOptions.reallyShowFooter=r,l.gridOptions.footerRowHeight=55+(r?10:0)},!0),!l.paramSchema)&&r.schema.params&&u(r.schema.params)):(l.showError(JSON.stringify(e.data.error),"Invalid Response Error"),l.reportSchema.title="Error - see console log")},function(e){let r,t;t=403===e.status?(r="You do not have permission to run this report (permission to GET all "+l.modelName+" records is required)","Permission denied"):(r="The server could not process the request","Error"),l.showError(r,t)})},l.refreshQuery()),l.showsContent=function(e,r){return!!/{{[\s]*COL_FIELD[\s]*}}/.test(e.replace(/(<([^>]+)>)/gi,""))||(-1!==e.indexOf('ng-bind-html="row.entity.'+r)?"HTML":void 0)},l.$on("$locationChangeStart",function(){delete S.contextMenu,delete S.items}),l.showError=function(r,e){if(l.alertTitle=e||"Error!","string"==typeof r)l.errorMessage=r;else if(r)if(r.message&&"string"==typeof r.message)l.errorMessage=r.message;else if(r.data&&r.data.message)l.errorMessage=r.data.message;else try{l.errorMessage=JSON.stringify(r)}catch(e){l.errorMessage=r}else l.errorMessage="An error occurred - that's all we got. Sorry.";l.errorHideTimer=window.setTimeout(function(){l.dismissError(),l.$digest()},3500+1e3*(l.alertTitle+l.errorMessage).length/50),l.errorVisible=!0,window.setTimeout(()=>{l.$digest()})},l.clearTimeout=function(){l.errorHideTimer&&(clearTimeout(l.errorHideTimer),delete l.errorHideTimer)},l.dismissError=function(){l.clearTimeout,l.errorVisible=!1,delete l.errorMessage,delete l.alertTitle},l.stickError=function(){clearTimeout(l.errorHideTimer)}}]);var COL_FIELD=/COL_FIELD/g;function ngGridCsvExportPlugin(e){var a=this;a.grid=null,a.scope=null,a.services=null,a.init=function(e,r,t){a.grid=r,a.scope=e,a.services=t},a.createCSV=function(){var e,r,t;e=a.scope.reportSchema.title+".csv",r="data:text/csv;charset=UTF-8,"+encodeURIComponent(a.prepareCSV()),(t=document.createElement("a")).download=e,t.href=r,e=new MouseEvent("click"),t.dispatchEvent(e)},a.prepareCSV=function(){function o(e,r){return null==e?"":r?r.filter(e,r.filterParam):"number"==typeof e?""+e:"boolean"==typeof e?e?"TRUE":"FALSE":("string"==typeof e?e:JSON.stringify(e)).replace(/"/g,'""')}function e(e){return e.substr(0,e.length-1)+"\n"}var i="",n={};return angular.forEach(a.grid.columns,function(e){var r;a.scope.extractFilter(e,n),e.visible&&(void 0===e.width||"*"===e.width||0<e.width)&&(-1!==e.field.indexOf(".")?console.error(`Cannot export nested fields such as ${e.field}. Use $project to simplify.`):e.colDef.cellTemplate?"HTML"===(r=a.scope.showsContent(e.colDef.cellTemplate,e.field))?(i+='"'+o(e.displayName)+'",',e.doCSVExport=function(e){return e=(e=(e=(e=(e=(e=(e=e.replace(/<p>/g,"\n\n")).replace(/<\/p>/g,"")).replace(/<\s?br\s?\/?>/g,"\n")).replace(/<[^>]+>/g,"")).replaceAll("&nbsp;"," ").trim()).replaceAll("\n\n \n\n","\n\n")).replaceAll("\n\n\n","\n\n")}):r?(i+='"'+o(e.displayName)+'",',e.doCSVExport=!0):e.doCSVExport=!1:(i+='"'+o(e.displayName)+'",',e.doCSVExport=!0))}),i=e(i),angular.forEach(a.scope.gridApi.core.getVisibleRows(),function(t){t.visible&&(angular.forEach(a.grid.columns,function(r){if(r.doCSVExport){let e=t.entity[r.field];"function"==typeof r.doCSVExport&&(e=r.doCSVExport(e)),i+='"'+o(e,n[r.field])+'",'}}),i=e(i))}),i}}function ngGridPdfExportPlugin(o){var l=this;l.grid=null,l.scope=null,l.services=null,l.options=o,l.init=function(e,r,t){l.grid=r,l.scope=e,l.services=t,o.inhibitButton||(e=r.$root.find(".ngFooterPanel"),null!=(t=r.$root.find(".ngFooterPanel .pdf-data-link-span"))&&t.remove(),e.append('<button class="pdf-data-link-span">PDF Export</button>'),e.on("click",function(){l.createPDF()}))},l.createPDF=function(){var o=[],i=[],e=[],n={},a={},r=(angular.forEach(l.grid.columns,function(e,r){var t;e.visible&&(-1!==e.field.indexOf(".")?console.error(`Cannot export nested fields such as ${e.field}. Use $project to simplify.`):e.colDef.cellTemplate?"HTML"===(t=l.scope.showsContent(e.colDef.cellTemplate,e.field))?(o.push(e.displayName),i.push(e.field),a[e.field]=function(e){return e=(e=(e=(e=(e=(e=(e=e.replace(/<p>/g,"\n\n")).replace(/<\/p>/g,"")).replace(/<\s?br\s?\/?>/g,"\n")).replace(/<[^>]+>/g,"")).replaceAll("&nbsp;"," ").trim()).replaceAll("\n\n \n\n","\n\n")).replaceAll("\n\n\n","\n\n")}):t&&(o.push(e.displayName),i.push(e.field)):(o.push(e.displayName),i.push(e.field))),e.colDef.totalsRow&&(e.field,l.grid.getTotalVal(e.field,e.filter).toString()),l.scope.extractFilter(e,n)}),angular.forEach(l.scope.gridApi.core.getVisibleRows(),function(t){var o=[];t.visible&&(i.forEach(function(e){var r=t.entity[e];n[e]&&(r=n[e].filter(r,n[e].filterParam)),"string"==typeof(r=a[e]?a[e](r):r)&&(r=(r=(r=(r=(r=r.replace(/\u2019/g,"'")).replace(/\u2018/g,"'")).replace(/\u201c/g,'"')).replace(/\u201d/g,'"')).replace(/[^\x00-\xFF]/g,"")),o.push(r)}),e.push(o))}),new jspdf.jsPDF("landscape","mm","a4"));r.autoTable({head:[o],body:e}),window.open(r.output("bloburl"))}}formsAngular.directive("ngTotalCell",["$compile","$domUtilityService",function(i,t){return{scope:!1,compile:function(){return{pre:function(e,r){var t=e.col.cellTemplate.match(/{{COL_FIELD \|(.+)}}/),t=t?e.col.cellTemplate.replace("COL_FIELD |"+t[1],'getTotalVal("'+e.col.field+'","'+t[1]+'")'):e.col.cellTemplate.replace(COL_FIELD,'getTotalVal("'+e.col.field+'")'),o=e.col.enableCellEdit?(o=(o=e.col.cellEditTemplate).replace(DISPLAY_CELL_TEMPLATE,t)).replace(EDITABLE_CELL_TEMPLATE,e.col.editableCellTemplate.replace(COL_FIELD,"row.entity."+e.col.field)):t,t=i(o)(e);e.enableCellSelection&&-1===t[0].className.indexOf("ngSelectionCell")&&(t[0].setAttribute("tabindex",0),t.addClass("ngCellElement")),r.append(t)},post:function(e,r){e.enableCellSelection&&e.domAccessProvider.selectionHandlers(e,r),e.$on("ngGridEventDigestCell",function(){t.digest(e)})}}}}}]);
1
+ /*! forms-angular 2023-10-22 */
2
+ "use strict";formsAngular.controller("AnalysisCtrl",["$rootScope","$window","$q","$filter","$scope","$http","$location","CssFrameworkService","RoutingService",function(e,r,l,a,s,c,p,n,t){var u=!0,o=new ngGridPdfExportPlugin({inhibitButton:!0}),i=new ngGridCsvExportPlugin({inhibitButton:!0});function d(r){try{return JSON.parse(r)}catch(e){throw new Error(`Invalid JSON ${r}
3
+ `+e.message)}}if(angular.extend(s,t.parsePathFunc()(p.$$path)),s.reportSchema={columnDefs:[{name:"dummy",field:"dummy"}]},s.gridOptions={enableFiltering:!1,data:"report",columnDefs:s.reportSchema.columnDefs,showColumnMenu:!0,enableRowHeaderSelection:!1,reallyShowFooter:!1,showTotals:!0,enableColumnResizing:!0,footerRowHeight:65,multiSelect:!1,plugins:[o,i],onRegisterApi:function(r){s.gridApi=r,s.gridOptions.plugins.forEach(function(e){e.init(s,r.grid,null)}),r.selection.on.rowSelectionChanged(s,function(o){var e=s.reportSchema.drilldown;e&&("string"==typeof e?(e=t.buildUrl(e.replace(/\|.+?\|/g,function(e){var r,e=e.slice(1,-1),t=/\((.+)\)/.exec(e);return t?(r=s.reportSchema.params[t[1]])?(s.param=s.record[t[1]],r.conversionExpression?s.$eval(r.conversionExpression):r.value):s.reportSchema.params[t[1]].value:o.entity[e]})),window.location=e):console.error("Was expecting drilldown to be string but it was "+typeof e+" ("+e+")"))})},appScopeProvider:{http:function(r,e,t){r.currentTarget.getAttributeNames().forEach(e=>{e.startsWith("data-")&&(t=t.replace(":"+e.slice(5),r.currentTarget.getAttribute(e)))});var o=r.currentTarget.getAttribute("data-disable-button"),o=(o&&(r.currentTarget.setAttribute("disabled","disabled"),"true"!==o)&&(r.currentTarget.innerText=o),{method:e,url:t});-1!==["POST","PUT","PATCH"].indexOf(e)&&(o.data={val:r.currentTarget.getAttribute("data-data")||{}}),c(o),r.stopPropagation()}}},s.report=[],!s.reportSchemaName&&p.$$search.r)switch(p.$$search.r.slice(0,1)){case"[":s.reportSchema.pipeline=d(p.$$search.r);break;case"{":angular.extend(s.reportSchema,d(p.$$search.r));break;default:throw new Error("No report instructions specified")}function f(e){for(var r in s.paramSchema=[],s.record={},e){var t,o;e.hasOwnProperty(r)&&((t=e[r]).noInput||(o=s.paramSchema.push({name:r,id:"fp_"+r,label:t.label||a("titleCase")(r),type:t.type||"text",required:!0,add:t.add||void 0,size:t.size||("bs3"===n.frameWork?"large":"medium")}),"select"===t.type&&(s[r+"_Opts"]=t.enum,s.paramSchema[o-1].options=r+"_Opts")),(o=/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3})(Z|[+ -]\d{4})$/.exec(t.value))&&(t.value=new Date(o[0])),s.record[r]=t.value)}s.$watch("record",function(e,r){r!==e&&s.refreshQuery()},!0)}s.getTotalVal=function(r,e){var t="",o=_.find(s.reportSchema.columnDefs,function(e){return e.field===r});if(o)switch(o.totalsRow){case void 0:break;case"$SUM":for(var n=0,i=0;i<s.report.length;i++)n+=s.report[i][r];t=n,e&&(t=a(e)(t));break;default:t=o.totalsRow}return t},s.$on("exportToPDF",function(){o.createPDF()}),s.$on("exportToCSV",function(){i.createCSV()}),s.extractFilter=function(e,r){var t,o,n;e.cellFilter&&(-1===(n=e.cellFilter.indexOf(":"))?t=e.cellFilter:(t=e.cellFilter.slice(0,n).trim(),"'"!==(o=e.cellFilter.slice(n+1,999).trim())[0]&&'"'!==o[0]||(o=o.slice(1,-1))),n=angular.element(document.body).injector().get("$filter")(t.trim()),r[e.field]={filter:n,filterParam:o})};var m,g,h,S=document.querySelector("div.report-grow"),v=(S&&(m=S.offsetLeft,g=S.offsetTop+m,h=(h=document.querySelector("div.ui-grid-header"))?h.clientHeight:31,r=Math.floor((r.innerHeight-g-h-m)/30),angular.element(S).css("height",30*r+"px")),e.navScope);v.items=[{fn:o.createPDF,text:"Save as PDF"},{fn:i.createCSV,text:"Export as CSV"}],v.contextMenu="Report",v.contextMenuId="reportMenu",s.titleWithSubstitutions=s.reportSchema.title,s.inhibitRefresh||(s.refreshQuery=function(){function t(n){return l(function(e){let o=[];n.replace(/\|.+?\|/g,function(e){var r,t=e.slice(1,-1),t=/\((.+)\)/.exec(t);return t[1]?(r=s.reportSchema.params[t[1]].value,0<t.index?o.push(c.get(`/api/organisation/${r}/list`).then(function(e){return e&&200===e.status&&e.data?e.data.list:""})):o.push(r)):o.push(""),e}),Promise.all(o).then(function(r){let t=0;e(n.replace(/\|.+?\|/g,function(){var e=r[t];return t+=1,e}))})})}var e="/api/report/"+s.modelName,r="?",o=!1,n=p.$$url.match(/\?.*/);if(s.reportSchemaName?e+="/"+s.reportSchemaName:n&&(u&&(s.paramSchema=JSON.parse(p.search().r).params,f(s.paramSchema)),e+=r+n[0].slice(1),r="&",o=!0),s.paramSchema){for(var i in s.record)if(s.record.hasOwnProperty(i)){var a=s.reportSchema.params[i];if(s.record[i]&&""!==s.record[i])s.param=s.record[i],a.conversionExpression&&(s.param=s.$eval(a.conversionExpression)),e+=r+i+"="+s.param,r="&";else if(a.required)return}}else!o&&n&&(e+=r+n[0].slice(1),r="&");return c.get(e).then(function(e){var r;e&&e.data&&e.data.success?(r=e.data,s.report=r.report,s.reportSchema=r.schema,s.reportSchema.title=s.reportSchema.title||s.modelName,t(s.reportSchema.title).then(function(e){s.titleWithSubstitutions=e}),s.gridOptions.enableFiltering=!!s.reportSchema.filter,v&&v.items&&(v.items.length=2,s.reportSchema.menu)&&s.reportSchema.menu.forEach(function(e){t(JSON.stringify(e)).then(function(e){v.items.push(JSON.parse(e))})}),u&&(u=!1,s.$watch("reportSchema.columnDefs",function(e){if(e){s.gridOptions.columnDefs.length=0;for(const t of e){var r;t.align&&(r="fng-"+t.align,t.cellClass=t.cellClass||"",-1===t.cellClass.indexOf(r))&&(t.cellClass=t.cellClass+" "+r),t.aggregationTypeStr&&(s.gridOptions.showColumnFooter=!0,t.aggregationType=uiGridConstants.aggregationTypes[t.aggregationTypeStr],t.aggregationHideLabel="sum"===t.aggregationTypeStr,t.footerCellFilter=t.cellFilter,t.footerCellClass=t.cellClass),s.gridOptions.columnDefs.push(t)}e.forEach(function(e){e.width&&"string"==typeof e.width&&-1!==e.width.indexOf("px")&&(e.width=parseInt(e.width.slice(0,-2)))})}},!0),!s.paramSchema)&&r.schema.params&&f(r.schema.params)):(s.showError(JSON.stringify(e.data.error),"Invalid Response Error"),s.reportSchema.title="Error - see console log")},function(e){let r,t;t=403===e.status?(r="You do not have permission to run this report (permission to GET all "+s.modelName+" records is required)","Permission denied"):(r="The server could not process the request","Error"),s.showError(r,t)})},s.refreshQuery()),s.showsContent=function(e,r){return!!/{{[\s]*COL_FIELD[\s]*}}/.test(e.replace(/(<([^>]+)>)/gi,""))||(-1!==e.indexOf('ng-bind-html="row.entity.'+r)?"HTML":void 0)},s.$on("$locationChangeStart",function(){delete v.contextMenu,delete v.items}),s.showError=function(r,e){if(s.alertTitle=e||"Error!","string"==typeof r)s.errorMessage=r;else if(r)if(r.message&&"string"==typeof r.message)s.errorMessage=r.message;else if(r.data&&r.data.message)s.errorMessage=r.data.message;else try{s.errorMessage=JSON.stringify(r)}catch(e){s.errorMessage=r}else s.errorMessage="An error occurred - that's all we got. Sorry.";s.errorHideTimer=window.setTimeout(function(){s.dismissError(),s.$digest()},3500+1e3*(s.alertTitle+s.errorMessage).length/50),s.errorVisible=!0,window.setTimeout(()=>{s.$digest()})},s.clearTimeout=function(){s.errorHideTimer&&(clearTimeout(s.errorHideTimer),delete s.errorHideTimer)},s.dismissError=function(){s.clearTimeout,s.errorVisible=!1,delete s.errorMessage,delete s.alertTitle},s.stickError=function(){clearTimeout(s.errorHideTimer)}}]);var COL_FIELD=/COL_FIELD/g;function ngGridCsvExportPlugin(e){var a=this;a.grid=null,a.scope=null,a.services=null,a.init=function(e,r,t){a.grid=r,a.scope=e,a.services=t},a.createCSV=function(){var e,r,t;e=a.scope.reportSchema.title+".csv",r="data:text/csv;charset=UTF-8,"+encodeURIComponent(a.prepareCSV()),(t=document.createElement("a")).download=e,t.href=r,e=new MouseEvent("click"),t.dispatchEvent(e)},a.prepareCSV=function(){function o(e,r){return null==e?"":r?r.filter(e,r.filterParam):"number"==typeof e?""+e:"boolean"==typeof e?e?"TRUE":"FALSE":("string"==typeof e?e:JSON.stringify(e)).replace(/"/g,'""')}function e(e){return e.substr(0,e.length-1)+"\n"}var n="",i={};return angular.forEach(a.grid.columns,function(e){var r;a.scope.extractFilter(e,i),e.visible&&(void 0===e.width||"*"===e.width||0<e.width)&&(-1!==e.field.indexOf(".")?console.error(`Cannot export nested fields such as ${e.field}. Use $project to simplify.`):e.colDef.cellTemplate?"HTML"===(r=a.scope.showsContent(e.colDef.cellTemplate,e.field))?(n+='"'+o(e.displayName)+'",',e.doCSVExport=function(e){return e=(e=(e=(e=(e=(e=(e=e.replace(/<p>/g,"\n\n")).replace(/<\/p>/g,"")).replace(/<\s?br\s?\/?>/g,"\n")).replace(/<[^>]+>/g,"")).replaceAll("&nbsp;"," ").trim()).replaceAll("\n\n \n\n","\n\n")).replaceAll("\n\n\n","\n\n")}):r?(n+='"'+o(e.displayName)+'",',e.doCSVExport=!0):e.doCSVExport=!1:(n+='"'+o(e.displayName)+'",',e.doCSVExport=!0))}),n=e(n),angular.forEach(a.scope.gridApi.core.getVisibleRows(),function(t){t.visible&&(angular.forEach(a.grid.columns,function(r){if(r.doCSVExport){let e=t.entity[r.field];"function"==typeof r.doCSVExport&&(e=r.doCSVExport(e)),n+='"'+o(e,i[r.field])+'",'}}),n=e(n))}),n}}function ngGridPdfExportPlugin(o){var l=this;l.grid=null,l.scope=null,l.services=null,l.options=o,l.init=function(e,r,t){l.grid=r,l.scope=e,l.services=t,o.inhibitButton||(e=r.$root.find(".ngFooterPanel"),null!=(t=r.$root.find(".ngFooterPanel .pdf-data-link-span"))&&t.remove(),e.append('<button class="pdf-data-link-span">PDF Export</button>'),e.on("click",function(){l.createPDF()}))},l.createPDF=function(){var o=[],n=[],e=[],i={},a={},r=(angular.forEach(l.grid.columns,function(e,r){var t;e.visible&&(-1!==e.field.indexOf(".")?console.error(`Cannot export nested fields such as ${e.field}. Use $project to simplify.`):e.colDef.cellTemplate?"HTML"===(t=l.scope.showsContent(e.colDef.cellTemplate,e.field))?(o.push(e.displayName),n.push(e.field),a[e.field]=function(e){return e=(e=(e=(e=(e=(e=(e=e.replace(/<p>/g,"\n\n")).replace(/<\/p>/g,"")).replace(/<\s?br\s?\/?>/g,"\n")).replace(/<[^>]+>/g,"")).replaceAll("&nbsp;"," ").trim()).replaceAll("\n\n \n\n","\n\n")).replaceAll("\n\n\n","\n\n")}):t&&(o.push(e.displayName),n.push(e.field)):(o.push(e.displayName),n.push(e.field))),e.colDef.totalsRow&&(e.field,l.grid.getTotalVal(e.field,e.filter).toString()),l.scope.extractFilter(e,i)}),angular.forEach(l.scope.gridApi.core.getVisibleRows(),function(t){var o=[];t.visible&&(n.forEach(function(e){var r=t.entity[e];i[e]&&(r=i[e].filter(r,i[e].filterParam)),"string"==typeof(r=a[e]?a[e](r):r)&&(r=(r=(r=(r=(r=r.replace(/\u2019/g,"'")).replace(/\u2018/g,"'")).replace(/\u201c/g,'"')).replace(/\u201d/g,'"')).replace(/[^\x00-\xFF]/g,"")),o.push(r)}),e.push(o))}),new jspdf.jsPDF("landscape","mm","a4"));r.autoTable({head:[o],body:e}),window.open(r.output("bloburl"))}}formsAngular.directive("ngTotalCell",["$compile","$domUtilityService",function(n,t){return{scope:!1,compile:function(){return{pre:function(e,r){var t=e.col.cellTemplate.match(/{{COL_FIELD \|(.+)}}/),t=t?e.col.cellTemplate.replace("COL_FIELD |"+t[1],'getTotalVal("'+e.col.field+'","'+t[1]+'")'):e.col.cellTemplate.replace(COL_FIELD,'getTotalVal("'+e.col.field+'")'),o=e.col.enableCellEdit?(o=(o=e.col.cellEditTemplate).replace(DISPLAY_CELL_TEMPLATE,t)).replace(EDITABLE_CELL_TEMPLATE,e.col.editableCellTemplate.replace(COL_FIELD,"row.entity."+e.col.field)):t,t=n(o)(e);e.enableCellSelection&&-1===t[0].className.indexOf("ngSelectionCell")&&(t[0].setAttribute("tabindex",0),t.addClass("ngCellElement")),r.append(t)},post:function(e,r){e.enableCellSelection&&e.domAccessProvider.selectionHandlers(e,r),e.$on("ngGridEventDigestCell",function(){t.digest(e)})}}}}}]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fng-reports",
3
- "version": "0.12.0-beta.230",
3
+ "version": "0.12.0-beta.232",
4
4
  "description": "Reporting plugin for forms-angular",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,7 +13,8 @@
13
13
  "reporting"
14
14
  ],
15
15
  "scripts": {
16
- "test": "grunt build"
16
+ "test": "echo Error - no tests specified - there is one that needs fixing",
17
+ "brokenTest": "grunt build"
17
18
  },
18
19
  "author": "Mark Chapman <support@forms-angular.org>",
19
20
  "license": "MIT",
@@ -32,7 +33,7 @@
32
33
  "angular-messages": "1.8.3",
33
34
  "angular-mocks": "1.8.3",
34
35
  "angular-sanitize": "1.8.3",
35
- "forms-angular": "file:../forms-angular/forms-angular-0.12.0-beta.230.tgz",
36
+ "forms-angular": "file:../forms-angular/forms-angular-0.12.0-beta.232.tgz",
36
37
  "grunt": "^1.5.3",
37
38
  "grunt-autoprefixer": "3.0.4",
38
39
  "grunt-concurrent": "3.0.0",
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- formsAngular.controller('AnalysisCtrl', ['$rootScope', '$window', '$filter', '$scope', '$http', '$location', 'CssFrameworkService', 'RoutingService',
4
- function ($rootScope, $window, $filter, $scope, $http, $location, CssFrameworkService, RoutingService) {
3
+ formsAngular.controller('AnalysisCtrl', ['$rootScope', '$window', '$q', '$filter', '$scope', '$http', '$location', 'CssFrameworkService', 'RoutingService', 'uiGridConstants',
4
+ function ($rootScope, $window, $q, $filter, $scope, $http, $location, CssFrameworkService, RoutingService, uiGridConstants) {
5
5
  /*jshint newcap: false */
6
6
  var firstTime = true,
7
7
  pdfPlugIn = new ngGridPdfExportPlugin({inhibitButton: true}),
@@ -11,20 +11,19 @@ formsAngular.controller('AnalysisCtrl', ['$rootScope', '$window', '$filter', '$s
11
11
  angular.extend($scope, RoutingService.parsePathFunc()($location.$$path));
12
12
 
13
13
  $scope.reportSchema = {
14
- columnDefs: []
14
+ columnDefs: [
15
+ { name: 'dummy', field: 'dummy' },
16
+ ]
15
17
  };
16
18
  $scope.gridOptions = {
19
+ enableFiltering: false,
17
20
  data: 'report',
18
21
  columnDefs: $scope.reportSchema.columnDefs,
19
22
  showColumnMenu: true,
20
23
  enableRowHeaderSelection: false,
21
- enableFiltering: false,
22
- showGridFooter: false,
23
24
  reallyShowFooter: false, // this determines whether it is actually displayed or not
24
25
  showTotals: true,
25
26
  enableColumnResizing: true,
26
- // enableColumnReordering: true,
27
- // jqueryUIDraggable: true,
28
27
  footerRowHeight: 65,
29
28
  multiSelect: false,
30
29
  plugins: [pdfPlugIn, csvPlugIn],
@@ -205,7 +204,7 @@ ${e.message}`);
205
204
  }
206
205
  var dateTest = /^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3})(Z|[+ -]\d{4})$/.exec(thisPart.value);
207
206
  if (dateTest) {
208
- thisPart.value = new Date(dateTest[1]);
207
+ thisPart.value = new Date(dateTest[0]);
209
208
  }
210
209
  $scope.record[param] = thisPart.value;
211
210
  }
@@ -248,10 +247,38 @@ ${e.message}`);
248
247
  $scope.refreshQuery = function () {
249
248
 
250
249
  function substituteParams(str) {
251
- return str.replace(/\|.+?\|/g, function (match) {
252
- var param = match.slice(1, -1);
253
- var isParamTest = /\((.+)\)/.exec(param);
254
- return isParamTest ? $scope.reportSchema.params[isParamTest[1]].value : '';
250
+ return $q(function (resolve) {
251
+ let promises = [];
252
+ str.replace(/\|.+?\|/g, function (match) {
253
+ var param = match.slice(1, -1);
254
+ var isParamTest = /\((.+)\)/.exec(param);
255
+ if (isParamTest[1]) {
256
+ const paramValue = $scope.reportSchema.params[isParamTest[1]].value;
257
+ if (isParamTest.index > 0) {
258
+ // We have a title function to run
259
+ promises.push($http.get(`/api/${'organisation'}/${paramValue}/list`).then(function (response) {
260
+ if (response && response.status === 200 && response.data) {
261
+ return response.data.list;
262
+ } else {
263
+ return '';
264
+ }
265
+ }));
266
+ } else {
267
+ promises.push(paramValue);
268
+ }
269
+ } else {
270
+ promises.push('');
271
+ }
272
+ return match;
273
+ });
274
+ Promise.all(promises).then(function (results) {
275
+ let index = 0;
276
+ resolve(str.replace(/\|.+?\|/g, function () {
277
+ let retVal = results[index];
278
+ index += 1;
279
+ return retVal;
280
+ }));
281
+ });
255
282
  });
256
283
  }
257
284
 
@@ -303,13 +330,18 @@ ${e.message}`);
303
330
  $scope.report = data.report;
304
331
  $scope.reportSchema = data.schema;
305
332
  $scope.reportSchema.title = $scope.reportSchema.title || $scope.modelName;
306
- $scope.titleWithSubstitutions = substituteParams($scope.reportSchema.title);
333
+ substituteParams($scope.reportSchema.title)
334
+ .then(function (str) {
335
+ $scope.titleWithSubstitutions = str;
336
+ });
307
337
  $scope.gridOptions.enableFiltering = !!$scope.reportSchema.filter;
308
338
  if (navScope && navScope.items) {
309
339
  navScope.items.length = 2;
310
340
  if ($scope.reportSchema.menu) {
311
341
  $scope.reportSchema.menu.forEach(function (m) {
312
- navScope.items.push(JSON.parse(substituteParams(JSON.stringify(m))));
342
+ substituteParams(JSON.stringify(m)).then(function (str) {
343
+ navScope.items.push(JSON.parse(str));
344
+ });
313
345
  });
314
346
  }
315
347
  }
@@ -322,19 +354,25 @@ ${e.message}`);
322
354
  firstTime = false;
323
355
 
324
356
  $scope.$watch('reportSchema.columnDefs', function (newValue) {
325
- var columnTotals = false;
357
+ // var columnTotals = false;
326
358
  if (newValue) {
327
- for (var i = 0; i < newValue.length; i++) {
328
- if (newValue[i].totalsRow) {
329
- columnTotals = true;
330
- }
331
- if (newValue[i].align) {
332
- var alignClass = 'fng-' + newValue[i].align;
333
- newValue[i].cellClass = newValue[i].cellClass || '';
334
- if (newValue[i].cellClass.indexOf(alignClass) === -1) {
335
- newValue[i].cellClass = newValue[i].cellClass + ' ' + alignClass;
359
+ $scope.gridOptions.columnDefs.length = 0;
360
+ for (const colDef of newValue) {
361
+ if (colDef.align) {
362
+ var alignClass = 'fng-' + colDef.align;
363
+ colDef.cellClass = colDef.cellClass || '';
364
+ if (colDef.cellClass.indexOf(alignClass) === -1) {
365
+ colDef.cellClass = colDef.cellClass + ' ' + alignClass;
336
366
  }
337
367
  }
368
+ if (colDef.aggregationTypeStr) {
369
+ $scope.gridOptions.showColumnFooter = true;
370
+ colDef.aggregationType = uiGridConstants.aggregationTypes[colDef.aggregationTypeStr];
371
+ colDef.aggregationHideLabel = colDef.aggregationTypeStr === 'sum';
372
+ colDef.footerCellFilter = colDef.cellFilter;
373
+ colDef.footerCellClass = colDef.cellClass;
374
+ }
375
+ $scope.gridOptions.columnDefs.push(colDef);
338
376
  }
339
377
  // Auto-upgrade from ng-grid to ui-grid
340
378
  newValue.forEach(function (def) {
@@ -343,11 +381,7 @@ ${e.message}`);
343
381
  def.width = parseInt(def.width.slice(0, -2));
344
382
  }
345
383
  });
346
- $scope.gridOptions.columnDefs = newValue;
347
384
  }
348
- $scope.gridOptions.showTotals = columnTotals;
349
- $scope.gridOptions.reallyShowFooter = columnTotals;
350
- $scope.gridOptions.footerRowHeight = 55 + (columnTotals ? 10 : 0);
351
385
  }, true);
352
386
 
353
387
  if (!$scope.paramSchema && data.schema.params) {
@@ -390,7 +424,7 @@ ${e.message}`);
390
424
  });
391
425
 
392
426
  // Error handling, stolen quickly from forms-angular record-handler
393
- $scope.showError = function(error, alertTitle) {
427
+ $scope.showError = function (error, alertTitle) {
394
428
  $scope.alertTitle = alertTitle ? alertTitle : 'Error!';
395
429
  if (typeof error === 'string') {
396
430
  $scope.errorMessage = error;
@@ -407,7 +441,7 @@ ${e.message}`);
407
441
  $scope.errorMessage = error;
408
442
  }
409
443
  }
410
- $scope.errorHideTimer = window.setTimeout(function() {
444
+ $scope.errorHideTimer = window.setTimeout(function () {
411
445
  $scope.dismissError();
412
446
  $scope.$digest();
413
447
  }, 3500 + (1000 * ($scope.alertTitle + $scope.errorMessage).length / 50));
@@ -417,21 +451,21 @@ ${e.message}`);
417
451
  });
418
452
  };
419
453
 
420
- $scope.clearTimeout = function() {
454
+ $scope.clearTimeout = function () {
421
455
  if ($scope.errorHideTimer) {
422
456
  clearTimeout($scope.errorHideTimer);
423
457
  delete $scope.errorHideTimer;
424
458
  }
425
459
  };
426
460
 
427
- $scope.dismissError = function() {
461
+ $scope.dismissError = function () {
428
462
  $scope.clearTimeout;
429
463
  $scope.errorVisible = false;
430
464
  delete $scope.errorMessage;
431
465
  delete $scope.alertTitle;
432
466
  };
433
467
 
434
- $scope.stickError = function() {
468
+ $scope.stickError = function () {
435
469
  clearTimeout($scope.errorHideTimer);
436
470
  };
437
471
 
@@ -8,6 +8,7 @@ module.exports = function(config) {
8
8
  'node_modules/angular-animate/angular-animate.js',
9
9
  'node_modules/angular-mocks/angular-mocks.js',
10
10
  'node_modules/angular-messages/angular-messages.js',
11
+ 'node_modules/angular-ui-grid/ui-grid.js',
11
12
  'node_modules/jspdf/dist/jspdf.umd.js',
12
13
  'node_modules/forms-angular/dist/client/forms-angular.js',
13
14
  'node_modules/ng-infinite-scroll/build/ng-infinite-scroll.js',