initial NearBeach

This commit is contained in:
2026-10-28 21:00:21 -04:00
parent 3d61b05194
commit ef252a02e5
1797 changed files with 800198 additions and 56 deletions

View File

@@ -0,0 +1,497 @@
<template>
<n-config-provider :theme="useNBTheme(theme)">
<div class="card">
<div class="card-body">
<ul
id="misc_module_tabs"
class="nav nav-tabs"
role="tablist"
>
<!-- GROUPS AND USERS -->
<!-- Don't need to show to requirement items - as permissions are gained from parent requirement -->
<li
v-if="destination !== 'requirement_item'"
class="nav-item"
role="presentation"
>
<button
id="group-and-user-tab"
class="nav-link active"
data-bs-toggle="tab"
data-bs-target="#group-and-users"
type="button"
role="tab"
aria-controls="home"
aria-selected="true"
>
Groups and Users
</button>
</li>
<!-- REQUIREMENT ITEMS -->
<li
v-if="destination === 'requirement'"
class="nav-item"
role="presentation"
>
<button
id="requirement-item-tab"
class="nav-link"
data-bs-toggle="tab"
data-bs-target="#requirement-items"
type="button"
role="tab"
aria-controls="home"
aria-selected="false"
>
Requirement Item
</button>
</li>
<!-- REQUIREMENT LINKS -->
<li
v-if="destination === 'requirement'"
class="nav-item"
role="presentation"
>
<button
id="requirement-link-tab"
class="nav-link"
data-bs-toggle="tab"
data-bs-target="#requirement-links"
type="button"
role="tab"
aria-controls="home"
aria-selected="false"
>
Requirement Links
</button>
</li>
<!-- REQUIREMENT ITEM LINKS -->
<li
v-if="destination === 'requirement_item'"
class="nav-item"
role="presentation"
>
<button
id="requirement-item-link-tab"
class="nav-link"
data-bs-toggle="tab"
data-bs-target="#requirement-item-links"
type="button"
role="tab"
aria-controls="home"
aria-selected="false"
>
Links
</button>
</li>
<!-- DOCUMENTS -->
<li
class="nav-item"
role="presentation"
>
<button
id="documents-tab"
class="nav-link"
data-bs-toggle="tab"
data-bs-target="#documents"
type="button"
role="tab"
aria-controls="home"
aria-selected="false"
>
Documents
</button>
</li>
<!-- LINKED OBJECTS -->
<li
v-if="
destination !== 'requirement' &&
destination !== 'requirement_item'
"
class="nav-item"
role="presentation"
>
<button
id="object-link-tabs"
class="nav-link"
data-bs-toggle="tab"
data-bs-target="#object-links"
type="button"
role="tab"
aria-controls="home"
aria-selected="false"
>
Linked Objects
</button>
</li>
<!-- CUSTOMERS -->
<!-- Customers are not needed by requirement items as the parent requirements take care of this -->
<li
v-if="destination !== 'requirement_item'"
class="nav-item"
role="presentation"
>
<button
id="customer-tab"
class="nav-link"
data-bs-toggle="tab"
data-bs-target="#customers"
type="button"
role="tab"
aria-controls="home"
aria-selected="false"
>
Customers
</button>
</li>
<!-- SPRINTS -->
<li
class="nav-item"
role="presentation"
>
<button
id="sprints-tab"
class="nav-link"
data-bs-toggle="tab"
data-bs-target="#sprints"
type="button"
role="tab"
aria-controls="home"
aria-selected="false"
>
Sprints
</button>
</li>
<!-- MISC -->
<li
class="nav-item"
role="presentation"
>
<button
id="misc-tab"
class="nav-link"
data-bs-toggle="tab"
data-bs-target="#misc"
type="button"
role="tab"
aria-controls="home"
aria-selected="false"
>
Misc
</button>
</li>
<!-- Notes -->
<li
class="nav-item"
role="presentation"
>
<button
id="notes-tab"
class="nav-link"
data-bs-toggle="tab"
data-bs-target="#notes"
type="button"
role="tab"
aria-controls="home"
aria-select="false"
>
Notes
</button>
</li>
<!-- ADMIN -->
<li
v-if="userLevel === 4"
class="nav-item"
role="presentation"
>
<button
id="admin-tab"
class="nav-link"
data-bs-toggle="tab"
data-bs-target="#admin"
type="button"
role="tab"
aria-controls="home"
aria-select="false"
>
Admin
</button>
</li>
</ul>
<hr/>
<div
id="misc_module_content"
class="tab-content"
>
<div
v-if="destination !== 'requirement_item'"
id="group-and-users"
class="tab-pane fade show active"
role="tabpanel"
aria-labelledby="contact-tab"
>
<groups-and-users-module></groups-and-users-module>
</div>
<div
v-if="destination === 'requirement'"
id="requirement-items"
class="tab-pane fade"
role="tabpanel"
aria-labelledby="home-tab"
>
<requirement-items-module></requirement-items-module>
</div>
<div
v-if="destination === 'requirement'"
id="requirement-links"
class="tab-pane fade"
role="tabpanel"
aria-labelledby="profile-tab"
>
<requirement-links-module></requirement-links-module>
</div>
<div
v-else-if="destination === 'requirement_item'"
id="requirement-item-links"
class="tab-pane fade"
role="tabpanel"
aria-labelledby="profile-tab"
>
<requirement-item-links-module></requirement-item-links-module>
</div>
<div
id="documents"
class="tab-pane fade"
role="tabpanel"
aria-labelledby="contact-tab"
>
<documents-module></documents-module>
<upload-document-wizard></upload-document-wizard>
<add-folder-wizard
:destination="destination"
:location-id="locationId"
></add-folder-wizard>
<add-link-wizard
:destination="destination"
:location-id="locationId"
></add-link-wizard>
<confirm-file-delete-vue></confirm-file-delete-vue>
<confirm-folder-delete></confirm-folder-delete>
</div>
<div
id="object-links"
class="tab-pane fade"
role="tabpanel"
aria-labelledby="contact-tab"
>
<object-links></object-links>
</div>
<div
id="customers"
class="tab-pane fade"
role="tabpanel"
aria-labelledby="contact-tab"
>
<customers-module></customers-module>
</div>
<div
id="sprints"
class="tab-pane fade"
role="tabpanel"
aria-labelledby="tabpanel"
>
<list-sprints></list-sprints>
</div>
<div
id="misc"
class="tab-pane fade"
role="tabpanel"
aria-labelledby="contact-tab"
>
<misc-module></misc-module>
<confirm-public-link-delete></confirm-public-link-delete>
</div>
<div
id="notes"
class="tab-pane fade"
role="tabpanel"
aria-labelledby="contact-tab"
>
<notes-module></notes-module>
<!-- Modals for Notes section -->
<edit-history-note-wizard></edit-history-note-wizard>
<new-history-note-wizard
:location-id="locationId"
:destination="destination"
></new-history-note-wizard>
<confirm-note-delete></confirm-note-delete>
</div>
<div
v-if="userLevel === 4"
id="admin"
class="tab-pane fade bg-danger"
role="tabpanel"
aria-labelledby="contact-tab"
>
<delete-object></delete-object>
</div>
</div>
</div>
</div>
</n-config-provider>
</template>
<script>
import GroupsAndUsersModule from "./sub_modules/GroupsAndUsersModule.vue";
import RequirementItemsModule from "./sub_modules/RequirementItemsModule.vue";
import RequirementItemLinksModule from "./sub_modules/RequirementItemLinksModule.vue";
import RequirementLinksModule from "./sub_modules/RequirementLinksModule.vue";
import DocumentsModule from "./sub_modules/DocumentsModule.vue";
import ObjectLinks from "./sub_modules/ObjectLinks.vue";
import CustomersModule from "./sub_modules/CustomersModule.vue";
import MiscModule from "./sub_modules/MiscModule.vue";
import NotesModule from "./sub_modules/NotesModule.vue";
import UploadDocumentWizard from "./wizards/UploadDocumentWizard.vue";
import AddLinkWizard from "./wizards/AddLinkWizard.vue";
import ConfirmFileDeleteVue from "./wizards/ConfirmFileDelete.vue";
import ConfirmFolderDelete from "./wizards/ConfirmFolderDelete.vue";
import AddFolderWizard from "./wizards/AddFolderWizard.vue";
import ListSprints from "./sub_modules/ListSprints.vue";
import EditHistoryNoteWizard from "./wizards/EditHistoryNoteWizard.vue";
import NewHistoryNoteWizard from "./wizards/NewHistoryNoteWizard.vue";
//Components
import ConfirmNoteDelete from "./wizards/ConfirmNoteDelete.vue";
//Composables
import {useNBTheme} from "Composables/theme/useNBTheme";
import ConfirmPublicLinkDelete from "./wizards/ConfirmPublicLinkDelete.vue";
import DeleteObject from "./sub_modules/DeleteObject.vue";
export default {
name: "ParentModules",
components: {
DeleteObject,
ConfirmPublicLinkDelete,
ConfirmNoteDelete,
AddFolderWizard,
ConfirmFileDeleteVue,
AddLinkWizard,
ConfirmFolderDelete,
CustomersModule,
DocumentsModule,
EditHistoryNoteWizard,
GroupsAndUsersModule,
ListSprints,
NewHistoryNoteWizard,
NotesModule,
ObjectLinks,
RequirementItemLinksModule,
RequirementItemsModule,
RequirementLinksModule,
UploadDocumentWizard,
MiscModule,
},
props: {
destination: {
type: String,
default: "",
}, //Which object we are looking at, i.e. requirement
isReadOnly: {
type: Boolean,
default: false,
},
locationId: {
type: Number,
default: 0,
}, //The ID of the object we are looking at.
rootUrl: {
type: String,
default: "/",
},
staticUrl: {
type: String,
default: "/",
},
theme: {
type: String,
default: "",
},
userExtraPermissions: {
type: Array,
default: () => {
return [];
},
},
userLevel: {
type: Number,
default: 0,
},
},
data() {
return {};
},
async beforeMount() {
await this.$store.dispatch("processThemeUpdate", {
theme: this.theme,
});
},
mounted() {
//Send data to required VueX states
this.$store.commit({
type: "updateDestination",
destination: this.destination,
locationId: this.locationId,
});
this.$store.commit({
type: "updateUrl",
rootUrl: this.rootUrl,
staticUrl: this.staticUrl,
});
//If is read only is true, we drop the user level to 1.
//If not read only, we send the correct userLevel up to VueX, as well as the extra permissions
if (this.isReadOnly) {
//Set everything as read only :)
this.$store.commit({
type: "updateUserLevel",
userLevel: 1,
});
} else {
//Use the user level
this.$store.commit({
type: "updateUserLevel",
userLevel: this.userLevel,
});
//Send extra permissions upstream
this.$store.commit({
type: "updateUserExtraPermissions",
userExtraPermissions: this.userExtraPermissions,
});
}
},
methods: {useNBTheme},
};
</script>

View File

@@ -0,0 +1,159 @@
<template>
<h2>AssignedSprints</h2>
<p class="text-instructions">
Lists all sprints that contains this object.
</p>
<h3
v-if="currentSprints.length > 0"
>
Current
</h3>
<render-sprint-card
:sprint-results="currentSprints"
@confirm_remove_sprint="confirmRemoveSprintFunction($event)"
></render-sprint-card>
<h3
v-if="finishedSprints.length > 0"
>
Finished
</h3>
<render-sprint-card
:sprint-results="finishedSprints"
@confirm_remove_sprint="confirmRemoveSprintFunction($event)"
></render-sprint-card>
<div
v-if="currentSprints.length + finishedSprints.length === 0"
class="alert alert-info"
>
Currently this object has not been assigned to any sprints.
</div>
<div class="row submit-row">
<div class="col-md-12">
<button
v-if="userLevel >= 2"
class="btn btn-primary save-changes"
@click="addToSprint"
>
Add Object To Sprint
</button>
</div>
</div>
<add-sprint-wizard
@update_sprint_list="updateSprintList($event)"
></add-sprint-wizard>
<confirm-remove-sprint
:confirm-remove-sprint="confirmRemoveSprint"
@update_sprint_list="updateSprintList($event)"
></confirm-remove-sprint>
</template>
<script>
//vuex
import { mapGetters } from "vuex";
//Bootstrap
import { Modal } from "bootstrap";
//Components
import AddSprintWizard from "../wizards/AddSprintWizard.vue";
import RenderSprintCard from "./RenderSprintCard.vue";
import ConfirmRemoveSprint from "../wizards/ConfirmRemoveSprint.vue";
export default {
name: "AssignedSprints",
components: {
ConfirmRemoveSprint,
RenderSprintCard,
AddSprintWizard,
},
data() {
return {
allowedObjects: [
"requirement_item",
"project",
"task",
],
confirmRemoveSprint: {
"sprint_id": 0,
"sprint_name": "",
},
currentImportVariables: {
header: "List of Current Sprints",
prefix: "sprint",
id: "sprint_id",
title: "sprint_name",
status: "sprint_status",
},
currentSprints: [],
finishedImportVariables: {
header: "List of Finished Sprints",
prefix: "sprint",
id: "sprint_id",
title: "sprint_name",
status: "sprint_status",
},
finishedSprints: [],
}
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
userLevel: "getUserLevel",
}),
},
mounted() {
this.$nextTick(() => {
if (this.allowedObjects.includes(this.destination)) {
this.getAssignedSprints();
}
});
},
methods: {
addToSprint() {
const modal = new Modal(document.getElementById("addSprintWizardModal"));
modal.show();
},
confirmRemoveSprintFunction(data) {
//Update data
this.confirmRemoveSprint = data;
//Open Modal
const modal = new Modal(document.getElementById("confirmSprintRemoveModal"));
modal.show();
},
getAssignedSprints() {
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/sprint_list/assigned/`,
).then((response) => {
//Update local data
this.updateSprintList(response.data);
}).catch((error) => {
this.$store.dispatch("newToast", {
headers: "Error fetching assigned sprints",
message: `Could not get the data. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
})
},
updateSprintList(data) {
//Update local data
this.currentSprints = data.filter((row) => {
return row.sprint_status !== "Finished";
});
this.finishedSprints = data.filter((row) => {
return row.sprint_status === "Finished";
});
},
},
}
</script>

View File

@@ -0,0 +1,146 @@
<template>
<div>
<h2>
Associated Objects
</h2>
<p class="text-instructions">
The following are current OPEN objects associated with the organisation.
</p>
<hr v-if="projectResults.length + taskResults.length + requirementResults.length > 0"/>
<!-- Project Results -->
<render-object-card
v-if="projectResults.length > 0"
:search-results="projectResults"
:import-variables="projectVariables"
destination="project"
></render-object-card>
<!-- Requirement Results -->
<render-object-card
v-if="requirementResults.length > 0"
:search-results="requirementResults"
:import-variables="requirementVariables"
destination="requirement"
></render-object-card>
<!-- Task Results -->
<render-object-card
v-if="taskResults.length > 0"
:search-results="taskResults"
:import-variables="taskVariables"
destination="task"
></render-object-card>
<!-- Only show when there are no associated tasks -->
<div
v-if="projectResults.length + taskResults.length + requirementResults.length === 0"
class="spacer"
></div>
<div
v-if="projectResults.length + taskResults.length + requirementResults.length === 0"
class="alert alert-info"
>
There are currently no Objects associated with this Organisation.
You can create some new objects by click on the "New Objects" menu
item.
</div>
</div>
</template>
<script>
//VueX
import {mapGetters} from "vuex";
import RenderObjectCard from "Components/render/RenderObjectCard.vue";
export default {
name: "AssociatedObjects",
components: {
RenderObjectCard,
},
data() {
return {
projectResults: [],
projectVariables: {
header: "Projects",
prefix: "Pro",
id: "project_id",
title: "project_name",
status: "project_status_text",
},
requirementResults: [],
requirementVariables: {
header: "Requirements",
prefix: "Req",
id: "requirement_id",
title: "requirement_title",
status: "requirement_status__requirement_status",
},
taskResults: [],
taskVariables: {
header: "Tasks",
prefix: "Task",
id: "task_id",
title: "task_short_description",
status: "task_status_text",
},
};
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
}),
},
mounted() {
this.$nextTick(() => {
this.getAssociatedObjectResults();
});
},
methods: {
getAssociatedObjectResults() {
if (this.locationId === 0) {
setTimeout(() => {
this.getAssociatedObjectResults();
}, 100);
return;
}
//All is good - get the data
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/associated_objects/`
).then((response) => {
this.projectResults = response.data.project;
this.requirementResults = response.data.requirement;
this.taskResults = response.data.task;
}).catch(error => {
this.$store.dispatch("newToast", {
header: "Error Getting Associated Objects",
message: `Sorry, we could not get associated objects. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
getFriendlyDate(input_date) {
const options = {
weekday: "long",
year: "numeric",
month: "long",
day: "numeric",
},
local_date = new Date(input_date);
return local_date.toLocaleString("en-US", options);
},
},
};
</script>

View File

