Skip to content

Commit

Permalink
Merge pull request #683 from RashmitTopG/newBranch
Browse files Browse the repository at this point in the history
New branch
  • Loading branch information
robotichead authored Oct 7, 2024
2 parents f1d6079 + 8b25a50 commit 5f6b1cc
Show file tree
Hide file tree
Showing 24 changed files with 68 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/customers/CustomerInformation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
4 changes: 2 additions & 2 deletions src/js/components/dates/BetweenDates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/js/components/gantt_chart/RenderGanttMonthlyHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/js/components/kanban/ArchiveCards.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/kanban/KanbanColumnDraggable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/modules/sub_modules/BugsModule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/my_planner/MyPlanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
6 changes: 3 additions & 3 deletions src/js/components/my_planner/NewPlannerObjectWizard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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}`,
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/object_scheduler/SchedulerFrequency.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export default {
});
},
setProfilePicture() {
let profile_picture =
const profile_picture =
this.organisationResults[0].fields
.organisation_profile_picture;
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/profile/UpdateProfilePicture.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/public/public_kanban_board.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
10 changes: 5 additions & 5 deletions src/js/components/render/RenderToasts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,21 @@ 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) => {
//Get the delay
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();
Expand All @@ -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}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down
14 changes: 7 additions & 7 deletions src/js/components/request_for_change/RfcWizard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ 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";
}
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}%;`;
}
},
}
</script>
</script>
8 changes: 4 additions & 4 deletions src/js/components/search/SearchTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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];
Expand All @@ -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();
Expand All @@ -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;
});
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/sprints/AddObjectWizard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/js/components/users/ResetUserPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down
45 changes: 21 additions & 24 deletions src/js/vuex/ganttChartVueX.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {DateTime} from "luxon";
import { DateTime } from "luxon";

export const moduleGantChart = {
state: () => ({
Expand All @@ -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 {
Expand All @@ -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,
Expand All @@ -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,
});
Expand All @@ -96,7 +93,7 @@ export const moduleGantChart = {
getDeltaDays: (state) => {
return state.deltaDays;
},
getGanttChartData: (state)=> {
getGanttChartData: (state) => {
return state.ganttChartData;
},
getGanttChartDataSingleRow: (state) => (index) => {
Expand All @@ -112,4 +109,4 @@ export const moduleGantChart = {
return state.startDateGantt;
},
},
}
};
Loading

0 comments on commit 5f6b1cc

Please sign in to comment.