set max dates

deepsource-autofix-76c6eb20
Dan Gowans 2022-10-07 14:56:29 -04:00
parent 57132e000d
commit aa7430a554
10 changed files with 81 additions and 29 deletions

View File

@ -97,7 +97,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
lotId;
modalElement.querySelector("#lotCommentEdit--lotCommentId").value = lotCommentId.toString();
modalElement.querySelector("#lotCommentEdit--lotComment").value = lotComment.lotComment;
modalElement.querySelector("#lotCommentEdit--lotCommentDateString").value = lotComment.lotCommentDateString;
const lotCommentDateStringElement = modalElement.querySelector("#lotCommentEdit--lotCommentDateString");
lotCommentDateStringElement.value = lotComment.lotCommentDateString;
const currentDateString = cityssm.dateToString(new Date());
lotCommentDateStringElement.max =
lotComment.lotCommentDateString <= currentDateString
? currentDateString
: lotComment.lotCommentDateString;
modalElement.querySelector("#lotCommentEdit--lotCommentTimeString").value = lotComment.lotCommentTimeString;
},
onshown: (modalElement, closeModalFunction) => {

View File

@ -150,11 +150,20 @@ declare const bulmaJS: BulmaJS;
(
modalElement.querySelector("#lotCommentEdit--lotComment") as HTMLInputElement
).value = lotComment.lotComment;
(
modalElement.querySelector(
const lotCommentDateStringElement = modalElement.querySelector(
"#lotCommentEdit--lotCommentDateString"
) as HTMLInputElement
).value = lotComment.lotCommentDateString;
) as HTMLInputElement;
lotCommentDateStringElement.value = lotComment.lotCommentDateString;
const currentDateString = cityssm.dateToString(new Date());
lotCommentDateStringElement.max =
lotComment.lotCommentDateString <= currentDateString
? currentDateString
: lotComment.lotCommentDateString;
(
modalElement.querySelector(
"#lotCommentEdit--lotCommentTimeString"

View File

@ -368,8 +368,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
document
.querySelector("#lotOccupancy--occupancyStartDateString")
.addEventListener("change", () => {
const endDatePicker = document.querySelector("#lotOccupancy--occupancyEndDateString")
.bulmaCalendar.datePicker;
const endDatePicker = document.querySelector("#lotOccupancy--occupancyEndDateString").bulmaCalendar.datePicker;
endDatePicker.min = document.querySelector("#lotOccupancy--occupancyStartDateString").value;
endDatePicker.refresh();
});
@ -636,7 +635,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyId").value = lotOccupancyId;
modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentId").value = lotOccupancyCommentId.toString();
modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyComment").value = lotOccupancyComment.lotOccupancyComment;
modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentDateString").value = lotOccupancyComment.lotOccupancyCommentDateString;
const lotOccupancyCommentDateStringElement = modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentDateString");
lotOccupancyCommentDateStringElement.value =
lotOccupancyComment.lotOccupancyCommentDateString;
const currentDateString = cityssm.dateToString(new Date());
lotOccupancyCommentDateStringElement.max =
lotOccupancyComment.lotOccupancyCommentDateString <= currentDateString
? currentDateString
: lotOccupancyComment.lotOccupancyCommentDateString;
modalElement.querySelector("#lotOccupancyCommentEdit--lotOccupancyCommentTimeString").value = lotOccupancyComment.lotOccupancyCommentTimeString;
},
onshown: (modalElement, closeModalFunction) => {

View File

@ -529,8 +529,9 @@ declare const bulmaJS: BulmaJS;
document
.querySelector("#lotOccupancy--occupancyStartDateString")
.addEventListener("change", () => {
const endDatePicker = document.querySelector("#lotOccupancy--occupancyEndDateString")
.bulmaCalendar.datePicker;
const endDatePicker = (
document.querySelector("#lotOccupancy--occupancyEndDateString") as HTMLInputElement
).bulmaCalendar.datePicker;
endDatePicker.min = (
document.querySelector(
@ -981,11 +982,21 @@ declare const bulmaJS: BulmaJS;
"#lotOccupancyCommentEdit--lotOccupancyComment"
) as HTMLInputElement
).value = lotOccupancyComment.lotOccupancyComment;
(
modalElement.querySelector(
const lotOccupancyCommentDateStringElement = modalElement.querySelector(
"#lotOccupancyCommentEdit--lotOccupancyCommentDateString"
) as HTMLInputElement
).value = lotOccupancyComment.lotOccupancyCommentDateString;
) as HTMLInputElement;
lotOccupancyCommentDateStringElement.value =
lotOccupancyComment.lotOccupancyCommentDateString;
const currentDateString = cityssm.dateToString(new Date());
lotOccupancyCommentDateStringElement.max =
lotOccupancyComment.lotOccupancyCommentDateString <= currentDateString
? currentDateString
: lotOccupancyComment.lotOccupancyCommentDateString;
(
modalElement.querySelector(
"#lotOccupancyCommentEdit--lotOccupancyCommentTimeString"

View File

@ -713,7 +713,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
const workOrderComment = workOrderComments.find((currentComment) => {
return currentComment.workOrderCommentId === workOrderCommentId;
});
console.log(workOrderComments);
let editFormElement;
let editCloseModalFunction;
const editComment = (submitEvent) => {
@ -738,7 +737,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
modalElement.querySelector("#workOrderCommentEdit--workOrderId").value = workOrderId;
modalElement.querySelector("#workOrderCommentEdit--workOrderCommentId").value = workOrderCommentId.toString();
modalElement.querySelector("#workOrderCommentEdit--workOrderComment").value = workOrderComment.workOrderComment;
modalElement.querySelector("#workOrderCommentEdit--workOrderCommentDateString").value = workOrderComment.workOrderCommentDateString;
const workOrderCommentDateStringElement = modalElement.querySelector("#workOrderCommentEdit--workOrderCommentDateString");
workOrderCommentDateStringElement.value =
workOrderComment.workOrderCommentDateString;
const currentDateString = cityssm.dateToString(new Date());
workOrderCommentDateStringElement.max =
workOrderComment.workOrderCommentDateString <= currentDateString
? currentDateString
: workOrderComment.workOrderCommentDateString;
modalElement.querySelector("#workOrderCommentEdit--workOrderCommentTimeString").value = workOrderComment.workOrderCommentTimeString;
},
onshown: (modalElement, closeModalFunction) => {

View File

@ -986,8 +986,6 @@ declare const bulmaJS: BulmaJS;
return currentComment.workOrderCommentId === workOrderCommentId;
});
console.log(workOrderComments);
let editFormElement: HTMLFormElement;
let editCloseModalFunction: () => void;
@ -1035,11 +1033,21 @@ declare const bulmaJS: BulmaJS;
"#workOrderCommentEdit--workOrderComment"
) as HTMLInputElement
).value = workOrderComment.workOrderComment;
(
modalElement.querySelector(
const workOrderCommentDateStringElement = modalElement.querySelector(
"#workOrderCommentEdit--workOrderCommentDateString"
) as HTMLInputElement
).value = workOrderComment.workOrderCommentDateString;
) as HTMLInputElement;
workOrderCommentDateStringElement.value =
workOrderComment.workOrderCommentDateString;
const currentDateString = cityssm.dateToString(new Date());
workOrderCommentDateStringElement.max =
workOrderComment.workOrderCommentDateString <= currentDateString
? currentDateString
: workOrderComment.workOrderCommentDateString;
(
modalElement.querySelector(
"#workOrderCommentEdit--workOrderCommentTimeString"

View File

@ -1 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const t=exports.los,e=document.querySelector("main").dataset.urlPrefix,o=document.querySelector("#lot--lotId").value,l=""===o,s=document.querySelector("#form--lot");s.addEventListener("submit",t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/"+(l?"doCreateLot":"doUpdateLot"),s,t=>{t.success?l?window.location.href=e+"/lots/"+t.lotId+"/edit":bulmaJS.alert({message:exports.aliases.lot+" Updated Successfully",contextualColorName:"success"}):bulmaJS.alert({title:"Error Updating "+exports.aliases.lot,message:t.errorMessage,contextualColorName:"danger"})})}),t.initializeUnlockFieldButtons(s),l||document.querySelector("#button--deleteLot").addEventListener("click",t=>{t.preventDefault();bulmaJS.confirm({title:"Delete "+exports.aliases.lot,message:"Are you sure you want to delete this "+exports.aliases.lot.toLowerCase()+"?",contextualColorName:"warning",okButton:{text:"Yes, Delete "+exports.aliases.lot,callbackFunction:()=>{cityssm.postJSON(e+"/lots/doDeleteLot",{lotId:o},t=>{t.success?(cityssm.disableNavBlocker(),window.location.href=e+"/lots/?t="+Date.now()):bulmaJS.alert({title:"Error Deleting "+exports.aliases.lot,message:t.errorMessage,contextualColorName:"danger"})})}}})});let n=exports.lotComments;delete exports.lotComments;const r=l=>{const s=Number.parseInt(l.currentTarget.closest("tr").dataset.lotCommentId,10),r=n.find(t=>t.lotCommentId===s);let a,i;const d=t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/doUpdateLotComment",a,t=>{t.success?(n=t.lotComments,i(),m()):bulmaJS.alert({title:"Error Updating Comment",message:t.errorMessage,contextualColorName:"danger"})})};cityssm.openHtmlModal("lot-editComment",{onshow:e=>{t.populateAliases(e),e.querySelector("#lotCommentEdit--lotId").value=o,e.querySelector("#lotCommentEdit--lotCommentId").value=s.toString(),e.querySelector("#lotCommentEdit--lotComment").value=r.lotComment,e.querySelector("#lotCommentEdit--lotCommentDateString").value=r.lotCommentDateString,e.querySelector("#lotCommentEdit--lotCommentTimeString").value=r.lotCommentTimeString},onshown:(e,o)=>{bulmaJS.toggleHtmlClipped(),t.initializeDatePickers(e),t.initializeTimePickers(e),e.querySelector("#lotCommentEdit--lotComment").focus(),(a=e.querySelector("form")).addEventListener("submit",d),i=o},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})},a=t=>{const l=Number.parseInt(t.currentTarget.closest("tr").dataset.lotCommentId,10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:()=>{cityssm.postJSON(e+"/lots/doDeleteLotComment",{lotId:o,lotCommentId:l},t=>{t.success?(n=t.lotComments,m()):bulmaJS.alert({title:"Error Removing Comment",message:t.errorMessage,contextualColorName:"danger"})})}},contextualColorName:"warning"})},m=()=>{const t=document.querySelector("#container--lotComments");if(0===n.length)return void(t.innerHTML='<div class="message is-info"><p class="message-body">There are no comments to display.</p></div>');const e=document.createElement("table");e.className="table is-fullwidth is-striped is-hoverable",e.innerHTML='<thead><tr><th>Commentor</th><th>Comment Date</th><th>Comment</th><th class="is-hidden-print"><span class="is-sr-only">Options</span></th></tr></thead><tbody></tbody>';for(const t of n){const o=document.createElement("tr");o.dataset.lotCommentId=t.lotCommentId.toString(),o.innerHTML="<td>"+cityssm.escapeHTML(t.recordCreate_userName)+"</td><td>"+t.lotCommentDateString+(0===t.lotCommentTime?"":" "+t.lotCommentTimeString)+"</td><td>"+cityssm.escapeHTML(t.lotComment)+'</td><td class="is-hidden-print"><div class="buttons are-small is-justify-content-end"><button class="button is-primary button--edit" type="button"><span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span> <span>Edit</span></button><button class="button is-light is-danger button--delete" data-tooltip="Delete Comment" type="button" aria-label="Delete"><i class="fas fa-trash" aria-hidden="true"></i></button></div></td>',o.querySelector(".button--edit").addEventListener("click",r),o.querySelector(".button--delete").addEventListener("click",a),e.querySelector("tbody").append(o)}t.innerHTML="",t.append(e)},i=()=>{let l;const s=t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/doAddLotComment",t.currentTarget,t=>{t.success&&(n=t.lotComments,m(),l())})};cityssm.openHtmlModal("lot-addComment",{onshow(e){t.populateAliases(e),e.querySelector("#lotCommentAdd--lotId").value=o,e.querySelector("form").addEventListener("submit",s)},onshown(t,e){bulmaJS.toggleHtmlClipped(),l=e,t.querySelector("#lotCommentAdd--lotComment").focus()},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#lotComments--add").focus()}})};l||(document.querySelector("#lotComments--add").addEventListener("click",i),m())})();
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),(()=>{const t=exports.los,e=document.querySelector("main").dataset.urlPrefix,o=document.querySelector("#lot--lotId").value,l=""===o,s=document.querySelector("#form--lot");s.addEventListener("submit",t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/"+(l?"doCreateLot":"doUpdateLot"),s,t=>{t.success?l?window.location.href=e+"/lots/"+t.lotId+"/edit":bulmaJS.alert({message:exports.aliases.lot+" Updated Successfully",contextualColorName:"success"}):bulmaJS.alert({title:"Error Updating "+exports.aliases.lot,message:t.errorMessage,contextualColorName:"danger"})})}),t.initializeUnlockFieldButtons(s),l||document.querySelector("#button--deleteLot").addEventListener("click",t=>{t.preventDefault();bulmaJS.confirm({title:"Delete "+exports.aliases.lot,message:"Are you sure you want to delete this "+exports.aliases.lot.toLowerCase()+"?",contextualColorName:"warning",okButton:{text:"Yes, Delete "+exports.aliases.lot,callbackFunction:()=>{cityssm.postJSON(e+"/lots/doDeleteLot",{lotId:o},t=>{t.success?(cityssm.disableNavBlocker(),window.location.href=e+"/lots/?t="+Date.now()):bulmaJS.alert({title:"Error Deleting "+exports.aliases.lot,message:t.errorMessage,contextualColorName:"danger"})})}}})});let n=exports.lotComments;delete exports.lotComments;const a=l=>{const s=Number.parseInt(l.currentTarget.closest("tr").dataset.lotCommentId,10),a=n.find(t=>t.lotCommentId===s);let r,i;const d=t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/doUpdateLotComment",r,t=>{t.success?(n=t.lotComments,i(),m()):bulmaJS.alert({title:"Error Updating Comment",message:t.errorMessage,contextualColorName:"danger"})})};cityssm.openHtmlModal("lot-editComment",{onshow:e=>{t.populateAliases(e),e.querySelector("#lotCommentEdit--lotId").value=o,e.querySelector("#lotCommentEdit--lotCommentId").value=s.toString(),e.querySelector("#lotCommentEdit--lotComment").value=a.lotComment;const l=e.querySelector("#lotCommentEdit--lotCommentDateString");l.value=a.lotCommentDateString;const n=cityssm.dateToString(new Date);l.max=a.lotCommentDateString<=n?n:a.lotCommentDateString,e.querySelector("#lotCommentEdit--lotCommentTimeString").value=a.lotCommentTimeString},onshown:(e,o)=>{bulmaJS.toggleHtmlClipped(),t.initializeDatePickers(e),t.initializeTimePickers(e),e.querySelector("#lotCommentEdit--lotComment").focus(),(r=e.querySelector("form")).addEventListener("submit",d),i=o},onremoved:()=>{bulmaJS.toggleHtmlClipped()}})},r=t=>{const l=Number.parseInt(t.currentTarget.closest("tr").dataset.lotCommentId,10);bulmaJS.confirm({title:"Remove Comment?",message:"Are you sure you want to remove this comment?",okButton:{text:"Yes, Remove Comment",callbackFunction:()=>{cityssm.postJSON(e+"/lots/doDeleteLotComment",{lotId:o,lotCommentId:l},t=>{t.success?(n=t.lotComments,m()):bulmaJS.alert({title:"Error Removing Comment",message:t.errorMessage,contextualColorName:"danger"})})}},contextualColorName:"warning"})},m=()=>{const t=document.querySelector("#container--lotComments");if(0===n.length)return void(t.innerHTML='<div class="message is-info"><p class="message-body">There are no comments to display.</p></div>');const e=document.createElement("table");e.className="table is-fullwidth is-striped is-hoverable",e.innerHTML='<thead><tr><th>Commentor</th><th>Comment Date</th><th>Comment</th><th class="is-hidden-print"><span class="is-sr-only">Options</span></th></tr></thead><tbody></tbody>';for(const t of n){const o=document.createElement("tr");o.dataset.lotCommentId=t.lotCommentId.toString(),o.innerHTML="<td>"+cityssm.escapeHTML(t.recordCreate_userName)+"</td><td>"+t.lotCommentDateString+(0===t.lotCommentTime?"":" "+t.lotCommentTimeString)+"</td><td>"+cityssm.escapeHTML(t.lotComment)+'</td><td class="is-hidden-print"><div class="buttons are-small is-justify-content-end"><button class="button is-primary button--edit" type="button"><span class="icon is-small"><i class="fas fa-pencil-alt" aria-hidden="true"></i></span> <span>Edit</span></button><button class="button is-light is-danger button--delete" data-tooltip="Delete Comment" type="button" aria-label="Delete"><i class="fas fa-trash" aria-hidden="true"></i></button></div></td>',o.querySelector(".button--edit").addEventListener("click",a),o.querySelector(".button--delete").addEventListener("click",r),e.querySelector("tbody").append(o)}t.innerHTML="",t.append(e)},i=()=>{let l;const s=t=>{t.preventDefault(),cityssm.postJSON(e+"/lots/doAddLotComment",t.currentTarget,t=>{t.success&&(n=t.lotComments,m(),l())})};cityssm.openHtmlModal("lot-addComment",{onshow(e){t.populateAliases(e),e.querySelector("#lotCommentAdd--lotId").value=o,e.querySelector("form").addEventListener("submit",s)},onshown(t,e){bulmaJS.toggleHtmlClipped(),l=e,t.querySelector("#lotCommentAdd--lotComment").focus()},onremoved(){bulmaJS.toggleHtmlClipped(),document.querySelector("#lotComments--add").focus()}})};l||(document.querySelector("#lotComments--add").addEventListener("click",i),m())})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -133,7 +133,13 @@
<div class="field">
<label class="label" for="workOrderEdit--workOrderOpenDateString">Open Date</label>
<div class="control has-icons-left">
<input class="input" id="workOrderEdit--workOrderOpenDateString" name="workOrderOpenDateString" type="date" value="<%= workOrder.workOrderOpenDateString %>" required />
<%
const currentDateString = dateTimeFunctions.dateToString(new Date());
%>
<input class="input" id="workOrderEdit--workOrderOpenDateString" name="workOrderOpenDateString" type="date"
value="<%= workOrder.workOrderOpenDateString %>"
max="<%= workOrder.workOrderOpenDateString > currentDateString ? workOrder.workOrderOpenDateString : currentDateString %>"
required />
<span class="icon is-left">
<i class="fas fa-calendar" aria-hidden="true"></i>
</span>