@@ -0,0 +1,202 @@
<template>
<div>
<h2>
Bugs List
</h2>
<p class="text-instructions">
The following is a list of bugs associated with this
{{ destination }}
</p>
<!-- TABLE OF BUGS -->
<div
v-if="bugList.length === 0"
class="spacer"
>
<div class="alert alert-dark">
Sorry - there are no bugs associated with this {{ destination }}
</div>
</div>
<div v-else>
<table class="table">
<thead>
<tr>
<td>Bug Description</td>
<td>Status</td>
</tr>
</thead>
<tbody>
<tr
v-for="bug in bugList"
:key="bug.pk"
>
<td>
<a
:href="getBugHyperLink(bug)"
rel="noopener noreferrer"
target="_blank"
>
<p>
{{ bug.bug_description }}
</p>
<div class="spacer"></div>
<p class="small-text">
Bug No. {{ bug.bug_code }} -
{{ bug.bug_client__bug_client_name }}
</p>
</a>
</td>
<td>
{{ bug.bug_status }}
<span
v-if="userLevel >= 2"
class="remove-link"
>
<carbon-trash-can
@click="removeBug(bug.bug_id)"
></carbon-trash-can>
</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Add Bug Button -->
<!-- TO DO - limit it to certain users -->
<hr v-if="userLevel > 1"/>
<div class="row submit-row">
<div class="col-md-12">
<button
v-if="userLevel > 1"
class="btn btn-primary save-changes"
@click="addNewBug"
>
Add Bug
</button>
</div>
</div>
<!-- Modals -->
<add-bug-wizard
:destination="destination"
:location-id="locationId"
@append_bug_list="appendBugList($event)"
></add-bug-wizard>
</div>
</template>
<script>
//JavaScript components
import {Modal} from "bootstrap";
import AddBugWizard from "../wizards/AddBugWizard.vue";
//VueX
import {mapGetters} from "vuex";
import {CarbonTrashCan} from "../../../components";
export default {
name: "BugsModule",
components: {
CarbonTrashCan,
AddBugWizard,
},
data() {
return {
bugList: [],
};
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
userLevel: "getUserLevel",
rootUrl: "getRootUrl",
}),
},
mounted() {
//If the location is inside the array - don't bother getting the data
const escape_array = ["requirement_item"];
if (escape_array.indexOf(this.destination) >= 0) return;
this.$nextTick(() => {
this.getBugList();
});
},
methods: {
addNewBug() {
const addBugModal = new Modal(
document.getElementById("addBugModal")
);
addBugModal.show();
},
appendBugList(data) {
//Create object for the data
const data_object = data[0].fields;
//Add the bug id
data_object.bug_id = data[0].pk;
//Append the data
this.bugList.push(data_object);
},
getBugHyperLink(bug) {
if (bug.bug_client__list_of_bug_client__bug_client_name === "Bugzilla") {
return `${bug.bug_client__bug_client_url}/show_bug.cgi?id=${bug.bug_code}`;
}
return "#";
},
getBugList() {
//We don't need to get the bug list when destination is requirement_items
if (this.destination === "requirement_item") {
//Jet pack out of there
return;
}
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/bug_list/`
).then((response) => {
//Clear the current list
this.bugList = [];
//Loop through the results, and push each rows into the array
response.data.forEach((row) => {
this.bugList.push(row);
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Failed to get bug list",
message: `Failed to get bug list. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
removeBug(bug_id) {
//Create data_to_send
const data_to_send = new FormData();
data_to_send.set("bug_id", bug_id);
//Use Axios to send data to backend
this.axios.post(
`${this.rootUrl}object_data/delete_bug/`,
data_to_send
).then(() => {
//Remove the bug from the model
this.bugList = this.bugList.filter((row) => {
return row.bug_id !== bug_id;
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Removing Bug",
message: `We had an issue removing the bug - error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
},
};
</script>

View File

@@ -0,0 +1,113 @@
<template>
<h2>List Sprints</h2>
<p class="text-instructions">
Lists out all the sprints associated with this particular object.
</p>
<div v-if="allowedObjects.includes(destination)">
<div
v-if="sprintResults.length === 0"
class="alert alert-info"
>
Currently there are no current sprints.
</div>
<!-- CURRENT SPRINTS-->
<render-sprint-card
:sprint-results="sprintResults"
:can-delete="false"
></render-sprint-card>
<!-- BUTTONS-->
<div
v-if="userLevel >= 2"
class="row submit-row"
>
<div class="col-md-12">
<button
class="btn btn-primary save-changes"
@click="openCreateModal"
>
Create New Sprint
</button>
</div>
</div>
<hr v-if="destination === 'project'" class="mt-4">
</div>
<new-sprint-wizard
v-if="allowedObjects.includes(destination)"
:sprint-results-length="sprintResults.length"
></new-sprint-wizard>
</template>
<script>
//vuex
import { mapGetters } from "vuex";
//Bootstrap
import { Modal } from "bootstrap";
//Components
import NewSprintWizard from "../wizards/NewSprintWizard.vue";
import RenderSprintCard from "./RenderSprintCard.vue";
export default {
name: "ChildSprints",
components: {
RenderSprintCard,
NewSprintWizard,
},
data() {
return {
allowedObjects: [
"project",
"requirement",
],
sprintResults: [],
}
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
userLevel: "getUserLevel",
}),
},
mounted() {
this.$nextTick(() => {
//Only run the get sprints if the destination is correct
if (this.allowedObjects.includes(this.destination)) {
this.getSprints();
}
});
},
methods: {
closeModal() {
document.getElementById("createNewSprintButton").click();
},
getSprints() {
const url = `${this.rootUrl}object_data/${this.destination}/${this.locationId}/sprint_list/child/`;
this.axios.post(
url,
).then((response) => {
//Update the data
this.sprintResults = response.data;
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Getting Sprint List",
message: `Sorry, could not get child sprints. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
openCreateModal() {
const modal = new Modal(document.getElementById("createNewSprintModal"));
modal.show();
},
},
}
</script>

View File

@@ -0,0 +1,146 @@
<template>
<div class="customer-list">
<div
v-for="customer in customerResults"
:key="customer.pk"
class="customer-card"
>
<!-- CUSOMER PROFILE -->
<img
:src="getCustomerImage(customer)"
alt="default profile picture"
/>
<!-- CUSTOMER DETAILS -->
<div class="customer-card--details">
<div class="customer-card--name">
<a
:href="`${rootUrl}customer_information/${customer.pk}/`"
>
{{ customer.fields.customer_first_name }}
{{ customer.fields.customer_last_name }}
</a>
</div>
<div class="customer-card--email">
<carbon-email></carbon-email>
{{ customer.fields.customer_email }}
</div>
</div>
<div
v-if="userLevel >= 2"
class="customer-card--remove"
>
<carbon-trash-can
@click="confirmRemoveCustomer(customer.pk)"
></carbon-trash-can>
</div>
</div>
</div>
<confirm-customer-removal
:customer-object="customerObject"
@remove_customer="removeCustomer($event)"
></confirm-customer-removal>
</template>
<script>
import { Modal } from "bootstrap";
import ConfirmCustomerRemoval from "../wizards/ConfirmCustomerRemove.vue";
//VueX
import {mapGetters} from "vuex";
import {CarbonEmail, CarbonTrashCan} from "../../../components";
export default {
name: "CustomersListModule",
components: {
CarbonEmail,
CarbonTrashCan,
ConfirmCustomerRemoval,
},
props: {
customerResults: {
type: Array,
default: () => {
return [];
},
},
},
emits: ["remove_customer"],
data() {
return {
customerObject: {
customer_id: 0,
customer_email: "",
customer_first_name: "",
customer_last_name: "",
customer_profile_picture: "",
},
};
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
staticUrl: "getStaticUrl",
userLevel: "getUserLevel",
}),
defaultCustomerImage() {
return `${this.staticUrl}/NearBeach/images/placeholder/people_tax.svg`;
},
},
methods: {
confirmRemoveCustomer(customer_id) {
//Update the customer object
const customer_object = this.customerResults.filter((row) => {
return parseInt(row.pk) === parseInt(customer_id);
});
if (customer_object.length !== 1) {
//Something went wrong. Notify the user and do nothing.
this.$store.dispatch("newToast", {
header: "Error Deleting Customer",
message: "Could not select the correct ID of the customer. Something went wrong",
extra_classes: "bg-danger",
delay: 0,
});
return;
}
//Map the data into a flat pack. As we only require this data
this.customerObject = customer_object.map(row => {
return {
customer_id: row.pk,
customer_email: row.fields.customer_email,
customer_first_name: row.fields.customer_first_name,
customer_last_name: row.fields.customer_last_name,
customer_profile_picture: row.fields.customer_profile_picture,
};
})[0];
//Show the modal
const modal = new Modal(document.getElementById("confirmCustomerRemoveModal"));
modal.show();
},
getCustomerImage(customer) {
const image = customer.fields.customer_profile_picture;
if (image === "" || image === null) {
//There is no image - return the default image
return this.defaultCustomerImage;
}
return `${this.rootUrl}private/${image}`;
},
removeCustomer(customer_id) {
//Notify upstream
this.$emit("remove_customer", customer_id);
},
},
};
</script>

View File

@@ -0,0 +1,126 @@
<template>
<div>
<h2>
Customers
</h2>
<p class="text-instructions">
Below are a list of customers who are stakeholders to this
{{ destination }}.
</p>
<!-- CUSTOMER RESULTS CARDS -->
<div v-if="customerResults.length == 0">
<div class="customers-module-spacer">
<div class="alert alert-dark">
Sorry - there are no customers. Please add them by clicking
on the button below
</div>
</div>
</div>
<div v-else>
<customers-list-module
:customer-results="customerResults"
@remove_customer="removeCustomer($event)"
></customers-list-module>
</div>
<!-- ADD CUSTOMER BUTTON -->
<hr/>
<div class="row submit-row">
<div class="col-md-12">
<button
v-if="userLevel > 1"
class="btn btn-primary save-changes"
@click="addNewCustomer"
>
Add Customer
</button>
</div>
</div>
<!-- MODALS -->
<add-customer-wizard
:location-id="locationId"
:destination="destination"
:exclude-customers="customerResults"
@update_customer_results="updateCustomerResults($event)"
></add-customer-wizard>
</div>
</template>
<script>
//JavaScript components
import CustomersListModule from "./CustomersListModule.vue";
import AddCustomerWizard from "../wizards/AddCustomerWizard.vue";
import {Modal} from "bootstrap";
//VueX
import {mapGetters} from "vuex";
export default {
name: "CustomersModule",
components: {
AddCustomerWizard,
CustomersListModule,
},
data() {
return {
customerResults: [],
};
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
userLevel: "getUserLevel",
rootUrl: "getRootUrl",
}),
},
mounted() {
//If the location is inside the array - don't bother getting the data
const escape_array = ["requirement_item"];
if (escape_array.indexOf(this.destination) >= 0) return;
//Wait 200ms before getting data
this.$nextTick(() => {
this.loadCustomerResults();
});
},
methods: {
addNewCustomer() {
const addCustomerModal = new Modal(
document.getElementById("addCustomerModal")
);
addCustomerModal.show();
},
loadCustomerResults() {
this.axios
.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/customer_list/`
)
.then((response) => {
this.customerResults = response.data;
})
.catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Loading Customer Results",
message: `We had an issue loading customer results. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
removeCustomer(customer_id) {
this.customerResults = this.customerResults.filter((row) => {
return row.pk !== customer_id;
});
},
updateCustomerResults(data) {
this.customerResults = data;
},
},
};
</script>

View File

@@ -0,0 +1,41 @@
<template>
<div class="delete-object">
<h2>Delete Object</h2>
<p>
WARNING! This will delete the follow {{ destination }} from the system. This can not be undone.
</p>
<button
class="btn btn-outline-dark"
@click="confirmDeleteObject"
>
DELETE {{ destination }}
</button>
</div>
<confirm-delete-object></confirm-delete-object>
</template>
<script>
import { mapGetters } from "vuex";
import { Modal } from "bootstrap";
import ConfirmDeleteObject from "../wizards/ConfirmDeleteObject.vue";
export default {
name: "DeleteObject",
components: {
ConfirmDeleteObject
},
computed: {
...mapGetters({
destination: "getDestination",
rootUrl: "getRootUrl",
}),
},
methods: {
confirmDeleteObject() {
const modal = new Modal(document.getElementById("confirmDeleteObjectModal"));
modal.show();
}
}
}
</script>

View File

@@ -0,0 +1,576 @@
<template>
<div>
<h2>
Documents
</h2>
<p class="text-instructions">
The following is a folder structure of all documents uploaded to
this {{ getDestination() }}
</p>
<!-- DOCUMENT FOLDER TREE -->
<div
v-if="parseInt(documentObjectCount) === 0"
class="module-spacer"
>
<div class="alert alert-dark">
Sorry - there are no documents or folders uploaded.
</div>
</div>
<div
v-else
class="document--widget"
>
<!-- GO TO PARENT DIRECTORY -->
<div
v-if="currentFolder !== 0"
id="folder_parent_directory"
class="document--child"
@click="goToParentDirectory()"
@dragenter.prevent
@dragover="dragoverFolder($event, 'folder_parent_directory')"
@dragleave="dragleaveFolder($event, 'folder_parent_directory')"
@drop="drop($event, currentParentFolder)"
>
<carbon-arrow-up
height="80px"
width="80px"
></carbon-arrow-up>
<p class="text-instructions">Go to Parent Directory...</p>
</div>
<!-- RENDER THE FOLDERS -->
<div
v-for="folder in folderFilteredList"
:id="`folder_${folder.pk}`"
:key="folder.pk"
class="document--child"
draggable="true"
@dragenter.prevent
@dragover="dragoverFolder($event, `folder_${folder.pk}`)"
@dragleave="dragleaveFolder($event, `folder_${folder.pk}`)"
@drop="drop($event, folder.pk)"
@dragstart="dragFolderStart($event, folder.pk)"
>
<a
href="javascript:void(0)"
@click="updateCurrentFolder(folder.pk)"
>
<carbon-folder
width="80px"
height="80px"
></carbon-folder>
<p class="text-instructions">
{{ shortName(folder.fields.folder_description) }}
</p>
</a>
<!-- REMOVE FOLDER -->
<div
v-if="hasDocumentPermission"
class="document--remove"
>
<carbon-trash-can
@click="confirmFolderDelete(folder.pk)"
></carbon-trash-can>
</div>
</div>
<!-- RENDER THE FILES -->
<div
v-for="document in documentFilteredList"
:key="document.document_key_id"
class="document--child"
draggable="true"
@dragstart="dragDocumentStart($event, document.document_key_id)"
>
<a
:href="`/private/${document.document_key_id}/`"
rel="noopener noreferrer"
target="_blank"
>
<component
:is="getIcon(document)"
width="80px"
height="80px"
></component>
<p class="text-instructions">
{{ shortName(document.document_key__document_description) }}
</p>
</a>
<!-- REMOVE DOCUMENT -->
<div
v-if="hasDocumentPermission"
class="document--remove"
>
<carbon-trash-can
@click="confirmFileDelete(document.document_key_id)"
></carbon-trash-can>
</div>
</div>
</div>
<!-- ADD DOCUMENTS AND FOLDER BUTTON -->
<hr v-if="hasDocumentPermission" />
<div
v-if="readOnly === false"
class="btn-group save-changes"
>
<button
v-if="hasDocumentPermission"
class="btn btn-primary dropdown-toggle"
type="button"
data-bs-toggle="dropdown"
aria-expanded="false"
>
New Document/File
</button>
<ul class="dropdown-menu">
<li>
<a
class="dropdown-item"
href="javascript:void(0)"
@click="uploadDocument"
>
Upload Document
</a>
</li>
<li>
<a
class="dropdown-item"
href="javascript:void(0)"
@click="addLink"
>
Add Link
</a>
</li>
<li>
<a
class="dropdown-item"
href="javascript:void(0)"
@click="addFolder"
>
Add Folder
</a>
</li>
</ul>
</div>
</div>
</template>
<script>
import {Modal} from "bootstrap";
//Icons
import CarbonArrowUp from "Components/icons/CarbonArrowUp.vue";
import CarbonDocument from "Components/icons/CarbonDocument.vue";
import CarbonDocumentPdf from "Components/icons/CarbonDocumentPdf.vue"
import CarbonFolder from "Components/icons/CarbonFolder.vue";
import CarbonImage from "Components/icons/CarbonImage.vue";
import MdiMicrosoftExcel from "Components/icons/MdiMicrosoftExcel.vue";
import MdiMicrosoftPowerPoint from "Components/icons/MdiMicrosoftPowerPoint.vue";
import MdiMicrosoftWord from "Components/icons/MdiMicrosoftWord.vue";
//VueX
import {mapGetters} from "vuex";
import {CarbonLink, CarbonTrashCan} from "../../../components";
export default {
name: "DocumentsModule",
components: {
CarbonArrowUp,
CarbonDocument,
CarbonDocumentPdf,
CarbonFolder,
CarbonImage,
CarbonTrashCan,
MdiMicrosoftExcel,
MdiMicrosoftPowerPoint,
MdiMicrosoftWord,
},
props: {
overrideDestination: {
type: String,
default: "",
},
overrideLocationId: {
type: Number,
default: 0,
},
readOnly: {
type: Boolean,
default: false,
},
},
computed: {
...mapGetters({
currentFolder: "getCurrentFolder",
currentParentFolder: "getCurrentParentFolder",
destination: "getDestination",
documentFilteredList: "getDocumentFilteredList",
documentObjectCount: "getDocumentObjectCount",
folderFilteredList: "getFolderFilteredList",
locationId: "getLocationId",
rootUrl: "getRootUrl",
staticUrl: "getStaticUrl",
userLevel: "getUserLevel",
}),
...mapGetters([
"getUserExtraPermission",
]),
hasDocumentPermission() {
// Either the user has native permissions, or they have the extra documentation permission
const condition_1 = this.getUserExtraPermission("document");
const condition_2 = this.userLevel >= 2;
return condition_1 || condition_2;
},
},
watch: {
overrideLocationId() {
//Update the data
this.getDocumentList();
this.getFolderList();
},
},
mounted() {
this.$nextTick(() => {
this.getDocumentList();
this.getFolderList();
});
},
methods: {
addFolder() {
//Close the card modal if exists
const cardModal = document.getElementById("cardInformationModalCloseButton");
if (cardModal !== null)
{
cardModal.click();
}
const addFolderModal = new Modal(
document.getElementById("addFolderModal")
);
addFolderModal.show();
},
addLink() {
//Close the card modal if exists
const cardModal = document.getElementById("cardInformationModalCloseButton");
if (cardModal !== null)
{
cardModal.click();
}
const addLinkModal = new Modal(
document.getElementById("addLinkModal")
);
addLinkModal.show();
},
confirmFileDelete(document_key) {
//Send the document key to VueX
this.$store.commit({
type: "updateDocumentRemoveKey",
documentRemoveKey: document_key,
});
//Close the card modal if exists
const cardModal = document.getElementById("cardInformationModalCloseButton");
if (cardModal !== null)
{
cardModal.click();
}
//Open the modal
const confirmFileDeleteModal = new Modal(
document.getElementById("confirmFileDeleteModal")
);
confirmFileDeleteModal.show();
},
confirmFolderDelete(folder_id) {
//Send the folder id to VueX
this.$store.commit({
type: "updateFolderRemoveId",
folderRemoveId: folder_id,
});
//Close the card modal if exists
const cardModal = document.getElementById("cardInformationModalCloseButton");
if (cardModal !== null)
{
cardModal.click();
}
//Open the modal
const confirmFolderDeleteModal = new Modal(
document.getElementById("confirmFolderDeleteModal")
);
confirmFolderDeleteModal.show();
},
dragDocumentStart(event, moving_document_id) {
// If the user does not have any permissions, just return
if (!this.hasDocumentPermission) return;
event.dataTransfer.setData(
"moving_document_id",
moving_document_id
);
event.dataTransfer.setData(
"object_type",
"document"
);
},
dragleaveFolder(event, folder_id) {
// If the user does not have any permissions, just return
if (!this.hasDocumentPermission) return;
//Prevent Default
event.preventDefault();
//Manipulate the background colour
const folder_object = document.getElementById(folder_id);
folder_object.style.backgroundColor = "";
},
dragFolderStart(event, moving_folder_id) {
// If the user does not have any permissions, just return
if (!this.hasDocumentPermission) return;
event.dataTransfer.setData(
"moving_folder_id",
moving_folder_id
);
event.dataTransfer.setData(
"object_type",
"folder"
);
},
dragoverFolder(event, folder_id) {
//Prevent default
event.preventDefault();
// If the user does not have any permissions, just return
if (!this.hasDocumentPermission) return;
//Manipulate the background colour
const folder_object = document.getElementById(folder_id);
folder_object.style.backgroundColor = "rgba(150, 150, 150, 0.5)";
},
drop(event, folder_id) {
event.preventDefault();
// If the user does not have any permissions, just return
if (!this.hasDocumentPermission) return;
//Look up the object type and apply the correct movement
const object_type = event.dataTransfer.getData("object_type");
if (object_type === "folder") {
//Handle the folder stuff
this.handleFolderMove(event, folder_id);
} else if (object_type === "document") {
this.handleDocumentMove(event, folder_id);
}
//Due to a bug, a user could drag and drop a document onot a folder, or parent directory. After this happens
//the background stays the gray colour. We are fetching both possibilities and making sure they are returned
//to their prior colour.
const parentFolder = document.getElementById('folder_parent_directory');
const folderObject = document.getElementById(`folder_${folder_id}`);
if (parentFolder !== undefined && parentFolder !== null) parentFolder.style.backgroundColor = "";
if (folderObject !== undefined && folderObject !== null) folderObject.style.backgroundColor = "";
},
getDestination() {
return this.overrideDestination !== "" ? this.overrideDestination : this.destination;
},
getDocumentList() {
//If getLocationID === 0 - bail on axios
if (this.getLocationId() === 0) return;
this.axios.post(
`${this.rootUrl}documentation/${this.getDestination()}/${this.getLocationId()}/list/files/`
).then((response) => {
// this.documentList = response.data;
//
// this.updateDocumentFilteredList();
this.$store.commit({
type: "updateDocumentList",
documentList: response.data,
})
}).catch(error => {
this.$store.dispatch("newToast", {
header: "Error getting Document List",
message: `Can not retrieve document list. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
getFolderList() {
//If getLocationID === 0 - bail on axios
if (this.getLocationId() === 0) return;
this.axios.post(
`${this.rootUrl}documentation/${this.getDestination()}/${this.getLocationId()}/list/folders/`
).then((response) => {
// this.folderList = response.data;
//
// this.updateFolderFilteredList();
this.$store.commit({
type: "updateFolderList",
folderList: response.data,
});
});
},
getIcon(document) {
//If the document is a weblink - just return the link image
if (
document.document_key__document_url_location !== "" &&
document.document_key__document_url_location !== null
) {
return CarbonLink;
}
//We know the document is not a link - now we use the suffix to the document name to determine the icon
const split_document = document.document_key__document.split(".");
//Get the last result
const document_suffic = split_document[split_document.length - 1];
switch (document_suffic) {
case "jpg":
case "png":
case "bmp":
return CarbonImage;
case "doc":
case "docx":
return MdiMicrosoftWord;
case "xls":
case "xlsx":
return MdiMicrosoftExcel;
case "ppt":
case "pptx":
return MdiMicrosoftPowerPoint;
case "pdf":
return CarbonDocumentPdf;
default:
return CarbonDocument;
}
},
getLocationId() {
//If there is an overrideDestination - we want to use the overrideLocationId
return this.overrideDestination !== "" ? this.overrideLocationId : this.locationId;
},
goToParentDirectory() {
this.$store.commit("updateCurrentFolder", {
currentFolder: this.currentParentFolder,
});
},
handleDocumentMove(event, parent_folder_id) {
//Get the document key id
const document_key_id = event.dataTransfer.getData('moving_document_id');
if (document_key_id === undefined) return;
//If folder id == 0, make it null
if (parseInt(parent_folder_id) === 0) parent_folder_id = null;
//Update document folder id
this.$store.dispatch("updateDocumentFolder", {
document_key_id,
parent_folder_id,
});
//Update the backend
const data_to_send = new FormData();
data_to_send.set("document_key", document_key_id);
if (parent_folder_id !== undefined && parent_folder_id !== null) {
data_to_send.set("parent_folder", parent_folder_id);
}
this.axios.post(
`${this.rootUrl}documentation/${this.getDestination()}/${this.getLocationId()}/update_document/`,
data_to_send,
).catch(error => {
this.$store.dispatch("newToast", {
header: "Error Moving Document",
message: `Sorry, there was an error moving your document. Please refresh page. Error -> ${error}`,
delay: 0,
extra_classes: "bg-danger",
});
});
},
handleFolderMove(event, parent_folder_id) {
//Get the folder id of the moving folder
const moving_folder_id = event.dataTransfer.getData("moving_folder_id");
if (moving_folder_id === undefined) return;
//If folder_id == 0, make it null
if (parseInt(parent_folder_id) === 0) parent_folder_id = null;
//Update the folder
this.$store.dispatch("updateFolderParentFolder", {
moving_folder_id,
parent_folder_id,
});
//Update backend
const data_to_send = new FormData();
data_to_send.set("moving_folder", moving_folder_id);
if (parent_folder_id !== undefined && parent_folder_id !== null && parseInt(parent_folder_id) !== 0) {
data_to_send.set("parent_folder", parent_folder_id);
}
this.axios.post(
`${this.rootUrl}documentation/${this.getDestination()}/${this.getLocationId()}/update_folder/`,
data_to_send,
).catch(error => {
this.$store.dispatch("newToast", {
header: "Error Moving Folder",
message: `Sorry, there was an error moving your folder. Please refresh page. Error -> ${error}`,
delay: 0,
extra_classes: "bg-danger",
});
});
},
shortName(input_string) {
//The following method will determine if we need an ellipsis (...) at the end of the file/folder name
const max_string_length = 50;
//If string is less than the max length, then just return the string
if (input_string.length <= max_string_length) {
return input_string;
}
//Now we split the string by max_string_length - 3 (3 for the ...)
return `${input_string.substring(
0,
max_string_length - 3
)}...`;
},
updateCurrentFolder(new_folder_id) {
//Update the current folder id
this.$store.commit({
type: "updateCurrentFolder",
currentFolder: new_folder_id,
});
},
uploadDocument() {
//Close the card modal if exists
const cardModal = document.getElementById("cardInformationModalCloseButton");
if (cardModal !== null)
{
cardModal.click();
}
//Open the upload document modal
const uploadDocumentModal = new Modal(
document.getElementById("uploadDocumentModal")
);
uploadDocumentModal.show();
},
},
};
</script>

View File

@@ -0,0 +1,250 @@
<template>
<div>
<!-- GROUPS -->
<h2>
Groups
</h2>
<p class="text-instructions">
The following list are all the Groups connected to this
{{ destinationTitle }}. Users will have to be included in these groups to
be added to this {{ destinationTitle }}
</p>
<div
v-if="loadingData"
class="alert alert-info"
>
Currently loading group data.
</div>
<div
v-else-if="objectGroupList.length === 0 && !addingGroupStatus"
class="alert alert-dark"
>
Sorry - there are no groups active.
</div>
<div
v-else
class="group-card-list"
>
<div
v-for="group in objectGroupList"
:key="group.group_id"
class="group-card"
>
<div class="group-card--details">
{{ group.group_name }}
</div>
<div
v-if="userLevel >= 2 && objectGroupList.length > 1"
class="group-card--remove"
>
<carbon-trash-can
@click="removeGroup(group.group_id)"
></carbon-trash-can>
</div>
</div>
<div
v-if="addingGroupStatus"
class="group-card"
>
<div class="group-card--details">++ Adding New Group ++</div>
</div>
</div>
<div class="spacer"></div>
<!-- ADD GROUP -->
<!-- TO DO - limit it to certain users -->
<div class="row submit-row">
<div class="col-md-12">
<a
v-if="userLevel > 1 && !isReadOnly"
href="javascript:void(0)"
class="btn btn-primary save-changes"
@click="addNewGroup"
>Add Group to {{ destinationTitle }}</a
>
</div>
</div>
<hr/>
<!-- USERS -->
<h2>
Users
</h2>
<p class="text-instructions">
The following are a list of users who are connected to this
{{ destinationTitle }}. Please note - users have to be a part of the
groups list above.
</p>
<render-user-card-list
:adding-user-status="addingUserStatus"
:loading-data="loadingData"
:object-user-list="objectUserList"
@remove_user="removeUser"
></render-user-card-list>
<div class="spacer"></div>
<!-- TO DO - limit it to certain users -->
<div
v-if="userLevel > 1 && !isReadOnly"
class="row submit-row"
>
<div class="col-md-12">
<a
href="javascript:void(0)"
class="btn btn-primary save-changes"
@click="addNewUser"
>Add User to {{ destinationTitle }}</a
>
</div>
</div>
<!-- MODALS -->
<add-group-wizard></add-group-wizard>
<add-user-wizard></add-user-wizard>
<confirm-group-delete :group-id="deleteGroupId"></confirm-group-delete>
<confirm-user-delete :username="deleteUsername"></confirm-user-delete>
</div>
</template>
<script>
//JavaScript extras
import {Modal} from "bootstrap";
import AddGroupWizard from "../wizards/AddGroupWizard.vue";
import AddUserWizard from "../wizards/AddUserWizard.vue";
import ConfirmGroupDelete from "../wizards/ConfirmGroupDelete.vue";
import ConfirmUserDelete from "../wizards/ConfirmUserDelete.vue";
//VueX
import {mapGetters} from "vuex";
//Components
import RenderUserCardList from "Components/render/RenderUserCardList.vue";
import {CarbonTrashCan} from "../../../components";
export default {
name: "GroupsAndUsersModule",
components: {
CarbonTrashCan,
AddGroupWizard,
AddUserWizard,
ConfirmGroupDelete,
ConfirmUserDelete,
RenderUserCardList,
},
props: {
isReadOnly: {
type: Boolean,
default: false,
},
},
data() {
return {
deleteGroupId: 0,
deleteUsername: "",
destinationTitle: "",
loadingData: true,
}
},
computed: {
...mapGetters({
addingGroupStatus: "getAddingGroupStatus",
addingUserStatus: "getAddingUserStatus",
destination: "getDestination",
locationId: "getLocationId",
objectGroupList: "getObjectGroupList",
objectUserList: "getObjectUserList",
rootUrl: "getRootUrl",
staticUrl: "getStaticUrl",
userLevel: "getUserLevel",
}),
},
mounted() {
//Get the data with the 0'th count
this.$nextTick(() => {
// If location Id = 0, we have a problem
if (this.locationId === 0) {
setTimeout(() => {
this.getGroupAndUserData();
}, 500);
return;
}
//All is good - get the data
this.getGroupAndUserData();
//Use the destination string to pull out the title. i.e. request_for_change => Request For Change
let title = this.destination;
//Replace any _ with a space
title = title.replaceAll("_", " ");
//Title case
this.destinationTitle = title.replace(
/\w\S*/g,
(txt) => {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
}
);
});
},
methods: {
addNewGroup() {
const addGroupModal = new Modal(
document.getElementById("addGroupModal")
);
addGroupModal.show();
},
addNewUser() {
const addUserModal = new Modal(
document.getElementById("addUserModal")
);
addUserModal.show();
},
getGroupAndUserData() {
//Get the data from the database
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/group_and_user_data/`
).then((response) => {
//Update VueX with the required data
this.$store.commit("updateGroupsAndUsers", {
objectGroupList: response.data.object_group_list,
objectUserList: response.data.object_user_list,
potentialGroupList: response.data.potential_group_list,
potentialUserList: response.data.potential_user_list,
userGroupList: response.data.user_group_list,
});
this.loadingData = false;
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error fetching group and user data",
message: `Sorry we could not get any group or user data. Error -> ${error}`,
extra_classes: "bd-danger",
delay: 0,
});
})
},
removeGroup(group_id) {
//Tell the confirmation modal what group id is being deleted
this.deleteGroupId = group_id;
//Open the modal
const modal = new Modal(document.getElementById("confirmGroupDeleteModal"));
modal.show();
},
removeUser(username) {
//Tell the confirmation modal what user id is being deleted
this.deleteUsername = username;
//Open the modal
const modal = new Modal(document.getElementById("confirmUserDeleteModal"));
modal.show();
},
},
};
</script>

View File

@@ -0,0 +1,162 @@
<template>
<div>
<!-- NOTE HISTORY -->
<div
v-if="noteList.length === 0"
class="module-spacer"
>
<div class="alert alert-dark">
Sorry - but there are no notes for this {{ destination }}.
</div>
</div>
<div
v-else
class="note-history"
>
<div
v-for="note in noteList"
:key="note.object_note_id"
class="note-history--row"
>
<div class="note-history--profile">
<img
:src="profilePicture(note.profile_picture)"
alt="default profile"
class="note-history--profile-picture"
/>
<div class="note-history--username">
{{note.first_name}} {{note.last_name}}
</div>
<div class="note-history--date">
{{useNiceDatetime(note.date_modified)}}
</div>
<div
v-if="note.can_edit === 'true'"
class="note-history--edit-button"
>
<button
type="button"
class="btn btn-outline-secondary"
@click="editNote(note.object_note_id)"
>
Edit Note
</button>
<button
type="button"
class="btn btn-outline-danger"
@click="deleteNote(note.object_note_id)"
>
Delete Note
</button>
</div>
</div>
<div class="note-history--note">
<editor
v-model="note.object_note"
license-key="gpl"
:init="{
license_key: 'gpl',
height: 250,
menubar: false,
plugins: ['lists', 'image', 'codesample', 'table'],
toolbar: [],
skin: `${skin}`,
content_css: `${contentCss}`,
relative_urls: false,
}"
:disabled="true"
/>
</div>
</div>
</div>
</div>
</template>
<script>
import Editor from "@tinymce/tinymce-vue";
import { Modal } from "bootstrap";
//VueX
import {mapGetters} from "vuex";
//Composables
import {useNiceDatetime} from "Composables/datetime/useNiceDatetime";
export default {
name: "ListNotes",
components: {
editor: Editor,
},
props: {
destination: {
type: String,
default: "",
},
},
computed: {
...mapGetters({
contentCss: "getContentCss",
noteList: "getNoteList",
rootUrl: "getRootUrl",
staticUrl: "getStaticUrl",
skin: "getSkin",
}),
},
methods: {
useNiceDatetime,
deleteNote(object_note_id) {
//Tell VueX of the note id change
this.$store.dispatch({
type: "updateNoteId",
noteId: object_note_id,
});
//Open the modal
const modal = new Modal(document.getElementById("confirmNoteDeleteModal"));
modal.show();
if (this.destination === "card") {
//Close the kanban card information
const close_button = document.getElementById("cardInformationModalCloseButton");
//Make sure the button exists
if (close_button !== undefined) {
close_button.click();
}
}
},
editNote(object_note_id) {
//Tell VueX of the note id change
this.$store.dispatch({
type: "updateNoteId",
noteId: object_note_id,
});
//Open the modal
const modal = new Modal(document.getElementById("editNoteModal"));
modal.show();
if (this.destination === "card") {
//Close the kanban card information
const close_button = document.getElementById("cardInformationModalCloseButton");
//Make sure the button exists
if (close_button !== undefined) {
close_button.click();
}
}
},
profilePicture(picture_uuid) {
if (picture_uuid !== null && picture_uuid !== "") {
return `${this.rootUrl}private/${picture_uuid}/`;
}
return `${this.staticUrl}NearBeach/images/placeholder/people_tax.svg`;
},
}
};
</script>

View File

@@ -0,0 +1,302 @@
<template>
<h2>Public Links</h2>
<p class="text-instructions">
The following will be public links you can send to clients. The links will contain certain information of the
current object. i.e. it's status and description. Becareful who you send the links too!
</p>
<div
v-if="isFetchingData"
class="alert alert-info"
>Currently loading data...</div>
<div
v-if="isFetchingData === false && publicLinkResults.length === 0"
class="alert alert-info"
>
Sorry. There are no public links setup for this object.
</div>
<table
v-else
class="table table-striped"
>
<thead>
<tr>
<td>Public Link</td>
<td style="text-align:center;width:100px;">Is Active</td>
<td v-if="userLevel > 1" style="width:10px;"></td>
</tr>
</thead>
<tbody>
<tr
v-for="link in publicLinkResults"
:key="link.public_link_id"
>
<td>
<button
type="button"
class="btn btn-link"
@click="copyPublicLink(link.public_link_id)"
>
{{formatUrl(link.public_link_id)}}
</button>
</td>
<td style="text-align: center">
<input
class="form-check-input"
type="checkbox"
:checked="link.public_link_is_active"
:data-public-link-id="link.public_link_id"
:disabled="userLevel<=1"
@change="updateIsActive"
/>
</td>
<td v-if="userLevel > 1">
<span class="remove-link">
<carbon-trash-can
@click="confirmDeletePublicLink(link.public_link_id)"
></carbon-trash-can>
</span>
</td>
</tr>
</tbody>
</table>
<div
v-if="isReadOnly===false && userLevel > 1"
class="row submit-row"
>
<div class="col-md-12">
<button
class="btn btn-primary save-changes"
@click="createPublicLink"
>
Create Public Link
</button>
</div>
</div>
</template>
<script>
//VueX
import { mapGetters } from "vuex";
//Icon
import {CarbonTrashCan} from "../../../components";
//Bootstrap
import {Modal} from "bootstrap";
export default {
name: "ListPublicLinks",
components: {
CarbonTrashCan,
},
props: {
isReadOnly: {
type: Boolean,
default: false,
},
overrideDestination: {
type: String,
default: "",
},
overrideLocationId: {
type: Number,
default: 0,
},
},
data() {
return {
isFetchingData: true,
// publicLinkResults: [],
};
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
publicLinkResults: "getPublicLinkResults",
rootUrl: "getRootUrl",
userLevel: "getUserLevel",
})
},
watch: {
overrideLocationId() {
this.getPublicLinks();
},
},
mounted() {
this.$nextTick(() => {
this.getPublicLinks();
})
},
methods: {
confirmDeletePublicLink(public_link_id) {
//Update VueX
this.$store.commit({
type: "updatePublicLinkRemoveKey",
publicLinkRemoveKey: public_link_id,
});
//Close the card modal if exists
const cardModal = document.getElementById("cardInformationModalCloseButton");
if (cardModal !== null)
{
cardModal.click();
}
//Open Modal
const modal = new Modal(
document.getElementById("confirmPublicLinkDeleteModal")
);
modal.show();
},
async copyPublicLink(public_link_id) {
//Get the URL
const url = `${window.location.origin}${this.rootUrl}public/${this.getDestination()}/${this.getLocationId()}/${public_link_id}/`
//Copy to the clipboard
try {
await navigator.clipboard.writeText(url);
//Notify the user
this.$store.dispatch("newToast", {
header: "Public Link Copied",
message: "Public Link has successfully copied to the clipboard",
extra_classes: "bg-success",
});
} catch(error) {
this.$store.dispatch("newToast", {
header: "Can not copy public link",
message: `Sorry, we failed to copy the public link: ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
}
},
createPublicLink() {
//Inform user of creating new link
this.$store.dispatch("newToast", {
header: "Creating New Toast",
message: "Please wait whilst we create the toast",
extra_classes: "bg-warning text-dark",
delay: 0,
unique_type: "create_public_link",
});
//Contact backend - get public link
this.axios.post(
`${this.rootUrl}public_data/${this.getDestination()}/${this.getLocationId()}/create/`,
).then((response) => {
//Inform user of success
this.$store.dispatch("newToast", {
header: "Successful new Public Link",
message: "We have been able to create a new public link",
extra_classes: "bg-success",
unique_type: "create_public_link",
});
//Replace everything
this.$store.commit({
type: "updatePublicLinkResults",
publicLinkResults: response.data,
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Can not create new public link",
message: `Sorry, we failed to create the new public link. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
unique_type: "create_public_link",
});
})
},
formatUrl(public_link_id) {
//Double check we are getting the correct URL
if (public_link_id === "" || public_link_id === undefined) {
return "Data error!";
}
//Trucate the UUID - so if someone is viewing the screen they don't get the key
const trunc_link_id = public_link_id.slice(0,7);
return `${window.location.origin}${this.rootUrl}public/${this.getDestination()}/${this.getLocationId()}/${trunc_link_id}...`
},
getDestination() {
return this.overrideDestination !== "" ? this.overrideDestination : this.destination;
},
getLocationId() {
//If there is an overrideDestination - we want to use the overrideLocationId
return this.overrideDestination !== "" ? this.overrideLocationId : this.locationId;
},
getPublicLinks() {
//Escape if there is no location id
if (this.getLocationId() === 0) return;
this.axios(
`${this.rootUrl}public_data/${this.getDestination()}/${this.getLocationId()}/get_links/`,
).then((response) => {
//Set the data
this.$store.commit({
type: "updatePublicLinkResults",
publicLinkResults: response.data,
});
//Set the fetch status to false
this.isFetchingData = false;
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error fetching Public Links",
message: `We had an issue fetching the public links for this object. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
updateIsActive(event) {
//Get the uuid
const uuid = event.target.dataset.publicLinkId;
//Tell the user we are updating the stats
this.$store.dispatch("newToast", {
header: "Updating Active Status for Private Link",
message: "Please wait - we are updating the status",
extra_classes: "bg-warning text-dark",
delay: 0,
unique_type: `is_active-${uuid}`,
});
//Translate the checked box
let is_active = "False";
if (event.target.checked) {
is_active = "True";
}
//Setup data to send
const data_to_send = new FormData();
data_to_send.set("public_link_id", uuid);
data_to_send.set("public_link_is_active", is_active);
this.axios.post(
`${this.rootUrl}public_data/${this.destination}/${this.locationId}/update_link/`,
data_to_send,
).then(() => {
//Update user
this.$store.dispatch("newToast", {
header: "Successfully Updated",
message: "We have updated the is active status for the link",
extra_classes: "bg-success",
unique_type: `is_active-${uuid}`,
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Updating Active Status for Private Link",
message: `We are sorry, something went wrong. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
unique_type: `is_active-${uuid}`,
});
})
},
},
}
</script>

