AlejandraTech / viver-cellers

Web project dedicated to marketing wines for the winemakers of Vilafranca del Penedés who are part of the Viver del Cellers project.
4 stars 0 forks source link

PR 44: Creation of the graph section on the sales of each product #78

Closed AlejandraTech closed 5 months ago

AlejandraTech commented 5 months ago

Implementation of Sales Chart by Product

Response to Issue #77

Description:

A new section has been implemented on the website to display an interactive chart showing the sales of each product. The implementation includes both the frontend in Angular and the backend in Laravel, ensuring that the data updates in real-time.

Changes Made:

Frontend (Angular):

  1. Dependency Updates:

    • Added chart.js to the package.json file for chart visualization.
  2. Routing and Components:

    • Added a new route for the sales chart page in app-routing.module.ts.
    • Created the SalesGraphComponent with its respective HTML, CSS, and unit tests.
    • Added the link to the navigation menu for authenticated users with the Nurseryman role.
  3. Order Service:

    • Added a method in order.service.ts to fetch sales and cancellations data from the backend.

Backend (Laravel):

  1. Order Controller:

    • Added a new method in OrderController.php to retrieve sales and cancellations data.
  2. API Route:

    • Added a new route in api.php to fetch sales and cancellations.

Modified Files:

  1. Angular:

    • package-lock.json
    • package.json
    • src/app/app-routing.module.ts
    • src/app/app.module.ts
    • src/app/components/header/header.component.html
    • src/app/components/sales-graph/sales-graph.component.{css,html,spec.ts,ts}
    • src/app/models/{Cancellation.ts,Sale.ts}
    • src/app/services/order.service.ts
  2. Laravel:

    • app/Http/Controllers/OrderController.php
    • routes/api.php