Correct language in invoice and receipt
This commit is contained in:
parent
2cd0ee76c0
commit
92865a6ee3
2 changed files with 11 additions and 11 deletions
|
@ -22,6 +22,7 @@ export class LanguageService {
|
||||||
private loginURL = ConfigData.Be_URL + 'getloginlang';
|
private loginURL = ConfigData.Be_URL + 'getloginlang';
|
||||||
private mainURL = ConfigData.Be_URL + 'getmainlang';
|
private mainURL = ConfigData.Be_URL + 'getmainlang';
|
||||||
private scanURL = ConfigData.Be_URL + 'getscanlang';
|
private scanURL = ConfigData.Be_URL + 'getscanlang';
|
||||||
|
private invoiceURL = ConfigData.Be_URL + 'getinvoicelang';
|
||||||
|
|
||||||
public zgoLanguage: string = '';
|
public zgoLanguage: string = '';
|
||||||
|
|
||||||
|
@ -58,6 +59,8 @@ export class LanguageService {
|
||||||
return this.http.get<LanguageData>(this.mainURL + '/?lang=' + this.zgoLanguage, {headers: reqHeaders, params: params});
|
return this.http.get<LanguageData>(this.mainURL + '/?lang=' + this.zgoLanguage, {headers: reqHeaders, params: params});
|
||||||
} else if (viewName === 'scan') {
|
} else if (viewName === 'scan') {
|
||||||
return this.http.get<LanguageData>(this.scanURL + '/?lang=' + this.zgoLanguage, {headers: reqHeaders, params: params});
|
return this.http.get<LanguageData>(this.scanURL + '/?lang=' + this.zgoLanguage, {headers: reqHeaders, params: params});
|
||||||
|
} else if (viewName === 'invoice') {
|
||||||
|
return this.http.get<LanguageData>(this.invoiceURL + '/?lang=' + this.zgoLanguage, {headers: reqHeaders, params: params});
|
||||||
} else {
|
} else {
|
||||||
return this.http.get<LanguageData>(this.baseURL +
|
return this.http.get<LanguageData>(this.baseURL +
|
||||||
'/?lang=' + this.zgoLanguage +
|
'/?lang=' + this.zgoLanguage +
|
||||||
|
|
|
@ -14,7 +14,8 @@ var Buffer = require('buffer/').Buffer;
|
||||||
})
|
})
|
||||||
export class ReceiptService {
|
export class ReceiptService {
|
||||||
beUrl = ConfigData.Be_URL;
|
beUrl = ConfigData.Be_URL;
|
||||||
private dataStore: {order: Order, owner: Owner } = {
|
private dataStore: {order: Order, owner: Owner, name: string } = {
|
||||||
|
name: '',
|
||||||
owner: {
|
owner: {
|
||||||
_id: '',
|
_id: '',
|
||||||
name: '',
|
name: '',
|
||||||
|
@ -58,34 +59,30 @@ export class ReceiptService {
|
||||||
public readonly orderUpdate: Observable<Order> = this._orderUpdated.asObservable();
|
public readonly orderUpdate: Observable<Order> = this._orderUpdated.asObservable();
|
||||||
public _nameUpdated: BehaviorSubject<string> = new BehaviorSubject(this.dataStore.owner.name);
|
public _nameUpdated: BehaviorSubject<string> = new BehaviorSubject(this.dataStore.owner.name);
|
||||||
public readonly nameUpdate: Observable<string>= this._nameUpdated.asObservable();
|
public readonly nameUpdate: Observable<string>= this._nameUpdated.asObservable();
|
||||||
public readonly ownerUpdate;
|
//public readonly ownerUpdate;
|
||||||
private reqHeaders: HttpHeaders;
|
private reqHeaders: HttpHeaders;
|
||||||
private session: null|string;
|
|
||||||
private params: HttpParams;
|
private params: HttpParams;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
public userService: UserService
|
public userService: UserService
|
||||||
) {
|
) {
|
||||||
this.session = localStorage.getItem('s4z_token');
|
//this.session = localStorage.getItem('s4z_token');
|
||||||
this.params = new HttpParams();
|
this.params = new HttpParams();
|
||||||
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
var auth = 'Basic ' + Buffer.from(ConfigData.UsrPwd).toString('base64');
|
||||||
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
this.reqHeaders = new HttpHeaders().set('Authorization', auth);
|
||||||
this.ownerUpdate = userService.ownerUpdate;
|
//this.ownerUpdate = userService.ownerUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrderById(id:string, token: string) {
|
getOrderById(id:string, token: string) {
|
||||||
let obs = this.http.get<{message: string, order: any}>(this.beUrl+'order/'+id, { headers:this.reqHeaders, params: this.params.append("token", token), observe: 'response'});
|
let obs = this.http.get<{message: string, order: any, shop: string}>(this.beUrl+'order/'+id, { headers:this.reqHeaders, params: this.params.append("token", token), observe: 'response'});
|
||||||
|
|
||||||
obs.subscribe((OrderDataResponse) => {
|
obs.subscribe((OrderDataResponse) => {
|
||||||
if (OrderDataResponse.status == 200) {
|
if (OrderDataResponse.status == 200) {
|
||||||
this.dataStore.order = OrderDataResponse.body!.order;
|
this.dataStore.order = OrderDataResponse.body!.order;
|
||||||
|
this.dataStore.name = OrderDataResponse.body!.shop;
|
||||||
this._orderUpdated.next(Object.assign({}, this.dataStore).order);
|
this._orderUpdated.next(Object.assign({}, this.dataStore).order);
|
||||||
this.userService.getOwner();
|
this._nameUpdated.next(Object.assign({}, this.dataStore).name);
|
||||||
this.ownerUpdate.subscribe((owner) => {
|
|
||||||
this.dataStore.owner = owner;
|
|
||||||
this._nameUpdated.next(Object.assign({}, this.dataStore).owner.name);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
this._orderUpdated.next(Object.assign({}, this.dataStore).order);
|
this._orderUpdated.next(Object.assign({}, this.dataStore).order);
|
||||||
console.log('No order found');
|
console.log('No order found');
|
||||||
|
|
Loading…
Reference in a new issue