View File

@@ -0,0 +1,44 @@
<template>
<child-sprints
v-if="childSprintsAllowedDestination.includes(destination)"
></child-sprints>
<assigned-sprints
v-if="assignedSprintAllowedDestination.includes(destination)"
></assigned-sprints>
</template>
<script>
//Import components
import ChildSprints from "./ChildSprints.vue";
import AssignedSprints from "./AssignedSprints.vue";
//vuex
import { mapGetters } from "vuex";
export default {
name: "ListSprints",
components: {
AssignedSprints,
ChildSprints,
},
data() {
return {
assignedSprintAllowedDestination: [
"requirement_item",
"project",
"task",
],
childSprintsAllowedDestination: [
"requirement",
"project",
],
}
},
computed: {
...mapGetters({
destination: "getDestination",
}),
},
}
</script>

View File

@@ -0,0 +1,164 @@
<template>
<div>
<h2>Assigned Tags</h2>
<p class="text-instructions">
Here are all tags associated with this {{ getDestination() }}. You can
add more tags by clicking on the "Add Tag" button.
</p>
<div class="tag-list">
<div
v-for="tag in assignedTags"
:key="tag.tag_id"
class="single-tag"
:style="`background-color: ${tag.tag_colour};color: ${tag.tag_text_colour};`"
>
{{ tag.tag_name }}
<span
@click="removeTag(tag.tag_id)"
>
<carbon-close-outline
v-if="userLevel > 1"
></carbon-close-outline>
</span>
</div>
</div>
<!-- ADD TAG BUTTON -->
<div class="row submit-row">
<div class="col-md-12">
<a
v-if="userLevel > 1"
href="javascript:void(0)"
class="btn btn-primary save-changes"
@click="openNewTagModal"
>Add Tag to {{ getDestination() }}</a
>
</div>
</div>
</div>
</template>
<script>
import {Modal} from "bootstrap";
//VueX
import {mapGetters} from "vuex";
import {CarbonCloseOutline} from "../../../components";
export default {
name: "ListTagsModule",
components: {
CarbonCloseOutline,
},
props: {
closeModalBefore: {
type: String,
default: "",
},
overrideDestination: {
type: String,
default: "",
},
overrideLocationId: {
type: Number,
default: 0,
},
},
computed: {
...mapGetters({
assignedTags: "getAssignedTags",
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
userLevel: "getUserLevel",
}),
},
watch: {
overrideLocationId() {
this.getAssignedTags();
}
},
mounted() {
//Wait 200ms before getting the data
this.$nextTick(() => {
this.getAssignedTags();
});
},
methods: {
getAssignedTags() {
if (this.getLocationId() === 0) return;
this.axios.post(
`${this.rootUrl}object_data/${this.getDestination()}/${this.getLocationId()}/tag_list/`
).then((response) => {
this.$store.commit({
type: "updateAssignedTags",
assignedTags: response.data,
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Getting Assigned Tags",
message: `Error getting assigned tags. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
getDestination() {
return this.overrideDestination !== "" ? this.overrideDestination : this.destination;
},
getLocationId() {
//If there is an overrideDestination - we want to use the overrideLocationId
return this.overrideDestination !== "" ? this.overrideLocationId : this.locationId;
},
openNewTagModal() {
//Close any modals that exist
if (this.closeModalBefore !== "") {
//Click on the close button :)
document.getElementById(this.closeModalBefore).click();
}
//Open up modal
const newTagModal = new Modal(
document.getElementById("addTagModal")
);
newTagModal.show();
},
removeTag(tag_id) {
//If user does not have enough permissions, don't let them proceed.
if (this.userLevel <= 1) return;
//Create data_to_send
const data_to_send = new FormData();
data_to_send.set("tag", tag_id);
//Send data using axios
this.axios.post(
`${this.rootUrl}object_data/${this.getDestination()}/${this.getLocationId()}/delete_tag/`,
data_to_send
).then(() => {
//Remove data from tagList
this.$store.dispatch("removeAssignedTag", {
tag_id,
});
//If destination is a kanban card, we update the card's tag list
if (this.getDestination() === "kanban_card") {
this.$store.commit({
type: "updateKanbanCard",
card_id: this.getLocationId(),
tag_list: this.assignedTags,
});
}
}).catch(error => {
this.$store.dispatch("newToast", {
header: "Error Removing Tag",
message: `Sorry, we could not remove the tag. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
},
};
</script>

View File

@@ -0,0 +1,36 @@
<template>
<list-tags-module></list-tags-module>
<add-tag-wizard></add-tag-wizard>
<hr>
<list-public-links></list-public-links>
</template>
<script>
// JavaScript Libraries
import AddTagWizard from "../wizards/AddTagWizard.vue";
import ListPublicLinks from "./ListPublicLinks.vue";
import ListTagsModule from "./ListTagsModule.vue";
//VueX
import { mapGetters } from "vuex";
export default {
name: "MiscModule",
components: {
AddTagWizard,
ListPublicLinks,
ListTagsModule,
},
computed: {
...mapGetters({
destination: "getDestination",
}),
},
};
</script>

View File

@@ -0,0 +1,98 @@
<template>
<div>
<h2>
Note History
</h2>
<p class="text-instructions">
The following are saved notes against this {{ destination }}. Add
notes by clicking on the button below.
</p>
<list-notes
:destination="destination"
></list-notes>
<!-- ADD NOTE HISTORY -->
<hr v-if="userLevel > 1 || hasNotePermission" />
<div class="row submit-row">
<div class="col-md-12">
<button
v-if="userLevel > 1 || hasNotePermission"
class="btn btn-primary save-changes"
@click="createNewNote"
>
Add Note to {{ destination }}
</button>
</div>
</div>
</div>
</template>
<script>
// JavaScript Libraries
import {Modal} from "bootstrap";
import ListNotes from "./ListNotes.vue";
//VueX
import {mapGetters} from "vuex";
export default {
name: "NotesModule",
components: {
ListNotes,
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
userLevel: "getUserLevel",
rootUrl: "getRootUrl",
}),
...mapGetters([
"getUserExtraPermission",
]),
hasNotePermission() {
return this.getUserExtraPermission(`${this.destination}_note`);
},
},
mounted() {
this.$nextTick(() => {
this.getNoteHistoryResults();
});
},
methods: {
createNewNote() {
const newNoteModal = new Modal(
document.getElementById("newNoteModal")
);
newNoteModal.show();
},
getNoteHistoryResults() {
//Depends if we are using note_list or organisation_note_list
let note_list = "note_list";
if (this.destination === "organisation") {
note_list = "organisation_note_list";
}
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/${note_list}/`,
).then((response) => {
// this.noteHistoryResults = response.data;
this.$store.commit({
type: "initNoteList",
noteList: response.data,
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Getting Note History",
message: `Can not retrieve the note history. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
})
});
},
},
};
</script>

View File

@@ -0,0 +1,242 @@
<template>
<div>
<h2>
{{ destination }} Links
</h2>
<p class="text-instructions">
The following are links to other objects like
projects/tasks/requirements. You can link a {{ destination }}
to these other objects to symbolise a connection between the two.
</p>
<!-- OBJECT LINKS -->
<div
v-if="linkResults.length === 0"
class="requirement-item-spacer"
>
<div class="alert alert-dark">
Sorry - there are no Links for this requirement.
</div>
</div>
<div v-else>
<!-- Relates To -->
<sub-object-links
title="Relates To"
:link-results="relatesTo"
@update_link_results="updateLinkResults($event)"
></sub-object-links>
<!-- Kanban Cards -->
<sub-object-links
title="Kanban Cards"
:link-results="kanbanCard"
:can-delete="false"
></sub-object-links>
<!-- Is Blocked By -->
<sub-object-links
title="Is Blocked By"
:link-results="isBlockedBy"
@update_link_results="updateLinkResults($event)"
></sub-object-links>
<!-- Is Currently Blocking -->
<sub-object-links
title="Is Currently Blocking"
:link-results="isCurrentlyBlocking"
@update_link_results="updateLinkResults($event)"
></sub-object-links>
<!-- Is Sub Object Of -->
<sub-object-links
title="Is Subobject Of"
:link-results="isSubObjectOf"
@update_link_results="updateLinkResults($event)"
></sub-object-links>
<!-- Is Parent Object Of -->
<sub-object-links
title="Is Parent Object Of"
:link-results="isParentOf"
@update_link_results="updateLinkResults($event)"
></sub-object-links>
<!-- Has Duplicate Object Of -->
<sub-object-links
title="Has Duplicate Object Of"
:link-results="hasDuplicateObjectOf"
@update_link_results="updateLinkResults($event)"
></sub-object-links>
<!-- Is Duplicate Object Of -->
<sub-object-links
title="Is Duplicate Object Of"
:link-results="isDuplicateObjectOf"
@update_link_results="updateLinkResults($event)"
></sub-object-links>
</div>
<!-- Submit Button -->
<hr v-if="userLevel > 1" />
<div class="row submit-row">
<div class="col-md-12">
<a
v-if="userLevel > 1"
href="javascript:void(0)"
class="btn btn-primary save-changes"
@click="newLink"
>Create new Link</a
>
</div>
</div>
<!-- MODAL FOR NEW OBJECT LINKS -->
<new-link-wizard
:destination="destination"
:location-id="locationId"
@update_link_results="updateLinkResults"
></new-link-wizard>
<!-- MODAL FOR CONFIRM DELETE LINK -->
<confirm-link-delete
@update_link_results="updateLinkResults"
></confirm-link-delete>
</div>
</template>
<script>
import {Modal} from "bootstrap";
import NewLinkWizard from "../wizards/NewLinkWizard.vue";
import SubObjectLinks from "./SubObjectLinks.vue";
import ConfirmLinkDelete from "../wizards/ConfirmLinkDelete.vue";
//VueX
import {mapGetters} from "vuex";
export default {
name: "ObjectLinks",
components: {
ConfirmLinkDelete,
NewLinkWizard,
SubObjectLinks,
},
data() {
return {
hasDuplicateObjectOf: [],
isBlockedBy: [],
isCurrentlyBlocking: [],
isDuplicateObjectOf: [],
isParentOf: [],
isSubObjectOf: [],
kanbanCard: [],
linkResults: [],
relatesTo: [],
};
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
userLevel: "getUserLevel",
}),
},
mounted() {
this.$nextTick(() => {
this.updateLinkResults();
});
},
methods: {
isLinkedObject(object) {
let results = false;
if (object.fields.project !== null) results = true;
if (object.fields.task !== null) results = true;
if (object.fields.requirement !== null) results = true;
return results;
},
newLink() {
//Open up the modal
const elem_modal = new Modal(
document.getElementById("newLinkModal")
);
elem_modal.show();
},
updateLinkResults() {
//Clear the data
this.linkResults = [];
//Get the data from the database
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/object_link_list/`
).then((response) => {
this.linkResults = response.data
//Filter out the data for relates to
this.relatesTo = response.data.filter(row => {
//We only have one condition - if there is a relate
return row.link_relationship === 'Relate' || row.link_relationship === null;
});
//Filter out the data for is blocked by
this.isBlockedBy = response.data.filter(row => {
const condition_1 = row.link_relationship === 'Block' && row.parent_link !== this.destination && row.reverse_relation === false;
const condition_2 = row.link_relationship === 'Block' && row.parent_link === this.destination && row.reverse_relation === true; //reverse
return condition_1 || condition_2;
})
//Filter out the data for kanban cards
this.kanbanCard = response.data.filter(row => {
//We only have one condition - if there is a kanban card
return row.link_relationship === 'Card'
})
//Filter out the data for is currently blocking
this.isCurrentlyBlocking = response.data.filter(row => {
const condition_1 = row.link_relationship === 'Block' && row.parent_link === this.destination && row.reverse_relation === false;
const condition_2 = row.link_relationship === 'Block' && row.parent_link !== this.destination && row.reverse_relation === true; //reverse
return condition_1 || condition_2;
})
//Filter out the dat for is subobject of
this.isSubObjectOf = response.data.filter(row => {
const condition_1 = row.link_relationship === 'Subobject' && row.parent_link !== this.destination && row.reverse_relation === false;
const condition_2 = row.link_relationship === 'Subobject' && row.parent_link === this.destination && row.reverse_relation === true;
return condition_1 || condition_2;
})
this.isParentOf = response.data.filter(row => {
const condition_1 = row.link_relationship === 'Subobject' && row.parent_link === this.destination && row.reverse_relation === false;
const condition_2 = row.link_relationship === 'Subobject' && row.parent_link !== this.destination && row.reverse_relation === true;
return condition_1 || condition_2;
})
this.hasDuplicateObjectOf = response.data.filter(row => {
const condition_1 = row.link_relationship === 'Duplicate' && row.parent_link === this.destination && row.reverse_relation === false;
const condition_2 = row.link_relationship === 'Duplicate' && row.parent_link !== this.destination && row.reverse_relation === true;
return condition_1 || condition_2;
})
this.isDuplicateObjectOf = response.data.filter(row => {
const condition_1 = row.link_relationship === 'Duplicate' && row.parent_link !== this.destination && row.reverse_relation === false;
const condition_2 = row.link_relationship === 'Duplicate' && row.parent_link === this.destination && row.reverse_relation === true;
return condition_1 || condition_2;
})
}).catch((error) => {
this.$store.dispatch("newToast", {
heading: "Object Links failed to get data",
message: `Failed to get data - Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
},
};
</script>

View File

@@ -0,0 +1,87 @@
<template>
<div
v-for="sprint in sprintResults"
:key="sprint.sprint_id"
class="row object-link"
>
<!-- Sprint ID + Sprint Name -->
<div class="col-md-10 object-link--details">
<a
:href="`${rootUrl}sprint_information/${sprint.sprint_id}/`"
target="_blank"
rel="noopener noreferrer"
>
<div class="object-link--link">Sprint- {{ sprint.sprint_id }}</div>
<div class="object-link--title">{{ sprint.sprint_name }}</div>
<div class="object-link--link">
Story Point Progression:
{{ sprint.completed_story_points }} out of {{ sprint.total_story_points }}
</div>
<div class="object-link--link">
Dates:
{{ useNiceDate(sprint.sprint_start_date) }} till {{ useNiceDate(sprint.sprint_end_date) }}
</div>
</a>
</div>
<!-- Sprint Status -->
<div class="col-md-2 object-link--status">
<span>Sprint Status: </span>
<span>
{{ sprint.sprint_status }}
</span>
</div>
<!-- Object Delete -->
<div
v-if="userLevel >= 2 && canDelete === true"
class="object-link--remove"
>
<carbon-trash-can
@click="confirmRemoveSprintFunction(sprint)"
></carbon-trash-can>
</div>
</div>
</template>
<script>
//Vuex
import { mapGetters } from "vuex";
import {CarbonTrashCan} from "../../../components";
//Composables
import {useNiceDate} from "Composables/datetime/useNiceDate";
export default {
name: "RenderSprintCard",
components: {CarbonTrashCan},
props: {
canDelete: {
type: Boolean,
default: true,
},
sprintResults: {
type: Array,
default: () => {
return [];
},
},
},
emits: [
"confirm_remove_sprint",
],
computed: {
...mapGetters({
rootUrl: "getRootUrl",
userLevel: "getUserLevel",
})
},
methods: {
useNiceDate,
confirmRemoveSprintFunction(sprint) {
//Send request upstream
this.$emit("confirm_remove_sprint", sprint);
}
},
}
</script>

View File

@@ -0,0 +1,135 @@
<template>
<div>
<h2>
Requirement Item Links
</h2>
<p class="text-instructions">
The following are links for the Items to other projects/tasks.
</p>
<!-- ITEM LINKS -->
<div v-if="itemLinkProject.length + itemLinkTask.length === 0">
<div class="alert alert-dark">
Sorry - there are no Item Links. Please navigate to the Item you
wish to add a link too.
</div>
</div>
<div v-else>
<!-- Project Links -->
<sub-object-links
title="Project Links"
:link-results="itemLinkProject"
@update_link_results="updateLinkResults($event)"
></sub-object-links>
<!-- Task Links -->
<sub-object-links
title="Task Links"
:link-results="itemLinkTask"
@update_link_results="updateLinkResults($event)"
></sub-object-links>
</div>
<!-- Submit Button -->
<hr v-if="userLevel > 1"/>
<div
v-if="userLevel > 1"
class="row submit-row"
>
<div class="col-md-12">
<a
href="javascript:void(0)"
class="btn btn-primary save-changes"
@click="newRequirementItemLink"
>Create new Link</a
>
</div>
</div>
<!-- LINKING MODAL -->
<!-- need to build something that resets the requirement links when adding links -->
<new-requirement-link-wizard
:location-id="locationId"
:destination="destination"
@update_module="updateLinkResults($event)"
></new-requirement-link-wizard>
<!-- MODAL FOR CONFIRM DELETE LINK -->
<confirm-link-delete
@update_link_results="updateLinkResults($event)"
></confirm-link-delete>
</div>
</template>
<script>
import {Modal} from "bootstrap";
import NewRequirementLinkWizard from "../wizards/NewRequirementLinkWizard.vue";
import ConfirmLinkDelete from "../wizards/ConfirmLinkDelete.vue";
//VueX
import {mapGetters} from "vuex";
import SubObjectLinks from "./SubObjectLinks.vue";
export default {
name: "RequirementItemLinksModule",
components: {
ConfirmLinkDelete,
NewRequirementLinkWizard,
SubObjectLinks,
},
data() {
return {
// itemLinkResults: [],
itemLinkProject: [],
itemLinkTask: [],
};
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
userLevel: "getUserLevel",
}),
},
mounted() {
//Get the required data we need
this.$nextTick(() => {
this.updateLinkResults();
})
},
methods: {
updateLinkResults() {
//Get the data from the database
this.axios.post(
`${this.rootUrl}object_data/requirement_item/${this.locationId}/object_link_list/`,
).then((response) => {
this.itemLinkProject = response.data.filter((row) => {
return row.object_type === "project";
});
this.itemLinkTask = response.data.filter((row) => {
return row.object_type === "task";
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Updating Link Results",
message: `We have had issues updating link results - error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
newRequirementItemLink() {
//Open up the modal
const elem_modal = new Modal(
document.getElementById("newRequirementLinkModal")
);
elem_modal.show();
},
},
};
</script>

View File

@@ -0,0 +1,128 @@
<template>
<div>
<h2>
Requirement Items
</h2>
<p class="text-instructions">
Requirements should be broken down into smaller components called
Requirement Items.
</p>
<!-- TABLE OF REQUIREMENT ITEMS -->
<div
v-if="itemResults.length === 0"
class="requirement-item-spacer"
>
<div class="alert alert-dark">
Sorry - there are no Items for this requirement.
</div>
</div>
<div v-else>
<render-object-card
:import-variables="requirementItemVariables"
:search-results="itemResults"
destination="requirement_item"
></render-object-card>
</div>
<!-- Submit Button -->
<!-- TO DO - limit it to certain users -->
<hr v-if="userLevel > 1"/>
<div
v-if="userLevel > 1"
class="row submit-row"
>
<div class="col-md-12">
<button
class="btn btn-primary save-changes"
@click="createNewItem"
>
Create new Requirement Item
</button>
</div>
</div>
<!-- NEW REQUIREMENT ITEM MODAL -->
<new-requirement-item-wizard
:item-status-list="itemStatusList"
:item-type-list="itemTypeList"
:location-id="locationId"
@new_item_added="newItemAdded($event)"
></new-requirement-item-wizard>
</div>
</template>
<script>
//JavaScript Libraries
import {Modal} from "bootstrap";
//Components
import NewRequirementItemWizard from "../wizards/NewRequirementItemWizard.vue";
import RenderObjectCard from "Components/render/RenderObjectCard.vue";
//VueX
import {mapGetters} from "vuex";
export default {
name: "RequirementItemsModule",
components: {
RenderObjectCard,
NewRequirementItemWizard,
},
data() {
return {
requirementItemVariables: {
header: "Requirement Items",
prefix: "RI-",
id: "requirement_item_id",
title: "requirement_item_title",
status: "requirement_item_status_text",
end_date: "",
},
itemResults: [],
itemStatusList: [],
itemTypeList: [],
};
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
userLevel: "getUserLevel",
}),
},
mounted() {
this.updateItemResults();
},
methods: {
createNewItem() {
const new_item_modal = new Modal(
document.getElementById("newItemModal")
);
new_item_modal.show();
},
newItemAdded(data) {
//A new item has been added in the wizard. We use the new data that has passed through to update
//the item results array.
this.itemResults = data;
},
updateItemResults() {
this.axios.post(
"data/items/"
).then((response) => {
this.itemResults = response.data;
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Updating Item Results",
message: `We are having issues updating item results: Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
},
};
</script>

View File

@@ -0,0 +1,213 @@
<template>
<div>
<h2>
Requirement Links
</h2>
<p class="text-instructions">
The following are links to other projects/tasks. You can link a
Requirement to these other objects to symbolise a connection between
the two.
</p>
<!-- REQUIREMENT LINKS -->
<div
v-if="linkProject.length + linkTask.length === 0"
class="requirement-item-spacer"
>
<div class="alert alert-dark">
Sorry - there are no Links for this requirement.
</div>
</div>
<div v-else>
<!-- Project Links -->
<sub-object-links
title="Project Links"
:link-results="linkProject"
@update_link_results="updateLinkResults($event)"
></sub-object-links>
<!-- Task Links -->
<sub-object-links
title="Task Links"
:link-results="linkTask"
@update_link_results="updateLinkResults($event)"
></sub-object-links>
</div>
<!-- Submit Button -->
<div
v-if="userLevel > 1"
class="row submit-row"
>
<div class="col-md-12">
<a
v-if="userLevel > 1"
href="javascript:void(0)"
class="btn btn-primary save-changes"
@click="newRequirementLink"
>Create new Link</a
>
</div>
</div>
<hr/>
<h2>
Requirement Item Links
</h2>
<p class="text-instructions">
The following are links for the Items to other projects/tasks.
</p>
<!-- ITEM LINKS -->
<div v-if="itemLinkProject.length + itemLinkTask.length === 0">
<div class="alert alert-dark">
Sorry - there are no Item Links. Please navigate to the Item you
wish to add a link too.
</div>
</div>
<div v-else>
<!-- Project Links -->
<sub-object-links
title="Project Links"
:link-results="itemLinkProject"
:can-delete="false"
></sub-object-links>
<!-- Task Links -->
<sub-object-links
title="Task Links"
:link-results="itemLinkTask"
:can-delete="false"
></sub-object-links>
</div>
<!-- LINKING MODAL -->
<new-requirement-link-wizard
:location-id="locationId"
destination="requirement"
@update_module="updateLinkResults"
></new-requirement-link-wizard>
<!-- MODAL FOR CONFIRM DELETE LINK -->
<confirm-link-delete
@update_link_results="updateLinkResults"
></confirm-link-delete>
</div>
</template>
<script>
//JavaScript components
import {Modal} from "bootstrap";
//Components
import NewRequirementLinkWizard from "../wizards/NewRequirementLinkWizard.vue";
//VueX
import {mapGetters} from "vuex";
import SubObjectLinks from "./SubObjectLinks.vue";
import ConfirmLinkDelete from "../wizards/ConfirmLinkDelete.vue";
export default {
name: "RequirementLinksModule",
components: {
ConfirmLinkDelete,
SubObjectLinks,
NewRequirementLinkWizard,
},
data() {
return {
itemLinkProject: [],
itemLinkTask: [],
linkProject: [],
linkTask: [],
linkModel: [],
};
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
userLevel: "getUserLevel",
}),
},
mounted() {
this.$nextTick(() => {
this.updateLinkResults();
});
},
methods: {
newRequirementLink() {
//Open up the modal
const elem_modal = new Modal(
document.getElementById("newRequirementLinkModal")
);
elem_modal.show();
},
updateLinkResults() {
//Get the data from the database
this.axios.post(
`${this.rootUrl}object_data/requirement/${this.locationId}/object_link_list/`,
).then((response) => {
this.linkProject = response.data.filter((row) => {
return row.object_type === "project";
});
this.linkTask = response.data.filter((row) => {
return row.object_type === "task";
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Updating Link Results",
message: `We have had issues updating link results - error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
})
//Get the ITEM links
this.axios.post(
`${this.rootUrl}requirement_information/${this.locationId}/data/item_links/`,
).then((response) => {
this.itemLinkProject = response.data.filter((row) => {
return row.object_type === "project";
}).map((row) => {
return {
link_relationship: null,
parent_link: null,
object_id: row.object_id,
object_title: `Item-${row.requirement_item_id} - ${row.object_title}`,
object_status: row.object_status,
object_type: row.object_type,
reverse_relation:false
};
});
this.itemLinkTask = response.data.filter((row) => {
return row.object_type === "task";
}).map((row) => {
return {
link_relationship: null,
parent_link: null,
object_id: row.object_id,
object_title: `Item-${row.requirement_item_id} - ${row.object_title}`,
object_status: row.object_status,
object_type: row.object_type,
reverse_relation: false
};
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Updating Link Results",
message: `We have had issues updating link results - error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
}
},
};
</script>

View File

@@ -0,0 +1,97 @@
<template>
<h3 v-if="linkResults.length > 0">
{{ title }}
</h3>
<div
v-for="link in linkResults"
:key="link.pk"
class="row object-link"
>
<!-- Object ID + Title -->
<div class="col-md-10 object-link--details">
<a
:href="`${rootUrl}${link.object_type}_information/${link.object_id}/`"
target="_blank"
rel="noopener noreferrer"
>
<div class="object-link--link">{{ link.object_type }} - {{ link.object_id }}</div>
<div class="object-link--title">{{ link.object_title }}</div>
</a>
</div>
<!-- Object Status -->
<div class="col-md-2 object-link--status">
<span>Object Status: </span>
<span>
{{ link.object_status }}
</span>
</div>
<!-- Object Delete -->
<div
v-if="userLevel >= 2 && canDelete === true"
class="object-link--remove"
>
<carbon-trash-can
@click="confirmRemoveLink(link)"
></carbon-trash-can>
</div>
</div>
<div
v-if="linkResults.length > 0"
class="spacer-extra"
></div>
</template>
<script>
import {mapGetters} from "vuex";
import {Modal} from "bootstrap";
import {CarbonTrashCan} from "../../../components";
export default {
name: "SubObjectLinks",
components: {
CarbonTrashCan,
},
props: {
canDelete: {
type: Boolean,
default: true,
},
linkResults: {
type: Array,
default: () => {
return [];
},
},
title: {
type: String,
default: "Relates",
},
},
emits: ["update_link_results"],
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
userLevel: "getUserLevel",
}),
},
methods: {
confirmRemoveLink(objectLink) {
//Send link information up to VueX
this.$store.commit("updateObjectLink", {
objectLink,
});
//Open the modal
const modal = new Modal(
document.getElementById("confirmLinkDeleteModal")
);
modal.show();
},
}
}
</script>

View File

@@ -0,0 +1,308 @@
<template>
<div
id="addBugModal"
class="modal fade"
tabindex="-1"
aria-labelledby="exampleModalLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-xl modal-fullscreen-lg-down">
<div class="modal-content">
<div class="modal-header">
<h2>
Add Bugs Wizard
</h2>
<button
id="addBugsCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<strong>Adding Bugs</strong>
<p class="text-instructions">
Select which bug client you want to search data
from. Then use keywords or bug id to search for
the required bugs. Once the search results
appear, select those appropriate bugs that you
want to link to the {{ destination }}.
</p>
</div>
<div class="col-md-8">
<!-- Bug Client List -->
<div class="form-group">
<label>Bug Client</label>
<n-select
v-model:value="bugClientModel"
:options="bugClientList"
label="bug_client_name"
option="bug_client_id"
></n-select>
</div>
<!-- Search Keywords -->
<div class="form-group mt-4">
<label>Search Keywords</label>
<input
v-model="searchModel"
type="text"
class="form-control"
:disabled="bugClientModel == ''"
maxlength="50"
@keydown="startSearchTimer"
/>
</div>
<!-- The Search Results -->
<div
v-if="searchOn"
class="no-search mt-4"
>
<strong>Currently Searching for Bugs</strong>
<br/>
<img
:src="`${staticUrl}/NearBeach/images/placeholder/online_connection.svg`"
alt="Placeholder Search Image"
/>
</div>
<div
v-else-if="bugResults.length == 0"
class="no-search"
>
<strong>No Search Results Sorry</strong>
<br/>
<img
:src="`${staticUrl}/NearBeach/images/placeholder/road_to_knowledge.svg`"
alt="Placeholder Search Image"
/>
</div>
<div
v-else
id="bug_results_div"
>
<table class="table">
<thead>
<tr>
<td></td>
<td>Bug Description</td>
<td>Bug Status</td>
</tr>
</thead>
<tbody>
<tr
v-for="bug in bugResults"
:key="bug.id"
>
<td :id="`bug_no_${bug.id}`">
<a
href="javascript:void(0)"
@click="
submitBug(bug.id)
"
>
Add Bug
</a>
</td>
<td>
{{ bug.summary }}
<div class="spacer"></div>
<p class="small-text">
Assigned to:
{{ bug.assigned_to }}
</p>
<p class="small-text">
Bug No. {{ bug.id }} |
Priority. {{ bug.priority }}
</p>
</td>
<td>{{ bug.status }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
</div>
</div>
</div>
</div>
</template>
<script>
//JavaScript extras
import {NSelect} from "naive-ui";
//VueX
import {mapGetters} from "vuex";
export default {
name: "AddBugWizard",
components: {
NSelect,
},
props: {
destination: {
type: String,
default: "",
},
locationId: {
type: Number,
default: 0,
},
},
emits: [
'append_bug_list',
],
data() {
return {
bugClientModel: "",
bugClientList: [],
bugResults: [],
searchModel: "",
searchOn: false,
searchTimer: "",
};
},
computed: {
...mapGetters({
rootUrl: "getRootUrl",
staticUrl: "getStaticUrl",
}),
},
mounted() {
//If the location is inside the array - don't bother getting the data
const escape_array = ["requirement_item"];
if (escape_array.indexOf(this.destination) >= 0) return;
//Wait 200ms before getting data
this.$nextTick(() => {
this.loadBugClientList();
});
},
methods: {
loadBugClientList() {
this.axios.post(
`${this.rootUrl}object_data/bug_client_list/`
).then((response) => {
//Clear out the bug list
this.bugClientList = response.data.map((row) => {
return {
value: row.pk,
label: row.fields.bug_client_name,
};
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error loading bug client list",
message: `We had an issue loading the bug client list - error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
startSearchTimer() {
//Destroy the first timer if it exists
if (this.searchTimer !== "") {
clearTimeout(this.searchTimer);
}
//Reset the timer
this.searchTimer = setTimeout(() => {
this.startSearch();
}, 700);
},
startSearch() {
//Escape conditions
if (this.searchModel === "") {
return;
}
//We want to tell the user that we are actually searching
this.searchOn = true;
//Prepare for the data we are sending
const data_to_send = new FormData();
data_to_send.set("bug_client_id", this.bugClientModel);
data_to_send.set("search", this.searchModel);
//Send the data - then wait for a response
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/query_bug_client/`,
data_to_send
).then((response) => {
//Update the bug results
this.bugResults = response.data;
//Turn off the search
this.searchOn = false;
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Search Failed",
message: `Sorry, the search for bug client has failed. Errors -> ${error}`,
extra_classes: "bg-warning text-dark",
delay: 0,
});
});
},
submitBug(bug_id) {
//Tell user you are adding the bug
const add_bug_element = document.getElementById(
`bug_no_${bug_id}`
);
add_bug_element.innerHTML = "Adding Bug";
//Filter for the bug information out of the bugResults
const filted_bug_results = this.bugResults.filter((row) => {
return parseInt(row.id) === parseInt(bug_id);
});
//Setup data
const data_to_send = new FormData();
data_to_send.set("bug_client", this.bugClientModel);
data_to_send.set("bug_id", bug_id);
data_to_send.set(
"bug_description",
filted_bug_results[0].summary
);
data_to_send.set("bug_status", filted_bug_results[0].status);
//Send data to the backend
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/add_bug/`,
data_to_send
).then((response) => {
//Send the updated bug list up
this.$emit("append_bug_list", response.data);
//Update the user that the bug has been added
add_bug_element.innerHTML = "Done";
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Submit Bug Failed",
message: `Sorry, the submitting the bug failed. Errors -> ${error}`,
extra_classes: "bg-warning text-dark",
delay: 0,
});
});
},
},
};
</script>

View File

@@ -0,0 +1,229 @@
<template>
<div
id="addCustomerModal"
class="modal fade"
tabindex="-1"
aria-labelledby="exampleModalLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2>
Add Customers Wizard
</h2>
<button
id="addCustomerCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<div
v-if="customerFixList.length > 0"
class="row"
>
<div class="col-md-4">
<strong>Select Customer</strong>
<p class="text-instructions">
Search for a customer who has not been added to
this {{ destination }}. If the search is blank
there are either no customers that match that
search, or all customer have already been added
to the {{ destination }}.
</p>
</div>
<div class="col-md-8">
<n-select
v-model:value="customerModel"
:options="customerFixList"
label="customerName"
></n-select>
</div>
</div>
<div
v-else
class="row"
>
<div class="col-md-6">
<strong>Sorry - no results</strong>
<p class="text-instructions">
This could be because
</p>
<ul class="text-instructions">
<li>There are no more customers left to add</li>
<li>
There are no customers for this organisation
</li>
</ul>
</div>
<div class="col-md-6 no-search">
<img
:src="`${staticUrl}NearBeach/images/placeholder/questions.svg`"
alt="Sorry - there are no results"
/>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
:diabled="customerModel == ''"
@click="addCustomer"
>
Save changes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {NSelect} from "naive-ui";
//VueX
import {mapGetters} from "vuex";
export default {
name: "AddCustomerWizard",
components: {
NSelect,
},
props: {
destination: {
type: String,
default: "",
},
locationId: {
type: Number,
default: 0,
},
excludeCustomers: {
type: Array,
default: () => {
return [];
},
},
},
emits: [
'update_customer_results',
],
data() {
return {
customerModel: "",
customerList: [],
customerFixList: [],
};
},
computed: {
...mapGetters({
rootUrl: "getRootUrl",
staticUrl: "getStaticUrl",
}),
},
watch: {
excludeCustomers() {
this.updateCustomerFixList();
},
},
mounted() {
//If the location is inside the array - don't bother getting the data
const escape_array = ["requirement_item"];
if (!escape_array.indexOf(this.locationId) < 0) return;
//Wait 200ms before getting data
this.$nextTick(() => {
this.getCustomerList();
});
},
methods: {
addCustomer() {
// Set up the data object to send
const data_to_send = new FormData();
data_to_send.set("customer", this.customerModel);
this.axios
.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/add_customer/`,
data_to_send
)
.then((response) => {
//Send the new data up stream
this.$emit("update_customer_results", response.data);
//Clear the model
this.customerModel = "";
//Close the modal
document.getElementById("addCustomerCloseButton").click();
})
.catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Adding Customer",
message: `We had an issue adding customers. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
getCustomerList() {
this.axios
.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/customer_list_all/`
)
.then((response) => {
//Place all the data into the "CustomerList" array.
this.customerList = response.data;
//Update the fixed list
this.updateCustomerFixList();
})
.catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Getting Customer List",
message: `We had an issue getting customer list. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
updateCustomerFixList() {
//If no customer list result - just exit
if (this.customerList.length === 0) return;
//Create an array of ids we should be excluding
const exclude_array = [];
this.excludeCustomers.forEach((row) => {
exclude_array.push(row.pk);
});
//Set the customerFixList
this.customerFixList = this.customerList
.filter((row) => {
return !exclude_array.includes(row.pk);
})
.map((row) => {
return {
value: row.pk,
label: `${row.fields.customer_first_name} ${row.fields.customer_last_name}`,
};
});
},
},
};
</script>

View File

@@ -0,0 +1,165 @@
<template>
<div
id="addFolderModal"
class="modal fade"
tabindex="-1"
aria-labelledby="exampleModalLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2>
Add Folder Wizard
</h2>
<button
id="addFolderCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<strong>Creating a folder</strong>
<p class="text-instructions">
Give the folder an appropriate name. When done,
click on the "Save" button. It will be added to
the current folder.
</p>
</div>
<div class="col-md-8">
<div class="form-group">
<label for="folder_description"
>Folder Name</label
>
<input
id="folder_description"
v-model="folderDescriptionModel"
type="text"
class="form-control"
maxlength="50"
/>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
:disabled="disableAddFolderButton"
@click="addFolder"
>
Add Folder
</button>
</div>
</div>
</div>
</div>
</template>
<script>
//VueX
import {mapGetters} from "vuex";
import {useReopenCardInformation} from "Composables/card_information/useReopenCardinformation";
export default {
name: "AddFolderWizard",
components: {
},
props: {
destination: {
type: String,
default: "/",
},
locationId: {
type: Number,
default: 0,
},
},
data() {
return {
disableAddFolderButton: true,
folderDescriptionModel: "",
};
},
computed: {
...mapGetters({
existingFolders: "getFolderFilteredList",
currentFolder: "getCurrentFolder",
rootUrl: "getRootUrl",
}),
},
updated() {
/*If there is no folder description OR the folder description already exists - we want to disable the add
button.*/
const match = this.existingFolders.filter((row) => {
return (
row.fields.folder_description === this.folderDescriptionModel
);
});
this.disableAddFolderButton =
match.length > 0 || this.folderDescriptionModel === "" || this.folderDescriptionModel === null;
},
methods: {
useReopenCardInformation,
addFolder() {
//Construct the data to send
const data_to_send = new FormData();
data_to_send.set(
"folder_description",
this.folderDescriptionModel
);
if (this.currentFolder > 0) {
data_to_send.set("parent_folder", this.currentFolder);
}
//Send the data in POST
this.axios
.post(
`${this.rootUrl}documentation/${this.destination}/${this.locationId}/add_folder/`,
data_to_send
)
.then((response) => {
//Update the Folder List in VueX
this.$store.dispatch("appendFolderList", {
folderList: response.data[0],
});
//Clear the model
this.folderDescriptionModel = "";
//Close the modal
document.getElementById("addFolderCloseButton").click();
//Reshow the card information modal if exists
useReopenCardInformation();
})
.catch((error) => {
this.$store.dispatch("newToast", {
header: "Failed to add folder",
message: `Failed to add folder. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
},
};
</script>

View File

@@ -0,0 +1,184 @@
<template>
<div
id="addGroupModal"
class="modal fade"
tabindex="-1"
aria-labelledby="exampleModalLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2>
Add Group Wizard
</h2>
<button
id="addGroupCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<div
v-if="groupFixList.length > 0"
class="row"
>
<div class="col-md-4">
<strong>Add Groups</strong>
<p class="text-instructions">
Use the following multiple select to select
which groups you want to add to this
{{ destination }}.
</p>
<p class="text-instructions">
Please note: A user's group has to be added to
the {{ destination }} before the user can be
added.
</p>
</div>
<div class="col-md-8">
<n-select
v-model:value="groupModel"
:options="groupFixList"
multiple
></n-select>
</div>
</div>
<div
v-else
class="row"
>
<div class="col-md-6">
<strong>Sorry - no results</strong>
<p class="text-instructions">
This could be because
</p>
<ul class="text-instructions">
<li>There are no more groups left to add</li>
</ul>
</div>
<div class="col-md-6 no-search">
<img
:src="`${staticUrl}NearBeach/images/placeholder/questions.svg`"
alt="Sorry - there are no results"
/>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
:disabled="groupModel.length == 0"
@click="addGroup"
>
Add Group(s)
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {NSelect} from "naive-ui";
//VueX
import {mapGetters} from "vuex";
export default {
name: "AddGroupWizard",
components: {
NSelect,
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
potentialGroupList: "getPotentialGroupList",
rootUrl: "getRootUrl",
staticUrl: "getStaticUrl",
}),
},
data() {
return {
groupFixList: [],
groupModel: [],
};
},
watch: {
potentialGroupList(new_value) {
if (new_value === undefined) return;
this.groupFixList = new_value.map(row => {
return {
value: row.group_id,
label: row.group_name,
}
})
}
},
methods: {
addGroup() {
//Tell user we are adding groups
this.$store.commit("updateAddingGroupStatus", {
addingGroupStatus: true,
});
//Send the database the new groups to add
const data_to_send = new FormData();
//Loop through the model and append the results
this.groupModel.forEach((row) => {
data_to_send.append("group_list", row);
});
//user axios
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/add_group/`,
data_to_send
).then((response) => {
//Update VueX with the required data
this.$store.commit("updateGroupsAndUsers", {
objectGroupList: response.data.object_group_list,
objectUserList: response.data.object_user_list,
potentialGroupList: response.data.potential_group_list,
potentialUserList: response.data.potential_user_list,
userGroupList: response.data.user_group_list,
})
//Update the user
this.$store.commit("updateAddingGroupStatus", {
addingGroupStatus: false,
});
//Clear the list
this.groupModel = [];
//Close this modal
document.getElementById("addGroupCloseButton").click();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: `Error adding group to ${this.destination}`,
message: `Sorry, we could not add the group to the ${this.destination}. Error -> ${error}`,
extra_classes: "bd-danger",
delay: 0,
});
});
},
},
};
</script>

View File

@@ -0,0 +1,216 @@
<template>
<div
id="addLinkModal"
class="modal fade"
tabindex="-1"
aria-labelledby="exampleModalLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2>
Add Link Wizard
</h2>
<button
id="addLinkCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<strong>Add Link</strong>
<p class="text-instruction">
Add hyperlinks to other documents and sources
located in on the internet/cloud.
</p>
</div>
<div class="col-md-8">
<div class="form-group">
<label for="document_description">
Document Description
<validation-rendering
:error-list="v$.documentDescriptionModel.$errors"
></validation-rendering>
<span
v-if="duplicateDescription"
class="error"
>
Sorry - but this is a duplicated
description.</span
>
</label>
<input
id="document_description"
v-model="documentDescriptionModel"
class="form-control"
maxlength="50"
placeholder="NearBeach Homepage"
/>
</div>
<div class="form-group">
<label for="document_url_location">
Document URL
<validation-rendering
:error-list="v$.documentUrlLocationModel.$errors"
></validation-rendering>
</label>
<input
id="document_url_location"
v-model="documentUrlLocationModel"
class="form-control"
placeholder="https://nearbeach.org"
/>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
:disabled="disableAddButton"
@click="addLink"
>
Add Link
</button>
</div>
</div>
</div>
</div>
</template>
<script>
//VueX
import {mapGetters} from "vuex";
//Validation
import useVuelidate from "@vuelidate/core";
import {required, url} from "@vuelidate/validators";
import ValidationRendering from "Components/validation/ValidationRendering.vue";
import {useReopenCardInformation} from "Composables/card_information/useReopenCardinformation";
export default {
name: "AddLinkWizard",
components: {
ValidationRendering,
},
props: {
destination: {
type: String,
default: "/",
},
locationId: {
type: Number,
default: 0,
},
},
setup() {
return {v$: useVuelidate()};
},
data() {
return {
linkModel: "",
disableAddButton: true,
documentDescriptionModel: "",
documentUrlLocationModel: "",
duplicateDescription: false,
};
},
validations: {
documentDescriptionModel: {
required,
},
documentUrlLocationModel: {
required,
url,
},
},
computed: {
...mapGetters({
currentFolder: "getCurrentFolder",
excludeDocuments: "getDocumentFilteredList",
rootUrl: "getRootUrl",
}),
},
updated() {
//We need to make sure both fields are not blank & to make sure the description is not duplicated
const match = this.excludeDocuments.filter((row) => {
return (
row.document_key__document_description ===
this.documentDescriptionModel
);
});
//Notify the user of duplicate descriptions (if there is any)
this.duplicateDescription = match.length > 0;
// Check the validation
this.v$.$touch();
//Disable the button (if it does not meet our standards)
this.disableAddButton = this.v$.$invalid || match.length > 0;
},
methods: {
useReopenCardInformation,
addLink() {
const data_to_send = new FormData();
data_to_send.set(
"document_description",
this.documentDescriptionModel
);
data_to_send.set(
"document_url_location",
this.documentUrlLocationModel
);
//Only set the parent folder variable if there exists a variable in current folder
if (this.currentFolder > 0) {
data_to_send.set("parent_folder", this.currentFolder);
}
this.axios.post(
`${this.rootUrl}documentation/${this.destination}/${this.locationId}/add_link/`,
data_to_send
).then((response) => {
//Append something to document List
this.$store.dispatch("appendDocumentList", {
documentList: response.data[0],
});
//Clear the data
this.documentDescriptionModel = "";
this.documentUrlLocationModel = "";
//Close the modal
document.getElementById("addLinkCloseButton").click();
//Reshow the card information modal if exists
useReopenCardInformation();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Adding Link",
message: `Sorry, could not add the link for you. Error - ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
},
};
</script>

View File

@@ -0,0 +1,187 @@
<template>
<div
id="addSprintWizardModal"
class="modal fade"
tabindex="-1"
aria-labelledby="addSprintWizard"
aria-hidden="true"
>
<div class="modal-dialog modal-lg modal-fullscreen-lg-down">
<div class="modal-content">
<div class="modal-header">
<h5 id="addSprintWizard" class="modal-title">Add Object to Sprint</h5>
<button
id="addSprintWizardButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<strong>Sprint Wizard</strong>
<p class="text-instructions">
Please select the appropriate sprint to add this current object too.
</p>
</div>
<div class="col-md-8">
<div class="form-group">
<label>Sprint</label>
<n-select
v-model:value="sprintModel"
:options="sprintOptions"
filterable
placeholder="Please select a sprint from the list"
></n-select>
</div>
<div class="spacer"></div>
<div
v-for="sprint in selectedSprintObject"
:key="sprint.value"
class="row"
>
<div class="col-md-12 mb-4">
<strong>Sprint Name: </strong>{{sprint.label}}<br/>
<strong>Sprint Start Date: </strong>{{useNiceDatetime(sprint.sprint_start_date)}}
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
:disabled="sprintModel === undefined"
type="button"
class="btn btn-primary"
@click="addSprint"
>
Add to Sprint
</button>
</div>
</div>
</div>
</div>
</template>
<script>
//Naive Ui
import { NSelect } from "naive-ui";
//Vuex
import { mapGetters } from "vuex";
//Composables
import {useNiceDatetime} from "Composables/datetime/useNiceDatetime";
export default {
name: "AddSprintWizard",
components: {
NSelect,
},
emits: [
'update_sprint_list',
],
data() {
return {
selectedSprintObject: {},
sprintModel: undefined,
sprintOptions: [],
}
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
})
},
watch: {
sprintModel(new_value) {
this.selectedSprintObject = this.sprintOptions.filter((row) => {
return parseInt(row.value) === parseInt(new_value);
})
},
},
mounted() {
this.$nextTick(() => {
this.getSprintOptions();
});
},
methods: {
useNiceDatetime,
addSprint() {
//Notify the users of the change
this.$store.dispatch("newToast", {
header: "Adding object to sprint",
message: "Adding current object to sprint, please wait.",
extra_classes: "bg-warning text-dark",
delay: 0,
unique_type: "add_sprint_wizard",
});
//Construct data to send
const data_to_send = new FormData();
data_to_send.set("sprint_id", this.sprintModel);
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/add_sprint/${this.sprintModel}/`,
data_to_send,
).then((response) => {
//Send the data upstream
this.$emit("update_sprint_list", response.data);
//Close the modal
document.getElementById("addSprintWizardButton").click();
//Update the user
this.$store.dispatch("newToast", {
header: "Added to Sprint",
message: "Successfully added current object to Sprint",
extra_classes: "bg-success",
unique_type: "add_sprint_wizard",
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error adding current object to sprint",
message: `Error adding the current object to sprint. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
unique_type: "add_sprint_wizard",
});
});
},
getSprintOptions() {
this.axios.post(
`${this.rootUrl}object_data/sprint_list/`,
).then((response) => {
this.sprintOptions = response.data.map((row) => {
return {
"value": row.sprint_id,
"label": row.sprint_name,
"sprint_start_date": row.sprint_start_date,
"sprint_end_date": row.sprint_end_date,
};
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error fetching Potential Sprint List",
message: `Can not retrieve sprint list. ${error}`,
extra_classes: "bg-warning text-dark",
delay: 0,
});
});
},
},
}
</script>

