Blacked and isorted the python files
Prettied and eslinted the typescript/html files
This commit is contained in:
@ -1,20 +1,14 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'accounting'
|
||||
name: 'accounting',
|
||||
})
|
||||
export class AccountingPipe implements PipeTransform {
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
transform(value: string): string {
|
||||
if (value === null) {
|
||||
return '';
|
||||
}
|
||||
const amount = +(value.replace(new RegExp('(₹ )|(,)', 'g'), ''));
|
||||
return value.replace('-', '') + ((amount < 0) ? '\u00A0Cr' : '\u00A0Dr');
|
||||
const amount = +value.replace(new RegExp('(₹[s]*)|(,)', 'g'), '');
|
||||
return value.replace('-', '') + (amount < 0 ? '\u00A0Cr' : '\u00A0Dr');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
import {Pipe, PipeTransform} from '@angular/core';
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'clear'
|
||||
name: 'clear',
|
||||
})
|
||||
export class ClearPipe implements PipeTransform {
|
||||
|
||||
transform(value: any, args?: any): any {
|
||||
transform(value: any): any {
|
||||
return value === '₹ 0.00' || value === '0.00' ? '' : value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<h1 mat-dialog-title>{{data.title}}</h1>
|
||||
<h1 mat-dialog-title>{{ data.title }}</h1>
|
||||
<div mat-dialog-content>
|
||||
{{data.content}}
|
||||
{{ data.content }}
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button [mat-dialog-close]="false" cdkFocusInitial>Cancel</button>
|
||||
|
||||
@ -1,16 +1,14 @@
|
||||
import {Component, Inject} from '@angular/core';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-confirm-dialog',
|
||||
templateUrl: './confirm-dialog.component.html',
|
||||
styleUrls: ['./confirm-dialog.component.css']
|
||||
styleUrls: ['./confirm-dialog.component.css'],
|
||||
})
|
||||
export class ConfirmDialogComponent {
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ConfirmDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
}
|
||||
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
) {}
|
||||
}
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class CookieService {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
public getCookie(name: string) {
|
||||
const ca: Array<string> = document.cookie.split(';');
|
||||
const caLen: number = ca.length;
|
||||
@ -27,10 +24,11 @@ export class CookieService {
|
||||
this.setCookie(name, '', -1);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
public setCookie(name: string, value: string, expireDays: number, path: string = '') {
|
||||
const d: Date = new Date();
|
||||
d.setTime(d.getTime() + expireDays * 24 * 60 * 60 * 1000);
|
||||
const expires: string = 'expires=' + d.toUTCString();
|
||||
document.cookie = name + '=' + value + '; ' + expires + (path.length > 0 ? '; path=' + path : '');
|
||||
const expires = `expires=${d.toUTCString()}`;
|
||||
document.cookie = `${name}=${value}; ${expires}${path.length > 0 ? `; path=${path}` : ''}`;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
<img [src]="data" (click)="close()">
|
||||
<img [src]="data" (click)="close()" />
|
||||
|
||||
@ -1,20 +1,18 @@
|
||||
import {Component, Inject} from '@angular/core';
|
||||
import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-image-dialog',
|
||||
templateUrl: './image-dialog.component.html',
|
||||
styleUrls: ['./image-dialog.component.css']
|
||||
styleUrls: ['./image-dialog.component.css'],
|
||||
})
|
||||
export class ImageDialogComponent {
|
||||
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ImageDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
}
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
) {}
|
||||
|
||||
close(): void {
|
||||
this.dialogRef.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
import {Pipe, PipeTransform} from '@angular/core';
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import * as moment from 'moment';
|
||||
|
||||
@Pipe({
|
||||
name: 'localTime'
|
||||
name: 'localTime',
|
||||
})
|
||||
export class LocalTimePipe implements PipeTransform {
|
||||
|
||||
transform(value: string): string {
|
||||
if (value === undefined) {
|
||||
return '';
|
||||
}
|
||||
return moment(value, 'DD-MMM-YYYY HH:mm').subtract(new Date().getTimezoneOffset(), 'minutes').format('DD-MMM-YYYY HH:mm');
|
||||
return moment(value, 'DD-MMM-YYYY HH:mm')
|
||||
.subtract(new Date().getTimezoneOffset(), 'minutes')
|
||||
.format('DD-MMM-YYYY HH:mm');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,31 +1,23 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ConfirmDialogComponent } from './confirm-dialog/confirm-dialog.component';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { LocalTimePipe } from './local-time.pipe';
|
||||
import { ClearPipe } from './clear.pipe';
|
||||
|
||||
import { AccountingPipe } from './accounting.pipe';
|
||||
import { ClearPipe } from './clear.pipe';
|
||||
import { ConfirmDialogComponent } from './confirm-dialog/confirm-dialog.component';
|
||||
import { ImageDialogComponent } from './image-dialog/image-dialog.component';
|
||||
import { LocalTimePipe } from './local-time.pipe';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
MatButtonModule,
|
||||
MatDialogModule
|
||||
],
|
||||
imports: [CommonModule, MatButtonModule, MatDialogModule],
|
||||
declarations: [
|
||||
ConfirmDialogComponent,
|
||||
ImageDialogComponent,
|
||||
AccountingPipe,
|
||||
ClearPipe,
|
||||
LocalTimePipe
|
||||
LocalTimePipe,
|
||||
],
|
||||
exports: [
|
||||
AccountingPipe,
|
||||
ClearPipe,
|
||||
LocalTimePipe
|
||||
]
|
||||
exports: [AccountingPipe, ClearPipe, LocalTimePipe],
|
||||
})
|
||||
export class SharedModule {
|
||||
}
|
||||
export class SharedModule {}
|
||||
|
||||
@ -1,17 +1,16 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ToCsvService {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
toCsv(headers: any, data: any[]): string {
|
||||
const header = Object.keys(headers);
|
||||
const replacer = (key, value) => value === null ? '' : value;
|
||||
const csv = data.map(row => header.map(fieldName => JSON.stringify(row[headers[fieldName]], replacer)).join(','));
|
||||
const replacer = (key, value) => (value === null ? '' : value);
|
||||
const csv = data.map((row) =>
|
||||
header.map((fieldName) => JSON.stringify(row[headers[fieldName]], replacer)).join(','),
|
||||
);
|
||||
csv.unshift(header.join(','));
|
||||
return csv.join('\r\n');
|
||||
}
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
|
||||
const re = /((('[^']+'|"[^"]+"|[^\s]+)\s*:\s*('[^']+'|"[^"]+"|[^\s]+))|('[^']+'|"[^"]+"|[^\s]+))/g;
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TokenizerService {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
getMatches(input: string): string[] {
|
||||
input = input ? input : '';
|
||||
return input.match(re);
|
||||
}
|
||||
|
||||
getPairs(input: string[]): any[] {
|
||||
input = input ? input : [];
|
||||
return input.reduce((accumulator, item) => {
|
||||
let key,
|
||||
value;
|
||||
if (item.indexOf(':') === -1) {
|
||||
key = '';
|
||||
value = item;
|
||||
} else {
|
||||
key = item.substr(0, item.indexOf(':')).trim();
|
||||
value = item.substr(item.indexOf(':') + 1, item.length).trim();
|
||||
}
|
||||
if (key.indexOf('\'') !== -1 || key.indexOf('"') !== -1) {
|
||||
key = key.substring(1, key.length - 1).trim();
|
||||
}
|
||||
if (value.indexOf('\'') !== -1 || value.indexOf('"') !== -1) {
|
||||
value = value.substring(1, value.length - 1).trim();
|
||||
}
|
||||
if (value !== '') {
|
||||
accumulator.push({Key: key, Value: value});
|
||||
}
|
||||
return accumulator;
|
||||
}, []);
|
||||
}
|
||||
|
||||
isSort(key: string, value: string, sorter?: any): boolean {
|
||||
const isSort = (key === '' && value.length > 1 && '+-'.indexOf(value.charAt(0)) !== -1);
|
||||
return sorter !== null ? (isSort && value.substr(1) in sorter) : isSort;
|
||||
}
|
||||
getFilters(input: string[]) {
|
||||
// input.
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user