npm additions, code fixes and env variables added
This commit is contained in:
parent
51097bc09f
commit
620282e9ac
6 changed files with 7320 additions and 77 deletions
|
@ -26,7 +26,8 @@
|
||||||
"environmentSource": "environments/environment.ts",
|
"environmentSource": "environments/environment.ts",
|
||||||
"environments": {
|
"environments": {
|
||||||
"dev": "environments/environment.ts",
|
"dev": "environments/environment.ts",
|
||||||
"prod": "environments/environment.prod.ts"
|
"prod": "environments/environment.prod.ts",
|
||||||
|
"local": "environments/environment.local.ts"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
7246
package-lock.json
generated
Normal file
7246
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,13 +1,14 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Http } from '@angular/http';
|
import { Http } from '@angular/http';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
import { environment } from '../../environments/environment';
|
||||||
import 'rxjs/add/operator/map';
|
import 'rxjs/add/operator/map';
|
||||||
|
|
||||||
/* this provider handles the interaction between server and client */
|
/* this provider handles the interaction between server and client */
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ApiService {
|
export class ApiService {
|
||||||
private apiUrl = 'https://dev.peartrade.org/api';
|
private apiUrl = environment.apiUrl;
|
||||||
private sessionKey: string = null;
|
private sessionKey: string = null;
|
||||||
constructor(
|
constructor(
|
||||||
private http: Http,
|
private http: Http,
|
||||||
|
@ -120,82 +121,66 @@ export class ApiService {
|
||||||
percentlocalsuppliersvscompetitor : true,
|
percentlocalsuppliersvscompetitor : true,
|
||||||
},
|
},
|
||||||
"snippets" :
|
"snippets" :
|
||||||
{
|
|
||||||
customersthismonth: false,
|
|
||||||
moneyspentthismonth: true,
|
|
||||||
pointstotal: true,
|
|
||||||
averagetransactiontoday: false,
|
|
||||||
percentownlocalsupplier : true,
|
|
||||||
percentsinglecompetitorlocalsupplier : true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"data" :
|
|
||||||
"graphs" :
|
|
||||||
{
|
{
|
||||||
"customersthisweek" :
|
customersthismonth: false,
|
||||||
{
|
moneyspentthismonth: true,
|
||||||
day : ['Monday', 'tuesday','wednesday','thursday','friday','saturday','sunday'],
|
pointstotal: true,
|
||||||
customerno : [1,2,3,4,5,6,7],
|
averagetransactiontoday: false,
|
||||||
returningcustomerno : [1,1,2,3,4,5,4],
|
percentownlocalsupplier : true,
|
||||||
totalcustomerno:
|
percentsinglecompetitorlocalsupplier : true,
|
||||||
},
|
|
||||||
"customerslastweek" :
|
|
||||||
{
|
|
||||||
day : ['Monday', 'tuesday','wednesday','thursday','friday','saturday','sunday'],
|
|
||||||
customerno : [7,6,5,4,3,2,1],
|
|
||||||
returningcustomerno : [3,4,5,4,3,2,1],
|
|
||||||
},
|
|
||||||
// can take differing size arrays, so any month works. Example here is for April
|
|
||||||
"customerslastmonth" :
|
|
||||||
{
|
|
||||||
day : ['April 1','April 2','April 3','April 4','April 5','April 6','April 7','April 8',
|
|
||||||
'April 9','April 10','April 11','April 12','April 13','April 14','April 15','April 16',
|
|
||||||
'April 17','April 18','April 19','April 20','April 21','April 22','April 23','April 24',
|
|
||||||
'April 25','April 26','April 27','April 28','April 29','April 30'],
|
|
||||||
customerno : [7,6,5,4,3,2,1,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],
|
|
||||||
returningcustomerno : [4,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],
|
|
||||||
},
|
|
||||||
"customerslastyear" :
|
|
||||||
{
|
|
||||||
month : ['January','February','March','April','May','June','July','August','September','October','November','December'],
|
|
||||||
customerno : [7,6,5,4,3,2,1,8,9,10,11,12],
|
|
||||||
returningcustomerno : [3,2,4,2,1,1,1,6,4,8,5,12],
|
|
||||||
},
|
|
||||||
// If the number is potential or actual customers in their sector has yet to be determined
|
|
||||||
"customersinsector" :
|
|
||||||
{
|
|
||||||
percent : 76,
|
|
||||||
customerno : 34000,
|
|
||||||
},
|
|
||||||
"pointsthisweek" :
|
|
||||||
{
|
|
||||||
day : ['Monday', 'tuesday','wednesday','thursday','friday','saturday','sunday'],
|
|
||||||
points : [1,2,3,4,5,6,7],
|
|
||||||
},
|
|
||||||
"pointslastweek" :
|
|
||||||
{
|
|
||||||
day : ['Monday', 'tuesday','wednesday','thursday','friday','saturday','sunday'],
|
|
||||||
points : [1,2,3,4,5,6,7],
|
|
||||||
},
|
|
||||||
"localsuppliers" :
|
|
||||||
{
|
|
||||||
percentownlocal : 50,
|
|
||||||
percentsinglecompetitorlocal : 65,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
"snippets" :
|
},
|
||||||
|
"data" :
|
||||||
{
|
{
|
||||||
"customersinsector" :
|
"customersthisweek" :
|
||||||
{
|
{
|
||||||
percent : 76,
|
day : ['Monday', 'tuesday','wednesday','thursday','friday','saturday','sunday'],
|
||||||
customerno : 34000,
|
customerno : [1,2,3,4,5,6,7],
|
||||||
},
|
returningcustomerno : [1,1,2,3,4,5,4],
|
||||||
"localsuppliers" :
|
},
|
||||||
{
|
"customerslastweek" :
|
||||||
percentownlocal : 50,
|
{
|
||||||
percentsinglecompetitorlocal : 65,
|
day : ['Monday', 'tuesday','wednesday','thursday','friday','saturday','sunday'],
|
||||||
},
|
customerno : [7,6,5,4,3,2,1],
|
||||||
|
returningcustomerno : [3,4,5,4,3,2,1],
|
||||||
|
},
|
||||||
|
// can take differing size arrays, so any month works. Example here is for April
|
||||||
|
"customerslastmonth" :
|
||||||
|
{
|
||||||
|
day : ['April 1','April 2','April 3','April 4','April 5','April 6','April 7','April 8',
|
||||||
|
'April 9','April 10','April 11','April 12','April 13','April 14','April 15','April 16',
|
||||||
|
'April 17','April 18','April 19','April 20','April 21','April 22','April 23','April 24',
|
||||||
|
'April 25','April 26','April 27','April 28','April 29','April 30'],
|
||||||
|
customerno : [7,6,5,4,3,2,1,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30],
|
||||||
|
returningcustomerno : [4,5,4,3,2,1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],
|
||||||
|
},
|
||||||
|
"customerslastyear" :
|
||||||
|
{
|
||||||
|
month : ['January','February','March','April','May','June','July','August','September','October','November','December'],
|
||||||
|
customerno : [7,6,5,4,3,2,1,8,9,10,11,12],
|
||||||
|
returningcustomerno : [3,2,4,2,1,1,1,6,4,8,5,12],
|
||||||
|
},
|
||||||
|
// If the number is potential or actual customers in their sector has yet to be determined
|
||||||
|
"customersinsector" :
|
||||||
|
{
|
||||||
|
percent : 76,
|
||||||
|
customerno : 34000,
|
||||||
|
},
|
||||||
|
"pointsthisweek" :
|
||||||
|
{
|
||||||
|
day : ['Monday', 'tuesday','wednesday','thursday','friday','saturday','sunday'],
|
||||||
|
points : [1,2,3,4,5,6,7],
|
||||||
|
},
|
||||||
|
"pointslastweek" :
|
||||||
|
{
|
||||||
|
day : ['Monday', 'tuesday','wednesday','thursday','friday','saturday','sunday'],
|
||||||
|
points : [1,2,3,4,5,6,7],
|
||||||
|
},
|
||||||
|
"localsuppliers" :
|
||||||
|
{
|
||||||
|
percentownlocal : 50,
|
||||||
|
percentsinglecompetitorlocal : 65,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
9
src/environments/environment.local.ts
Normal file
9
src/environments/environment.local.ts
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
// The file contents for the current environment will overwrite these during build.
|
||||||
|
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
|
||||||
|
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
|
||||||
|
// The list of which env maps to which file can be found in `angular-cli.json`.
|
||||||
|
|
||||||
|
export const environment = {
|
||||||
|
production: false,
|
||||||
|
apiUrl: 'http://192.168.2.156:3000/api'
|
||||||
|
};
|
|
@ -1,3 +1,4 @@
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: true
|
production: true,
|
||||||
|
apiUrl: 'http://app.peartrade.org/api'
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,5 +4,6 @@
|
||||||
// The list of which env maps to which file can be found in `angular-cli.json`.
|
// The list of which env maps to which file can be found in `angular-cli.json`.
|
||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
production: false
|
production: false,
|
||||||
|
apiUrl: 'http://dev.peartrade.org/api'
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue