Skip to content

Commit

Permalink
Merge pull request #517 from vinayak-00017/feature/issue-489/replacin…
Browse files Browse the repository at this point in the history
…g-var-with-var-and-const

refactor: replace var with const and let
  • Loading branch information
robotichead authored Oct 15, 2023
2 parents 91a7b7c + e1e4d59 commit f64984e
Show file tree
Hide file tree
Showing 30 changed files with 95 additions and 94 deletions.
2 changes: 1 addition & 1 deletion src/js/components/change_task/ChangeTaskInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export default {
//Stop the usual stuff
event.preventDefault();
var change_task_seconds =
const change_task_seconds =
this.changeEndDateModel - this.changeStartDateModel;
// Create data_to_send
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/change_task/NewChangeTask.vue
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ export default {
return;
}
var change_task_seconds =
const change_task_seconds =
parseInt(this.changeEndDateModel) -
parseInt(this.changeStartDateModel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default {
methods: {
newLink() {
//Open up the modal
var elem_modal = new Modal(
const elem_modal = new Modal(
document.getElementById("newChangeTaskLinkModal")
);
Expand Down
12 changes: 6 additions & 6 deletions src/js/components/customers/NewCustomer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default {
)
.then((response) => {
//Extract the required JSON data
var extracted_data = response.data;
const extracted_data = response.data;
//Look through the extracted data - and map the required fields into stakeholder fix list
this.organisationFixList = extracted_data.map((row) => {
Expand All @@ -172,14 +172,14 @@ export default {
})
.catch(function (error) {
// Get the error modal
var elem_cont =
const elem_cont =
document.getElementById("errorModalContent");
// Update the content
elem_cont.innerHTML = `<strong>Search Organisation Issue:</strong><br/>${error}`;
// Show the modal
var errorModal = new Modal(
const errorModal = new Modal(
document.getElementById("errorModal"),
{
keyboard: false,
Expand All @@ -188,7 +188,7 @@ export default {
errorModal.show();
// Hide the loader
var loader_element = document.getElementById("loader");
const loader_element = document.getElementById("loader");
loader_element.style.display = "none";
});
},
Expand All @@ -210,14 +210,14 @@ export default {
//NEED TO USE MIXIN FOR THIS SECTION
if (!hasFormErrors) {
//Show the error dialog and notify to the user that there were field missing.
var elem_cont =
const elem_cont =
document.getElementById("errorModalContent");
// Update the content
elem_cont.innerHTML = `<strong>FORM ISSUE:</strong> Sorry, but can you please fill out the form completely.`;
// Show the modal
var errorModal = new Modal(
const errorModal = new Modal(
document.getElementById("errorModal")
);
errorModal.show();
Expand Down
4 changes: 2 additions & 2 deletions src/js/components/customers/NewCustomerModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ export default {
//NEED TO USE MIXIN FOR THIS SECTION
if (!isFormCorrect) {
//Show the error dialog and notify to the user that there were field missing.
var elem_cont =
const elem_cont =
document.getElementById("errorModalContent");
// Update the content
elem_cont.innerHTML = `<strong>FORM ISSUE:</strong> Sorry, but can you please fill out the form completely.`;
// Show the modal
var errorModal = new Modal(
const errorModal = new Modal(
document.getElementById("errorModal")
);
errorModal.show();
Expand Down
10 changes: 5 additions & 5 deletions src/js/components/kanban/KanbanBoard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ export default {
// that smaller size
if (columns_width < kanban_container_width) {
//Add in the width restrictions
var header_element = document.getElementsByClassName("kanban-edit-text")[0];
var elements = document.getElementsByClassName("kanban-level-div");
const header_element = document.getElementsByClassName("kanban-edit-text")[0];
const elements = document.getElementsByClassName("kanban-level-div");
//Loop through each element
Array.from(elements).forEach((element) => {
Expand All @@ -155,7 +155,7 @@ export default {
//The columns width is greater than the container width.
//So we need to use the scroll width of the container
const scroll_width = container_element.scrollWidth;
var header_element = document.getElementsByClassName("kanban-edit-text")[0];
const header_element = document.getElementsByClassName("kanban-edit-text")[0];
let elements = document.getElementsByClassName("kanban-level-div");
//Loop through each element
Expand All @@ -169,15 +169,15 @@ export default {
},
scrollProcedure() {
//Make sure the kanban-sticky-row matches the scroll left for the kanban-container
var kanban_sticky =
const kanban_sticky =
document.getElementsByClassName("kanban-sticky-row")[0],
kanban_container =
document.getElementsByClassName("kanban-container")[0];
kanban_sticky.scrollLeft = kanban_container.scrollLeft;
//Get the distance to the top of the page
var scrollTop = document.getElementById("kanban_container").scrollTop;
const scrollTop = document.getElementById("kanban_container").scrollTop;
// var scrollTop =
// window.pageYOffset !== undefined
// ? window.pageYOffset
Expand Down
4 changes: 2 additions & 2 deletions src/js/components/kanban/KanbanPropertyOrder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ export default {
this.newPropertyItem = "";
},
openModal() {
var newItemModal = new Modal(
const newItemModal = new Modal(
document.getElementById(`addItem${this.propertyName}`)
);
newItemModal.show();
Expand Down Expand Up @@ -543,7 +543,7 @@ export default {
this.newCardDestinationList[0].value;
//Show the delete modal
var deleteItemModal = new Modal(
const deleteItemModal = new Modal(
document.getElementById(
`deleteItem${this.propertyName}`
)
Expand Down
14 changes: 7 additions & 7 deletions src/js/components/kanban/kanbanColumnDraggable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,24 +160,24 @@ export default {
methods: {
addNewKanbanCard() {
//Update the modal's data-attributes to reflect the column ID and Level ID
var addKanbanCardModal =
const addKanbanCardModal =
document.getElementById("addKanbanCardModal");
addKanbanCardModal.dataset.kanbanLevel = this.levelId;
addKanbanCardModal.dataset.kanbanColumn = this.columnId;
//Get the Modal from the above modal
var addKanbanCardModal = new Modal(addKanbanCardModal);
addKanbanCardModal.show();
const modalInstance = new Modal(addKanbanCardModal);
modalInstance.show();
},
addNewLink() {
//Update the modal's data-attributes to reflect the column ID and Level ID
var newLinkModal = document.getElementById("newLinkModal");
const newLinkModal = document.getElementById("newLinkModal");
newLinkModal.dataset.kanbanLevel = this.levelId;
newLinkModal.dataset.kanbanColumn = this.columnId;
//Get the Modal from the above modal
var newLinkModal = new Modal(newLinkModal);
newLinkModal.show();
const modalInstance = new Modal(newLinkModal);
modalInstance.show();
},
archiveCards() {
//Send the archive destination to state - it will trigger the modal
Expand Down Expand Up @@ -432,7 +432,7 @@ export default {
two sort orders to both the old and the new*/
//Get the y=data
var new_elem = event.to,
const new_elem = event.to,
old_elem = event.from,
card_id = event.item.dataset.cardId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export default {
});
},
getFriendlyDate(input_date) {
var options = {
const options = {
weekday: "long",
year: "numeric",
month: "long",
Expand Down
4 changes: 2 additions & 2 deletions src/js/components/modules/sub_modules/BugsModule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default {
},
methods: {
addNewBug() {
var addBugModal = new Modal(
const addBugModal = new Modal(
document.getElementById("addBugModal")
);
addBugModal.show();
Expand Down Expand Up @@ -196,7 +196,7 @@ export default {
},
mounted() {
//If the location is inside the array - don't bother getting the data
var escape_array = ["requirement_item"];
const escape_array = ["requirement_item"];
if (escape_array.indexOf(this.destination) >= 0) return;
this.$nextTick(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/js/components/modules/sub_modules/CustomersModule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default {
},
methods: {
addNewCustomer() {
var addCustomerModal = new Modal(
const addCustomerModal = new Modal(
document.getElementById("addCustomerModal")
);
addCustomerModal.show();
Expand Down Expand Up @@ -117,7 +117,7 @@ export default {
},
mounted() {
//If the location is inside the array - don't bother getting the data
var escape_array = ["requirement_item"];
const escape_array = ["requirement_item"];
if (escape_array.indexOf(this.destination) >= 0) return;
//Wait 200ms before getting data
Expand Down
18 changes: 9 additions & 9 deletions src/js/components/modules/sub_modules/DocumentsModule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,13 @@ export default {
},
methods: {
addFolder() {
var addFolderModal = new Modal(
const addFolderModal = new Modal(
document.getElementById("addFolderModal")
);
addFolderModal.show();
},
addLink() {
var addLinkModal = new Modal(
const addLinkModal = new Modal(
document.getElementById("addLinkModal")
);
addLinkModal.show();
Expand All @@ -251,7 +251,7 @@ export default {
this.removeDocumentKey = document_key;
//Open the modal
var confirmFileDeleteModal = new Modal(
const confirmFileDeleteModal = new Modal(
document.getElementById("confirmFileDeleteModal")
);
confirmFileDeleteModal.show();
Expand Down Expand Up @@ -298,10 +298,10 @@ export default {
}
//We know the document is not a link - now we use the suffix to the document name to determine the icon
var split_document = document.document_key__document.split(".");
const split_document = document.document_key__document.split(".");
//Get the last result
var document_suffic = split_document[split_document.length - 1];
const document_suffic = split_document[split_document.length - 1];
switch (document_suffic) {
case "jpg":
Expand Down Expand Up @@ -329,8 +329,8 @@ export default {
},
goToParentDirectory() {
//Filter for the directory - then obtain it's parent directory variable.
var filtered_data = this.folderList.filter((row) => {
return row.pk === this.currentFolder;
const filtered_data = this.folderList.filter((row) => {
return row.pk == this.currentFolder;
})[0];
//Update the current directory to the parent folder
Expand All @@ -353,7 +353,7 @@ export default {
}
//Now we split the string by max_string_length - 3 (3 for the ...)
var new_string = `${input_string.substring(
const new_string = `${input_string.substring(
0,
max_string_length - 3
)}...`;
Expand Down Expand Up @@ -401,7 +401,7 @@ export default {
});
},
uploadDocument() {
var uploadDocumentModal = new Modal(
const uploadDocumentModal = new Modal(
document.getElementById("uploadDocumentModal")
);
uploadDocumentModal.show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ export default {
mixins: [errorModalMixin, iconMixin],
methods: {
addNewGroup() {
var addGroupModal = new Modal(
const addGroupModal = new Modal(
document.getElementById("addGroupModal")
);
addGroupModal.show();
},
addNewUser() {
var addUserModal = new Modal(
const addUserModal = new Modal(
document.getElementById("addUserModal")
);
addUserModal.show();
Expand Down
4 changes: 2 additions & 2 deletions src/js/components/modules/sub_modules/ListTagsModule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default {
},
createNewTag() {
//Open up modal
var newTagModal = new Modal(
const newTagModal = new Modal(
document.getElementById("addTagModal")
);
newTagModal.show();
Expand Down Expand Up @@ -128,7 +128,7 @@ export default {
},
mounted() {
//If the location is inside the array - don't bother getting the data
var escape_array = ["requirement_item"];
const escape_array = ["requirement_item"];
if (escape_array.indexOf(this.destination) >= 0) return;
//Wait 200ms before getting the data
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/modules/sub_modules/NotesModule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default {
},
methods: {
createNewNote() {
var newNoteModal = new Modal(
const newNoteModal = new Modal(
document.getElementById("newNoteModal")
);
newNoteModal.show();
Expand Down
Loading

0 comments on commit f64984e

Please sign in to comment.