View File

@@ -0,0 +1,202 @@
<template>
<div
id="addTagModal"
class="modal fade"
tabindex="-1"
aria-labelledby="exampleModalLabel"
aria-hidden="true"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2>
Add Tags Wizard
</h2>
<button
id="addTagsCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<strong>Add Tag</strong>
<p class="text-instructions">
Use the dropdown to select one or many lables to
add to the {{ getDestination() }}.
</p>
</div>
<div class="col-md-8">
<label>All Tag List</label>
<n-select
v-model:value="tagModel"
label="tag"
multiple
:options="availableTagList"
></n-select>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
@click="addTag"
>
Add Tag
</button>
</div>
</div>
</div>
</div>
</template>
<script>
//JavaScript extras
import {NSelect} from "naive-ui";
import {Modal} from "bootstrap";
//VueX
import {mapGetters} from "vuex";
export default {
name: "AddTagWizard",
components: {
NSelect,
},
props: {
overrideDestination: {
type: String,
default: "",
},
overrideLocationId: {
type: Number,
default: 0,
},
reopenModal: {
type: String,
default: "",
},
},
data() {
return {
tagModel: [],
};
},
computed: {
...mapGetters({
allTagList: "getAllTagList",
availableTagList: "getAvailableTagList",
assignedTags: "getAssignedTags",
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
}),
},
mounted() {
//If the location is inside the array - don't bother getting the data
const escape_array = ["requirement_item"];
if (escape_array.indexOf(this.getDestination()) >= 0) return;
this.$nextTick(() => {
//Get the tag list
this.getTagList();
});
},
methods: {
addTag() {
if (this.getLocationId() === 0) return;
//Construct data_to_send
const data_to_send = new FormData();
//Loop through all the models results
this.tagModel.forEach((row) => {
data_to_send.append("tag_id", row);
});
//Use Axios to send data to backend
this.axios.post(
`${this.rootUrl}object_data/${this.getDestination()}/${this.getLocationId()}/add_tags/`,
data_to_send
).then((response) => {
//Emit data up
this.$store.commit({
type: "updateAssignedTags",
assignedTags: response.data,
});
//Close the modal
document.getElementById("addTagsCloseButton").click();
//Clear the results
this.tagModel = [];
//If there is anything in reopenModal, we reopen that modal
if (this.reopenModal !== "") {
const modal = new Modal(
document.getElementById(this.reopenModal)
);
modal.show();
}
//Check to see if we have added a tag to a kanban card - if so, update that kanban card
if (this.getDestination() === "kanban_card") {
//Update the kanban card's tags
this.$store.commit({
type: "updateKanbanCard",
card_id: this.getLocationId(),
tag_list: response.data,
});
}
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Failed to add tag",
message: `Sorry, we could not add tag. Errors -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
getDestination() {
return this.overrideDestination !== "" ? this.overrideDestination : this.destination;
},
getLocationId() {
//If there is an overrideDestination - we want to use the overrideLocationId
return this.overrideDestination !== "" ? this.overrideLocationId : this.locationId;
},
getTagList() {
this.axios.post(
`${this.rootUrl}object_data/tag_list_all/`
).then((response) => {
//Map data to the preferred data format for vue-select
this.$store.commit({
type: "updateAllTagList",
allTagList: response.data,
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Failed to get tag list",
message: `Sorry, we could not get the tag list. Errors -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
},
};
</script>

View File

@@ -0,0 +1,193 @@
<template>
<div
id="addUserModal"
class="modal fade"
tabindex="-1"
aria-labelledby="exampleModalLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2>
Add User Wizard
</h2>
<button
id="addUserCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<div
v-if="userFixList.length > 0"
class="row"
>
<div class="col-md-4">
<strong>Add Users</strong>
<p class="text-instructions">
Use the following multiple select to select
which users you want to add to this
{{ destination }}.
</p>
<p class="text-instructions">
Please note: A user's group has to be added to
the {{ destination }} before the user can be
added.
</p>
</div>
<div class="col-md-8">
<n-select
v-model:value="userModel"
:options="userFixList"
multiple
></n-select>
</div>
</div>
<div
v-else
class="row"
>
<div class="col-md-6">
<strong>Sorry - no results</strong>
<p class="text-instructions">
This could be because
</p>
<ul class="text-instructions">
<li>There are no more users left to add</li>
<li>
The user you are after is in a group not
current added to this {{ destination }}
</li>
</ul>
</div>
<div class="col-md-6 no-search">
<img
:src="`${staticURL}NearBeach/images/placeholder/questions.svg`"
alt="Sorry - there are no results"
/>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
:disabled="userModel.length === 0"
@click="addUser"
>
Add User(s)
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {NSelect} from "naive-ui";
//VueX
import {mapGetters} from "vuex";
export default {
name: "AddUserWizard",
components: {
NSelect,
},
data() {
return {
userFixList: [],
userModel: [],
};
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
potentialUserList: "getPotentialUserList",
rootUrl: "getRootUrl",
staticURL: "getStaticUrl",
userLevel: "getUserLevel",
}),
},
watch: {
potentialUserList(new_value) {
if (new_value === undefined) return;
this.userFixList = new_value.map(row => {
return {
value: row.id,
label: `${row.username}: ${row.first_name} ${row.last_name}`,
}
})
}
},
methods: {
addUser() {
//Update user about adding user
this.$store.commit("updateAddingUserStatus", {
addingUserStatus: true
});
//Construct the data_to_send array
const data_to_send = new FormData();
//Look through all of the results in user model and append
this.userModel.forEach((row) => {
data_to_send.append("user_list", row);
});
//User axios to send the data to the backend
this.axios
.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/add_user/`,
data_to_send
)
.then((response) => {
//Close the modal
document.getElementById("addUserCloseButton").click();
//Clear the models
this.userModel = [];
//Update VueX with the required data
this.$store.commit("updateGroupsAndUsers", {
objectGroupList: response.data.object_group_list,
objectUserList: response.data.object_user_list,
potentialGroupList: response.data.potential_group_list,
potentialUserList: response.data.potential_user_list,
userGroupList: response.data.user_group_list,
});
//User has been added - return to false
this.$store.commit("updateAddingUserStatus", {
addingUserStatus: false,
});
})
.catch((error) => {
this.$store.dispatch("newToast", {
header: "Failed to add user",
message: `Failed to add user. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
},
};
</script>

View File

@@ -0,0 +1,128 @@
<template>
<div
id="confirmCustomerRemoveModal"
class="modal fade"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false"
aria-labelledby="confirmCustomerRemove"
aria-hidden="true"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5
id="confirmCustomerRemove"
class="modal-title"
>
Please confirm Customer Removal
</h5>
<!-- TASK INFORMATION -->
<button
id="confirmCustomerRemoveButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
<div class="customer-card--details">
<div class="customer-card--name">
<a
:href="`${rootUrl}customer_information/${customerObject.customer_id}/`"
target="_blank"
rel="noopener noreferrer"
>
{{ customerObject.customer_first_name }}
{{ customerObject.customer_last_name }}
</a>
</div>
<div class="customer-card--email">
{{ customerObject.customer_email }}
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
@click="closeModal"
>
No
</button>
<button
type="button"
class="btn btn-primary"
@click="removeCustomer"
>
Yes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {mapGetters} from "vuex";
export default {
name: "ConfirmCustomerRemoval",
props: {
customerObject: {
type: Object,
default: () => {
return {
customer_id: 0,
customer_email: "",
customer_first_name: "",
customer_last_name: "",
customer_profile_picture: "",
}
}
},
},
emits: ["remove_customer"],
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
})
},
methods: {
closeModal() {
document.getElementById("confirmCustomerRemoveButton").click();
},
removeCustomer() {
//Setup data_to_send
const data_to_send = new FormData();
data_to_send.set("customer_id", this.customerObject.customer_id);
//Depending on the destination, depends on the URL
let url = `${this.rootUrl}object_data/${this.destination}/${this.locationId}/remove_customer/`
if (this.destination === "organisation") {
url = `${this.rootUrl}customer_information/${this.locationId}/delete/`
}
this.axios.post(
url,
data_to_send,
).then(() => {
//Filter out the delete customer
this.$emit("remove_customer", this.customerObject.customer_id);
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Can't remove customer",
message: `Sorry, could not remove customer. Error -> ${error}`,
extra_classes: "bg-warning text-dark",
delay: 0,
});
});
this.closeModal();
},
},
}
</script>

View File

@@ -0,0 +1,126 @@
<template>
<div
id="confirmDeleteObjectModal"
class="modal fade"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false"
aria-labelledby="confirmDeleteObject"
aria-hidden="true"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5
id="confirmDeleteObject"
class="modal-title"
>
Please confirm {{destination}} deletion
</h5>
<!-- TASK INFORMATION -->
<button
id="confirmDeleteObjectButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
Can you please confirm the title of the {{ destination }} you are deleting.
<br/>
<div class="mt-2">
<strong>Title: </strong>{{ title }}
</div>
<div class="form-group mt-2">
<label>Confirm Title: </label>
<input
v-model="confirmTitle"
type="text"
class="form-control"
onpaste="return false"
ondrop="return false"
autocomplete="off"
/>
</div>
</div>
<div class="modal-footer justify-content-between">
<button
type="button"
class="btn btn-primary btn-sm"
@click="closeModal"
>
No - Keep {{ destination }}
</button>
<button
type="button"
class="btn btn-danger btn-sm"
:disabled="isButtonDisabled"
@click="deleteObject"
>
Yes - Delete {{ destination }}
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import { mapGetters } from "vuex";
export default {
name: "ConfirmDeleteObject",
data() {
return {
confirmTitle: "",
isButtonDisabled: true,
}
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
title: "getTitle",
}),
},
watch: {
confirmTitle() {
this.isButtonDisabled = this.confirmTitle.toLowerCase() !== this.title.toLowerCase();
}
},
methods: {
closeModal() {
//Clear content
this.confirmTitle = "";
//Close
document.getElementById("confirmDeleteObjectButton").click();
},
deleteObject() {
this.$store.dispatch("newToast", {
header: "Deleting Object",
message: "Deleting Object, please wait",
extra_classes: "bg-warning",
delay: 0,
unique_type: "delete_object",
});
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/delete/`,
).then(() => {
window.location.href = this.rootUrl;
}).catch(error => {
this.$store.dispatch("newToast", {
header: "Error deleting Object",
message: `Could not delete the ${this.destination}. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
unique_type: "delete_object",
});
});
},
}
}
</script>

View File

@@ -0,0 +1,121 @@
<template>
<div
id="confirmFileDeleteModal"
class="modal fade"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false"
aria-labelledby="confirmFileDelete"
aria-hidden="true"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5
id="confirmFileDelete"
class="modal-title"
>
Please confirm File Deletion
</h5>
<!-- TASK INFORMATION -->
<button
id="confirmFileDeleteButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
Are you sure you want to delete the file?
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
@click="closeModal"
>
No
</button>
<button
type="button"
class="btn btn-primary"
@click="deleteFile"
>
Yes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {mapGetters} from "vuex";
import {useReopenCardInformation} from "Composables/card_information/useReopenCardinformation";
export default {
name: "ConfirmFileDelete",
computed: {
...mapGetters({
destination: "getDestination",
documentRemoveKey: "getDocumentRemoveKey",
locationId: "getLocationId",
rootUrl: "getRootUrl",
})
},
methods: {
useReopenCardInformation,
deleteFile() {
//Check to make sure it isn't blank
if (this.documentRemoveKey === "") {
//We don't want to remove a blank file
return;
}
//Axios is a promise. It is not guaranteed that the documentRemoveKey will not be blanked out by the time
//it has finished it's web query. Hence we cache this here. :)
const cached_document_remove_key = this.documentRemoveKey;
//Create data_to_send
const data_to_send = new FormData();
data_to_send.set("document_key", this.documentRemoveKey);
this.axios.post(
`${this.rootUrl}documentation/${this.destination}/${this.locationId}/remove/`,
data_to_send,
).then(() => {
//Update VueX - remove that document from the list
this.$store.dispatch("removeDocument", {
document_key: cached_document_remove_key,
});
//Close the modal
this.closeModal();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error removing file",
message: `We could not remove your file. Error - ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
this.closeModal();
},
closeModal() {
//Zero out the document key (just in case)
this.$store.commit({
type: "updateDocumentRemoveKey",
documentRemoveKey: "",
});
//Close the modal
document.getElementById("confirmFileDeleteButton").click();
//Reshow the card information modal if exists
useReopenCardInformation();
}
},
}
</script>

View File

@@ -0,0 +1,121 @@
<template>
<div
id="confirmFolderDeleteModal"
class="modal fade"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false"
aria-labelledby="confirmFolderDelete"
aria-hidden="true"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5
id="confirmFolderDelete"
class="modal-title"
>
Please confirm Folder Deletion
</h5>
<!-- TASK INFORMATION -->
<button
id="confirmFolderDeleteButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
Are you sure you want to delete the folder? All files under this folder will be deleted also.
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
@click="closeModal"
>
No
</button>
<button
type="button"
class="btn btn-primary"
@click="deleteFolder"
>
Yes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {mapGetters} from "vuex";
import {useReopenCardInformation} from "Composables/card_information/useReopenCardinformation";
export default {
name: "ConfirmFolderDelete",
computed: {
...mapGetters({
destination: "getDestination",
folderRemoveId: "getFolderRemoveId",
locationId: "getLocationId",
rootUrl: "getRootUrl",
})
},
methods: {
useReopenCardInformation,
deleteFolder() {
//Check to make sure it isn't blank
if (this.folderRemoveId === "") {
//We don't want to remove a blank file
return;
}
//Axios is a promise. It is not guaranteed that the folderRemoveId will not be blanked out by the time
//it has finished it's web query. Hence we cache this here. :)
const cached_folder_remove_id = this.folderRemoveId;
//Create data_to_send
const data_to_send = new FormData();
data_to_send.set("folder_id", this.folderRemoveId);
this.axios.post(
`${this.rootUrl}documentation/${this.destination}/${this.locationId}/remove_folder/`,
data_to_send,
).then(() => {
//Update VueX - remove that document from the list
this.$store.dispatch("removeFolder", {
folder_id: cached_folder_remove_id,
});
//Close the modal
this.closeModal();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error removing folder",
message: `We could not remove your folder. Error - ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
this.closeModal();
},
closeModal() {
//Zero out the document key (just in case)
this.$store.commit({
type: "updateFolderRemoveId",
documentRemoveKey: "",
});
//Close the modal
document.getElementById("confirmFolderDeleteButton").click();
//Reshow the card information modal if exists
useReopenCardInformation();
}
},
}
</script>

View File

@@ -0,0 +1,134 @@
<template>
<div
id="confirmGroupDeleteModal"
class="modal fade"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false"
aria-labelledby="confirmGroupDelete"
aria-hidden="true"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5
id="confirmGroupDelete"
class="modal-title"
>
Please confirm Group Deletion
</h5>
<!-- TASK INFORMATION -->
<button
id="confirmGroupDeleteButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
Are you sure you want to delete the Group from the object?
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
@click="closeModal"
>
No
</button>
<button
type="button"
class="btn btn-primary"
@click="deleteGroup"
>
Yes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {mapGetters} from "vuex";
export default {
name: "ConfirmGroupDelete",
props: {
groupId: {
type: Number,
default: 0,
},
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
objectGroupList: "getObjectGroupList",
rootUrl: "getRootUrl",
})
},
methods: {
deleteGroup() {
//Optimistic Update - we assume everything is going to be ok
//Remove the group from the list
this.$store.commit("updateGroupsAndUsers", {
objectGroupList: this.objectGroupList.filter(row => {
return row.group_id !== this.groupId;
}),
});
//Setup data to send
const data_to_send = new FormData();
data_to_send.set("group_id", `${this.groupId}`);
//Tell the backend to remove this group
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/remove_group/`,
data_to_send
).then((response) => {
//Update VueX with the required data
this.$store.commit("updateGroupsAndUsers", {
objectGroupList: response.data.object_group_list,
objectUserList: response.data.object_user_list,
potentialGroupList: response.data.potential_group_list,
potentialUserList: response.data.potential_user_list,
userGroupList: response.data.user_group_list,
});
if (this.hasUserAccessBeenRemoved(
response.data.object_group_list,
response.data.user_group_list
)) {
//Access has been removed. User removed their last group from object
document.location.reload();
}
})
.catch((error) => {
this.$store.dispatch("newToast", {
header: "Error removing group from object",
message: `We encounted an error moving the group from the object. Error -> ${error}`,
extra_classes: 'bg-danger',
delay: 0,
});
});
//Close the modal
this.closeModal();
},
closeModal() {
document.getElementById("confirmGroupDeleteButton").click();
},
hasUserAccessBeenRemoved(objectGroupList, userGroupList) {
//Make sure there is some overlap between objectGroupList and userGroupList. If there is no overlap
//it means the user has removed all their groups.
const count = objectGroupList.filter((row) => {
return userGroupList.some(level => row.group_id === level.group_id);
}).length;
return count === 0;
}
},
}
</script>

View File

@@ -0,0 +1,138 @@
<template>
<div
id="confirmLinkDeleteModal"
class="modal fade"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false"
aria-labelledby="confirmLinkDelete"
aria-hidden="true"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5
id="confirmLinkDelete"
class="modal-title"
>
Please confirm Link Deletion
</h5>
<!-- TASK INFORMATION -->
<button
id="confirmLinkDeleteButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
<div class="row">
<p>Are you sure you want to delete the link?</p>
</div>
<div class="row">
<p>
<strong>{{formatId(objectLink.object_type, objectLink.object_id)}}</strong><br/>
<strong>Title: </strong>{{objectLink.object_title}}
</p>
</div>
<div
v-if="objectLink.link_relationship.toLowerCase() === 'block'"
class="row mt-2"
>
<p class="mb-0">
Alternatively, for any Blocked links we can migrate them to the "Related" status.
</p>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary me-auto"
@click="closeModal"
>
Cancel
</button>
<button
v-if="objectLink.link_relationship.toLowerCase() === 'block' && showMigrateButton"
type="button"
class="btn btn-info"
@click="processLink('migrate')"
>Migrate Link</button>
<button
type="button"
class="btn btn-primary"
@click="processLink('remove')"
>
Delete Link
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {mapGetters} from "vuex";
export default {
name: "ConfirmLinkDelete",
props: {
showMigrateButton: {
type: Boolean,
default: true,
},
},
emits: [
'update_link_results',
],
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
objectLink: "getObjectLink",
rootUrl: "getRootUrl",
})
},
methods: {
closeModal() {
document.getElementById("confirmLinkDeleteButton").click();
},
formatId(object_type, object_id) {
switch (object_type) {
case "project":
return `Pro${object_id}`;
case "requirement":
return `Req${object_id}`;
case "requirement_item":
return `Item${object_id}`;
case "task":
return `Task${object_id}`;
default:
return `${object_type.slice(0,3)}${object_id}`;
}
},
processLink(process) {
//Create data_to_send
const data_to_send = new FormData();
data_to_send.set("link_id", this.objectLink.object_id);
data_to_send.set(
"link_connection",
this.objectLink.object_type === this.destination ? "meta_object" : this.objectLink.object_type
);
//Send the data to the backend
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/${process}_link/`,
data_to_send
).then(() => {
//Update the data
this.$emit("update_link_results", {});
});
//Close the modal
this.closeModal();
},
},
}
</script>

