Assignment 3

(20 Points) In this assignment you will convert all your pages to use .html extensions. Dynamic pages will be updated using JavaScript. All PHP will be moved to APIs on the server and accessed using AJAX calls from your HTML pages.

Agent Bookings:

  1. Create agent_bookings_api.php to return an array of agent bookings.
  2. Create agent_bookings.html with JavaScript to generate a table from the return array.

Add Agent:

  1. Create add_agent_api.php which accepts a new agent record and adds it to the AGENT table
  2. Create office_options_api.php that returns the OFFICE table.
  3. Create add_agent.html that calls office_options_api.php and generates the Office drop down menu, and calls add_agent_api.php to insert a new agent record.

Add Sale:

  1. Create add_sale_api.php which accepts a new sale record and adds it to the SALE table
  2. Create options_api.php that returns the AGENT and DESTINATION tables as arrays.
  3. Create add_sale.html that calls options_api.php to generate the Agent and Destination drop down menus, and calls add_sale_api.php to insert a new sale record.

Search Sales:

  1. Create search_sales_api.php which accepts an AgentID, DestinationID, AmountsAbove and AmountsBelow and returns an array of sales.
  2. Use the options_api.php that you created for adding a sale to return the AGENT and DESTINATION tables as arrays.
  3. Create search_sales.html that calls options_api.php to generate the Agent and Destination drop down menus, and calls search_sales_api.php when the user presses the SEARCH button on the form.
  4. Display the table that would be displayed on the search_results.php page in a DIV element below the Search Sales form. Make the date be a link to, for example, update_sale.html?5 if 5 were the SaleID of the sale to update.

Update Sale:

  1. Create one or two APIs to perform the update and delete functions.
  2. Create another API to display the select options for the Agent and Destination on the update form. You may use or modify the same API as you created for the Search Sales form. If you modify the same API it must work with both forms.
  3. Make it so when you delete the record, both the Update Sale and Delete Sale forms disappear.