Automatic lint

This commit is contained in:
Ben Goldsworthy 2021-03-20 23:47:48 +00:00
parent 9bbf6af75c
commit 06dfb7947b
16 changed files with 272 additions and 273 deletions

View file

@ -1,5 +1,5 @@
import { LoginPageObject } from './login.po';
import { browser } from "protractor";
import { browser } from 'protractor';
describe('Login Page', () => {
let page: LoginPageObject;

View file

@ -91,7 +91,7 @@ export class AddDataComponent implements OnInit {
}
private setCategoryList(data: any) {
let halfLength = Math.floor(data.length / 2);
const halfLength = Math.floor(data.length / 2);
this.leftCategoryList = data.splice(0, halfLength);
this.rightCategoryList = data;
}

View file

@ -9,10 +9,10 @@ import * as moment from 'moment';
})
export class CategoryMonthComponent implements OnInit {
disableCategoryButton1: boolean = false;
disableCategoryButton2: boolean = false;
disableCategoryButton3: boolean = false;
disableCategoryButton4: boolean = false;
disableCategoryButton1 = false;
disableCategoryButton2 = false;
disableCategoryButton3 = false;
disableCategoryButton4 = false;
weekPurchaseList = {
first: 0,
@ -22,14 +22,14 @@ export class CategoryMonthComponent implements OnInit {
weekList2 = [];
weekList3 = [];
weekList4 = [];
weekListValueSum1: number = 0;
weekListValueSum2: number = 0;
weekListValueSum3: number = 0;
weekListValueSum4: number = 0;
weekEssential1: number = 0;
weekEssential2: number = 0;
weekEssential3: number = 0;
weekEssential4: number = 0;
weekListValueSum1 = 0;
weekListValueSum2 = 0;
weekListValueSum3 = 0;
weekListValueSum4 = 0;
weekEssential1 = 0;
weekEssential2 = 0;
weekEssential3 = 0;
weekEssential4 = 0;
dayList: any[] = [];
valueList: number[] = [];
@ -37,10 +37,10 @@ export class CategoryMonthComponent implements OnInit {
myWeek2: any;
myWeek3: any;
myWeek4: any;
categoryLimit1: number = 6;
categoryLimit2: number = 6;
categoryLimit3: number = 6;
categoryLimit4: number = 6;
categoryLimit1 = 6;
categoryLimit2 = 6;
categoryLimit3 = 6;
categoryLimit4 = 6;
constructor(
private api: ApiService,

View file

@ -28,9 +28,9 @@ export class DashboardCustomerComponent implements OnInit {
trends: any;
myRank: any;
username: any;
maxPurchase: number = 0;
maxPurchase = 0;
disableCategoryButton: boolean = false;
disableCategoryButton = false;
public bootstrapColours: string[] = ['bg-primary', 'bg-secondary', 'bg-success',
'bg-danger', 'bg-warning', 'bg-info'];
@ -93,7 +93,7 @@ export class DashboardCustomerComponent implements OnInit {
}],
}
};
public barChartTypeEssential:string = 'horizontalBar';
public barChartTypeEssential = 'horizontalBar';
public barChartOptionsCategory: any = {
scaleShowVerticalLines: false,
@ -114,8 +114,8 @@ export class DashboardCustomerComponent implements OnInit {
},
},
};
public barChartTypeCategory:string = 'bar';
public barChartLegendCategory:boolean = false;
public barChartTypeCategory = 'bar';
public barChartLegendCategory = false;
public barChartDataCategory: any[] = [];
public barChartLabelsCategory: string[] = [];
public barChartColoursCategory: any[] = [
@ -144,8 +144,8 @@ export class DashboardCustomerComponent implements OnInit {
count: 0,
};
showTotalCategoryList: boolean = false;
totalCategoryLimit: number = 10;
showTotalCategoryList = false;
totalCategoryLimit = 10;
totalCategoryList: any[] = [];
@ -212,13 +212,13 @@ export class DashboardCustomerComponent implements OnInit {
private setChartData(dataCat: any) {
this.barChartLabelsCategory = Object.keys(dataCat);
let barChartDataCategoryInitial = Object.keys(dataCat).map(key => dataCat[key]);
const barChartDataCategoryInitial = Object.keys(dataCat).map(key => dataCat[key]);
this.barChartDataCategory = [
{data: barChartDataCategoryInitial, label: 'Series A'},
];
this.showCategoryBarChart = true;
if (this.weekList1) {
let doughnutChartDataCategoryInitial = this.weekList1.map(function(a) {return a.value;});
const doughnutChartDataCategoryInitial = this.weekList1.map(function(a) {return a.value; });
this.doughnutChartDataCategory = [
{data: doughnutChartDataCategoryInitial, label: 'Series A'},
];
@ -269,8 +269,8 @@ export class DashboardCustomerComponent implements OnInit {
}
private tooltipLabelCallback(tooltipItem: any, data: any) {
var dataset = data.datasets[tooltipItem.datasetIndex];
var value = dataset.data[tooltipItem.index];
const dataset = data.datasets[tooltipItem.datasetIndex];
const value = dataset.data[tooltipItem.index];
return this.currencyPipe.transform(value, 'GBP', 'symbol', '1.2-2');
}

View file

@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { Router, NavigationEnd } from "@angular/router";
import { Router, NavigationEnd } from '@angular/router';
import { CurrencyPipe } from '@angular/common';
import { ChartOptions, ChartType, ChartDataSets } from 'chart.js';
import { Color, Label } from 'ng2-charts';
@ -75,7 +75,7 @@ export class DashboardComponent {
*/
];
disableCategoryButton: boolean = false;
disableCategoryButton = false;
public bootstrapColours: string[] = ['bg-primary', 'bg-secondary', 'bg-success',
'bg-danger', 'bg-warning', 'bg-info'];
@ -118,7 +118,7 @@ export class DashboardComponent {
public purchaseNotEssential: number;
public purchaseEssential: number;
public showEssentialBarChart:boolean = false;
public showEssentialBarChart = false;
public showCategoryBarChart = false;
public showCategoryDoughnutChart = false;
@ -138,7 +138,7 @@ export class DashboardComponent {
}]
}
};
public barChartTypeEssential:string = 'horizontalBar';
public barChartTypeEssential = 'horizontalBar';
public barChartColoursCategory: any[] = [
{
backgroundColor: [
@ -175,8 +175,8 @@ export class DashboardComponent {
},
},
};
public barChartTypeCategory:string = 'bar';
public barChartLegendCategory:boolean = false;
public barChartTypeCategory = 'bar';
public barChartLegendCategory = false;
public barChartDataCategory: any[] = [];
public barChartLabelsCategory: string[] = [];
@ -246,8 +246,8 @@ export class DashboardComponent {
count: 0,
};
showTotalCategoryList: boolean = false;
totalCategoryLimit: number = 10;
showTotalCategoryList = false;
totalCategoryLimit = 10;
totalCategoryList: any[] = [];
constructor(
@ -296,13 +296,13 @@ export class DashboardComponent {
private setChartDataCat(dataCat: any) {
this.barChartLabelsCategory = Object.keys(dataCat);
let barChartDataCategoryInitial = Object.keys(dataCat).map(key => dataCat[key]);
const barChartDataCategoryInitial = Object.keys(dataCat).map(key => dataCat[key]);
this.barChartDataCategory = [
{data: barChartDataCategoryInitial, label: 'Series A'},
];
this.showCategoryBarChart = true;
if (this.weekList1) {
let doughnutChartDataCategoryInitial = this.weekList1.map(function(a) {return a.value;});
const doughnutChartDataCategoryInitial = this.weekList1.map(function(a) {return a.value; });
this.doughnutChartDataCategory = [
{data: doughnutChartDataCategoryInitial, label: 'Series A'},
];
@ -357,8 +357,8 @@ export class DashboardComponent {
}
private tooltipLabelCallback(tooltipItem: any, data: any) {
var dataset = data.datasets[tooltipItem.datasetIndex];
var value = dataset.data[tooltipItem.index];
const dataset = data.datasets[tooltipItem.datasetIndex];
const value = dataset.data[tooltipItem.index];
return this.currencyPipe.transform(value, 'GBP', 'symbol', '1.2-2');
}

View file

@ -26,6 +26,7 @@ export class LeaderboardComponent implements OnInit {
currentPage: 1,
totalItems: 0
};
org
constructor(
private api: ApiService,
@ -70,8 +71,7 @@ export class LeaderboardComponent implements OnInit {
console.log(error);
}
);
}org
}
// // dynamically changes the row style based on player's position
// // for instance, top three player and the player him/herself should
// // be hightlighted

View file

@ -10,13 +10,13 @@ import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';
})
export class MapComponent implements OnInit, AfterViewInit {
@ViewChild('statusModal', { static: true }) myStatusModal: ModalDirective;
lat: number = 54.0466;
lng: number = -2.8007;
zoom: number = 12;
lat = 54.0466;
lng = -2.8007;
zoom = 12;
public modalRef: BsModalRef;
clickedMarker: any;
dataReceived: string = 'loading';
dataReceived = 'loading';
markers: Array<{latitude: number, longitude: number, name: string}>;
@ -48,9 +48,9 @@ export class MapComponent implements OnInit, AfterViewInit {
}
public viewBoundsChanged() {
console.log("finding bounds");
console.log('finding bounds');
const resp = this.map.getBounds();
console.log("found bounds");
console.log('found bounds');
console.log(resp.getNorthEast().lat());
console.log(resp.getNorthEast().lng());
console.log(resp.getSouthWest().lat());

View file

@ -2,7 +2,7 @@ import {Component, OnInit, Input, Output, EventEmitter, ViewChild} from '@angula
import {ApiService} from '../providers/api-service';
import {BaseChartDirective} from 'ng2-charts';
import {CurrencyPipe} from '@angular/common';
import {ChartType} from "chart.js";
import {ChartType} from 'chart.js';
import * as moment from 'moment';
@Component({
@ -16,75 +16,20 @@ export class MoreStuffComponent implements OnInit {
filterFrom: any;
filterTo: any;
isBubbleChartLoaded: boolean = false;
isSupplierChartLoaded: boolean = false;
isBubbleChartLoaded = false;
isSupplierChartLoaded = false;
wardList: any;
wardListAvailable = false;
metaTypeList: any;
metaTypeListAvailable = false;
constructor(
private api: ApiService,
private currencyPipe: CurrencyPipe,
) {
let now = moment();
this.filterTo = now.format('YYYY-MM-DD');
now.subtract(1, 'months');
this.filterFrom = now.format('YYYY-MM-DD');
this.tableSummary();
}
ngOnInit(): void {
this.loadData();
}
public loadData() {
this.tableSummary();
this.loadYearSpend();
this.loadSupplierBubble();
this.loadSupplierHistory();
}
public showLegend = true;
/*
* Supplier Bubble Chart Setup
*/
private formatGraphData(data: any): any[] {
let graph_data = [];
data.data.map(item => {
graph_data.push({
t: item.date,
r: item.value > 1000000 ? (item.value / 200000) : (item.value / 100000) + 5,
supplier: item.seller,
y: item.count,
value: item.value,
count: item.count,
});
});
return graph_data;
}
private loadSupplierBubble() {
this.api.loadMiscUrl('organisation/external/supplier_count', {
from: this.filterFrom,
to: this.filterTo,
}).subscribe(
result => {
this.supplierBubbleChartData[0].data = this.formatGraphData(result);
this.isBubbleChartLoaded = true;
}
)
}
public supplierBubbleChartType: ChartType = 'bubble';
public supplierBubbleChartData: any[] = [
{
data: [],
label: ["Spend"],
label: ['Spend'],
borderColor: 'blue',
hoverBorderColor: 'black',
radius: 5,
@ -120,9 +65,160 @@ export class MoreStuffComponent implements OnInit {
},
};
public yearSpendChartData: any[] = [
{
data: [],
label: ['Value £'],
fill: false,
borderColor: 'red',
hoverBackgroundColor: '#ffa1b5',
hoverBorderColor: 'red',
yAxisID: 'y-value',
},
{
data: [],
label: ['Count'],
fill: false,
borderColor: 'blue',
hoverBackgroundColor: '#52afed',
hoverBorderColor: 'blue',
yAxisID: 'y-count',
},
];
public yearSpendChartOptions: any = {
elements: {line: {tension: 0}},
responsive: true,
scales: {
xAxes: [{
type: 'time',
time: {
unit: 'month'
},
scaleLabel: {
display: true,
labelString: 'Date'
}
}],
yAxes: [
{id: 'y-value', position: 'left', beginAtZero: true, type: 'linear'},
{id: 'y-count', position: 'right', beginAtZero: true, type: 'linear'},
]
},
};
public yearSpendChartLabels: string[] = [];
public yearSpendChartType: ChartType = 'line';
@ViewChild('supplierChart', { read: BaseChartDirective }) supplierChart: BaseChartDirective;
private _supplierHistoryData: any[];
private _supplierHistoryPerPage = 15;
public _supplierHistoryPage = 1;
public _supplierHistoryPages = 1;
public supplierMonthChartData: any[] = [
{
data: [],
label: ['3 Month'],
fill: false,
borderColor: 'red',
hoverBorderColor: 'red',
hoverBackgroundColor: 'red',
},
{
data: [],
label: ['6 Month'],
fill: false,
borderColor: 'blue',
hoverBorderColor: 'blue',
hoverBackgroundColor: 'blue',
},
{
data: [],
label: ['12 Month'],
fill: false,
borderColor: 'orange',
hoverBorderColor: 'orange',
hoverBackgroundColor: 'orange',
},
];
public supplierMonthChartOptions: any = {
// maintainAspectRatio: false,
responsive: true,
scales: {
xAxes: [{
scaleLabel: {
display: true,
labelString: 'Spend amount £'
}
}],
yAxes: [{
scaleLabel: {
display: true,
labelString: 'Supplier Names'
}
}]
},
};
public supplierMonthChartLabels: string[] = [];
public supplierMonthChartType: ChartType = 'horizontalBar';
constructor(
private api: ApiService,
private currencyPipe: CurrencyPipe,
) {
const now = moment();
this.filterTo = now.format('YYYY-MM-DD');
now.subtract(1, 'months');
this.filterFrom = now.format('YYYY-MM-DD');
this.tableSummary();
}
ngOnInit(): void {
this.loadData();
}
public loadData() {
this.tableSummary();
this.loadYearSpend();
this.loadSupplierBubble();
this.loadSupplierHistory();
}
/*
* Supplier Bubble Chart Setup
*/
private formatGraphData(data: any): any[] {
const graph_data = [];
data.data.map(item => {
graph_data.push({
t: item.date,
r: item.value > 1000000 ? (item.value / 200000) : (item.value / 100000) + 5,
supplier: item.seller,
y: item.count,
value: item.value,
count: item.count,
});
});
return graph_data;
}
private loadSupplierBubble() {
this.api.loadMiscUrl('organisation/external/supplier_count', {
from: this.filterFrom,
to: this.filterTo,
}).subscribe(
result => {
this.supplierBubbleChartData[0].data = this.formatGraphData(result);
this.isBubbleChartLoaded = true;
}
)
}
private bubbleTooltipCallback(tooltipItem: any, data: any) {
let dataset = data.datasets[tooltipItem.datasetIndex];
let value = dataset.data[tooltipItem.index];
const dataset = data.datasets[tooltipItem.datasetIndex];
const value = dataset.data[tooltipItem.index];
return `${value.supplier}: ${this.currencyPipe.transform(value.value, 'GBP', 'symbol', '1.2-2')} over ${value.count} purchases`;
}
@ -154,8 +250,8 @@ export class MoreStuffComponent implements OnInit {
to: this.filterTo,
}).subscribe(
result => {
let value_data = [];
let count_data = [];
const value_data = [];
const count_data = [];
result.data.map(item => {
value_data.push({
@ -175,49 +271,6 @@ export class MoreStuffComponent implements OnInit {
)
}
public yearSpendChartData: any[] = [
{
data: [],
label: ["Value £"],
fill: false,
borderColor: 'red',
hoverBackgroundColor: '#ffa1b5',
hoverBorderColor: 'red',
yAxisID: 'y-value',
},
{
data: [],
label: ["Count"],
fill: false,
borderColor: 'blue',
hoverBackgroundColor: '#52afed',
hoverBorderColor: 'blue',
yAxisID: 'y-count',
},
];
public yearSpendChartOptions: any = {
elements: {line: {tension: 0}},
responsive: true,
scales: {
xAxes: [{
type: 'time',
time: {
unit: 'month'
},
scaleLabel: {
display: true,
labelString: 'Date'
}
}],
yAxes: [
{id: 'y-value', position: 'left', beginAtZero: true, type: 'linear'},
{id: 'y-count', position: 'right', beginAtZero: true, type: 'linear'},
]
},
};
public yearSpendChartLabels: string[] = [];
public yearSpendChartType: ChartType = 'line';
randomData() {
return Math.random();
}
@ -227,8 +280,6 @@ export class MoreStuffComponent implements OnInit {
}
@ViewChild('supplierChart', { read: BaseChartDirective }) supplierChart: BaseChartDirective;
private loadSupplierHistory() {
this.api.loadMiscUrl('organisation/external/supplier_history').subscribe(
result => {
@ -251,10 +302,10 @@ export class MoreStuffComponent implements OnInit {
const pageData = this._supplierHistoryData.slice(firstResult, lastResult);
console.log(pageData);
let labels = [];
let year = [];
let half = [];
let quarter = [];
const labels = [];
const year = [];
const half = [];
const quarter = [];
pageData.map(item => {
labels.push(item.name);
year.push(item.year_total);
@ -281,55 +332,4 @@ export class MoreStuffComponent implements OnInit {
}
this.updateSupplierHistoryData();
}
private _supplierHistoryData: any[];
private _supplierHistoryPerPage: number = 15;
public _supplierHistoryPage: number = 1;
public _supplierHistoryPages: number = 1;
public supplierMonthChartData: any[] = [
{
data: [],
label: ["3 Month"],
fill: false,
borderColor: 'red',
hoverBorderColor: 'red',
hoverBackgroundColor: 'red',
},
{
data: [],
label: ["6 Month"],
fill: false,
borderColor: 'blue',
hoverBorderColor: 'blue',
hoverBackgroundColor: 'blue',
},
{
data: [],
label: ["12 Month"],
fill: false,
borderColor: 'orange',
hoverBorderColor: 'orange',
hoverBackgroundColor: 'orange',
},
];
public supplierMonthChartOptions: any = {
//maintainAspectRatio: false,
responsive: true,
scales: {
xAxes: [{
scaleLabel: {
display: true,
labelString: 'Spend amount £'
}
}],
yAxes: [{
scaleLabel: {
display: true,
labelString: 'Supplier Names'
}
}]
},
};
public supplierMonthChartLabels: string[] = [];
public supplierMonthChartType: ChartType = 'horizontalBar';
}

View file

@ -39,10 +39,10 @@ export class PayrollLogComponent implements OnInit {
getMinDate() {
// gets the April 1st date of the current year
let aprilDate = moment().month(3).date(1);
let now = moment();
const aprilDate = moment().month(3).date(1);
const now = moment();
// Checks if current time is before April 1st, if so returns true
let beforeApril = now.isBefore(aprilDate);
const beforeApril = now.isBefore(aprilDate);
if ( beforeApril == true ) {
this.minDate = aprilDate.subtract(2, 'years').format('YYYY-MM-DD');
} else {

View file

@ -23,11 +23,11 @@ export class SendPushNotificationComponent implements OnInit {
this.topicList = result.topics;
this.topicIdList = Object.keys(this.topicList);
} else {
console.warn("No topics returned from server");
console.warn('No topics returned from server');
}
},
error => {
console.error("Couldn't get topics");
console.error('Couldn\'t get topics');
console.error(error._body);
}
);

View file

@ -11,7 +11,7 @@ import { FilterPipeModule } from 'ngx-filter-pipe';
export class SuppliersComponent implements OnInit, AfterViewInit {
@Output() public onClick = new EventEmitter();
@Input() public categories: any;
public perPage: number = 10;
public perPage = 10;
searchText: string;

View file

@ -10,16 +10,16 @@ import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service';
})
export class TrailMapComponent implements OnInit, AfterViewInit {
@ViewChild('statusModal', { static: true }) myStatusModal: ModalDirective;
lat: number = 54.0466;
lng: number = -2.8007;
zoom: number = 12;
lat = 54.0466;
lng = -2.8007;
zoom = 12;
public modalRef: BsModalRef;
public modalRef2: BsModalRef;
clickedMarker: any;
assocMap = 'lis';
assocLogo: string;
dataReceived: string = 'loading';
dataReceived = 'loading';
markers: Array<{latitude: number, longitude: number, name: string}>;
@ -57,9 +57,9 @@ export class TrailMapComponent implements OnInit, AfterViewInit {
}
public viewBoundsChanged() {
console.log("finding bounds");
console.log('finding bounds');
const resp = this.map.getBounds();
console.log("found bounds");
console.log('found bounds');
console.log(resp.getNorthEast().lat());
console.log(resp.getNorthEast().lng());
console.log(resp.getSouthWest().lat());

View file

@ -102,9 +102,9 @@ export class TransactionLogComponent implements OnInit {
}
editRecurringTransaction() {
let updatedTimeSubmit = moment(this.updatedTime, 'YYYY-MM-DD[T]HH:mm').local().format('YYYY-MM-DD[T]HH:mm:ss.SSSZ');
const updatedTimeSubmit = moment(this.updatedTime, 'YYYY-MM-DD[T]HH:mm').local().format('YYYY-MM-DD[T]HH:mm:ss.SSSZ');
this.clickedRecur.display_time = moment(this.updatedTime).format('llll');
let myParams = {
const myParams = {
category: (this.clickedRecur.category == 0 ? undefined : this.clickedRecur.category),
essential: this.clickedRecur.essential,
id: this.clickedRecur.id,
@ -138,7 +138,7 @@ export class TransactionLogComponent implements OnInit {
}
deleteRecurringTransaction() {
let myParams = {
const myParams = {
id: this.clickedRecur.id,
};
this.api

View file

@ -36,8 +36,7 @@ export class MessagingService {
this.angularFireMessaging.requestToken.subscribe((token) => {
this.api.checkDeviceToken({'token': token}).subscribe(
result => {
if (result.exists) { console.log('Device already registered!'); }
else {
if (result.exists) { console.log('Device already registered!'); } else {
this.api.addDeviceToken({'token': token, 'email': localStorage.getItem('email')}).subscribe(
result => {
console.log('Device registered successfully!');
@ -61,7 +60,7 @@ export class MessagingService {
receiveMessage() {
this.angularFireMessaging.messages.subscribe((message) => {
console.log('show message!', message);
let notification = new Notification(message.notification.title, { body: message.notification.body });
const notification = new Notification(message.notification.title, { body: message.notification.body });
this.currentMessage.next(message);
});
}