"; //
list += "
";
- list += "
" + punchList[i].subject + "
"; //
+ list += "
" + punchList[i].subject + "
"; //
list += "
Status: " + punchList[i].progress + "
";
list += "
Priority: " + punchList[i].priority + "
";
list += "
Need By: " + punchList[i].nDate + "
";
@@ -96,12 +106,12 @@ function genList(punchList, element) {
list += "
";
list += "
";
list += "
";
- list += "
";
- list += "
";
- list += "
start";
- list += "
done";
- list += "
edit";
- list += "
delete";
+ list += "
";
+ list += "
";
+ list += "
start";
+ list += "
done";
+ list += "
edit";
+ list += "
delete";
list += "
";
}
} else {
@@ -109,7 +119,7 @@ function genList(punchList, element) {
list += "
"; //
list += "
"; //
list += "
";
- list += "
" + punchList[i].subject + "
"; //
+ list += "
" + punchList[i].subject + "
"; //
list += "
Status: " + punchList[i].progress + "
";
list += "
Priority: " + punchList[i].priority + "
";
list += "
Need By: " + punchList[i].nDate + "
";
@@ -124,12 +134,12 @@ function genList(punchList, element) {
list += "
";
list += "
";
list += "
";
- list += "
";
- list += "
";
- list += "
start";
- list += "
done";
- list += "
edit";
- list += "
delete";
+ list += "
";
+ list += "
";
+ list += "
start";
+ list += "
done";
+ list += "
edit";
+ list += "
delete";
list += "
";
}
}
@@ -160,13 +170,12 @@ function completePunch(item) {
putJson(jsonStr);
}
-function enablePunchDetail(item) {
+function enablePunchDetail(uuid) {
var punchList = window.punches;
+ item = findArrayId(uuid);
console.log(`inside enablePunchDetail`);
disableElement("punchListAll");
- console.log(`punchList Disabled`);
enableElement("punchDetail");
- console.log(`punchDetail Enabled`);
// html = "";
html = "
subject: " + punchList[item].subject + "
Created: " + punchList[item].cDate + "
Modified Date: " + punchList[item].mDate + "
Priority: " + punchList[item].priority + "
Progress: " + punchList[item].progress + "
";
document.getElementById("punchDetail").innerHTML = html;
@@ -185,7 +194,7 @@ function createNewEvent() {
var nDateField = document.getElementById("timepickerCreate").value;
var notesField = document.getElementById("newNotes").value;
- var newEventJson = { nDate: nDateField, subject: subjectField, priority: priorityField, progress: progressField, notes: notesField };
+ var newEventJson = { uuid: genUid(), nDate: nDateField, subject: subjectField, priority: priorityField, progress: progressField, notes: notesField };
punchList.push(newEventJson);
jsonStr = JSON.stringify(punchList);
putJson(jsonStr);
@@ -194,10 +203,11 @@ function createNewEvent() {
// document.getElementById("newEventList").innerHTML = jsonStr;
}
-function deletePunch(item) {
+function deletePunch(uuid) {
// console.log(`${punchList}`);
// console.log(`${window.punches}`);
punchList = window.punches;
+ item = findArrayId(uuid);
console.log(`splicing ${item}`);
@@ -251,12 +261,13 @@ function toggleShowDone() {
getJson();
}
-function editPunch(item) {
+function editPunch(uuid) {
disableElement("newEvent");
disableElement("punchListAll");
enableElement("editPunch");
punchList = window.punches;
+ item = findArrayId(uuid);
var id = item;
@@ -297,7 +308,7 @@ function submitEditPunch() {
function addTag() {
var item = document.getElementById("editID").value;
- var newTag = document.getElementById("tag").value;
+ var newTag = document.getElementById("tag").value.toLowerCase();
console.log(`Item: ${item}`);
console.log(`New Tag: ${newTag}`);
@@ -321,3 +332,15 @@ function clearDefault(a){
a.value="";
}
}
+
+function genUid() {
+ function chr4() {
+ return Math.random().toString(16).slice(-4);
+ }
+ return chr4() + chr4() +
+ '-' + chr4() +
+ '-' + chr4() +
+ '-' + chr4() +
+ '-' + chr4() + chr4() + chr4();
+}
+
diff --git a/punch_list/metadata.js b/punch_list/metadata.js
index 4e47cb0..5b3c3b2 100644
--- a/punch_list/metadata.js
+++ b/punch_list/metadata.js
@@ -1,4 +1,4 @@
-var version = "0.3.045",
+var version = "0.3.047",
debug = false,
jsonUrl = "https://api.myjson.com/bins/1dodsj",
showDone = false,