View File

@@ -0,0 +1,123 @@
<template>
<div
id="confirmNoteDeleteModal"
class="modal fade"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false"
aria-labelledby="confirmLinkDelete"
aria-hidden="true"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5
id="confirmNoteDelete"
class="modal-title"
>
Please confirm Note Deletion
</h5>
<button
id="confirmNoteDeleteButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
Are you sure you want to delete the note?
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
@click="closeModal"
>
No
</button>
<button
type="button"
class="btn btn-primary"
@click="deleteNote"
>
Yes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {mapGetters} from "vuex";
import {useReopenCardInformation} from "Composables/card_information/useReopenCardinformation";
export default {
name: "ConfirmNoteDelete",
props: {},
computed: {
...mapGetters({
destination: "getDestination",
noteId: "getSingleNoteId",
rootUrl: "getRootUrl",
}),
},
methods: {
useReopenCardInformation,
deleteNote() {
//Tell the user we are deleting the note
this.$store.dispatch("newToast", {
header: "Deleting Note",
message: "Currently deleting note",
extra_classes: "bg-warning text-dark",
delay: 0,
unique_type: "delete_note",
});
//If destination is an organisation, we have a slightly different URL due to permissions.
let url = `${this.rootUrl}note/delete/${this.noteId}/`;
if (this.destination === "organisation") {
url = `${this.rootUrl}note/organisation/delete/${this.noteId}/`;
}
//Send the data
this.axios.post(
url,
).then(() => {
this.$store.dispatch("newToast", {
header: "Note is deleted",
message: "Successfully Deleted Note",
extra_classes: "bg-success",
unique_type: "delete_note",
});
this.$store.commit({
type: "removeNote",
noteId: this.noteId,
});
//Close the modal
this.closeModal();
//Reshow the card information modal if exists
useReopenCardInformation();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Failed to Delete Note",
message: `Sorry, we failed to delete the note. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
unique_type: "delete_note",
});
})
},
closeModal() {
document.getElementById("confirmNoteDeleteButton").click();
//Open the card information modal, if it exists
useReopenCardInformation();
},
},
}
</script>

View File

@@ -0,0 +1,166 @@
<template>
<div
id="confirmObjectRemoveModal"
class="modal fade"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false"
aria-labelledby="confirmObjectRemove"
aria-hidden="true"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5
id="confirmObjectRemove"
class="modal-title"
>
Please confirm object removal.
</h5>
<button
id="confirmObjectRemoveButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
Please confirm you would like to remove this object from the sprint.
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
@click="closeModal"
>
No
</button>
<button
type="button"
class="btn btn-primary"
@click="removeObject"
>
Yes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import { mapGetters } from "vuex";
export default {
name: "ConfirmObjectRemove",
props: {},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
objectId: "getConfirmDeleteObjectId",
objectType: "getConfirmDeleteObjectType",
parentObjectId: "getConfirmDeleteParentObjectId",
parentObjectType: "getConfirmDeleteParentObjectType",
rootUrl: "getRootUrl",
}),
},
methods: {
closeModal() {
document.getElementById("confirmObjectRemoveButton").click();
},
removeObject() {
/*
If there is more than one instance of an object in this sprint, i.e. they are a child component of multiple
objects, we would only want to remove the Object Association. As the user is defining they don't want that
object as a child object.
If there is only one instance of an object, we just remove the object from the sprint.
*/
this.$store.dispatch("newToast", {
header: "Removing Object from Sprint",
message: "Please wait whilst we remove the object",
extra_classes: "bg-warning text-dark",
delay: 0,
unique_type: "remove_object",
});
const object_list = this.$store.getters.getGanttChartDataByObject(this.objectId, this.objectType);
if (object_list.length > 1) {
this.removeObjectAssociation();
return;
}
this.removeObjectFromSprint();
},
removeObjectAssociation() {
const data_to_remove = new FormData();
data_to_remove.set("link_id", this.objectId);
data_to_remove.set("link_connection", this.objectType);
this.axios.post(
`${this.rootUrl}object_data/${this.parentObjectType}/${this.parentObjectId}/remove_link/`,
data_to_remove,
).then(() => {
this.$store.dispatch("removeGanttChartSingleRow", {
objectType: this.objectType,
objectId: this.objectId,
parentObjectId: this.parentObjectId,
parentObjectType: this.parentObjectType,
});
//Notify the user
this.$store.dispatch("newToast", {
header: "Removing Object from Sprint",
message: "Object has been removed",
extra_classes: "bg-success text-dark",
unique_type: "remove_object",
});
}).catch(error => {
this.$store.dispatch("newToast", {
header: "Failed Updating Sprint",
message: `Sorry, moving the object failed. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
this.closeModal();
},
removeObjectFromSprint() {
this.axios.delete(
`${this.rootUrl}api/v0/sprint/${this.locationId}/link/${this.objectId}/`,
).then(() => {
//Delete that particular data
this.$store.dispatch("removeGanttChartSingleRow", {
objectType: this.objectType,
objectId: this.objectId,
parentObjectId: this.parentObjectId,
parentObjectType: this.parentObjectType,
});
//Notify the user
this.$store.dispatch("newToast", {
header: "Removing Object from Sprint",
message: "Object has been removed",
extra_classes: "bg-success text-dark",
unique_type: "remove_object",
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Failed to remove object",
message: `Failed to remove the object from the sprint. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
unique_type: "remove_object",
});
});
this.closeModal();
},
},
}
</script>

View File

@@ -0,0 +1,149 @@
<template>
<div
id="confirmPublicLinkDeleteModal"
class="modal fade"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false"
aria-labelledby="confirmPublicLinkDelete"
aria-hidden="true"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5
id="confirmPublicLinkDelete"
class="modal-title"
>
Please confirm Private Link Deletion
</h5>
<!-- TASK INFORMATION -->
<button
id="confirmPublicLinkDeleteButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
Are you sure you want to delete the private link?
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
@click="closeModal"
>
No
</button>
<button
type="button"
class="btn btn-primary"
@click="deletePrivateLink"
>
Yes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
//VueX
import {mapGetters} from "vuex";
//Composers
import {useReopenCardInformation} from "Composables/card_information/useReopenCardinformation";
export default {
name: "ConfirmPublicLinkDelete",
props: {
overrideDestination: {
type: String,
default: "",
},
overrideLocationId: {
type: Number,
default: 0,
},
},
emits: [
'update_link_results',
],
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
publicLinkRemoveKey: "getPublicLinkRemoveKey",
rootUrl: "getRootUrl",
})
},
methods: {
useReopenCardInformation,
deletePrivateLink() {
//Construct data to send
const data_to_send = new FormData();
data_to_send.set("public_link_id", this.publicLinkRemoveKey);
//Notify user we are deleting the data
this.$store.dispatch("newToast", {
header: "Deleting Public Link",
message: "Deleting Public Link",
extra_classes: "bg-warning text-dark",
delay: 0,
unique_type: "public_link_delete",
});
//Use axios
this.axios.post(
`${this.rootUrl}public_data/${this.getDestination()}/${this.getLocationId()}/delete/`,
data_to_send,
).then(() => {
//Remove the row
this.$store.dispatch("removePublicLink", {
public_link_id: this.publicLinkRemoveKey,
});
this.$store.dispatch("newToast", {
header: "Successfully Deleted Public Link",
message: "Successfully Deleted Public Link",
extra_classes: "bg-success",
unique_type: "public_link_delete",
});
this.closeModal();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Deleting Public Link",
message: `Error - could not delete link. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
unique_type: "public_link_delete",
});
});
},
closeModal() {
//Zero out the public key (just in case)
this.$store.commit({
type: "updatePublicLinkRemoveKey",
publicLinkRemoveKey: "",
});
//Close the modal
document.getElementById("confirmPublicLinkDeleteButton").click();
//Reshow the card information modal if exists
useReopenCardInformation();
},
getDestination() {
return this.overrideDestination !== "" ? this.overrideDestination : this.destination;
},
getLocationId() {
//If there is an overrideDestination - we want to use the overrideLocationId
return this.overrideDestination !== "" ? this.overrideLocationId : this.locationId;
},
},
}
</script>

View File

@@ -0,0 +1,111 @@
<template>
<div
id="confirmSprintRemoveModal"
class="modal fade"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false"
aria-labelledby="confirmSprintRemoveLabel"
aria-hidden="true"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5
id="confirmSprintRemoveLabel"
class="modal-title"
>
Please confirm the sprint removal
</h5>
<!-- TASK INFORMATION -->
<button
id="confirmSprintRemovalButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
Are you sure you want to remove the sprint from the current object.
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
@click="closeModal"
>
No
</button>
<button
type="button"
class="btn btn-primary"
@click="removeSprint"
>
Yes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {mapGetters} from "vuex";
export default {
name: "ConfirmRemoveSprint",
props: {
confirmRemoveSprint: {
type: Object,
default: () => {
return {
sprint_name: "",
sprint_id: 0,
};
},
},
},
emits: ['update_sprint_list'],
computed: {
...mapGetters({
destination: "getDestination",
documentRemoveKey: "getDocumentRemoveKey",
locationId: "getLocationId",
rootUrl: "getRootUrl",
})
},
methods: {
removeSprint() {
const sprint_id = this.confirmRemoveSprint.sprint_id;
//Setup Data to Send
const data_to_send = new FormData();
data_to_send.set("sprint_id", sprint_id);
//Axios
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/remove_sprint/${sprint_id}/`,
data_to_send,
).then((response) => {
//Send the updated data upstream
this.$emit("update_sprint_list", response.data);
//Close the modal
document.getElementById("confirmSprintRemovalButton").click();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Removing Sprint",
message: `Sorry, we could not remove the sprint from the current object. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
closeModal() {
document.getElementById("confirmSprintRemovalButton").click();
}
},
}
</script>

View File

@@ -0,0 +1,116 @@
<template>
<div
id="confirmUserDeleteModal"
class="modal fade"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false"
aria-labelledby="confirmUserDelete"
aria-hidden="true"
>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5
id="confirmUserDelete"
class="modal-title"
>
Please confirm User Deletion
</h5>
<!-- TASK INFORMATION -->
<button
id="confirmUserDeleteButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
Are you sure you want to delete the User from the object?
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
@click="closeModal"
>
No
</button>
<button
type="button"
class="btn btn-primary"
@click="deleteUser"
>
Yes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {mapGetters} from "vuex";
export default {
name: "ConfirmUserDelete",
props: {
username: {
type: String,
default: "",
},
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
objectUserList: "getObjectUserList",
rootUrl: "getRootUrl",
})
},
methods: {
deleteUser() {
//Optimistic Update - we assume everything is going to be ok
//Remove the user from the list
this.$store.commit("updateGroupsAndUsers", {
objectUserList: this.objectUserList.filter(row => {
return row.username !== this.username;
}),
});
//Setup data to send
const data_to_send = new FormData();
data_to_send.set("username", this.username);
//Tell the backend we no longer want this user attached
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/remove_user/`,
data_to_send
).then(response => {
//Update VueX with the required data
this.$store.commit("updateGroupsAndUsers", {
objectGroupList: response.data.object_group_list,
objectUserList: response.data.object_user_list,
potentialGroupList: response.data.potential_group_list,
potentialUserList: response.data.potential_user_list,
userGroupList: response.data.user_group_list,
})
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error removing user from object",
message: `We encounted an error moving the user from the object. Error -> ${error}`,
extra_classes: 'bg-danger',
delay: 0,
});
});
//Close the modal
this.closeModal();
},
closeModal() {
document.getElementById("confirmUserDeleteButton").click();
}
},
}
</script>

View File

@@ -0,0 +1,175 @@
<template>
<!-- EDIT HISTORY NOTE -->
<div
id="editNoteModal"
class="modal fade"
tabindex="-1"
role="dialog"
aria-labelledby="exampleModalLabel"
aria-hidden="true"
>
<div
class="modal-dialog modal-lg modal-fullscreen-lg-down"
role="document"
>
<div class="modal-content">
<div class="modal-header">
<h2>
Edit Note
</h2>
<button
id="editNoteCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<p class="text-instructions">
Use the text editor to edit your note. Click on the "Update" button
to submit the changes.
</p>
<editor
v-model="noteModel"
license-key="gpl"
:init="{
license_key: 'gpl',
height: 300,
menubar: false,
plugins: ['lists', 'codesample', 'table'],
toolbar: 'undo redo | blocks | bold italic strikethrough underline backcolor | alignleft aligncenter ' +
'alignright alignjustify | bullist numlist outdent indent | removeformat | table image codesample',
skin: `${skin}`,
content_css: `${contentCss}`,
relative_urls: false,
}"
/>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-primary"
:disabled="noteModel == ''"
@click="updateNote"
>
Update Note
</button>
<button
type="button"
class="btn btn-secondary"
@click="closeModal"
>
Close
</button>
</div>
</div>
</div>
</div>
</template>
<script>
//JavaScript components
import Editor from "@tinymce/tinymce-vue";
//VueX
import {mapGetters} from "vuex";
import {useReopenCardInformation} from "Composables/card_information/useReopenCardinformation";
export default {
name: "EditHistoryNoteWizard",
components: {
editor: Editor,
},
data() {
return {
noteModel: "",
};
},
computed: {
...mapGetters({
description: "getSingleNoteDescription",
destination: "getDestination",
contentCss: "getContentCss",
noteDescription: "getSingleNoteDescription",
noteId: "getSingleNoteId",
rootUrl: "getRootUrl",
skin: "getSkin",
}),
},
watch: {
noteDescription() {
//Update local noteModel
this.noteModel = this.noteDescription;
},
},
methods: {
useReopenCardInformation,
closeModal() {
//Close the current modal
document.getElementById("editNoteCloseButton").click();
//Open the card information modal, if it exists
useReopenCardInformation();
},
updateNote() {
//Setup data to send
const data_to_send = new FormData();
data_to_send.set("object_note_id", `${this.noteId}`);
data_to_send.set("object_note", this.noteModel);
this.$store.dispatch("newToast", {
header: "Updating Note",
message: "Please wait - updating your note",
extra_classes: "bg-warning text-dark",
delay: 0,
unique_type: "save_note",
});
//If the destination is organisation, we have a different url due to permissions
let url = `${this.rootUrl}note/update/${this.noteId}/`;
if (this.destination === "organisation") {
url = `${this.rootUrl}note/organisation/update/${this.noteId}/`;
}
this.axios.post(
url,
data_to_send
).then(() => {
this.$store.dispatch("newToast", {
header: "Updated Note",
message: "The note updated successfully.",
extra_classes: "bg-success",
unique_type: "save_note",
});
//Update the vueX
this.$store.dispatch({
type: "editSingleNote",
noteId: this.noteId,
noteDescription: this.noteModel,
});
//Close the modal
document.getElementById("editNoteCloseButton").click();
//Reshow the card information modal if exists
useReopenCardInformation();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Failed Updating Note",
message: `Failed to update note - Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
unique_type: "save_note",
});
});
}
},
};
</script>

View File

@@ -0,0 +1,240 @@
<template>
<div
id="newChangeTaskLinkModal"
class="modal fade"
tabindex="-1"
aria-labelledby="linkModal"
aria-hidden="true"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2>
New Change Task Link Wizard
</h2>
<button
id="linkCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<!-- CHOOSE RELATIONSHIP TYPE -->
<div class="row">
<div class="col-md-4">
<strong>Relationship</strong>
<p class="text-instructions">
Please indicate if you are blocking future Changes Tasks, or if a
past Change Task is blocking current Change Task.
</p>
</div>
<div class="col-md-8">
<label for="change-task-relation">Current change task</label>
<n-select
id="change-task-relation"
v-model:value="changeTaskRelationModel"
:options="changeTaskRelation"
class="object-selection"
></n-select>
</div>
</div>
<hr/>
<!-- SELECTING WHICH OBJECTS TO LINK TO -->
<div class="row">
<div class="col-md-4">
<strong>Select Links</strong>
<p class="text-instructions">
Please select which of the change tasks you want to
connect to this change task.
</p>
</div>
<div class="col-md-8">
<div
v-if="filteredChangeTaskResults.length === 0"
class="alert alert-warning"
>
Sorry - there are no results.
</div>
<div
v-for="changeTask in filteredChangeTaskResults"
:key="changeTask.pk"
:class="checkSelected(changeTask.pk)"
>
<div class="form-check">
<input
:id="`checkbox_change_task_${changeTask.pk}`"
v-model="linkModel"
class="form-check-input"
type="checkbox"
:value="changeTask.pk"
/>
<label
class="form-check-label"
:for="`checkbox_change_task_${changeTask.pk}`"
>
Change Task {{ changeTask.pk }} - {{ changeTask.fields.change_task_title }}
</label>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
:disabled="linkModel.length == 0"
@click="saveLinks"
>
Save changes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {NSelect} from "naive-ui";
//VueX
import {mapGetters} from "vuex";
export default {
name: "NewChangeTaskLinkWizard",
components: {
NSelect,
},
emits: [
'update_link_results',
],
data() {
return {
changeTaskRelation: [
{value: "blocked_by", label: "Is Blocked By"},
{value: "blocking", label: "Is Currently Blocking"},
],
changeTaskRelationModel: "blocking",
changeTaskResults: [],
filteredChangeTaskResults: [],
linkModel: [],
}
},
computed: {
...mapGetters({
destination: "getDestination",
endDate: "getChangeTaskEndDate",
locationId: "getLocationId",
rootUrl: "getRootUrl",
startDate: "getChangeTaskStartDate",
staticUrl: "getStaticUrl",
}),
},
watch: {
changeTaskRelationModel() {
if (this.changeTaskRelationModel === "blocking") {
this.filterBlocking();
} else {
this.filterBlockedBy();
}
},
},
mounted() {
//Get the required data
//Have to wait a little extra - tick does not work :'(
setTimeout(() => {
this.getAllChangeTasks();
}, 500);
},
methods: {
checkSelected(pk) {
if (this.linkModel.includes(pk)) {
return "row change-task--detail change-task--selected";
}
return "row change-task--detail";
},
filterBlockedBy() {
//Filter out all dates where the change task end date <= start_date of current change task
this.filteredChangeTaskResults = this.changeTaskResults.filter(row => {
const end_date = new Date(row.fields.change_task_end_date);
return end_date.getTime() <= this.startDate.getTime();
})
},
filterBlocking() {
//Filter out all dates where the change task start date >= end_date of the current change task
this.filteredChangeTaskResults = this.changeTaskResults.filter(row => {
const start_date = new Date(row.fields.change_task_start_date);
return start_date.getTime() >= this.endDate.getTime();
})
},
getAllChangeTasks() {
//Use Axios to get data
this.axios.post(
`${this.rootUrl}change_task_information/${this.locationId}/get_change_task_list/`
).then(response => {
this.changeTaskResults = response.data;
//Get filtered data
this.filterBlocking();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error getting all change tasks",
message: `There is an issue getting all change tasks - error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
})
},
saveLinks() {
// Set up the data object to send
const data_to_send = new FormData();
// Go through all link models to add to data_to_send
this.linkModel.forEach((link) => {
data_to_send.append(
"change_task",
link
);
});
//Tells the backend the relationship we want
data_to_send.set("object_relation", this.changeTaskRelationModel);
// Use axios to send data
this.axios.post(
`${this.rootUrl}object_data/change_task/${this.locationId}/add_link/`,
data_to_send
).then(() => {
//Data has been successfully saved. Time to update the requirement links
this.$emit("update_link_results", {});
//Click on the close button - a hack, but it should close the modal
document.getElementById("linkCloseButton").click();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error getting all change tasks",
message: `There is an issue getting all change tasks - error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
}
}
}
</script>

View File

@@ -0,0 +1,169 @@
<template>
<!-- NEW HISTORY NOTE -->
<div
id="newNoteModal"
class="modal fade"
tabindex="-1"
role="dialog"
aria-labelledby="exampleModalLabel"
aria-hidden="true"
>
<div
class="modal-dialog modal-lg modal-fullscreen-lg-down"
role="document"
>
<div class="modal-content">
<div class="modal-header">
<h2>
New Note
</h2>
<button
id="newNoteCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<p class="text-instructions">
Use the text editor to type out your note. Click on the
submit button to submit the note.
</p>
<editor
v-model="newNoteModel"
license-key="gpl"
:init="{
license_key: 'gpl',
height: 300,
menubar: false,
plugins: ['lists', 'codesample', 'table'],
toolbar: 'undo redo | blocks | bold italic strikethrough underline backcolor | alignleft aligncenter ' +
'alignright alignjustify | bullist numlist outdent indent | removeformat | table image codesample',
skin: `${skin}`,
content_css: `${contentCss}`,
relative_urls: false,
}"
/>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-primary"
:disabled="newNoteModel == ''"
@click="submitNote"
>
Submit Note
</button>
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
</div>
</div>
</div>
</div>
</template>
<script>
//JavaScript components
import Editor from "@tinymce/tinymce-vue";
//VueX
import {mapGetters} from "vuex";
export default {
name: "NewHistoryNoteWizard",
components: {
editor: Editor,
},
props: {
destination: {
type: String,
default: "",
},
locationId: {
type: Number,
default: 0,
},
},
data() {
return {
newNoteModel: "",
};
},
computed: {
...mapGetters({
contentCss: "getContentCss",
rootUrl: "getRootUrl",
skin: "getSkin",
}),
},
methods: {
submitNote() {
//Notify user of submitting note
this.$store.dispatch("newToast", {
header: "Submitting new note",
message: "Please wait. Submitting new note",
extra_classes: "bg-warning text-dark",
delay: 0,
unique_type: "submit_note",
});
//Construct the form data to send
const data_to_send = new FormData();
data_to_send.set("destination", this.destination);
data_to_send.set("location_id", `${this.locationId}`);
data_to_send.set("note", this.newNoteModel);
//If the destination is organisation, we have a different url due to permissions
let add_notes = "add_notes";
if (this.destination === "organisation") {
add_notes = "organisation_add_notes";
}
//Add the data to data_to_send
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/${add_notes}/`,
data_to_send
).then((response) => {
//Notify user of success
this.$store.dispatch("newToast", {
header: "New Note Submitted",
message: "The new note submitted successfully.",
extra_classes: "bg-success",
unique_type: "submit_note",
});
//Use VueX to add the note to the note list
this.$store.commit({
type: "addNote",
newNote: response.data[0],
});
//Clear the notes
this.newNoteModel = "";
//Close the modal
document.getElementById("newNoteCloseButton").click();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Submitting Note",
message: `Sorry, the note did not submit. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
unique_type: "submit_note",
});
});
},
},
};
</script>

