From 1b3703aec117329a26b69fc46dc61486f723f7af Mon Sep 17 00:00:00 2001 From: ikyriazis Date: Wed, 16 Sep 2020 13:26:08 -0400 Subject: [PATCH 01/12] base working --- public/index.html | 57 ++++++++++++++++++++++++++++++++------ server.improved.js | 68 +++++++++++++++++++++++++++++++--------------- 2 files changed, 94 insertions(+), 31 deletions(-) diff --git a/public/index.html b/public/index.html index c56d620e..3956ed06 100755 --- a/public/index.html +++ b/public/index.html @@ -6,19 +6,35 @@
- - + + +
+ +
+
+ + + + + + + + + + diff --git a/server.improved.js b/server.improved.js index 26673fc0..f54f935e 100644 --- a/server.improved.js +++ b/server.improved.js @@ -6,11 +6,13 @@ const http = require( 'http' ), dir = 'public/', port = 3000 -const appdata = [ - { 'model': 'toyota', 'year': 1999, 'mpg': 23 }, - { 'model': 'honda', 'year': 2004, 'mpg': 30 }, - { 'model': 'ford', 'year': 1987, 'mpg': 14} -] +// const appdata = [ +// { 'model': 'toyota', 'year': 1999, 'mpg': 23 }, +// { 'model': 'honda', 'year': 2004, 'mpg': 30 }, +// { 'model': 'ford', 'year': 1987, 'mpg': 14} +// ] + +let appdata = []; const server = http.createServer( function( request,response ) { if( request.method === 'GET' ) { @@ -18,37 +20,59 @@ const server = http.createServer( function( request,response ) { }else if( request.method === 'POST' ){ handlePost( request, response ) } -}) +}); const handleGet = function( request, response ) { - const filename = dir + request.url.slice( 1 ) + const filename = dir + request.url.slice( 1 ) ; if( request.url === '/' ) { sendFile( response, 'public/index.html' ) }else{ sendFile( response, filename ) } -} +}; const handlePost = function( request, response ) { - let dataString = '' + let dataString = ''; + console.log("hi"); request.on( 'data', function( data ) { - dataString += data - }) + dataString += data; + console.log("hi") + }); request.on( 'end', function() { - console.log( JSON.parse( dataString ) ) + console.log(JSON.parse(dataString)); + // const json = JSON.parse(dataString); + // this request is an order + // console.log(json.orderNum); + // if (json.numberOfItems === 2) { + // const orderNum = appdata.length === 0? 1 : appdata[-1].orderNum + 1; + // appdata.push({orderNum: orderNum, color: json.color, quantity: json.quantity}) + // } + // // this request is a fulfillment + // else if (json.numberOfItems === 1) { + // const orderNum = json.orderNum; + // let i; + // for (i = 0; i < appdata.length; i++) { + // if (appdata[i].orderNum === orderNum) { + // appdata = appdata.slice(0, i).concat(appdata.slice(i + 1, appdata.length)); + // } + // } + // } + // else { + // // this is an invalid request + // console.log("invalid json"); + // } // ... do something with the data here!!! - - response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }) + response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }); response.end() }) -} +}; const sendFile = function( response, filename ) { - const type = mime.getType( filename ) + const type = mime.getType( filename ); fs.readFile( filename, function( err, content ) { @@ -56,17 +80,17 @@ const sendFile = function( response, filename ) { if( err === null ) { // status code: https://httpstatuses.com - response.writeHeader( 200, { 'Content-Type': type }) - response.end( content ) + response.writeHeader( 200, { 'Content-Type': type }); + response.end( content ); }else{ // file not found, error code 404 - response.writeHeader( 404 ) - response.end( '404 Error: File Not Found' ) + response.writeHeader( 404 ); + response.end( '404 Error: File Not Found' ); } }) -} +}; -server.listen( process.env.PORT || port ) +server.listen( process.env.PORT || port ); From ee23dc8ca6eebe2c47a0d8883b26f937f9119844 Mon Sep 17 00:00:00 2001 From: ikyriazis Date: Wed, 16 Sep 2020 13:56:24 -0400 Subject: [PATCH 02/12] More than basic, fixed bug --- public/index.html | 34 +++++++++++++++++----------------- server.improved.js | 40 ++++++++++++++++++++-------------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/public/index.html b/public/index.html index 3956ed06..7163492d 100755 --- a/public/index.html +++ b/public/index.html @@ -10,19 +10,19 @@
- +
- - - - - - - - - - +
+ + + + +
diff --git a/server.improved.js b/server.improved.js index f54f935e..29f4bfa3 100644 --- a/server.improved.js +++ b/server.improved.js @@ -43,27 +43,27 @@ const handlePost = function( request, response ) { request.on( 'end', function() { console.log(JSON.parse(dataString)); - // const json = JSON.parse(dataString); + const json = JSON.parse(dataString); // this request is an order - // console.log(json.orderNum); - // if (json.numberOfItems === 2) { - // const orderNum = appdata.length === 0? 1 : appdata[-1].orderNum + 1; - // appdata.push({orderNum: orderNum, color: json.color, quantity: json.quantity}) - // } - // // this request is a fulfillment - // else if (json.numberOfItems === 1) { - // const orderNum = json.orderNum; - // let i; - // for (i = 0; i < appdata.length; i++) { - // if (appdata[i].orderNum === orderNum) { - // appdata = appdata.slice(0, i).concat(appdata.slice(i + 1, appdata.length)); - // } - // } - // } - // else { - // // this is an invalid request - // console.log("invalid json"); - // } + console.log(json.orderNum); + if (json.numberOfItems === 2) { + const orderNum = appdata.length === 0? 1 : appdata[-1].orderNum + 1; + appdata.push({orderNum: orderNum, color: json.color, quantity: json.quantity}) + } + // this request is a fulfillment + else if (json.numberOfItems === 1) { + const orderNum = json.orderNum; + let i; + for (i = 0; i < appdata.length; i++) { + if (appdata[i].orderNum === orderNum) { + appdata = appdata.slice(0, i).concat(appdata.slice(i + 1, appdata.length)); + } + } + } + else { + // this is an invalid request + console.log("invalid json"); + } // ... do something with the data here!!! response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }); From 817098acc2f361a17341e7d0a7bd2c4244800c4c Mon Sep 17 00:00:00 2001 From: ikyriazis Date: Wed, 16 Sep 2020 14:01:53 -0400 Subject: [PATCH 03/12] added json type to request --- public/index.html | 4 ++-- server.improved.js | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/public/index.html b/public/index.html index 7163492d..100bded8 100755 --- a/public/index.html +++ b/public/index.html @@ -32,7 +32,7 @@ const color = document.getElementById( 'color' ), quantity = document.getElementById('quantity'), - json = { color: color.value, quantity: quantity.value}, + json = {type: "order", color: color.value, quantity: quantity.value}, body = JSON.stringify( json ); console.log("Submitting order"); @@ -53,7 +53,7 @@ e.preventDefault() const orderNum = document.getElementById( 'orderNum' ), - json = {orderNum: orderNum.value}, + json = {type: "fulfill", orderNum: orderNum.value}, body = JSON.stringify( json ); console.log("Fulfilling order " + orderNum); diff --git a/server.improved.js b/server.improved.js index 29f4bfa3..293833e7 100644 --- a/server.improved.js +++ b/server.improved.js @@ -34,24 +34,22 @@ const handleGet = function( request, response ) { const handlePost = function( request, response ) { let dataString = ''; - console.log("hi"); request.on( 'data', function( data ) { dataString += data; - console.log("hi") }); request.on( 'end', function() { - console.log(JSON.parse(dataString)); const json = JSON.parse(dataString); // this request is an order - console.log(json.orderNum); - if (json.numberOfItems === 2) { - const orderNum = appdata.length === 0? 1 : appdata[-1].orderNum + 1; + if (json.type === "order") { + console.log("obtained order"); + const orderNum = appdata.length === 0? 1 : appdata[appdata.length - 1].orderNum + 1; appdata.push({orderNum: orderNum, color: json.color, quantity: json.quantity}) } // this request is a fulfillment - else if (json.numberOfItems === 1) { + else if (json.type === "fulfill") { + console.log("obtained fulfillment"); const orderNum = json.orderNum; let i; for (i = 0; i < appdata.length; i++) { From 8445e43abddd30eed4e1cc96295e7746a1b9d000 Mon Sep 17 00:00:00 2001 From: ikyriazis Date: Wed, 16 Sep 2020 14:52:27 -0400 Subject: [PATCH 04/12] Fulfilling orders works now --- public/index.html | 14 ++++++++++---- server.improved.js | 13 ++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/public/index.html b/public/index.html index 100bded8..f5a10e0f 100755 --- a/public/index.html +++ b/public/index.html @@ -42,7 +42,10 @@ }) .then( function( response ) { // do something with the response - console.log( response ) + return response.text(); + }).then( function(txt) { + console.log(txt); + return false; }) return false @@ -62,9 +65,12 @@ body }) .then( function( response ) { - // do something with the reponse - console.log( response ) - }) + // do something with the response + return response.text(); + }).then( function(txt) { + console.log(txt); + return false; + }) return false }; diff --git a/server.improved.js b/server.improved.js index 293833e7..2476df16 100644 --- a/server.improved.js +++ b/server.improved.js @@ -50,11 +50,14 @@ const handlePost = function( request, response ) { // this request is a fulfillment else if (json.type === "fulfill") { console.log("obtained fulfillment"); - const orderNum = json.orderNum; + let orderNum = json.orderNum; + console.log(orderNum); + console.log(typeof orderNum); let i; for (i = 0; i < appdata.length; i++) { - if (appdata[i].orderNum === orderNum) { - appdata = appdata.slice(0, i).concat(appdata.slice(i + 1, appdata.length)); + console.log(appdata[i].orderNum); + if (appdata[i].orderNum.toString() === orderNum) { + appdata = appdata.splice(0, i).concat(appdata.splice(i + 1, appdata.length)); } } } @@ -62,10 +65,10 @@ const handlePost = function( request, response ) { // this is an invalid request console.log("invalid json"); } - + console.log(appdata); // ... do something with the data here!!! response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }); - response.end() + response.end(JSON.stringify(appdata)); }) }; From 1467b97e8ee9db4fb0a3b456996429efe9456cb1 Mon Sep 17 00:00:00 2001 From: ikyriazis Date: Wed, 16 Sep 2020 14:53:25 -0400 Subject: [PATCH 05/12] Removed print statements --- server.improved.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/server.improved.js b/server.improved.js index 2476df16..14a98403 100644 --- a/server.improved.js +++ b/server.improved.js @@ -49,10 +49,7 @@ const handlePost = function( request, response ) { } // this request is a fulfillment else if (json.type === "fulfill") { - console.log("obtained fulfillment"); let orderNum = json.orderNum; - console.log(orderNum); - console.log(typeof orderNum); let i; for (i = 0; i < appdata.length; i++) { console.log(appdata[i].orderNum); From 2a8b9ec6a4e1517d1577e06cedb02ba682c85385 Mon Sep 17 00:00:00 2001 From: ikyriazis Date: Wed, 16 Sep 2020 14:54:10 -0400 Subject: [PATCH 06/12] Removed more prints --- server.improved.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/server.improved.js b/server.improved.js index 14a98403..ac8004a5 100644 --- a/server.improved.js +++ b/server.improved.js @@ -43,7 +43,6 @@ const handlePost = function( request, response ) { const json = JSON.parse(dataString); // this request is an order if (json.type === "order") { - console.log("obtained order"); const orderNum = appdata.length === 0? 1 : appdata[appdata.length - 1].orderNum + 1; appdata.push({orderNum: orderNum, color: json.color, quantity: json.quantity}) } @@ -52,7 +51,6 @@ const handlePost = function( request, response ) { let orderNum = json.orderNum; let i; for (i = 0; i < appdata.length; i++) { - console.log(appdata[i].orderNum); if (appdata[i].orderNum.toString() === orderNum) { appdata = appdata.splice(0, i).concat(appdata.splice(i + 1, appdata.length)); } @@ -62,7 +60,6 @@ const handlePost = function( request, response ) { // this is an invalid request console.log("invalid json"); } - console.log(appdata); // ... do something with the data here!!! response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }); response.end(JSON.stringify(appdata)); From 528bc33a067415a0842d2d7e1baf025701266009 Mon Sep 17 00:00:00 2001 From: ikyriazis Date: Wed, 16 Sep 2020 15:14:31 -0400 Subject: [PATCH 07/12] Added table --- public/index.html | 47 ++++++++++++++++++++++++++++++++++++++++------ server.improved.js | 4 +++- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/public/index.html b/public/index.html index f5a10e0f..ae332b0c 100755 --- a/public/index.html +++ b/public/index.html @@ -5,10 +5,10 @@ + +
- -
@@ -44,7 +44,25 @@ // do something with the response return response.text(); }).then( function(txt) { - console.log(txt); + let appdata = JSON.parse(txt); + let table = document.getElementById('orders'); + table.innerHTML = ""; + let thead = table.createTHead(); + let row = thead.insertRow(); + for (let key of Object.keys(appdata[0])) { + let th = document.createElement("th"); + let text = document.createTextNode(key); + th.appendChild(text); + row.appendChild(th); + } + for (let element of appdata) { + let row = table.insertRow(); + for (let key in element) { + let cell = row.insertCell(); + let text = document.createTextNode(element[key]); + cell.appendChild(text); + } + } return false; }) @@ -58,7 +76,6 @@ const orderNum = document.getElementById( 'orderNum' ), json = {type: "fulfill", orderNum: orderNum.value}, body = JSON.stringify( json ); - console.log("Fulfilling order " + orderNum); fetch( '/submit', { method:'POST', @@ -68,8 +85,26 @@ // do something with the response return response.text(); }).then( function(txt) { - console.log(txt); - return false; + let appdata = JSON.parse(txt); + let table = document.getElementById('orders'); + table.innerHTML = ""; + let thead = table.createTHead(); + let row = thead.insertRow(); + for (let key of Object.keys(appdata[0])) { + let th = document.createElement("th"); + let text = document.createTextNode(key); + th.appendChild(text); + row.appendChild(th); + } + for (let element of appdata) { + let row = table.insertRow(); + for (let key in element) { + let cell = row.insertCell(); + let text = document.createTextNode(element[key]); + cell.appendChild(text); + } + } + return false; }) return false diff --git a/server.improved.js b/server.improved.js index ac8004a5..ad45b041 100644 --- a/server.improved.js +++ b/server.improved.js @@ -12,7 +12,9 @@ const http = require( 'http' ), // { 'model': 'ford', 'year': 1987, 'mpg': 14} // ] -let appdata = []; +let appdata = [ + +]; const server = http.createServer( function( request,response ) { if( request.method === 'GET' ) { From 917f5b9d4f7450fafae7aa248bb92187e2b61873 Mon Sep 17 00:00:00 2001 From: ikyriazis Date: Wed, 16 Sep 2020 15:23:10 -0400 Subject: [PATCH 08/12] Refeactored table making function --- public/index.html | 59 ++++++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 36 deletions(-) diff --git a/public/index.html b/public/index.html index ae332b0c..e59fdf46 100755 --- a/public/index.html +++ b/public/index.html @@ -45,24 +45,7 @@ return response.text(); }).then( function(txt) { let appdata = JSON.parse(txt); - let table = document.getElementById('orders'); - table.innerHTML = ""; - let thead = table.createTHead(); - let row = thead.insertRow(); - for (let key of Object.keys(appdata[0])) { - let th = document.createElement("th"); - let text = document.createTextNode(key); - th.appendChild(text); - row.appendChild(th); - } - for (let element of appdata) { - let row = table.insertRow(); - for (let key in element) { - let cell = row.insertCell(); - let text = document.createTextNode(element[key]); - cell.appendChild(text); - } - } + generateTable(appdata); return false; }) @@ -86,30 +69,34 @@ return response.text(); }).then( function(txt) { let appdata = JSON.parse(txt); - let table = document.getElementById('orders'); - table.innerHTML = ""; - let thead = table.createTHead(); - let row = thead.insertRow(); - for (let key of Object.keys(appdata[0])) { - let th = document.createElement("th"); - let text = document.createTextNode(key); - th.appendChild(text); - row.appendChild(th); - } - for (let element of appdata) { - let row = table.insertRow(); - for (let key in element) { - let cell = row.insertCell(); - let text = document.createTextNode(element[key]); - cell.appendChild(text); - } - } + generateTable(appdata); return false; }) return false }; + function generateTable(appdata) { + let table = document.getElementById('orders'); + table.innerHTML = ""; + let thead = table.createTHead(); + let row = thead.insertRow(); + for (let key of Object.keys(appdata[0])) { + let th = document.createElement("th"); + let text = document.createTextNode(key); + th.appendChild(text); + row.appendChild(th); + } + for (let element of appdata) { + let row = table.insertRow(); + for (let key in element) { + let cell = row.insertCell(); + let text = document.createTextNode(element[key]); + cell.appendChild(text); + } + } + } + window.onload = function() { const orderButton = document.getElementById( 'order' ); const fulfillButton = document.getElementById('fulfill'); From eabcc11363d28451b2c49483fe7f52dddd5e8b22 Mon Sep 17 00:00:00 2001 From: ikyriazis Date: Wed, 16 Sep 2020 15:31:39 -0400 Subject: [PATCH 09/12] added more colors and size field --- public/index.html | 19 +++++++++++++++---- server.improved.js | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/public/index.html b/public/index.html index e59fdf46..8842f73e 100755 --- a/public/index.html +++ b/public/index.html @@ -16,9 +16,19 @@
+ @@ -32,7 +42,8 @@ const color = document.getElementById( 'color' ), quantity = document.getElementById('quantity'), - json = {type: "order", color: color.value, quantity: quantity.value}, + size = document.getElementById('size'), + json = {type: "order", color: color.value, size: size.value, quantity: quantity.value}, body = JSON.stringify( json ); console.log("Submitting order"); diff --git a/server.improved.js b/server.improved.js index ad45b041..a3438c15 100644 --- a/server.improved.js +++ b/server.improved.js @@ -46,7 +46,7 @@ const handlePost = function( request, response ) { // this request is an order if (json.type === "order") { const orderNum = appdata.length === 0? 1 : appdata[appdata.length - 1].orderNum + 1; - appdata.push({orderNum: orderNum, color: json.color, quantity: json.quantity}) + appdata.push({orderNum: orderNum, color: json.color, size: json.size, quantity: json.quantity}) } // this request is a fulfillment else if (json.type === "fulfill") { From 3058db27fe0bab8b3d60ecdf511a2f0f29d86084 Mon Sep 17 00:00:00 2001 From: ikyriazis Date: Wed, 16 Sep 2020 17:14:47 -0400 Subject: [PATCH 10/12] Fixed delete method --- public/css/style.css | 14 +++++++++++++- public/index.html | 6 +++--- server.improved.js | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index d5f842ab..2af96e20 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -1 +1,13 @@ -/*Style your own assignment! This is fun! */ \ No newline at end of file +/*Style your own assignment! This is fun! */ +/* +Various CSS Selector functionality must be demonstrated: + +Element selectors +ID selectors +Class selectors + */ +table { + +} + + diff --git a/public/index.html b/public/index.html index 8842f73e..c841dbec 100755 --- a/public/index.html +++ b/public/index.html @@ -20,7 +20,7 @@ - + @@ -38,7 +38,7 @@ const submitOrder = function( e ) { // prevent default form action from being carried out - e.preventDefault() + e.preventDefault(); const color = document.getElementById( 'color' ), quantity = document.getElementById('quantity'), @@ -65,7 +65,7 @@ const fulfillOrder = function(e) { // prevent default form action from being carried out - e.preventDefault() + e.preventDefault(); const orderNum = document.getElementById( 'orderNum' ), json = {type: "fulfill", orderNum: orderNum.value}, diff --git a/server.improved.js b/server.improved.js index a3438c15..7b5bc168 100644 --- a/server.improved.js +++ b/server.improved.js @@ -54,7 +54,7 @@ const handlePost = function( request, response ) { let i; for (i = 0; i < appdata.length; i++) { if (appdata[i].orderNum.toString() === orderNum) { - appdata = appdata.splice(0, i).concat(appdata.splice(i + 1, appdata.length)); + appdata.splice(i, 1); } } } From 5fff118932f45543807f0097bbd4c625f9dd3ec9 Mon Sep 17 00:00:00 2001 From: ikyriazis Date: Wed, 16 Sep 2020 21:45:25 -0400 Subject: [PATCH 11/12] submit version --- README.md | 100 +++++-------------------------------------- public/css/style.css | 27 +++++++++++- public/index.html | 57 +++++++++++++----------- server.improved.js | 2 +- 4 files changed, 70 insertions(+), 116 deletions(-) diff --git a/README.md b/README.md index 3945c152..1b56927c 100755 --- a/README.md +++ b/README.md @@ -1,93 +1,15 @@ -Assignment 2 - Short Stack: Basic Two-tier Web Application using HTML/CSS/JS and Node.js -=== - -Due: September 16th, by 11:59 PM. - -This assignment aims to introduce you to the concepts and practice involved in creating a prototype (i.e. not deployment ready) two-tiered web application. The baseline aims of this assignment involve creating an application that demonstrates the use of several specific pieces of HTML, CSS, JavaScript, and Node.js functionality. - -Baseline Requirements ---- - -Note that there is a very large range of application areas and possibilities that meet these baseline requirements. Make your application do something useful! A todo list, storing / retrieving high scores for a very simple game, have a little fun with it. - -Your application is required to implement the following functionalities: - -- a `Server` which not only serves files, but also maintains a tabular dataset with 3 or more fields related to your application -- a `Results` functionality which shows the entire dataset residing in the server's memory -- a `Form/Entry` functionality which allows a user to add, modify, or delete data items residing in the server's memory -- a `Server Logic` which, upon receiving new or modified "incoming" data, includes and uses a function that adds at least one additional derived field to this incoming data before integrating it with the existing dataset -- the `Derived field` for a new row of data must be computed based on fields already existing in the row. For example, a `todo` dataset with `task`, `priority`, and `creation_date` may generate a new field `deadline` by looking at `creation_date` and `priority` - -Your application is required to demonstrate the use of the following concepts: - -HTML: -- One or more [HTML Forms](https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms), with any combination of form tags appropriate for the user input portion of the application -- A results page displaying all data currently available on the server. You will most likely use a `` tag for this, but `
    ` could also work and might be simpler to work with. -- All pages should [validate](https://validator.w3.org) - -CSS: -- CSS styling of the primary visual elements in the application -- Various CSS Selector functionality must be demonstrated: - - Element selectors - - ID selectors - - Class selectors -- CSS positioning and styling of the primary visual elements in the application: - - Use of either a CSS grid or flexbox for layout - - Rules defining fonts for all text used; no default fonts! Be sure to use a web safe font or a font from a web service like [Google Fonts](http://fonts.google.com/) - -- CSS defined in a maintainable, readable form, in external stylesheets - -JavaScript: -- At minimum, a small amount of front-end JavaScript to get / fetch data from the server; a sample is provided in this repository. - -Node.js: -- An HTTP Server that delivers all necessary files and data for the application. A starting point is provided in this repository. - -Deliverables ---- - -Do the following to complete this assignment and acheive a base grade of 85%: - -1. Fork the starting project code (make sure to fork the 2020 repo!). This repo contains some starter code that may be used or discarded as needed. -2. Implement your project with the above requirements. -3. Test your project to make sure that when someone goes to your main page, it displays correctly. -4. Deploy your project to Glitch, and fill in the appropriate fields in your package.json file. -5. Ensure that your project has the proper naming scheme `a2-yourname` so we can find it. -6. Modify the README to the specifications below. -7. Create and submit a Pull Request to the original repo. Label the pull request as follows: a2-gitusername-firstname-lastname - -Acheivements ---- - -Below are suggested technical and design achievements. You can use these to help boost your grade up to an A and customize the assignment to your personal interests. These are recommended acheivements, but feel free to create/implement your own... just make sure you thoroughly describe what you did in your README and why it was challenging. ALL ACHIEVEMENTS MUST BE DESCRIBED IN YOUR README IN ORDER TO GET CREDIT FOR THEM. - -*Technical* -- (10 points) Create a single-page app that both provides a form for users to submit data and always shows the current state of the server-side data. To put it another way, when the user submits data, the server should respond sending back the updated data (including the derived field calculated on the server) and the client should then update its data display. - -*Design/UX* -- (5 points per person, with a max of 10 points) Test your user interface with other students in the class. Define a specific task for them to complete (ideally something short that takes <10 minutes), and then use the [think-aloud protocol](https://en.wikipedia.org/wiki/Think_aloud_protocol) to obtain feedback on your design (talk-aloud is also find). Important considerations when designing your study: - -1. Make sure you start the study by clearly stating the task that you expect your user to accomplish. -2. You shouldn't provide any verbal instructions on how to use your interface / accomplish the task you give them. Make sure that your interface is clear enough that users can figure it out without any instruction, or provide text instructions from within the interface itself. -3. If users get stuck to the point where they give up, you can then provde instruction so that the study can continue, but make sure to discuss this in your README. You won't lose any points for this... all feedback is good feedback! - -You'll need to use sometype of collaborative software that will enable you both to see the test subject's screen and listen to their voice as they describe their thoughts. After completing each study, briefly (one to two sentences for each question) address the following in your README: - -1. Provide the last name of each student you conduct the evaluation with. -2. What problems did the user have with your design? -3. What comments did they make that surprised you? -4. What would you change about the interface based on their feedback? - -*You do not need to actually make changes based on their feedback*. This acheivement is designed to help gain experience testing user interfaces. If you run two user studies, you should answer two sets of questions. - -Sample Readme (delete the above when you're ready to submit, and modify the below so with your links and descriptions) ---- - -## Your Web Application Title -Include a very brief summary of your project here. Be sure to include the CSS positioning technique you used, and any required instructions to use your application. +## Order Placing and Fulfilling Platform +This website allows users to place orders. Only one type of product is available but comes in different colors and sizes. The user also enters the quantity of the product +they desire. The administrator can then remove orders from the database once they fulfill the orders. I used a flexbox to align the elements of the webpage. ## Technical Achievements -- **Tech Achievement 1**: Using a combination of... +- **Tech Achievement 1**: I use a table to display all the data stored in the server. It is updated every time an order is placed or fulfilled. The derived field is the order number. +This field is derived from the previous order number. ### Design/Evaluation Achievements -- **Design Achievement 1**: +- **Design Achievement 1**: I use the Kumbh Sans font from Google Fonts. +- **Design Achievement 2**: I use two colors I've obtained from the Adobe color wheel. +- **Evaluation Achievement 1**: I ran a user study on my girlfriend. I told her to fulfill order number 13 when there were 15 orders in the database. She had no trouble with it. +- **Evaluation Achievement 2**: I ran a user study on my 9-year-old brother. I told him to place an order for "5 green mediums". At first he thought he could edit the table directly. +When that didn't work he looked at the form and saw that he could select colors and sizes. He then was about to place an order without a quantity but I reminded him that he +needs 5 of them. He then put the correct quantity and submitted the order. From this I learned that my application isn't the most intuitive to a 9-year-old. diff --git a/public/css/style.css b/public/css/style.css index 2af96e20..2eab5a7b 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -6,8 +6,33 @@ Element selectors ID selectors Class selectors */ -table { +table{ + display: flex; + justify-content: center; + align-content: space-evenly; + border-collapse: collapse; +} +td, th { + background-color: white; + border: solid #1A6166 3px; + padding: 5px; +} +.admin { + display: flex; + justify-content: center; + align-content: space-evenly; + align-items: stretch; +} +#client { + display: flex; + justify-content: center; + align-content: space-evenly; + align-items: stretch; } +body { + font-family: 'Kumbh Sans', sans-serif; + background-color: #3EACB3; +} diff --git a/public/index.html b/public/index.html index c841dbec..66357e52 100755 --- a/public/index.html +++ b/public/index.html @@ -3,36 +3,43 @@ CS4241 Assignment 2 + +
- - - - - +
+
+
+ + + +
+

-
- - - - - -
+
+
+ + + + + +
+