GithubHelp home page GithubHelp logo

john11d-payu-gpo / 04arswlab-ii Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arsw-eci-archive/javascript-client-modular

0.0 1.0 0.0 816 KB

HTML 15.39% JavaScript 30.36% Java 50.85% CSS 3.40%

04arswlab-ii's Introduction

JavaScript Modular Client

Link Heroku App

Part 1: Refactoring

Understand the module pattern for JavaScript and make a refactoring of your code to have two layer modules (FrontEnd and Network):

  • Network Layer -> Implement the method getOrders of the RestaurantRestController.js using the axios library to make the HTTP calls to the REST API.

  • FrontEnd Layer -> Implement the method showOrdersByTable of the OrdersController.js

Reference: https://toddmotto.com/mastering-the-module-pattern/

Part 2: FrontEnd implementation - Orders

Modify the index.html page so it displays the following orders structure:

  • Add the OrdersController.js and RestaurantRestController.js to the index.html
  • Connect the modules with your HTML code:
    • Call the getOrders method of the RestaurantRestController module (You can add a log so you can verify that it actually retrieves the data from the server)
    • Connect the two modules by calling the OrdersController.js -> showOrdersByTable method from the RestaurantRestController.js once the request promise is completed.
  • Call the showOrdersByTable function on the onload event so the orders load once tha page is loaded.

Part 2: Orders CRUD: FrontEnd

Create a new html page that has the following structure:

Implement the CRUD methods of the RestaurantRestController.js using the axios library to make the HTTP calls to the REST API.

- updateOrder
- deleteOrder

Implement the remaining methods of the OrdersController.js

- addItemToOrder
- updateOrder
- deleteOrderItem
  • Call the getOrders function on the onload and store it on global variable

Connect your html components with your controllers:

  • Implement a listener for the comboBox so when you change the order then the Update Orders table changes with the corresponding items (user the orders global variable).
  • Call the function addItemToOrder when the Add button is clicked (make sure you validate the submitted data)
  • Call the function updateOrder when the Update button is clicked (make sure you validate the submitted data)
  • Call the function deleteOrderItem when the Delete button is clicked

Part 3: Orders CRUD: BackEnd

Implement the missing methods on your REST API in order to be able to serve your JavaScript client:

  • updateOrder
  • addItemToOrder
  • deleteOrderItem

04arswlab-ii's People

Contributors

sancarbar avatar john11d-payu-gpo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.