View File

@@ -0,0 +1,355 @@
<template>
<div
id="addKanbanCardModal"
class="modal fade"
data-bs-backdrop="static"
data-bs-keyboard="false"
tabindex="-1"
aria-labelledby="addKanbanCardModalLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-xl modal-fullscreen-xl-down">
<div class="modal-content">
<div class="modal-header">
<h2>
Add Kanban Card Wizard
</h2>
<button
id="addKanbanCardCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<strong>Please note</strong>
<p class="text-instructions">
The card names can not be the same as something
that already exists on the board.
</p>
</div>
<div class="col-md-8">
<label>
Kanban Card Text
<span
v-if="disableAddButton"
class="error"
>
Please supply a unique card name
</span>
</label>
<input
id="kanbanCardText"
v-model="kanbanCardTextModel"
class="form-control"
@keydown.enter="addKanbanCard"
/>
</div>
</div>
<hr />
<!-- CARD PRIORITY -->
<div class="row">
<div class="col-md-4">
<strong>Card Priority</strong>
<p class="text-instructions">
Please select the apprioriate card priority.
</p>
</div>
<div class="col-md-8">
<label>Card Priority</label>
<n-select
v-model:value="kanbanCardPriorityModal"
:options="listPriority"
></n-select>
</div>
</div>
<hr />
<!-- CARD DESCRIPTION -->
<div class="row">
<div class="col-md-4">
<strong>Card Description</strong>
<p class="text-instructions">
Fill out a detailed description for the card,
then click on the "Update Card" button to update
the card.
</p>
</div>
<div class="col-md-8">
<editor
v-model="kanbanCardDescriptionModel"
license-key="gpl"
:init="{
license_key: 'gpl',
file_picker_types: 'image',
height: 300,
images_upload_handler: useUploadImage,
menubar: false,
paste_data_images: true,
plugins: ['lists', 'image', 'codesample', 'table'],
toolbar: 'undo redo | blocks | bold italic strikethrough underline backcolor | alignleft aligncenter ' +
'alignright alignjustify | bullist numlist outdent indent | removeformat | table image codesample',
skin: `${skin}`,
content_css: `${contentCss}`,
relative_urls: false,
}"
/>
</div>
</div>
<!-- CARD LOCATION -->
<hr
v-if="newCardLocation.userCanSelectLocation"
/>
<div
v-if="newCardLocation.userCanSelectLocation"
class="row"
>
<div class="col-md-4">
<strong>Card Location</strong>
<p class="text-instructions">
Select the appropriate location for this card.
</p>
</div>
<div class="col-md-8">
<div class="row">
<div class="col-md-6 mt-4">
<label>Card Column</label>
<n-select
v-model:value="localColumnId"
:options="listColumns"
label="column"
></n-select>
</div>
<div class="col-md-6 mt-4">
<label>Card Level</label>
<n-select
v-model:value="localLevelId"
:options="listLevels"
label="level"
></n-select>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
:disabled="disableAddButton"
@click="addKanbanCard"
>
Add Card
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import Editor from "@tinymce/tinymce-vue";
import {NSelect} from "naive-ui";
//VueX
import {mapGetters} from "vuex";
import {useUploadImage} from "Composables/uploads/useUploadImage";
export default {
name: "NewKanbanCard",
components: {
editor: Editor,
NSelect,
},
props: {
columnResults: {
type: Array,
default: () => {
return [];
},
},
levelResults: {
type: Array,
default: () => {
return [];
},
},
kanbanBoardResults: {
type: Array,
default: () => {
return [];
},
},
},
emits: [
'new_card',
],
data() {
return {
disableAddButton: true,
kanbanCardDescriptionModel: "",
kanbanCardTextModel: "",
kanbanCardPriorityModal: 2,
listPriority: [
{
label: "Highest",
value: 0,
},
{
label: "High",
value: 1,
},
{
label: "Normal",
value: 2,
},
{
label: "Low",
value: 3,
},
{
label: "Lowest",
value: 4,
},
],
localColumnId: 0,
localLevelId: 0,
};
},
computed: {
...mapGetters({
contentCss: "getContentCss",
kanbanCardResults: "getKanbanCardResults",
listColumns: "getListColumns",
listLevels: "getListLevels",
newCardLocation: "getNewCardLocation",
rootUrl: "getRootUrl",
skin: "getSkin",
}),
},
watch: {
kanbanCardTextModel() {
// If the model is blank OR the text already exists - turn disableAddButton to true
this.disableAddButton = false; //People can click the "Add" button
if (this.kanbanCardTextModel.length === 0) {
this.disableAddButton = true;
}
//Check to make sure it does not exist
const filtered_results = this.kanbanCardResults.filter((row) => {
return (
row.kanban_card_text === this.kanbanCardTextModel
);
});
if (filtered_results.length > 0) {
this.disableAddButton = true;
}
//If there are no rows or levels - we don't want the user to submit a card
if (
this.columnResults.length === 0 ||
this.levelResults.length === 0
) {
this.disableAddButton = true;
}
},
newCardLocation: {
handler(new_value) {
this.localColumnId = new_value.columnId;
this.localLevelId = new_value.levelId;
},
deep: true,
immediate: true,
},
},
methods: {
useUploadImage,
addKanbanCard() {
//Disable the save
this.disableAddButton = true;
this.$store.dispatch("newToast", {
header: "Creating new card",
message: "Please wait as we create the new card",
extra_classes: "bg-warning",
delay: 0,
unique_type: "new_card",
});
//Create the data_to_send
const data_to_send = new FormData();
data_to_send.set("kanban_card_text", this.kanbanCardTextModel);
data_to_send.set(
"kanban_card_description",
this.kanbanCardDescriptionModel
);
data_to_send.set(
"kanban_level",
this.localLevelId,
);
data_to_send.set(
"kanban_column",
this.localColumnId,
);
data_to_send.set(
"kanban_card_priority",
this.kanbanCardPriorityModal
)
//Send the data
this.axios.post(
`${this.rootUrl}kanban_information/${this.kanbanBoardResults[0].pk}/new_card/`,
data_to_send
).then((response) => {
//Get the first value from the response
const new_card = response.data[0];
new_card.tag_list = [];
//Emit the data upstream
this.$emit("new_card", new_card);
//Blank the model
this.kanbanCardTextModel = "";
this.kanbanCardDescriptionModel = "";
//Close the modal
document.getElementById("addKanbanCardCloseButton").click();
this.$store.dispatch("newToast", {
header: "Card created successfully",
message: "Card created successfully",
extra_classes: "bg-success",
unique_type: "new_card",
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error creating card",
message: `Error creating card: Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
unique_type: "new_card",
});
});
},
},
};
</script>

View File

@@ -0,0 +1,426 @@
<template>
<div
id="newLinkModal"
class="modal fade"
tabindex="-1"
aria-labelledby="kanbanLinkModal"
aria-hidden="true"
>
<div class="modal-dialog modal-lg modal-fullscreen-lg-down">
<div class="modal-content">
<div class="modal-header">
<h2>
New Kanban Link Wizard
</h2>
<button
id="requirementLinkCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<!-- CHOOSING A OBJECT TYPE -->
<div class="row">
<div class="col-md-4">
<strong>Object Selector</strong>
<p class="text-instructions">
Please select which object you would like to
link to this requirement.
</p>
</div>
<div class="col-md-8">
<n-select
v-if="!isSearching"
v-model:value="objectModel"
:options="objectSelection"
class="object-selection"
></n-select>
<div
v-else
class="alert alert-success"
>
Searching for {{ objectModel }}s
</div>
</div>
</div>
<!-- CARD LOCATION -->
<hr
v-if="newCardLocation.userCanSelectLocation"
/>
<div
v-if="newCardLocation.userCanSelectLocation"
class="row"
>
<div class="col-md-4">
<strong>Card Location</strong>
<p class="text-instructions">
Select the appropriate location for this card.
</p>
</div>
<div class="col-md-8">
<div class="row">
<div class="col-md-6 mt-4">
<label>Card Column</label>
<n-select
v-model:value="localColumnId"
:options="listColumns"
label="column"
></n-select>
</div>
<div class="col-md-6 mt-4">
<label>Card Level</label>
<n-select
v-model:value="localLevelId"
:options="listLevels"
label="level"
></n-select>
</div>
</div>
</div>
</div>
<!-- SELECTING WHICH OBJECTS TO LINK TO -->
<hr/>
<div
id="select_links"
class="row"
:style="styleHeight"
>
<div class="col-md-4">
<strong>Select Links</strong>
<p class="text-instructions">
Please select which of the objects you want to
connect to this requirement.
</p>
</div>
<div class="col-md-8">
<!-- SEARCH RESULTS -->
<div class="form-group">
<label>Search Terms</label>
<input
id="search_terms"
v-model="searchModel"
class="form-control"
type="text"
/>
</div>
<br/>
<div
v-if="
objectResults.length === 0 &&
objectModel != null
"
class="alert alert-warning"
>
Sorry - there are no results.
</div>
<!-- ADD CODE -->
<div
v-if="!isSearching &&
objectResults.length > 0 &&
objectModel != null"
class="wizard-results"
>
<div
v-for="result in objectResults"
:key="result.id"
class="wizard-results--card"
>
<div class="wizard-results--card--tick">
<input
:id="`checkbox_${objectModel.toLowerCase()}_${result.pk}`"
v-model="linkModel"
class="form-check-input"
type="radio"
name="link-option"
:value="result.id"
/>
</div>
<div class="wizard-results--card--content">
<div class="text-instructions">
{{objectModel}} {{ result.id }}
</div>
<div>
<strong>{{ result.title }}</strong>
</div>
<div>
Status:
<span class="text-instructions">{{ result.status }}</span>
</div>
</div>
</div>
<nav
v-if="setOfPages.length > 1"
aria-label="Pagination for New Link Wizard"
>
<ul class="pagination justify-content-center"
>
<li
v-for="index in setOfPages"
:key="index.destinationPage"
:class="getClasses(index.destinationPage)"
>
<a
v-if="parseInt(index.destiantionPage) !== parseInt(currentPage)"
class="page-link"
href="javascript:void(0)"
@click="changePage(index.destinationPage)"
>
{{ index.text }}
</a>
<span
v-else
class="page-link"
>
{{ index.text }}
</span>
</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
:disabled="linkModel.length === 0"
@click="saveLinks"
>
Save changes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
// NaiveUi
import {NSelect} from "naive-ui";
// VueX
import {mapGetters} from "vuex";
// Composable
import {getSetOfPages} from "Composables/pagintation/getSetOfPages";
export default {
name: "NewKanbanLinkWizard",
components: {
NSelect,
},
props: {
locationId: {
type: Number,
default: 0,
},
},
emits: ['new_card'],
data() {
return {
currentPage: 1,
isSearching: false,
linkModel: [],
localColumnId: 0,
localLevelId: 0,
numberOfPages: 1,
setOfPages: [],
objectModel: null,
objectResults: [],
objectSelection: [
{
value: "Project",
label: "Project",
},
{
value: "Requirement",
label: "Requirement",
},
{
value: "Requirement_Item",
label: "Requirement Item",
},
{
value: "Task",
label: "Task",
},
],
searchModel: "",
searchTimeout: "",
styleHeight: "height: 90px",
};
},
computed: {
...mapGetters({
listColumns: "getListColumns",
listLevels: "getListLevels",
newCardLocation: "getNewCardLocation",
rootUrl: "getRootUrl",
staticUrl: "getStaticUrl",
}),
},
watch: {
newCardLocation: {
handler(new_value) {
this.localColumnId = new_value.columnId;
this.localLevelId = new_value.levelId;
},
deep: true,
immediate: true,
},
objectModel() {
this.currentPage = 1;
this.getObjects();
},
searchModel() {
//Clear timer if it already exists
if (this.searchTimeout !== "") {
//Stop the clock
clearTimeout(this.searchTimeout);
}
//Only search if there are either 0 character or more than 3
if (this.searchModel.length >= 3 ||
this.searchModel.length === 0 ||
Number.isInteger(parseInt(this.searchModel))
) {
this.searchTimeout = setTimeout(() => {
//Use change page, as we should change the page back to destination page 1
this.changePage(1);
}, 500);
}
}
},
methods: {
getSetOfPages,
changePage(index) {
this.currentPage = index;
this.getObjects();
},
getClasses(index) {
if (parseInt(index) === this.currentPage) {
return "page-item active";
}
return "page-item";
},
getObjects() {
//Clear data
this.linkModel = [];
//User has chosen an object.
if (this.objectModel === null) {
//Ok - then removed the objects. We don't need to do anything
this.isSearching = false;
return;
}
const data_to_send = new FormData();
data_to_send.append("array_of_objects", this.objectModel.toLowerCase());
data_to_send.set("destination_page", this.currentPage);
data_to_send.set("exclude_destination", "kanban_board");
data_to_send.set("exclude_location_id", this.locationId);
data_to_send.set("search", this.searchModel);
//Tell the form that we are searching
this.isSearching = true;
//Now to use axios to get the data we require
this.axios.post(
`${this.rootUrl}kanban_information/${this.locationId}/link_list/`,
data_to_send
).then((response) => {
//Load the data into the array
this.objectResults = response.data[this.objectModel.toLowerCase()];
this.numberOfPages = response.data[`${this.objectModel.toLowerCase()}_number_of_pages`];
this.currentPage = response.data[`${this.objectModel.toLowerCase()}_current_page`];
this.setOfPages = getSetOfPages(this.currentPage, this.numberOfPages);
//Tell the user we are no longer searching
this.isSearching = false;
//Clear out search term model
this.searchTermModel = "";
//Set style height as nothing
this.styleHeight = "";
this.$nextTick(() => {
const select_links = document.getElementById("select_links");
if (select_links !== undefined) {
this.styleHeight = `height: ${select_links.clientHeight}px`;
}
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Getting Link List",
message: `We had an issue getting Link List. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
saveLinks() {
// Set up the data object to send
const data_to_send = new FormData();
//Depending on what the object model is - depends what is sent
data_to_send.set(
`${this.objectModel.toLowerCase()}`,
this.linkModel
);
data_to_send.set(
"kanban_level",
this.localLevelId,
);
data_to_send.set(
"kanban_column",
this.localColumnId,
);
// Use axios to send data
this.axios.post(
`${this.rootUrl}kanban_information/${this.locationId}/${this.objectModel.toLowerCase()}/add_link/`,
data_to_send
).then((response) => {
//Get the response data
const new_link = response.data[0];
new_link.tag_list = [];
//Data has been successfully saved. Time to add the card to the board
this.$emit("new_card", new_link);
//Clear the object model
this.objectModel = null;
//Click on the close button - a hack, but it should close the modal
document.getElementById("requirementLinkCloseButton").click();
//Shrink the style height
this.styleHeight = "height: 90px";
});
},
},
};
</script>

View File

@@ -0,0 +1,414 @@
<template>
<div
id="newLinkModal"
class="modal fade"
tabindex="-1"
aria-labelledby="linkModal"
aria-hidden="true"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2>
New {{ destination }} Link Wizard
</h2>
<button
id="linkCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<!-- CHOOSING A OBJECT TYPE -->
<div class="row">
<div class="col-md-4">
<strong>Object Selector</strong>
<p class="text-instructions">
Please select which object you would like to
link to this {{ destination }}.
</p>
</div>
<div class="col-md-8">
<n-select
v-if="!isSearching"
v-model:value="objectModel"
:options="objectSelection"
class="object-selection"
></n-select>
<div
v-else
class="alert alert-success"
>
Searching for {{ objectModel }}s
</div>
</div>
</div>
<hr/>
<!-- CHOOSE RELATIONSHIP TYPE -->
<div class="row">
<div class="col-md-4">
<strong>Relationship</strong>
<p class="text-instructions">
Please select an appropriate relation for the objects.
Default is "Relates"
</p>
</div>
<div class="col-md-8">
<label for="object-relation">Current object</label>
<n-select
id="object-relation"
v-model:value="objectRelationModel"
:options="objectRelation"
class="object-selection"
:disabled="objectModel === null"
></n-select>
</div>
</div>
<hr/>
<!-- SELECTING WHICH OBJECTS TO LINK TO -->
<div
id="select_links"
class="row"
:style="styleHeight"
>
<div class="col-md-4">
<strong>Select Links</strong>
<p class="text-instructions">
Please select which of the objects you want to
connect to this {{ destination }}.
</p>
</div>
<div class="col-md-8">
<div
v-if="objectModel !== '' && objectModel !== null"
class="row"
>
<div class="form-group">
<label>Search</label>
<input
v-model="searchModel"
type="text"
class="form-control"
/>
</div>
</div>
<div
v-if="
objectResults.length === 0 &&
objectModel != null
"
class="alert alert-warning"
>
Sorry - there are no results.
</div>
<div
v-if="!isSearching &&
objectResults.length > 0 &&
objectModel != null"
class="wizard-results"
>
<div
v-for="result in objectResults"
:key="result.id"
class="wizard-results--card"
>
<div class="wizard-results--card--tick">
<input
:id="`checkbox_${objectModel.toLowerCase()}_${result.pk}`"
v-model="linkModel"
class="form-check-input"
type="checkbox"
name="link-option"
:value="result.id"
/>
</div>
<div class="wizard-results--card--content">
<div class="text-instructions">
{{objectModel}} {{ result.id }}
</div>
<div>
<strong>{{ result.title }}</strong>
</div>
<div>
Status:
<span class="text-instructions">{{ result.status }}</span>
</div>
</div>
</div>
<nav
v-if="setOfPages.length >= 1"
aria-label="Pagination for New Link Wizard"
>
<ul class="pagination justify-content-center"
>
<li
v-for="index in setOfPages"
:key="index.destinationPage"
:class="getClasses(index.destinationPage)"
>
<a
v-if="parseInt(index.destinationPage) !== parseInt(currentPage)"
class="page-link"
href="javascript:void(0)"
@click="changePage(index.destinationPage)"
>
{{ index.text }}
</a>
<span
v-else
class="page-link"
>
{{ index.text }}
</span>
</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
:disabled="linkModel.length === 0"
@click="saveLinks"
>
Save changes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
//JavaScript components
import {NSelect} from "naive-ui";
//VueX
import {mapGetters} from "vuex";
//Composable
import { getSetOfPages } from "Composables/pagintation/getSetOfPages";
export default {
name: "NewLinkWizard",
components: {
NSelect,
},
props: {
destination: {
type: String,
default: "",
},
locationId: {
type: Number,
default: 0,
},
},
emits: [
'update_link_results',
],
data() {
return {
currentPage: 1,
isSearching: false,
objectModel: null,
objectRelation: [
{value: "relates", label: "Relates To"},
],
objectRelationModel: "relates",
objectResults: [],
objectSelection: [
{value: "Project", label: "Project"},
{value: "Requirement", label: "Requirement"},
{value: "Requirement_Item", label: "Requirement_Item"},
{value: "Task", label: "Task"},
],
linkModel: [],
numberOfPages: 1,
searchModel: "",
searchTimeout: "",
setOfPages: [],
styleHeight: "height: 90px",
};
},
computed: {
...mapGetters({
rootUrl: "getRootUrl",
staticUrl: "getStaticUrl",
}),
},
watch: {
objectModel() {
this.currentPage = 1;
this.getObjects();
},
searchModel() {
//Clear timer if it already exists
if (this.searchTimeout !== "") {
//Stop the clock
clearTimeout(this.searchTimeout);
}
//Only search if there are either 0 characters, or more than 3
if (this.searchModel.length >= 3 || this.searchModel.length === 0) {
this.searchTimeout = setTimeout(() => {
//Use change page, as we should change the page back to destination page 1
this.changePage(1);
}, 500);
}
},
},
mounted() {
this.handleRelationship();
},
methods: {
getSetOfPages,
changePage(index) {
this.currentPage = index;
this.getObjects();
},
getClasses(index) {
if (parseInt(index) === this.currentPage) {
return "page-item active";
}
return "page-item";
},
getObjects() {
//Clear data
this.linkModel = [];
//Handle the relationship field
this.handleRelationship();
//User has chosen an object.
if (this.objectModel === null) {
//Ok - then removed the objects. We don't need to do anything
this.isSearching = false;
return;
}
const data_to_send = new FormData();
data_to_send.append("array_of_objects", this.objectModel.toLowerCase());
data_to_send.set("destination_page", this.currentPage);
data_to_send.set("exclude_destination", this.destination);
data_to_send.set("exclude_location_id", this.locationId);
data_to_send.set("search", this.searchModel);
//Tell the form that we are searching
this.isSearching = true;
//Now to use axios to get the data we require
this.axios.post(
`${this.rootUrl}search/data/`,
data_to_send,
).then((response) => {
//Load the data into the array
this.objectResults = response.data[this.objectModel.toLowerCase()];
this.numberOfPages = response.data[`${this.objectModel.toLowerCase()}_number_of_pages`];
this.currentPage = response.data[`${this.objectModel.toLowerCase()}_current_page`];
this.setOfPages = getSetOfPages(this.currentPage, this.numberOfPages);
//Tell the user we are no longer searching
this.isSearching = false;
//Set style height as nothing
this.styleHeight = "";
this.$nextTick(() => {
const select_links = document.getElementById("select_links");
if (select_links !== undefined) {
this.styleHeight = `height: ${select_links.clientHeight}px`;
}
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Searching",
message: `We got an error searching. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
handleRelationship() {
//Depending on what object we are looking for, depends which relationships are allowed. For example, the
//requirements and requirement items are only allowed to have the "Of Parent Of" relation ship
if (this.objectModel === "Requirement" || this.objectModel === "Requirement_Item") {
this.objectRelation = [
{value: "parent_object_of", label: "Is Parent Object Of"},
];
this.objectRelationModel = "parent_object_of";
return;
}
//Default :)
this.objectRelation = [
{value: "relates", label: "Relates To"},
{value: "blocked_by", label: "Is Blocked By"},
{value: "blocking", label: "Is Currently Blocking"},
{value: "sub_object_of", label: "Is Sub Object Of"},
{value: "parent_object_of", label: "Is Parent Object Of"},
{value: "has_duplicate", label: "Has Duplicate Object Of"},
{value: "duplicate_object", label: "Is Duplicate Object Of"},
];
this.objectRelationModel = "relates";
},
saveLinks() {
// Set up the data object to send
const data_to_send = new FormData();
// Go through all link models to add to data_to_send
this.linkModel.forEach((link) => {
data_to_send.append(
`${this.objectModel.toLowerCase()}`,
link
);
});
//Tells the backend the relationship we want
data_to_send.set("object_relation", this.objectRelationModel);
// Use axios to send data
this.axios.post(
`${this.rootUrl}object_data/${this.destination}/${this.locationId}/add_link/`,
data_to_send
).then(() => {
//Data has been successfully saved. Time to update the requirement links
this.$emit("update_link_results", {});
//Clear the data
this.objectModel = null;
//Click on the close button - a hack, but it should close the modal
document.getElementById("linkCloseButton").click();
//Shrink the style height
this.styleHeight = "height: 90px";
});
},
}
};
</script>

View File

@@ -0,0 +1,299 @@
<template>
<div
id="newItemModal"
class="modal fade"
tabindex="-1"
aria-labelledby="requirementItemModal"
aria-hidden="true"
>
<div class="modal-dialog modal-xl modal-fullscreen-lg-down">
<div class="modal-content">
<div class="modal-header">
<h2>
New Requirement Item Wizard
</h2>
<button
id="requirementItemCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<strong>Description</strong>
<p class="text-instructions">
Place in a detailed description of this
requirement item. This particular item can be
then connected to Project or Tasks.
</p>
</div>
<div class="col-md-8">
<label for="id_requirement_item_title"
>Requirement Item Title:
<validation-rendering
:error-list="v$.requirementItemTitleModel.$errors"
></validation-rendering>
</label>
<input
id="id_requirement_item_title"
v-model="requirementItemTitleModel"
class="form-control"
name="requirement_item_title"
type="text"
required="true"
maxlength="255"
/>
<br/>
<label>
Requirement Item Scope:
<validation-rendering
:error-list="v$.requirementItemTitleModel.$errors"
></validation-rendering>
</label>
<br/>
<editor
v-model="requirementItemScopeModel"
license-key="gpl"
:init="{
license_key: 'gpl',
height: 500,
menubar: false,
plugins: ['lists', 'codesample', 'table'],
toolbar: 'undo redo | blocks | bold italic strikethrough underline backcolor | alignleft aligncenter ' +
'alignright alignjustify | bullist numlist outdent indent | removeformat | table image codesample',
skin: `${skin}`,
content_css: `${contentCss}`,
relative_urls: false,
}"
/>
</div>
</div>
<!-- Status -->
<hr/>
<div class="row">
<div class="col-md-4">
<h2>Status</h2>
<p class="text-instructions">
Set the Requirement Status and Type here.
</p>
</div>
<div class="col-md-4">
<div class="form-group">
<label
>Requirement Status
<validation-rendering
:error-list="v$.requirementItemTitleModel.$errors"
></validation-rendering>
</label>
<n-select
v-model:value="statusItemModel"
:options="statusItemFixList"
label="status"
></n-select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label
>Requirement Type
<validation-rendering
:error-list="v$.typeItemModel.$errors"
></validation-rendering>
</label>
<n-select
v-model:value="typeItemModel"
:options="typeItemFixList"
label="type"
></n-select>
</div>
</div>
</div>
</div>
<!-- FOOTERS -->
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
@click="saveItem"
>
Save Requirement Item
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {NSelect} from "naive-ui";
import Editor from "@tinymce/tinymce-vue";
//Validation
import useVuelidate from "@vuelidate/core";
import {required, maxLength} from "@vuelidate/validators";
import ValidationRendering from "Components/validation/ValidationRendering.vue";
//Vuex
import {mapGetters} from "vuex";
export default {
name: "NewRequirementItemWizard",
components: {
editor: Editor,
NSelect,
ValidationRendering,
},
emits: [
'new_item_added',
],
setup() {
return {v$: useVuelidate()};
},
data() {
return {
requirementItemScopeModel: "",
requirementItemTitleModel: "",
statusItemFixList: [],
statusItemModel: "",
typeItemFixList: [],
typeItemModel: "",
};
},
computed: {
...mapGetters({
contentCss: "getContentCss",
locationId: "getLocationId",
rootUrl: "getRootUrl",
skin: "getSkin",
}),
},
validations: {
requirementItemScopeModel: {
required,
maxLength: maxLength(630000),
},
requirementItemTitleModel: {
required,
},
statusItemModel: {
required,
},
typeItemModel: {
required,
},
},
mounted() {
this.$nextTick(() => {
this.updateStatusList();
this.updateTypeList();
})
},
methods: {
saveItem() {
// Check the validation first
this.v$.$touch();
if (this.v$.$invalid) {
//Just return - as we do not need to do the rest of this function
return;
}
const data_to_send = new FormData();
data_to_send.set(
"requirement_item_title",
this.requirementItemTitleModel
);
data_to_send.set(
"requirement_item_scope",
this.requirementItemScopeModel
);
data_to_send.set(
"requirement_item_status",
this.statusItemModel
);
data_to_send.set("requirement_item_type", this.typeItemModel);
this.axios.post(
`${this.rootUrl}new_requirement_item/save/${this.locationId}/`,
data_to_send
).then((response) => {
//Data saved successfully - clear all models
this.requirementItemScopeModel = "";
this.requirementItemTitleModel = "";
this.statusItemModel = "";
this.typeItemModel = "";
//EMIT THE NEW DATA UPSTREAM
this.$emit("new_item_added", response.data);
//SHOULD CLOSE MODAL HERE!
document
.getElementById("requirementItemCloseButton")
.click();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Failed to save item",
message: `Failed to save item. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
updateStatusList() {
this.axios.post(
`${this.rootUrl}requirement_information/data/list_of_item_status_values/`
).then((response) => {
this.statusItemFixList = response.data.map((row) => {
return {
value: row.pk,
label: row.fields.requirement_item_status,
}
})
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Updating Status List",
message: `There was an error updating the status list - error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
updateTypeList() {
this.axios.post(
`${this.rootUrl}requirement_information/data/list_of_item_type_values/`
).then((response) => {
this.typeItemFixList = response.data.map((row) => {
return {
value: row.pk,
label: row.fields.requirement_item_type,
}
});
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error Updating Type List",
message: `There was an error updating the type list - error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
}
};
</script>

View File

@@ -0,0 +1,341 @@
<template>
<div
id="newRequirementLinkModal"
class="modal fade"
tabindex="-1"
aria-labelledby="requirementLinkModal"
aria-hidden="true"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2>
New Requirement Link Wizard
</h2>
<button
id="requirementLinkCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<!-- CHOOSING A OBJECT TYPE -->
<div class="row">
<div class="col-md-4">
<strong>Object Selector</strong>
<p class="text-instructions">
Please select which object you would like to
link to this requirement.
</p>
</div>
<div class="col-md-8">
<div class="form-group">
<label>Object Selection</label>
<n-select
v-model:value="objectModel"
:options="objectSelection"
class="object-selection"
></n-select>
</div>
</div>
</div>
<hr/>
<!-- SELECTING WHICH OBJECTS TO LINK TO -->
<div
id="select_links"
class="row"
:style="styleHeight"
>
<div class="col-md-4">
<strong>Select Links</strong>
<p class="text-instructions">
Please select which of the objects you want to
connect to this requirement.
</p>
</div>
<div class="col-md-8">
<div
v-if="objectResults.length === 0 && objectModel != null"
class="alert alert-warning"
>
Sorry - there are no results.
</div>
<!-- SEARCH RESULTS -->
<div
v-if="objectModel != null"
class="form-group"
>
<label>Filter</label>
<input
id="search_terms"
v-model="searchModel"
class="form-control"
type="text"
/>
</div>
<br/>
<div
v-if="!isSearching &&
objectResults.length > 0 &&
objectModel != null"
class="wizard-results"
>
<div
v-for="result in objectResults"
:key="result.id"
class="wizard-results--card"
>
<div class="wizard-results--card--tick">
<input
:id="`checkbox_${objectModel.toLowerCase()}_${result.pk}`"
v-model="linkModel"
class="form-check-input"
type="checkbox"
name="link-option"
:value="result.id"
/>
</div>
<div class="wizard-results--card--content">
<div class="text-instructions">
{{objectModel}} {{ result.id }}
</div>
<div>
<strong>{{ result.title }}</strong>
</div>
<div>
Status:
<span class="text-instructions">{{ result.status }}</span>
</div>
</div>
</div>
<nav
v-if="setOfPages.length > 1"
aria-label="Pagination for New Link Wizard"
>
<ul class="pagination justify-content-center"
>
<li
v-for="index in setOfPages"
:key="index.destinationPage"
:class="getClasses(index.destinationPage)"
>
<a
v-if="parseInt(index.destinationPage) !== parseInt(currentPage)"
class="page-link"
href="javascript:void(0)"
@click="changePage(index.destinationPage)"
>
{{ index.text }}
</a>
<span
v-else
class="page-link"
>
{{ index.text }}
</span>
</li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
:disabled="linkModel.length === 0"
@click="saveLinks"
>
Save changes
</button>
</div>
</div>
</div>
</div>
</template>
<script>
//JavaScript components
import {NSelect} from "naive-ui";
//VueX
import {mapGetters} from "vuex";
// Composibales
import { getSetOfPages } from "Composables/pagintation/getSetOfPages";
export default {
name: "NewRequirementLinkWizard",
components: {
NSelect,
},
props: {
destination: {
type: String,
default: "",
},
locationId: {
type: Number,
default: 0,
},
},
emits: ['update_module'],
data() {
return {
currentPage: 1,
isSearching: false,
linkModel: [],
numberOfPages: 1,
objectModel: null,
objectResults: [],
objectSelection: [
{value: "Project", label: "Project"},
{value: "Task", label: "Task"},
],
searchModel: "",
searchTimeout: "",
styleHeight: "height: 90px",
};
},
computed: {
...mapGetters({
rootUrl: "getRootUrl",
staticUrl: "getStaticUrl",
}),
},
watch: {
objectModel() {
this.getObjects();
},
searchModel() {
//Determine if there is a timeout session going on
if (this.searchTimeout !== "") {
clearTimeout(this.searchTimeout);
}
if (this.searchModel.length >= 3 || this.searchModel.length === 0) {
this.searchTimeout = setTimeout(() => {
this.getObjects();
}, 500);
}
},
},
methods: {
getSetOfPages,
changePage(index) {
this.currentPage = index;
this.getObjects();
},
getClasses(index) {
if (parseInt(index) === this.currentPage) {
return "page-item active";
}
return "page-item";
},
getObjects() {
//Clear data
this.linkModel = [];
//User has chosen an object.
if (this.objectModel === null) {
//Ok - then removed the objects. We don't need to do anything
this.isSearching = false;
return;
}
const data_to_send = new FormData();
data_to_send.append("array_of_objects", this.objectModel.toLowerCase());
data_to_send.set("destination_page", this.currentPage);
data_to_send.set("exclude_destination", this.destination);
data_to_send.set("exclude_location_id", this.locationId);
data_to_send.set("search", this.searchModel);
//Tell the form that we are searching
this.isSearching = true;
//Now to use axios to get the data we require
this.axios.post(
`${this.rootUrl}search/data/`,
data_to_send,
).then((response) => {
//Load the data into the array
this.objectResults = response.data[this.objectModel.toLowerCase()];
this.numberOfPages = response.data[`${this.objectModel.toLowerCase()}_number_of_pages`];
this.currentPage = response.data[`${this.objectModel.toLowerCase()}_current_page`];
this.setOfPages = getSetOfPages(this.currentPage, this.numberOfPages);
//Tell the user we are no longer searching
this.isSearching = false;
//Set style height as nothing
this.styleHeight = "";
this.$nextTick(() => {
const select_links = document.getElementById("select_links");
if (select_links != undefined) {
this.styleHeight = `height: ${select_links.clientHeight}px`;
}
});
}).catch(() => {
this.$store.dispatch("newToast", {
header: "Error retrieving links",
message: "We are currently having issues obtaining data",
delay: 0,
extra_classes: "bg-danger",
});
});
},
saveLinks() {
// Set up the data object to send
const data_to_send = new FormData();
// Go through all link models to add to data_to_send
this.linkModel.forEach((link) => {
data_to_send.append(
`${this.objectModel.toLowerCase()}`,
link
);
});
// Use axios to send data
this.axios.post(
`${this.rootUrl}${this.destination}_information/${this.locationId}/add_link/`,
data_to_send
).then((response) => {
//Data has been successfully saved. Time to update the requirement links
this.$emit("update_module", response.data);
//Click on the close button - a hack, but it should close the modal
document
.getElementById("requirementLinkCloseButton")
.click();
//Clear results
this.objectModel = null;
//Set style height
this.styleHeight = "height: 90px";
});
},
},
};
</script>

View File

@@ -0,0 +1,190 @@
<template>
<div
id="createNewSprintModal"
class="modal fade"
tabindex="-1"
data-bs-backdrop="static"
data-bs-keyboard="false"
aria-labelledby="createNewSprint"
aria-hidden="true"
>
<div class="modal-dialog modal-lg modal-fullscreen-lg-down">
<div class="modal-content">
<div class="modal-header">
<h5
class="modal-title"
>
Please confirm Link Deletion
</h5>
<button
id="createNewSprintButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<strong>Sprint Information</strong>
<p class="text-instructions">
Please use an appropriate name, start date, and finish date.
</p>
</div>
<div class="col-md-8">
<div class="form-group">
<label>Sprint Name</label>
<input
v-model="sprintNameModel"
class="form-control"
type="text"
/>
</div>
<div class="spacer"></div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Start Date</label>
<n-date-picker v-model:value="sprintStartDate" type="date"></n-date-picker>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>End Date</label>
<n-date-picker v-model:value="sprintEndDate" type="date"></n-date-picker>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
@click="closeModal"
>
Cancel
</button>
<button
type="button"
class="btn btn-primary"
@click="createNewSprint"
>
Create New Sprint
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import { mapGetters } from "vuex";
//Naive UI
import { NDatePicker } from 'naive-ui';
export default {
name: "NewSprintWizard",
components: {
NDatePicker,
},
props: {
sprintResultsLength: {
type: Number,
default: 0,
},
},
data() {
return {
sprintEndDate: 0,
sprintNameModel: "",
sprintStartDate: 0,
}
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
rootUrl: "getRootUrl",
})
},
watch: {
sprintResultsLength() {
this.updateSprintNameModel();
}
},
mounted() {
//Set the sprint start date as today, the end date in 7 days.
this.sprintStartDate = new Date().getTime();
this.sprintEndDate = this.sprintStartDate + 7 * 1000 * 60 * 60 * 24;
this.$nextTick(() => {
this.updateSprintNameModel();
});
},
methods: {
closeModal() {
document.getElementById("createNewSprintButton").click();
},
createNewSprint() {
//Notify user that data is being sent
this.$store.dispatch("newToast", {
header: "Creating New Toast",
message: "Please wait - we are creating the new toast. It will automatically navigate you to the " +
"new sprint information page",
extra_classes: "bg-warning text-dark",
delay: 0,
unique_type: "create_sprint",
});
//Organise dates
const start_date = new Date(this.sprintStartDate);
const end_date = new Date(this.sprintEndDate);
//Setup data to send
const data_to_send = new FormData();
data_to_send.set("sprint_name", this.sprintNameModel);
data_to_send.set(
"sprint_start_date",
start_date.toISOString(),
)
data_to_send.set(
"sprint_end_date",
end_date.toISOString(),
)
this.axios.post(
`${this.rootUrl}new_sprint/${this.destination}/${this.locationId}/save/`,
data_to_send,
).then((response) => {
//Navigate user to the new sprint page
window.location = `${this.rootUrl}sprint_information/${response.data.id}/`;
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error creating new sprint",
message: `Could not create new sprint. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
unique_type: "create_sprint",
});
});
},
updateSprintNameModel() {
const new_value = this.sprintResultsLength + 1;
//Fix up the models
const date = new Date().toLocaleDateString(
'en-au',
{ year:"numeric", month:"short", day:"numeric"}
);
//Update the sprint name model
this.sprintNameModel = `${this.destination}-${this.locationId} - Sprint ${new_value} - ${date}`;
},
}
}
</script>

View File

@@ -0,0 +1,136 @@
<template>
<div
v-if="userLevel > 1"
id="updateChangeLeadModal"
class="modal fade"
tabindex="-1"
aria-labelledby="exampleModalLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2>
Change Lead Wizard
</h2>
<button
id="updateChangeLeadCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<strong>Change User</strong>
<p class="text-instructions">
Please use the dropdown to select the new
Change User
</p>
</div>
<div class="col-md-8">
<n-select
v-model:value="userModel"
:options="userFixList"
></n-select>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
:disabled="userModel.length === 0"
@click="changeLead"
>
Change Lead
</button>
</div>
</div>
</div>
</div>
</template>
<script>
import {NSelect} from "naive-ui";
//VueX
import {mapGetters} from "vuex";
export default {
name: "UpdateChangeLeadWizard",
components: {
NSelect,
},
emits: [
'update_change_lead'
],
data() {
return {
userFixList: [],
userModel: [],
};
},
computed: {
...mapGetters({
destination: "getDestination",
locationId: "getLocationId",
potentialUserList: "getPotentialUserList",
rootUrl: "getRootUrl",
staticURL: "getStaticUrl",
userLevel: "getUserLevel",
}),
},
watch: {
potentialUserList(new_value) {
if (new_value === undefined) return;
this.userFixList = new_value.map(row => {
return {
value: row.id,
label: `${row.username}: ${row.first_name} ${row.last_name}`,
}
})
}
},
methods: {
changeLead() {
//Construct the data_to_send array
const data_to_send = new FormData();
data_to_send.set("username", this.userModel);
//User axios to send the data to the backend
this.axios.post(
`${this.rootUrl}rfc_information/${this.locationId}/update_change_lead/`,
data_to_send
).then((response) => {
//Update the data
this.$emit("update_change_lead", response.data.change_lead_results);
//Close the modal
document.getElementById("updateChangeLeadCloseButton").click();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Error changing the lead",
message: `Sorry, we could not change the lead. Error -> ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
},
};
</script>

View File

@@ -0,0 +1,371 @@
<template>
<div
id="uploadDocumentModal"
class="modal fade"
data-bs-backdrop="static"
data-bs-keyboard="false"
tabindex="-1"
aria-labelledby="exampleModalLabel"
aria-hidden="true"
>
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2>
Upload Document Wizard
</h2>
<button
id="uploadDocumentCloseButton"
type="button"
class="btn-close"
data-bs-dismiss="modal"
aria-label="Close"
>
<span aria-hidden="true"></span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4">
<strong>Uploading File</strong>
<p class="text-instructions">
You will be able to upload a file against this
{{ getDestination }}. It will appear in the current
folder.
</p>
<p v-if="documentModel.length === 0">
1. Please click on "Upload File" button to
upload a file
</p>
<p v-else-if="uploadPercentage === ''">
2. Please modify the document descript to be
more human readable. Or click the "Reset" button
to remove the uploaded file.
</p>
<p v-else>
3. Document is currently uploading. Please be
patient.
</p>
</div>
<div class="col-md-8">
<div
v-if="documentModel.length === 0"
class="form-file"
>
<div class="mb-3">
<label
for="document"
class="form-label"
>
Please upload a file<br/>
{{ maxUploadString }}
<div
v-if="maxUploadWarning"
class="alert alert-warning"
>
Sorry - file too large
</div>
</label>
<input
id="document"
type="file"
class="form-control"
:accept="acceptedDocuments"
@change="
handleFileUploads(
$event.target.files
)
"
/>
</div>
</div>
<div
v-else-if="uploadPercentage == ''"
class="form-group"
>
<!-- DOCUMENT DESCRIPTION -->
<div class="form-group">
<label for="documentDescription"
>Document Description</label
>
<input
id="documentDescription"
v-model="documentDescriptionModel"
type="text"
class="form-control"
/>
</div>
<!-- RESET FORM BUTTON -->
<div class="form-row mt-4">
<button
class="btn btn-warning"
@click="resetForm"
>
Reset Form
</button>
</div>
</div>
<div v-else>
<!-- THE UPLOAD SPINNER -->
<div
v-if="
parseFloat(uploadPercentage).toFixed(
0
) < 1
"
class="alert alert-warning"
>
Uploading
{{
(
parseFloat(uploadPercentage) * 100
).toFixed(2)
}}%
<div
class="spinner-border text-primary"
role="status"
>
<span class="sr-only"></span>
</div>
</div>
<!-- THE FINAL WRITING -->
<div
v-else
class="alert alert-success"
>
The document has been uploaded. The server
is currently writing the file to disk.
Please be patient - this modal will close
automatically. Thank you
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-bs-dismiss="modal"
>
Close
</button>
<button
type="button"
class="btn btn-primary"
:disabled="disableUploadButton"
@click="uploadFile"
>
Upload File
</button>
</div>
</div>
</div>
</div>
</template>
<script>
//VueX
import {mapGetters} from "vuex";
import {useReopenCardInformation} from "Composables/card_information/useReopenCardinformation";
export default {
name: "UploadDocumentWizard",
props: {
overrideDestination: {
type: String,
default: "",
},
overrideLocationId: {
type: Number,
default: 0,
},
},
data() {
return {
disableUploadButton: true,
documentModel: [],
documentDescriptionModel: "",
uploadPercentage: "",
maxUploadSize: 0,
maxUploadString: "No Upload Limit",
maxUploadWarning: false,
};
},
computed: {
...mapGetters({
acceptedDocuments: "getAcceptedDocuments",
currentFolder: "getCurrentFolder",
destination: "getDestination",
excludeDocuments: "getDocumentFilteredList",
locationId: "getLocationId",
staticUrl: "getStaticUrl",
rootUrl: "getRootUrl",
}),
},
watch: {
maxUploadSize() {
//If the user has set 0 -> just say "No Upload Limit"
if (this.maxUploadSize === 0) {
return "No Upload Limit";
}
//Define the constants we wish to use
const k = 1024;
const sizes = [
"Bytes",
"KB",
"MB",
"GB",
"TB",
"PB",
"EB",
"ZB",
"YB",
];
//Use math to find out which array section we are going to use from sizes
const i = Math.floor(
Math.log(this.maxUploadSize) / Math.log(k)
);
this.maxUploadString = `Max Upload Size: ${parseFloat(
(this.maxUploadSize / Math.pow(k, i)).toFixed(2)
)} ${sizes[i]}`;
return "";
},
},
updated() {
const match = this.excludeDocuments.filter((row) => {
return (
row.document_key__document_description ===
this.documentDescriptionModel
);
});
this.disableUploadButton =
this.documentModel === "" ||
this.documentDescriptionModel.length === 0 ||
match.length > 0;
},
mounted() {
//Wait a few seconds before getting the max file upload size
this.$nextTick(() => {
//Get the max file upload size
this.axios.post(
`${this.rootUrl}documentation/get/max_upload/`
).then((response) => {
//Set the value
this.maxUploadSize = response.data.max_upload_size;
}).catch(() => {
this.$store.dispatch("newToast", {
header: "Failed to get the max upload size",
message: `Had an issue getting data from backend. ${this.maxUploadString}`,
extra_classes: "bg-danger",
delay: 0,
});
});
});
},
methods: {
useReopenCardInformation,
getDestination() {
return this.overrideDestination !== "" ? this.overrideDestination : this.destination;
},
getLocationId() {
//If there is an overrideDestination - we want to use the overrideLocationId
return this.overrideDestination !== "" ? this.overrideLocationId : this.locationId;
},
handleFileUploads(fileList) {
/*Check that the size of the fileList is not too big
The boolean (0!=this.maxUploadSize) will product a 0 result when maxUploadSize is 0. Thus negating
the need for an extra if statement*/
if (
fileList[0].size * (this.maxUploadSize !== 0) >
this.maxUploadSize
) {
this.maxUploadWarning = true;
//Just return
return;
}
//Remove maxUploadWarning
this.maxUploadWarning = false;
//Update the document modal
this.documentModel = fileList[0];
//Extract the file name and place into the document description for the user
this.documentDescriptionModel = fileList[0].name;
},
resetForm() {
//Blank out all the models
this.documentModel = "";
this.documentDescriptionModel = "";
this.uploadPercentage = "";
},
uploadFile() {
//Create the data to send
const data_to_send = new FormData();
data_to_send.set(
"document",
this.documentModel,
this.documentDescriptionModel
);
data_to_send.set(
"document_description",
this.documentDescriptionModel
);
//If there is a current/partent folder - then add it to the data to send
if (this.currentFolder > 0) {
data_to_send.set("parent_folder", this.currentFolder);
}
//Configuration for axios
const config = {
onUploadProgress: (progressEvent) => {
//As the document gets uploaded - we want to update the upload Percentage
this.uploadPercentage =
parseFloat(progressEvent.loaded) /
parseFloat(progressEvent.total);
},
};
//Use axios to send it to the backend
this.axios.post(
`${this.rootUrl}documentation/${this.getDestination()}/${this.getLocationId()}/upload/`,
data_to_send,
config
).then((response) => {
//Append the new document to the existing document list
this.$store.dispatch("appendDocumentList", {
documentList: response.data[0],
});
//Close the modal
document.getElementById("uploadDocumentCloseButton").click();
//Reset the document
this.resetForm();
//Reshow the card information modal if exists
useReopenCardInformation();
}).catch((error) => {
this.$store.dispatch("newToast", {
header: "Failed to upload documentation",
message: `Can not upload the documentation. ${error}`,
extra_classes: "bg-danger",
delay: 0,
});
});
},
},
};
</script>