Added more content to the add page.

Also moved the add.js file to the new static
folder to align with how flask projects should be
laid out.
This commit is contained in:
Billy 2024-04-29 19:32:48 -04:00
parent 17e0d560cc
commit e84d75e07f
3 changed files with 177 additions and 11 deletions

35
static/add.js Normal file
View File

@ -0,0 +1,35 @@
function add_asset() {
let serial = document.getElementById("add-asset-serial");
let tag = document.getElementById("add-asset-tag");
let category = document.getElementById("add-asset-category");
let model = document.getElementById("add-asset-model");
if (tag.value == "") {
tag = null;
} else {
tag = tag.value;
document.getElementById("add-asset-tag").value = "";
}
if (serial.value == "") {
alert('Serial field cannot be empty!')
return;
} else {
serial = serial.value;
document.getElementById("add-asset-serial").value = "";
}
if (category.value == "N/A") {
category = null;
} else {
category = category.value;
document.getElementById("add-asset-category").value = "N/A";
}
if (model.value == "N/A") {
model = null;
} else {
model = model.value;
document.getElementById("add-asset-model").value = "N/A";
}
console.log(serial,tag,category,model);
}

View File

@ -1,3 +0,0 @@
function update_add_asset_model() {
}

View File

@ -21,50 +21,184 @@
<body> <body>
<div class="col">
<h1>Assets</h1>
Stuff pertaining to laptops and ipads.
<h2>Adding assets</h2>
<p>The asset tag is a pseudo-optional field and will assign based on the
database and auto increment the database counter if not provided.</p>
<p>The serial is required for an asset.</p>
<p>Both the model and category are optional fields.</p>
<h2>Modifying assets</h2>
<p>Provide the asset tag to modify the serial, model, and category.</p>
<p>The serial should only be modified to correct erroneous data.</p>
</div>
<div class="col">
<h1>Users</h1>
We know what users are...
<h2>Adding users</h2>
<p>The user name field is required as that is how we identify users.</p>
<p>The user ID field is optional and an ID will automatically be
assigned if an ID is not provided.
</p>
<p>The assigned card and assigned asset fields are optional.</p>
<h2>Modifying users</h2>
<p>Provide the user id of the user you want to modify.</p>
<p>Typically used to assign cards and assets as needed.</p>
</div>
<div class="col">
<h1>Access cards</h1>
Access cards have two numbers, the display number on the front, and the
actual card number on the back. The card number should be 3 or 4 digits.
<h2>Adding access cards</h2>
The card number is required as it is usually a unique value.
<h2>Modifying access cards</h2>
Supply the card number that you want to modify the display number on.
E.g. change card no. 879's display number from null to 8.
</div>
<div class="col"> <div class="col">
<h1>Add asset</h1> <h1>Add asset</h1>
<form action="javascript:add_asset()"> <form action="javascript:add_asset()">
<label for="asset-serial">Serial:</label> <label for="add-asset-tag">Asset Tag:</label>
<input type="text" name="asset-serial" id="asset-serial"> <input type="number" name="add-asset-tag" id="add-asset-tag">
<br> <br>
<br> <br>
<label for="asset-category">Category:</label> <label for="add-asset-serial">Serial:</label>
<select name="asset-category" id="asset-category"> <input type="text" name="add-asset-serial" id="add-asset-serial">
<br>
<br>
<label for="add-asset-category">Category:</label>
<select name="add-asset-category" id="add-asset-category">
<option value="N/A">N/A</option>
<option value="LAPTOP">Laptop</option> <option value="LAPTOP">Laptop</option>
<option value="IPAD">iPad</option> <option value="IPAD">iPad</option>
</select> </select>
<br> <br>
<br> <br>
<label for="asset-model">Model:</label> <label for="add-asset-model">Model:</label>
<select name="asset-model" id="asset-model" disabled="disabled"> <select name="add-asset-model" id="add-asset-model">
<option value="N/A">N/A</option>
<option value="AIR_M1">Air M1</option> <option value="AIR_M1">Air M1</option>
<option value="AIR_M2">Air M2</option> <option value="AIR_M2">Air M2</option>
<option value="PRO_M1">Pro M1</option> <option value="PRO_M1">Pro M1</option>
<option value="PRO_M2">Pro M2</option> <option value="PRO_M2">Pro M2</option>
<option value="IPAD_GEN9">Pro M2</option>
</select> </select>
<br> <br>
<br> <br>
<button>Submit</button> <button>Submit</button>
</form> </form>
</div> </div>
<div class="col"> <div class="col">
<h1>Add user</h1> <h1>Add user</h1>
<form action="javascript:add_user()">
<label for="add-user-id">User ID:</label>
<input type="number" name="add-user-id" id="add-user-id">
<br>
<br>
<label for="add-user-name">User name:</label>
<input type="text" name="add-user-name" id="add-user-name">
<br>
<br>
<label for="add-assigned-asset">Assigned asset:</label>
<input type="number" name="add-assigned-asset" id="add-assigned-asset">
<br>
<br>
<label for="add-assigned-card">Assigned card:</label>
<input type="number" name="add-assigned-card" id="add-assigned-card">
<br>
<br>
<button>Submit</button>
</form>
</div> </div>
<div class="col"> <div class="col">
<h1>Add access card</h1> <h1>Add access card</h1>
<form action="javascript:add_card()">
<label for="add-display-number">Display number:</label>
<input type="number" name="add-display-number" id="add-display-number">
<br>
<br>
<label for="add-card-number">Card number:</label>
<input type="number" name="add-card-number" id="add-card-number">
<br>
<br>
<button>Submit</button>
</form>
</div> </div>
<div class="col"> <div class="col">
<h1>Modify asset</h1> <h1>Modify asset</h1>
<form action="javascript:modify_asset()">
<label for="modify-asset-tag">Asset Tag:</label>
<input type="number" name="modify-asset-tag" id="modify-asset-tag">
<br>
<br>
<label for="modify-asset-serial">Serial:</label>
<input type="text" name="modify-asset-serial" id="modify-asset-serial">
<br>
<br>
<label for="modify-asset-category">Category:</label>
<select name="modify-asset-category" id="modify-asset-category">
<option value="N/A">N/A</option>
<option value="LAPTOP">Laptop</option>
<option value="IPAD">iPad</option>
</select>
<br>
<br>
<label for="modify-asset-model">Model:</label>
<select name="modify-asset-model" id="modify-asset-model">
<option value="N/A">N/A</option>
<option value="AIR_M1">Air M1</option>
<option value="AIR_M2">Air M2</option>
<option value="PRO_M1">Pro M1</option>
<option value="PRO_M2">Pro M2</option>
<option value="IPAD_GEN9">Pro M2</option>
</select>
<br>
<br>
<button>Submit</button>
</form>
</div> </div>
<div class="col"> <div class="col">
<h1>Modify user</h1> <h1>Modify user</h1>
<form action="javascript:modify_user()">
<label for="modify-user-id">User ID:</label>
<input type="number" name="modify-user-id" id="modify-user-id">
<br>
<br>
<label for="modify-user-name">User name:</label>
<input type="text" name="modify-user-name" id="modify-user-name">
<br>
<br>
<label for="modify-assigned-asset">Assigned asset:</label>
<input type="number" name="modify-assigned-asset" id="modify-assigned-asset">
<br>
<br>
<label for="modify-assigned-card">Assigned card:</label>
<input type="number" name="modify-assigned-card" id="modify-assigned-card">
<br>
<br>
<button>Submit</button>
</form>
</div> </div>
<div class="col"> <div class="col">
<h1>Modify access card</h1> <h1>Modify access card</h1>
<form action="javascript:modify_card()">
<label for="modify-display-number">Display number:</label>
<input type="number" name="modify-display-number" id="modify-display-number">
<br>
<br>
<label for="modify-card-number">Card number:</label>
<input type="number" name="modify-card-number" id="modify-card-number">
<br>
<br>
<button>Submit</button>
</form>
</div> </div>
<script src="add.js"></script> <script src="{{url_for('static', filename='add.js')}}"></script>
</body> </body>