Skip to content

Commit

Permalink
Added style and JavaScript to my Application.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonell Colon authored and Jonell Colon committed Apr 6, 2012
1 parent a399acd commit 0187141
Show file tree
Hide file tree
Showing 5 changed files with 280 additions and 80 deletions.
Binary file added VFWProject2Flowchart.pdf
Binary file not shown.
113 changes: 52 additions & 61 deletions additem.html
@@ -1,56 +1,42 @@
<!DOCTYPE HTML>

<!-- Jonell Colon -->
<!-- Project 1 VFW -->
<!-- Project 2 VFW -->
<!-- Term 1204 -->

<html>
<head>
<meta charset="UTF-8">
<meta name="keywords" content="Auto, Parts, Car, Autoparts"/>
<meta name="description" content="Order your car part on your mobile device"/>
<meta name="robots" content="INDEX"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="HandheldFriendly" content="True"/>

<title>AutoParts Prepare</title>

</head>

<head>
<meta charset="UTF-8">
<meta name="keywords" content="Auto, Parts, Car, Autoparts"/>
<meta name="description" content="Order your car part on your mobile device"/>
<meta name="robots" content="INDEX"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="HandheldFriendly" content="True"/>
<title>MeCPART HELP</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<header>
<h1><span>AutoPart Prepare</span></h1>

<h2>Choose Part Description:</h2>
<h1><span>MeCPART HELP</span></h1>
</header>

<!-- Form Begins Here -->

<p><select>
<option value="motor">Motor</option>
<option value="cabin">Cabin</option>
<option value="body">Body</option>
<option value="trunk">Trunk</option>
<option value="exhaust">Exhaust</option>
<option value="wheel">Wheels</option>
</select></p>
</header>

<!-- Form Begins Here -->

<form action="#" method="post" id="partList" />
<ul>
<li id="select"><label for="group">Part Description:</label></li>
</ul>
<!-- Customer Information -->

<form>
<fieldset>
<legend>Customer Information:</legend>
<ul>
<li><label for="name">Customer Name:</label></li>
<input type="text" name="fullname" input id="fullname" autocomplete="on">
<li><label for="fullname">Customer Name: </label>
<input type="text" id="fullname" autocomplete="on" placeholder="John Smith" /></li>

<li><label for="phone">Phone Number:</label></li>
<input type="tel" name="phone" input id="number" autocomplete="on">
<li><label for="phone">Phone Number: </label>
<input type="tel" id="phone" autocomplete="on" placeholder="555-555-5555" /></li>

<li><label for="email">E-Mail:</label></li>
<input type="email" name="email" input id="email" autocomplete="on">
<li><label for="email">E-Mail: </label>
<input type="email" id="email" autocomplete="on" placeholder="johnsmith@me.com" /></li>
</ul>
</fieldset>

Expand All @@ -59,40 +45,45 @@ <h2>Choose Part Description:</h2>
<fieldset>
<legend>Part Form:</legend>
<ul>
<li><label for="cpart">Part Needed:</label></li>
<input type="text" name="cpart" input id="part">
<li><label for="cpart">Part Needed:</label>
<input type="text" id="cpart"></li>

<li><label for="hmany">How Many?</label></li>
<input type="range" min="1" max="5" name="hmany" input id="quantity">
<li><label for="hmany">How Many?</label>
<input type="range" min="1" max="5" id="hmany"></li>

<li><label for="ctype">Car Type:</label></li>
<input type="text" name="ctyper" input id="type">

<li><label for="cmodel">Car Model:</label></li>
<input type="text" name="cmodel" input id="model">
<li><label for="ctype">Car Type:</label>
<input type="text" id="ctype"></li>

<li><label for="ycar">Year:</label></li>
<input type="text" name="ycar" input id="year">
<li><label for="cmodel">Car Model:</label>
<input type="text" id="cmodel"></li>

<li><label for="deliver">Used:</label>
<input type="radio" name="obtain" input id="delivery">
<li><label for="ycar">Year:</label>
<input type="text" id="ycar"></li>

<label for="deliver">New:</label>
<input type="radio" name="obtain" input id="delivery" checked="checked"></li>
<li><label for="used">Used:</label>
<input type="radio" name="style" id="used">
<label for="new">New:</label>
<input type="radio" name="style" id="new" checked="checked"></li>

<p><li><label for="special">Special Request:</label></li>
<textarea autofocus></textarea><br></p>
<li><label for="special">Special Request:</label>
<textarea id="special"></textarea></li><br>
</ul>
</fieldset>
</form>

<!-- End Of Form -->

<!-- Save Information needed or Display your Order -->
<p><input type="submit" value="Save Info">


<input type="submit" value="Save" id="submit" /><br />

</form>
<!-- Clear Storage Link and Display Order Link -->
<h5><a href="#">Clear Local Storage</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Display Order</a></h5></p>

<nav>
<small>
<a href="#" id="clear">Clear Local Storage</a>
<a href="#" id="displayLink">View Parts Needed</a>
<a href="additem.html" id="addNew" style="display:none;">Add New Part</a>
</small>
</nav>
<!-- JavaScript -->
<script src="main.js" type="text/javascript"></script>
</body>
</html>
38 changes: 19 additions & 19 deletions index.html
@@ -1,40 +1,40 @@
<!DOCTYPE HTML>

