|
|
@@ -12,13 +12,13 @@ export type Index = 'EVI' | 'RVI4S1';
|
|
|
|
|
|
@Injectable({providedIn: 'root'})
|
|
|
export class CalculatorService {
|
|
|
+ AVAILABLE_PRODUCTS = ['EVI', 'RVI4S1'] as const;
|
|
|
+ SERVICE_BASE_URL = 'https://fieldcalc.lesprojekt.cz/' as const;
|
|
|
availableDates: Array<string>;
|
|
|
- availableProducts = ['EVI', 'RVI4S1'];
|
|
|
dateRangeSelects: Subject<{date: string}> = new Subject();
|
|
|
dateCalendarSelects: Subject<{date: string}> = new Subject();
|
|
|
selectedDate;
|
|
|
//selectedProduct;
|
|
|
- serviceBaseUrl = 'https://fieldcalc.lesprojekt.cz/';
|
|
|
private _datesLoading: boolean;
|
|
|
private _zonesLoading: boolean;
|
|
|
|
|
|
@@ -31,6 +31,13 @@ export class CalculatorService {
|
|
|
this.dateRangeSelects.subscribe(({date}) => {
|
|
|
this.selectedDate = date;
|
|
|
});
|
|
|
+ /**
|
|
|
+ * When new field is selected, clean all other params
|
|
|
+ */
|
|
|
+ this.fieldService.fieldSelects.subscribe(({feature}) => {
|
|
|
+ this.availableDates = undefined;
|
|
|
+ this.selectedDate = undefined;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
noDates(): boolean {
|
|
|
@@ -47,7 +54,7 @@ export class CalculatorService {
|
|
|
const data = await this.httpClient
|
|
|
.get<{dates: string[]}>(
|
|
|
(this.proxyEnabled() ? this.hsConfig.proxyPrefix : '') +
|
|
|
- this.serviceBaseUrl +
|
|
|
+ this.SERVICE_BASE_URL +
|
|
|
'get_dates?' +
|
|
|
'product=' +
|
|
|
product +
|
|
|
@@ -87,7 +94,7 @@ export class CalculatorService {
|
|
|
const data = await this.httpClient
|
|
|
.post(
|
|
|
(this.proxyEnabled() ? this.hsConfig.proxyPrefix : '') +
|
|
|
- this.serviceBaseUrl +
|
|
|
+ this.SERVICE_BASE_URL +
|
|
|
'get_zones',
|
|
|
{
|
|
|
product,
|