Unverified Commit f6b1aa6a authored by Ruslan Konviser's avatar Ruslan Konviser Committed by GitHub
Browse files

Merge branch 'develop' into l10n_develop

parents 3c80f652 a99e21bf
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -135,7 +135,25 @@ export class CarriersService {
						getCarrier(id: $id) {
							id
							firstName
							lastName
							phone
							logo
							isDeleted
							numberOfDeliveries
							skippedOrderIds
							status
							isActive
							username
							isSharedCarrier
							geoLocation {
								city
								streetAddress
								house
								loc {
									type
									coordinates
								}
							}
						}
					}
				`,
+16 −0
Original line number Diff line number Diff line
@@ -52,6 +52,22 @@ export class Store {
		localStorage.setItem('serverConnection', val);
	}

	get adminPasswordReset() {
		return localStorage.getItem('adminPasswordReset');
	}

	set adminPasswordReset(val: string) {
		localStorage.setItem('adminPasswordReset', val);
	}

	get fakeDataGenerator() {
		return localStorage.getItem('fakeDataGenerator');
	}

	set fakeDataGenerator(val: string) {
		localStorage.setItem('fakeDataGenerator', val);
	}

	clearMaintenanceMode() {
		localStorage.removeItem('maintenanceMode');
	}
+48 −0
Original line number Diff line number Diff line
import { Injectable } from '@angular/core';
import { Store } from '../data/store.service';
import { Apollo } from 'apollo-angular';
import { IAdminAppSettings } from '@modules/server.common/interfaces/IAppsSettings';
import gql from 'graphql-tag';
import { take, map } from 'rxjs/operators';

@Injectable({
	providedIn: 'root',
})
export class ServerSettingsService {
	constructor(
		private readonly _apollo: Apollo,
		private readonly store: Store
	) {}

	async load() {
		return new Promise(async (resolve, reject) => {
			const res = await this.getAdminAppSettings();

			if (res) {
				this.store.adminPasswordReset = res.adminPasswordReset;
				this.store.fakeDataGenerator = res.fakeDataGenerator;
			}

			resolve(true);
		});
	}

	getAdminAppSettings() {
		return this._apollo
			.query<{ settings: IAdminAppSettings }>({
				query: gql`
					query adminAppSettings {
						adminAppSettings {
							adminPasswordReset
							fakeDataGenerator
						}
					}
				`,
			})
			.pipe(
				take(1),
				map((res) => res.data['adminAppSettings'])
			)
			.toPromise();
	}
}
+5 −5
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import {
	Country,
	CountryName,
	getCountryName,
	countriesIdsToNamesArray,
} from '@modules/server.common/entities/GeoLocation';
import { FormHelpers } from '../helpers';

@@ -57,11 +58,10 @@ export class LocationFormComponent implements AfterViewInit {

	public showCoordinates: boolean = false;

	static COUNTRIES: Array<{ id: Country; name: CountryName }> = Object.keys(
		countries
	).map((abbr) => {
		return { id: Country[abbr], name: getCountryName(+Country[abbr]) };
	});
	static COUNTRIES: Array<{
		id: Country;
		name: CountryName;
	}> = countriesIdsToNamesArray;

	private _lastUsedAddressText: string;
	private _lat: number;
+1 −1
Original line number Diff line number Diff line
<div class="iconsCont" style="display: flex;">
	<h6 class="text-center iconBtns">
	<h6 class="text-center iconBtns mr-1">
		<i (click)="openInfo()" class="fa fa-info-circle infoBtn"></i>
	</h6>
	<h6><i (click)="openMap()" class="fa fa-search infoBtn"></i></h6>
Loading