<!-- Jonell Colon -->
<!-- Project 1 VFW -->
<!-- Project 2 VFW -->
<!-- Term 1204 -->

<html>
<head>
<head>

<meta charset="UTF-8">
<meta name="keywords" content="Auto, Parts, Car, Autoparts"/>
<meta name="description" content="Order your car part on your mobile"/>
<meta name="robots" content="INDEX"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="HandheldFriendly" content="True"/>
<meta charset="UTF-8">
<meta name="keywords" content="Auto, Parts, Car, Autoparts"/>
<meta name="description" content="Order your car part on your mobile"/>
<meta name="robots" content="INDEX"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="HandheldFriendly" content="True"/>
<link rel="stylesheet" href="styles.css" />
<title>MeCPART HELP</title>
</head>

<title>AutoPart Prepare</title>
</head>

<body>
<header>
<body>
<header>

<h1><span>AutoPart Request</span></h1>
<h3>Get your parts list ready while examining the car.</h3>
<h1><span>MeCPART HELP</span></h1>
<p>Get your parts list ready while examining the car.</p>

</header>
</header>

<article>

<p>With AutoParts Request app you can prepare for your car needs. This app is intended for all, from the professional mechanic to the hard working customer.</p>
<p>With MeCPART you can prepare for your car repair needs. This app is intended for all, from the professional mechanic to the hard working customer.</p>

</article>

<h3><a href="additem.html">Add Car Part</a></h3>
<a href="additem.html"><strong>Add Car Part</strong></a>



</body>
</body>

</html>
143 changes: 143 additions & 0 deletions main.js
@@ -0,0 +1,143 @@
// Jonell Colon
// Term 1204
// Project 2 VFW
// Local Storage

// Wait until the DOM is ready
window.addEventListener("DOMContentLoaded", function(){

// getElementById Function
function $(x){
var theElement = document.getElementById(x);
return theElement;
}

// Create select field element and populate with options.
function makeCats(){
var formTag = document.getElementsByTagName("form"), //formTag is an array.
selectLi = $("select"),
makeSelect = document.createElement("select");
makeSelect.setAttribute("id", "groups");
for(var i=0, j=contactGroups.length; i<j; i++){
var makeOption = document.createElement("option");
var optText = contactGroups[i];
makeOption.setAttribute("value", optText);
makeOption.innerHTML = optText;
makeSelect.appendChild(makeOption);
}
selectLi.appendChild(makeSelect);
}

// Find value of selected radio button.
function getSelectedRadio(){
var radios = document.forms[0].style;
for(var i=0; i<radios.length; i++){
if(radios[i].checked){
partStyle = radios[i].style;
}
}

}

function toggleControls(n){
switch(n){
case "on":
$("partList").style.display = "none";
$("clear").style.display = "inline";
$("displayLink").style.display = "none";
$("addNew").style.display = "inline";
break;
case "off":
$("partList").style.display = "block";
$("clear").style.display = "inline";
$("displayLink").style.display = "inline";
$("addNew").style.display = "none";
$("items").style.display = "none";
break;
default:
return false;
}
}

function storeData(){

var id = Math.floor(Math.random()*100000001);

getSelectedRadio();

var item = {};
item.group = ["Group: ", $("groups").value];
item.fullname = ["Full Name: ", $("fullname").value];
item.phone = ["Phone Number: ", $("phone").value];
item.cpart = ["Car Part: ", $("cpart").value];
item.hmany = ["How Many: ", $("hmany").value];
item.ctype = ["Car Type: ", $("ctype").value];
item.ycar = ["Car Year: ", $("ycar").value];
item.style = ["Value: ", partStyle];
item.special = ["Special Request: ", $("special").value];

//Save data to Local Storage: Stringify.
localStorage.setItem(id, JSON.stringify(item));
alert("Part Information Saved!");

}

function getData(){
toggleControls("on");
if(localStorage.length === 0){
alert("There is no data in Local Storage.");
}
// Write Data into Local Storage
var makeDiv = document.createElement("div");
makeDiv.setAttribute("id", "items");
var makeList = document.createElement("ul");
makeDiv.appendChild(makeList);
document.body.appendChild(makeDiv);
$("items").style.display = "block";
for(var i=0, len=localStorage.length; i<len;i++){
var makeli = document.createElement("li");
makeList.appendChild(makeli);
var key = localStorage.key(i);
var value = localStorage.getItem(key);
var obj = JSON.parse(value);
var makeSubList = document.createElement("ul");
makeli.appendChild(makeSubList);
for(var n in obj){
var makeSubli = document.createElement("li");
makeSubList.appendChild(makeSubli);
var optSubText = obj[n][0]+" "+obj[n][1];
makeSubli.innerHTML = optSubText;
}

}

}

function clearLocal(){
if(localStorage.length === 0){
alert("There is no data to clear.")
}else{
localStorage.clear();
alert("All Data is deleted!");
window.location.reload();
return false;
}
}

// Variable defaults
var contactGroups = ["--Choose One--", "Motor", "Cabin", "Wheels", "Body", "Trunk", "Exhaust"],
partValue
;
makeCats();

// Set Link & Submit Click Events
var displayLink = $("displayLink");
displayLink.addEventListener("click", getData);
var clearLink = $("clear");
clearLink.addEventListener("click", clearLocal);
var save = $("submit");
save.addEventListener("click", storeData);



});

0 comments on commit 0187141

Please sign in to comment.