2025-12-14 20:34:15 +03:30
|
|
|
import { IPaginatedResponse } from '@/core/models/service.model';
|
|
|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
|
import { Injectable } from '@angular/core';
|
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
|
import { POS_API_ROUTES } from '../constants';
|
|
|
|
|
import {
|
|
|
|
|
IPosInfoRawResponse,
|
|
|
|
|
IPosInfoResponse,
|
2025-12-15 18:00:45 +03:30
|
|
|
IPosOrderRequest,
|
2025-12-14 20:34:15 +03:30
|
|
|
IPosProductCategoriesRawResponse,
|
|
|
|
|
IPosProductCategoriesResponse,
|
|
|
|
|
IPosStockRawResponse,
|
|
|
|
|
IPosStockResponse,
|
|
|
|
|
} from '../models';
|
|
|
|
|
|
|
|
|
|
@Injectable({ providedIn: 'root' })
|
|
|
|
|
export class PosService {
|
|
|
|
|
constructor(private http: HttpClient) {}
|
|
|
|
|
|
|
|
|
|
private apiRoutes = POS_API_ROUTES;
|
|
|
|
|
|
|
|
|
|
getInfo(): Observable<IPosInfoResponse> {
|
|
|
|
|
return this.http.get<IPosInfoRawResponse>(this.apiRoutes.info());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getStock(): Observable<IPaginatedResponse<IPosStockResponse>> {
|
|
|
|
|
return this.http.get<IPaginatedResponse<IPosStockRawResponse>>(this.apiRoutes.stock());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getCategories(): Observable<IPaginatedResponse<IPosProductCategoriesResponse>> {
|
|
|
|
|
return this.http.get<IPaginatedResponse<IPosProductCategoriesRawResponse>>(
|
|
|
|
|
this.apiRoutes.productCategories(),
|
|
|
|
|
);
|
|
|
|
|
}
|
2025-12-15 18:00:45 +03:30
|
|
|
|
|
|
|
|
submitOrder(payload: IPosOrderRequest): Observable<any> {
|
|
|
|
|
return this.http.post<any>(this.apiRoutes.submitOrder(), payload);
|
|
|
|
|
}
|
2025-12-14 20:34:15 +03:30
|
|
|
}
|