diff --git a/backend-server/src/index.ts b/backend-server/src/index.ts index cd234a7..ee13307 100644 --- a/backend-server/src/index.ts +++ b/backend-server/src/index.ts @@ -286,7 +286,6 @@ app.put("/api/delivery/update/:id", async(req, res)=> { }) //TODO: FIx the file structure -//TODO: delivery Update //TODO: delivery Delete const PORT = 3000; diff --git a/src/app/components/pages/client-service/client-service.component.ts b/src/app/components/pages/client-service/client-service.component.ts index 0e3e0d1..42eaa9a 100644 --- a/src/app/components/pages/client-service/client-service.component.ts +++ b/src/app/components/pages/client-service/client-service.component.ts @@ -36,13 +36,6 @@ export class ClientServiceComponent implements OnInit, OnDestroy { ngOnInit(): void { - // if(this.data.delivery_date === this.today) { - // console.log("Date Matched") - // } else { - // console.log("Date does not matched") - // console.log(this.data.delivery_date) - // console.log(this.today) - // } this.allDeliverySubscription = this.clientDeliveryService.allDelivery().subscribe(data=>{ this.allDeliveryTasks = data; }) @@ -54,7 +47,6 @@ export class ClientServiceComponent implements OnInit, OnDestroy { completedTask(client: DeliveryModel): void { client.delivery_status = "Completed"; - //TODO11: When Completed is pressed send request to backend to change delivery Status to completed this.clientDeliveryService.updateStatus(client).subscribe(response=>{ console.log(response) this.clientDeliveryService.allDelivery().subscribe(data=>{ diff --git a/src/app/components/pages/client-service/client-service.service.ts b/src/app/components/pages/client-service/client-service.service.ts index 6a7e460..3cae1d0 100644 --- a/src/app/components/pages/client-service/client-service.service.ts +++ b/src/app/components/pages/client-service/client-service.service.ts @@ -2,6 +2,7 @@ import { HttpClient } from "@angular/common/http"; import { Injectable } from "@angular/core"; import { DeliveryModel } from "./client-service.model"; import { Observable } from "rxjs"; +import { DELIVERY_CREATE_URL, DELIVERY_UPDATE_URL, DELIVERY_URL } from "../../../shared/constants/backend"; @Injectable({ providedIn: 'root' @@ -14,15 +15,15 @@ export class ClientDeliveryService { constructor(private httpClient: HttpClient){} allDelivery(): Observable { - return this.httpClient.get("http://localhost:3000/api/delivery") + return this.httpClient.get(DELIVERY_URL) } addNewClientToDB(newClient: DeliveryModel){ - return this.httpClient.post("http://localhost:3000/api/delivery/create", newClient) + return this.httpClient.post(DELIVERY_CREATE_URL, newClient) } updateStatus(newStatus: DeliveryModel) { - return this.httpClient.put(`http://localhost:3000/api/delivery/update/${newStatus._id}`, newStatus, {responseType: 'text'}) + return this.httpClient.put(`${DELIVERY_UPDATE_URL}/${newStatus._id}`, newStatus, {responseType: 'text'}) } diff --git a/src/app/components/pages/dashboard/dashboard-data.ts b/src/app/components/pages/dashboard/dashboard-data.ts index 6d4a1e0..a0c5106 100644 --- a/src/app/components/pages/dashboard/dashboard-data.ts +++ b/src/app/components/pages/dashboard/dashboard-data.ts @@ -114,7 +114,7 @@ export const service_links: navLink[] =[ export const shift_tasks = [ { "name" : "Client Delivery", - "url" : "http://localhost:12180/delivery" //TODO: Fix the localhost Name after full client delivery development + "url" : "http://118.67.213.117:12180/delivery" }, { "name": "Monitoring Screenshots list", diff --git a/src/app/shared/constants/backend.ts b/src/app/shared/constants/backend.ts index 21b5491..7ef564e 100644 --- a/src/app/shared/constants/backend.ts +++ b/src/app/shared/constants/backend.ts @@ -6,3 +6,6 @@ export const UPDATE_ADD_URL = `${UPDATE_GET_URL}/add`; export const UPDATE_COMPLETE_URL = `${UPDATE_GET_URL}/complete`; export const UPDATE_DELETE_URL = `${UPDATE_GET_URL}/delete`; export const SECRET_URL = `${MAIN_URL}/secrets`; +export const DELIVERY_URL = `${MAIN_URL}/delivery` +export const DELIVERY_CREATE_URL = `${DELIVERY_URL}/create` +export const DELIVERY_UPDATE_URL = `${DELIVERY_URL}/update`