diff --git a/src/js/components/change_task/modules/ChangeTaskLinkList.vue b/src/js/components/change_task/modules/ChangeTaskLinkList.vue index 721ea924f..fafe316dd 100644 --- a/src/js/components/change_task/modules/ChangeTaskLinkList.vue +++ b/src/js/components/change_task/modules/ChangeTaskLinkList.vue @@ -117,7 +117,7 @@ export default { ).then((response) => { this.linkResults = response.data.map((row) => { //Get results - let results = row; + const results = row; //Mutate the object_status results.object_status = this.translateStatus[row.object_status]; diff --git a/src/js/components/customers/CustomerInformation.vue b/src/js/components/customers/CustomerInformation.vue index ff8aa1539..b691bdabf 100644 --- a/src/js/components/customers/CustomerInformation.vue +++ b/src/js/components/customers/CustomerInformation.vue @@ -225,7 +225,7 @@ export default { }, setProfilePicture() { //If there is a profile picture/image, update. Otherwise use default - let profile_picture = + const profile_picture = this.customerResults[0].fields.customer_profile_picture; if ( profile_picture !== undefined && diff --git a/src/js/components/dates/BetweenDates.vue b/src/js/components/dates/BetweenDates.vue index b06fe1825..702668282 100644 --- a/src/js/components/dates/BetweenDates.vue +++ b/src/js/components/dates/BetweenDates.vue @@ -73,7 +73,7 @@ export default { endDateModel: { type: Number, default: () => { - let temp_date = new Date(); + const temp_date = new Date(); temp_date.setHours(16); temp_date.setMinutes(0); temp_date.setSeconds(0); @@ -96,7 +96,7 @@ export default { startDateModel: { type: Number, default: () => { - let temp_date = new Date(); + const temp_date = new Date(); temp_date.setHours(9); temp_date.setMinutes(0); temp_date.setSeconds(0); diff --git a/src/js/components/gantt_chart/RenderGanttMonthlyHeader.vue b/src/js/components/gantt_chart/RenderGanttMonthlyHeader.vue index 311e1e13a..2d6d8d0f2 100644 --- a/src/js/components/gantt_chart/RenderGanttMonthlyHeader.vue +++ b/src/js/components/gantt_chart/RenderGanttMonthlyHeader.vue @@ -57,8 +57,8 @@ export default { this.monthArray = []; //Setup local variables - let start_date = new Date(this.startDateGantt); - let end_date = new Date(this.endDateGantt); + const start_date = new Date(this.startDateGantt); + const end_date = new Date(this.endDateGantt); let point_date = start_date; let next_date = end_date; diff --git a/src/js/components/kanban/ArchiveCards.vue b/src/js/components/kanban/ArchiveCards.vue index 6a34c53c1..b1cd4ab93 100644 --- a/src/js/components/kanban/ArchiveCards.vue +++ b/src/js/components/kanban/ArchiveCards.vue @@ -81,8 +81,8 @@ export default { methods: { archiveCards() { //Simplify the variables - let column = this.archiveDestination.column; - let level = this.archiveDestination.level; + const column = this.archiveDestination.column; + const level = this.archiveDestination.level; // Create data_to_send const data_to_send = new FormData(); diff --git a/src/js/components/kanban/KanbanColumnDraggable.vue b/src/js/components/kanban/KanbanColumnDraggable.vue index d518b9c49..91560d57d 100644 --- a/src/js/components/kanban/KanbanColumnDraggable.vue +++ b/src/js/components/kanban/KanbanColumnDraggable.vue @@ -299,7 +299,7 @@ export default { card_id = event.item.dataset.cardId; //Setup variables (for shorthand) - let new_card_column = new_elem.dataset.column, + const new_card_column = new_elem.dataset.column, new_card_level = new_elem.dataset.level, new_card_sort_number = event.newIndex, old_card_column = old_elem.dataset.column, diff --git a/src/js/components/modules/sub_modules/BugsModule.vue b/src/js/components/modules/sub_modules/BugsModule.vue index d05f832c1..19e38e000 100644 --- a/src/js/components/modules/sub_modules/BugsModule.vue +++ b/src/js/components/modules/sub_modules/BugsModule.vue @@ -129,7 +129,7 @@ export default { }, appendBugList(data) { //Create object for the data - let data_object = data[0].fields; + const data_object = data[0].fields; //Add the bug id data_object.bug_id = data[0].pk; diff --git a/src/js/components/my_planner/MyPlanner.vue b/src/js/components/my_planner/MyPlanner.vue index 4ea4f4286..9a3bdbaa6 100644 --- a/src/js/components/my_planner/MyPlanner.vue +++ b/src/js/components/my_planner/MyPlanner.vue @@ -235,7 +235,7 @@ export default { //Loop for the days for (let i = 0; i < 7; i++) { //Getting the day information - let new_day = today.plus({days: i}) + const new_day = today.plus({days: i}) //Filter for the data for this specific day const data = this.objectData.filter((row) => { diff --git a/src/js/components/my_planner/NewPlannerObjectWizard.vue b/src/js/components/my_planner/NewPlannerObjectWizard.vue index 24507ab0c..40ae9ff4b 100644 --- a/src/js/components/my_planner/NewPlannerObjectWizard.vue +++ b/src/js/components/my_planner/NewPlannerObjectWizard.vue @@ -361,9 +361,9 @@ export default { //For loop for (let i = 0; i < 7; i++) { - let new_day = today.plus({days: i}); - let new_day_date = new_day.toFormat("yyyy-LL-dd"); - let new_day_day = new_day.toFormat("cccc"); + const new_day = today.plus({days: i}); + const new_day_date = new_day.toFormat("yyyy-LL-dd"); + cosnt new_day_day = new_day.toFormat("cccc"); this.listOfDays.push({ label: `${new_day_day} - ${new_day_date}`, diff --git a/src/js/components/object_scheduler/SchedulerFrequency.vue b/src/js/components/object_scheduler/SchedulerFrequency.vue index 0677b379c..2beaceb93 100644 --- a/src/js/components/object_scheduler/SchedulerFrequency.vue +++ b/src/js/components/object_scheduler/SchedulerFrequency.vue @@ -338,7 +338,7 @@ export default { }, mounted() { //Update start date - let temp_date = new Date(); + const temp_date = new Date(); temp_date.setHours(9); temp_date.setMinutes(0); temp_date.setSeconds(0); diff --git a/src/js/components/organisations/OrganisationInformation.vue b/src/js/components/organisations/OrganisationInformation.vue index 1858b6de7..0763c65aa 100644 --- a/src/js/components/organisations/OrganisationInformation.vue +++ b/src/js/components/organisations/OrganisationInformation.vue @@ -189,7 +189,7 @@ export default { }); }, setProfilePicture() { - let profile_picture = + const profile_picture = this.organisationResults[0].fields .organisation_profile_picture; diff --git a/src/js/components/profile/UpdateProfilePicture.vue b/src/js/components/profile/UpdateProfilePicture.vue index b1c9cf1fa..2abdba8fe 100644 --- a/src/js/components/profile/UpdateProfilePicture.vue +++ b/src/js/components/profile/UpdateProfilePicture.vue @@ -80,7 +80,7 @@ export default { if (this.userProfile.length === 0) return; //Run through the conditions of not using the default profile - let profile_picture = this.userProfile[0].fields.document; + const profile_picture = this.userProfile[0].fields.document; if ( profile_picture !== undefined && profile_picture !== null && diff --git a/src/js/components/public/public_kanban_board.vue b/src/js/components/public/public_kanban_board.vue index ff081d664..5619aa545 100644 --- a/src/js/components/public/public_kanban_board.vue +++ b/src/js/components/public/public_kanban_board.vue @@ -291,7 +291,7 @@ export default { //So we need to use the scroll width of the container const scroll_width = container_element.scrollWidth; const header_element = document.getElementsByClassName("kanban-edit-text")[0]; - let elements = document.getElementsByClassName("kanban-level-div"); + const elements = document.getElementsByClassName("kanban-level-div"); //Loop through each element Array.from(elements).forEach((element) => { diff --git a/src/js/components/render/RenderToasts.vue b/src/js/components/render/RenderToasts.vue index 526f05837..c141c0b8c 100644 --- a/src/js/components/render/RenderToasts.vue +++ b/src/js/components/render/RenderToasts.vue @@ -41,7 +41,7 @@ export default { //Wait until AFTER rendering happens this.$nextTick(() => { // let toastList = document.getElementsByClassName("toast"); - let toastList = [].slice.call(document.querySelectorAll('.toast')) + const toastList = [].slice.call(document.querySelectorAll('.toast')) //Loop through each toast item and deploy :) toastList.forEach((row) => { @@ -49,13 +49,13 @@ export default { var delay = row.dataset.delay; //Setup the options - let options = { + const options = { delay: parseInt(delay), autohide: parseInt(delay) > 0, }; //Create the new toast - let toast = new Toast(row, options); + const toast = new Toast(row, options); //Show the toast toast.show(); @@ -72,14 +72,14 @@ export default { let hours = timestamp.getHours(); //Determine if hours are AM or PM - let ampm = hours >= 12 ? 'PM' : 'AM'; + const ampm = hours >= 12 ? 'PM' : 'AM'; //Reset hours into non 24 format hours = hours % 12; hours = hours ? hours : 12; //Get minutes in the 00 format - let minutes = timestamp.getMinutes() < 10 ? `0${timestamp.getMinutes()}` : timestamp.getMinutes(); + const minutes = timestamp.getMinutes() < 10 ? `0${timestamp.getMinutes()}` : timestamp.getMinutes(); //Return what we have return `${hours}:${minutes} ${ampm}`; diff --git a/src/js/components/request_for_change/NewRequestForChange.vue b/src/js/components/request_for_change/NewRequestForChange.vue index 04cb40c42..bc2ee68c2 100644 --- a/src/js/components/request_for_change/NewRequestForChange.vue +++ b/src/js/components/request_for_change/NewRequestForChange.vue @@ -220,7 +220,7 @@ export default { submitRfc() { // Check validation let validation_is_true = true; - for (let tab in this.validationData) { + for (const tab in this.validationData) { //If there are any FALSE, then the "validation_is_true" will be false validation_is_true = validation_is_true && this.validationData[tab]; } diff --git a/src/js/components/request_for_change/RfcWizard.vue b/src/js/components/request_for_change/RfcWizard.vue index abf935c01..45167f269 100644 --- a/src/js/components/request_for_change/RfcWizard.vue +++ b/src/js/components/request_for_change/RfcWizard.vue @@ -45,7 +45,7 @@ export default { return classReturn + " current"; } - //If index is less than current tab, then we are completed + // If index is less than current tab, then we are completed if (parseInt(index) < this.currentTab) { return classReturn + " completed"; } @@ -53,13 +53,13 @@ export default { return classReturn; }, getStyle() { - //Edge component will be 8.333% width - //Any length between the circles is 16.666% - let a = 8.333 + (16.333 * this.currentTab); + // Edge component will be 8.333% width + // Any length between the circles is 16.666% + const progressWidth = 8.333 + (16.333 * this.currentTab); // Renamed from 'a' to 'progressWidth' - //Convert into string - return `width: ${a}%;` + // Convert into string + return `width: ${progressWidth}%;`; } }, } - \ No newline at end of file + diff --git a/src/js/components/search/SearchTags.vue b/src/js/components/search/SearchTags.vue index 7c8cd8e25..bc4ee64cc 100644 --- a/src/js/components/search/SearchTags.vue +++ b/src/js/components/search/SearchTags.vue @@ -120,7 +120,7 @@ export default { this.singleTagTextColour = "#ffffff"; //Open up modal - let edit_tag_modal = new Modal( + const edit_tag_modal = new Modal( document.getElementById("editTagModal") ); edit_tag_modal.show(); @@ -133,7 +133,7 @@ export default { }, editTag(tag_id) { //Filter for the tag information - let single_tag = this.localTagResults.filter((row) => { + const single_tag = this.localTagResults.filter((row) => { return row.pk === tag_id; })[0]; @@ -144,7 +144,7 @@ export default { this.singleTagTextColour = single_tag.fields.tag_text_colour; //Open up modal - let edit_tag_modal = new Modal( + const edit_tag_modal = new Modal( document.getElementById("editTagModal") ); edit_tag_modal.show(); @@ -154,7 +154,7 @@ export default { }, updateTags(data) { //Get the index location of the object we are updating - let index = this.localTagResults.findIndex((row) => { + const index = this.localTagResults.findIndex((row) => { return row.pk === data.tag_id; }); diff --git a/src/js/components/sprints/AddObjectWizard.vue b/src/js/components/sprints/AddObjectWizard.vue index 6b8d6e57e..05b852295 100644 --- a/src/js/components/sprints/AddObjectWizard.vue +++ b/src/js/components/sprints/AddObjectWizard.vue @@ -206,7 +206,7 @@ export default { ).then((response) => { //ADD CODE //Get the gantt chart data - let gantt_chart_data = response.data.gantt_chart_data.map((row) => { + const gantt_chart_data = response.data.gantt_chart_data.map((row) => { //Convert the dates const end_date = DateTime.fromISO(row.end_date); const start_date = DateTime.fromISO(row.start_date); diff --git a/src/js/components/users/ResetUserPassword.vue b/src/js/components/users/ResetUserPassword.vue index 1c00f6096..b46a84772 100644 --- a/src/js/components/users/ResetUserPassword.vue +++ b/src/js/components/users/ResetUserPassword.vue @@ -174,10 +174,10 @@ export default { }), disableButton() { //Both passwords have to be the same - let condition_1 = this.password1Model === this.password2Model; + const condition_1 = this.password1Model === this.password2Model; //Passwords can not be less than 8 character - let condition_2 = this.password1Model.length >= 8; + const condition_2 = this.password1Model.length >= 8; //If all conditions are true, send back false (to enable the button) return !(condition_1 && condition_2 === true); @@ -194,7 +194,7 @@ export default { }, passwordResetClicked() { //Opens the password reset modal - let passwordResetModal = new Modal( + const passwordResetModal = new Modal( document.getElementById("passwordResetModal") ); passwordResetModal.show(); diff --git a/src/js/vuex/ganttChartVueX.js b/src/js/vuex/ganttChartVueX.js index 1e9b05ac6..17d7e14e8 100644 --- a/src/js/vuex/ganttChartVueX.js +++ b/src/js/vuex/ganttChartVueX.js @@ -1,4 +1,4 @@ -import {DateTime} from "luxon"; +import { DateTime } from "luxon"; export const moduleGantChart = { state: () => ({ @@ -14,12 +14,9 @@ export const moduleGantChart = { }), mutations: { updateGanttChart(state, payload) { - //Defining int keys const int_keys = ["deltaDays", "startDateGantt", "endDateGantt"]; - //Loop through the payload and update the results according to the keys Object.keys(payload).forEach((key) => { - //Update the results if (int_keys.includes(key)) { state[key] = parseInt(payload[key]); } else { @@ -35,27 +32,27 @@ export const moduleGantChart = { }, }, actions: { - initialiseGanttChartData: ({state, commit}, payload) => { - //Calculate the delta - let delta_days = Math.floor((payload.endDateGantt - payload.startDateGantt) / (1000 * 60 * 60 * 24)); + initialiseGanttChartData: ({ commit }, payload) => { // Removed state + // Calculate the delta + let delta_days = Math.floor((payload.endDateGantt - payload.startDateGantt) / (1000 * 60 * 60 * 24)); - //If deltaDays == 0, we add 1 + // If deltaDays == 0, we add 1 if (delta_days === 0) delta_days = 1; - //Convert some of the gantt data into the correct format - let gant_chart_data = payload.ganttChartData.map((row) => { - //Convert the dates + // Convert some of the gantt data into the correct format + const gant_chart_data = payload.ganttChartData.map((row) => { + // Convert the dates const end_date = DateTime.fromISO(row.end_date); const start_date = DateTime.fromISO(row.start_date); - //Mutate the row + // Mutate the row row.end_date = end_date.toMillis(); row.start_date = start_date.toMillis(); return row; }); - //Commit the data + // Commit the data commit({ type: "updateGanttChart", deltaDays: delta_days, @@ -65,28 +62,28 @@ export const moduleGantChart = { }); }, removeGanttChartSingleRow: ({ state, commit }, payload) => { - //Simple remove that row using the id and object type + // Simple remove that row using the id and object type const gantt_chart_data = state.ganttChartData.filter(row => { const condition1 = payload.objectType !== row.object_type; - const condition2 = parseInt(payload.objectId) !== parseInt(row.object_id) + const condition2 = parseInt(payload.objectId) !== parseInt(row.object_id); - //To keep, at least one of the conditions have to be true - return condition1 || condition2 + // To keep, at least one of the conditions have to be true + return condition1 || condition2; }); - //Remove from the front end :) + // Remove from the front end :) commit("updateGanttChartData", { ganttChartData: gantt_chart_data, }); }, updateGanttChartSingleRow: ({ state, commit }, payload) => { - //Get the gantt chart data - let gantt_chart_data = state.ganttChartData; + // Get the gantt chart data + const gantt_chart_data = state.ganttChartData.slice(); // Create a copy to maintain immutability - //Mutate the gantt chart data + // Mutate the gantt chart data gantt_chart_data[payload.index] = payload.value; - //Update gantt chart data + // Update gantt chart data commit("updateGanttChartData", { ganttChartData: gantt_chart_data, }); @@ -96,7 +93,7 @@ export const moduleGantChart = { getDeltaDays: (state) => { return state.deltaDays; }, - getGanttChartData: (state)=> { + getGanttChartData: (state) => { return state.ganttChartData; }, getGanttChartDataSingleRow: (state) => (index) => { @@ -112,4 +109,4 @@ export const moduleGantChart = { return state.startDateGantt; }, }, -} +}; diff --git a/src/js/vuex/kanbanVueX.js b/src/js/vuex/kanbanVueX.js index 8b9d9ed14..3f44ddb93 100644 --- a/src/js/vuex/kanbanVueX.js +++ b/src/js/vuex/kanbanVueX.js @@ -78,7 +78,7 @@ export const moduleKanban = { card_priorty = event.item.dataset.cardPriority; //Setup variables (for shorthand) - let new_card_column = new_elem.dataset.column, + const new_card_column = new_elem.dataset.column, new_card_level = new_elem.dataset.level, new_card_sort_number = event.newIndex, old_card_column = old_elem.dataset.column, @@ -147,7 +147,7 @@ export const moduleKanban = { card_id = event.item.dataset.cardId; //Setup variables (for shorthand) - let new_card_column = new_elem.dataset.column, + const new_card_column = new_elem.dataset.column, new_card_level = new_elem.dataset.level, new_card_sort_number = event.newDraggableIndex, old_card_sort_number = event.oldDraggableIndex; @@ -157,10 +157,10 @@ export const moduleKanban = { //For example, if we move a card from a higher position to a lower //position, all cards inbetween will have a delta change of -1. i.e. //a lower position on the sort order. - let delta = 1 - 2 * (old_card_sort_number < new_card_sort_number); + const delta = 1 - 2 * (old_card_sort_number < new_card_sort_number); //Get the largest and smallest values - let largest = + const largest = (new_card_sort_number >= old_card_sort_number) * new_card_sort_number + (new_card_sort_number < old_card_sort_number) * old_card_sort_number, smallest = @@ -212,7 +212,7 @@ export const moduleKanban = { old_elem = event.from; //Setup variables (for shorthand) - let new_card_column = new_elem.dataset.column, + const new_card_column = new_elem.dataset.column, new_card_level = new_elem.dataset.level, old_card_column = old_elem.dataset.column, old_card_level = old_elem.dataset.level; diff --git a/src/js/vuex/noteVueX.js b/src/js/vuex/noteVueX.js index b184b0e36..cbc98ca10 100644 --- a/src/js/vuex/noteVueX.js +++ b/src/js/vuex/noteVueX.js @@ -28,7 +28,7 @@ export const moduleNote = { if (index < 0 ) return; //Update the note description - let mutate_data = state.noteList; + const mutate_data = state.noteList; mutate_data[index].object_note = payload.noteDescription; //Update state diff --git a/src/js/vuex/toastsVueX.js b/src/js/vuex/toastsVueX.js index 1e8254523..246f2b27e 100644 --- a/src/js/vuex/toastsVueX.js +++ b/src/js/vuex/toastsVueX.js @@ -15,7 +15,7 @@ export const moduleToasts = { const timestamp = new Date(); //Setup new toast object with default values - let new_toast = { + const new_toast = { delay: 20000, extra_classes: "", header: "", diff --git a/src/js/vuex/usersettings/kanbanSettingsVueX.js b/src/js/vuex/usersettings/kanbanSettingsVueX.js index f111dccbd..f17bbe27f 100644 --- a/src/js/vuex/usersettings/kanbanSettingsVueX.js +++ b/src/js/vuex/usersettings/kanbanSettingsVueX.js @@ -30,7 +30,7 @@ export const kanbanSettings = { }, async updateLevelCollapse({dispatch, commit, state}, payload) { //Map in the changes - let current_levels = state.levels.map((row) => { + const current_levels = state.levels.map((row) => { //If the payload.level_id != row.level_id, just return the data if (payload.level_id !== row.level_id) return row;