added codebase, project rules and sec audit
This commit is contained in:
224
NearBeach/src/js/app.js
Normal file
224
NearBeach/src/js/app.js
Normal file
@@ -0,0 +1,224 @@
|
||||
//Vue
|
||||
import {createApp} from "vue/dist/vue.esm-bundler";
|
||||
|
||||
//VueX
|
||||
import {store} from "./vuex-store";
|
||||
|
||||
//Import Bootstrap
|
||||
|
||||
|
||||
|
||||
//SCSS Library
|
||||
import "../sass/main.scss";
|
||||
|
||||
//custom javascript
|
||||
import "./global.js";
|
||||
|
||||
//Import axios for ajax
|
||||
const axios = require("axios");
|
||||
const axiosInstance = axios.create({
|
||||
withCredentials: true,
|
||||
xsrfCookieName: "csrftoken",
|
||||
xsrfHeaderName: "X-CSRFTOKEN",
|
||||
});
|
||||
|
||||
//nextTick
|
||||
|
||||
|
||||
//Naive-ui
|
||||
import {NConfigProvider} from "naive-ui";
|
||||
|
||||
//Lazy Load Parent Components
|
||||
import {
|
||||
CarbonArrowUp,
|
||||
CarbonCloseOutline,
|
||||
CarbonDocument,
|
||||
CarbonDocumentPdf,
|
||||
CarbonEmail,
|
||||
CarbonFolder,
|
||||
CarbonImage,
|
||||
CarbonInformation,
|
||||
CarbonLink,
|
||||
CarbonTrashCan,
|
||||
ChangeTaskInformation,
|
||||
ChangeTaskModules,
|
||||
ConfirmKanbanBoardClosure,
|
||||
ConfirmKanbanBoardReopen,
|
||||
CustomerInformation,
|
||||
CustomerModules,
|
||||
DashboardKanbanList,
|
||||
DashboardMyObjects,
|
||||
DashboardRfcApprovals,
|
||||
DashboardTodoToday,
|
||||
DashboardUnassignedObjects,
|
||||
DashboardUsersWithNoGroups,
|
||||
DiagnosticInformation,
|
||||
EditSprint,
|
||||
GanttInformation,
|
||||
GdprWizard,
|
||||
GroupInformation,
|
||||
KanbanDangerZone,
|
||||
KanbanEditBoard,
|
||||
KanbanGroupPermissions,
|
||||
KanbanInformation,
|
||||
KanbanPublicLinks,
|
||||
ListSearchResults,
|
||||
MdiMicrosoftExcel,
|
||||
MdiMicrosoftPowerPoint,
|
||||
MdiMicrosoftWord,
|
||||
MyPlanner,
|
||||
NewCustomer,
|
||||
NewGroup,
|
||||
NewKanban,
|
||||
NewNotification,
|
||||
NewOrganisation,
|
||||
NewPermissionSet,
|
||||
NewProject,
|
||||
NewRequestForChange,
|
||||
NewRequirement,
|
||||
NewScheduledObject,
|
||||
NewTask,
|
||||
NewUser,
|
||||
NotificationInformation,
|
||||
ObjectStatusInformation,
|
||||
ObjectStatusList,
|
||||
OrganisationInformation,
|
||||
OrganisationModules,
|
||||
ParentModules,
|
||||
PermissionInformation,
|
||||
ProfileInformation,
|
||||
ProjectInformation,
|
||||
PublicCardInformation,
|
||||
PublicKanbanBoard,
|
||||
PublicRequirementItemList,
|
||||
RenderToasts,
|
||||
RequirementInformation,
|
||||
RequirementItemInformation,
|
||||
ResetUserPassword,
|
||||
RfcInformation,
|
||||
RfcModules,
|
||||
ScheduleObjects,
|
||||
ScheduleObjectInformation,
|
||||
SearchCustomers,
|
||||
SearchGroups,
|
||||
SearchNotifications,
|
||||
SearchObjects,
|
||||
SearchOrganisations,
|
||||
SearchPermissionSets,
|
||||
SearchSprints,
|
||||
SearchTags,
|
||||
SearchUsers,
|
||||
SprintInformation,
|
||||
TaskInformation,
|
||||
UpdateProfilePicture,
|
||||
UserApiList,
|
||||
UserInformation,
|
||||
UserList,
|
||||
} from "./components";
|
||||
|
||||
//Construction of the VUE App
|
||||
const app = createApp({
|
||||
components: {
|
||||
//BugsModule,
|
||||
CarbonArrowUp,
|
||||
CarbonCloseOutline,
|
||||
CarbonDocument,
|
||||
CarbonDocumentPdf,
|
||||
CarbonEmail,
|
||||
CarbonFolder,
|
||||
CarbonImage,
|
||||
CarbonInformation,
|
||||
CarbonLink,
|
||||
CarbonTrashCan,
|
||||
ConfirmKanbanBoardClosure,
|
||||
ConfirmKanbanBoardReopen,
|
||||
ChangeTaskInformation,
|
||||
ChangeTaskModules,
|
||||
CustomerInformation,
|
||||
CustomerModules,
|
||||
DashboardKanbanList,
|
||||
DashboardMyObjects,
|
||||
DashboardRfcApprovals,
|
||||
DashboardTodoToday,
|
||||
DashboardUnassignedObjects,
|
||||
DashboardUsersWithNoGroups,
|
||||
DiagnosticInformation,
|
||||
EditSprint,
|
||||
GanttInformation,
|
||||
GdprWizard,
|
||||
GroupInformation,
|
||||
KanbanDangerZone,
|
||||
KanbanEditBoard,
|
||||
KanbanGroupPermissions,
|
||||
KanbanInformation,
|
||||
KanbanPublicLinks,
|
||||
ListSearchResults,
|
||||
MdiMicrosoftExcel,
|
||||
MdiMicrosoftPowerPoint,
|
||||
MdiMicrosoftWord,
|
||||
MyPlanner,
|
||||
NewCustomer,
|
||||
NewGroup,
|
||||
NewKanban,
|
||||
NewNotification,
|
||||
NewOrganisation,
|
||||
NewPermissionSet,
|
||||
NewProject,
|
||||
NewRequestForChange,
|
||||
NewRequirement,
|
||||
NewScheduledObject,
|
||||
NewTask,
|
||||
NewUser,
|
||||
NotificationInformation,
|
||||
ObjectStatusInformation,
|
||||
ObjectStatusList,
|
||||
OrganisationInformation,
|
||||
OrganisationModules,
|
||||
ParentModules,
|
||||
PermissionInformation,
|
||||
ProfileInformation,
|
||||
ProjectInformation,
|
||||
PublicCardInformation,
|
||||
PublicKanbanBoard,
|
||||
PublicRequirementItemList,
|
||||
RenderToasts,
|
||||
RequirementInformation,
|
||||
RequirementItemInformation,
|
||||
ResetUserPassword,
|
||||
RfcInformation,
|
||||
RfcModules,
|
||||
ScheduleObjects,
|
||||
ScheduleObjectInformation,
|
||||
SearchCustomers,
|
||||
SearchGroups,
|
||||
SearchNotifications,
|
||||
SearchObjects,
|
||||
SearchOrganisations,
|
||||
SearchPermissionSets,
|
||||
SearchSprints,
|
||||
SearchTags,
|
||||
SearchUsers,
|
||||
SprintInformation,
|
||||
TaskInformation,
|
||||
UpdateProfilePicture,
|
||||
UserApiList,
|
||||
UserInformation,
|
||||
UserList,
|
||||
},
|
||||
mounted() {
|
||||
//Remove the loader
|
||||
const loader_elem = document.getElementById("loader");
|
||||
loader_elem.style.transform = "translateY(-100vh)";
|
||||
|
||||
//Remove the element when we are finished with it
|
||||
setTimeout(() => {
|
||||
//Destroy the evidance
|
||||
loader_elem.remove();
|
||||
}, 500);
|
||||
},
|
||||
});
|
||||
app.config.devtools = true;
|
||||
app.use(store);
|
||||
app.config.globalProperties.axios=axiosInstance;
|
||||
app.component("NConfigProvider", NConfigProvider);
|
||||
app.mount("#app");
|
||||
507
NearBeach/src/js/components.js
Normal file
507
NearBeach/src/js/components.js
Normal file
@@ -0,0 +1,507 @@
|
||||
import {defineAsyncComponent} from "vue/dist/vue.esm-bundler";
|
||||
|
||||
export const
|
||||
CarbonArrowUp = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "carbon-arrow-up" */
|
||||
"./components/icons/CarbonArrowUp.vue"
|
||||
)
|
||||
),
|
||||
CarbonCloseOutline = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "carbon-close-outline" */
|
||||
"./components/icons/CarbonCloseOutline.vue"
|
||||
)
|
||||
),
|
||||
CarbonDocument = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "carbon-document" */
|
||||
"./components/icons/CarbonDocument.vue"
|
||||
)
|
||||
),
|
||||
CarbonDocumentPdf = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "carbon-document-pdf" */
|
||||
"./components/icons/CarbonDocumentPdf.vue"
|
||||
)
|
||||
),
|
||||
CarbonEmail = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "carbon-email" */
|
||||
"./components/icons/CarbonEmail.vue"
|
||||
)
|
||||
),
|
||||
CarbonFolder = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "carbon-folder" */
|
||||
"./components/icons/CarbonFolder.vue"
|
||||
)
|
||||
),
|
||||
CarbonImage = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "carbon-image" */
|
||||
"./components/icons/CarbonImage.vue"
|
||||
)
|
||||
),
|
||||
CarbonInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "carbon-information" */
|
||||
"./components/icons/CarbonInformation.vue"
|
||||
)
|
||||
),
|
||||
CarbonLink = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "carbon-link" */
|
||||
"./components/icons/CarbonLink.vue"
|
||||
)
|
||||
),
|
||||
CarbonTrashCan = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "carbon-trash-can" */
|
||||
"./components/icons/CarbonTrashCan.vue"
|
||||
)
|
||||
),
|
||||
ChangeTaskInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "change-task-information" */
|
||||
"./components/change_task/ChangeTaskInformation.vue"
|
||||
)
|
||||
),
|
||||
ChangeTaskModules = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "change-task-modules" */
|
||||
"./components/change_task/ChangeTaskModules.vue"
|
||||
)
|
||||
),
|
||||
ConfirmKanbanBoardClosure = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "confirm-kanban-board-closure" */
|
||||
"./components/kanban/ConfirmKanbanBoardClosure.vue"
|
||||
)
|
||||
),
|
||||
ConfirmKanbanBoardReopen = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "confirm-kanban-board-reopen" */
|
||||
"./components/kanban/ConfirmKanbanBoardReopen.vue"
|
||||
)
|
||||
),
|
||||
CustomerInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "customer-information" */
|
||||
"./components/customers/CustomerInformation.vue"
|
||||
)
|
||||
),
|
||||
CustomerModules = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "customer-modules" */
|
||||
"./components/customers/CustomerModules.vue"
|
||||
)
|
||||
),
|
||||
DashboardKanbanList = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "dashboard-kanban-list" */
|
||||
"./components/dashboard/DashboardKanbanList.vue"
|
||||
)
|
||||
),
|
||||
DashboardMyObjects = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "dashboard-my-objects" */
|
||||
"./components/dashboard/DashboardMyObjects.vue"
|
||||
)
|
||||
),
|
||||
DashboardRfcApprovals = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "dashboard-rfc-approvals" */
|
||||
"./components/dashboard/DashboardRfcApprovals.vue"
|
||||
)
|
||||
),
|
||||
DashboardTodoToday = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "dashboard-todo-today" */
|
||||
"./components/dashboard/DashboardTodoToday.vue"
|
||||
)
|
||||
),
|
||||
DashboardUnassignedObjects = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "dashboard-unassigned-objects" */
|
||||
"./components/dashboard/DashboardUnassignedObjects.vue"
|
||||
)
|
||||
),
|
||||
DashboardUsersWithNoGroups = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "dashboard-users-with-no-groups" */
|
||||
"./components/dashboard/DashboardUsersWithNoGroups.vue"
|
||||
)
|
||||
),
|
||||
DiagnosticInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "diagnostic-information" */
|
||||
"./components/diagnostic/DiagnosticInformation.vue"
|
||||
)
|
||||
),
|
||||
EditSprint = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "edit-sprint" */
|
||||
"./components/sprints/EditSprint.vue"
|
||||
)
|
||||
),
|
||||
GanttInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "gantt-information" */
|
||||
"./components/gantt_chart/GanttInformation.vue"
|
||||
)
|
||||
),
|
||||
GdprWizard = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "gdpr-wizard" */
|
||||
"./components/gdpr/GdprWizard.vue"
|
||||
)
|
||||
),
|
||||
GroupInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "group-information" */
|
||||
"./components/groups/GroupInformation.vue"
|
||||
)
|
||||
),
|
||||
KanbanDangerZone = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "kanban-danger-zone" */
|
||||
"./components/kanban/KanbanDangerZone.vue"
|
||||
)
|
||||
),
|
||||
KanbanEditBoard = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "kanban-edit-board" */
|
||||
"./components/kanban/KanbanEditBoard.vue"
|
||||
)
|
||||
),
|
||||
KanbanGroupPermissions = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "kanban-group-permissions" */
|
||||
"./components/kanban/KanbanGroupPermissions.vue"
|
||||
)
|
||||
),
|
||||
KanbanInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "kanban-information" */
|
||||
"./components/kanban/KanbanInformation.vue"
|
||||
)
|
||||
),
|
||||
KanbanPublicLinks = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "kanban-public-links" */
|
||||
"./components/kanban/KanbanPublicLinks.vue"
|
||||
)
|
||||
),
|
||||
ListSearchResults = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "list-search-results" */
|
||||
"./components/search/ListSearchResults.vue"
|
||||
)
|
||||
),
|
||||
MdiMicrosoftExcel = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "mdi-microsoft-excel" */
|
||||
"./components/icons/MdiMicrosoftExcel.vue"
|
||||
)
|
||||
),
|
||||
MdiMicrosoftPowerPoint = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "mdi-microsoft-power-point" */
|
||||
"./components/icons/MdiMicrosoftPowerPoint.vue"
|
||||
)
|
||||
),
|
||||
MdiMicrosoftWord = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "mdi-microsoft-word" */
|
||||
"./components/icons/MdiMicrosoftWord.vue"
|
||||
)
|
||||
),
|
||||
MyPlanner = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "my-planner" */
|
||||
"./components/my_planner/MyPlanner.vue"
|
||||
)
|
||||
),
|
||||
NewCustomer = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "new-customer" */
|
||||
"./components/customers/NewCustomer.vue"
|
||||
)
|
||||
),
|
||||
NewGroup = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "new-group" */
|
||||
"./components/groups/NewGroup.vue"
|
||||
)
|
||||
),
|
||||
NewKanban = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "new-kanban" */
|
||||
"./components/kanban/NewKanban.vue"
|
||||
)
|
||||
),
|
||||
NewNotification = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "new-notification" */
|
||||
"./components/notifications/NewNotification.vue"
|
||||
)
|
||||
),
|
||||
NewPermissionSet = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "new-permission-set" */
|
||||
"./components/permissions/NewPermissionSet.vue"
|
||||
)
|
||||
),
|
||||
NewOrganisation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "new-permission-set" */
|
||||
"./components/organisations/NewOrganisation.vue"
|
||||
)
|
||||
),
|
||||
NewProject = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "new-project" */
|
||||
"./components/projects/NewProject.vue"
|
||||
)
|
||||
),
|
||||
NewRequestForChange = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "new-request-for-change" */
|
||||
"./components/request_for_change/NewRequestForChange.vue"
|
||||
)
|
||||
),
|
||||
NewRequirement = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "new-requirement" */
|
||||
"./components/requirements/NewRequirement.vue"
|
||||
)
|
||||
),
|
||||
NewScheduledObject = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "new-scheduled-object" */
|
||||
"./components/object_scheduler/NewScheduledObject.vue"
|
||||
)
|
||||
),
|
||||
NewTask = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "new-task" */
|
||||
"./components/tasks/NewTask.vue"
|
||||
)
|
||||
),
|
||||
NewUser = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "new-user" */
|
||||
"./components/users/NewUser.vue"
|
||||
)
|
||||
),
|
||||
NotificationInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "notification-information" */
|
||||
"./components/notifications/NotificationInformation.vue"
|
||||
)
|
||||
),
|
||||
ObjectStatusInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "object-status-information" */
|
||||
"./components/object_status/ObjectStatusInformation.vue"
|
||||
)
|
||||
),
|
||||
ObjectStatusList = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "object-status-list" */
|
||||
"./components/object_status/ObjectStatusList.vue"
|
||||
)
|
||||
),
|
||||
OrganisationInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "organisation-information" */
|
||||
"./components/organisations/OrganisationInformation.vue"
|
||||
)
|
||||
),
|
||||
OrganisationModules = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "organisation-modules" */
|
||||
"./components/organisations/OrganisationModules.vue"
|
||||
)
|
||||
),
|
||||
ParentModules = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "parent-modules" */
|
||||
"./components/modules/ParentModules.vue"
|
||||
)
|
||||
),
|
||||
PermissionInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "permission-information" */
|
||||
"./components/permissions/PermissionInformation.vue"
|
||||
)
|
||||
),
|
||||
ProjectInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "project-information" */
|
||||
"./components/projects/ProjectInformation.vue"
|
||||
)
|
||||
),
|
||||
ProfileInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "profile-information" */
|
||||
"./components/profile/ProfileInformation.vue"
|
||||
)
|
||||
),
|
||||
PublicCardInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "public-card-information" */
|
||||
"./components/public/public_card_information.vue"
|
||||
)
|
||||
),
|
||||
PublicKanbanBoard = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "public-kanban-board" */
|
||||
"./components/public/public_kanban_board.vue"
|
||||
)
|
||||
),
|
||||
PublicRequirementItemList = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "public-requirement-item-list" */
|
||||
"./components/public/public_requirement_item_list.vue"
|
||||
)
|
||||
),
|
||||
RenderToasts = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "render-toasts" */
|
||||
"./components/render/RenderToasts.vue"
|
||||
)
|
||||
),
|
||||
ResetUserPassword = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "reset-user-password" */
|
||||
"./components/users/ResetUserPassword.vue"
|
||||
)
|
||||
),
|
||||
RfcInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "rfc-Information" */
|
||||
"./components/request_for_change/RfcInformation.vue"
|
||||
)
|
||||
),
|
||||
RfcModules = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "rfc-modules" */
|
||||
"./components/request_for_change/RfcModules.vue"
|
||||
)
|
||||
),
|
||||
RequirementInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "requirement-information" */
|
||||
"./components/requirements/RequirementInformation.vue"
|
||||
)
|
||||
),
|
||||
RequirementItemInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "requirement-item-information" */
|
||||
"./components/requirement_items/RequirementItemInformation.vue"
|
||||
)
|
||||
),
|
||||
ScheduleObjects = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "schedule-objects" */
|
||||
"./components/object_scheduler/ScheduleObjects.vue"
|
||||
)
|
||||
),
|
||||
ScheduleObjectInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "schedule-object-information" */
|
||||
"./components/object_scheduler/ScheduledObjectInformation.vue"
|
||||
)
|
||||
),
|
||||
SearchCustomers = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "search-customers" */
|
||||
"./components/search/SearchCustomers.vue"
|
||||
)
|
||||
),
|
||||
SearchGroups = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "search-groups" */
|
||||
"./components/search/SearchGroups.vue"
|
||||
)
|
||||
),
|
||||
SearchNotifications = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "search-notifications" */
|
||||
"./components/search/SearchNotifications.vue"
|
||||
)
|
||||
),
|
||||
SearchObjects = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "search-objects" */
|
||||
"./components/search/SearchObjects.vue"
|
||||
)
|
||||
),
|
||||
SearchOrganisations = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "search-organisations" */
|
||||
"./components/search/SearchOrganisations.vue"
|
||||
)
|
||||
),
|
||||
SearchPermissionSets = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "search-permission-sets" */
|
||||
"./components/search/SearchPermissionSets.vue"
|
||||
)
|
||||
),
|
||||
SearchSprints = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "search-sprints" */
|
||||
"./components/search/SearchSprints.vue"
|
||||
)
|
||||
),
|
||||
SearchTags = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "search-tags" */
|
||||
"./components/search/SearchTags.vue"
|
||||
)
|
||||
),
|
||||
SearchUsers = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "search-users" */
|
||||
"./components/search/SearchUsers.vue"
|
||||
)
|
||||
),
|
||||
SprintInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "sprint-information" */
|
||||
"./components/sprints/SprintInformation.vue"
|
||||
)
|
||||
),
|
||||
TaskInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "task-information" */
|
||||
"./components/tasks/TaskInformation.vue"
|
||||
)
|
||||
),
|
||||
UpdateProfilePicture = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "update-profile-picture" */
|
||||
"./components/profile/UpdateProfilePicture.vue"
|
||||
)
|
||||
),
|
||||
UserApiList = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "user-api-list" */
|
||||
"./components/users/UserApiList.vue"
|
||||
)
|
||||
),
|
||||
UserInformation = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "user-information" */
|
||||
"./components/users/UserInformation.vue"
|
||||
)
|
||||
),
|
||||
UserList = defineAsyncComponent(() =>
|
||||
import(
|
||||
/* webpackChunkName: "user-list" */
|
||||
"./components/administration/UserList.vue"
|
||||
)
|
||||
);
|
||||
276
NearBeach/src/js/components/administration/AdminAddUser.vue
Normal file
276
NearBeach/src/js/components/administration/AdminAddUser.vue
Normal file
@@ -0,0 +1,276 @@
|
||||
<template>
|
||||
<div
|
||||
id="addUserModal"
|
||||
class="modal fade"
|
||||
data-bs-backdrop="static"
|
||||
data-bs-keyboard="false"
|
||||
tabindex="-1"
|
||||
aria-labelledby="addUserModalLabel"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog modal-lg modal-fullscreen-lg-down">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5
|
||||
id="addUserModalLabel"
|
||||
class="modal-title"
|
||||
>
|
||||
Add User
|
||||
</h5>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-close"
|
||||
data-bs-dismiss="modal"
|
||||
aria-label="Close"
|
||||
></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<!-- Search Users -->
|
||||
<div
|
||||
v-if="destination !== 'user'"
|
||||
class="row"
|
||||
>
|
||||
<div class="col-md-4">
|
||||
<strong>Search Users</strong>
|
||||
<p class="text-instructions">
|
||||
Please use the select to find the user you would
|
||||
like to add to this {{ destination }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<label>Search User</label>
|
||||
<n-select
|
||||
v-model:value="userModel"
|
||||
:options="userResults"
|
||||
filterable
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<hr v-if="destination !== 'user'"/>
|
||||
|
||||
<!-- Search Groups -->
|
||||
<div
|
||||
v-if="destination !== 'group'"
|
||||
class="row"
|
||||
>
|
||||
<div class="col-md-4">
|
||||
<strong>Search Groups</strong>
|
||||
<p class="text-instructions">
|
||||
Please use the select to find the group you
|
||||
would like to add to this user to.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<label>Search Groups</label>
|
||||
<n-select
|
||||
v-model:value="groupModel"
|
||||
:options="groupResults"
|
||||
class="form-control"
|
||||
multiple
|
||||
filterable
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<hr v-if="destination !== 'group'"/>
|
||||
|
||||
<!-- Search Permission Sets -->
|
||||
<div
|
||||
v-if="destination !== 'permission_set'"
|
||||
class="row"
|
||||
>
|
||||
<div class="col-md-4">
|
||||
<strong>Search Permission Sets</strong>
|
||||
<p class="text-instructions">
|
||||
Please use the select to find the permission set
|
||||
you would like to add to this user.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<label>Search Permission Sets</label>
|
||||
<n-select
|
||||
v-model:value="permissionSetModel"
|
||||
:options="permissionSetResults"
|
||||
class="form-control"
|
||||
multiple
|
||||
filterable
|
||||
/>
|
||||
</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="addUser"
|
||||
>
|
||||
{{ addButtonText() }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {NSelect} from "naive-ui";
|
||||
|
||||
//VueX
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "AdminAddUser",
|
||||
components: {
|
||||
NSelect,
|
||||
},
|
||||
props: {
|
||||
destination: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
locationId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
groupModel: [],
|
||||
groupResults: [],
|
||||
permissionSetModel: [],
|
||||
permissionSetResults: [],
|
||||
userModel: [],
|
||||
userResults: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
rootUrl: "getRootUrl",
|
||||
userLevel: "getUserLevel",
|
||||
}),
|
||||
disableAddButton() {
|
||||
//Setup the conditions
|
||||
const condition_1 = Number.isInteger(this.userModel) ? 1 : 0;
|
||||
const condition_2 = this.groupModel.length > 0 ? 1 : 0;
|
||||
const condition_3 = this.permissionSetModel.length > 0 ? 1 : 0;
|
||||
|
||||
//If we add all 3 conditions together, we should get 3
|
||||
return condition_1 + condition_2 + condition_3 !== 3;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
//Form loads - obtain data.
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
addButtonText() {
|
||||
//Add Group should be used on user
|
||||
if (this.destination === "user") {
|
||||
return "Add Group";
|
||||
}
|
||||
|
||||
return "Add User";
|
||||
},
|
||||
addUser() {
|
||||
//Create the data_to_send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("username", this.userModel);
|
||||
|
||||
//Loop through all the groups
|
||||
this.groupModel.forEach((row) => {
|
||||
data_to_send.append("group", row);
|
||||
});
|
||||
|
||||
//Loop through all the permission_sets
|
||||
this.permissionSetModel.forEach((row) => {
|
||||
data_to_send.append("permission_set", row);
|
||||
});
|
||||
|
||||
this.axios.post(
|
||||
`${this.rootUrl}admin_add_user/`,
|
||||
data_to_send
|
||||
).then(() => {
|
||||
//Just refresh the page (for now)
|
||||
window.location.reload(true);
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error adding user",
|
||||
message: `Sorry, we could not add user. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
getData() {
|
||||
const data_to_send = new FormData();
|
||||
|
||||
//Use Axios to obtain all the group, permission-set, and user results
|
||||
this.axios.post(
|
||||
`${this.rootUrl}object_data/admin_add_user/`,
|
||||
data_to_send
|
||||
).then((response) => {
|
||||
//Assign it to the appropriate variable
|
||||
this.groupResults = response.data.group_results.map(
|
||||
(data) => {
|
||||
return {
|
||||
label: data.group_name,
|
||||
value: data.group_id,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
this.permissionSetResults =
|
||||
response.data.permission_set_results.map((data) => {
|
||||
return {
|
||||
label: data.permission_set_name,
|
||||
value: data.permission_set_id,
|
||||
};
|
||||
});
|
||||
|
||||
this.userResults = response.data.user_results.map((data) => {
|
||||
return {
|
||||
label: `${data.id}: ${data.first_name} ${data.last_name}`,
|
||||
value: data.id,
|
||||
};
|
||||
});
|
||||
|
||||
//Use a simple if statement to find out which destination we are concentrating on
|
||||
//Then filter the responses of that destination to determine the modal response
|
||||
switch (this.destination) {
|
||||
case "group":
|
||||
//Filter group model data from group results
|
||||
this.groupModel = [this.locationId];
|
||||
break;
|
||||
case "permission_set":
|
||||
//Filter permission set model data from permission set results
|
||||
this.permissionSetModel = [this.locationId];
|
||||
break;
|
||||
case "user":
|
||||
//Filter user model data from user results
|
||||
this.userModel = this.locationId;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error obtaining data",
|
||||
message: `Sorry, we could not obtain the required data. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<div
|
||||
id="confirmPermissionDeleteModal"
|
||||
class="modal fade"
|
||||
data-bs-backdrop="static"
|
||||
data-bs-keyboard="false"
|
||||
tabindex="-1"
|
||||
aria-labelledby="confirmPermissionDeleteLabel"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1
|
||||
id="confirmPermissionDeleteLabel"
|
||||
class="modal-title fs-5"
|
||||
>
|
||||
Are you sure?
|
||||
</h1>
|
||||
<button
|
||||
id="confirmPermissionDeleteClose"
|
||||
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 that permission?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-secondary"
|
||||
data-bs-dismiss="modal"
|
||||
>
|
||||
No
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
@click="removePermission"
|
||||
>
|
||||
Yes
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "ConfirmPermissionDelete",
|
||||
props: {
|
||||
permissionDeleteId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
emits: [
|
||||
'remove_permission',
|
||||
],
|
||||
methods: {
|
||||
removePermission() {
|
||||
//Create data to send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("user_group_id", this.permissionDeleteId);
|
||||
|
||||
this.axios.post(
|
||||
"/user_information/remove_permission/",
|
||||
data_to_send
|
||||
).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error removing permission",
|
||||
message: `Sorry, we could not remove the permission. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
|
||||
//Optimistic - remove data and close modal
|
||||
this.$emit("remove_permission", this.permissionDeleteId);
|
||||
document.getElementById("confirmPermissionDeleteClose").click();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
248
NearBeach/src/js/components/administration/UserList.vue
Normal file
248
NearBeach/src/js/components/administration/UserList.vue
Normal file
@@ -0,0 +1,248 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h2 v-if="destination === 'user'">User Permission List</h2>
|
||||
<h2 v-else>User List</h2>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>List of Users</strong>
|
||||
<p text="text-instructions">
|
||||
The following are a list of users associated to
|
||||
{{ destination }}. To add a new user please click on the
|
||||
"Add User" at the bottom of the page.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>User</td>
|
||||
<td>Group List</td>
|
||||
<td>Permission List</td>
|
||||
<td>Team Leader</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="user in localListResults"
|
||||
:key="user.username"
|
||||
>
|
||||
<td>
|
||||
{{ user.username__first_name }}
|
||||
{{ user.username__last_name }}
|
||||
</td>
|
||||
<td>
|
||||
{{ user.group__group_name }}
|
||||
</td>
|
||||
<td>
|
||||
{{
|
||||
user.permission_set__permission_set_name
|
||||
}}
|
||||
</td>
|
||||
<td style="text-align: center">
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
:checked="user.group_leader"
|
||||
:data-group="user.group"
|
||||
:data-permission-set="
|
||||
user.permission_set
|
||||
"
|
||||
:data-user="user.username"
|
||||
@change="updateGroupLeader"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<span
|
||||
class="remove-link"
|
||||
>
|
||||
<carbon-trash-can
|
||||
@click="deletePermission(user.user_group_id)"
|
||||
></carbon-trash-can>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<a
|
||||
href="javascript:void(0)"
|
||||
class="btn btn-primary save-changes"
|
||||
@click="addUser"
|
||||
>{{ addButtonText() }}</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MODALS -->
|
||||
<admin-add-user
|
||||
:destination="destination"
|
||||
:location-id="locationId"
|
||||
></admin-add-user>
|
||||
|
||||
<confirm-permission-delete
|
||||
:permission-delete-id="permissionDeleteId"
|
||||
@remove_permission="removePermission"
|
||||
></confirm-permission-delete>
|
||||
</div>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {Modal} from "bootstrap";
|
||||
|
||||
//Vue Components
|
||||
import AdminAddUser from "./AdminAddUser.vue";
|
||||
import ConfirmPermissionDelete from "./ConfirmPermissionDelete.vue"
|
||||
|
||||
//Icon
|
||||
import {CarbonTrashCan} from "../../components";
|
||||
|
||||
//Composable
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
|
||||
export default {
|
||||
name: "UserList",
|
||||
components: {
|
||||
CarbonTrashCan,
|
||||
AdminAddUser,
|
||||
ConfirmPermissionDelete,
|
||||
},
|
||||
props: {
|
||||
destination: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
locationId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
userListResults: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
localListResults: [],
|
||||
permissionDeleteId: 0,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.localListResults = this.userListResults;
|
||||
},
|
||||
methods: {
|
||||
useNBTheme,
|
||||
addButtonText() {
|
||||
//Add Group should be used on user
|
||||
if (this.destination === "user") {
|
||||
return "Add Group";
|
||||
}
|
||||
|
||||
return "Add User";
|
||||
},
|
||||
addUser() {
|
||||
//Show the user's modal
|
||||
const addUserModal = new Modal(
|
||||
document.getElementById("addUserModal")
|
||||
);
|
||||
addUserModal.show();
|
||||
},
|
||||
deletePermission(user_group_id) {
|
||||
//Update variable
|
||||
this.permissionDeleteId = user_group_id;
|
||||
|
||||
//Open Modal
|
||||
const permissionDeleteModal = new Modal(
|
||||
document.getElementById('confirmPermissionDeleteModal')
|
||||
)
|
||||
permissionDeleteModal.show();
|
||||
},
|
||||
isTeamLeader(username /* As an ID*/) {
|
||||
//Get count of the data from userListResults, where username and group_leader == true
|
||||
const count = this.userListResults.filter((row) => {
|
||||
return row.username === username && row.group_leader;
|
||||
}).length;
|
||||
|
||||
//If length > 0, return true
|
||||
return count > 0;
|
||||
},
|
||||
removePermission(user_group_id) {
|
||||
this.localListResults = this.localListResults.filter((row) => {
|
||||
return row.user_group_id !== user_group_id;
|
||||
});
|
||||
},
|
||||
updateGroupLeader(event) {
|
||||
//Notify the user of updating the group leader
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Updating Team Leader Status",
|
||||
message: "Currently updating team leader status. Please wait",
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
unique_type: "update_group_leader",
|
||||
});
|
||||
|
||||
//Get if the checkbox is ticked or not
|
||||
const group_leader = event.target.checked;
|
||||
|
||||
// Send to the backend
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("group_leader", group_leader);
|
||||
data_to_send.set("username", event.target.dataset.user);
|
||||
|
||||
//Case specific data
|
||||
if (
|
||||
this.destination === "group" ||
|
||||
this.destination === "user"
|
||||
) {
|
||||
data_to_send.set("group", event.target.dataset.group);
|
||||
} else if (this.destination === "permission_set") {
|
||||
data_to_send.set(
|
||||
"permission_set",
|
||||
event.target.dataset.permissionSet
|
||||
);
|
||||
}
|
||||
|
||||
this.axios.post(
|
||||
`/update_group_leader_status/${this.destination}/`,
|
||||
data_to_send
|
||||
).then((response) => {
|
||||
//Updated data
|
||||
this.localListResults = response.data;
|
||||
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Updated Team Leader Status",
|
||||
message: "Updated team leader status.",
|
||||
extra_classes: "bg-success",
|
||||
unique_type: "update_group_leader",
|
||||
});
|
||||
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error updating group leader",
|
||||
message: `Sorry, we could not update group leader. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
195
NearBeach/src/js/components/card_information/AddUserToCard.vue
Normal file
195
NearBeach/src/js/components/card_information/AddUserToCard.vue
Normal file
@@ -0,0 +1,195 @@
|
||||
<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 To Card
|
||||
</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
|
||||
kanban card.
|
||||
</p>
|
||||
<p class="text-instructions">
|
||||
Please note: A user's group has to be added to
|
||||
the kanban card 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 kanban card
|
||||
</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"
|
||||
@click="closeModal"
|
||||
>
|
||||
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";
|
||||
import {Modal} from "bootstrap";
|
||||
|
||||
//VueX
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "AddUserToCard",
|
||||
components: {
|
||||
NSelect,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
userFixList: [],
|
||||
userModel: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
cardId: "getCardId",
|
||||
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() {
|
||||
//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/kanban_card/${this.cardId}/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,
|
||||
})
|
||||
|
||||
//Reshow the card information modal
|
||||
const cardModal = new Modal(
|
||||
document.getElementById("cardInformationModal")
|
||||
);
|
||||
cardModal.show();
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error adding user to kanban card",
|
||||
message: `Sorry, we could not add the user to the kanban card. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
closeModal() {
|
||||
//Close the modal
|
||||
document.getElementById("addUserCloseButton").click();
|
||||
|
||||
//Reshow the card information modal
|
||||
const cardModal = new Modal(
|
||||
document.getElementById("cardInformationModal")
|
||||
);
|
||||
cardModal.show();
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
128
NearBeach/src/js/components/card_information/CardDescription.vue
Normal file
128
NearBeach/src/js/components/card_information/CardDescription.vue
Normal file
@@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<div>
|
||||
<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="cardDescription"
|
||||
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,
|
||||
}"
|
||||
:disabled="editorIsDisabled"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
|
||||
<div
|
||||
v-if="userLevel > 1"
|
||||
class="row"
|
||||
>
|
||||
<div class="col-md-12">
|
||||
<button
|
||||
class="btn btn-warning"
|
||||
@click="closeModal"
|
||||
>
|
||||
Close & Discard Changes
|
||||
</button>
|
||||
<button
|
||||
v-if="kanbanStatus !== 'Closed'"
|
||||
class="btn btn-primary save-changes"
|
||||
@click="updateCard(true)"
|
||||
>
|
||||
Save & Close
|
||||
</button>
|
||||
<button
|
||||
v-if="kanbanStatus !== 'Closed'"
|
||||
class="btn btn-success save-changes"
|
||||
@click="updateCard(false)"
|
||||
>
|
||||
Save & Continue
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//TinyMce
|
||||
import Editor from "@tinymce/tinymce-vue";
|
||||
|
||||
//VueX
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
import {useUploadImage} from "Composables/uploads/useUploadImage";
|
||||
|
||||
export default {
|
||||
name: "CardDescription",
|
||||
components: {
|
||||
editor: Editor,
|
||||
},
|
||||
props: {},
|
||||
emits: [
|
||||
"update_card",
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
editorIsDisabled: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
contentCss: "getContentCss",
|
||||
kanbanStatus: "getKanbanStatus",
|
||||
skin: "getSkin",
|
||||
userLevel: "getUserLevel",
|
||||
}),
|
||||
cardDescription: {
|
||||
get() {
|
||||
return this.$store.state.card.cardDescription;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit("updateValue", {
|
||||
field: "cardDescription",
|
||||
value,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
//BUG - if we use the following condition it won't work. We need to wait at least 500ms before apply it.
|
||||
//I hate this :'(
|
||||
setTimeout(() => {
|
||||
this.editorIsDisabled = this.kanbanStatus === "Closed" || this.userLevel <= 1;
|
||||
}, 500);
|
||||
},
|
||||
methods: {
|
||||
useUploadImage,
|
||||
closeModal() {
|
||||
document
|
||||
.getElementById("cardInformationModalCloseButton")
|
||||
.click();
|
||||
},
|
||||
updateCard(close_modal) {
|
||||
this.$emit("update_card", {
|
||||
close_modal,
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
362
NearBeach/src/js/components/card_information/CardDetails.vue
Normal file
362
NearBeach/src/js/components/card_information/CardDetails.vue
Normal file
@@ -0,0 +1,362 @@
|
||||
<template>
|
||||
<div>
|
||||
<div
|
||||
v-if="cardLink.id !== undefined && cardLink.id !== null"
|
||||
class="row link-to-object"
|
||||
>
|
||||
<strong>Object Link: </strong>
|
||||
<a
|
||||
:href="cardLink.hyperlink"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{{ cardLink.type }} - {{ cardLink.id }}
|
||||
</a>
|
||||
</div>
|
||||
<hr v-if="cardLink.id !== undefined && cardLink.id !== null"/>
|
||||
|
||||
<!-- Card Text -->
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Card Title</strong>
|
||||
<p class="text-instructions">
|
||||
Write an appropriate name for the kanban card. To update
|
||||
click on the "Update" button.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<label>Card Title</label>
|
||||
<input
|
||||
v-model="cardTitle"
|
||||
class="form-control"
|
||||
:disabled="userLevel<=1"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Card Priority</strong>
|
||||
<p class="text-instructions">
|
||||
Define what the priority of the card is.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label>Card Priority</label>
|
||||
<n-select
|
||||
v-model:value="cardPriority"
|
||||
:options="listPriority"
|
||||
:disabled="kanbanStatus === 'Closed' || userLevel <= 1"
|
||||
></n-select>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
|
||||
<!-- CARD LOCATION -->
|
||||
<div 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="cardColumn"
|
||||
:options="listColumns"
|
||||
label="column"
|
||||
:disabled="kanbanStatus === 'Closed' || userLevel <= 1"
|
||||
></n-select>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 mt-4">
|
||||
<label>Card Level</label>
|
||||
<n-select
|
||||
v-model:value="cardLevel"
|
||||
:options="listLevels"
|
||||
label="level"
|
||||
:disabled="kanbanStatus === 'Closed' || userLevel <= 1"
|
||||
></n-select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Card Dates</strong>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
Creation Date
|
||||
<p class="text-instructions">
|
||||
{{useNiceDatetime(dateCreated)}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
Last Modified Date
|
||||
<p class="text-instructions">
|
||||
{{useNiceDatetime(dateModified)}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr v-if="userLevel > 1"/>
|
||||
<div
|
||||
v-if="userLevel > 1"
|
||||
class="row"
|
||||
>
|
||||
<div class="col-md-12 card-detail--buttons">
|
||||
<button
|
||||
class="btn btn-warning"
|
||||
@click="closeModal"
|
||||
>
|
||||
Close & Discard Changes
|
||||
</button>
|
||||
<button
|
||||
v-if="kanbanStatus !== 'Closed'"
|
||||
class="btn btn-danger archive-card"
|
||||
@click="archiveCard"
|
||||
>
|
||||
Archive Card
|
||||
</button>
|
||||
<button
|
||||
v-if="kanbanStatus !== 'Closed'"
|
||||
class="btn btn-primary save-changes"
|
||||
@click="updateCard(true)"
|
||||
>
|
||||
Save & Close
|
||||
</button>
|
||||
<button
|
||||
v-if="kanbanStatus !== 'Closed'"
|
||||
class="btn btn-success save-changes"
|
||||
@click="updateCard(false)"
|
||||
>
|
||||
Save & Continue
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {NSelect} from "naive-ui";
|
||||
import {mapGetters} from "vuex";
|
||||
import {Modal} from "bootstrap";
|
||||
|
||||
//Composables
|
||||
import { useNiceDatetime } from "Composables/datetime/useNiceDatetime";
|
||||
|
||||
export default {
|
||||
name: "CardDetails",
|
||||
components: {
|
||||
NSelect,
|
||||
},
|
||||
emits: [
|
||||
"update_card",
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
listPriority: [
|
||||
{
|
||||
label: "Highest",
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: "High",
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: "Normal",
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: "Low",
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: "Lowest",
|
||||
value: 4,
|
||||
},
|
||||
],
|
||||
tempModel: "",
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
cardId: "getCardId",
|
||||
cardLink: "getCardLink",
|
||||
dateCreated: "getDateCreated",
|
||||
dateModified: "getDateModified",
|
||||
kanbanStatus: "getKanbanStatus",
|
||||
listColumns: "getListColumns",
|
||||
listLevels: "getListLevels",
|
||||
userLevel: "getUserLevel",
|
||||
}),
|
||||
cardColumn: {
|
||||
get() {
|
||||
return this.$store.state.card.cardColumn;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit({
|
||||
type: "updateValue",
|
||||
field: "cardColumn",
|
||||
value,
|
||||
});
|
||||
},
|
||||
},
|
||||
cardLevel: {
|
||||
get() {
|
||||
return this.$store.state.card.cardLevel;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit({
|
||||
type: "updateValue",
|
||||
field: "cardLevel",
|
||||
value,
|
||||
});
|
||||
},
|
||||
},
|
||||
cardPriority: {
|
||||
get() {
|
||||
return this.$store.state.card.cardPriority;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit({
|
||||
type: "updateValue",
|
||||
field: "cardPriority",
|
||||
value,
|
||||
});
|
||||
},
|
||||
},
|
||||
cardTitle: {
|
||||
get() {
|
||||
return this.$store.state.card.cardTitle;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit({
|
||||
type: "updateValue",
|
||||
field: "cardTitle",
|
||||
value,
|
||||
});
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
archiveCard() {
|
||||
//Close the current modal
|
||||
document
|
||||
.getElementById("cardInformationModalCloseButton")
|
||||
.click();
|
||||
|
||||
//Open up the archive card modal
|
||||
const confirmCardArchive = new Modal(
|
||||
"#confirmCardArchiveModal"
|
||||
);
|
||||
confirmCardArchive.show();
|
||||
},
|
||||
closeModal() {
|
||||
document
|
||||
.getElementById("cardInformationModalCloseButton")
|
||||
.click();
|
||||
},
|
||||
async differentDestination(close_modal, old_card) {
|
||||
//The card is assumed to be placed at the end of the new destination. So lets look up how many cards are there
|
||||
//and then use that number
|
||||
const new_index = this.$store.getters.getCardsOrder(this.cardColumn, this.cardLevel).length;
|
||||
|
||||
//Create the EVENT object for VueX
|
||||
const event = {
|
||||
to: {
|
||||
dataset: {
|
||||
column: this.cardColumn,
|
||||
level: this.cardLevel,
|
||||
},
|
||||
},
|
||||
from: {
|
||||
dataset: {
|
||||
column: old_card.kanban_column,
|
||||
level: old_card.kanban_level,
|
||||
}
|
||||
},
|
||||
item: {
|
||||
dataset: {
|
||||
cardId: this.cardId,
|
||||
cardPriority: this.cardPriority,
|
||||
}
|
||||
},
|
||||
newIndex: new_index,
|
||||
};
|
||||
|
||||
//Send this information up to vueX :)
|
||||
//VueX will move everything around for us - like we have moved the card manually
|
||||
await this.$store.dispatch("kanbanCardMoved", {
|
||||
event,
|
||||
});
|
||||
|
||||
//Now we get the new destination and old destination
|
||||
const new_destination = this.$store.getters.getCardsOrder(this.cardColumn, this.cardLevel);
|
||||
const old_destination = this.$store.getters.getCardsOrder(
|
||||
old_card.kanban_column,
|
||||
old_card.kanban_level
|
||||
).filter((row) => {
|
||||
//We don't want the old destination to have the card id...
|
||||
return parseInt(row.pk) !== parseInt(this.cardId);
|
||||
});
|
||||
|
||||
//Tell the parent node that we have updated the data
|
||||
this.$emit("update_card", {
|
||||
close_modal,
|
||||
new_destination,
|
||||
old_destination,
|
||||
});
|
||||
},
|
||||
sameDestination(close_modal) {
|
||||
//Update the card title
|
||||
this.$store.commit({
|
||||
type: "updateKanbanCard",
|
||||
card_id: this.cardId,
|
||||
kanban_card_text: this.cardTitle,
|
||||
kanban_card_priority: this.cardPriority,
|
||||
});
|
||||
|
||||
//Tell the parent node that we have updated the data
|
||||
this.$emit("update_card", {
|
||||
close_modal,
|
||||
});
|
||||
},
|
||||
updateCard(close_modal) {
|
||||
/* METHOD
|
||||
* ~~~~~~
|
||||
* 1. Determine if there is a change in either column/level
|
||||
* 2. If no change - just send back basic information to save
|
||||
* 3.
|
||||
*/
|
||||
|
||||
//Get the old card information
|
||||
const old_card = this.$store.getters.getCard(this.cardId);
|
||||
|
||||
//Determine if we are changing levels or columns
|
||||
const condition_1 = parseInt(this.cardColumn) === parseInt(old_card.kanban_column);
|
||||
const condition_2 = parseInt(this.cardLevel) === parseInt(old_card.kanban_level);
|
||||
|
||||
//If there are no changes - just send the data upstream
|
||||
if (condition_1 && condition_2) {
|
||||
this.sameDestination(close_modal)
|
||||
} else {
|
||||
this.differentDestination(close_modal, old_card);
|
||||
}
|
||||
},
|
||||
useNiceDatetime,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
345
NearBeach/src/js/components/card_information/CardInformation.vue
Normal file
345
NearBeach/src/js/components/card_information/CardInformation.vue
Normal file
@@ -0,0 +1,345 @@
|
||||
<template>
|
||||
<div
|
||||
id="cardInformationModal"
|
||||
class="modal fade"
|
||||
data-bs-backdrop="static"
|
||||
data-bs-keyboard="false"
|
||||
tabindex="-1"
|
||||
aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog modal-xl modal-fullscreen-xl-down">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2>
|
||||
Card Information - {{ cardId }}
|
||||
</h2>
|
||||
<button
|
||||
id="cardInformationModalCloseButton"
|
||||
type="button"
|
||||
class="btn-close"
|
||||
data-bs-dismiss="modal"
|
||||
aria-label="Close"
|
||||
>
|
||||
<span aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body mt-4">
|
||||
<!-- TAB MENU -->
|
||||
<ul
|
||||
id="card_information_tabs"
|
||||
class="nav nav-tabs"
|
||||
role="tablist"
|
||||
>
|
||||
<li
|
||||
class="nav-item"
|
||||
role="presentation"
|
||||
>
|
||||
<button
|
||||
id="details-tab"
|
||||
class="nav-link active"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#card_details"
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-controls="home"
|
||||
aria-selected="true"
|
||||
>
|
||||
Details
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="nav-item"
|
||||
role="presentation"
|
||||
>
|
||||
<button
|
||||
id="description-tab"
|
||||
class="nav-link"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#card_description"
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-controls="profile"
|
||||
aria-selected="false"
|
||||
>
|
||||
Description
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="nav-item"
|
||||
role="presentation"
|
||||
>
|
||||
<button
|
||||
id="notes-tab"
|
||||
class="nav-link"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#card_notes"
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-controls="contact"
|
||||
aria-selected="false"
|
||||
>
|
||||
Notes
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="nav-item"
|
||||
role="presentation"
|
||||
>
|
||||
<button
|
||||
id="users-tab"
|
||||
class="nav-link"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#user_permissions"
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-controls="contact"
|
||||
aria-selected="false"
|
||||
>
|
||||
Users
|
||||
</button>
|
||||
</li>
|
||||
<li
|
||||
class="nav-item"
|
||||
role="presentation"
|
||||
>
|
||||
<button
|
||||
id="downloads-tab"
|
||||
class="nav-link"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#downloads"
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-controls="contact"
|
||||
aria-selected="false"
|
||||
>
|
||||
Downloads
|
||||
</button>
|
||||
</li>
|
||||
<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="contact"
|
||||
aria-selected="false"
|
||||
>
|
||||
Misc
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<hr/>
|
||||
|
||||
<!-- CONTENT OF TABS -->
|
||||
<div
|
||||
id="myTabContent"
|
||||
class="tab-content"
|
||||
>
|
||||
<div
|
||||
id="card_details"
|
||||
class="tab-pane fade show active"
|
||||
role="tabpanel"
|
||||
aria-labelledby="details-tab"
|
||||
>
|
||||
<card-details
|
||||
@update_card="updateCard($event)"
|
||||
></card-details>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="card_description"
|
||||
class="tab-pane fade"
|
||||
role="tabpanel"
|
||||
aria-labelledby="description-tab"
|
||||
>
|
||||
<card-description
|
||||
@update_card="updateCard($event)"
|
||||
></card-description>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="card_notes"
|
||||
class="tab-pane fade"
|
||||
role="tabpanel"
|
||||
aria-labelledby="notes-tab"
|
||||
>
|
||||
<card-notes></card-notes>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="user_permissions"
|
||||
class="tab-pane fade"
|
||||
role="tabpanel"
|
||||
aria-labelledby="user-tab"
|
||||
>
|
||||
<card-users></card-users>
|
||||
</div>
|
||||
<div
|
||||
id="downloads"
|
||||
class="tab-pane fade"
|
||||
role="tabpanel"
|
||||
aria-labelledby="user-tab"
|
||||
>
|
||||
<documents-module
|
||||
override-destination="kanban_card"
|
||||
:override-location-id="cardId"
|
||||
:read-only="kanbanStatus === 'Closed'"
|
||||
></documents-module>
|
||||
</div>
|
||||
<div
|
||||
id="misc"
|
||||
class="tab-pane fade"
|
||||
role="tabpanel"
|
||||
aria-labelledby="user-tab"
|
||||
>
|
||||
<list-tags-module
|
||||
override-destination="kanban_card"
|
||||
close-modal-before="cardInformationModalCloseButton"
|
||||
:override-location-id="cardId"
|
||||
></list-tags-module>
|
||||
|
||||
<list-public-links
|
||||
override-destination="kanban_card"
|
||||
:override-location-id="cardId"
|
||||
:is-read-only="kanbanStatus === 'Closed'"
|
||||
></list-public-links>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CardDetails from "./CardDetails.vue";
|
||||
import CardNotes from "./CardNotes.vue";
|
||||
import CardDescription from "./CardDescription.vue";
|
||||
import CardUsers from "./CardUsers.vue";
|
||||
import DocumentsModule from 'Modules/sub_modules/DocumentsModule.vue';
|
||||
import ListPublicLinks from "Modules/sub_modules/ListPublicLinks.vue";
|
||||
|
||||
//VueX
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
import ListTagsModule from "Modules/sub_modules/ListTagsModule.vue";
|
||||
|
||||
export default {
|
||||
name: "CardInformation",
|
||||
components: {
|
||||
ListTagsModule,
|
||||
CardDescription,
|
||||
CardDetails,
|
||||
CardNotes,
|
||||
CardUsers,
|
||||
DocumentsModule,
|
||||
ListPublicLinks,
|
||||
},
|
||||
emits: [
|
||||
'update_card',
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
cardDescriptionModel: "",
|
||||
cardNoteModel: "",
|
||||
cardTitleModel: "",
|
||||
noteHistoryResults: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
cardId: "getCardId",
|
||||
kanbanStatus: "getKanbanStatus",
|
||||
rootUrl: "getRootUrl",
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
updateCard(data) {
|
||||
//Notify the user we are updating the card
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Updating Current Card",
|
||||
message: "Please wait - we are updating the card's information",
|
||||
extra_classes: "bg-warning text-dark",
|
||||
unique_type: "update-card",
|
||||
delay: 0,
|
||||
});
|
||||
|
||||
//Get all data from VueX
|
||||
const all_data = this.$store.getters.getAllCardData;
|
||||
|
||||
//Setup data_to_send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("kanban_card_text", all_data.cardTitle);
|
||||
data_to_send.set(
|
||||
"kanban_card_description",
|
||||
all_data.cardDescription
|
||||
);
|
||||
data_to_send.set("kanban_level", all_data.cardLevel);
|
||||
data_to_send.set("kanban_column", all_data.cardColumn);
|
||||
data_to_send.set("kanban_card_id", all_data.cardId);
|
||||
data_to_send.set("kanban_card_priority", all_data.cardPriority);
|
||||
|
||||
//If there is new_destination or old_destination, we want to send that data into the backend too
|
||||
if (data.new_destination !== undefined) {
|
||||
data.new_destination.forEach((row) => {
|
||||
data_to_send.append("new_destination", row.kanban_card_id);
|
||||
});
|
||||
}
|
||||
|
||||
if (data.old_destination !== undefined) {
|
||||
data.old_destination.forEach((row) => {
|
||||
data_to_send.append("old_destination", row.kanban_card_id);
|
||||
});
|
||||
}
|
||||
|
||||
//Use Axios to send data to backend
|
||||
this.axios.post(
|
||||
`${this.rootUrl}kanban_information/update_card/`,
|
||||
data_to_send
|
||||
).then(() => {
|
||||
//Send the new data upstream
|
||||
this.$emit("update_card", {
|
||||
kanban_card_id: all_data.cardId,
|
||||
kanban_card_text: all_data.cardTitle,
|
||||
kanban_card_description:
|
||||
all_data.cardDescription,
|
||||
// kanban_column: all_data.cardColumn,
|
||||
// kanban_level: all_data.cardLevel,
|
||||
// kanban_card_priority: all_data.cardPriority,
|
||||
});
|
||||
|
||||
//Notify user of successful update
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Card successfully updated",
|
||||
message: "Your card has successfully update",
|
||||
extra_classes: "bg-success",
|
||||
unique_type: "update-card",
|
||||
});
|
||||
|
||||
//Only close if data.close_modal is true
|
||||
if (data.close_modal) {
|
||||
document
|
||||
.getElementById("cardInformationModalCloseButton")
|
||||
.click();
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Card failed to updated",
|
||||
message: `Sorry your card failed to update - error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
unique_type: "update-card",
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
151
NearBeach/src/js/components/card_information/CardNotes.vue
Normal file
151
NearBeach/src/js/components/card_information/CardNotes.vue
Normal file
@@ -0,0 +1,151 @@
|
||||
<template>
|
||||
<div>
|
||||
<div
|
||||
v-if="userLevel > 1 || hasNotePermission"
|
||||
class="row"
|
||||
>
|
||||
<div class="col-md-4">
|
||||
<strong>Notes</strong>
|
||||
<p class="text-instructions">
|
||||
To add a note - type your note in the Note Box and hit the
|
||||
"Submit Note" button.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<label>Note Box</label>
|
||||
<editor
|
||||
v-model="cardNoteModel"
|
||||
license-key="gpl"
|
||||
:init="{
|
||||
license_key: 'gpl',
|
||||
height: 250,
|
||||
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,
|
||||
}"
|
||||
:disabled="kanbanStatus === 'Closed'"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<hr v-if="userLevel > 1 || hasNotePermission"/>
|
||||
<div
|
||||
v-if="userLevel > 1 || hasNotePermission"
|
||||
class="row"
|
||||
>
|
||||
<div class="col-md-12">
|
||||
<button
|
||||
class="btn btn-secondary"
|
||||
@click="closeModal"
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-primary save-changes"
|
||||
:disabled="cardNoteModel === ''"
|
||||
@click="addNote"
|
||||
>
|
||||
Add Note
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<hr v-if="userLevel > 1 || hasNotePermission"/>
|
||||
|
||||
<!-- NOTE HISTORY -->
|
||||
<list-notes
|
||||
:note-history-results="cardNotes"
|
||||
destination="card"
|
||||
></list-notes>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Editor from "@tinymce/tinymce-vue";
|
||||
import ListNotes from "Modules/sub_modules/ListNotes.vue";
|
||||
|
||||
//VueX
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "CardNotes",
|
||||
components: {
|
||||
editor: Editor,
|
||||
ListNotes,
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
cardNoteModel: "",
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
cardNotes: "getCardNotes",
|
||||
contentCss: "getContentCss",
|
||||
kanbanStatus: "getKanbanStatus",
|
||||
rootUrl: "getRootUrl",
|
||||
skin: "getSkin",
|
||||
userLevel: "getUserLevel",
|
||||
}),
|
||||
...mapGetters([
|
||||
"getUserExtraPermission",
|
||||
]),
|
||||
hasNotePermission() {
|
||||
return this.getUserExtraPermission("kanban_note");
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
addNote() {
|
||||
//Create the data_to_send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("note", this.cardNoteModel);
|
||||
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Adding Note",
|
||||
message: "Currently adding note to object",
|
||||
extra_classes: "bg-warning",
|
||||
delay: 0,
|
||||
unique_type: "adding_note",
|
||||
});
|
||||
|
||||
//Use axios to send the data
|
||||
this.axios.post(
|
||||
`${this.rootUrl}object_data/kanban_card/${this.$store.state.card.cardId}/add_notes/`,
|
||||
data_to_send
|
||||
).then((response) => {
|
||||
//Add the response to the end of the noteHistoryResults
|
||||
this.$store.commit({
|
||||
type: "addNote",
|
||||
newNote: response.data[0],
|
||||
});
|
||||
|
||||
//Clear the card note model
|
||||
this.cardNoteModel = "";
|
||||
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Successfully Added Note",
|
||||
message: "Successfully Added Note to Object",
|
||||
extra_classes: "bg-success",
|
||||
unique_type: "adding_note",
|
||||
});
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Can't add Note",
|
||||
message: `Sorry, we could not add a note for you. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
unique_type: "adding_note",
|
||||
});
|
||||
});
|
||||
},
|
||||
closeModal() {
|
||||
document
|
||||
.getElementById("cardInformationModalCloseButton")
|
||||
.click();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
87
NearBeach/src/js/components/card_information/CardUsers.vue
Normal file
87
NearBeach/src/js/components/card_information/CardUsers.vue
Normal file
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<render-user-card-list
|
||||
:object-user-list="objectUserList"
|
||||
@remove_user="removeUser"
|
||||
></render-user-card-list>
|
||||
|
||||
<div
|
||||
v-if="userLevel > 1 && kanbanBoardStatus !== 'Closed'"
|
||||
class="row mt-3"
|
||||
>
|
||||
<div class="col-md-12">
|
||||
<button
|
||||
class="btn btn-primary"
|
||||
@click="addUser"
|
||||
>
|
||||
Add User
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {Modal} from "bootstrap";
|
||||
|
||||
//Vuex components
|
||||
import {mapGetters} from "vuex";
|
||||
import RenderUserCardList from "Components/render/RenderUserCardList.vue";
|
||||
|
||||
export default {
|
||||
name: "CardUsers",
|
||||
components: {
|
||||
RenderUserCardList,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
cardId: "getCardId",
|
||||
kanbanBoardStatus: "getKanbanStatus",
|
||||
locationId: "getLocationId",
|
||||
rootUrl: "getRootUrl",
|
||||
staticUrl: "getStaticUrl",
|
||||
userLevel: "getUserLevel",
|
||||
objectUserList: "getObjectUserList",
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
addUser() {
|
||||
//Close the current modal
|
||||
document
|
||||
.getElementById("cardInformationModalCloseButton")
|
||||
.click();
|
||||
|
||||
//Open the user wizard model
|
||||
const addUserWizard = new Modal("#addUserModal");
|
||||
addUserWizard.show();
|
||||
},
|
||||
profilePicture(picture_uuid) {
|
||||
if (picture_uuid !== null && picture_uuid !== "") {
|
||||
return `${this.rootUrl}private/${picture_uuid}/`;
|
||||
}
|
||||
|
||||
return `${this.staticUrl}NearBeach/images/placeholder/people_tax.svg`;
|
||||
},
|
||||
removeUser(username) {
|
||||
//Data to send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("username", username);
|
||||
|
||||
//Axios
|
||||
this.axios
|
||||
.post(
|
||||
`${this.rootUrl}object_data/kanban_card/${this.cardId}/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,
|
||||
})
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,434 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1>Change Task - {{ changeTaskResults[0].pk }}</h1>
|
||||
<br/>
|
||||
RFC Status: {{ rfcStatus }}
|
||||
<br/>
|
||||
<a
|
||||
:href="`${rootUrl}rfc_information/${changeTaskResults[0].fields.request_for_change}`"
|
||||
>Go back</a
|
||||
>
|
||||
<hr/>
|
||||
|
||||
<!-- CHANGE TASK TITLE -->
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Change Task Title</strong>
|
||||
<p class="text-instructions">
|
||||
Please write a short title of the description for this
|
||||
task. i.e Backup of Database
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label>Change Title:</label>
|
||||
<input
|
||||
v-model="changeTitleModel"
|
||||
type="text"
|
||||
class="form-control"
|
||||
:disabled="isReadOnly"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- NOTIFY USERS OF DATE RESTRICTIONS -->
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Date Restrictions</strong>
|
||||
<p class="text-instructions">
|
||||
Start and End dates of the RFC
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
Start Date: <span>{{ formatDate(rfcStartDate) }}</span>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
End Date: <span>{{ formatDate(rfcEndDate) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- START DATE & END DATE -->
|
||||
<hr/>
|
||||
<between-dates
|
||||
destination="Change Task"
|
||||
:start-date-model="changeStartDateModel"
|
||||
:end-date-model="changeEndDateModel"
|
||||
:no-back-dating="false"
|
||||
:is-read-only="isReadOnly"
|
||||
@update_dates="updateDates($event)"
|
||||
></between-dates>
|
||||
|
||||
<!-- IMPLEMENTATION USER & QA USER -->
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Implementation & QA User</strong>
|
||||
<p class="text-instructions">
|
||||
Please indicate which user will be implementing the
|
||||
work, and the user who will QA.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>Implementation User</label>
|
||||
<n-select
|
||||
v-model:value="assignedUserModel"
|
||||
:options="userListFixed"
|
||||
:disabled="isReadOnly"
|
||||
></n-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>QA User</label>
|
||||
<n-select
|
||||
v-model:value="qaUserModel"
|
||||
:options="userListFixed"
|
||||
:disabled="isReadOnly"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- GO BACK -->
|
||||
<hr v-if="userLevel > 1"/>
|
||||
<!-- CANCEL -->
|
||||
<a
|
||||
v-if="userLevel > 1"
|
||||
:href="`${rootUrl}rfc_information/${changeTaskResults[0].fields.request_for_change}/`"
|
||||
class="btn btn-secondary cancel-changes"
|
||||
>Cancel</a
|
||||
>
|
||||
|
||||
<!-- DELETE -->
|
||||
<a
|
||||
v-if="
|
||||
changeTaskResults[0].fields.change_task_status == 1 &&
|
||||
userLevel == 4
|
||||
"
|
||||
href="javascript:void(0)"
|
||||
class="btn btn-warning"
|
||||
@click="confirmDeleteChangeTask"
|
||||
>Delete</a
|
||||
>
|
||||
|
||||
<!-- SAVE -->
|
||||
<a
|
||||
v-if="
|
||||
changeTaskResults[0].fields.change_task_status == 1 &&
|
||||
userLevel >= 2
|
||||
"
|
||||
href="javascript:void(0)"
|
||||
class="btn btn-primary save-changes"
|
||||
@click="saveChangeTask"
|
||||
>Save</a
|
||||
>
|
||||
|
||||
<!-- START CHANGE TASK -->
|
||||
<a
|
||||
v-if="
|
||||
changeTaskResults[0].fields.change_task_status == 3 &&
|
||||
userLevel >= 2 &&
|
||||
rfcStatus === 'Started'
|
||||
"
|
||||
href="javascript:void(0)"
|
||||
class="btn btn-danger save-changes"
|
||||
@click="updateStatus(4)"
|
||||
>Start Task</a
|
||||
>
|
||||
|
||||
<!-- FINISH CHANGE TASK -->
|
||||
<a
|
||||
v-if="
|
||||
changeTaskResults[0].fields.change_task_status == 4 &&
|
||||
userLevel >= 2
|
||||
"
|
||||
href="javascript:void(0)"
|
||||
class="btn btn-success save-changes"
|
||||
@click="updateStatus(5)"
|
||||
>Finish Task</a
|
||||
>
|
||||
|
||||
<!-- REJECT CHANGE TASK -->
|
||||
<a
|
||||
v-if="
|
||||
changeTaskResults[0].fields.change_task_status == 4 &&
|
||||
userLevel >= 2
|
||||
"
|
||||
href="javascript:void(0)"
|
||||
class="btn btn-danger save-changes"
|
||||
@click="updateStatus(6)"
|
||||
>REJECT Task</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<confirm-change-task-delete
|
||||
:change-task-results="changeTaskResults"
|
||||
></confirm-change-task-delete>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//Widgets
|
||||
import BetweenDates from "Components/dates/BetweenDates.vue";
|
||||
import {NSelect} from "naive-ui";
|
||||
import {Modal} from "bootstrap";
|
||||
|
||||
//Vuex
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
//Components
|
||||
import ConfirmChangeTaskDelete from "./modules/ConfirmChangeTaskDelete.vue";
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
|
||||
export default {
|
||||
name: "ChangeTaskInformation",
|
||||
components: {
|
||||
BetweenDates,
|
||||
ConfirmChangeTaskDelete,
|
||||
NSelect,
|
||||
},
|
||||
props: {
|
||||
changeTaskResults: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
destination: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
locationId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
rfcStatus: {
|
||||
type: String,
|
||||
default: "Empty Status",
|
||||
},
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
staticUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
userLevel: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
userList: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
assignedUserModel: this.changeTaskResults[0].fields.change_task_assigned_user,
|
||||
changeTitleModel: this.changeTaskResults[0].fields.change_task_title,
|
||||
changeStartDateModel: new Date(
|
||||
this.changeTaskResults[0].fields.change_task_start_date
|
||||
).getTime(),
|
||||
changeEndDateModel: new Date(
|
||||
this.changeTaskResults[0].fields.change_task_end_date
|
||||
).getTime(),
|
||||
isReadOnly: false,
|
||||
qaUserModel: this.changeTaskResults[0].fields.change_task_qa_user,
|
||||
userListFixed: this.userList.map((row) => {
|
||||
return {
|
||||
label: `${row.username}: ${row.first_name} ${row.last_name}`,
|
||||
value: row.id,
|
||||
};
|
||||
}),
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
rfcEndDate: "getEndDate",
|
||||
rfcStartDate: "getStartDate",
|
||||
}),
|
||||
},
|
||||
mounted() {
|
||||
//Send data to required VueX states
|
||||
this.$store.commit({
|
||||
type: "updateDestination",
|
||||
destination: this.destination,
|
||||
locationId: this.locationId,
|
||||
});
|
||||
this.$store.commit({
|
||||
type: "updateTitle",
|
||||
title: this.changeTitleModel,
|
||||
});
|
||||
this.$store.commit({
|
||||
type: "updateUrl",
|
||||
rootUrl: this.rootUrl,
|
||||
staticUrl: this.staticUrl,
|
||||
});
|
||||
this.$store.commit({
|
||||
type: "updateUserLevel",
|
||||
userLevel: this.userLevel,
|
||||
});
|
||||
this.$store.commit({
|
||||
type: "updateChangeTask",
|
||||
description: this.changeTaskResults[0].fields.change_task_description,
|
||||
endDate: this.changeTaskResults[0].fields.change_task_end_date,
|
||||
isDowntime: this.changeTaskResults[0].fields.is_downtime,
|
||||
requiredBy: this.changeTaskResults[0].fields.change_task_required_by,
|
||||
startDate: this.changeTaskResults[0].fields.change_task_start_date,
|
||||
|
||||
});
|
||||
|
||||
//Set read only
|
||||
this.setReadOnly();
|
||||
},
|
||||
methods: {
|
||||
useNBTheme,
|
||||
confirmDeleteChangeTask() {
|
||||
const modal = new Modal(document.getElementById("confirmChangeTaskDeleteModal"));
|
||||
modal.show();
|
||||
},
|
||||
formatDate(date) {
|
||||
//Setup the date
|
||||
let new_date = new Date(date);
|
||||
|
||||
//Split the date into date vs time
|
||||
new_date = new_date.toISOString().split("T");
|
||||
|
||||
//Split the time
|
||||
const time_split = new_date[1].split(".");
|
||||
|
||||
//Return the date as a string
|
||||
return `${new_date[0]} ${time_split[0]}`;
|
||||
},
|
||||
saveChangeTask(event) {
|
||||
//Stop the usual stuff
|
||||
event.preventDefault();
|
||||
|
||||
const change_task_seconds =
|
||||
this.changeEndDateModel - this.changeStartDateModel;
|
||||
|
||||
// Create data_to_send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("change_task_title", this.changeTitleModel);
|
||||
// data_to_send.set(
|
||||
// "change_task_description",
|
||||
// this.changeDescriptionModel
|
||||
// );
|
||||
data_to_send.set(
|
||||
"change_task_start_date",
|
||||
new Date(this.changeStartDateModel).toISOString()
|
||||
);
|
||||
data_to_send.set(
|
||||
"change_task_end_date",
|
||||
new Date(this.changeEndDateModel).toISOString()
|
||||
);
|
||||
data_to_send.set(
|
||||
"change_task_seconds",
|
||||
change_task_seconds.toString()
|
||||
);
|
||||
data_to_send.set(
|
||||
"change_task_assigned_user",
|
||||
this.assignedUserModel
|
||||
);
|
||||
data_to_send.set("change_task_qa_user", this.qaUserModel);
|
||||
// data_to_send.set(
|
||||
// "change_task_required_by",
|
||||
// this.changeStakeholderModel
|
||||
// );
|
||||
// data_to_send.set("is_downtime", this.changeIsDowntimeModel);
|
||||
|
||||
this.axios
|
||||
.post(
|
||||
`${this.rootUrl}change_task_information/${this.changeTaskResults[0].pk}/save/`,
|
||||
data_to_send
|
||||
)
|
||||
.then(() => {
|
||||
//If successful, go back
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Saved Change Task",
|
||||
message: "Your change task has saved.",
|
||||
extra_classes: "bg-success",
|
||||
unique_type: "save",
|
||||
});
|
||||
//window.location.href = `${this.rootUrl}rfc_information/${this.changeTaskResults[0].fields.request_for_change}/`;
|
||||
})
|
||||
.catch(() => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Can not save",
|
||||
message: "Sorry, we could not save your change task",
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
setReadOnly() {
|
||||
//Is user has permissions <= 1 then read only
|
||||
if (this.userLevel <= 1) {
|
||||
this.isReadOnly = true;
|
||||
}
|
||||
|
||||
//If the status is not in draft - we don't want to edit
|
||||
if (this.rfcStatus.toLowerCase() !== "draft") {
|
||||
this.isReadOnly = true;
|
||||
}
|
||||
|
||||
//Update vuex
|
||||
this.$store.commit({
|
||||
type: "updateIsChangeTaskReadOnly",
|
||||
isChangeTaskReadOnly: this.isReadOnly,
|
||||
});
|
||||
},
|
||||
updateStatus(new_status) {
|
||||
//Setup data_to_send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("change_task_status", new_status);
|
||||
|
||||
//Use axios to send the data
|
||||
this.axios
|
||||
.post(
|
||||
`${this.rootUrl}change_task_update_status/${this.changeTaskResults[0].pk}/`,
|
||||
data_to_send
|
||||
)
|
||||
.then(() => {
|
||||
//Reload the page
|
||||
window.location.reload(true);
|
||||
})
|
||||
.catch(() => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Can not save",
|
||||
message: "Sorry, we could not save your change task",
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
updateDates(data) {
|
||||
this.changeStartDateModel = data.start_date;
|
||||
this.changeEndDateModel = data.end_date;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.save-changes {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
||||
140
NearBeach/src/js/components/change_task/ChangeTaskModules.vue
Normal file
140
NearBeach/src/js/components/change_task/ChangeTaskModules.vue
Normal file
@@ -0,0 +1,140 @@
|
||||
<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"
|
||||
>
|
||||
<!-- CHANGE TASK LINKS -->
|
||||
<li
|
||||
class="nav-item"
|
||||
role="presentation"
|
||||
>
|
||||
<button
|
||||
id="change-task-links-tab"
|
||||
class="nav-link active"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#change_task_links"
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-controls="home"
|
||||
aria-selected="true"
|
||||
>
|
||||
Change Task Links
|
||||
</button>
|
||||
</li>
|
||||
|
||||
<!-- DESCRIPTION -->
|
||||
<li
|
||||
class="nav-item"
|
||||
role="presentation"
|
||||
>
|
||||
<button
|
||||
id="description-tab"
|
||||
class="nav-link"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#description"
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-controls="home"
|
||||
aria-selected="true"
|
||||
>
|
||||
Description
|
||||
</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="true"
|
||||
>
|
||||
Misc
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<hr/>
|
||||
|
||||
<div
|
||||
id="misc_module_content"
|
||||
class="tab-content"
|
||||
>
|
||||
<div
|
||||
id="change_task_links"
|
||||
class="tab-pane fade active show"
|
||||
role="tabpanel"
|
||||
aria-labelledby="contact-tab"
|
||||
>
|
||||
<!-- <change-task-link-list-vue></change-task-link-list-vue>-->
|
||||
<change-task-link-list></change-task-link-list>
|
||||
</div>
|
||||
<div
|
||||
id="description"
|
||||
class="tab-pane fade"
|
||||
role="tabpanel"
|
||||
aria-labelledby="home-tab"
|
||||
>
|
||||
<change-task-description></change-task-description>
|
||||
</div>
|
||||
|
||||
<div
|
||||
id="misc"
|
||||
class="tab-pane fade"
|
||||
role="tabpanel"
|
||||
aria-labelledby="home-tab"
|
||||
>
|
||||
<change-task-misc></change-task-misc>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//Import components
|
||||
import ChangeTaskDescription from "./modules/ChangeTaskDescription.vue";
|
||||
import ChangeTaskLinkList from "./modules/ChangeTaskLinkList.vue";
|
||||
import ChangeTaskMisc from "./modules/ChangeTaskMisc.vue"
|
||||
|
||||
//Naive UI
|
||||
import { NConfigProvider } from "naive-ui";
|
||||
|
||||
//Composables
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
|
||||
export default {
|
||||
name: "ChangeTaskModules",
|
||||
components: {
|
||||
ChangeTaskDescription,
|
||||
ChangeTaskLinkList,
|
||||
ChangeTaskMisc,
|
||||
NConfigProvider,
|
||||
},
|
||||
props: {
|
||||
theme: {
|
||||
type: String,
|
||||
default: "light",
|
||||
}
|
||||
},
|
||||
beforeMount() {
|
||||
this.$store.dispatch("processThemeUpdate", {
|
||||
theme: this.theme,
|
||||
});
|
||||
},
|
||||
methods: {useNBTheme}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
420
NearBeach/src/js/components/change_task/NewChangeTask.vue
Normal file
420
NearBeach/src/js/components/change_task/NewChangeTask.vue
Normal file
@@ -0,0 +1,420 @@
|
||||
<template>
|
||||
<div
|
||||
id="newRunItemModal"
|
||||
class="modal fade"
|
||||
tabindex="-1"
|
||||
aria-labelledby="newRunItemModalLabel"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog modal-xl modal-fullscreen-xl-down">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2
|
||||
id="newRunItemModalLabel"
|
||||
class="modal-title"
|
||||
>
|
||||
New Change Task
|
||||
</h2>
|
||||
<button
|
||||
id="newRunItemCloseButton"
|
||||
type="button"
|
||||
class="btn-close"
|
||||
data-bs-dismiss="modal"
|
||||
aria-label="Close"
|
||||
>
|
||||
<span aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-if="currentStatus === 'uploading'"
|
||||
class="modal-body"
|
||||
>
|
||||
<div class="row">
|
||||
Currently Uploading Data...
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="modal-body"
|
||||
>
|
||||
<!-- CHANGE TASK TITLE -->
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Change Task Title</strong>
|
||||
<p class="text-instructions">
|
||||
Please write a short title of the description
|
||||
for this task. i.e Backup of Database
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label>
|
||||
Change Title:
|
||||
<validation-rendering
|
||||
:error-list="v$.changeTitleModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<input
|
||||
v-model="changeTitleModel"
|
||||
type="text"
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- START DATE & END DATE -->
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Between Dates</strong>
|
||||
<p class="text-instructions">
|
||||
Choose the start and end date of the Change Task. Please
|
||||
note the end date can not be earlier than the start date.
|
||||
The release date is the datetime where users now have
|
||||
access to what you just released.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>
|
||||
Start Date:
|
||||
<validation-rendering
|
||||
:error-list="v$.changeStartDateModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<n-date-picker
|
||||
v-model:value="changeStartDateModel"
|
||||
type="datetime"
|
||||
></n-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>
|
||||
End Date:
|
||||
<validation-rendering
|
||||
:error-list="v$.changeEndDateModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<n-date-picker
|
||||
v-model:value="changeEndDateModel"
|
||||
type="datetime"
|
||||
></n-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="changeStartDateModel < rfcStartDate"
|
||||
class="row"
|
||||
>
|
||||
<div class="spacer"></div>
|
||||
<div class="alert alert-info">
|
||||
Saving this change task will automatically update the start date for the RFC. The
|
||||
RFC's new date will reflect this current date time.
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="changeEndDateModel > rfcEndDate"
|
||||
class="row"
|
||||
>
|
||||
<div class="spacer"></div>
|
||||
<div class="alert alert-info">
|
||||
Saving this change task will automatically update the end date for the RFC. The
|
||||
RFC's new date will reflect this current date time.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- IMPLEMENTATION USER & QA USER -->
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Implementation & QA User</strong>
|
||||
<p class="text-instructions">
|
||||
Please indicate which user will be implementing
|
||||
the work, and the user who will QA.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>
|
||||
Implementation User
|
||||
<validation-rendering
|
||||
:error-list="v$.assignedUserModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<n-select
|
||||
v-model:value="assignedUserModel"
|
||||
:options="userList"
|
||||
></n-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label>
|
||||
QA User
|
||||
<validation-rendering
|
||||
:error-list="v$.qaUserModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<n-select
|
||||
v-model:value="qaUserModel"
|
||||
:options="userList"
|
||||
/>
|
||||
</div>
|
||||
</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"
|
||||
@click="submitAndClose($event)"
|
||||
>
|
||||
Add & Close Modal
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-success"
|
||||
@click="submitChangeTask($event)"
|
||||
>
|
||||
Add & Create another
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {NSelect, NDatePicker} from "naive-ui";
|
||||
|
||||
//VueX
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
//Validation
|
||||
import useVuelidate from "@vuelidate/core";
|
||||
import {required, numeric} from "@vuelidate/validators";
|
||||
import ValidationRendering from "Components/validation/ValidationRendering.vue";
|
||||
|
||||
|
||||
export default {
|
||||
name: "NewChangeTask",
|
||||
components: {
|
||||
NDatePicker,
|
||||
NSelect,
|
||||
ValidationRendering,
|
||||
},
|
||||
props: {
|
||||
locationId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
emits: ['update_change_task_list'],
|
||||
setup() {
|
||||
return {v$: useVuelidate()};
|
||||
},
|
||||
data: () => ({
|
||||
assignedUserModel: null,
|
||||
changeEndDateModel: 0,
|
||||
changeStartDateModel: 0,
|
||||
changeTitleModel: "",
|
||||
currentStatus: "ready", //Has values; ready, saving
|
||||
qaUserModel: null,
|
||||
userList: [],
|
||||
}),
|
||||
validations: {
|
||||
assignedUserModel: {
|
||||
required,
|
||||
numeric,
|
||||
},
|
||||
changeEndDateModel: {
|
||||
required,
|
||||
},
|
||||
changeStartDateModel: {
|
||||
required,
|
||||
},
|
||||
changeTitleModel: {
|
||||
required,
|
||||
},
|
||||
qaUserModel: {
|
||||
required,
|
||||
numeric,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
objectUserList: "getObjectUserList",
|
||||
potentialUserList: "getPotentialUserList",
|
||||
rfcEndDate: "getEndDate",
|
||||
rfcStartDate: "getStartDate",
|
||||
rootUrl: "getRootUrl",
|
||||
}),
|
||||
},
|
||||
watch: {
|
||||
changeEndDateModel(new_value) {
|
||||
if (new_value < this.changeStartDateModel) {
|
||||
this.changeStartDateModel = new_value;
|
||||
}
|
||||
},
|
||||
changeStartDateModel(new_value) {
|
||||
if (new_value > this.changeEndDateModel) {
|
||||
this.changeEndDateModel = new_value;
|
||||
}
|
||||
},
|
||||
groupUserList() {
|
||||
this.updateUserList();
|
||||
},
|
||||
potentialUserList() {
|
||||
this.updateUserList();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
//Update the user fixed list
|
||||
this.$nextTick(() => {
|
||||
this.updateUserList();
|
||||
});
|
||||
|
||||
//Update Times
|
||||
this.changeEndDateModel = this.rfcEndDate + (15 * 1000 * 60);
|
||||
this.changeStartDateModel = this.rfcEndDate;
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
//Setup the date
|
||||
let new_date = new Date(date);
|
||||
|
||||
//Split the date into date vs time
|
||||
new_date = new_date.toISOString().split("T");
|
||||
|
||||
//Split the time
|
||||
const time_split = new_date[1].split(".");
|
||||
|
||||
//Return the date as a string
|
||||
return `${new_date[0]} ${time_split[0]}`;
|
||||
},
|
||||
async submitAndClose(event) {
|
||||
//Check validation
|
||||
const isFormCorrect = await this.v$.$validate();
|
||||
if (!isFormCorrect) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.submitChangeTask(event);
|
||||
|
||||
//Close the modal
|
||||
document.getElementById("newRunItemCloseButton").click();
|
||||
},
|
||||
async submitChangeTask(event) {
|
||||
//Tell modal current object is saving
|
||||
this.currentStatus = 'uploading';
|
||||
|
||||
//Stop the usual stuff
|
||||
event.preventDefault();
|
||||
|
||||
//Check validation
|
||||
const isFormCorrect = await this.v$.$validate();
|
||||
if (!isFormCorrect) {
|
||||
//Set the status back to "ready"
|
||||
this.currentStatus = "ready";
|
||||
|
||||
//Do nothing, and return
|
||||
return;
|
||||
}
|
||||
|
||||
const change_task_seconds =
|
||||
parseInt(this.changeEndDateModel) -
|
||||
parseInt(this.changeStartDateModel);
|
||||
|
||||
// Create data_to_send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set(
|
||||
"request_for_change",
|
||||
this.locationId.toString()
|
||||
);
|
||||
data_to_send.set("change_task_title", this.changeTitleModel);
|
||||
data_to_send.set(
|
||||
"change_task_start_date",
|
||||
new Date(this.changeStartDateModel).toISOString()
|
||||
);
|
||||
data_to_send.set(
|
||||
"change_task_end_date",
|
||||
new Date(this.changeEndDateModel).toISOString()
|
||||
);
|
||||
data_to_send.set(
|
||||
"change_task_seconds",
|
||||
change_task_seconds.toString()
|
||||
);
|
||||
data_to_send.set(
|
||||
"change_task_assigned_user",
|
||||
this.assignedUserModel
|
||||
);
|
||||
data_to_send.set("change_task_qa_user", this.qaUserModel);
|
||||
|
||||
this.axios.post(
|
||||
`${this.rootUrl}rfc_information/${this.locationId}/new_change_task/`,
|
||||
data_to_send
|
||||
).then((response) => {
|
||||
//Update the runsheet variables
|
||||
this.$emit("update_change_task_list", response.data);
|
||||
|
||||
//Clear the modal
|
||||
this.changeTitleModel = "";
|
||||
this.assignedUserModel = "";
|
||||
this.qaUserModel = "";
|
||||
|
||||
//Adjust the times
|
||||
this.changeStartDateModel = this.changeEndDateModel;
|
||||
this.changeEndDateModel = this.changeEndDateModel + (15 * 1000 * 60);
|
||||
|
||||
//Set the current status back to ready
|
||||
this.currentStatus = 'ready';
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error submitting change task",
|
||||
message: `Sorry, we could not submit the change task. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
updateUserList() {
|
||||
//Grab a map of the potential and current users
|
||||
const formatted_user_list = this.objectUserList.map((row) => {
|
||||
return {
|
||||
label: `${row.username}: ${row.first_name} ${row.last_name}`,
|
||||
value: row.id,
|
||||
}
|
||||
});
|
||||
|
||||
const formatted_potential_list = this.potentialUserList.map((row) => {
|
||||
return {
|
||||
label: `${row.username}: ${row.first_name} ${row.last_name}`,
|
||||
value: row.id,
|
||||
}
|
||||
});
|
||||
|
||||
//Concatenate the lists
|
||||
this.userList = formatted_user_list.concat(formatted_potential_list);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<h2>Description</h2>
|
||||
<p class="text-instructions">
|
||||
The description is optional. If you update the
|
||||
description, please hit the "Update Descritpion" button
|
||||
</p>
|
||||
<editor
|
||||
v-model="changeDescriptionModel"
|
||||
license-key="gpl"
|
||||
:init="{
|
||||
license_key: 'gpl',
|
||||
file_picker_types: 'image',
|
||||
height: 300,
|
||||
images_upload_handler: customUploadImage,
|
||||
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,
|
||||
}"
|
||||
:disabled="isReadOnly"
|
||||
/>
|
||||
|
||||
<hr v-if="!isReadOnly"/>
|
||||
<div
|
||||
v-if="!isReadOnly"
|
||||
class="row submit-row"
|
||||
>
|
||||
<div class="col-md-12">
|
||||
<button
|
||||
class="btn btn-primary save-changes"
|
||||
@click="updateDescription"
|
||||
>
|
||||
Update Description
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Editor from "@tinymce/tinymce-vue";
|
||||
|
||||
//VueX
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "ChangeTaskDescription",
|
||||
components: {
|
||||
Editor,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
contentCss: "getContentCss",
|
||||
isReadOnly: "getIsChangeTaskReadOnly",
|
||||
skin: "getSkin",
|
||||
}),
|
||||
changeDescriptionModel: {
|
||||
get() {
|
||||
return this.$store.state.changeTask.description;
|
||||
},
|
||||
set(changeDescription) {
|
||||
this.$store.commit({
|
||||
type: "updateChangeTaskDescription",
|
||||
changeTaskDescription: changeDescription,
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
customUploadImage(blobInfo, success) {
|
||||
//Create the form
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set(
|
||||
"document",
|
||||
blobInfo.blob(),
|
||||
blobInfo.filename()
|
||||
);
|
||||
data_to_send.set("document_description", blobInfo.filename());
|
||||
|
||||
//Configuration for axios
|
||||
const config = {
|
||||
onUploadProgress: () => {
|
||||
//As the document gets uploaded - we want to update the upload Percentage
|
||||
|
||||
},
|
||||
};
|
||||
|
||||
//Create url
|
||||
const url = `${this.rootUrl}documentation/request_for_change/${this.changeTaskResults[0].fields.request_for_change}/upload/`;
|
||||
|
||||
//Use axios to send the data
|
||||
this.axios.post(
|
||||
url,
|
||||
data_to_send, config
|
||||
).then((response) => {
|
||||
//Just send the location to the success
|
||||
success(`/private/${response.data[0].document_key_id}`);
|
||||
|
||||
});
|
||||
},
|
||||
updateDescription() {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Updating Description",
|
||||
message: "Updating Description, please wait",
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
unique_type: "save_description",
|
||||
});
|
||||
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set('change_task_description', this.changeDescriptionModel);
|
||||
|
||||
this.axios.post(
|
||||
"update/description/",
|
||||
data_to_send,
|
||||
).then(() => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Updated Description",
|
||||
message: "Description Updated",
|
||||
extra_classes: "bg-success",
|
||||
unique_type: "save_description",
|
||||
});
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Failed Updating Description",
|
||||
message: `Sorry - description failed to update. Error -> ${error}`,
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
unique_type: "save_description",
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<div>
|
||||
<h2>
|
||||
Change Task Links
|
||||
</h2>
|
||||
<p class="text-instructions">
|
||||
The following are links to other change tasks. You can either block
|
||||
an existing change task in the future. Or can set it will be Blocked
|
||||
by a change task in the past.
|
||||
</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 change task.
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<!-- Is Blocked By -->
|
||||
<sub-object-links
|
||||
title="Is Blocked By"
|
||||
:link-results="linkResults.filter(row => {return row.link_relationship === 'Block' && row.parent_link !== destination})"
|
||||
></sub-object-links>
|
||||
|
||||
<!-- Is Currently Blocking -->
|
||||
<sub-object-links
|
||||
title="Is Currently Blocking"
|
||||
:link-results="linkResults.filter(row => {return row.link_relationship === 'Block' && row.parent_link === destination})"
|
||||
></sub-object-links>
|
||||
</div>
|
||||
|
||||
<!-- Submit 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="newLink"
|
||||
>Create new Link</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
|
||||
<!-- MODAL FOR NEW CHANGE TASK LINKS -->
|
||||
<new-change-task-link-wizard-vue
|
||||
@update_link_results="updateLinkResults"
|
||||
></new-change-task-link-wizard-vue>
|
||||
|
||||
<confirm-link-delete
|
||||
:show-migrate-button="false"
|
||||
@update_link_results="updateLinkResults"
|
||||
></confirm-link-delete>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {Modal} from "bootstrap";
|
||||
|
||||
//Components
|
||||
import NewChangeTaskLinkWizardVue from "Modules/wizards/NewChangeTaskLinkWizard.vue";
|
||||
import SubObjectLinks from "Modules/sub_modules/SubObjectLinks.vue";
|
||||
|
||||
//VueX
|
||||
import {mapGetters} from "vuex";
|
||||
import ConfirmLinkDelete from "Modules/wizards/ConfirmLinkDelete.vue";
|
||||
|
||||
export default {
|
||||
name: "ChangeTaskLinkList",
|
||||
components: {
|
||||
ConfirmLinkDelete,
|
||||
NewChangeTaskLinkWizardVue,
|
||||
SubObjectLinks,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
linkResults: [],
|
||||
translateStatus: {
|
||||
1: "Draft",
|
||||
2: "Waiting for approval",
|
||||
3: "Approved",
|
||||
4: "Started",
|
||||
5: "Finished",
|
||||
6: "Rejected",
|
||||
7: "Paused",
|
||||
8: "Ready for QA",
|
||||
9: "Failed",
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
destination: "getDestination",
|
||||
locationId: "getLocationId",
|
||||
rootUrl: "getRootUrl",
|
||||
userLevel: "getUserLevel",
|
||||
}),
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.updateLinkResults();
|
||||
}, 200);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
newLink() {
|
||||
//Open up the modal
|
||||
const elem_modal = new Modal(
|
||||
document.getElementById("newChangeTaskLinkModal")
|
||||
);
|
||||
|
||||
elem_modal.show();
|
||||
},
|
||||
updateLinkResults() {
|
||||
//Clear the data
|
||||
this.linkResults = [];
|
||||
|
||||
//Get the data from the database
|
||||
this.axios.post(
|
||||
`${this.rootUrl}object_data/change_task/${this.locationId}/object_link_list/`
|
||||
).then((response) => {
|
||||
this.linkResults = response.data.map((row) => {
|
||||
//Get results
|
||||
const results = row;
|
||||
|
||||
//Mutate the object_status
|
||||
results.object_status = this.translateStatus[row.object_status];
|
||||
|
||||
//Return results
|
||||
return results;
|
||||
})
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error updating link results",
|
||||
message: `Sorry, we could not update the link results. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<is-downtime></is-downtime>
|
||||
|
||||
<hr/>
|
||||
<required-by></required-by>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import IsDowntime from './IsDowntime.vue'
|
||||
import RequiredBy from './RequiredBy.vue'
|
||||
|
||||
export default {
|
||||
name: "ChangeTaskMisc",
|
||||
components: {
|
||||
IsDowntime,
|
||||
RequiredBy,
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<div
|
||||
id="confirmChangeTaskDeleteModal"
|
||||
class="modal fade"
|
||||
tabindex="-1"
|
||||
data-bs-backdrop="static"
|
||||
data-bs-keyboard="false"
|
||||
aria-labelledby="confirmChangeTaskDelete"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5
|
||||
id="confirmChangeTaskDelete"
|
||||
class="modal-title"
|
||||
>
|
||||
Please confirm Change Task Deletion
|
||||
</h5>
|
||||
<!-- TASK INFORMATION -->
|
||||
<button
|
||||
id="confirmChangeTaskDeleteButton"
|
||||
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 Change Task from the Request for Change?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-secondary"
|
||||
@click="closeModal"
|
||||
>
|
||||
No
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
@click="deleteChangeTask"
|
||||
>
|
||||
Yes
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "ConfirmChangeTaskDelete",
|
||||
props: {
|
||||
changeTaskResults: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
destination: "getDestination",
|
||||
locationId: "getLocationId",
|
||||
rootUrl: "getRootUrl",
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
deleteChangeTask() {
|
||||
//Send the trigger
|
||||
this.axios.post(
|
||||
`${this.rootUrl}change_task_information/${this.changeTaskResults[0].pk}/delete/`
|
||||
).then(() => {
|
||||
//If successful, go back
|
||||
window.location.href = `${this.rootUrl}rfc_information/${this.changeTaskResults[0].fields.request_for_change}/`;
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error deleting change task",
|
||||
message: `Sorry, we could not delete the change task. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
closeModal() {
|
||||
document.getElementById("confirmChangeTaskDeleteButton").click();
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
110
NearBeach/src/js/components/change_task/modules/IsDowntime.vue
Normal file
110
NearBeach/src/js/components/change_task/modules/IsDowntime.vue
Normal file
@@ -0,0 +1,110 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Misc</strong>
|
||||
<p class="text-instructions">
|
||||
To state if there is downtime, please click the "No
|
||||
Downtime" to change it's statue.
|
||||
</p>
|
||||
<p class="text-instructions">
|
||||
Clicking will automatically update the value.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div
|
||||
class="btn-group"
|
||||
role="group"
|
||||
aria-label="Basic checkbox toggle button group"
|
||||
>
|
||||
<input
|
||||
id="isDowntime"
|
||||
v-model="isDowntimeModel"
|
||||
type="checkbox"
|
||||
class="btn-check"
|
||||
autocomplete="off"
|
||||
:disabled="isReadOnly"
|
||||
/>
|
||||
<label
|
||||
class="btn btn-outline-primary"
|
||||
for="isDowntime"
|
||||
>{{ isDowntime() }}</label
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
export default {
|
||||
name: "IsDowntime",
|
||||
computed: {
|
||||
...mapGetters({
|
||||
isReadOnly: "getIsChangeTaskReadOnly",
|
||||
}),
|
||||
isDowntimeModel: {
|
||||
get() {
|
||||
return this.$store.state.changeTask.isDowntime;
|
||||
},
|
||||
set(isDowntime) {
|
||||
this.$store.commit({
|
||||
type: "updateChangeTaskIsDowntime",
|
||||
//isDowntime: isDowntime,
|
||||
isDowntime,
|
||||
});
|
||||
|
||||
this.updateIsDowntime(isDowntime);
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
isDowntime() {
|
||||
const downtimeMessage = this.isDowntimeModel ? "Downtime Scheduled" : "No Downtime";
|
||||
|
||||
let appendMessage = "";
|
||||
if (!this.isReadOnly) {
|
||||
// Currently in edit mode - so we append an appropriate message
|
||||
appendMessage = this.isDowntimeModel ? " - click to remove" : " - click to Schedule";
|
||||
}
|
||||
|
||||
return downtimeMessage + appendMessage;
|
||||
},
|
||||
updateIsDowntime(isDowntime) {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Updating Downtime flag",
|
||||
message: "Please wait, we are updating the downtime flag",
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
unique_type: "downtime-save",
|
||||
});
|
||||
|
||||
//Setup data to send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set('is_downtime', isDowntime);
|
||||
|
||||
//Send to the backend
|
||||
this.axios.post(
|
||||
"update/is_downtime/",
|
||||
data_to_send,
|
||||
).then(() => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Updated Downtime flag",
|
||||
message: "Successfully Updated the Downtime Flag",
|
||||
extra_classes: "bg-success",
|
||||
unique_type: "downtime-save",
|
||||
});
|
||||
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Failed to Update Downtime Flag",
|
||||
message: `We have come across an issue updating the downtime flag. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
unique_type: "downtime-save",
|
||||
});
|
||||
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,96 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Misc</strong>
|
||||
<p class="text-instructions">
|
||||
Please fill in the requiredBys for this particular
|
||||
change task. Default value will be "requiredBys".
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label>Required By/Stakeholder:</label>
|
||||
<input
|
||||
v-model="requiredByModel"
|
||||
type="text"
|
||||
class="form-control"
|
||||
:disabled="isReadOnly"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
export default {
|
||||
name: "RequiredBy",
|
||||
data() {
|
||||
return {
|
||||
updateTimer: "",
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
isReadOnly: "getIsChangeTaskReadOnly",
|
||||
}),
|
||||
requiredByModel: {
|
||||
get() {
|
||||
return this.$store.state.changeTask.requiredBy;
|
||||
},
|
||||
set(requiredBy) {
|
||||
//Update the VueX
|
||||
this.$store.commit({
|
||||
type: "updateChangeTaskRequiredBy",
|
||||
requiredBy,
|
||||
});
|
||||
|
||||
//Destroy the first timer if it exists
|
||||
if (this.updateTimer !== "") {
|
||||
clearTimeout(this.updateTimer);
|
||||
}
|
||||
|
||||
//Reset the timer
|
||||
this.updateTimer = setTimeout(() => {
|
||||
this.updateRequiredBy(requiredBy);
|
||||
}, 1200)
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
updateRequiredBy(requiredBy) {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Updating Required By",
|
||||
message: "Please wait, we are updating required by",
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
unique_type: "required-save",
|
||||
});
|
||||
|
||||
//Send to the backend
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("change_task_required_by", requiredBy);
|
||||
|
||||
this.axios.post(
|
||||
"update/required_by/",
|
||||
data_to_send,
|
||||
).then(() => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Updated Required By",
|
||||
message: "The Required by has been updated",
|
||||
extra_classes: "bg-success",
|
||||
unique_type: "required-save",
|
||||
});
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Issue updating Required By",
|
||||
message: `We have had an issue updating required by. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
unique_type: "required-save",
|
||||
});
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
352
NearBeach/src/js/components/customers/CustomerInformation.vue
Normal file
352
NearBeach/src/js/components/customers/CustomerInformation.vue
Normal file
@@ -0,0 +1,352 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- TITLE -->
|
||||
<h1 class="mb-4">Customer Information</h1>
|
||||
<a :href="`${rootUrl}search/customer/`"
|
||||
>Go back to customer search</a
|
||||
>
|
||||
<hr/>
|
||||
|
||||
<!-- FIELDS SECTION -->
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Please Note</strong>
|
||||
<p class="text-instructions">
|
||||
Please fill out the following details. If the customer
|
||||
is not assigned an organisation, NearBeach will treat
|
||||
this customer as a freelancer.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="row customer-profile-image">
|
||||
<!-- PROFILE IMAGE -->
|
||||
<img
|
||||
:src="profilePicture"
|
||||
alt="User Profile Picture"
|
||||
class="customer-profile-image"
|
||||
/>
|
||||
<n-upload
|
||||
v-if="userLevel > 1"
|
||||
:action="`${rootUrl}customer_information/${customerResults[0].pk}/update_profile/`"
|
||||
:headers="{
|
||||
'X-CSRFTOKEN': useToken('csrftoken'),
|
||||
}"
|
||||
:data="{}"
|
||||
accept=".jpg, .jpeg, .png, *.webp"
|
||||
@finish="updateProfilePicture"
|
||||
@error="showErrorToast"
|
||||
>
|
||||
<n-button>Update Profile Picture</n-button>
|
||||
</n-upload>
|
||||
</div>
|
||||
<div class="spacer-extra"></div>
|
||||
|
||||
<!-- CUSTOMER INFORMATION -->
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-3">
|
||||
<label>
|
||||
Title:
|
||||
<validation-rendering
|
||||
:error-list="v$.customerTitleModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<n-select
|
||||
v-model:value="customerTitleModel"
|
||||
:options="titleFixList"
|
||||
:disabled="userLevel <= 1"
|
||||
></n-select>
|
||||
</div>
|
||||
<div class="form-group col-sm-4">
|
||||
<label>
|
||||
First Name:
|
||||
<validation-rendering
|
||||
:error-list="v$.customerFirstNameModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<input
|
||||
v-model="customerFirstNameModel"
|
||||
type="text"
|
||||
class="form-control"
|
||||
:disabled="userLevel <= 1"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group col-sm-5">
|
||||
<label>
|
||||
Last Name:
|
||||
<validation-rendering
|
||||
:error-list="v$.customerLastNameModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<input
|
||||
v-model="customerLastNameModel"
|
||||
type="text"
|
||||
class="form-control"
|
||||
:disabled="userLevel <= 1"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- STAKEHOLDER ORGANISATION -->
|
||||
<hr/>
|
||||
<stakeholder-information
|
||||
v-if="organisationResults.length > 0"
|
||||
:organisation-results="organisationResults"
|
||||
:default-stakeholder-image="defaultStakeholderImage"
|
||||
></stakeholder-information>
|
||||
|
||||
<!-- NEED TO APPLY PERMISSIONS -->
|
||||
<!-- Submit Button -->
|
||||
<hr
|
||||
v-if="userLevel > 1"
|
||||
class="mt-4"
|
||||
/>
|
||||
<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="updateCustomer"
|
||||
>Update Customer</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {NButton, NSelect, NUpload} from "naive-ui";
|
||||
import StakeholderInformation from "Components/organisations/StakeholderInformation.vue";
|
||||
|
||||
//Validation
|
||||
import useVuelidate from "@vuelidate/core";
|
||||
import {required, email} from "@vuelidate/validators";
|
||||
import ValidationRendering from "Components/validation/ValidationRendering.vue"
|
||||
|
||||
//Composables
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
import {useToken} from "Composables/security/useToken";
|
||||
|
||||
export default {
|
||||
name: "CustomerInformation",
|
||||
components: {
|
||||
NButton,
|
||||
NSelect,
|
||||
NUpload,
|
||||
StakeholderInformation,
|
||||
ValidationRendering,
|
||||
},
|
||||
props: {
|
||||
customerResults: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
defaultStakeholderImage: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
organisationResults: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
staticUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
titleList: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
userLevel: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
return {v$: useVuelidate()};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
customerEmailModel:
|
||||
this.customerResults[0].fields.customer_email,
|
||||
customerFirstNameModel:
|
||||
this.customerResults[0].fields.customer_first_name,
|
||||
customerLastNameModel:
|
||||
this.customerResults[0].fields.customer_last_name,
|
||||
customerTitleModel:
|
||||
this.customerResults[0].fields.customer_title,
|
||||
profilePicture: `${this.staticUrl}/NearBeach/images/placeholder/product_tour.svg`,
|
||||
titleFixList: [],
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
customerEmailModel: {
|
||||
required,
|
||||
email,
|
||||
},
|
||||
customerFirstNameModel: {
|
||||
required,
|
||||
},
|
||||
customerLastNameModel: {
|
||||
required,
|
||||
},
|
||||
customerTitleModel: {
|
||||
required,
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
//Send up root and static url
|
||||
this.$store.commit({
|
||||
type: "updateUrl",
|
||||
rootUrl: this.rootUrl,
|
||||
staticUrl: this.staticUrl,
|
||||
});
|
||||
|
||||
this.$store.commit({
|
||||
type: "updateUserLevel",
|
||||
userLevel: this.userLevel,
|
||||
});
|
||||
|
||||
this.$store.commit({
|
||||
type: "updateDestination",
|
||||
destination: "customer",
|
||||
locationId: this.customerResults[0].pk,
|
||||
});
|
||||
this.$store.commit({
|
||||
type: "updateTitle",
|
||||
title: `${this.customerFirstNameModel} ${this.customerLastNameModel}`,
|
||||
});
|
||||
|
||||
//Convert the title list data into a format NSelect can use
|
||||
this.titleFixList = this.titleList.map((row) => {
|
||||
return {
|
||||
value: row.pk,
|
||||
label: row.fields.title,
|
||||
};
|
||||
});
|
||||
|
||||
//See if there is a profile picture
|
||||
this.setProfilePicture();
|
||||
},
|
||||
methods: {
|
||||
useToken,
|
||||
useNBTheme,
|
||||
showErrorToast() {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error uploading profile picture",
|
||||
message: "Sorry, we had an issue uploading the profile image.",
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
},
|
||||
setProfilePicture() {
|
||||
//If there is a profile picture/image, update. Otherwise use default
|
||||
const profile_picture =
|
||||
this.customerResults[0].fields.customer_profile_picture;
|
||||
if (
|
||||
profile_picture !== undefined &&
|
||||
profile_picture !== null &&
|
||||
profile_picture !== ""
|
||||
) {
|
||||
//There exists a profile image for the user
|
||||
this.profilePicture = `/private${this.rootUrl}${this.customerResults[0].fields.customer_profile_picture}`;
|
||||
} else {
|
||||
//Go back to default
|
||||
this.profilePicture = `${this.staticUrl}/NearBeach/images/placeholder/product_tour.svg`;
|
||||
}
|
||||
},
|
||||
async updateCustomer() {
|
||||
//Check validation
|
||||
const isFormCorrect = await this.v$.$validate();
|
||||
if (!isFormCorrect || this.displayGroupPermissionIssue) {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Please correct issues",
|
||||
message: "Not all fields are correctly validated. Please correct.",
|
||||
extra_classes: "bg-danger",
|
||||
})
|
||||
return;
|
||||
}
|
||||
|
||||
//Construct the data_to_send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("customer_email", this.customerEmailModel);
|
||||
data_to_send.set(
|
||||
"customer_first_name",
|
||||
this.customerFirstNameModel
|
||||
);
|
||||
data_to_send.set(
|
||||
"customer_last_name",
|
||||
this.customerLastNameModel
|
||||
);
|
||||
data_to_send.set("customer_title", this.customerTitleModel);
|
||||
|
||||
//Notify user we are updating
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Updating Customer",
|
||||
message: "Please wait whilst we update customer",
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
unique_type: "save",
|
||||
});
|
||||
|
||||
//Use axios to send the data
|
||||
this.axios.post(
|
||||
`${this.rootUrl}customer_information/${this.customerResults[0].pk}/save/`,
|
||||
data_to_send
|
||||
).then(() => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Customer Updated",
|
||||
message: "The Customer has updated",
|
||||
extra_classes: "bg-success",
|
||||
unique_type: "save",
|
||||
});
|
||||
|
||||
//Check to see if we are updating the profile picture
|
||||
this.updateProfilePicture();
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Failed to Update Customer",
|
||||
message: `Sorry. We have encounted an error. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
unique_type: "save",
|
||||
});
|
||||
});
|
||||
},
|
||||
updateProfilePicture() {
|
||||
//Contact the API to get the location of the new image
|
||||
this.axios.post(
|
||||
`${this.rootUrl}customer_information/${this.customerResults[0].pk}/get_profile_picture/`,
|
||||
{}
|
||||
).then((response) => {
|
||||
this.profilePicture = response.data;
|
||||
}).catch(() => {
|
||||
this.profilePicture = `${this.staticUrl}/NearBeach/images/placeholder/product_tour.svg`;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
106
NearBeach/src/js/components/customers/CustomerModules.vue
Normal file
106
NearBeach/src/js/components/customers/CustomerModules.vue
Normal file
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- The MENU Items -->
|
||||
<ul
|
||||
id="misc_module_tabs"
|
||||
class="nav nav-tabs"
|
||||
role="tablist"
|
||||
>
|
||||
<!-- Associated Projects & Tasks -->
|
||||
<li
|
||||
class="nav-item"
|
||||
role="presentation"
|
||||
>
|
||||
<button
|
||||
id="associated-objects-tab"
|
||||
class="nav-link active"
|
||||
data-bs-toggle="tab"
|
||||
data-bs-target="#associated-objects"
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-controls="home"
|
||||
aria-selected="true"
|
||||
>
|
||||
Associated Objects
|
||||
</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/>
|
||||
|
||||
<!-- The Modules -->
|
||||
<div
|
||||
id="misc_module_content"
|
||||
class="tab-content"
|
||||
>
|
||||
<div
|
||||
id="associated-objects"
|
||||
class="tab-pane fade active show"
|
||||
role="tabpanel"
|
||||
aria-labelledby="profile-tab"
|
||||
>
|
||||
<associated-objects
|
||||
></associated-objects>
|
||||
</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 AssociatedObjects from "Modules/sub_modules/AssociatedObjects.vue";
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
//Composable
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
import DeleteObject from "Modules/sub_modules/DeleteObject.vue";
|
||||
|
||||
export default {
|
||||
name: "CustomerModule",
|
||||
components: {
|
||||
DeleteObject,
|
||||
AssociatedObjects,
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
theme: "getTheme",
|
||||
userLevel: "getUserLevel",
|
||||
}),
|
||||
},
|
||||
methods: {useNBTheme},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
68
NearBeach/src/js/components/customers/ListCustomers.vue
Normal file
68
NearBeach/src/js/components/customers/ListCustomers.vue
Normal file
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<div
|
||||
v-for="customer in customerResults"
|
||||
:key="customer.pk"
|
||||
class="customer-details">
|
||||
<img
|
||||
:src="getProfilePicture(customer)"
|
||||
alt="Stakeholder Logo"
|
||||
class="customer-image"
|
||||
/>
|
||||
<div class="customer-name">
|
||||
<a
|
||||
:href="`${rootUrl}customer_information/${customer.pk}/`"
|
||||
>
|
||||
{{ customer.fields.customer_first_name }}
|
||||
{{ customer.fields.customer_last_name }}
|
||||
</a>
|
||||
</div>
|
||||
<div class="customer-email">
|
||||
<carbon-email></carbon-email>
|
||||
Email:
|
||||
<a :href="`mailto:${customer.fields.customer_email}`">
|
||||
{{ customer.fields.customer_email }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//VueX
|
||||
import {mapGetters} from "vuex";
|
||||
import {CarbonEmail} from "../../components";
|
||||
|
||||
export default {
|
||||
name: "ListCustomers",
|
||||
components: {
|
||||
CarbonEmail,
|
||||
},
|
||||
props: {
|
||||
customerResults: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
rootUrl: "getRootUrl",
|
||||
staticUrl: "getStaticUrl",
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
getProfilePicture(customer) {
|
||||
const image = customer.fields.customer_profile_picture;
|
||||
|
||||
//If customer profile is blank - return default picture
|
||||
if (image === "" || image === null) {
|
||||
return `${this.staticUrl}NearBeach/images/placeholder/product_tour.svg`;
|
||||
}
|
||||
|
||||
return `${this.rootUrl}private/${image}`;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
278
NearBeach/src/js/components/customers/NewCustomer.vue
Normal file
278
NearBeach/src/js/components/customers/NewCustomer.vue
Normal file
@@ -0,0 +1,278 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- HEADER -->
|
||||
<h1>New Customer</h1>
|
||||
<hr/>
|
||||
|
||||
New Customer Form
|
||||
<new-customer-form
|
||||
:organisation-name="organisationName"
|
||||
:title-list="titleList"
|
||||
:flag-validation-check="flagValidationCheck"
|
||||
@update_customer_data="updateCustomerData($event)"
|
||||
></new-customer-form>
|
||||
|
||||
<!-- CUSTOMER ORGANISATION -->
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Customer Organisation</strong>
|
||||
<p class="text-instructions">
|
||||
A customer will require an Organisation. If the customer
|
||||
does not have any organisations, i.e. a sole trader, we
|
||||
recommend creating the customer as an organisation instead.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group col-sm-8">
|
||||
<label>
|
||||
Organisation:
|
||||
<validation-rendering
|
||||
:error-list="v$.organisationModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<n-select
|
||||
v-model:value="organisationModel"
|
||||
:options="organisationFixList"
|
||||
filterable
|
||||
placeholder="Search Organisations"
|
||||
label="organisation_name"
|
||||
class="get-stakeholders"
|
||||
@search="fetchOptions"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- REMEMBER TO ADD IN USER PERMISSIONS HERE!! -->
|
||||
<!-- Submit Button -->
|
||||
<hr/>
|
||||
<div class="row submit-row">
|
||||
<div class="col-md-12">
|
||||
<button
|
||||
href="javascript:void(0)"
|
||||
class="btn btn-primary save-changes"
|
||||
:disabled="disableSubmitButton"
|
||||
@click="submitNewCustomer"
|
||||
>Submit Customer</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//Validation
|
||||
import useVuelidate from "@vuelidate/core";
|
||||
import {required, email} from "@vuelidate/validators";
|
||||
|
||||
//Components
|
||||
import NewCustomerForm from "./NewCustomerForm.vue";
|
||||
import {NSelect} from "naive-ui";
|
||||
|
||||
//Composable
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
import ValidationRendering from "Components/validation/ValidationRendering.vue";
|
||||
|
||||
export default {
|
||||
name: "NewCustomer",
|
||||
components: {
|
||||
ValidationRendering,
|
||||
NewCustomerForm,
|
||||
NSelect,
|
||||
},
|
||||
props: {
|
||||
organisationName: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
titleList: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
return {v$: useVuelidate()};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
customerEmailModel: "",
|
||||
customerFirstNameModel: "",
|
||||
customerLastNameModel: "",
|
||||
disableSubmitButton: false,
|
||||
flagValidationCheck: false,
|
||||
organisationFixList: [],
|
||||
organisationModel: "",
|
||||
searchTimeout: "",
|
||||
titleModel: [],
|
||||
};
|
||||
},
|
||||
validations() {
|
||||
return {
|
||||
customerEmailModel: {
|
||||
required,
|
||||
email,
|
||||
},
|
||||
customerFirstNameModel: {
|
||||
required,
|
||||
},
|
||||
customerLastNameModel: {
|
||||
required,
|
||||
},
|
||||
organisationModel: {
|
||||
required,
|
||||
},
|
||||
titleModel: {
|
||||
required,
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
//Get a default list when mounted
|
||||
this.$nextTick(() => {
|
||||
this.getOrganisationData("", "");
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
useNBTheme,
|
||||
fetchOptions(search, loading) {
|
||||
//Clear timer if it already exists
|
||||
if (this.searchTimeout !== "") {
|
||||
//Stop the clock
|
||||
clearTimeout(this.searchTimeout);
|
||||
}
|
||||
|
||||
//Setup timer if there are 3 characters or more
|
||||
if (search.length >= 3) {
|
||||
//Start the potential search
|
||||
this.searchTimeout = setTimeout(() => {
|
||||
this.getOrganisationData(search, loading);
|
||||
}, 500);
|
||||
}
|
||||
},
|
||||
getOrganisationData(search) {
|
||||
// Save the seach data in FormData
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("search", search);
|
||||
|
||||
// Now that the timer has run out, lets use AJAX to get the organisations.
|
||||
this.axios.post(
|
||||
`${this.rootUrl}search/organisation/data/`,
|
||||
data_to_send
|
||||
).then((response) => {
|
||||
//Extract the required JSON data
|
||||
const extracted_data = response.data;
|
||||
|
||||
//Look through the extracted data - and map the required fields into stakeholder fix list
|
||||
this.organisationFixList = extracted_data.map((row) => {
|
||||
//Create the creation object
|
||||
return {
|
||||
value: row.pk,
|
||||
label: row.fields.organisation_name,
|
||||
};
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error Getting Organisation Data",
|
||||
message: `Error getting organisation data. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
async submitNewCustomer() {
|
||||
//Flag downstream to check validation
|
||||
this.flagValidationCheck = true;
|
||||
|
||||
//Reset this check after 100ms
|
||||
setTimeout(() => {
|
||||
this.flagValidationCheck = false;
|
||||
}, 100);
|
||||
|
||||
// Check the validation at this level
|
||||
this.v$.$touch();
|
||||
|
||||
// Check the validation at this level
|
||||
const hasFormErrors = await this.v$.$validate();
|
||||
|
||||
//NEED TO USE MIXIN FOR THIS SECTION
|
||||
if (!hasFormErrors) {
|
||||
//Show error modal
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error submitting new customer",
|
||||
message: `Sorry, we had an submitting new customer. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
|
||||
//Just return - as we do not need to do the rest of this function
|
||||
return;
|
||||
}
|
||||
|
||||
//Disble submit button
|
||||
this.disableSubmitButton = true;
|
||||
|
||||
//Create the data_to_send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("customer_title", this.titleModel);
|
||||
data_to_send.set(
|
||||
"customer_first_name",
|
||||
this.customerFirstNameModel
|
||||
);
|
||||
data_to_send.set(
|
||||
"customer_last_name",
|
||||
this.customerLastNameModel
|
||||
);
|
||||
data_to_send.set("customer_email", this.customerEmailModel);
|
||||
|
||||
//If there is an organisation in the model - send it
|
||||
if (
|
||||
this.organisationModel !== "" &&
|
||||
this.organisationModel !== null
|
||||
) {
|
||||
data_to_send.set("organisation", this.organisationModel);
|
||||
}
|
||||
|
||||
//Send the data using axios
|
||||
this.axios
|
||||
.post(`${this.rootUrl}new_customer/save/`, data_to_send)
|
||||
.then((response) => {
|
||||
//Go to the new customer page
|
||||
window.location.href = response.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error submitting new customer",
|
||||
message: `Sorry, we had an submitting new customer. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
|
||||
//Enable users to submit again
|
||||
this.disableSubmitButton = false;
|
||||
});
|
||||
},
|
||||
updateCustomerData(data) {
|
||||
//Update the modal field with the value data
|
||||
this[data.field] = data.value;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
187
NearBeach/src/js/components/customers/NewCustomerForm.vue
Normal file
187
NearBeach/src/js/components/customers/NewCustomerForm.vue
Normal file
@@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>New Customer</strong>
|
||||
<p class="text-instructions">
|
||||
Please fill out the following details.
|
||||
</p>
|
||||
<strong>Please Note:</strong>
|
||||
<p class="text-instructions">
|
||||
Customers do not go through a duplication process. Please search
|
||||
for the potential customer first before adding them into
|
||||
NearBeach.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<!-- CUSTOMER DETAILS -->
|
||||
<div class="row">
|
||||
<div class="form-group col-sm-3">
|
||||
<label>
|
||||
Title:
|
||||
<validation-rendering
|
||||
:error-list="v$.titleModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<n-select
|
||||
v-model:value="titleModel"
|
||||
:options="titleFixList"
|
||||
label="title"
|
||||
placeholder=""
|
||||
></n-select>
|
||||
</div>
|
||||
<div class="form-group col-sm-4">
|
||||
<label>
|
||||
First Name:
|
||||
<validation-rendering
|
||||
:error-list="v$.customerFirstNameModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<input
|
||||
v-model="customerFirstNameModel"
|
||||
type="text"
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group col-sm-5">
|
||||
<label>
|
||||
Last Name:
|
||||
<validation-rendering
|
||||
:error-list="v$.customerLastNameModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<input
|
||||
v-model="customerLastNameModel"
|
||||
type="text"
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Customer Email -->
|
||||
<div class="form-group col-sm-8 mt-4 mb-4">
|
||||
<label>
|
||||
Email:
|
||||
<validation-rendering
|
||||
:error-list="v$.customerEmailModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<input
|
||||
v-model="customerEmailModel"
|
||||
type="text"
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {NSelect} from "naive-ui";
|
||||
|
||||
//Validation
|
||||
import useVuelidate from "@vuelidate/core";
|
||||
import {required, email} from "@vuelidate/validators";
|
||||
import ValidationRendering from "Components/validation/ValidationRendering.vue";
|
||||
|
||||
export default {
|
||||
name: "NewCustomerForm",
|
||||
components: {
|
||||
NSelect,
|
||||
ValidationRendering,
|
||||
},
|
||||
props: {
|
||||
flagValidationCheck: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
titleList: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
emits: [
|
||||
'update_customer_data',
|
||||
],
|
||||
setup() {
|
||||
return {v$: useVuelidate()};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
customerEmailModel: "",
|
||||
customerFirstNameModel: "",
|
||||
customerLastNameModel: "",
|
||||
organisationModel: {},
|
||||
searchTimeout: "",
|
||||
titleFixList: [],
|
||||
titleModel: [],
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
customerEmailModel: {
|
||||
required,
|
||||
email,
|
||||
},
|
||||
customerFirstNameModel: {
|
||||
required,
|
||||
},
|
||||
customerLastNameModel: {
|
||||
required,
|
||||
},
|
||||
titleModel: {
|
||||
required,
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
customerEmailModel() {
|
||||
//Emit up this function's data
|
||||
this.$emit("update_customer_data", {
|
||||
field: "customerEmailModel",
|
||||
value: this.customerEmailModel,
|
||||
});
|
||||
},
|
||||
customerFirstNameModel() {
|
||||
//Emit up this function's data
|
||||
this.$emit("update_customer_data", {
|
||||
field: "customerFirstNameModel",
|
||||
value: this.customerFirstNameModel,
|
||||
});
|
||||
},
|
||||
customerLastNameModel() {
|
||||
//Emit up this function's data
|
||||
this.$emit("update_customer_data", {
|
||||
field: "customerLastNameModel",
|
||||
value: this.customerLastNameModel,
|
||||
});
|
||||
},
|
||||
flagValidationCheck() {
|
||||
//Don't worry if it is false
|
||||
if (!this.flagValidationCheck) return;
|
||||
|
||||
//Touch the validation
|
||||
|
||||
this.v$.$touch();
|
||||
},
|
||||
titleModel() {
|
||||
//Emit up this function's data
|
||||
this.$emit("update_customer_data", {
|
||||
field: "titleModel",
|
||||
value: this.titleModel,
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
//Get the data formatted how the NSelect wants
|
||||
this.titleFixList = this.titleList.map((row) => {
|
||||
return {
|
||||
value: row.pk,
|
||||
label: row.fields.title,
|
||||
};
|
||||
});
|
||||
},
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
177
NearBeach/src/js/components/customers/NewCustomerModal.vue
Normal file
177
NearBeach/src/js/components/customers/NewCustomerModal.vue
Normal file
@@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<div
|
||||
id="addCustomerModal"
|
||||
class="modal fade"
|
||||
tabindex="-1"
|
||||
aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog modal-xl modal-fullscreen-xl-down">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2>
|
||||
Add Customer 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">
|
||||
<new-customer-form
|
||||
:title-list="titleList"
|
||||
:flag-validation-check="flagValidationCheck"
|
||||
@update_customer_data="updateCustomerData($event)"
|
||||
></new-customer-form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a
|
||||
href="javascript:void(0)"
|
||||
class="btn btn-primary"
|
||||
@click="submitNewCustomer"
|
||||
>Add Contact</a
|
||||
>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-secondary"
|
||||
data-bs-dismiss="modal"
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NewCustomerForm from "./NewCustomerForm.vue";
|
||||
|
||||
//VueX
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
//Validation
|
||||
import useVuelidate from "@vuelidate/core";
|
||||
import {required, email} from "@vuelidate/validators";
|
||||
|
||||
export default {
|
||||
name: "NewCustomerModal",
|
||||
components: {
|
||||
NewCustomerForm,
|
||||
},
|
||||
props: {
|
||||
organisationId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
titleList: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
return {v$: useVuelidate()};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
customerEmailModel: "",
|
||||
customerFirstNameModel: "",
|
||||
customerLastNameModel: "",
|
||||
flagValidationCheck: false,
|
||||
organisationModel: {},
|
||||
titleModel: [],
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
customerEmailModel: {
|
||||
required,
|
||||
email,
|
||||
},
|
||||
customerFirstNameModel: {
|
||||
required,
|
||||
},
|
||||
customerLastNameModel: {
|
||||
required,
|
||||
},
|
||||
titleModel: {
|
||||
required,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
rootUrl: "getRootUrl",
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
async submitNewCustomer() {
|
||||
//Flag downstream to check validation
|
||||
this.flagValidationCheck = true;
|
||||
|
||||
//Reset this check after 100ms
|
||||
setTimeout(() => {
|
||||
this.flagValidationCheck = false;
|
||||
}, 100);
|
||||
|
||||
// Check the validation at this level
|
||||
const isFormCorrect = await this.v$.$validate();
|
||||
|
||||
//NEED TO USE MIXIN FOR THIS SECTION
|
||||
if (!isFormCorrect) {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Please check validation",
|
||||
message: "Sorry, but can you please fix all validation issues.",
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
});
|
||||
|
||||
//Just return - as we do not need to do the rest of this function
|
||||
return;
|
||||
}
|
||||
|
||||
//Create the data_to_send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("customer_title", this.titleModel);
|
||||
data_to_send.set(
|
||||
"customer_first_name",
|
||||
this.customerFirstNameModel
|
||||
);
|
||||
data_to_send.set(
|
||||
"customer_last_name",
|
||||
this.customerLastNameModel
|
||||
);
|
||||
data_to_send.set("customer_email", this.customerEmailModel);
|
||||
data_to_send.set("organisation", this.organisationId);
|
||||
|
||||
//Send the data using axios
|
||||
this.axios.post(
|
||||
`${this.rootUrl}new_customer/save/`,
|
||||
data_to_send
|
||||
).then((response) => {
|
||||
//Go to the new customer page
|
||||
window.location.href = response.data;
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Could not save customer",
|
||||
message: `Sorry, could not save the customer. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
updateCustomerData(data) {
|
||||
//Update the modal field with the value data
|
||||
this[data.field] = data.value;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="kanbanList.length > 0"
|
||||
class="card"
|
||||
>
|
||||
<div class="card-body">
|
||||
<h1>Open Kanban Boards</h1>
|
||||
<hr/>
|
||||
|
||||
<!-- List all kanban boards -->
|
||||
<render-object-card
|
||||
:search-results="kanbanList"
|
||||
:import-variables="kanbanVariables"
|
||||
destination="kanban"
|
||||
></render-object-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//Components
|
||||
import RenderObjectCard from "Components/render/RenderObjectCard.vue";
|
||||
|
||||
export default {
|
||||
name: "DashboardKanbanList",
|
||||
components: {
|
||||
RenderObjectCard,
|
||||
},
|
||||
props: {
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
},
|
||||
data: () => ({
|
||||
kanbanList: [],
|
||||
kanbanVariables: {
|
||||
header: "Kanban Boards",
|
||||
prefix: "Kan",
|
||||
id: "id",
|
||||
title: "title",
|
||||
status: "status",
|
||||
end_date: "end_date",
|
||||
},
|
||||
}),
|
||||
mounted() {
|
||||
//Get list of kanban items
|
||||
this.getMyKanbanList();
|
||||
},
|
||||
methods: {
|
||||
getMyKanbanList() {
|
||||
//Use axios to get data
|
||||
this.axios
|
||||
.post(`${this.rootUrl}dashboard/get/kanban_list/`)
|
||||
.then((response) => {
|
||||
//Map out the data to a flatted table for rendering purposes.
|
||||
this.kanbanList = response.data.map((row) => {
|
||||
return {
|
||||
id: row.pk,
|
||||
title: row.fields.kanban_board_name,
|
||||
status: "Open",
|
||||
end_date: "",
|
||||
};
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error Getting Kanban List",
|
||||
message: `Error getting kanban list. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
168
NearBeach/src/js/components/dashboard/DashboardMyObjects.vue
Normal file
168
NearBeach/src/js/components/dashboard/DashboardMyObjects.vue
Normal file
@@ -0,0 +1,168 @@
|
||||
<template>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1>My Current Objects</h1>
|
||||
<hr/>
|
||||
|
||||
<div
|
||||
v-if="!isLoaded"
|
||||
class="alert alert-dark"
|
||||
>
|
||||
Still obtaining your assigned jobs.
|
||||
</div>
|
||||
|
||||
<!-- Requirements -->
|
||||
<render-object-card
|
||||
v-if="objectResults.requirement.length > 0"
|
||||
:search-results="objectResults.requirement"
|
||||
:import-variables="requirementVariables"
|
||||
destination="requirement"
|
||||
></render-object-card>
|
||||
|
||||
<!-- Projects -->
|
||||
<render-object-card
|
||||
v-if="objectResults.project.length > 0"
|
||||
:search-results="objectResults.project"
|
||||
:import-variables="projectVariables"
|
||||
destination="project"
|
||||
></render-object-card>
|
||||
|
||||
<!-- Tasks -->
|
||||
<render-object-card
|
||||
v-if="objectResults.task.length > 0"
|
||||
:search-results="objectResults.task"
|
||||
:import-variables="taskVariables"
|
||||
destination="task"
|
||||
></render-object-card>
|
||||
|
||||
<!-- Kanban Boards -->
|
||||
<render-object-card
|
||||
v-if="objectResults.kanban_board.length > 0"
|
||||
:search-results="objectResults.kanban_board"
|
||||
:import-variables="kanbanBoardVariables"
|
||||
destination="kanban"
|
||||
></render-object-card>
|
||||
|
||||
<!-- Kanban Cards -->
|
||||
<render-object-card
|
||||
v-if="objectResults.card.length > 0"
|
||||
:search-results="objectResults.card"
|
||||
:import-variables="cardVariables"
|
||||
destination="card"
|
||||
></render-object-card>
|
||||
|
||||
<!-- If there are no objects -->
|
||||
<div
|
||||
v-if="countObjects === 0 && isLoaded"
|
||||
class="alert alert-primary"
|
||||
>
|
||||
It looks like no one has assigned you any tasks.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//Components
|
||||
import RenderObjectCard from "Components/render/RenderObjectCard.vue";
|
||||
|
||||
export default {
|
||||
name: "DashboardMyObjects",
|
||||
components: {
|
||||
RenderObjectCard,
|
||||
},
|
||||
props: {
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoaded: false,
|
||||
objectResults: {
|
||||
card: [],
|
||||
kanban_board: [],
|
||||
requirement: [],
|
||||
project: [],
|
||||
task: [],
|
||||
},
|
||||
cardVariables: {
|
||||
header: "Cards",
|
||||
prefix: "Card",
|
||||
id: "kanban_card_id",
|
||||
title: "kanban_card_text",
|
||||
status: "kanban_column__kanban_column_name",
|
||||
end_date: "",
|
||||
},
|
||||
kanbanBoardVariables: {
|
||||
header: "Kanban Boards",
|
||||
prefix: "Kanban",
|
||||
id: "kanban_board_id",
|
||||
title: "kanban_board_name",
|
||||
status: "kanban_board_status",
|
||||
end_date: "",
|
||||
},
|
||||
projectVariables: {
|
||||
header: "Projects",
|
||||
prefix: "Pro",
|
||||
id: "project_id",
|
||||
title: "project_name",
|
||||
status: "project_status__project_status",
|
||||
end_date: "project_end_date",
|
||||
},
|
||||
requirementVariables: {
|
||||
header: "Your Requirements",
|
||||
prefix: "Req",
|
||||
id: "requirement_id",
|
||||
title: "requirement_title",
|
||||
status: "requirement_status__requirement_status",
|
||||
end_date: "",
|
||||
},
|
||||
taskVariables: {
|
||||
header: "Tasks",
|
||||
prefix: "Task",
|
||||
id: "task_id",
|
||||
title: "task_short_description",
|
||||
status: "task_status__task_status",
|
||||
end_date: "task_end_date",
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
countObjects() {
|
||||
return (
|
||||
this.objectResults.requirement.length +
|
||||
this.objectResults.project.length +
|
||||
this.objectResults.task.length +
|
||||
this.objectResults.card.length
|
||||
);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
//Get the data we want
|
||||
this.getMyObjects();
|
||||
},
|
||||
methods: {
|
||||
getMyObjects() {
|
||||
//Use axios to get the objects assigned to me
|
||||
this.axios
|
||||
.post(`${this.rootUrl}dashboard/get/my_objects/`)
|
||||
.then((response) => {
|
||||
this.objectResults = response.data;
|
||||
|
||||
//Update loading status
|
||||
this.isLoaded = true;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error Getting Dashboard Data",
|
||||
message: `Can't get data for My Objects. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
})
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,73 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="rfcApprovalsList.length > 0"
|
||||
class="card bg-danger"
|
||||
>
|
||||
<div class="card-body">
|
||||
<h1>Request for Changes Waiting for Approval</h1>
|
||||
<hr/>
|
||||
|
||||
<p class="text-instructions">
|
||||
The following Request for Changes, require you to action them.
|
||||
You can either approve or reject these Request for Changes.
|
||||
</p>
|
||||
|
||||
|
||||
<render-object-card
|
||||
:search-results="rfcApprovalsList"
|
||||
:import-variables="rfcVariables"
|
||||
destination="rfc"
|
||||
></render-object-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import RenderObjectCard from "Components/render/RenderObjectCard.vue";
|
||||
|
||||
export default {
|
||||
name: "DashboardRfcApprovals",
|
||||
components: {RenderObjectCard},
|
||||
props: {
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
rfcApprovalsList: [],
|
||||
rfcVariables: {
|
||||
header: "Request for Change",
|
||||
prefix: "Rfc",
|
||||
id: "rfc_id",
|
||||
title: "rfc_title",
|
||||
status: "rfc_status__rfc_status",
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getRfcApprovalsList();
|
||||
},
|
||||
methods: {
|
||||
getRfcApprovalsList() {
|
||||
//Use axios to get data
|
||||
this.axios.post(
|
||||
`${this.rootUrl}dashboard/get/rfc_approvals/`
|
||||
).then((response) => {
|
||||
//Place the data into rfcApprovalsList
|
||||
this.rfcApprovalsList = response.data;
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error Getting RFC Approvals list",
|
||||
message: `We can not get the RFC Approvals List atm. Error -> ${error}`,
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
105
NearBeach/src/js/components/dashboard/DashboardTodoToday.vue
Normal file
105
NearBeach/src/js/components/dashboard/DashboardTodoToday.vue
Normal file
@@ -0,0 +1,105 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="todoList.length > 0"
|
||||
class="card"
|
||||
>
|
||||
<div class="card-body todays-todo">
|
||||
<h1 class="mb-4">Today's Todo</h1>
|
||||
<a :href="`${rootUrl}my_planner`">My Planner</a>
|
||||
<hr/>
|
||||
|
||||
<div class="object-card-list">
|
||||
<div
|
||||
v-for="row in todoList"
|
||||
:key="row.user_job_id"
|
||||
:class="`object-card ${ getExtraClasses(row.higher_order_status) }`"
|
||||
>
|
||||
<div class="object-card--detail">
|
||||
<a :href="getUrl(row)">
|
||||
<div class="object-card--detail--link">
|
||||
{{ getPrefix(row.object_type) }}{{ row.location_id }}
|
||||
</div>
|
||||
<div class="object-card--detail--description">
|
||||
{{ row.title }}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="object-card--status">
|
||||
<a :href="getUrl(row)">
|
||||
<div class="object-card--status--status">
|
||||
{{ row.status }}
|
||||
</div>
|
||||
<p class="small-text">
|
||||
{{ useNiceDatetime(row.end_date) }}
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//Composables
|
||||
import {useNiceDatetime} from "Composables/datetime/useNiceDatetime";
|
||||
|
||||
export default {
|
||||
name: "DashboardTodoToday",
|
||||
components: {},
|
||||
props: {
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
todoList: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTodoList();
|
||||
},
|
||||
methods: {
|
||||
useNiceDatetime,
|
||||
getExtraClasses(higher_order_status) {
|
||||
if (higher_order_status === "Closed") {
|
||||
return "bg-secondary-subtle";
|
||||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
getPrefix(data) {
|
||||
switch(data) {
|
||||
case "card":
|
||||
return "Card";
|
||||
case "project":
|
||||
return "Pro";
|
||||
case "task":
|
||||
return "Task";
|
||||
default:
|
||||
return "----";
|
||||
}
|
||||
},
|
||||
getTodoList() {
|
||||
//Use Axios to obtain data
|
||||
this.axios.post(
|
||||
`${this.rootUrl}dashboard/get/todo_today/`,
|
||||
).then((response) => {
|
||||
this.todoList = response.data;
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error Getting Dashboard Data",
|
||||
message: `Can't get data for To Do Today. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
})
|
||||
});
|
||||
},
|
||||
getUrl(data) {
|
||||
return `${this.rootUrl}${data.object_type}_information/${data.location_id}/`;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1>Unassigned Objects</h1>
|
||||
<hr/>
|
||||
|
||||
<div
|
||||
v-if="!isLoaded"
|
||||
class="alert alert-dark"
|
||||
>
|
||||
Still obtaining a list of assigned objects
|
||||
</div>
|
||||
|
||||
<!-- Requirements -->
|
||||
<render-object-card
|
||||
v-if="objectResults.requirement.length > 0"
|
||||
:search-results="objectResults.requirement"
|
||||
:import-variables="requirementVariables"
|
||||
destination="requirement"
|
||||
></render-object-card>
|
||||
|
||||
<!-- Projects -->
|
||||
<render-object-card
|
||||
v-if="objectResults.project.length > 0"
|
||||
:search-results="objectResults.project"
|
||||
:import-variables="projectVariables"
|
||||
destination="project"
|
||||
></render-object-card>
|
||||
|
||||
<!-- Tasks -->
|
||||
<render-object-card
|
||||
v-if="objectResults.task.length > 0"
|
||||
:search-results="objectResults.task"
|
||||
:import-variables="taskVariables"
|
||||
destination="task"
|
||||
></render-object-card>
|
||||
|
||||
<!-- If there are no objects -->
|
||||
<div
|
||||
v-if="countObjects === 0 && isLoaded"
|
||||
class="alert alert-primary"
|
||||
>
|
||||
Good Work - all objects have been assigned to at least one user.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//Components
|
||||
import RenderObjectCard from 'Components/render/RenderObjectCard.vue';
|
||||
|
||||
export default {
|
||||
name: "DashboardUnassignedObjects",
|
||||
components: {
|
||||
RenderObjectCard,
|
||||
},
|
||||
props: {
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoaded: false,
|
||||
objectResults: {
|
||||
requirement: [],
|
||||
project: [],
|
||||
task: [],
|
||||
},
|
||||
projectVariables: {
|
||||
header: "Projects",
|
||||
prefix: "Pro",
|
||||
id: "project_id",
|
||||
title: "project_name",
|
||||
status: "project_status__project_status",
|
||||
end_date: "project_end_date",
|
||||
},
|
||||
requirementVariables: {
|
||||
header: "Your Requirements",
|
||||
prefix: "Req",
|
||||
id: "requirement_id",
|
||||
title: "requirement_title",
|
||||
status: "requirement_status__requirement_status",
|
||||
end_date: "",
|
||||
},
|
||||
taskVariables: {
|
||||
header: "Tasks",
|
||||
prefix: "Task",
|
||||
id: "task_id",
|
||||
title: "task_short_description",
|
||||
status: "task_status__task_status",
|
||||
end_date: "task_end_date",
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
countObjects() {
|
||||
return (
|
||||
this.objectResults.requirement.length +
|
||||
this.objectResults.project.length +
|
||||
this.objectResults.task.length
|
||||
);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
//Get the data we want
|
||||
this.getMyObjects();
|
||||
|
||||
//Update the state management
|
||||
this.$store.commit({
|
||||
type: "updateUrl",
|
||||
rootUrl: this.rootUrl,
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
getMyObjects() {
|
||||
//Use axios to get the objects assigned to me
|
||||
this.axios
|
||||
.post(`${this.rootUrl}dashboard/get/unassigned_objects/`)
|
||||
.then((response) => {
|
||||
this.objectResults = response.data;
|
||||
|
||||
//Update loading status
|
||||
this.isLoaded = true;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error Getting Dashboard Data",
|
||||
message: `Can't get data for My Objects. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,97 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="userList.length > 0"
|
||||
class="card"
|
||||
>
|
||||
<div class="card-body">
|
||||
<h1>Users with no groups</h1>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h2>Users with no groups</h2>
|
||||
<p class="text-instructions">
|
||||
Please take action! The following users DO NOT have any
|
||||
groups associated with them. They will not be able to
|
||||
log in.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8 user-card-list">
|
||||
<div
|
||||
v-for="user in userList"
|
||||
:key="user.id"
|
||||
class="user-card-big"
|
||||
@click="goToUser(user.id)"
|
||||
>
|
||||
<img
|
||||
:src="profilePicture(user.profile_picture)"
|
||||
alt="default profile"
|
||||
class="user-card--profile"
|
||||
/>
|
||||
<div class="user-card--details">
|
||||
<div class="user-card--name">
|
||||
{{ user.first_name }}
|
||||
{{ user.last_name }}
|
||||
</div>
|
||||
<div class="user-card--email">
|
||||
{{ user.email }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "DashboardUsersWithNoGroups",
|
||||
props: {
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
staticUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
userList: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getUserList();
|
||||
},
|
||||
methods: {
|
||||
getUserList() {
|
||||
//Get the data from the database
|
||||
this.axios
|
||||
.post(`${this.rootUrl}dashboard/get/users_with_no_groups/`)
|
||||
.then((response) => {
|
||||
this.userList = response.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error getting user list",
|
||||
message: `Sorry, we could not retrieve the user user. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
goToUser(user_id) {
|
||||
window.location.href = `${this.rootUrl}user_information/${user_id}/`;
|
||||
},
|
||||
profilePicture(picture_uuid) {
|
||||
if (picture_uuid !== null && picture_uuid !== "" && picture_uuid !== undefined) {
|
||||
return `${this.rootUrl}private/${picture_uuid}/`;
|
||||
}
|
||||
|
||||
return `${this.staticUrl}NearBeach/images/placeholder/people_tax.svg`;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
156
NearBeach/src/js/components/dates/BetweenDates.vue
Normal file
156
NearBeach/src/js/components/dates/BetweenDates.vue
Normal file
@@ -0,0 +1,156 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Between Dates</strong>
|
||||
<p class="text-instructions">
|
||||
Choose the start and end date of the {{ destination }}. Please
|
||||
note the end date can not be earlier than the start date. They
|
||||
can be equal.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label class="text-capitalize">
|
||||
{{ destination }} Start Date:
|
||||
<validation-rendering
|
||||
:error-list="v$.localStartDateModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<n-date-picker
|
||||
v-model:value="localStartDateModel"
|
||||
type="datetime"
|
||||
:disabled="userLevel<=1 || isReadOnly"
|
||||
></n-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label class="text-capitalize">
|
||||
{{ destination }} End Date:
|
||||
<validation-rendering
|
||||
:error-list="v$.localEndDateModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<n-date-picker
|
||||
v-model:value="localEndDateModel"
|
||||
type="datetime"
|
||||
:disabled="userLevel<=1 || isReadOnly"
|
||||
></n-date-picker>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {NDatePicker} from "naive-ui";
|
||||
|
||||
//Validation
|
||||
import useVuelidate from "@vuelidate/core";
|
||||
import {required} from "@vuelidate/validators";
|
||||
import ValidationRendering from "Components/validation/ValidationRendering.vue";
|
||||
|
||||
//VueX
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "BetweenDates",
|
||||
components: {
|
||||
NDatePicker,
|
||||
ValidationRendering,
|
||||
},
|
||||
props: {
|
||||
destination: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
endDateModel: {
|
||||
type: Number,
|
||||
default: () => {
|
||||
const temp_date = new Date();
|
||||
temp_date.setHours(16);
|
||||
temp_date.setMinutes(0);
|
||||
temp_date.setSeconds(0);
|
||||
temp_date.setMilliseconds(0);
|
||||
|
||||
return temp_date.getTime();
|
||||
},
|
||||
},
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
startDateModel: {
|
||||
type: Number,
|
||||
default: () => {
|
||||
const temp_date = new Date();
|
||||
temp_date.setHours(9);
|
||||
temp_date.setMinutes(0);
|
||||
temp_date.setSeconds(0);
|
||||
temp_date.setMilliseconds(0);
|
||||
|
||||
return temp_date.getTime();
|
||||
},
|
||||
},
|
||||
},
|
||||
emits: ['update_dates'],
|
||||
setup() {
|
||||
return {v$: useVuelidate()};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
localEndDateModel: this.endDateModel,
|
||||
localStartDateModel: this.startDateModel,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
userLevel: "getUserLevel",
|
||||
}),
|
||||
},
|
||||
validations: {
|
||||
localEndDateModel: {
|
||||
required,
|
||||
},
|
||||
localStartDateModel: {
|
||||
required,
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
localEndDateModel() {
|
||||
//If the user update the end date to appear BEFORE the start date, we should update the start date to be
|
||||
// 1 day BEFORE the end date
|
||||
if (this.localEndDateModel < this.localStartDateModel) {
|
||||
this.localStartDateModel = this.localEndDateModel - (24 * 60 * 60 * 1000);
|
||||
}
|
||||
|
||||
//Send the new results up steam
|
||||
this.emitDates();
|
||||
},
|
||||
localStartDateModel() {
|
||||
//If the user updates the start date to appear AFTER the end date, we should update the end date to be
|
||||
// 1 day AFTER the start date
|
||||
if (this.localStartDateModel > this.localEndDateModel) {
|
||||
this.localEndDateModel = this.localStartDateModel + (24 * 60 * 60 * 1000);
|
||||
}
|
||||
|
||||
//Send the new results up stream
|
||||
this.emitDates();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
//In case the dates fall on default - send up stream
|
||||
this.emitDates();
|
||||
},
|
||||
methods: {
|
||||
emitDates() {
|
||||
//Send this data upstream
|
||||
this.$emit("update_dates", {
|
||||
start_date: this.localStartDateModel,
|
||||
end_date: this.localEndDateModel,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Email Test</strong>
|
||||
<p class="text-instructions">
|
||||
Please click "Send Email", to send an email to yourself. If you do not receive an email, it means there
|
||||
is something broken.
|
||||
</p>
|
||||
<p class="text-instructions">
|
||||
Potential Issues
|
||||
</p>
|
||||
<ul>
|
||||
<li>Spam Blocking Email</li>
|
||||
<li>Server not sending</li>
|
||||
<li>Email Credentials Incorrect</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<button
|
||||
v-if="emailState === 'not_started'"
|
||||
class="btn btn-warning"
|
||||
@click="sendEmail"
|
||||
>Send Email</button>
|
||||
|
||||
<div
|
||||
v-if="emailState === 'sending_email'"
|
||||
class="alert alert-warning"
|
||||
>
|
||||
Currently sending the email. Please wait.
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="emailState === 'sent_email'"
|
||||
class="alert alert-success"
|
||||
>
|
||||
Email sent by backend. Please check your inbox. If you do not receive the email, please check to make
|
||||
sure it is not in spam.
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="emailState === 'failed_sending'"
|
||||
class="alert alert-danger"
|
||||
>
|
||||
Sorry. The backend server could not send the email. Please check logs
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "DiagnosticEmailTest",
|
||||
data() {
|
||||
return {
|
||||
emailState: "not_started",
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
rootUrl: "getRootUrl",
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
sendEmail() {
|
||||
//Update email state
|
||||
this.emailState = "sending_email";
|
||||
|
||||
this.axios.post(
|
||||
`${this.rootUrl}diagnostic_information/email_test/`,
|
||||
).then(() => {
|
||||
this.emailState = "sent_email";
|
||||
}).catch((error) => {
|
||||
this.emailState = "failed_sending";
|
||||
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error sending Email",
|
||||
message: `${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
234
NearBeach/src/js/components/diagnostic/DiagnosticInformation.vue
Normal file
234
NearBeach/src/js/components/diagnostic/DiagnosticInformation.vue
Normal file
@@ -0,0 +1,234 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1>Diagnostic Information</h1>
|
||||
<hr/>
|
||||
|
||||
<h2>Core Configurations</h2>
|
||||
|
||||
<div class="spacer"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Azure Storage</strong>
|
||||
<p class="text-instructions">
|
||||
Confirms these values have been set in your Django Settings file. Please ignore if you are
|
||||
not utilsing Azure Storage
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width:80%">Configuration Field</td>
|
||||
<td style="width:20%">Is Filled In</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>AZURE_STORAGE_CONNECTION_STRING</td>
|
||||
<td>{{ azureStorageConnectionString }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>AZURE_STORAGE_CONTAINER_NAME</td>
|
||||
<td>{{ azureStorageContainerName }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>S3/R2/Minio Storage</strong>
|
||||
<p class="text-instructions">
|
||||
Confirms these values have been set in your Django Settings file. Please ignore if you are
|
||||
not utilsing either S3, R2, or Minio storage solutions.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width:80%">Configuration Field</td>
|
||||
<td style="width:20%">Is Filled In</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>AWS_ACCESS_KEY_ID</td>
|
||||
<td>{{ awsAccessKeyId }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>AWS_SECRET_ACCESS_KEY</td>
|
||||
<td>{{ awsSecretAccessKey }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>AWS_S3_ENDPOINT_URL (for minio)</td>
|
||||
<td>{{ awsS3EndpointUrl }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>AWS_STORAGE_BUCKET_NAME</td>
|
||||
<td>{{ awsStorageBucketName }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Email</strong>
|
||||
<p class="text-instructions">
|
||||
Confirms these values have been set in your Django Settings file.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width:80%">Configuration Field</td>
|
||||
<td style="width:20%">Values</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>SMTP_EMAIL_HOST</td>
|
||||
<td>{{ smtpEmailHost }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SMTP_EMAIL_HOST_USER</td>
|
||||
<td>{{ smtpEmailHostUser }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Allowed Hosts & CSRF Trusted URLS</strong>
|
||||
<p class="text-instructions">
|
||||
Confirms these values have been set in your Django Settings file.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td style="width:50%">Configuration Field</td>
|
||||
<td style="width:50%">Is Filled In</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>ALLOWED_HOSTS</td>
|
||||
<td>
|
||||
<p
|
||||
v-for="single in allowedHosts"
|
||||
:key="single"
|
||||
>- {{ single }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CSRF_TRUSTED_URLS</td>
|
||||
<td>
|
||||
<p
|
||||
v-for="single in allowedHosts"
|
||||
:key="single"
|
||||
>- {{ single }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<diagnostic-upload></diagnostic-upload>
|
||||
|
||||
<hr/>
|
||||
|
||||
<diagnostic-email-test></diagnostic-email-test>
|
||||
</div>
|
||||
</div>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//Components
|
||||
import DiagnosticUpload from "./DiagnosticUploadTest.vue";
|
||||
import DiagnosticEmailTest from "./DiagnosticEmailTest.vue";
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
|
||||
export default {
|
||||
name: "DiagnosticInformation",
|
||||
components: {
|
||||
DiagnosticEmailTest,
|
||||
DiagnosticUpload
|
||||
},
|
||||
props: {
|
||||
awsAccessKeyId: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
awsSecretAccessKey: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
allowedHosts: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
awsS3EndpointUrl: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
awsStorageBucketName: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
azureStorageConnectionString: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
azureStorageContainerName: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
smtpEmailHost: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
smtpEmailHostUser: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "light",
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.$store.commit({
|
||||
type: "updateUrl",
|
||||
rootUrl: this.rootUrl,
|
||||
});
|
||||
},
|
||||
methods: {useNBTheme}
|
||||
}
|
||||
</script>
|
||||
120
NearBeach/src/js/components/diagnostic/DiagnosticUploadTest.vue
Normal file
120
NearBeach/src/js/components/diagnostic/DiagnosticUploadTest.vue
Normal file
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="uploadState === 'before_upload'"
|
||||
class="row"
|
||||
>
|
||||
<div class="col-md-4">
|
||||
<strong>Upload Document Test</strong>
|
||||
<p class="text-instructions">
|
||||
Please click on the "Upload Document" button. It will upload a small text file to the blob storage. If
|
||||
there are any issues, they will print here.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<button
|
||||
class="btn btn-primary"
|
||||
@click="uploadFile"
|
||||
>
|
||||
Upload Test
|
||||
</button>
|
||||
|
||||
<div
|
||||
v-if="uploadIssues !== ''"
|
||||
class="alert alert-danger"
|
||||
>
|
||||
<h1>Upload Issues</h1>
|
||||
{{ uploadIssues }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="uploadState === 'sending'">
|
||||
<div class="alert alert-info">Currently sending data</div>
|
||||
</div>
|
||||
<div v-else-if="uploadState === 'error'">
|
||||
<div class="alert alert-danger">
|
||||
Sorry this upload process failed. Please read the error below.
|
||||
</div>
|
||||
<iframe :srcdoc="uploadError"></iframe>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="row"
|
||||
>
|
||||
<div class="col-md-4">
|
||||
<strong>Test Download</strong>
|
||||
<p class="text-instructions">
|
||||
Please download the file and compare it's components with the UUID. They should match.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<p><a :href="downloadLocation" target="_blank" rel="noopener noreferrer">Please click here to download the file.</a></p>
|
||||
<p>It's contents should match the UUID: {{ uuidVerification }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//VueX
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
//Composables
|
||||
import {useRandomID} from "Composables/security/useRandomID";
|
||||
|
||||
export default {
|
||||
name: "DiagnosticUpload",
|
||||
data() {
|
||||
return {
|
||||
downloadLocation: "",
|
||||
uploadError: "",
|
||||
uploadIssues: "",
|
||||
uploadState: "before_upload",
|
||||
uuidVerification: "",
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
rootUrl: 'getRootUrl',
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
uploadFile() {
|
||||
//State changes
|
||||
this.uploadState = "sending";
|
||||
|
||||
//Create a simple uuid
|
||||
const uuid = useRandomID();
|
||||
|
||||
//Create the file we are uploading
|
||||
const document = new Blob([uuid], { type: "text/plain"});
|
||||
|
||||
//Create the form data
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set(
|
||||
'document',
|
||||
document,
|
||||
'diagnostic-upload-test.txt',
|
||||
);
|
||||
data_to_send.set("uuid", uuid.toString());
|
||||
|
||||
this.axios.post(
|
||||
`${this.rootUrl}diagnostic_information/upload_test/`,
|
||||
data_to_send,
|
||||
).then((response) => {
|
||||
this.uploadState = "Completed";
|
||||
this.uuidVerification = uuid;
|
||||
this.downloadLocation = `${this.rootUrl}private/${response.data[0].document_key_id}/`
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error with Uploads",
|
||||
message: `Sorry could not upload document. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
|
||||
this.uploadState = "error";
|
||||
this.uploadError = error.response.data;
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
482
NearBeach/src/js/components/gantt_chart/GanttInformation.vue
Normal file
482
NearBeach/src/js/components/gantt_chart/GanttInformation.vue
Normal file
@@ -0,0 +1,482 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div
|
||||
class="gantt-chart"
|
||||
:style="ganttStyle"
|
||||
@mouseup="mouseUp"
|
||||
@mouseleave="mouseLeave"
|
||||
@mousemove="mouseMove"
|
||||
>
|
||||
<render-gantt-monthly-header></render-gantt-monthly-header>
|
||||
<render-gantt-days-header></render-gantt-days-header>
|
||||
|
||||
<!-- RENDER EACH GANTT ROW-->
|
||||
<render-gantt-group
|
||||
v-for="(row, index) in filteredGanttChartData"
|
||||
:key="index"
|
||||
:description="row.description"
|
||||
:end-date="row.end_date"
|
||||
:is-closed="isParentClosed()"
|
||||
:level-number="0"
|
||||
:object-id="row.object_id"
|
||||
:object-type="row.object_type"
|
||||
:parent-object-id="0"
|
||||
:parent-object-type="row.parent_object_type"
|
||||
:higher-order-status="row.higher_order_status"
|
||||
:sprint-object-assignment-id="row.sprint_object_assignment_id"
|
||||
:start-date="row.start_date"
|
||||
:status-id="row.status_id"
|
||||
:title="row.title"
|
||||
></render-gantt-group>
|
||||
|
||||
<render-blank-gantt-row></render-blank-gantt-row>
|
||||
|
||||
</div>
|
||||
</n-config-provider>
|
||||
|
||||
<div
|
||||
v-if="startDateIssues.length >= 1"
|
||||
class="alert alert-warning"
|
||||
>
|
||||
The following Objects have start dates BEFORE the gantt chart's start date.
|
||||
<ul>
|
||||
<li
|
||||
v-for="(issue, index) in startDateIssues"
|
||||
:key="index"
|
||||
>
|
||||
{{ issue.object_type }}{{ issue.object_id }} - {{issue.title }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="endDateIssues.length >= 1"
|
||||
class="alert alert-warning"
|
||||
>
|
||||
The following Objects have end dates AFTER the gantt chart's end date.
|
||||
<ul>
|
||||
<li
|
||||
v-for="(issue, index) in endDateIssues"
|
||||
:key="index"
|
||||
>
|
||||
{{ issue.object_type }}{{ issue.object_id }} - {{issue.title }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<confirm-object-remove></confirm-object-remove>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
import {DateTime} from "luxon";
|
||||
|
||||
|
||||
//Components
|
||||
import ConfirmObjectRemove from "Modules/wizards/ConfirmObjectRemove.vue";
|
||||
import RenderGanttDaysHeader from "./RenderGanttDaysHeader.vue";
|
||||
import RenderGanttMonthlyHeader from "./RenderGanttMonthlyHeader.vue";
|
||||
import RenderBlankGanttRow from "./RenderBlankGanttRow.vue";
|
||||
|
||||
//Composable
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
import RenderGanttGroup from "./RenderGanttGroup.vue";
|
||||
|
||||
export default {
|
||||
name: "GanttChart",
|
||||
components: {
|
||||
RenderGanttGroup,
|
||||
ConfirmObjectRemove,
|
||||
RenderBlankGanttRow,
|
||||
RenderGanttDaysHeader,
|
||||
RenderGanttMonthlyHeader,
|
||||
},
|
||||
props: {
|
||||
destination: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
ganttEndDate: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
ganttStartDate: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
locationId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
parentStatus: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "light",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
endDateIssues: [],
|
||||
ganttStyle: "",
|
||||
startDateIssues: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
deltaDays: "getDeltaDays",
|
||||
ganttChartData: "getGanttChartData",
|
||||
|
||||
//Mouse Down Variables
|
||||
isMouseDown: "getIsMouseDown",
|
||||
mdClientXInitial: "getMdClientXInitial",
|
||||
mdIndex: "getMdIndex",
|
||||
mdObjectId: "getMdObjectId",
|
||||
mdObjectType: "getMdObjectType",
|
||||
mdParentObjectId: "getMdParentObjectId",
|
||||
mdParentObjectType: "getMdParentObjectType",
|
||||
mdColumn: "getMdColumn",
|
||||
mdEndDateInitial: "getMdEndDateInitial",
|
||||
mdHigherOrderStatus: "getMdHigherOrderStatus",
|
||||
mdStartDateInitial: "getMdStartDateInitial",
|
||||
mdStatus: "getMdStatus",
|
||||
mdStatusId: "getMdStatusId",
|
||||
mdTitle: "getMdTitle",
|
||||
}),
|
||||
|
||||
filteredGanttChartData() {
|
||||
return this.ganttChartData("", "");
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
deltaDays: {
|
||||
handler() {
|
||||
this.updateGanttStyle();
|
||||
}
|
||||
},
|
||||
ganttChartData: {
|
||||
handler() {
|
||||
//Use the method
|
||||
this.checkAllObjectsAreWithinDates();
|
||||
},
|
||||
deep: true,
|
||||
immediate: false,
|
||||
},
|
||||
},
|
||||
created() {
|
||||
window.addEventListener("resize", this.updateGanttStyle);
|
||||
},
|
||||
unmounted() {
|
||||
window.removeEventListener("resize", this.updateGanttStyle);
|
||||
},
|
||||
mounted() {
|
||||
this.initialiseData();
|
||||
},
|
||||
methods: {
|
||||
useNBTheme,
|
||||
checkAllObjectsAreWithinDates() {
|
||||
//Setup the dates
|
||||
const end_date = DateTime.fromISO(this.ganttEndDate);
|
||||
const start_date = DateTime.fromISO(this.ganttStartDate);
|
||||
|
||||
//If any of the dates fall outside the time frame, we want to notify the user
|
||||
this.endDateIssues = this.ganttChartData.filter((row) => {
|
||||
return row.end_date > end_date.ts;
|
||||
});
|
||||
|
||||
this.startDateIssues = this.ganttChartData.filter((row) => {
|
||||
return row.start_date < start_date.ts;
|
||||
});
|
||||
},
|
||||
initialiseData() {
|
||||
//Escape conditions
|
||||
if (this.destination === "") return;
|
||||
if (this.locationId === 0) return;
|
||||
|
||||
//Get Data from backend
|
||||
this.axios.get(
|
||||
// `${this.rootUrl}gantt_data/${this.destination}/${this.locationId}/get_data/`,
|
||||
`${this.rootUrl}api/v0/${this.destination}/${this.locationId}/`,
|
||||
).then((response) => {
|
||||
//Get the dates
|
||||
let end_date = DateTime.fromISO(this.ganttEndDate);
|
||||
let start_date = DateTime.fromISO(this.ganttStartDate);
|
||||
|
||||
//Set the end/start date's times to 12:00:00AM
|
||||
end_date = end_date.set({hour: 0, minute: 0, second: 0, millisecond: 0});
|
||||
start_date = start_date.set({hour: 0, minute: 0, second: 0, millisecond: 0});
|
||||
|
||||
//Update the status lists
|
||||
this.$store.commit({
|
||||
type: "updateGanttStatusList",
|
||||
ganttStatusList: response.data.status_results,
|
||||
});
|
||||
|
||||
//Initialise gantt chart data
|
||||
this.$store.dispatch("initialiseGanttChartData", {
|
||||
ganttChartData: response.data.object_results,
|
||||
endDateGantt: end_date.ts,
|
||||
startDateGantt: start_date.ts,
|
||||
});
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error fetching Gantt Data",
|
||||
message: `Can not retrieve gantt data. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
})
|
||||
},
|
||||
isParentClosed() {
|
||||
const closed_status = [
|
||||
'finished',
|
||||
'closed',
|
||||
];
|
||||
|
||||
return closed_status.includes(this.parentStatus.toLowerCase());
|
||||
},
|
||||
mouseLeave(event) {
|
||||
event.preventDefault();
|
||||
|
||||
//Tell the system the mouse is no longer down
|
||||
this.$store.commit("updateMouseDown", {
|
||||
isMouseDown: false,
|
||||
});
|
||||
|
||||
//Check to make sure we need to update the backend
|
||||
if (this.mdObjectId !== 0) {
|
||||
//Update the backend
|
||||
// this.$nextTick(() => {
|
||||
// this.updateGanttData();
|
||||
// });
|
||||
this.updateGanttData();
|
||||
}
|
||||
},
|
||||
mouseMove(event) {
|
||||
//Prevents default
|
||||
event.preventDefault();
|
||||
|
||||
//If closed do nothing
|
||||
if (this.isParentClosed()) return;
|
||||
|
||||
//Make sure not on a touch device, simple hand gestures will cause unwanted results. aka bars moving around
|
||||
const touch = matchMedia('(hover: none)').matches;
|
||||
if (touch) return;
|
||||
|
||||
//Make sure mouse is down - if it isn't, then we don't want anything to move :)
|
||||
if (this.isMouseDown !== true) return
|
||||
|
||||
//Deal with the mouse movement
|
||||
const client_x_final = event.clientX;
|
||||
|
||||
//Get the number of hours from this
|
||||
const delta = Math.floor((client_x_final - this.mdClientXInitial) / 2) * (60 * 60 * 1000);
|
||||
|
||||
//Depending on the column, depends what functionality we are updating.
|
||||
switch (this.mdColumn) {
|
||||
case "end":
|
||||
this.updateEnd(delta);
|
||||
break;
|
||||
case "middle":
|
||||
this.updateMiddle(delta);
|
||||
break;
|
||||
case "start":
|
||||
this.updateStart(delta);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
mouseUp(event) {
|
||||
event.preventDefault();
|
||||
|
||||
//Tell the system the mouse is no longer down
|
||||
this.$store.commit("updateMouseDown", {
|
||||
isMouseDown: false,
|
||||
});
|
||||
|
||||
//Update the backend data
|
||||
if (this.mdObjectId !== 0) {
|
||||
// this.$nextTick(() => {
|
||||
// this.updateGanttData();
|
||||
// });
|
||||
this.updateGanttData();
|
||||
}
|
||||
},
|
||||
updateEnd(delta) {
|
||||
//Apply the delta to the dates
|
||||
const end_date = new Date(this.mdEndDateInitial + delta);
|
||||
|
||||
//Do nothing if the end date is past the sprint's end date
|
||||
const g_e_d = DateTime.fromISO(
|
||||
this.ganttEndDate
|
||||
).set({
|
||||
hour: 23,
|
||||
minute: 59,
|
||||
second: 59,
|
||||
millisecond: 999,
|
||||
});
|
||||
if (this.mdEndDateInitial + delta > g_e_d.ts) return;
|
||||
|
||||
//Do nothing if the end date is less than the start date
|
||||
if (this.mdEndDateInitial + delta <= this.mdStartDateInitial) return;
|
||||
|
||||
//Update VueX with the new dates\
|
||||
this.$store.dispatch("updateGanttChartSingleRow", {
|
||||
end_date: end_date.getTime(),
|
||||
higher_order_status: this.mdHigherOrderStatus,
|
||||
object_id: this.mdObjectId,
|
||||
object_type: this.mdObjectType,
|
||||
start_date: this.mdStartDateInitial,
|
||||
status_id: this.mdStatusId,
|
||||
title: this.mdTitle,
|
||||
});
|
||||
},
|
||||
updateGanttData() {
|
||||
//If we are not moving the bar itself, we don't want to complete this function.
|
||||
const required_conditions = ["end", "middle", "start"];
|
||||
if (!required_conditions.includes(this.mdColumn)) return;
|
||||
|
||||
//Get the data from VueX
|
||||
const data = this.$store.getters.getGanttChartDataSingleRow(
|
||||
this.mdObjectId,
|
||||
this.mdObjectType,
|
||||
this.mdParentObjectId,
|
||||
this.mdParentObjectType,
|
||||
);
|
||||
|
||||
if (data === undefined) {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error Updating Gantt Data",
|
||||
message: "We have had an issue isolating that particular record.",
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Send updated data to the backend
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set('status_id', data.status_id);
|
||||
|
||||
//Handle the start and end date
|
||||
const end_date = new Date(data.end_date);
|
||||
const start_date = new Date(data.start_date);
|
||||
data_to_send.set('end_date', end_date.toISOString());
|
||||
data_to_send.set('start_date', start_date.toISOString());
|
||||
|
||||
//Use axios to update backend
|
||||
this.axios.post(
|
||||
`${this.rootUrl}gantt_data/${data.object_type}/${data.object_id}/update_data/`,
|
||||
data_to_send
|
||||
).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error Updating the Object",
|
||||
message: `Sorry, we could not update the object's information. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
})
|
||||
});
|
||||
|
||||
//Release the data
|
||||
this.$store.commit("updateMouseDown", {
|
||||
mdObjectId: 0,
|
||||
});
|
||||
},
|
||||
updateGanttStyle() {
|
||||
//Function used to determine the size and margin of the gantt chart.
|
||||
//Get the max width of the gantt chart
|
||||
const gantt_max_width = 900 + ((this.deltaDays + 1) * 48);
|
||||
|
||||
//Get the width of the screen
|
||||
const container_element = document.getElementsByClassName("container-wide")[0];
|
||||
|
||||
//If there is no container - RUN
|
||||
if (container_element === undefined) return;
|
||||
|
||||
const screen_width = container_element.clientWidth;
|
||||
|
||||
//If screen width > gantt_max_width, we want to specify the gantt chart size, and margin
|
||||
if (parseInt(screen_width) > parseInt(gantt_max_width)) {
|
||||
this.ganttStyle = `width:${gantt_max_width}px; margin: 0 10;`;
|
||||
} else {
|
||||
this.ganttStyle = "width: calc(100vw - 10px);";
|
||||
}
|
||||
},
|
||||
updateMiddle(delta) {
|
||||
//Do nothing if the start date is past the sprint's start date
|
||||
const g_s_d = DateTime.fromISO(
|
||||
this.ganttStartDate
|
||||
).set({
|
||||
hour: 0,
|
||||
minute: 0,
|
||||
second: 0,
|
||||
millisecond: 0
|
||||
});
|
||||
if (this.mdStartDateInitial + delta < g_s_d.ts) return;
|
||||
|
||||
//Do nothing if the end date is past the sprint's end date
|
||||
const g_e_d = DateTime.fromISO(
|
||||
this.ganttEndDate
|
||||
).set({
|
||||
hour: 23,
|
||||
minute: 59,
|
||||
second: 59,
|
||||
millisecond: 999,
|
||||
});
|
||||
if (this.mdEndDateInitial + delta > g_e_d.ts) return;
|
||||
|
||||
//Apply the delta to the dates
|
||||
const end_date = new Date(this.mdEndDateInitial + delta);
|
||||
const start_date = new Date(this.mdStartDateInitial + delta);
|
||||
|
||||
//Update VueX with the new dates\
|
||||
this.$store.dispatch("updateGanttChartSingleRow", {
|
||||
end_date: end_date.getTime(),
|
||||
higher_order_status: this.mdHigherOrderStatus,
|
||||
object_id: this.mdObjectId,
|
||||
object_type: this.mdObjectType,
|
||||
start_date: start_date.getTime(),
|
||||
status_id: this.mdStatusId,
|
||||
title: this.mdTitle,
|
||||
});
|
||||
},
|
||||
updateStart(delta) {
|
||||
//Apply the delta to the dates
|
||||
const start_date = new Date(this.mdStartDateInitial + delta);
|
||||
|
||||
//If the start date is less than the gantt start date - do nothing
|
||||
const g_s_d = DateTime.fromISO(
|
||||
this.ganttStartDate
|
||||
).set({
|
||||
hour: 0,
|
||||
minute: 0,
|
||||
second: 0,
|
||||
millisecond: 0
|
||||
});
|
||||
if (this.mdStartDateInitial + delta < g_s_d.ts) return;
|
||||
|
||||
//If the start date is greater or equal to the end date. Do nothing
|
||||
if (this.mdStartDateInitial + delta >= this.mdEndDateInitial) return;
|
||||
|
||||
//Update VueX with the new dates\
|
||||
this.$store.dispatch("updateGanttChartSingleRow", {
|
||||
end_date: this.mdEndDateInitial,
|
||||
higher_order_status: this.mdHigherOrderStatus,
|
||||
object_id: this.mdObjectId,
|
||||
object_type: this.mdObjectType,
|
||||
start_date: start_date.getTime(),
|
||||
status_id: this.mdStatusId,
|
||||
title: this.mdTitle,
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
127
NearBeach/src/js/components/gantt_chart/RenderBlankGanttRow.vue
Normal file
127
NearBeach/src/js/components/gantt_chart/RenderBlankGanttRow.vue
Normal file
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<div
|
||||
id="gantt_row_parent"
|
||||
class="gantt-row"
|
||||
>
|
||||
<div
|
||||
class="gantt-row--information"
|
||||
@dragleave="dragleaveRow"
|
||||
@dragover="dragoverRow"
|
||||
@drop="drop"
|
||||
>
|
||||
<div class="gantt-row--title"></div>
|
||||
<div class="gantt-row--start-date"></div>
|
||||
<div class="gantt-row--end-date"></div>
|
||||
<div class="gantt-row--status"></div>
|
||||
</div>
|
||||
|
||||
<div class="gantt-row--render"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//VueX
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "RenderBlankGanttRow",
|
||||
emits: ['mouse_down'],
|
||||
data() {
|
||||
return {
|
||||
datePickerFormat: "yyyy-MM-dd HH:mm",
|
||||
localEndDate: this.endDate,
|
||||
localStartDate: this.startDate,
|
||||
localStatusId: this.statusId,
|
||||
statusList: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
rootUrl: "getRootUrl",
|
||||
|
||||
//Mouse Down
|
||||
mdObjectId: "getMdObjectId",
|
||||
mdObjectType: "getMdObjectType",
|
||||
mdParentObjectId: "getMdParentObjectId",
|
||||
mdParentObjectType: "getMdParentObjectType",
|
||||
mdColumn: "getMdColumn",
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
canBeDestination() {
|
||||
const exclude_array = [
|
||||
null,
|
||||
"",
|
||||
undefined,
|
||||
];
|
||||
|
||||
return !exclude_array.includes(this.mdParentObjectType);
|
||||
},
|
||||
canObjectMove() {
|
||||
//If there are multiple instances of the same object on the sprint, the user can not move this object to
|
||||
//the root level. As the object can only be a child element, or root element. Not both at the same time. :)
|
||||
const object_list = this.$store.getters.getGanttChartDataByObject(this.mdObjectId, this.mdObjectType);
|
||||
return object_list.length <= 1;
|
||||
},
|
||||
dragleaveRow(event) {
|
||||
event.preventDefault();
|
||||
|
||||
const element = document.getElementById("gantt_row_parent");
|
||||
element.classList.remove("gantt-chart-row-destination");
|
||||
},
|
||||
dragoverRow(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (this.canBeDestination() === false) return;
|
||||
|
||||
const element = document.getElementById("gantt_row_parent");
|
||||
element.classList.add("gantt-chart-row-destination");
|
||||
},
|
||||
drop(event) {
|
||||
event.preventDefault();
|
||||
|
||||
const element = document.getElementById("gantt_row_parent");
|
||||
element.classList.remove("gantt-chart-row-destination");
|
||||
|
||||
if (this.canBeDestination() === false) return;
|
||||
|
||||
if (!this.canObjectMove()) {
|
||||
this.$store.dispatch("newToast", {
|
||||
heading: "Can not move object",
|
||||
message: "Sorry object can't be moved, as it isn't the only instance of that object. An object can only exist at root level if it is the only instance",
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Handle the process of moving the object :)
|
||||
this.$store.dispatch("updateGanttChartSingleRowsParent", {
|
||||
object_id: this.mdObjectId,
|
||||
object_type: this.mdObjectType,
|
||||
parent_object_id: this.mdParentObjectId,
|
||||
parent_object_type: this.mdParentObjectType,
|
||||
new_parent_object_id: 0,
|
||||
new_parent_object_type: "",
|
||||
});
|
||||
|
||||
const data_to_remove = new FormData();
|
||||
data_to_remove.set("link_id", this.mdObjectId);
|
||||
data_to_remove.set("link_connection", this.mdObjectType);
|
||||
|
||||
this.axios.post(
|
||||
`${this.rootUrl}object_data/${this.mdParentObjectType}/${this.mdParentObjectId}/remove_link/`,
|
||||
data_to_remove,
|
||||
).catch(error => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Failed Updating Sprint",
|
||||
message: `Sorry, moving the object failed. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<div class="gantt-header">
|
||||
<div class="gantt-header--information">
|
||||
<div class="gantt-header--title">Object Title</div>
|
||||
<div class="gantt-header--start-date">Start Date</div>
|
||||
<div class="gantt-header--end-date">End Date</div>
|
||||
<div class="gantt-header--status">Status</div>
|
||||
</div>
|
||||
<div class="gantt-header--dates">
|
||||
<div
|
||||
v-for="index in deltaDays + 1"
|
||||
:key="index"
|
||||
class="gantt-header--date"
|
||||
>
|
||||
<div class="dayDate">
|
||||
{{getDayDate(index - 1)}}
|
||||
</div>
|
||||
<div class="dayText">
|
||||
{{getDayText(index - 1)}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "RenderGanttDaysHeader",
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
dateDictionary: {
|
||||
0: "Sun",
|
||||
1: "Mon",
|
||||
2: "Tue",
|
||||
3: "Wed",
|
||||
4: "Thu",
|
||||
5: "Fri",
|
||||
6: "Sat",
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
deltaDays: "getDeltaDays",
|
||||
endDateGantt: "getEndDateGantt",
|
||||
startDateGantt: "getStartDateGantt",
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
getDayDate(index) {
|
||||
const delta = index * 24 * 60 * 60 * 1000;
|
||||
const new_date = new Date(this.startDateGantt + delta);
|
||||
return this.dateDictionary[new_date.getDay()];
|
||||
},
|
||||
getDayText(index) {
|
||||
const delta = index * 24 * 60 * 60 * 1000;
|
||||
const new_date = new Date(this.startDateGantt + delta);
|
||||
return new_date.getDate();
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
117
NearBeach/src/js/components/gantt_chart/RenderGanttGroup.vue
Normal file
117
NearBeach/src/js/components/gantt_chart/RenderGanttGroup.vue
Normal file
@@ -0,0 +1,117 @@
|
||||
<template>
|
||||
<!-- RENDER THE ONE ELEMENT WE WANT-->
|
||||
<render-gantt-row
|
||||
:description="description"
|
||||
:end-date="endDate"
|
||||
:is-closed="isClosed"
|
||||
:level-number="levelNumber"
|
||||
:object-id="objectId"
|
||||
:object-type="objectType"
|
||||
:parent-object-id="parentObjectId"
|
||||
:parent-object-type="parentObjectType"
|
||||
:higher-order-status="higherOrderStatus"
|
||||
:sprint-object-assignment-id="sprintObjectAssignmentId"
|
||||
:start-date="startDate"
|
||||
:status-id="statusId"
|
||||
:title="title"
|
||||
></render-gantt-row>
|
||||
|
||||
<!-- RENDER ALL THE CHILD ELEMENTS WE WANT-->
|
||||
<!-- TODO: FIX THE "IS-CLOSED", as we have just put false-->
|
||||
<render-gantt-group
|
||||
v-for="(row, index) in filteredGanttChartData"
|
||||
v-if="levelNumber <= 3"
|
||||
:key="index"
|
||||
:description="row.description"
|
||||
:end-date="row.end_date"
|
||||
:is-closed="false"
|
||||
:level-number="levelNumber + 1"
|
||||
:object-id="row.object_id"
|
||||
:object-type="row.object_type"
|
||||
:parent-object-id="row.parent_object_id"
|
||||
:parent-object-type="row.parent_object_type"
|
||||
:higher-order-status="row.higher_order_status"
|
||||
:sprint-object-assignment-id="row.sprint_object_assignment_id"
|
||||
:start-date="row.start_date"
|
||||
:status-id="row.status_id"
|
||||
:title="row.title"
|
||||
></render-gantt-group>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
import RenderGanttRow from "./RenderGanttRow.vue";
|
||||
|
||||
export default {
|
||||
name: "RenderGanttGroup",
|
||||
components: {RenderGanttRow},
|
||||
props: {
|
||||
description: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
endDate: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
higherOrderStatus: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
isClosed: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
levelNumber: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
objectId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
objectType: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
parentObjectId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
parentObjectType: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
sprintObjectAssignmentId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
startDate: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
statusId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
ganttChartData: "getGanttChartData",
|
||||
}),
|
||||
|
||||
filteredGanttChartData() {
|
||||
return this.ganttChartData(
|
||||
this.objectType,
|
||||
this.objectId
|
||||
);
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,106 @@
|
||||
<template>
|
||||
<div class="gantt-header">
|
||||
<div class="gantt-header--information"></div>
|
||||
<div class="gantt-header--months">
|
||||
<div
|
||||
v-for="month in monthArray"
|
||||
:key="month.index"
|
||||
class="gantt-header--month"
|
||||
:style="`width: ${month.width}px`"
|
||||
>
|
||||
<span>{{month.month}} {{month.year}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "RenderGanttMonthlyHeader",
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
monthArray: [],
|
||||
monthDictionary: {
|
||||
0: "Jan",
|
||||
1: "Feb",
|
||||
2: "March",
|
||||
3: "April",
|
||||
4: "May",
|
||||
5: "June",
|
||||
6: "July",
|
||||
7: "August",
|
||||
8: "September",
|
||||
9: "October",
|
||||
10: "November",
|
||||
11: "December",
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
deltaDays: "getDeltaDays",
|
||||
endDateGantt: "getEndDateGantt",
|
||||
startDateGantt: "getStartDateGantt",
|
||||
}),
|
||||
},
|
||||
watch: {
|
||||
deltaDays() {
|
||||
this.generateHeader();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
generateHeader() {
|
||||
//Blank out month array
|
||||
this.monthArray = [];
|
||||
|
||||
//Setup local variables
|
||||
const start_date = new Date(this.startDateGantt);
|
||||
const end_date = new Date(this.endDateGantt);
|
||||
let point_date = start_date;
|
||||
let next_date = end_date;
|
||||
|
||||
let keep_looping = true;
|
||||
let index = 0;
|
||||
while (keep_looping) {
|
||||
let delta = 0;
|
||||
|
||||
//Determine if end date is in the current month
|
||||
if (point_date.getMonth() === end_date.getMonth()) {
|
||||
//Months are the same. Get the delta between the dates and call it a day
|
||||
keep_looping = false;
|
||||
|
||||
//Get delta then the width of the object :)
|
||||
delta = Math.round((end_date.getTime() - point_date.getTime()) / (1000 * 60 * 60 * 24)) + 1;
|
||||
} else {
|
||||
//Months are different. Get the point date for the first of next month
|
||||
if (point_date.getMonth() === 11) {
|
||||
//Point date is in December. We want next year
|
||||
next_date = new Date(point_date.getFullYear() + 1, 0, 1);
|
||||
} else {
|
||||
next_date = new Date(point_date.getFullYear(), point_date.getMonth() + 1, 1);
|
||||
}
|
||||
|
||||
//Get the delta
|
||||
delta = Math.round((next_date.getTime() - point_date.getTime()) / (1000 * 60 * 60 * 24));
|
||||
}
|
||||
|
||||
this.monthArray.push({
|
||||
index,
|
||||
delta,
|
||||
width: delta * 48,
|
||||
month: this.monthDictionary[point_date.getMonth()],
|
||||
year: point_date.getFullYear(),
|
||||
});
|
||||
|
||||
//Cycle up the variables
|
||||
index = index + 1;
|
||||
point_date = next_date;
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
527
NearBeach/src/js/components/gantt_chart/RenderGanttRow.vue
Normal file
527
NearBeach/src/js/components/gantt_chart/RenderGanttRow.vue
Normal file
@@ -0,0 +1,527 @@
|
||||
<template>
|
||||
<div
|
||||
:id="getGanttRowId()"
|
||||
class="gantt-row"
|
||||
>
|
||||
<div
|
||||
class="gantt-row--information"
|
||||
@dragleave="dragleaveRow"
|
||||
@dragover="dragoverRow"
|
||||
@drop="drop"
|
||||
>
|
||||
<div
|
||||
class="gantt-row--title"
|
||||
:style="`padding-left:${levelNumber * 32}px`"
|
||||
>
|
||||
<span style="margin-right:10px;">
|
||||
<carbon-trash-can
|
||||
@click="confirmRemoval()"
|
||||
></carbon-trash-can>
|
||||
</span>
|
||||
<span
|
||||
v-if="objectType !== 'requirement_item'"
|
||||
style="margin-right:10px;"
|
||||
@mousedown="handleVerticalMove"
|
||||
>
|
||||
<a href="javascript:void(0)">
|
||||
<carbon-drag-vertical
|
||||
></carbon-drag-vertical>
|
||||
</a>
|
||||
</span>
|
||||
<span
|
||||
style="margin-right:10px"
|
||||
:data-bs-title="description"
|
||||
data-bs-toggle="tooltip"
|
||||
data-bs-html="true"
|
||||
data-bs-custom-class="tooltip-description"
|
||||
data-bs-delay="200"
|
||||
>
|
||||
<a
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
:href="getObjectUrl()"
|
||||
>
|
||||
<carbon-information></carbon-information>
|
||||
</a>
|
||||
</span>
|
||||
{{titleKeyValuePair[objectType]}}{{objectId}} - {{title}}
|
||||
</div>
|
||||
<div class="gantt-row--start-date">
|
||||
<n-date-picker
|
||||
v-if="objectType !== 'requirement_item'"
|
||||
v-model:value="localStartDate"
|
||||
:disabled="userLevel <= 1 || isClosed"
|
||||
:format="datePickerFormat"
|
||||
size="small"
|
||||
type="datetime"
|
||||
@update:value="modifiedStartDate"
|
||||
/>
|
||||
</div>
|
||||
<div class="gantt-row--end-date">
|
||||
<n-date-picker
|
||||
v-if="objectType !== 'requirement_item'"
|
||||
v-model:value="localEndDate"
|
||||
:disabled="userLevel <= 1 || isClosed"
|
||||
:format="datePickerFormat"
|
||||
size="small"
|
||||
type="datetime"
|
||||
@update:value="modifiedEndDate"
|
||||
></n-date-picker>
|
||||
</div>
|
||||
<div class="gantt-row--status">
|
||||
<n-select
|
||||
v-model:value="localStatusId"
|
||||
:options="statusList"
|
||||
:on-update-value="updateStatus"
|
||||
:disabled="userLevel <= 1 || isClosed"
|
||||
size="small"
|
||||
></n-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gantt-row--render">
|
||||
<div
|
||||
v-if="renderBar"
|
||||
:class="`gantt-row--render-bar gantt-row--level-${levelNumber}`"
|
||||
>
|
||||
<div
|
||||
class="gantt-row--spacer"
|
||||
:style="`width: ${spacerWidth}px`"
|
||||
></div>
|
||||
<div
|
||||
class="gantt-row--bar"
|
||||
:style="`width: ${barWidth}px`"
|
||||
>
|
||||
<div
|
||||
class="gantt-row--bar-start"
|
||||
data-column="start"
|
||||
@mousedown="mouseDown"
|
||||
></div>
|
||||
<div
|
||||
class="gantt-row--bar-middle"
|
||||
data-column="middle"
|
||||
@mousedown="mouseDown"
|
||||
></div>
|
||||
<div
|
||||
class="gantt-row--bar-end"
|
||||
data-column="end"
|
||||
@mousedown="mouseDown"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//VueX
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
//Components
|
||||
import { CarbonTrashCan } from "../../components";
|
||||
import { CarbonInformation } from "../../components";
|
||||
import { NDatePicker, NSelect } from "naive-ui";
|
||||
import { Modal, Tooltip } from "bootstrap";
|
||||
|
||||
//Datetime
|
||||
import { DateTime } from "luxon";
|
||||
import CarbonDragVertical from "Components/icons/CarbonDragVertical.vue";
|
||||
|
||||
export default {
|
||||
name: "RenderGanttRow",
|
||||
components: {
|
||||
CarbonDragVertical,
|
||||
CarbonInformation,
|
||||
CarbonTrashCan,
|
||||
NDatePicker,
|
||||
NSelect,
|
||||
},
|
||||
props: {
|
||||
description: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
endDate: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
higherOrderStatus: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
isClosed: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
levelNumber: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
objectId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
objectType: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
parentObjectId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
parentObjectType: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
sprintObjectAssignmentId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
startDate: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
statusId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
emits: ['mouse_down'],
|
||||
data() {
|
||||
return {
|
||||
datePickerFormat: "yyyy-MM-dd HH:mm",
|
||||
localEndDate: this.endDate,
|
||||
localStartDate: this.startDate,
|
||||
localStatusId: this.statusId,
|
||||
statusList: [],
|
||||
titleKeyValuePair: {
|
||||
"project": "Pro",
|
||||
"requirement_item": "Item",
|
||||
"task": "Task",
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
endDateGantt: "getEndDateGantt",
|
||||
rootUrl: "getRootUrl",
|
||||
startDateGantt: "getStartDateGantt",
|
||||
userLevel: "getUserLevel",
|
||||
|
||||
//Mouse Down
|
||||
mdObjectId: "getMdObjectId",
|
||||
mdObjectType: "getMdObjectType",
|
||||
mdParentObjectId: "getMdParentObjectId",
|
||||
mdParentObjectType: "getMdParentObjectType",
|
||||
mdColumn: "getMdColumn",
|
||||
}),
|
||||
barWidth() {
|
||||
//Setup the date variables
|
||||
let start_date = this.localStartDate;
|
||||
let end_date = this.localEndDate;
|
||||
|
||||
//In the case where the bar falls outside of the timeframe, we need to adjust the start_date/end_date
|
||||
if (start_date < this.startDateGantt) {
|
||||
//The start date of the bar, falls outside the timeframe. Adjust to the start of the gantt chart
|
||||
start_date = this.startDateGantt;
|
||||
}
|
||||
|
||||
//Adjust the end date to the END of that particular day
|
||||
const g_e_d = DateTime.fromMillis(this.endDateGantt).set({
|
||||
hour: 23,
|
||||
minute: 59,
|
||||
second: 59,
|
||||
millisecond: 999,
|
||||
});
|
||||
if (end_date > g_e_d.ts) {
|
||||
//The end date of the bar, falls outside the timeframe. Adjust to the end of the gantt chart
|
||||
end_date = g_e_d.ts;
|
||||
}
|
||||
|
||||
//Calculate the delta (aka number of days)
|
||||
const delta = Math.ceil((end_date - start_date) / (1000 * 60 * 60));
|
||||
|
||||
//Return number of days multiplied by 35 pixels
|
||||
return delta * 2;
|
||||
},
|
||||
renderBar() {
|
||||
//Conditions
|
||||
//~~~~~~~~~~
|
||||
//Bar's end date > start date of gantt chart
|
||||
//Bar's start date < end date of gantt chart
|
||||
const condition_1 = this.localEndDate > this.startDateGantt;
|
||||
const condition_2 = this.localStartDate < this.endDateGantt;
|
||||
|
||||
//Match both conditions
|
||||
return condition_1 && condition_2;
|
||||
},
|
||||
spacerWidth() {
|
||||
//If bar start is less than gantt start, return 0
|
||||
if (this.localStartDate <= this.startDateGantt) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Calculate the delta (aka number of days)
|
||||
const delta = Math.floor((this.localStartDate - this.startDateGantt) / (1000 * 60 * 60));
|
||||
|
||||
//Return the number of days multiplied by 35 pixels
|
||||
return delta * 2;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
endDate(new_value) {
|
||||
this.localEndDate = new_value;
|
||||
},
|
||||
startDate(new_value) {
|
||||
this.localStartDate = new_value;
|
||||
},
|
||||
statusId(new_value) {
|
||||
this.localStatusId = new_value;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.getStatusList();
|
||||
|
||||
//This code is used the for tooltip when user is hovering over the (i) icon.
|
||||
setTimeout(() => {
|
||||
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
||||
// const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new Tooltip(tooltipTriggerEl))
|
||||
}, 500);
|
||||
},
|
||||
methods: {
|
||||
canBeDestination() {
|
||||
//If a user if moving a row, can this particular row be it's destination :)
|
||||
if (this.mdColumn !== "na_vertical_move") return false;
|
||||
|
||||
//We can't move any objects to be a sub object of a task
|
||||
if (this.objectType === "task") return false;
|
||||
if (this.objectType === this.mdObjectType) return false;
|
||||
|
||||
//If the moving object's parents are this parent, we don't need to move anything
|
||||
if (
|
||||
(this.mdParentObjectType === this.objectType) &&
|
||||
(parseInt(this.mdParentObjectId) === parseInt(this.objectId))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
canObjectMove() {
|
||||
//If the object already exists in the location we want to go too, we will flag that it can not be moved
|
||||
//here
|
||||
const object_list = this.$store.getters.getGanttChartDataByObject(this.mdObjectId, this.mdObjectType);
|
||||
const count = object_list.filter(row => {
|
||||
const condition1 = parseInt(row.parent_object_id) === parseInt(this.objectId);
|
||||
const condition2 = row.parent_object_type === this.objectType;
|
||||
|
||||
return condition1 && condition2;
|
||||
}).length;
|
||||
|
||||
return count === 0;
|
||||
},
|
||||
confirmRemoval() {
|
||||
//Add this location into the confirm delete store
|
||||
this.$store.commit({
|
||||
type: "updateConfirmDelete",
|
||||
objectId: this.sprintObjectAssignmentId,
|
||||
});
|
||||
|
||||
//Open the modal
|
||||
const modal = new Modal(document.getElementById("confirmObjectRemoveModal"));
|
||||
modal.show();
|
||||
},
|
||||
dragleaveRow(event) {
|
||||
event.preventDefault();
|
||||
|
||||
const element = document.getElementById(this.getGanttRowId());
|
||||
element.classList.remove("gantt-chart-row-destination");
|
||||
},
|
||||
dragoverRow(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (this.canBeDestination() === false) return;
|
||||
|
||||
const element = document.getElementById(this.getGanttRowId());
|
||||
element.classList.add("gantt-chart-row-destination");
|
||||
},
|
||||
drop(event) {
|
||||
event.preventDefault();
|
||||
|
||||
const element = document.getElementById(this.getGanttRowId());
|
||||
element.classList.remove("gantt-chart-row-destination");
|
||||
|
||||
if (this.canBeDestination() === false) return;
|
||||
|
||||
if (!this.canObjectMove()) {
|
||||
this.$store.dispatch("newToast", {
|
||||
heading: "Can not move object",
|
||||
message: "Sorry object can't be moved, as there already exists an instance of this object within this location",
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Handle the process of moving the object :)
|
||||
this.$store.dispatch("updateGanttChartSingleRowsParent", {
|
||||
object_id: this.mdObjectId,
|
||||
object_type: this.mdObjectType,
|
||||
parent_object_id: this.mdParentObjectId,
|
||||
parent_object_type: this.mdParentObjectType,
|
||||
new_parent_object_id: this.objectId,
|
||||
new_parent_object_type: this.objectType,
|
||||
});
|
||||
|
||||
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set(this.mdObjectType, this.mdObjectId);
|
||||
data_to_send.set("object_relation", "parent_object_of");
|
||||
|
||||
const data_to_remove = new FormData();
|
||||
data_to_remove.set("link_id", this.mdObjectId);
|
||||
data_to_remove.set("link_connection", this.mdObjectType);
|
||||
|
||||
this.axios.post(
|
||||
`${this.rootUrl}object_data/${this.objectType}/${this.objectId}/add_link/`,
|
||||
data_to_send
|
||||
).catch(error => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Failed Updating Sprint",
|
||||
message: `Sorry, moving the object failed. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
|
||||
//In the case we are moving from a the root directory, we don't need to remove anything
|
||||
if (this.mdParentObjectId === 0) return;
|
||||
|
||||
this.axios.post(
|
||||
`${this.rootUrl}object_data/${this.mdParentObjectType}/${this.mdParentObjectId}/remove_link/`,
|
||||
data_to_remove,
|
||||
).catch(error => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Failed Updating Sprint",
|
||||
message: `Sorry, moving the object failed. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
getGanttRowId() {
|
||||
if (this.parentObjectId === 0 || this.parentObjectId === undefined) {
|
||||
//Return the short name
|
||||
return `gantt_row_${this.objectType}_${this.objectId}`;
|
||||
}
|
||||
|
||||
return `gantt_row_${this.objectType}_${this.objectId}_${this.parentObjectType}_${this.parentObjectId}`;
|
||||
},
|
||||
getObjectUrl() {
|
||||
return `${this.rootUrl}${this.objectType}_information/${this.objectId}`;
|
||||
},
|
||||
getStatusList() {
|
||||
//Get the status list dependent on the object type
|
||||
this.statusList = this.$store.getters.getGanttStatusList(this.objectType);
|
||||
},
|
||||
handleVerticalMove() {
|
||||
//Send data up stream
|
||||
this.$store.commit("updateMouseDown", {
|
||||
isMouseDown: true,
|
||||
mdObjectId: this.objectId,
|
||||
mdObjectType: this.objectType,
|
||||
mdParentObjectId: this.parentObjectId,
|
||||
mdParentObjectType: this.parentObjectType,
|
||||
mdColumn: "na_vertical_move",
|
||||
});
|
||||
},
|
||||
modifiedEndDate() {
|
||||
//If the end date is before the start date - we modify the start date to be the end date minus one day
|
||||
if (this.localEndDate < this.localStartDate) {
|
||||
this.localStartDate = this.localEndDate - (24 * 60 * 60 * 1000);
|
||||
}
|
||||
|
||||
this.updateGanttData();
|
||||
},
|
||||
modifiedStartDate() {
|
||||
//If the start date is after the end date - we modify the end date to be the start date plus one day
|
||||
if (this.localStartDate > this.localEndDate) {
|
||||
this.localEndDate = this.localStartDate + (24 * 60 * 60 * 1000);
|
||||
}
|
||||
|
||||
this.updateGanttData();
|
||||
},
|
||||
mouseDown(event) {
|
||||
//If the user does not have enough permissions, do nothing
|
||||
if (this.userLevel <= 1) return;
|
||||
|
||||
//Send data up stream
|
||||
this.$store.commit("updateMouseDown", {
|
||||
isMouseDown: true,
|
||||
mdClientXInitial: event.clientX,
|
||||
mdHigherOrderStatus: this.higherOrderStatus,
|
||||
mdObjectId: this.objectId,
|
||||
mdObjectType: this.objectType,
|
||||
mdParentObjectId: this.parentObjectId,
|
||||
mdParentObjectType: this.parentObjectType,
|
||||
mdColumn: event.target.dataset.column,
|
||||
mdEndDateInitial: this.endDate,
|
||||
mdStartDateInitial: this.startDate,
|
||||
mdStatus: this.status,
|
||||
mdStatusId: this.statusId,
|
||||
mdTitle: this.title,
|
||||
});
|
||||
},
|
||||
updateGanttData() {
|
||||
//Update the VueX with the new data
|
||||
this.$store.dispatch("updateGanttChartSingleRow", {
|
||||
end_date: this.localEndDate,
|
||||
higher_order_status: this.higherOrderStatus,
|
||||
object_id: this.objectId,
|
||||
object_type: this.objectType,
|
||||
start_date: this.localStartDate,
|
||||
status_id: this.localStatusId,
|
||||
});
|
||||
|
||||
//Next tick is required - we have a race condition if this is not here. :'(
|
||||
this.$nextTick(() => {
|
||||
//Send updated data to the backend
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set('status_id', this.localStatusId);
|
||||
|
||||
//Handle the start and end date
|
||||
const end_date = new Date(this.localEndDate);
|
||||
const start_date = new Date(this.localStartDate);
|
||||
data_to_send.set('end_date', end_date.toISOString());
|
||||
data_to_send.set('start_date', start_date.toISOString());
|
||||
|
||||
//Use axios to update backend
|
||||
this.axios.post(
|
||||
`${this.rootUrl}gantt_data/${this.objectType}/${this.objectId}/update_data/`,
|
||||
data_to_send
|
||||
).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error Updating the Object",
|
||||
message: `Sorry, we could not update the object's information. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
updateStatus(data) {
|
||||
//Race condition issues - we will manually update the local status id here
|
||||
//Then run the update gantt data.
|
||||
//In chrome we were having race conditions.
|
||||
this.localStatusId = data;
|
||||
|
||||
this.updateGanttData();
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
211
NearBeach/src/js/components/gdpr/GdprWizard.vue
Normal file
211
NearBeach/src/js/components/gdpr/GdprWizard.vue
Normal file
@@ -0,0 +1,211 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card gdpr-wizard-card">
|
||||
<div class="card-body">
|
||||
<h1>GDPR Wizard</h1>
|
||||
<hr/>
|
||||
|
||||
<gdpr-wizard-steps :current-tab="currentTab"></gdpr-wizard-steps>
|
||||
|
||||
<div class="alert alert-info gdpr-wizard-alert">
|
||||
Please use a larger monitor, as there is a large amount of data to process. Doing this task on a
|
||||
small screen is considered hard/annoying.
|
||||
</div>
|
||||
|
||||
<!-- OBJECT-->
|
||||
<gdpr-wizard-object
|
||||
:style="displayTab(0)"
|
||||
></gdpr-wizard-object>
|
||||
|
||||
<!-- SEARCH-->
|
||||
<gdpr-wizard-search
|
||||
:style="displayTab(1)"
|
||||
></gdpr-wizard-search>
|
||||
|
||||
<!-- DATA VERIFICATION-->
|
||||
<gdpr-wizard-data-verification
|
||||
:style="displayTab(2)"
|
||||
></gdpr-wizard-data-verification>
|
||||
|
||||
<!-- CONFIRMATION-->
|
||||
<gdpr-wizard-confirmation
|
||||
:style="displayTab(3)"
|
||||
></gdpr-wizard-confirmation>
|
||||
|
||||
<!-- NAVIGATION -->
|
||||
<hr/>
|
||||
<div class="row submit-row">
|
||||
<div class="col-md-12">
|
||||
<!-- PREVIOUS -->
|
||||
<button
|
||||
v-if="currentTab!==0"
|
||||
class="btn btn-primary"
|
||||
@click="previousTab"
|
||||
>
|
||||
Previous
|
||||
</button>
|
||||
|
||||
<!-- NEXT -->
|
||||
<button
|
||||
v-if="currentTab!==3"
|
||||
class="btn btn-primary save-changes"
|
||||
@click="nextTab"
|
||||
>
|
||||
Next
|
||||
</button>
|
||||
|
||||
<!-- SUBMIT -->
|
||||
<button
|
||||
v-if="currentTab===3"
|
||||
class="btn btn-danger save-changes"
|
||||
:disabled="disableSubmitButton"
|
||||
@click="submitGdpr"
|
||||
>
|
||||
SUBMIT GDPR DELETION
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import GdprWizardSteps from "./GdprWizardSteps.vue";
|
||||
import GdprWizardObject from "./tabs/GdprWizardObject.vue";
|
||||
import GdprWizardSearch from "./tabs/GdprWizardSearch.vue";
|
||||
import GdprWizardDataVerification from "./tabs/GdprWizardDataVerification.vue";
|
||||
import GdprWizardConfirmation from "./tabs/GdprWizardConfirmation.vue";
|
||||
|
||||
//Composable
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
|
||||
//VueX
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "GdprWizard",
|
||||
components: {
|
||||
GdprWizardConfirmation,
|
||||
GdprWizardDataVerification,
|
||||
GdprWizardSearch,
|
||||
GdprWizardObject,
|
||||
GdprWizardSteps
|
||||
},
|
||||
props: {
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "light",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentTab: 0,
|
||||
disableSubmitButton: false,
|
||||
pickedObject: "",
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
gdprObjectId: "getGdprObjectId",
|
||||
gdprObjectType: "getGdprObjectType",
|
||||
userActionToRemove: "getUserActionToRemove",
|
||||
validationData: "getValidationData",
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
useNBTheme,
|
||||
displayTab(tab_id) {
|
||||
if (parseInt(tab_id) === parseInt(this.currentTab)) {
|
||||
//We want to display this tab
|
||||
return "";
|
||||
}
|
||||
|
||||
//We want to hide this tab
|
||||
return "display:none;";
|
||||
},
|
||||
nextTab() {
|
||||
//Do nothing if tab >= 4
|
||||
if (this.currentTab >= 4) return;
|
||||
|
||||
//Validate the current tab
|
||||
if (this.validationData[`tab_${this.currentTab}`] === false) {
|
||||
//Notify the user of the unvalidated data and return
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Please check your input",
|
||||
message: "Sorry, we are being told that some of the data is not valid",
|
||||
extra_classes: "bg-danger",
|
||||
delay: 1500,
|
||||
});
|
||||
|
||||
//Do nothing
|
||||
return;
|
||||
}
|
||||
|
||||
//Validation has passed move the user to the next tab
|
||||
this.currentTab = this.currentTab + 1;
|
||||
|
||||
//Scroll to the top
|
||||
window.scrollTo({top: 0, behavior: 'smooth'});
|
||||
},
|
||||
previousTab() {
|
||||
//Do nothing if tab <= 0
|
||||
if (this.currentTab <= 0) return;
|
||||
|
||||
//Move to previous tab
|
||||
this.currentTab = this.currentTab - 1;
|
||||
},
|
||||
submitGdpr() {
|
||||
//Disable the button
|
||||
this.disableSubmitButton = true;
|
||||
|
||||
//Create data to send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("gdpr_object_id", this.gdprObjectId);
|
||||
data_to_send.set("gdpr_object_type", this.gdprObjectType);
|
||||
|
||||
// Loop through each of the user action to remove
|
||||
Object.entries(this.userActionToRemove).forEach(([key, object]) => {
|
||||
object.forEach(single_object => {
|
||||
data_to_send.append(key.toString(), single_object.toString());
|
||||
});
|
||||
});
|
||||
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "GDPR Wizard Deletion",
|
||||
message: "Please wait whilst we delete the data",
|
||||
extra_classes: "bg-warning",
|
||||
delay: 0,
|
||||
unique_type: "gdpr_wizard_submit",
|
||||
})
|
||||
|
||||
this.axios.post(
|
||||
`${this.rootUrl}gdpr_wizard/submit/`,
|
||||
data_to_send,
|
||||
).then(() => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "GDPR Wizard Deleted",
|
||||
message: "Data deleted",
|
||||
extra_classes: "bg-success",
|
||||
delay: 0,
|
||||
unique_type: "gdpr_wizard_submit",
|
||||
});
|
||||
|
||||
window.location.href = `${this.rootUrl}gdpr_wizard/success/`;
|
||||
}).catch(error => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "GDPR Wizard Deletion ERROR",
|
||||
message: `An error occurred whilst deleting data: Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
unique_type: "gdpr_wizard_submit",
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
65
NearBeach/src/js/components/gdpr/GdprWizardSteps.vue
Normal file
65
NearBeach/src/js/components/gdpr/GdprWizardSteps.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<div
|
||||
class="gdpr-wizard--loading-bar"
|
||||
:style="getStyle()"
|
||||
></div>
|
||||
|
||||
<div class="gdpr-wizard">
|
||||
<div
|
||||
v-for="(tab, index) in tabContents"
|
||||
:key="tab"
|
||||
class="gdpr-wizard--tab"
|
||||
>
|
||||
<div :class="getClasses(index)">
|
||||
<span>{{ index + 1 }}</span>
|
||||
</div>
|
||||
<div class="gdpr-wizard--tab-title">{{ tab }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "GdprWizardSteps",
|
||||
components: {},
|
||||
props: {
|
||||
currentTab: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
data: () => ({
|
||||
tabContents: [
|
||||
"Object",
|
||||
"Search",
|
||||
"Data Verification",
|
||||
"Confirmation",
|
||||
],
|
||||
}),
|
||||
methods: {
|
||||
getClasses(index) {
|
||||
const classReturn = "gdpr-wizard--tab-circle";
|
||||
|
||||
// If index is current tab - we highlight as current
|
||||
if (parseInt(index) === this.currentTab) {
|
||||
return `${classReturn} current`;
|
||||
}
|
||||
|
||||
// If index is less than current tab, then we are completed
|
||||
if (parseInt(index) < this.currentTab) {
|
||||
return `${classReturn} completed`;
|
||||
}
|
||||
|
||||
return classReturn;
|
||||
},
|
||||
getStyle() {
|
||||
// Edge component will be 8.333% width
|
||||
// Any length between the circles is 16.666%
|
||||
const progressWidth = 12.5 + (25 * this.currentTab);
|
||||
|
||||
// Convert into string
|
||||
return `width: ${progressWidth}%;`;
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,72 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>WARNING! DELETING {{ gdprObjectType }}</strong>
|
||||
<p class="text-instructions">
|
||||
Please confirm that you are happy with deleting this data. Please type in the field "Deleting
|
||||
{{ gdprObjectType }}".
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div
|
||||
v-if="gdprObjectType === 'user'"
|
||||
class="alert alert-info"
|
||||
>
|
||||
Due to the CASCADE effect within the NearBeach's database. Many objects will be deleted if we just remove
|
||||
the user. To stop this from happening we'll be using your user id to fill both the "Creation User" and
|
||||
"Modified User" fields.
|
||||
</div>
|
||||
|
||||
<div class="alert alert-danger">
|
||||
BEWARD! This can NOT be undone. We are deleting data from the database. Please make sure you have checked
|
||||
all data before submitting this. It can NOT be undone.
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>
|
||||
Confirm Deletion of {{ gdprObjectType }}
|
||||
<span
|
||||
v-if="!isValidated"
|
||||
class="error"
|
||||
>
|
||||
Please confirm what you are deleting. Write "Deleting {{ gdprObjectType }}"
|
||||
</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="confirmationModel"
|
||||
type="text"
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters } from "vuex";
|
||||
export default {
|
||||
name: "GdprWizardConfirmation",
|
||||
data() {
|
||||
return {
|
||||
confirmationModel: "",
|
||||
isValidated: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
gdprObjectType: "getGdprObjectType",
|
||||
rootUrl: "getRootUrl",
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
confirmationModel() {
|
||||
this.isValidated = this.confirmationModel.toLowerCase() === `deleting ${this.gdprObjectType.toLowerCase()}`;
|
||||
this.$store.commit({
|
||||
type: "updateValidationData",
|
||||
tab_id: "tab_3",
|
||||
value: this.isValidated
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,273 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div
|
||||
v-if="status==='loading'"
|
||||
class="alert alert-info"
|
||||
>
|
||||
Please wait. Fetching data.
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="status!=='loading'"
|
||||
class="row"
|
||||
>
|
||||
<div class="col-md-4">
|
||||
<strong>User Action Required</strong>
|
||||
<p class="text-instructions">
|
||||
Please note the following data will need to be reviewed by a human. There can be false positives within
|
||||
this data where the text in the description can be over-written. Please uncheck if you do not want this
|
||||
data over-written.
|
||||
</p>
|
||||
<p class="text-instructions">
|
||||
Alternatively, you can go to the object and manually edit the data. Please untick the row if you would
|
||||
like to take this step.
|
||||
</p>
|
||||
<p class="text-instructions">
|
||||
Best practise is to review each of these action required, as there could be false positives.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<render-object-card-checkbox
|
||||
v-if="projectResults.userActionRequired.length > 0"
|
||||
:search-results="projectResults.userActionRequired"
|
||||
:import-variables="projectVariables"
|
||||
destination="project"
|
||||
model-target="project"
|
||||
target="_blank"
|
||||
@update_checkbox_model="updateCheckboxModel"
|
||||
></render-object-card-checkbox>
|
||||
|
||||
<render-object-card-checkbox
|
||||
v-if="requirementResults.userActionRequired.length > 0"
|
||||
:search-results="requirementResults.userActionRequired"
|
||||
:import-variables="requirementVariables"
|
||||
destination="requirement"
|
||||
model-target="requirement"
|
||||
target="_blank"
|
||||
@update_checkbox_model="updateCheckboxModel"
|
||||
></render-object-card-checkbox>
|
||||
|
||||
<render-object-card-checkbox
|
||||
v-if="requirementItemResults.userActionRequired.length > 0"
|
||||
:search-results="requirementItemResults.userActionRequired"
|
||||
:import-variables="requirementItemVariables"
|
||||
destination="requirement_item"
|
||||
model-target="requirement_item"
|
||||
target="_blank"
|
||||
@update_checkbox_model="updateCheckboxModel"
|
||||
></render-object-card-checkbox>
|
||||
|
||||
<render-object-card-checkbox
|
||||
v-if="taskResults.userActionRequired.length > 0"
|
||||
:search-results="taskResults.userActionRequired"
|
||||
:import-variables="taskVariables"
|
||||
destination="task"
|
||||
model-target="task"
|
||||
target="_blank"
|
||||
@update_checkbox_model="updateCheckboxModel"
|
||||
></render-object-card-checkbox>
|
||||
</div>
|
||||
<div class="spacer"></div>
|
||||
</div>
|
||||
|
||||
<div class="spacer"></div>
|
||||
<hr/>
|
||||
<div
|
||||
v-if="status!=='loading'"
|
||||
class="row"
|
||||
>
|
||||
<div class="col-md-4">
|
||||
<strong>Data to be removed</strong>
|
||||
<p
|
||||
v-if="gdprObjectType === 'customer'"
|
||||
class="text-instructions"
|
||||
>
|
||||
The following objects will have the customer removed from them. The objects will NOT be deleted,
|
||||
just the connection to the customer.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<render-object-card
|
||||
v-if="projectResults.dataToBeDeleted.length > 0"
|
||||
:search-results="projectResults.dataToBeDeleted"
|
||||
:import-variables="projectVariables"
|
||||
destination="project"
|
||||
target="_blank"
|
||||
></render-object-card>
|
||||
|
||||
<render-object-card
|
||||
v-if="requirementResults.dataToBeDeleted.length > 0"
|
||||
:search-results="requirementResults.dataToBeDeleted"
|
||||
:import-variables="requirementVariables"
|
||||
destination="requirement"
|
||||
target="_blank"
|
||||
></render-object-card>
|
||||
|
||||
<render-object-card
|
||||
v-if="requirementItemResults.dataToBeDeleted.length > 0"
|
||||
:search-results="requirementItemResults.dataToBeDeleted"
|
||||
:import-variables="requirementItemVariables"
|
||||
destination="requirement_item"
|
||||
target="_blank"
|
||||
></render-object-card>
|
||||
|
||||
<render-object-card
|
||||
v-if="taskResults.dataToBeDeleted.length > 0"
|
||||
:search-results="taskResults.dataToBeDeleted"
|
||||
:import-variables="taskVariables"
|
||||
destination="task"
|
||||
target="_blank"
|
||||
></render-object-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// VueX
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
// Components
|
||||
import RenderObjectCard from "Components/render/RenderObjectCard.vue";
|
||||
import RenderObjectCardCheckbox from "Components/render/RenderObjectCardCheckbox.vue";
|
||||
|
||||
export default {
|
||||
name: "GdprWizardDataVerification",
|
||||
components: {
|
||||
RenderObjectCard,
|
||||
RenderObjectCardCheckbox,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
status: "loading",
|
||||
projectModel: [],
|
||||
projectResults: {
|
||||
userActionRequired: [],
|
||||
dataToBeDeleted: []
|
||||
},
|
||||
projectVariables: {
|
||||
header: "Projects",
|
||||
prefix: "Pro",
|
||||
id: "object_id",
|
||||
title: "object_title",
|
||||
status: "object_status",
|
||||
},
|
||||
requirementModel: [],
|
||||
requirementResults: {
|
||||
userActionRequired: [],
|
||||
dataToBeDeleted: [],
|
||||
},
|
||||
requirementVariables: {
|
||||
header: "Requirements",
|
||||
prefix: "Req",
|
||||
id: "object_id",
|
||||
title: "object_title",
|
||||
status: "object_status",
|
||||
},
|
||||
requirementItemModel: [],
|
||||
requirementItemResults: {
|
||||
userActionRequired: [],
|
||||
dataToBeDeleted: [],
|
||||
},
|
||||
requirementItemVariables: {
|
||||
header: "Requirement Items",
|
||||
prefix: "Item",
|
||||
id: "object_id",
|
||||
title: "object_title",
|
||||
status: "object_status",
|
||||
},
|
||||
taskModel: [],
|
||||
taskResults: {
|
||||
userActionRequired: [],
|
||||
dataToBeDeleted: [],
|
||||
},
|
||||
taskVariables: {
|
||||
header: "Tasks",
|
||||
prefix: "Task",
|
||||
id: "object_id",
|
||||
title: "object_title",
|
||||
status: "object_status",
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
gdprObjectId: "getGdprObjectId",
|
||||
gdprObjectType: "getGdprObjectType",
|
||||
rootUrl: "getRootUrl",
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
gdprObjectId() {
|
||||
//Do nothing if empty
|
||||
if (this.gdprObjectId === null || this.gdprObjectId === "") return;
|
||||
|
||||
this.getData();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
//Tell user we are fetching data
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Fetching Data",
|
||||
message: "Please wait. Fetching Data",
|
||||
extra_classes: "bg-warning",
|
||||
delay: 0,
|
||||
unique_type: "gdpr_wizard",
|
||||
})
|
||||
//Setup form data
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("gdpr_object_type", this.gdprObjectType);
|
||||
data_to_send.set("gdpr_object_id", this.gdprObjectId);
|
||||
|
||||
//Contact the backend
|
||||
this.axios.post(
|
||||
`${this.rootUrl}gdpr_wizard/get_data/`,
|
||||
data_to_send,
|
||||
).then(response => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Fetched Data",
|
||||
message: "Data has been fetched. Please move to Data Verification Tab to review",
|
||||
extra_classes: "bg-success",
|
||||
unique_type: "gdpr_wizard",
|
||||
});
|
||||
|
||||
this.status = "loaded";
|
||||
|
||||
//Load data into structure
|
||||
this.projectResults.dataToBeDeleted = response.data.data_to_be_deleted.project;
|
||||
this.projectResults.userActionRequired =response.data.user_action_required.project;
|
||||
this.requirementResults.dataToBeDeleted = response.data.data_to_be_deleted.requirement;
|
||||
this.requirementResults.userActionRequired = response.data.user_action_required.requirement;
|
||||
this.requirementItemResults.dataToBeDeleted = response.data.data_to_be_deleted.requirement_item;
|
||||
this.requirementItemResults.userActionRequired = response.data.user_action_required.requirement_item;
|
||||
this.taskResults.dataToBeDeleted = response.data.data_to_be_deleted.task;
|
||||
this.taskResults.userActionRequired = response.data.user_action_required.task;
|
||||
|
||||
//Verifiy the tab
|
||||
this.$store.commit({
|
||||
type: "updateValidationData",
|
||||
tab_id: "tab_2",
|
||||
value: true,
|
||||
});
|
||||
}).catch(error => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error Fetching Data",
|
||||
message: `Sorry, could not fetch the data we required. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
unique_type: "gdpr_wizard",
|
||||
});
|
||||
})
|
||||
},
|
||||
updateCheckboxModel(data) {
|
||||
this.$store.commit({
|
||||
type: "updateUserActionToRemove",
|
||||
modelTarget: data.modelTarget,
|
||||
value: data.value,
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
61
NearBeach/src/js/components/gdpr/tabs/GdprWizardObject.vue
Normal file
61
NearBeach/src/js/components/gdpr/tabs/GdprWizardObject.vue
Normal file
@@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Description</strong>
|
||||
<p class="text-instructions">
|
||||
The GDPR Wizard is designed to replace/remove any data associated with any user/customer. Please note
|
||||
this can NOT be un-done, and should only be used when issued a GDPR takedown.
|
||||
</p>
|
||||
<strong>Instructions</strong>
|
||||
<p class="text-instructions">
|
||||
Please pick which object you would like to remove from the system. You can remove either; customer,
|
||||
organisation, or a user.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label>Selected Object</label>
|
||||
<n-select v-model:value="objectResults" :options="objectOptions" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { NSelect } from "naive-ui";
|
||||
|
||||
export default {
|
||||
name: "GdprWizardObject",
|
||||
components: {
|
||||
NSelect,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
objectOptions: [
|
||||
{
|
||||
label: "Customer",
|
||||
value: "customer",
|
||||
},
|
||||
{
|
||||
label: "Organisation",
|
||||
value: "organisation",
|
||||
},
|
||||
{
|
||||
label: "User",
|
||||
value: "user",
|
||||
},
|
||||
],
|
||||
objectResults: "",
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
objectResults() {
|
||||
//Send results up to VueX
|
||||
this.$store.dispatch("processGdprObjectType", {
|
||||
"gdprObject": this.objectResults,
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
90
NearBeach/src/js/components/gdpr/tabs/GdprWizardSearch.vue
Normal file
90
NearBeach/src/js/components/gdpr/tabs/GdprWizardSearch.vue
Normal file
@@ -0,0 +1,90 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Search</strong>
|
||||
<p class="text-instructions">
|
||||
Search for the {{ gdprObjectType }} you wish to remove from NearBeach's data. Please note we can only focus
|
||||
on one objects at a time.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label>Search {{ gdprObjectType }}</label>
|
||||
<n-select
|
||||
v-model:value="searchResults"
|
||||
:options="searchObjects"
|
||||
:placeholder="`Please search for a ${ gdprObjectType}`"
|
||||
filterable
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { NSelect } from "naive-ui";
|
||||
|
||||
//VueX
|
||||
import { mapGetters } from "vuex";
|
||||
export default {
|
||||
name: "GdprWizardSearch",
|
||||
components: {
|
||||
NSelect,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
searchObjects: [],
|
||||
searchResults: "",
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
gdprObjectType: "getGdprObjectType",
|
||||
rootUrl: "getRootUrl",
|
||||
}),
|
||||
},
|
||||
watch: {
|
||||
gdprObjectType() {
|
||||
if (this.gdprObjectType === "" || this.gdprObjectType === null) {
|
||||
//Empty object type, clear search data
|
||||
this.searchObjects = [];
|
||||
return;
|
||||
}
|
||||
|
||||
//Fetch the data we want
|
||||
this.getSearchObjects();
|
||||
},
|
||||
searchResults() {
|
||||
this.$store.dispatch("processGdprObjectId", {
|
||||
"gdprObjectId": this.searchResults,
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getSearchObjects() {
|
||||
// If there is no object type, we don't get any data
|
||||
if (this.gdprObjectType === "" || this.gdprObjectType === null) return;
|
||||
|
||||
//Data to send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("gdpr_object_type", this.gdprObjectType);
|
||||
|
||||
//AJAX CALL
|
||||
this.axios.post(
|
||||
`${this.rootUrl}gdpr_wizard/search_data/`,
|
||||
data_to_send,
|
||||
).then(response => {
|
||||
this.searchObjects = response.data;
|
||||
}).catch(error => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Can not fetch search data",
|
||||
message: `Can not fetch search data. ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
105
NearBeach/src/js/components/groups/ConfirmGroupDelete.vue
Normal file
105
NearBeach/src/js/components/groups/ConfirmGroupDelete.vue
Normal file
@@ -0,0 +1,105 @@
|
||||
<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">
|
||||
Please confirm you would like to delete this group. This is permanent.
|
||||
</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({
|
||||
rootUrl: "getRootUrl",
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
closeModal() {
|
||||
//Close the modal
|
||||
document.getElementById("confirmGroupDeleteButton").click();
|
||||
},
|
||||
deleteGroup() {
|
||||
//Check to make sure group id is valid
|
||||
if (this.groupId === 0) {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Group ID not valid",
|
||||
message: "Sorry, current group ID is not valid",
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
|
||||
//Do nothing and return
|
||||
return;
|
||||
}
|
||||
|
||||
//Send to backend
|
||||
this.axios.post(
|
||||
`${this.rootUrl}group_information/${this.groupId}/delete/`,
|
||||
).then(() => {
|
||||
window.location = `${this.rootUrl}search/group/`;
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error Deleting Group",
|
||||
message: `Sorry could not delete the group. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
188
NearBeach/src/js/components/groups/GroupInformation.vue
Normal file
188
NearBeach/src/js/components/groups/GroupInformation.vue
Normal file
@@ -0,0 +1,188 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1 class="mb-4">Group Information</h1>
|
||||
<a :href="`${rootUrl}search/group/`"
|
||||
>Back to group list</a
|
||||
>
|
||||
<hr/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Group Information</strong>
|
||||
<p class="text-instruction">
|
||||
Please edit the group information here. Please note -
|
||||
groups have to be unique!
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label>Group Name</label>
|
||||
<input
|
||||
v-model="groupNameModel"
|
||||
type="text"
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Parent Group</label>
|
||||
<n-select
|
||||
v-model:value="parentGroupModel"
|
||||
filterable
|
||||
:options="parentGroupFixList"
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Submit Button -->
|
||||
<hr/>
|
||||
<div class="row submit-row">
|
||||
<div class="col-md-12">
|
||||
<button
|
||||
v-if="parseInt(groupResults[0].pk) !== 1"
|
||||
class="btn btn-danger"
|
||||
@click="confirmDelete"
|
||||
>
|
||||
Delete Group
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-primary save-changes"
|
||||
@click="updateGroup"
|
||||
>
|
||||
Update Group
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<confirm-group-delete
|
||||
:group-id="groupResults[0].pk"
|
||||
></confirm-group-delete>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { NSelect, NConfigProvider } from "naive-ui";
|
||||
import { Modal } from "bootstrap";
|
||||
|
||||
//Components
|
||||
import ConfirmGroupDelete from "./ConfirmGroupDelete.vue";
|
||||
|
||||
//Composables
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
|
||||
export default {
|
||||
name: "GroupInformation",
|
||||
components: {
|
||||
ConfirmGroupDelete,
|
||||
NConfigProvider,
|
||||
NSelect,
|
||||
},
|
||||
props: {
|
||||
groupResults: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
parentGroupResults: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
groupNameModel: this.groupResults[0].fields.group_name,
|
||||
parentGroupFixList: [],
|
||||
parentGroupModel: this.groupResults[0].fields.parent_group,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// Create the parent group fix list
|
||||
const parent_group_fix_list = this.parentGroupResults.map((row) => {
|
||||
return {
|
||||
group_name: row.fields.group_name,
|
||||
label: row.fields.group_name,
|
||||
value: row.pk,
|
||||
};
|
||||
});
|
||||
|
||||
//Set the variables
|
||||
this.parentGroupFixList = parent_group_fix_list;
|
||||
|
||||
//Send the rootUrl to VueX
|
||||
this.$store.commit({
|
||||
type: "updateUrl",
|
||||
rootUrl: this.rootUrl,
|
||||
});
|
||||
this.$store.commit({
|
||||
type: "updateTitle",
|
||||
title: this.groupNameModel,
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
useNBTheme,
|
||||
confirmDelete() {
|
||||
//Show the modal
|
||||
const modal = new Modal(document.getElementById("confirmGroupDeleteModal"));
|
||||
modal.show();
|
||||
},
|
||||
updateGroup() {
|
||||
//Construct data to send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("group_name", this.groupNameModel);
|
||||
|
||||
//Send parent group if not null
|
||||
if (this.parentGroupModel !== null && this.parentGroupModel !== "") {
|
||||
data_to_send.set("parent_group", this.parentGroupModel);
|
||||
}
|
||||
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Updated Group",
|
||||
message: "Updated Group. Please wait.",
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
unique_type: "update_group_leader",
|
||||
});
|
||||
|
||||
//User axios to send data
|
||||
this.axios.post(
|
||||
`${this.rootUrl}group_information/${this.groupResults[0].pk}/save/`,
|
||||
data_to_send
|
||||
).then(() => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Updated Group",
|
||||
message: "Successfully Update Group",
|
||||
extra_classes: "bg-success",
|
||||
delay: 0,
|
||||
unique_type: "update_group_leader",
|
||||
});
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error Updating Group",
|
||||
message: `We had an issue updating group. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
unique_type: "update_group_leader",
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
221
NearBeach/src/js/components/groups/NewGroup.vue
Normal file
221
NearBeach/src/js/components/groups/NewGroup.vue
Normal file
@@ -0,0 +1,221 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1>New Group</h1>
|
||||
<hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<strong>Create a new group</strong>
|
||||
<p class="text-instructional">
|
||||
Each group should contain a unique name. If the name
|
||||
already exists then we won't be able to create the
|
||||
group.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label>
|
||||
Group Name
|
||||
<validation-rendering
|
||||
:error-list="v$.groupNameModel.$errors"
|
||||
></validation-rendering>
|
||||
<span
|
||||
v-if="!uniqueGroupName"
|
||||
class="error"
|
||||
>
|
||||
Please supply a unique name</span
|
||||
>
|
||||
<span
|
||||
v-if="checkingGroupName"
|
||||
class="error"
|
||||
>
|
||||
Checking group name...</span
|
||||
>
|
||||
</label>
|
||||
<input
|
||||
v-model="groupNameModel"
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label> Parent Group (optional) </label>
|
||||
<n-select
|
||||
v-model:value="parentGroupModel"
|
||||
:options="groupResultsFixList"
|
||||
label="group_name"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Submit Button -->
|
||||
<hr/>
|
||||
<div class="row submit-row">
|
||||
<div class="col-md-12">
|
||||
<a
|
||||
href="javascript:void(0)"
|
||||
class="btn btn-primary save-changes"
|
||||
@click="addNewGroup"
|
||||
>Create new Group</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {NSelect} from "naive-ui";
|
||||
|
||||
// Validation
|
||||
import useVuelidate from "@vuelidate/core";
|
||||
import {required} from "@vuelidate/validators";
|
||||
import ValidationRendering from "Components/validation/ValidationRendering.vue";
|
||||
|
||||
//Composables
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
|
||||
export default {
|
||||
name: "NewGroup",
|
||||
components: {
|
||||
NSelect,
|
||||
ValidationRendering,
|
||||
},
|
||||
props: {
|
||||
groupResults: {
|
||||
type: Array,
|
||||
default() {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
return {v$: useVuelidate()};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
checkingGroupName: false,
|
||||
groupNameModel: "",
|
||||
groupResultsFixList: [],
|
||||
parentGroupModel: "",
|
||||
searchTimeout: "",
|
||||
uniqueGroupName: true,
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
groupNameModel: {
|
||||
required,
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
groupNameModel(new_value) {
|
||||
// Tell user that we are searching for the group name
|
||||
this.checkingGroupName = true;
|
||||
|
||||
//Clear timer if it already exists
|
||||
if (this.searchTimeout !== "") {
|
||||
//Stop the clock
|
||||
clearTimeout(this.searchTimeout);
|
||||
}
|
||||
|
||||
//Setup timer if there are 3 characters or more
|
||||
if (new_value.length >= 3) {
|
||||
//Start the potential search
|
||||
this.searchTimeout = setTimeout(() => {
|
||||
this.checkGroupName();
|
||||
}, 500);
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
//This will map reconstruct the JSON data into a V-SELECT friendly data
|
||||
this.groupResultsFixList = this.groupResults.map((row) => {
|
||||
return {
|
||||
label: row.fields.group_name,
|
||||
value: row.pk,
|
||||
};
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
useNBTheme,
|
||||
addNewGroup() {
|
||||
//Check to make sure everything is validated
|
||||
this.v$.$touch();
|
||||
|
||||
if (this.v$.$invalid || !this.uniqueGroupName) {
|
||||
//The group name is not valid, or is not unique. Show error and return
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Please check all fields",
|
||||
message: "Failed validation. Please check all fields are validated",
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
unique_type: "update_user",
|
||||
});
|
||||
|
||||
//Just return
|
||||
return;
|
||||
}
|
||||
|
||||
//Get the data
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("group_name", this.groupNameModel);
|
||||
|
||||
if (this.parentGroupModel !== undefined) {
|
||||
data_to_send.set("parent_group", this.parentGroupModel);
|
||||
}
|
||||
|
||||
//Use Axios to send data
|
||||
this.axios.post(
|
||||
`${this.rootUrl}new_group/save/`, data_to_send
|
||||
).then((response) => {
|
||||
//Go to that webpage
|
||||
window.location.href = response.data;
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Failed to Add New Group",
|
||||
message: `Sorry, could not save new group. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
checkGroupName() {
|
||||
//Send group name to backend to make sure it is not a duplicate
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("search", this.groupNameModel);
|
||||
|
||||
//User Axios to send data
|
||||
this.axios.post(
|
||||
`${this.rootUrl}group_information/check_group_name/`,
|
||||
data_to_send
|
||||
).then((response) => {
|
||||
// Update the uniqueGroupName
|
||||
this.uniqueGroupName = response.data.length === 0;
|
||||
|
||||
// Hide the checking group name
|
||||
this.checkingGroupName = false;
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Failed to Check the Group Name",
|
||||
message: `Sorry, could not check the group name. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
})
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
32
NearBeach/src/js/components/icons/CarbonArrowUp.vue
Normal file
32
NearBeach/src/js/components/icons/CarbonArrowUp.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path fill="currentColor" d="M16 4L6 14l1.41 1.41L15 7.83V28h2V7.83l7.59 7.58L26 14z" />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "CarbonArrowUp",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Carbon-->
|
||||
<!--Developer: IBM-->
|
||||
33
NearBeach/src/js/components/icons/CarbonCloseOutline.vue
Normal file
33
NearBeach/src/js/components/icons/CarbonCloseOutline.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path fill="currentColor" d="M16 2C8.2 2 2 8.2 2 16s6.2 14 14 14s14-6.2 14-14S23.8 2 16 2m0 26C9.4 28 4 22.6 4 16S9.4 4 16 4s12 5.4 12 12s-5.4 12-12 12" />
|
||||
<path fill="currentColor" d="M21.4 23L16 17.6L10.6 23L9 21.4l5.4-5.4L9 10.6L10.6 9l5.4 5.4L21.4 9l1.6 1.6l-5.4 5.4l5.4 5.4z" />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "CarbonCloseOutline",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Carbon-->
|
||||
<!--Developer: IBM-->
|
||||
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path class="cls-2" d="m22,16l-1.4141,1.4141,4.5859,4.5859h-10.1719V5c0-1.1046-.8954-2-2-2H3v2h10v17c0,1.1046.8954,2,2,2h10.1719l-4.5859,4.5859,1.4141,1.4141,7-7-7-7Z"/>
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "CarbonConnectionFlowUsage",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Carbon-->
|
||||
<!--Developer: IBM-->
|
||||
33
NearBeach/src/js/components/icons/CarbonDocument.vue
Normal file
33
NearBeach/src/js/components/icons/CarbonDocument.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path fill="currentColor" d="m25.7 9.3l-7-7c-.2-.2-.4-.3-.7-.3H8c-1.1 0-2 .9-2 2v24c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V10c0-.3-.1-.5-.3-.7M18 4.4l5.6 5.6H18zM24 28H8V4h8v6c0 1.1.9 2 2 2h6z" />
|
||||
<path fill="currentColor" d="M10 22h12v2H10zm0-6h12v2H10z" />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "CarbonDocument",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Carbon-->
|
||||
<!--Developer: IBM-->
|
||||
33
NearBeach/src/js/components/icons/CarbonDocumentPdf.vue
Normal file
33
NearBeach/src/js/components/icons/CarbonDocumentPdf.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path fill="currentColor" d="M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z" />
|
||||
<path fill="currentColor" d="M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z" />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "CarbonDocumentPdf",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Carbon-->
|
||||
<!--Developer: IBM-->
|
||||
40
NearBeach/src/js/components/icons/CarbonDragVertical.vue
Normal file
40
NearBeach/src/js/components/icons/CarbonDragVertical.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<polygon fill="currentColor" points="4 20 15 20 15 26.17 12.41 23.59 11 25 16 30 21 25 19.59 23.59 17 26.17 17 20 28 20 28 18 4 18 4 20"/>
|
||||
<polygon fill="currentColor" points="11 7 12.41 8.41 15 5.83 15 12 4 12 4 14 28 14 28 12 17 12 17 5.83 19.59 8.41 21 7 16 2 11 7"/>
|
||||
<rect id="_Transparent_Rectangle_" data-name="<Transparent Rectangle>" class="transparent-rectangle" width="32" height="32"/>
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "CarbonDragVertical",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.transparent-rectangle {
|
||||
fill: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--ICON NAME: Carbon-->
|
||||
<!--Developer: IBM-->
|
||||
32
NearBeach/src/js/components/icons/CarbonEmail.vue
Normal file
32
NearBeach/src/js/components/icons/CarbonEmail.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path fill="currentColor" d="M28 6H4a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h24a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2m-2.2 2L16 14.78L6.2 8ZM4 24V8.91l11.43 7.91a1 1 0 0 0 1.14 0L28 8.91V24Z" />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "CarbonEmail",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Carbon-->
|
||||
<!--Developer: IBM-->
|
||||
32
NearBeach/src/js/components/icons/CarbonFolder.vue
Normal file
32
NearBeach/src/js/components/icons/CarbonFolder.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path fill="currentColor" d="m11.17 6l3.42 3.41l.58.59H28v16H4V6zm0-2H4a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h24a2 2 0 0 0 2-2V10a2 2 0 0 0-2-2H16l-3.41-3.41A2 2 0 0 0 11.17 4" />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "CarbonFolder",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Carbon-->
|
||||
<!--Developer: IBM-->
|
||||
33
NearBeach/src/js/components/icons/CarbonImage.vue
Normal file
33
NearBeach/src/js/components/icons/CarbonImage.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path fill="currentColor" d="M19 14a3 3 0 1 0-3-3a3 3 0 0 0 3 3m0-4a1 1 0 1 1-1 1a1 1 0 0 1 1-1" />
|
||||
<path fill="currentColor" d="M26 4H6a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h20a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 22H6v-6l5-5l5.59 5.59a2 2 0 0 0 2.82 0L21 19l5 5Zm0-4.83l-3.59-3.59a2 2 0 0 0-2.82 0L18 19.17l-5.59-5.59a2 2 0 0 0-2.82 0L6 17.17V6h20Z" />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "CarbonImage",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Carbon-->
|
||||
<!--Developer: IBM-->
|
||||
33
NearBeach/src/js/components/icons/CarbonInformation.vue
Normal file
33
NearBeach/src/js/components/icons/CarbonInformation.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path fill="currentColor" d="M17 22v-8h-4v2h2v6h-3v2h8v-2zM16 8a1.5 1.5 0 1 0 1.5 1.5A1.5 1.5 0 0 0 16 8" />
|
||||
<path fill="currentColor" d="M16 30a14 14 0 1 1 14-14a14 14 0 0 1-14 14m0-26a12 12 0 1 0 12 12A12 12 0 0 0 16 4" />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "CarbonInformation",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Carbon-->
|
||||
<!--Developer: IBM-->
|
||||
33
NearBeach/src/js/components/icons/CarbonLink.vue
Normal file
33
NearBeach/src/js/components/icons/CarbonLink.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path fill="currentColor" d="M29.25 6.76a6 6 0 0 0-8.5 0l1.42 1.42a4 4 0 1 1 5.67 5.67l-8 8a4 4 0 1 1-5.67-5.66l1.41-1.42l-1.41-1.42l-1.42 1.42a6 6 0 0 0 0 8.5A6 6 0 0 0 17 25a6 6 0 0 0 4.27-1.76l8-8a6 6 0 0 0-.02-8.48" />
|
||||
<path fill="currentColor" d="M4.19 24.82a4 4 0 0 1 0-5.67l8-8a4 4 0 0 1 5.67 0A3.94 3.94 0 0 1 19 14a4 4 0 0 1-1.17 2.85L15.71 19l1.42 1.42l2.12-2.12a6 6 0 0 0-8.51-8.51l-8 8a6 6 0 0 0 0 8.51A6 6 0 0 0 7 28a6.07 6.07 0 0 0 4.28-1.76l-1.42-1.42a4 4 0 0 1-5.67 0" />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "CarbonLink",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Carbon-->
|
||||
<!--Developer: IBM-->
|
||||
33
NearBeach/src/js/components/icons/CarbonTrashCan.vue
Normal file
33
NearBeach/src/js/components/icons/CarbonTrashCan.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path fill="currentColor" d="M12 12h2v12h-2zm6 0h2v12h-2z" />
|
||||
<path fill="currentColor" d="M4 6v2h2v20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h2V6zm4 22V8h16v20zm4-26h8v2h-8z" />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "CarbonTrashCan",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Carbon-->
|
||||
<!--Developer: IBM-->
|
||||
32
NearBeach/src/js/components/icons/MdiMicrosoftExcel.vue
Normal file
32
NearBeach/src/js/components/icons/MdiMicrosoftExcel.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path fill="currentColor" d="M21.17 3.25q.33 0 .59.25q.24.24.24.58v15.84q0 .34-.24.58q-.26.25-.59.25H7.83q-.33 0-.59-.25q-.24-.24-.24-.58V17H2.83q-.33 0-.59-.24Q2 16.5 2 16.17V7.83q0-.33.24-.59Q2.5 7 2.83 7H7V4.08q0-.34.24-.58q.26-.25.59-.25M7 13.06l1.18 2.22h1.79L8 12.06l1.93-3.17H8.22L7.13 10.9l-.04.06l-.03.07q-.26-.53-.56-1.07q-.25-.53-.53-1.07H4.16l1.89 3.19L4 15.28h1.78m8.1 4.22V17H8.25v2.5m5.63-3.75v-3.12H12v3.12m1.88-4.37V8.25H12v3.13M13.88 7V4.5H8.25V7m12.5 12.5V17h-5.62v2.5m5.62-3.75v-3.12h-5.62v3.12m5.62-4.37V8.25h-5.62v3.13M20.75 7V4.5h-5.62V7Z" />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "MdiMicrosoftExcel",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Material Design Icons-->
|
||||
<!--Developer: Pictogrammers-->
|
||||
32
NearBeach/src/js/components/icons/MdiMicrosoftPowerPoint.vue
Normal file
32
NearBeach/src/js/components/icons/MdiMicrosoftPowerPoint.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path fill="currentColor" d="M13.25 3.25q1.21 0 2.33.31q1.12.32 2.09.89q.97.55 1.77 1.36q.79.8 1.36 1.77q.58.97.89 2.09T22 12t-.31 2.33t-.89 2.09q-.57.97-1.36 1.77q-.8.81-1.77 1.36q-.97.58-2.09.89t-2.33.31q-1.07 0-2.1-.25q-1.03-.26-1.95-.74q-.92-.49-1.7-1.18q-.81-.7-1.43-1.58H2.83q-.33 0-.59-.24Q2 16.5 2 16.17V7.83q0-.33.24-.58Q2.5 7 2.83 7h3.24q.62-.88 1.43-1.58q.78-.7 1.7-1.18q.93-.48 1.95-.74q1.03-.25 2.1-.25m.63 1.28v6.84h6.84q-.12-1.37-.69-2.56T18.55 6.7q-.91-.91-2.12-1.48q-1.2-.57-2.55-.69M9.5 10.84q0-.57-.2-.97q-.19-.41-.52-.66q-.33-.26-.78-.37q-.45-.12-1-.12H4.37v6.55h1.54V13h1.03q.48 0 .93-.16q.46-.14.82-.41q.36-.26.58-.67q.23-.4.23-.92m3.75 8.66q.98 0 1.89-.24q.9-.26 1.71-.68q.81-.45 1.48-1.08q.67-.61 1.17-1.37q.5-.77.83-1.66q.31-.89.39-1.85h-8.08V4.53q-1.45.12-2.73.76T7.67 7h3.5q.33 0 .59.25q.24.25.24.58v8.34q0 .33-.24.59q-.26.24-.59.24h-3.5q.53.6 1.17 1.06q.66.44 1.35.78q.72.33 1.49.49q.77.17 1.57.17M6.85 10q.47 0 .76.19q.28.19.28.7q0 .22-.1.36t-.26.25q-.16.07-.35.1q-.18.04-.38.04h-.89V10z" />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "MdiMicrosoftPowerPoint",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default: "20px"
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Material Design Icons-->
|
||||
<!--Developer: Pictogrammers-->
|
||||
32
NearBeach/src/js/components/icons/MdiMicrosoftWord.vue
Normal file
32
NearBeach/src/js/components/icons/MdiMicrosoftWord.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<span class="icon">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
:width="width"
|
||||
:height="height"
|
||||
viewBox="0 0 32 32"
|
||||
>
|
||||
<path fill="currentColor" d="M21.17 3.25q.33 0 .59.25q.24.24.24.58v15.84q0 .34-.24.58q-.26.25-.59.25H7.83q-.33 0-.59-.25q-.24-.24-.24-.58V17H2.83q-.33 0-.59-.24Q2 16.5 2 16.17V7.83q0-.33.24-.59Q2.5 7 2.83 7H7V4.08q0-.34.24-.58q.26-.25.59-.25m-.8 8.09l1.2 3.94H9.6l1.31-6.56H9.53l-.78 3.88l-1.11-3.75H6.5l-1.19 3.77l-.78-3.9H3.09l1.31 6.56h1.37m14.98 4.22V17H8.25v2.5m12.5-3.75v-3.12H12v3.12m8.75-4.37V8.25H12v3.13M20.75 7V4.5H8.25V7Z" />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "MdiMicrosoftWord",
|
||||
props: {
|
||||
height: {
|
||||
type: String,
|
||||
default: "20px",
|
||||
},
|
||||
width: {
|
||||
type: String,
|
||||
default:"20px",
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<!--ICON NAME: Material Design Icons-->
|
||||
<!--Developer: Pictogrammers-->
|
||||
142
NearBeach/src/js/components/kanban/ArchiveCards.vue
Normal file
142
NearBeach/src/js/components/kanban/ArchiveCards.vue
Normal file
@@ -0,0 +1,142 @@
|
||||
<template>
|
||||
<div
|
||||
id="archiveCardsModal"
|
||||
class="modal fade"
|
||||
tabindex="-1"
|
||||
data-bs-backdrop="static"
|
||||
data-bs-keyboard="false"
|
||||
aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5
|
||||
id="exampleModalLabel"
|
||||
class="modal-title"
|
||||
>
|
||||
Are you sure?
|
||||
</h5>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-close"
|
||||
aria-label="Close"
|
||||
@click="closeModal"
|
||||
></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Are you sure you want to archive the cards? This can not be
|
||||
undone.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-secondary"
|
||||
@click="closeModal"
|
||||
>
|
||||
No
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
@click="archiveCards"
|
||||
>
|
||||
Yes
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
import {Modal} from "bootstrap";
|
||||
|
||||
export default {
|
||||
name: "ArchiveCards",
|
||||
data() {
|
||||
return {
|
||||
archiveCardsModal: {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
allCards: "getCards",
|
||||
archiveDestination: "getArchiveDestination",
|
||||
archiveDestinationString: "getArchiveDestinationString",
|
||||
rootUrl: "getRootUrl",
|
||||
}),
|
||||
},
|
||||
watch: {
|
||||
archiveDestinationString(newValue) {
|
||||
//Check to make sure there are values within column or level
|
||||
if (newValue === undefined) return;
|
||||
|
||||
//Open the modal
|
||||
this.archiveCardsModal = new Modal("#archiveCardsModal");
|
||||
this.archiveCardsModal.show();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
archiveCards() {
|
||||
//Simplify the variables
|
||||
const column = this.archiveDestination.column;
|
||||
const level = this.archiveDestination.level;
|
||||
|
||||
// Create data_to_send
|
||||
const data_to_send = new FormData();
|
||||
|
||||
// Loop through the master list and get all card ids
|
||||
this.allCards
|
||||
.filter((card) => {
|
||||
return (
|
||||
parseInt(card.kanban_column) === column &&
|
||||
parseInt(card.kanban_level) === level
|
||||
);
|
||||
})
|
||||
.forEach((card) => {
|
||||
data_to_send.append("kanban_card_id", card.kanban_card_id);
|
||||
});
|
||||
|
||||
//Mutate the data to exclude the archived cards
|
||||
this.$store.commit({
|
||||
type: "archiveCards",
|
||||
column,
|
||||
level,
|
||||
});
|
||||
|
||||
//Close the modal
|
||||
this.archiveCardsModal.hide();
|
||||
|
||||
//Reset the state
|
||||
this.$store.commit({
|
||||
type: "updateArchiveDestination",
|
||||
column: "",
|
||||
level: "",
|
||||
});
|
||||
|
||||
// Use axios to contact backend
|
||||
this.axios
|
||||
.post(
|
||||
`${this.rootUrl}kanban_information/archive_kanban_cards/`,
|
||||
data_to_send
|
||||
)
|
||||
.catch(() => {
|
||||
//TODO: Return cards back into state management. They errored out.
|
||||
});
|
||||
},
|
||||
closeModal() {
|
||||
//Close the modal
|
||||
this.archiveCardsModal.hide();
|
||||
|
||||
//Reset the state
|
||||
this.$store.commit({
|
||||
type: "updateArchiveDestination",
|
||||
column: "",
|
||||
level: "",
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
124
NearBeach/src/js/components/kanban/BlockedNotesModal.vue
Normal file
124
NearBeach/src/js/components/kanban/BlockedNotesModal.vue
Normal file
@@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<div
|
||||
id="blockedNotesModal"
|
||||
class="modal fade"
|
||||
tabindex="-1"
|
||||
aria-labelledby="blockedNotesModal"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog modal-lg modal-fullscreen-lg-down">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2>Blocked Card Notes</h2>
|
||||
<button
|
||||
id="blockedNotesModalButton"
|
||||
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>Blocked Card Notes</strong>
|
||||
<p class="text-instructions">
|
||||
Please write a reason why this particular card
|
||||
is blocked at the moment.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<editor
|
||||
v-model="noteModal"
|
||||
license-key="gpl"
|
||||
:init="{
|
||||
license_key: 'gpl',
|
||||
file_picker_types: 'image',
|
||||
height: 250,
|
||||
menubar: false,
|
||||
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>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
class="btn btn-secondary"
|
||||
@click="closeModal"
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-primary save-changes"
|
||||
:disabled="noteModal === ''"
|
||||
@click="addNote"
|
||||
>
|
||||
Add Note
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Editor from "@tinymce/tinymce-vue";
|
||||
|
||||
//VueX
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "BlockedNotesModal",
|
||||
components: {
|
||||
editor: Editor,
|
||||
},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
noteModal: "",
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
cardId: "getCardId",
|
||||
contentCss: "getContentCss",
|
||||
rootUrl: "getRootUrl",
|
||||
skin: "getSkin",
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
addNote() {
|
||||
//Setup data to send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("note", this.noteModal);
|
||||
|
||||
//Use axios to send the data
|
||||
this.axios
|
||||
.post(
|
||||
`${this.rootUrl}object_data/kanban_card/${this.cardId}/add_notes/`,
|
||||
data_to_send
|
||||
)
|
||||
.then(() => {
|
||||
this.closeModal();
|
||||
});
|
||||
},
|
||||
closeModal() {
|
||||
//Clear the data
|
||||
this.noteModal = "";
|
||||
|
||||
//Close the modal
|
||||
document.getElementById("blockedNotesModalButton").click();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
114
NearBeach/src/js/components/kanban/ConfirmCardArchive.vue
Normal file
114
NearBeach/src/js/components/kanban/ConfirmCardArchive.vue
Normal file
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<div
|
||||
id="confirmCardArchiveModal"
|
||||
class="modal fade"
|
||||
tabindex="-1"
|
||||
aria-labelledby="confirmCardArchiveModalLabel"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h2>Card Information</h2>
|
||||
<button
|
||||
id="confirmCardArchiveModalCloseButton"
|
||||
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="alert alert-danger">
|
||||
Please note - archiving the card can not be undone.
|
||||
</div>
|
||||
<h3>
|
||||
Are you sure you want to archive the following card?
|
||||
</h3>
|
||||
<div class="row">
|
||||
<div class="col">Card No. - {{ cardId }}</div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="row">
|
||||
<div class="col">Card Title - {{ cardTitle }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-danger"
|
||||
@click="archiveCard"
|
||||
>
|
||||
Yes Archive Card
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-secondary"
|
||||
@click="goBack"
|
||||
>
|
||||
No go back
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
import {Modal} from "bootstrap";
|
||||
|
||||
export default {
|
||||
name: "ConfirmCardArchive",
|
||||
computed: {
|
||||
...mapGetters({
|
||||
cardId: "getCardId",
|
||||
cardTitle: "getCardTitle",
|
||||
rootUrl: "getRootUrl",
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
archiveCard() {
|
||||
//Create data to send
|
||||
const data_to_send = new FormData();
|
||||
|
||||
//Append the kanban_card_id, not set, as the form is expecting an array/list
|
||||
data_to_send.append("kanban_card_id", this.cardId);
|
||||
|
||||
//TODO - update VueX to remove single card
|
||||
//Mutate the data to exlcude the archived card
|
||||
this.$store.commit({
|
||||
type: "archiveCard",
|
||||
cardId: this.cardId,
|
||||
});
|
||||
|
||||
//Close the modal
|
||||
document
|
||||
.getElementById("confirmCardArchiveModalCloseButton")
|
||||
.click();
|
||||
|
||||
//Send the data to backend
|
||||
this.axios
|
||||
.post(
|
||||
`${this.rootUrl}kanban_information/archive_kanban_cards/`,
|
||||
data_to_send
|
||||
)
|
||||
.catch(() => {
|
||||
//TODO: show card error
|
||||
});
|
||||
},
|
||||
goBack() {
|
||||
//Close current modal
|
||||
document
|
||||
.getElementById("confirmCardArchiveModalCloseButton")
|
||||
.click();
|
||||
|
||||
//Open previous modal
|
||||
const modal = new Modal("#cardInformationModal");
|
||||
modal.show();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<div
|
||||
id="confirmKanbanBoardClosure"
|
||||
class="modal fade"
|
||||
tabindex="-1"
|
||||
data-bs-backdrop="static"
|
||||
data-bs-keyboard="false"
|
||||
aria-labelledby="confirmKanbanBoardClosure"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5
|
||||
id="confirmKanbanBoardClosure"
|
||||
class="modal-title"
|
||||
>
|
||||
Please confirm Kanban Board Closure
|
||||
</h5>
|
||||
<!-- TASK INFORMATION -->
|
||||
<button
|
||||
id="confirmKanbanCloseButton"
|
||||
type="button"
|
||||
class="btn-close"
|
||||
data-bs-dismiss="modal"
|
||||
aria-label="Close"
|
||||
></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Are you sure you want to close the current Kanban Board?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-secondary"
|
||||
@click="closeModal"
|
||||
>
|
||||
No
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
@click="closeKanbanBoard"
|
||||
>
|
||||
Yes
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "ConfirmKanbanBoardClosure",
|
||||
computed: {
|
||||
...mapGetters({
|
||||
destination: "getDestination",
|
||||
locationId: "getLocationId",
|
||||
rootUrl: "getRootUrl",
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
closeKanbanBoard() {
|
||||
this.axios.post(
|
||||
`${this.rootUrl}kanban_information/${this.locationId}/close_board/`
|
||||
)
|
||||
.then(() => {
|
||||
window.location.href = `${this.rootUrl}`;
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Error closing the kanban board",
|
||||
message: `Sorry, we could not close the kanban board. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
closeModal() {
|
||||
document.getElementById("confirmKanbanCloseButton").click();
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,85 @@
|
||||
<template>
|
||||
<div
|
||||
id="confirmKanbanBoardReopen"
|
||||
class="modal fade"
|
||||
tabindex="-1"
|
||||
data-bs-backdrop="static"
|
||||
data-bs-keyboard="false"
|
||||
aria-labelledby="confirmKanbanBoardReopen"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5
|
||||
id="confirmKanbanBoardOpen"
|
||||
class="modal-title"
|
||||
>
|
||||
Please confirm Kanban Board Reopen
|
||||
</h5>
|
||||
<!-- TASK INFORMATION -->
|
||||
<button
|
||||
id="confirmKanbanCloseButton"
|
||||
type="button"
|
||||
class="btn-close"
|
||||
data-bs-dismiss="modal"
|
||||
aria-label="Close"
|
||||
></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Are you sure you want to reopen the current Kanban Board?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-secondary"
|
||||
@click="closeModal"
|
||||
>
|
||||
No
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
@click="reopenKanbanBoard"
|
||||
>
|
||||
Yes
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "ConfirmKanbanBoardOpen",
|
||||
computed: {
|
||||
...mapGetters({
|
||||
destination: "getDestination",
|
||||
locationId: "getLocationId",
|
||||
rootUrl: "getRootUrl",
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
reopenKanbanBoard() {
|
||||
this.axios.post(
|
||||
`${this.rootUrl}kanban_information/${this.locationId}/reopen_board/`
|
||||
).then(() => {
|
||||
window.location.reload();
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
heading: "Error Reopening Kanban board",
|
||||
message: `Error typing to reopen kanban board: Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
closeModal() {
|
||||
document.getElementById("confirmKanbanBoardOpen").click();
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
200
NearBeach/src/js/components/kanban/GetKanbanSettings.vue
Normal file
200
NearBeach/src/js/components/kanban/GetKanbanSettings.vue
Normal file
@@ -0,0 +1,200 @@
|
||||
<template>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h2>Kanban Settings</h2>
|
||||
<p class="text-instructions">
|
||||
Please search for the kanban board in the dropdown. Then choose the appropriate Kanban Level and Column.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label for="kanban_board">
|
||||
Kanban Board
|
||||
<validation-rendering
|
||||
:error-list="v$.kanbanBoardModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<n-select
|
||||
v-model:value="kanbanBoardModel"
|
||||
:options="kanbanBoardOptions"
|
||||
filterable
|
||||
placeholder="Search Kanban Boards"
|
||||
label-field="kanban_board_name"
|
||||
value-field="kanban_board_id"
|
||||
class="get-stakeholders"
|
||||
@search="fetchKanbanBoardOptions"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h2>Kanban Column/Level</h2>
|
||||
<p class="text-instructions">
|
||||
Please pick the Column and Level for the Kanban Card.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="kanban_column">
|
||||
Kanban Column
|
||||
<validation-rendering
|
||||
:error-list="v$.kanbanBoardModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<n-select
|
||||
v-model:value="kanbanColumnModel"
|
||||
:options="kanbanColumnOptions"
|
||||
filterable
|
||||
placeholder="Search Columns"
|
||||
label-field="kanban_column_name"
|
||||
value-field="kanban_column_id"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label for="kanban_board">
|
||||
Kanban Level
|
||||
<validation-rendering
|
||||
:error-list="v$.kanbanBoardModel.$errors"
|
||||
></validation-rendering>
|
||||
</label>
|
||||
<n-select
|
||||
v-model:value="kanbanLevelModel"
|
||||
:options="kanbanLevelOptions"
|
||||
filterable
|
||||
placeholder="Search Levels"
|
||||
label-field="kanban_level_name"
|
||||
value-field="kanban_level_id"
|
||||
class="get-stakeholders"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
import ValidationRendering from "Components/validation/ValidationRendering.vue";
|
||||
import {NSelect} from "naive-ui";
|
||||
import {required} from "@vuelidate/validators";
|
||||
import useVuelidate from "@vuelidate/core";
|
||||
|
||||
export default {
|
||||
name: "GetKanbanSettings",
|
||||
components: {
|
||||
NSelect,
|
||||
ValidationRendering
|
||||
},
|
||||
props: {
|
||||
initKanbanBoardId: {
|
||||
type: Number,
|
||||
default: undefined,
|
||||
},
|
||||
initKanbanColumnId: {
|
||||
type: Number,
|
||||
default: undefined,
|
||||
},
|
||||
initKanbanLevelId: {
|
||||
type: Number,
|
||||
default: undefined,
|
||||
},
|
||||
},
|
||||
emits: [
|
||||
"update_kanban_settings",
|
||||
],
|
||||
setup() {
|
||||
return {v$: useVuelidate()};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
kanbanBoardModel: this.initKanbanBoardId === 0 ? "" : this.initKanbanBoardId,
|
||||
kanbanBoardOptions: [],
|
||||
kanbanColumnModel: this.initKanbanColumnId === 0 ? "" : this.initKanbanColumnId,
|
||||
kanbanColumnOptions: [],
|
||||
kanbanLevelModel: this.initKanbanLevelId === 0 ? "" : this.initKanbanLevelId,
|
||||
kanbanLevelOptions: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
rootUrl: "getRootUrl",
|
||||
}),
|
||||
},
|
||||
validations: {
|
||||
kanbanBoardModel: {
|
||||
required,
|
||||
},
|
||||
kanbanLevelModel: {
|
||||
required,
|
||||
},
|
||||
kanbanColumnModel: {
|
||||
required,
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
kanbanBoardModel() {
|
||||
// Clear results
|
||||
this.kanbanColumnModel = "";
|
||||
this.kanbanLevelModel = "";
|
||||
|
||||
this.fetchKanbanProperties();
|
||||
this.updateDetails();
|
||||
},
|
||||
kanbanColumnModel() {
|
||||
this.updateDetails();
|
||||
},
|
||||
kanbanLevelModel() {
|
||||
this.updateDetails();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.fetchKanbanBoardOptions();
|
||||
},
|
||||
methods: {
|
||||
fetchKanbanBoardOptions() {
|
||||
this.axios.get(
|
||||
`${this.rootUrl}api/v0/kanban_board/`
|
||||
).then((response) => {
|
||||
this.kanbanBoardOptions = response.data.results;
|
||||
|
||||
// If there exists data already, also get the properties
|
||||
if (this.initKanbanBoardId > 0) {
|
||||
this.fetchKanbanProperties();
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Fetching Kanban List",
|
||||
message: `Sorry, could not fetch the list of kanban board. ${error}`,
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
});
|
||||
})
|
||||
},
|
||||
fetchKanbanProperties() {
|
||||
this.axios.get(
|
||||
`${this.rootUrl}api/v0/kanban_board/${this.kanbanBoardModel}/`
|
||||
).then(response => {
|
||||
this.kanbanColumnOptions = response.data.kanban_column;
|
||||
this.kanbanLevelOptions = response.data.kanban_level;
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Fetching Kanban Properties",
|
||||
message: `Sorry, could not fetch the kanban properties. ${error}`,
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
})
|
||||
});
|
||||
},
|
||||
updateDetails() {
|
||||
this.$emit("update_kanban_settings", {
|
||||
"kanbanBoardModel": parseInt(this.kanbanBoardModel),
|
||||
"kanbanColumnModel": parseInt(this.kanbanColumnModel),
|
||||
"kanbanLevelModel": parseInt(this.kanbanLevelModel),
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
208
NearBeach/src/js/components/kanban/KanbanBoard.vue
Normal file
208
NearBeach/src/js/components/kanban/KanbanBoard.vue
Normal file
@@ -0,0 +1,208 @@
|
||||
<template>
|
||||
<div
|
||||
id="kanban_container"
|
||||
class="kanban-container"
|
||||
@scroll="scrollProcedure"
|
||||
>
|
||||
<!-- Render out the header -->
|
||||
<div class="kanban-header-row">
|
||||
<div
|
||||
v-for="column in columnResults"
|
||||
:key="column.pk"
|
||||
class="kanban-column-header"
|
||||
>
|
||||
{{ column.fields.kanban_column_name }} - [{{ getColumnCount(column.pk) }}]
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Render out the STICKY header -->
|
||||
<div
|
||||
class="kanban-header-row kanban-sticky-row"
|
||||
style="display: none"
|
||||
>
|
||||
<div
|
||||
v-for="column in columnResults"
|
||||
:key="column.pk"
|
||||
class="kanban-column-header"
|
||||
>
|
||||
{{ column.fields.kanban_column_name }} - [{{ getColumnCount(column.pk) }}]
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Render each row -->
|
||||
<div
|
||||
v-for="level in levelResults"
|
||||
:key="level.pk"
|
||||
>
|
||||
<!-- CREATE THE LEVEL HEADER -->
|
||||
<div
|
||||
class="kanban-level-div"
|
||||
@click="expandLevel(level.pk)"
|
||||
>
|
||||
<span :class="getExpandClass(level.pk)"
|
||||
></span>
|
||||
<span>
|
||||
{{ level.fields.kanban_level_name }}
|
||||
- [{{levelCardCount(level.pk)}}]
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- RENDER THE CELLS -->
|
||||
<kanban-row
|
||||
:level-id="level.pk"
|
||||
:new-card-info="newCardInfo"
|
||||
@double_clicked_card="doubleClickedCard($event)"
|
||||
></kanban-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import KanbanRow from "./KanbanRow.vue";
|
||||
|
||||
//VueX
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
|
||||
export default {
|
||||
name: "KanbanBoard",
|
||||
components: {
|
||||
KanbanRow,
|
||||
},
|
||||
props: {
|
||||
kanbanBoardResults: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
newCardInfo: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
emits: ['double_clicked_card'],
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
columnResults: "getColumnResults",
|
||||
levelCardCount: "getLevelCardCount",
|
||||
levelResults: "getLevelResults",
|
||||
}),
|
||||
},
|
||||
created() {
|
||||
window.addEventListener("resize", this.resizeProcedure);
|
||||
window.addEventListener("scroll", this.scrollProcedure);
|
||||
},
|
||||
unmounted() {
|
||||
window.removeEventListener("resize", this.resizeProcedure);
|
||||
window.removeEventListener("scroll", this.scrollProcedure);
|
||||
},
|
||||
mounted() {
|
||||
//Check the resize procedure
|
||||
this.$nextTick(() => {
|
||||
this.resizeProcedure();
|
||||
});
|
||||
|
||||
this.$store.commit({
|
||||
type: "updateKanbanStatus",
|
||||
kanbanStatus:
|
||||
this.kanbanBoardResults[0].fields.kanban_board_status,
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
doubleClickedCard(data) {
|
||||
//Send data upstream
|
||||
this.$emit("double_clicked_card", data);
|
||||
},
|
||||
expandLevel(level_id) {
|
||||
//Update the VueX data
|
||||
this.$store.dispatch("updateLevelCollapse", {
|
||||
level_id,
|
||||
});
|
||||
},
|
||||
getColumnCount(column_id) {
|
||||
return this.$store.getters.getColumnCount(column_id);
|
||||
},
|
||||
getExpandClass(level_id) {
|
||||
//Get the required results from vuex
|
||||
const collapsed_status = this.$store.getters.getLevelCollapseStatus(level_id);
|
||||
|
||||
// If getLevel Collasped status is true - it is collapsed
|
||||
if (collapsed_status) {
|
||||
return "kanban-expand collapsed";
|
||||
}
|
||||
|
||||
return "kanban-expand expanded";
|
||||
},
|
||||
resizeProcedure() {
|
||||
// Get the screen size and the columns width
|
||||
const little_adjustment = 2 * (this.columnResults.length - 1)
|
||||
const columns_width = this.columnResults.length * 400 + little_adjustment;
|
||||
const container_element = document.getElementsByClassName("kanban-container")[0];
|
||||
|
||||
//If container element does not exist just return
|
||||
if (container_element === undefined) return;
|
||||
|
||||
//Get the kanban container width
|
||||
const kanban_container_width = container_element.clientWidth;
|
||||
|
||||
//If the columns width is smaller than the screen size
|
||||
// - we will need to adjust the kanban-level-div to match
|
||||
// that smaller size
|
||||
if (columns_width < kanban_container_width) {
|
||||
//Add in the width restrictions
|
||||
// const header_element = document.getElementsByClassName("kanban-edit-text")[0];
|
||||
const elements = document.getElementsByClassName("kanban-level-div");
|
||||
|
||||
//Loop through each element
|
||||
Array.from(elements).forEach((element) => {
|
||||
element.style = `max-width: ${columns_width}px;`;
|
||||
});
|
||||
|
||||
//Adjust the size of the header element
|
||||
// header_element.style = `max-width: ${columns_width}px`;
|
||||
} else {
|
||||
//The columns width is greater than the container width.
|
||||
//So we need to use the scroll width of the container
|
||||
const scroll_width = container_element.scrollWidth;
|
||||
// const header_element = document.getElementsByClassName("kanban-edit-text")[0];
|
||||
const elements = document.getElementsByClassName("kanban-level-div");
|
||||
|
||||
//Loop through each element
|
||||
Array.from(elements).forEach((element) => {
|
||||
element.style = `width: ${scroll_width}px;`;
|
||||
});
|
||||
|
||||
//Adjust the size of the header element
|
||||
// header_element.style = `max-width: ${scroll_width}px`;
|
||||
}
|
||||
},
|
||||
scrollProcedure() {
|
||||
//Make sure the kanban-sticky-row matches the scroll left for the kanban-container
|
||||
const kanban_sticky =
|
||||
document.getElementsByClassName("kanban-sticky-row")[0],
|
||||
kanban_container =
|
||||
document.getElementsByClassName("kanban-container")[0];
|
||||
|
||||
kanban_sticky.scrollLeft = kanban_container.scrollLeft;
|
||||
|
||||
//Get the distance to the top of the page
|
||||
const scrollTop = document.getElementById("kanban_container").scrollTop;
|
||||
|
||||
//Determine if we are hidding the element or not
|
||||
if (scrollTop < 90) {
|
||||
kanban_sticky.style.display = "none";
|
||||
} else {
|
||||
kanban_sticky.style.display = "";
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
328
NearBeach/src/js/components/kanban/KanbanColumn.vue
Normal file
328
NearBeach/src/js/components/kanban/KanbanColumn.vue
Normal file
@@ -0,0 +1,328 @@
|
||||
<template>
|
||||
<div
|
||||
:id="`kanban_cell_${levelId}_${columnId}`"
|
||||
class="list-group kanban-cell"
|
||||
:data-level="levelId"
|
||||
:data-column="columnId"
|
||||
>
|
||||
<div
|
||||
v-for="element in masterList"
|
||||
:id="element.kanban_card_id"
|
||||
:key="element.kanban_card_id"
|
||||
class="list-group-item"
|
||||
:data-sort-number="element.kanban_card_sort_number"
|
||||
:data-card-id="element.kanban_card_id"
|
||||
@dblclick="doubleClickCard($event)"
|
||||
>
|
||||
<div
|
||||
:class="`card-priority-line priority-${priorityList[element.kanban_card_priority]}`">
|
||||
</div>
|
||||
<carbon-link
|
||||
v-if="isLinkedObject(element)"
|
||||
class="card-external-link"
|
||||
></carbon-link>
|
||||
<b>#{{ element.kanban_card_id }}</b>
|
||||
<br/>
|
||||
{{ element.kanban_card_text }}
|
||||
<div
|
||||
v-if="element.tag_list.length > 0"
|
||||
class="tag-list"
|
||||
>
|
||||
<div
|
||||
v-for="single_tag in element.tag_list"
|
||||
:key="single_tag.tag_assignment_id"
|
||||
:style="`background-color:${single_tag.tag_colour};color:${single_tag.tag_text_colour};`"
|
||||
class="single-tag-thin"
|
||||
>
|
||||
{{ single_tag.tag_name }}
|
||||
</div>
|
||||
</div>
|
||||
<carbon-information
|
||||
class="kanban-card-info-icon"
|
||||
width="25px"
|
||||
height="25px"
|
||||
@click="singleClickCard(element.kanban_card_id)"
|
||||
@dblclick="singleClickCard(element.kanban_card_id)"
|
||||
></carbon-information>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {Modal} from "bootstrap";
|
||||
|
||||
//Components
|
||||
import CarbonInformation from "Components/icons/CarbonInformation.vue"
|
||||
import CarbonLink from "Components/icons/CarbonLink.vue"
|
||||
|
||||
|
||||
//VUEX MAP GETTERS
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "KanbanColumn",
|
||||
components: {
|
||||
CarbonInformation,
|
||||
CarbonLink,
|
||||
},
|
||||
props: {
|
||||
columnId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
levelId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
newCardInfo: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//masterList: [],
|
||||
drag: false,
|
||||
priorityList: [
|
||||
'highest',
|
||||
'high',
|
||||
'normal',
|
||||
'low',
|
||||
'lowest',
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
allCards: "getCards",
|
||||
kanbanStatus: "getKanbanStatus",
|
||||
openCardOnLoad: "getOpenCardOnLoad",
|
||||
rootUrl: "getRootUrl",
|
||||
}),
|
||||
masterList() {
|
||||
//Filter the data
|
||||
let return_array = this.allCards.filter((card) => {
|
||||
return (
|
||||
parseInt(card.kanban_column) === this.columnId &&
|
||||
parseInt(card.kanban_level) === this.levelId
|
||||
);
|
||||
});
|
||||
|
||||
//Make sure it is sorted
|
||||
return_array = return_array.sort((a, b) => {
|
||||
return (
|
||||
a.kanban_card_sort_number -
|
||||
b.kanban_card_sort_number
|
||||
);
|
||||
});
|
||||
|
||||
return return_array;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
newCardInfo() {
|
||||
//Only add the card if the column and the level match
|
||||
if (
|
||||
this.columnId === this.newCardInfo[0].kanban_column &&
|
||||
this.levelId === this.newCardInfo[0].kanban_level
|
||||
) {
|
||||
//The new card is for this level and column. Add it to the masterList
|
||||
this.masterList.push(this.newCardInfo[0]);
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
// this.checkCardOrder();
|
||||
|
||||
//Check to see if the "openCardOnLoad" card ID exists on in this section
|
||||
const count = this.masterList.filter((row) => {
|
||||
//Conditions
|
||||
// 1 row primary key is the same as openCardOnLoad value
|
||||
// 2 row is not a linked object, i.e. not value under project, task, or requirement field
|
||||
const condition_1 = row.kanban_card_id === this.openCardOnLoad;
|
||||
const condition_2 = this.isLinkedObject(row).length === 0;
|
||||
|
||||
return condition_1 && condition_2;
|
||||
}).length;
|
||||
|
||||
if (count > 0) {
|
||||
//Card exists here. Run function to open the card
|
||||
this.singleClickCard(this.openCardOnLoad);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
checkCardOrder() {
|
||||
/* Due to an issue - sometimes some of the cards will contain a -1 for the sort order. This sadly
|
||||
throws a spanner into the dragging and dropping functionality. When the board boots up, we will check to
|
||||
make sure the cards are in order. If they are not - we adjust them and upload the changes.
|
||||
|
||||
Checks
|
||||
~~~~~~
|
||||
1. Make sure there are no values under 0
|
||||
2. Make sure the lowest value is 0
|
||||
3. Make sure the highest value is length of the set minus 1.
|
||||
*/
|
||||
|
||||
//Don't worry about it when masterList is empty
|
||||
if (this.masterList.length === 0) {
|
||||
//Escape
|
||||
return;
|
||||
}
|
||||
|
||||
//Get the list of values for sort array
|
||||
const sort_array = this.masterList.map((row) => {
|
||||
return row.kanban_card_sort_number;
|
||||
});
|
||||
|
||||
//Get the min and max
|
||||
const min_value = Math.min.apply(null, sort_array),
|
||||
max_value = Math.max.apply(null, sort_array);
|
||||
|
||||
if (
|
||||
min_value === 0 &&
|
||||
max_value === this.masterList.length - 1
|
||||
) {
|
||||
//Nothing to do :) YAY
|
||||
return;
|
||||
}
|
||||
|
||||
//Show error screen
|
||||
document.getElementById("sort_error").style.display = "flex";
|
||||
|
||||
//There is an issue - we need to fix all the variables and send that information upstream to the
|
||||
//backend AND the VueX
|
||||
//Loop through the data
|
||||
this.masterList.forEach((row, index) => {
|
||||
//Setup data_to_send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set(
|
||||
"new_card_column",
|
||||
this.columnId.toString()
|
||||
);
|
||||
data_to_send.set("new_card_level", this.levelId.toString());
|
||||
data_to_send.set("new_card_sort_number", index.toString());
|
||||
data_to_send.set(
|
||||
"old_card_column",
|
||||
row.kanban_column
|
||||
);
|
||||
data_to_send.set("old_card_level", row.kanban_level);
|
||||
data_to_send.set(
|
||||
"old_card_sort_number",
|
||||
row.kanban_card_sort_number
|
||||
);
|
||||
data_to_send.set("card_id", row.kanban_card_id);
|
||||
|
||||
//Update kanban card
|
||||
this.$store.commit({
|
||||
type: "updateKanbanCard",
|
||||
card_id: row.kanban_card_id,
|
||||
kanban_column: this.columnId,
|
||||
kanban_level: this.levelId,
|
||||
kanban_card_sort_number: index,
|
||||
});
|
||||
|
||||
//Use axios to send the data to the database
|
||||
this.axios.post(
|
||||
`${this.rootUrl}kanban_information/${row.kanban_card_id}/move_card/`,
|
||||
data_to_send
|
||||
);
|
||||
});
|
||||
|
||||
//Done - hide the error screen
|
||||
document.getElementById("sort_error").style.display = "";
|
||||
},
|
||||
doubleClickCard(event) {
|
||||
//Retrieve the card id from the event
|
||||
const card_id = this.getCardIdFromObject(event.target);
|
||||
|
||||
//Check to make sure we card is not 0
|
||||
if (card_id === 0) return;
|
||||
|
||||
//Filter out the data we want to send up stream
|
||||
const filtered_data = this.masterList.filter((row) => {
|
||||
return parseInt(row.kanban_card_id) === parseInt(card_id);
|
||||
})[0];
|
||||
|
||||
//Check to see if there are any results
|
||||
if (filtered_data === undefined) return;
|
||||
|
||||
//Setup data to send upstream
|
||||
this.sendDataUpstream(filtered_data);
|
||||
},
|
||||
getCardIdFromObject(object) {
|
||||
//Recursive function, that checks to see if we can get the card id. If not we look at the parent.
|
||||
//The break points are where the parent is undefined, OR the id === "kanban_container"
|
||||
const card_id = object.dataset.cardId;
|
||||
|
||||
//Got the card id, lets return
|
||||
if (card_id !== undefined) return card_id;
|
||||
|
||||
//Check to make sure we not at the escapte point
|
||||
if (object.id === "kanban_container") return 0;
|
||||
if (object.parentElement === undefined || object.parentElement === null) return 0;
|
||||
|
||||
//Recursive call the function
|
||||
return this.getCardIdFromObject(object.parentElement);
|
||||
},
|
||||
isLinkedObject(object) {
|
||||
let results = "";
|
||||
|
||||
if (object.project !== null && object.project !== undefined) results = "project";
|
||||
if (object.requirement !== null && object.requirement !== undefined) results = "requirement";
|
||||
if (object.task !== null && object.requirement !== undefined) results = "task";
|
||||
|
||||
return results;
|
||||
},
|
||||
sendDataUpstream(filtered_data) {
|
||||
// Check to make sure this is a linked object
|
||||
const is_link = this.isLinkedObject(filtered_data);
|
||||
if (is_link.length > 0) {
|
||||
//Open a new tab with that linked object
|
||||
const url = `${this.rootUrl}${is_link}_information/${filtered_data[is_link]}/`;
|
||||
|
||||
window.open(
|
||||
url,
|
||||
'_blank'
|
||||
).focus();
|
||||
|
||||
//Just return - nothing else to do
|
||||
return;
|
||||
}
|
||||
|
||||
// Update VueX ACTION
|
||||
this.$store.dispatch({
|
||||
type: "updateCard",
|
||||
cardId: filtered_data.kanban_card_id,
|
||||
cardTitle: filtered_data.kanban_card_text,
|
||||
cardDescription:
|
||||
filtered_data.kanban_card_description,
|
||||
cardColumn: filtered_data.kanban_column,
|
||||
cardLevel: filtered_data.kanban_level,
|
||||
cardLink: {},
|
||||
cardPriority: filtered_data.kanban_card_priority,
|
||||
dateCreated: filtered_data.date_created,
|
||||
dateModified: filtered_data.date_modified,
|
||||
});
|
||||
|
||||
//Show the modal
|
||||
const cardInformationModal = new Modal(
|
||||
document.getElementById("cardInformationModal")
|
||||
);
|
||||
cardInformationModal.show();
|
||||
},
|
||||
singleClickCard(data) {
|
||||
//Filter out the data we want to send up stream
|
||||
const filtered_data = this.masterList.filter((row) => {
|
||||
return row.kanban_card_id === data;
|
||||
})[0];
|
||||
|
||||
//Setup data to send upstream
|
||||
this.sendDataUpstream(filtered_data);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
480
NearBeach/src/js/components/kanban/KanbanColumnDraggable.vue
Normal file
480
NearBeach/src/js/components/kanban/KanbanColumnDraggable.vue
Normal file
@@ -0,0 +1,480 @@
|
||||
<template>
|
||||
<draggable
|
||||
v-if="!levelCollapseStatus(levelId)"
|
||||
:id="`kanban_cell_${levelId}_${columnId}`"
|
||||
v-model="masterList"
|
||||
class="list-group kanban-cell"
|
||||
:data-level="levelId"
|
||||
:data-column="columnId"
|
||||
:data-column-property="columnProperty"
|
||||
:animation="200"
|
||||
:disabled="kanbanStatus === 'Closed' || !canDragCards"
|
||||
group="tasks"
|
||||
ghost-class="ghost"
|
||||
item-key="kanban_card_id"
|
||||
@end="onEnd($event)"
|
||||
>
|
||||
<template #item="{ element }">
|
||||
<div
|
||||
:id="element.kanban_card_id"
|
||||
:key="element.kanban_card_id"
|
||||
class="list-group-item"
|
||||
:data-sort-number="element.kanban_card_sort_number"
|
||||
:data-card-id="element.kanban_card_id"
|
||||
:data-card-priority="element.kanban_card_priority"
|
||||
@dblclick="doubleClickCard($event)"
|
||||
>
|
||||
<div :class="`card-priority-line priority-${priorityList[element.kanban_card_priority]}`"
|
||||
></div>
|
||||
<carbon-link
|
||||
v-if="isLinkedObject(element).length > 0"
|
||||
class="card-external-link"
|
||||
></carbon-link>
|
||||
<b>#{{ element.kanban_card_id }}</b>
|
||||
<br/>
|
||||
{{ element.kanban_card_text }}
|
||||
<br />
|
||||
<div>
|
||||
Created Date:
|
||||
<span class="text-instructions">
|
||||
{{useNiceDatetime(element.date_created)}}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="element.tag_list.length > 0"
|
||||
class="tag-list"
|
||||
>
|
||||
<div
|
||||
v-for="single_tag in element.tag_list"
|
||||
:key="single_tag.tag_assignment_id"
|
||||
:style="`background-color:${single_tag.tag_colour};color:${single_tag.tag_text_colour};`"
|
||||
class="single-tag-thin"
|
||||
>
|
||||
{{ single_tag.tag_name }}
|
||||
</div>
|
||||
</div>
|
||||
<span v-if="!canDragCards" style="font-weight: lighter">- Movement Locked!</span>
|
||||
<span v-else style="font-weight: lighter">
|
||||
|
||||
</span>
|
||||
<carbon-information
|
||||
class="kanban-card-info-icon"
|
||||
width="25px"
|
||||
height="25px"
|
||||
@click="singleClickCard(element.kanban_card_id)"
|
||||
@dblclick="singleClickCard(element.kanban_card_id)"
|
||||
></carbon-information>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- ADD NEW CARDS + LINK OBJECTS -->
|
||||
<template
|
||||
v-if="kanbanStatus !== 'Closed'"
|
||||
#footer
|
||||
>
|
||||
<div class="kanban-add-new-cards">
|
||||
<a
|
||||
v-if="columnProperty !== 'Closed'"
|
||||
class="kanban-link btn btn-primary"
|
||||
href="javascript:void(0)"
|
||||
@click="addNewKanbanCard"
|
||||
>
|
||||
New Card
|
||||
</a>
|
||||
<a
|
||||
v-if="columnProperty !== 'Closed'"
|
||||
class="kanban-link btn btn-warning"
|
||||
href="javascript:void(0)"
|
||||
@click="addNewLink"
|
||||
>
|
||||
Link Object
|
||||
</a>
|
||||
<a
|
||||
v-if="masterList.length > 0"
|
||||
class="kanban-link btn btn-danger"
|
||||
href="javascript:void(0)"
|
||||
@click="archiveCards"
|
||||
>
|
||||
Archive Cards
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
</draggable>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import draggable from "vuedraggable";
|
||||
import {Modal} from "bootstrap";
|
||||
|
||||
//Components
|
||||
import {CarbonInformation, CarbonLink} from "../../components";
|
||||
|
||||
//VUEX MAP GETTERS
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
//Composables
|
||||
import {useNiceDatetime} from "Composables/datetime/useNiceDatetime";
|
||||
|
||||
export default {
|
||||
name: "KanbanColumnDraggable",
|
||||
components: {
|
||||
CarbonInformation,
|
||||
CarbonLink,
|
||||
draggable,
|
||||
},
|
||||
props: {
|
||||
columnId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
columnProperty: {
|
||||
type: String,
|
||||
default: "Normal",
|
||||
},
|
||||
levelId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
newCardInfo: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//masterList: [],
|
||||
drag: false,
|
||||
priorityList: [
|
||||
'highest',
|
||||
'high',
|
||||
'normal',
|
||||
'low',
|
||||
'lowest',
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
allCards: "getCards",
|
||||
canDragCards: "getCanDragCards",
|
||||
kanbanStatus: "getKanbanStatus",
|
||||
levelCollapseStatus: "getLevelCollapseStatus",
|
||||
openCardOnLoad: "getOpenCardOnLoad",
|
||||
rootUrl: "getRootUrl",
|
||||
}),
|
||||
dragOptions() {
|
||||
return {
|
||||
animation: 200,
|
||||
group: "description",
|
||||
disabled: false,
|
||||
ghostClass: "ghost"
|
||||
};
|
||||
},
|
||||
masterList() {
|
||||
return this.$store.getters.getCardsOrder(this.columnId, this.levelId);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
newCardInfo() {
|
||||
//Only add the card if the column and the level match
|
||||
if (
|
||||
this.columnId === this.newCardInfo[0].kanban_column &&
|
||||
this.levelId === this.newCardInfo[0].kanban_level
|
||||
) {
|
||||
//The new card is for this level and column. Add it to the masterList
|
||||
this.masterList.push(this.newCardInfo[0]);
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.checkCardOrder();
|
||||
|
||||
//Check to see if the "openCardOnLoad" card ID exists on in this section
|
||||
const count = this.masterList.filter((row) => {
|
||||
//Conditions
|
||||
// 1 row primary key is the same as openCardOnLoad value
|
||||
// 2 row is not a linked object, i.e. not value under project, task, or requirement field
|
||||
const condition_1 = row.kanban_card_id === this.openCardOnLoad;
|
||||
const condition_2 = this.isLinkedObject(row).length === 0;
|
||||
|
||||
return condition_1 && condition_2;
|
||||
}).length;
|
||||
|
||||
if (count > 0) {
|
||||
//Card exists here. Run function to open the card
|
||||
this.singleClickCard(this.openCardOnLoad);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addNewKanbanCard() {
|
||||
//Update New Card VueX to use this location
|
||||
this.$store.commit({
|
||||
type: "updateNewCardLocation",
|
||||
columnId: this.columnId,
|
||||
levelId: this.levelId,
|
||||
userCanSelectLocation: false,
|
||||
});
|
||||
|
||||
//Get the Modal from the above modal
|
||||
const modalInstance = new Modal(document.getElementById("addKanbanCardModal"));
|
||||
modalInstance.show();
|
||||
|
||||
//Focus on the card title
|
||||
setTimeout(() => {
|
||||
const focus_element = document.getElementById("kanbanCardText");
|
||||
focus_element.focus();
|
||||
}, 250);
|
||||
},
|
||||
addNewLink() {
|
||||
//Update New Card VueX to use this location
|
||||
this.$store.commit({
|
||||
type: "updateNewCardLocation",
|
||||
columnId: this.columnId,
|
||||
levelId: this.levelId,
|
||||
userCanSelectLocation: false,
|
||||
});
|
||||
|
||||
//Get the Modal from the above modal
|
||||
const modalInstance = new Modal(document.getElementById("newLinkModal"));
|
||||
modalInstance.show();
|
||||
},
|
||||
archiveCards() {
|
||||
//Send the archive destination to state - it will trigger the modal
|
||||
this.$store.commit({
|
||||
type: "updateArchiveDestination",
|
||||
column: this.columnId,
|
||||
level: this.levelId,
|
||||
});
|
||||
},
|
||||
checkCardOrder() {
|
||||
/* Due to an issue - sometimes some of the cards will contain a -1 for the sort order. This sadly
|
||||
throws a spanner into the dragging and dropping functionality. When the board boots up, we will check to
|
||||
make sure the cards are in order. If they are not - we adjust them and upload the changes.
|
||||
|
||||
Checks
|
||||
~~~~~~
|
||||
1. Make sure there are no values under 0
|
||||
2. Make sure the lowest value is 0
|
||||
3. Make sure the highest value is length of the set minus 1.
|
||||
*/
|
||||
|
||||
//Don't worry about it when masterList is empty
|
||||
if (this.masterList.length === 0) {
|
||||
//Escape
|
||||
return;
|
||||
}
|
||||
|
||||
//Get the list of values for sort array
|
||||
const sort_array = this.masterList.map((row) => {
|
||||
return row.kanban_card_sort_number;
|
||||
});
|
||||
|
||||
//Get the min and max
|
||||
const min_value = Math.min.apply(null, sort_array),
|
||||
max_value = Math.max.apply(null, sort_array);
|
||||
|
||||
if (
|
||||
min_value === 0 &&
|
||||
max_value === this.masterList.length - 1
|
||||
) {
|
||||
//Nothing to do :) YAY
|
||||
return;
|
||||
}
|
||||
|
||||
//Show error screen
|
||||
document.getElementById("sort_error").style.display = "flex";
|
||||
|
||||
//Send the new order to the backend
|
||||
const data_to_send = new FormData();
|
||||
|
||||
this.masterList.forEach((row, index) => {
|
||||
//Set the form data
|
||||
data_to_send.append("kanban_cards", row.kanban_card_id);
|
||||
|
||||
//Update the VueX with the new sort ordering
|
||||
this.$store.commit({
|
||||
type: "updateKanbanCard",
|
||||
card_id: row.kanban_card_id,
|
||||
kanban_card_sort_number: index,
|
||||
});
|
||||
});
|
||||
|
||||
this.axios.post(
|
||||
`${this.rootUrl}kanban_information/fix_card_ordering/`,
|
||||
data_to_send,
|
||||
).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Failed to move card",
|
||||
message: `Sorry, we could not move your card. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
|
||||
//Done - hide the error screen
|
||||
document.getElementById("sort_error").style.display = "";
|
||||
},
|
||||
doubleClickCard(event) {
|
||||
//Retrieve the card id from the event
|
||||
const card_id = this.getCardIdFromObject(event.target);
|
||||
|
||||
//Check to make sure we card is not 0
|
||||
if (card_id === 0) return;
|
||||
|
||||
//Filter out the data we want to send up stream
|
||||
const filtered_data = this.masterList.filter((row) => {
|
||||
return parseInt(row.kanban_card_id) === parseInt(card_id);
|
||||
})[0];
|
||||
|
||||
if (filtered_data === undefined) return;
|
||||
|
||||
//Setup data to send upstream
|
||||
this.sendDataUpstream(filtered_data);
|
||||
},
|
||||
getCardIdFromObject(object) {
|
||||
//Recursive function, that checks to see if we can get the card id. If not we look at the parent.
|
||||
//The break points are where the parent is undefined, OR the id === "kanban_container"
|
||||
const card_id = object.dataset.cardId;
|
||||
|
||||
//Got the card id, lets return
|
||||
if (card_id !== undefined) return card_id;
|
||||
|
||||
//Check to make sure we not at the escapte point
|
||||
if (object.id === "kanban_container") return 0;
|
||||
if (object.parentElement === undefined || object.parentElement === null) return 0;
|
||||
|
||||
//Recursive call the function
|
||||
return this.getCardIdFromObject(object.parentElement);
|
||||
},
|
||||
isLinkedObject(object) {
|
||||
let results = "";
|
||||
|
||||
if (object.project !== null && object.project !== undefined) results = "project";
|
||||
if (object.requirement !== null && object.requirement !== undefined) results = "requirement";
|
||||
if (object.requirement_item !== null && object.requirement_item !== undefined) results = "requirement_item";
|
||||
if (object.task !== null && object.task !== undefined) results = "task";
|
||||
|
||||
return results;
|
||||
},
|
||||
async onEnd(event) {
|
||||
//Tell VueX we have moved the card - VueX will handle the logistic. Wait for vuex
|
||||
await this.$store.dispatch("kanbanCardMoved", {
|
||||
event,
|
||||
});
|
||||
|
||||
//Get the y=data
|
||||
const new_elem = event.to,
|
||||
old_elem = event.from,
|
||||
card_id = event.item.dataset.cardId;
|
||||
|
||||
//Setup variables (for shorthand)
|
||||
const new_card_column = new_elem.dataset.column,
|
||||
new_card_level = new_elem.dataset.level,
|
||||
|
||||
old_card_column = old_elem.dataset.column,
|
||||
old_card_level = old_elem.dataset.level,
|
||||
|
||||
column_property = new_elem.dataset.columnProperty;
|
||||
|
||||
//Data to send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("new_card_column", new_card_column);
|
||||
data_to_send.set("new_card_level", new_card_level);
|
||||
|
||||
//Set the new destination
|
||||
this.$store.getters.getCardsOrder(
|
||||
new_card_column,
|
||||
new_card_level
|
||||
).forEach((row) => {
|
||||
data_to_send.append("new_destination", row.kanban_card_id);
|
||||
});
|
||||
|
||||
//Set the old destination
|
||||
this.$store.getters.getCardsOrder(
|
||||
old_card_column,
|
||||
old_card_level
|
||||
).forEach((row) => {
|
||||
data_to_send.append("old_destination", row.kanban_card_id);
|
||||
});
|
||||
|
||||
//Use axios to send the data to the database
|
||||
this.axios.post(
|
||||
`${this.rootUrl}kanban_information/${card_id}/move_card/`,
|
||||
data_to_send
|
||||
).then(() => {
|
||||
if (column_property === "Blocked") {
|
||||
//Tell Axios about the card id
|
||||
this.$store.commit({
|
||||
type: "updateValue",
|
||||
field: "cardId",
|
||||
value: parseInt(card_id),
|
||||
});
|
||||
|
||||
//Open the required modal
|
||||
const modal = new Modal(document.getElementById("blockedNotesModal"));
|
||||
modal.show();
|
||||
}
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Can not update Card",
|
||||
message: `Sorry, moving the card had an error. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
sendDataUpstream(filtered_data) {
|
||||
// Check to make sure this is a linked object
|
||||
const is_link = this.isLinkedObject(filtered_data);
|
||||
if (is_link.length > 0) {
|
||||
//Open a new tab with that linked object
|
||||
const url = `${this.rootUrl}${is_link}_information/${filtered_data[is_link]}/`;
|
||||
|
||||
window.open(
|
||||
url,
|
||||
'_blank'
|
||||
).focus();
|
||||
|
||||
//Just return - nothing else to do
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Update VueX ACTION
|
||||
this.$store.dispatch({
|
||||
type: "updateCard",
|
||||
cardId: filtered_data.kanban_card_id,
|
||||
cardTitle: filtered_data.kanban_card_text,
|
||||
cardDescription:
|
||||
filtered_data.kanban_card_description,
|
||||
cardColumn: filtered_data.kanban_column,
|
||||
cardLevel: filtered_data.kanban_level,
|
||||
cardLink: {},
|
||||
cardPriority: filtered_data.kanban_card_priority,
|
||||
dateCreated: filtered_data.date_created,
|
||||
dateModified: filtered_data.date_modified,
|
||||
});
|
||||
|
||||
//Show the modal
|
||||
const cardInformationModal = new Modal(
|
||||
document.getElementById("cardInformationModal")
|
||||
);
|
||||
cardInformationModal.show();
|
||||
},
|
||||
singleClickCard(data) {
|
||||
//Filter out the data we want to send up stream
|
||||
const filtered_data = this.masterList.filter((row) => {
|
||||
return row.kanban_card_id === data;
|
||||
})[0];
|
||||
|
||||
//Setup data to send upstream
|
||||
this.sendDataUpstream(filtered_data);
|
||||
},
|
||||
useNiceDatetime,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
112
NearBeach/src/js/components/kanban/KanbanDangerZone.vue
Normal file
112
NearBeach/src/js/components/kanban/KanbanDangerZone.vue
Normal file
@@ -0,0 +1,112 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card text-bg-warning">
|
||||
<div class="card-body">
|
||||
<h1>DANGER ZONE</h1>
|
||||
<hr>
|
||||
<div
|
||||
v-if="kanbanBoardStatus === 'Closed'"
|
||||
class="row"
|
||||
>
|
||||
<div class="col-md-4">
|
||||
<h2>Reopen Kanban Board</h2>
|
||||
<p>
|
||||
WARNING - this will reopen the kanban board for everyone to access it.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<button
|
||||
class="btn btn-success"
|
||||
@click="reopenKanban"
|
||||
>
|
||||
Reopen Kanban Board
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="row"
|
||||
>
|
||||
<div class="col-md-4">
|
||||
<h2>Close Kanban Board</h2>
|
||||
<p>
|
||||
WARNING - this will close the kanban board, you will not be able to make any more edits.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<button
|
||||
class="btn btn-danger"
|
||||
@click="closeKanban"
|
||||
>
|
||||
Close Kanban Board
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h2>DELETE Kanban Board</h2>
|
||||
<p>
|
||||
WARNING - this will DELETE the kanban board, this can not be reverted!
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<button
|
||||
class="btn btn-danger"
|
||||
@click="deleteKanban"
|
||||
>
|
||||
Delete Kanban Board!
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<confirm-delete-object></confirm-delete-object>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {Modal} from "bootstrap";
|
||||
|
||||
//Composable
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
|
||||
//Components
|
||||
import ConfirmDeleteObject from "Modules/wizards/ConfirmDeleteObject.vue";
|
||||
|
||||
export default {
|
||||
name: "KanbanDangerZone",
|
||||
components: {
|
||||
ConfirmDeleteObject
|
||||
},
|
||||
props: {
|
||||
kanbanBoardStatus: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
useNBTheme,
|
||||
closeKanban() {
|
||||
const modal = new Modal("#confirmKanbanBoardClosure");
|
||||
modal.show();
|
||||
},
|
||||
deleteKanban() {
|
||||
const modal = new Modal("#confirmDeleteObjectModal");
|
||||
modal.show();
|
||||
},
|
||||
reopenKanban() {
|
||||
const modal = new Modal("#confirmKanbanBoardReopen");
|
||||
modal.show();
|
||||
},
|
||||
},
|
||||
|
||||
}
|
||||
</script>
|
||||
226
NearBeach/src/js/components/kanban/KanbanEditBoard.vue
Normal file
226
NearBeach/src/js/components/kanban/KanbanEditBoard.vue
Normal file
@@ -0,0 +1,226 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1>{{ kanbanBoardResults[0].fields.kanban_board_name }}</h1>
|
||||
<a :href="`${rootUrl}kanban_information/${kanbanBoardResults[0].pk}/`">
|
||||
Go back to kanban board
|
||||
</a>
|
||||
<hr/>
|
||||
|
||||
<!-- Properties for the drag and drop coloumns/levels -->
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h2>Columns & Levels</h2>
|
||||
<p class="text-instructions">
|
||||
Drag the cards around to sort out the columns how you
|
||||
want them.
|
||||
</p>
|
||||
<strong>Rename Columns & Levels</strong>
|
||||
<p class="text-instructions">
|
||||
To rename any level or object, double click on the card.
|
||||
This will bring up the card's properties.
|
||||
</p>
|
||||
<n-switch
|
||||
v-model:value="canDragCards"
|
||||
@update:value="updateCanDragCards"
|
||||
>
|
||||
<template #checked>
|
||||
Can Drag Cards
|
||||
</template>
|
||||
<template #unchecked>
|
||||
Card Position Locked
|
||||
</template>
|
||||
</n-switch>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<kanban-property-order
|
||||
:is-read-only="isReadOnly"
|
||||
:property-list="columnModel"
|
||||
:is-dirty="v$.columnModel.$dirty"
|
||||
:is-new-mode="false"
|
||||
:kanban-board-id="kanbanBoardResults[0].pk"
|
||||
property-name="Column"
|
||||
source="columnModel"
|
||||
@update_property_list="updatePropertyList($event)"
|
||||
></kanban-property-order>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<kanban-property-order
|
||||
:is-read-only="isReadOnly"
|
||||
:property-list="levelModel"
|
||||
:is-dirty="v$.columnModel.$dirty"
|
||||
:is-new-mode="false"
|
||||
:kanban-board-id="kanbanBoardResults[0].pk"
|
||||
property-name="Level"
|
||||
source="levelModel"
|
||||
@update_propety_list="udatePropertyList($event)"
|
||||
></kanban-property-order>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SAVE -->
|
||||
<hr/>
|
||||
<div class="row submit-row">
|
||||
<div class="col-md-12">
|
||||
<button
|
||||
class="btn btn-primary save-changes"
|
||||
@click="backToBoard"
|
||||
>
|
||||
Back to Kanban Board
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {NSwitch} from "naive-ui";
|
||||
|
||||
// Components
|
||||
import KanbanPropertyOrder from "./KanbanPropertyOrder.vue";
|
||||
|
||||
// Validation
|
||||
import useVuelidate from "@vuelidate/core";
|
||||
import {required} from "@vuelidate/validators";
|
||||
|
||||
//Composables
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
|
||||
export default {
|
||||
name: "KanbanEditBoard",
|
||||
components: {
|
||||
KanbanPropertyOrder,
|
||||
NSwitch,
|
||||
},
|
||||
props: {
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
columnResults: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
kanbanBoardResults: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
levelResults: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
locationId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
staticUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
userLevel: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
return {v$: useVuelidate()};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
canDragCards: false,
|
||||
columnModel: [],
|
||||
levelModel: [],
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
columnModel: {
|
||||
required,
|
||||
},
|
||||
levelModel: {
|
||||
required,
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
//Send the location id and destination
|
||||
this.$store.commit({
|
||||
type: "updateDestination",
|
||||
destination: "kanban_board",
|
||||
locationId: this.locationId,
|
||||
});
|
||||
this.$store.commit({
|
||||
type: "updateTitle",
|
||||
title: this.kanbanBoardResults[0].fields.kanban_board_name,
|
||||
})
|
||||
|
||||
//Send the rootURL to the vuex
|
||||
this.$store.commit({
|
||||
type: "updateUrl",
|
||||
rootUrl: this.rootUrl,
|
||||
staticUrl: this.staticUrl,
|
||||
});
|
||||
|
||||
this.$store.commit({
|
||||
type: "updateUserLevel",
|
||||
userLevel: this.userLevel,
|
||||
});
|
||||
|
||||
//Map the variables into a useable format
|
||||
this.columnModel = this.columnResults.map((row) => {
|
||||
return {
|
||||
id: row.pk,
|
||||
property: row.fields.kanban_column_property,
|
||||
title: row.fields.kanban_column_name,
|
||||
};
|
||||
});
|
||||
|
||||
this.levelModel = this.levelResults.map((row) => {
|
||||
return {
|
||||
id: row.pk,
|
||||
property: "",
|
||||
title: row.fields.kanban_level_name,
|
||||
};
|
||||
});
|
||||
|
||||
//Update Can Drag Cards value
|
||||
this.updateCanDragCards(false);
|
||||
},
|
||||
methods: {
|
||||
useNBTheme,
|
||||
backToBoard() {
|
||||
window.location.href = `${this.rootUrl}kanban_information/${this.kanbanBoardResults[0].pk}/`;
|
||||
},
|
||||
updateCanDragCards(value) {
|
||||
this.$store.commit({
|
||||
type: "updateCanDragCards",
|
||||
canDragCards: value,
|
||||
})
|
||||
// this.$store.dispatch({
|
||||
// type: "updateCanDragCards",
|
||||
// canDragCards: value,
|
||||
// });
|
||||
},
|
||||
updatePropertyList(data) {
|
||||
this[data.source] = data.data;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card kanban-group-permissions">
|
||||
<div class="card-body">
|
||||
<!-- Group Permissions -->
|
||||
<groups-and-users-module
|
||||
:is-read-only="isReadOnly"
|
||||
></groups-and-users-module>
|
||||
</div>
|
||||
</div>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//Components
|
||||
import GroupsAndUsersModule from "Modules/sub_modules/GroupsAndUsersModule.vue";
|
||||
|
||||
//Composables
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
|
||||
export default {
|
||||
name: "KanbanGroupPermissions",
|
||||
components: {
|
||||
GroupsAndUsersModule,
|
||||
},
|
||||
props: {
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
methods: {useNBTheme},
|
||||
};
|
||||
</script>
|
||||
544
NearBeach/src/js/components/kanban/KanbanInformation.vue
Normal file
544
NearBeach/src/js/components/kanban/KanbanInformation.vue
Normal file
@@ -0,0 +1,544 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div>
|
||||
<h1 class="kanban-header">
|
||||
<span
|
||||
v-if="kanbanStatus.toLowerCase() === 'closed'"
|
||||
class="kanban-closed"
|
||||
>
|
||||
CLOSED:
|
||||
</span>
|
||||
{{ kanbanBoardResults[0].fields.kanban_board_name }}
|
||||
</h1>
|
||||
<div
|
||||
v-if="canRenderDropdown"
|
||||
class="btn-group kanban-menu"
|
||||
>
|
||||
<button
|
||||
class="btn btn-secondary btn-sm dropdown-toggle"
|
||||
type="button"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
>
|
||||
Kanban Menu
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li v-if="kanbanStatus.toLowerCase() !== 'closed'">
|
||||
<a class="dropdown-item" href="#">
|
||||
<n-switch
|
||||
v-if="kanbanBoardResults[0].fields.kanban_board_status !== 'Closed' && userLevel >= 2"
|
||||
v-model:value="canDragCards"
|
||||
@update:value="updateCanDragCards"
|
||||
>
|
||||
<template #checked>
|
||||
Can Drag Cards
|
||||
</template>
|
||||
<template #unchecked>
|
||||
Card Position Locked
|
||||
</template>
|
||||
</n-switch>
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="kanbanStatus.toLowerCase() !== 'closed'">
|
||||
<hr
|
||||
v-if="userLevel >= 3"
|
||||
class="dropdown-divider"
|
||||
>
|
||||
</li>
|
||||
<li v-if="kanbanStatus.toLowerCase() !== 'closed'">
|
||||
<a
|
||||
class="dropdown-item"
|
||||
href="#"
|
||||
@click="addNewKanbanCard()"
|
||||
>
|
||||
Add New Card
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="kanbanStatus.toLowerCase() !== 'closed'">
|
||||
<a
|
||||
class="dropdown-item"
|
||||
href="#"
|
||||
@click="addNewLink()"
|
||||
>
|
||||
Add New Link to Object
|
||||
</a>
|
||||
</li>
|
||||
<li v-if="kanbanStatus.toLowerCase() !== 'closed'">
|
||||
<hr
|
||||
v-if="userLevel >= 3"
|
||||
class="dropdown-divider"
|
||||
>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
v-if="userLevel >= 3"
|
||||
class="dropdown-item"
|
||||
:href="`${rootUrl}kanban_information/${kanbanBoardResults[0].pk}/edit_board/`"
|
||||
>
|
||||
Edit Kanban
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-else
|
||||
style="height: 31px; width: 100%;"
|
||||
></div>
|
||||
|
||||
<!-- Rendering the Kanban Container -->
|
||||
<kanban-board
|
||||
:kanban-board-results="kanbanBoardResults"
|
||||
:new-card-info="newCardInfo"
|
||||
@double_clicked_card="doubleClickedCard($event)"
|
||||
></kanban-board>
|
||||
|
||||
<!-- MODALS -->
|
||||
<add-user-to-card
|
||||
:location-id="cardId"
|
||||
:refresh-user-list="refreshUserList"
|
||||
destination="kanban_card"
|
||||
@reset_refresh_user_list="resetRefreshUserList"
|
||||
></add-user-to-card>
|
||||
|
||||
<archive-cards></archive-cards>
|
||||
|
||||
<blocked-notes-modal></blocked-notes-modal>
|
||||
|
||||
<confirm-card-archive
|
||||
:card-information="cardInformation"
|
||||
></confirm-card-archive>
|
||||
|
||||
<new-kanban-card
|
||||
:column-results="columnResults"
|
||||
:level-results="levelResults"
|
||||
:kanban-board-results="kanbanBoardResults"
|
||||
@new_card="newCard($event)"
|
||||
></new-kanban-card>
|
||||
|
||||
<card-information
|
||||
:card-information="cardInformation"
|
||||
@update_card="updateCard($event)"
|
||||
></card-information>
|
||||
|
||||
<upload-document-wizard
|
||||
override-destination="kanban_card"
|
||||
:override-location-id="cardId"
|
||||
></upload-document-wizard>
|
||||
|
||||
<edit-history-note-wizard></edit-history-note-wizard>
|
||||
|
||||
<new-history-note-wizard
|
||||
:location-id="cardId"
|
||||
destination="kanban_card"
|
||||
></new-history-note-wizard>
|
||||
|
||||
<confirm-note-delete></confirm-note-delete>
|
||||
|
||||
<add-folder-wizard
|
||||
:location-id="cardId"
|
||||
destination="kanban_card"
|
||||
></add-folder-wizard>
|
||||
|
||||
<add-link-wizard
|
||||
:location-id="cardId"
|
||||
destination="kanban_card"
|
||||
></add-link-wizard>
|
||||
|
||||
<!-- CONFIRM DOCUMENT DELETE -->
|
||||
<confirm-file-delete-vue></confirm-file-delete-vue>
|
||||
<confirm-folder-delete></confirm-folder-delete>
|
||||
|
||||
<!-- CONFIRM PUBLIC LINK DELETE -->
|
||||
<confirm-public-link-delete
|
||||
:override-location-id="cardId"
|
||||
override-destination="kanban_card"
|
||||
></confirm-public-link-delete>
|
||||
|
||||
<new-kanban-link-wizard
|
||||
:location-id="locationId"
|
||||
:column-results="columnResults"
|
||||
:level-results="levelResults"
|
||||
@new_card="newCard($event)"
|
||||
></new-kanban-link-wizard>
|
||||
|
||||
<add-tag-wizard
|
||||
override-destination="kanban_card"
|
||||
reopen-modal="cardInformationModal"
|
||||
:override-location-id="cardId"
|
||||
></add-tag-wizard>
|
||||
</div>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {Modal} from "bootstrap";
|
||||
|
||||
//VueX
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
//Naive UI
|
||||
import {NSwitch} from "naive-ui";
|
||||
|
||||
//Components
|
||||
import UploadDocumentWizard from "Modules/wizards/UploadDocumentWizard.vue";
|
||||
import AddFolderWizard from "Modules/wizards/AddFolderWizard.vue";
|
||||
import AddLinkWizard from "Modules/wizards/AddLinkWizard.vue";
|
||||
import ConfirmFileDeleteVue from "Modules/wizards/ConfirmFileDelete.vue";
|
||||
import ConfirmFolderDelete from "Modules/wizards/ConfirmFolderDelete.vue";
|
||||
import EditHistoryNoteWizard from "Modules/wizards/EditHistoryNoteWizard.vue";
|
||||
import NewHistoryNoteWizard from "Modules/wizards/NewHistoryNoteWizard.vue";
|
||||
import ConfirmNoteDelete from "Modules/wizards/ConfirmNoteDelete.vue";
|
||||
import AddTagWizard from "Modules/wizards/AddTagWizard.vue";
|
||||
import AddUserToCard from "Components/card_information/AddUserToCard.vue";
|
||||
import ArchiveCards from "./ArchiveCards.vue";
|
||||
import BlockedNotesModal from "./BlockedNotesModal.vue";
|
||||
import KanbanBoard from "./KanbanBoard.vue";
|
||||
import NewKanbanCard from "Modules/wizards/NewKanbanCard.vue";
|
||||
import CardInformation from "Components/card_information/CardInformation.vue";
|
||||
import NewKanbanLinkWizard from "Modules/wizards/NewKanbanLinkWizard.vue";
|
||||
import ConfirmCardArchive from "./ConfirmCardArchive.vue";
|
||||
|
||||
//Composables
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
import ConfirmPublicLinkDelete from "Modules/wizards/ConfirmPublicLinkDelete.vue";
|
||||
|
||||
export default {
|
||||
name: "KanbanInformation",
|
||||
components: {
|
||||
ConfirmPublicLinkDelete,
|
||||
AddTagWizard,
|
||||
ConfirmNoteDelete,
|
||||
NewHistoryNoteWizard,
|
||||
EditHistoryNoteWizard,
|
||||
ConfirmFolderDelete,
|
||||
ConfirmFileDeleteVue,
|
||||
AddLinkWizard,
|
||||
AddFolderWizard,
|
||||
UploadDocumentWizard,
|
||||
AddUserToCard,
|
||||
ArchiveCards,
|
||||
BlockedNotesModal,
|
||||
CardInformation,
|
||||
ConfirmCardArchive,
|
||||
KanbanBoard,
|
||||
NewKanbanCard,
|
||||
NewKanbanLinkWizard,
|
||||
NSwitch,
|
||||
},
|
||||
props: {
|
||||
columnResults: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
kanbanBoardResults: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
kanbanCardResults: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
kanbanSettings: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
setting_data: {
|
||||
canDragCards: true,
|
||||
levels: [],
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
levelResults: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
locationId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
openCardOnLoad: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
potentialUserList: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
staticUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
tagResults: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
userExtraPermissions: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
userLevel: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
canDragCards: true,
|
||||
cardInformation: {},
|
||||
kanbanStatus: this.kanbanBoardResults[0].fields.kanban_board_status,
|
||||
localKanbanCardResults: this.kanbanCardResults,
|
||||
refreshUserList: false,
|
||||
newCardInfo: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
cardId: "getCardId",
|
||||
}),
|
||||
canRenderDropdown() {
|
||||
//Condition 1: User has Create or higher permissions
|
||||
const condition1 = this.userLevel >= 3;
|
||||
|
||||
//Conditon 2: User has Edit permissions and board is not closed
|
||||
const condition2 = this.kanbanBoardResults[0].fields.kanban_board_status.toLowerCase() !== 'closed'
|
||||
&& this.userLevel === 2;
|
||||
|
||||
return condition1 || condition2;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
cardId() {
|
||||
this.refreshUserList = true;
|
||||
},
|
||||
},
|
||||
async beforeMount() {
|
||||
await this.$store.dispatch("processThemeUpdate", {
|
||||
theme: this.theme,
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
//Send the settings up stream
|
||||
this.updateKanbanSettings();
|
||||
|
||||
//Map the tags onto "tag_list" field for the kanbanCardResults
|
||||
const kanban_card_results = this.kanbanCardResults.map((row) => {
|
||||
//Add the field
|
||||
row.tag_list = this.tagResults.filter((tag_row) => {
|
||||
return parseInt(tag_row.kanban_card_id) === parseInt(row.kanban_card_id);
|
||||
});
|
||||
|
||||
return row;
|
||||
})
|
||||
|
||||
//Send data to VueX
|
||||
this.$store.commit({
|
||||
type: "initPayload",
|
||||
kanbanCardResults: kanban_card_results,
|
||||
levelResults: this.levelResults,
|
||||
columnResults: this.columnResults,
|
||||
openCardOnLoad: this.openCardOnLoad,
|
||||
});
|
||||
|
||||
//Send the urls upstream
|
||||
this.$store.commit({
|
||||
type: "updateUrl",
|
||||
rootUrl: this.rootUrl,
|
||||
staticUrl: this.staticUrl,
|
||||
});
|
||||
|
||||
this.$store.commit({
|
||||
type: "updateDestination",
|
||||
destination: "kanban_board",
|
||||
locationId: this.locationId,
|
||||
});
|
||||
|
||||
//Send columns and levels into the VueX
|
||||
this.$store.commit({
|
||||
type: "updateLists",
|
||||
columnResults: this.columnResults,
|
||||
levelResults: this.levelResults,
|
||||
});
|
||||
|
||||
//Update the user permissions
|
||||
this.$store.commit({
|
||||
type: "updateUserLevel",
|
||||
userLevel: this.userLevel,
|
||||
});
|
||||
|
||||
//Send extra permissions upstream
|
||||
this.$store.commit({
|
||||
type: "updateUserExtraPermissions",
|
||||
userExtraPermissions: this.userExtraPermissions,
|
||||
});
|
||||
|
||||
//Update groups and users
|
||||
this.$store.commit({
|
||||
type: "updateGroupsAndUsers",
|
||||
potentialUserList: this.potentialUserList,
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
useNBTheme,
|
||||
addNewKanbanCard() {
|
||||
//Update New Card VueX to use this location
|
||||
this.$store.commit({
|
||||
type: "updateNewCardLocation",
|
||||
columnId: this.columnResults[0].pk,
|
||||
levelId: this.levelResults[0].pk,
|
||||
userCanSelectLocation: true,
|
||||
});
|
||||
|
||||
//Get the Modal from the above modal
|
||||
const modalInstance = new Modal(document.getElementById("addKanbanCardModal"));
|
||||
modalInstance.show();
|
||||
|
||||
//Focus on the card title
|
||||
setTimeout(() => {
|
||||
const focus_element = document.getElementById("kanbanCardText");
|
||||
focus_element.focus();
|
||||
}, 250);
|
||||
},
|
||||
addNewLink() {
|
||||
//Update New Card VueX to use this location
|
||||
this.$store.commit({
|
||||
type: "updateNewCardLocation",
|
||||
columnId: this.columnResults[0].pk,
|
||||
levelId: this.levelResults[0].pk,
|
||||
userCanSelectLocation: true,
|
||||
});
|
||||
|
||||
//Get the Modal from the above modal
|
||||
const modalInstance = new Modal(document.getElementById("newLinkModal"));
|
||||
modalInstance.show();
|
||||
},
|
||||
doubleClickedCard(data) {
|
||||
//Update the cardInformationId with the card id
|
||||
this.cardInformation = data;
|
||||
},
|
||||
newCard(data) {
|
||||
//this.newCardInfo = data;
|
||||
|
||||
this.$store.commit({
|
||||
type: "addCard",
|
||||
newCard: data,
|
||||
});
|
||||
},
|
||||
resetRefreshUserList() {
|
||||
this.refreshUserList = false;
|
||||
},
|
||||
updateCanDragCards(value) {
|
||||
// this.$store.commit({
|
||||
// type: "updateCanDragCards",
|
||||
// canDragCards: value,
|
||||
// })
|
||||
this.$store.dispatch({
|
||||
type: "updateCanDragCards",
|
||||
canDragCards: value,
|
||||
});
|
||||
},
|
||||
updateCard(data) {
|
||||
//Loop through the results - when the id's match. Update the data.
|
||||
this.localKanbanCardResults.forEach((row, index) => {
|
||||
//Check to see if the primary keys match - if they do update the data
|
||||
if (row.kanban_card_id === data.kanban_card_id) {
|
||||
this.localKanbanCardResults[
|
||||
index
|
||||
].kanban_card_text = data.kanban_card_text;
|
||||
this.localKanbanCardResults[
|
||||
index
|
||||
].kanban_card_description =
|
||||
data.kanban_card_description;
|
||||
}
|
||||
});
|
||||
},
|
||||
updateKanbanSettings() {
|
||||
//If there are no settings - default to basic structure
|
||||
if (this.kanbanSettings.setting_data === undefined) {
|
||||
//Data is ready to upload
|
||||
this.$store.commit({
|
||||
type: "initKanbanSettings",
|
||||
canDragCards: true,
|
||||
levels: this.levelResults.map((row) => {
|
||||
return {
|
||||
level_id: row.pk,
|
||||
is_collapsed: false,
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Setup the canDrag
|
||||
let can_drag_cards = this.kanbanSettings.setting_data.canDragCards;
|
||||
if (can_drag_cards === undefined) can_drag_cards = true;
|
||||
|
||||
//Update local
|
||||
this.canDragCards = can_drag_cards;
|
||||
|
||||
//Setup the kanban levels collapse
|
||||
let levels = this.kanbanSettings.setting_data.levels;
|
||||
if (levels === undefined) levels = [];
|
||||
|
||||
//Check to see if we are missing any levels
|
||||
const level_id_array = levels.map(row => {
|
||||
return row.level_id
|
||||
});
|
||||
const missing_levels = this.levelResults.filter((row) => {
|
||||
//Find those that don't exist in level results
|
||||
return level_id_array.indexOf(row.pk) === -1;
|
||||
})
|
||||
|
||||
//Loop through the missing levels and add them to levels
|
||||
missing_levels.forEach((row) => {
|
||||
levels.push({
|
||||
level_id: row.pk,
|
||||
is_collapsed: false,
|
||||
});
|
||||
});
|
||||
|
||||
//Remove any levels that no longer exist
|
||||
const all_levels_array = this.levelResults.map((row) => {
|
||||
return row.pk;
|
||||
});
|
||||
levels = levels.filter((row) => {
|
||||
return all_levels_array.indexOf(row.level_id) >= 0;
|
||||
})
|
||||
|
||||
|
||||
//Data is ready to upload
|
||||
this.$store.commit({
|
||||
type: "initKanbanSettings",
|
||||
canDragCards: can_drag_cards,
|
||||
levels,
|
||||
})
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
615
NearBeach/src/js/components/kanban/KanbanPropertyOrder.vue
Normal file
615
NearBeach/src/js/components/kanban/KanbanPropertyOrder.vue
Normal file
@@ -0,0 +1,615 @@
|
||||
<template>
|
||||
<strong>{{ propertyName }}</strong>
|
||||
<span
|
||||
v-if="!v$.localPropertyList.required && isDirty"
|
||||
class="error"
|
||||
>
|
||||
Please create at least one {{ propertyName }}.</span
|
||||
>
|
||||
|
||||
<!-- The column of data where you can sort the properties -->
|
||||
<draggable
|
||||
v-model="localPropertyList"
|
||||
:disabled="!canDragCards || isReadOnly"
|
||||
item-key="pk"
|
||||
ghost-class="ghost"
|
||||
class="kanban-property-order"
|
||||
@change="sendPropertyListUp"
|
||||
>
|
||||
<template
|
||||
#item="{ element }"
|
||||
type="transition"
|
||||
name="flip-list"
|
||||
>
|
||||
<div
|
||||
:id="element.id"
|
||||
:key="element.id"
|
||||
class="sortable"
|
||||
:data-property="element.property"
|
||||
:data-id="element.id"
|
||||
:data-title="element.title"
|
||||
@dblclick="editItem($event)"
|
||||
>
|
||||
<div
|
||||
:id="element.id"
|
||||
:key="element.id"
|
||||
class="content"
|
||||
:data-id="element.id"
|
||||
:data-property="element.property"
|
||||
:data-title="element.title"
|
||||
>
|
||||
<strong
|
||||
:id="element.id"
|
||||
:key="element.id"
|
||||
:data-id="element.id"
|
||||
:data-property="element.property"
|
||||
:data-title="element.title"
|
||||
>
|
||||
{{ element.title }}
|
||||
</strong>
|
||||
<span
|
||||
v-if="!canDragCards"
|
||||
:id="element.id"
|
||||
:data-id="element.id"
|
||||
:data-property="element.property"
|
||||
:data-title="element.title"
|
||||
style="font-weight: lighter"
|
||||
> - Movement Locked!</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="localPropertyList.length > 1"
|
||||
class="icon"
|
||||
@click="removeItem(element.id)"
|
||||
>
|
||||
<carbon-close-outline></carbon-close-outline>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</draggable>
|
||||
|
||||
<!-- ADD BUTTON -->
|
||||
<button
|
||||
v-if="isReadOnly===false"
|
||||
class="btn btn-primary"
|
||||
@click="openModal"
|
||||
>
|
||||
Add {{ propertyName }} Item
|
||||
</button>
|
||||
|
||||
<!-- MODAL FOR ADDING AN EXTRA ROW -->
|
||||
<div
|
||||
:id="`addItem${propertyName}`"
|
||||
class="modal fade"
|
||||
tabindex="-1"
|
||||
aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5
|
||||
id="exampleModalLabel"
|
||||
class="modal-title"
|
||||
>
|
||||
Add/Edit {{ propertyName }}
|
||||
</h5>
|
||||
<button
|
||||
:id="`addItemClose${propertyName}`"
|
||||
type="button"
|
||||
class="btn-close"
|
||||
data-bs-dismiss="modal"
|
||||
aria-label="Close"
|
||||
></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label>{{ propertyName }} Item Description</label>
|
||||
<input
|
||||
v-model="newPropertyItem"
|
||||
type="text"
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="propertyName.toLowerCase() === 'column'"
|
||||
class="form-group"
|
||||
>
|
||||
<label>{{ propertyName }} Property</label>
|
||||
<n-select
|
||||
v-model:value="columnPropertyModel"
|
||||
:options="columnPropertyOptions"
|
||||
/>
|
||||
</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="addItem"
|
||||
>
|
||||
Save changes
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MODAL FOR DELETING ITEM -->
|
||||
<div
|
||||
:id="`deleteItem${propertyName}`"
|
||||
class="modal fade"
|
||||
tabindex="-1"
|
||||
aria-labelledby="exampleModalLabel"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Delete {{ propertyName }}</h5>
|
||||
<button
|
||||
:id="`deleteItemClose${propertyName}`"
|
||||
type="button"
|
||||
class="btn-close"
|
||||
data-bs-dismiss="modal"
|
||||
aria-label="Close"
|
||||
></button>
|
||||
</div>
|
||||
<div class="modal-body pb-4">
|
||||
<!-- WARNING -->
|
||||
<div class="alert alert-warning">
|
||||
<h4>WARNING</h4>
|
||||
<p>
|
||||
This process can not be reversed. Deleting a
|
||||
{{ propertyName }} will remove it.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
All existing cards will be moved to the stated
|
||||
location you have provided. Any cards that have
|
||||
been archived or deleted, will still be
|
||||
associated with the removed card.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- ASK USER ABOUT CARDS -->
|
||||
<div class="row">
|
||||
<p>Would you like to remove the cards within the {{ propertyName }}?</p>
|
||||
<n-radio-group v-model:value="removeCardsModel" name="radiogroup">
|
||||
<n-space>
|
||||
<n-radio
|
||||
:value="true"
|
||||
label="Yes - please remove cards"
|
||||
/>
|
||||
<n-radio
|
||||
:value="false"
|
||||
label="No - please MOVE cards"
|
||||
/>
|
||||
</n-space>
|
||||
</n-radio-group>
|
||||
</div>
|
||||
|
||||
<!-- CARD DESTINATIONS -->
|
||||
<div class="spacer"></div>
|
||||
<div
|
||||
v-if="!removeCardsModel"
|
||||
class="row"
|
||||
>
|
||||
<p>Please select an appropriate destination for the current cards.</p>
|
||||
<label
|
||||
><strong>Destination for Cards</strong></label
|
||||
>
|
||||
<n-select
|
||||
v-model:value="destinationItemId"
|
||||
:options="newCardDestinationList"
|
||||
style="z-index: 9999"
|
||||
class="new-card-destination"
|
||||
></n-select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-secondary"
|
||||
data-bs-dismiss="modal"
|
||||
>
|
||||
Close
|
||||
</button>
|
||||
<button
|
||||
v-if="isReadOnly===false"
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
:disabled="destinationItemId == null"
|
||||
@click="deleteItem"
|
||||
>
|
||||
Delete {{ propertyName }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {Modal} from "bootstrap";
|
||||
import {NSelect, NRadioGroup, NRadio, NSpace} from "naive-ui";
|
||||
import draggable from "vuedraggable";
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
//Validation
|
||||
import useVuelidate from "@vuelidate/core";
|
||||
import {required} from "@vuelidate/validators";
|
||||
|
||||
import {CarbonCloseOutline} from "../../components";
|
||||
|
||||
export default {
|
||||
name: "KanbanPropertyOrder",
|
||||
components: {
|
||||
CarbonCloseOutline,
|
||||
draggable,
|
||||
NRadio,
|
||||
NRadioGroup,
|
||||
NSelect,
|
||||
NSpace,
|
||||
},
|
||||
props: {
|
||||
isDirty: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
}, //Passes the value from the template above where the checking is done
|
||||
isNewMode: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
kanbanBoardId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
propertyList: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
propertyName: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
source: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
emits: [
|
||||
"update_property_list",
|
||||
],
|
||||
setup() {
|
||||
return {v$: useVuelidate()};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
columnPropertyModel: "Normal",
|
||||
columnPropertyOptions: [
|
||||
{
|
||||
label: "Backlog",
|
||||
value: "Backlog",
|
||||
},
|
||||
{
|
||||
label: "Normal",
|
||||
value: "Normal",
|
||||
},
|
||||
{
|
||||
label: "Blocked",
|
||||
value: "Blocked",
|
||||
},
|
||||
{
|
||||
label: "Closed",
|
||||
value: "Closed",
|
||||
},
|
||||
],
|
||||
deleteItemId: "",
|
||||
destinationItemId: "",
|
||||
localPropertyList: this.propertyList,
|
||||
newCardDestinationList: [],
|
||||
newPropertyItem: "",
|
||||
removeCardsModel: false,
|
||||
singleItemId: "",
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
localPropertyList: {
|
||||
required,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
canDragCards: "getCanDragCards",
|
||||
rootUrl: "getRootUrl",
|
||||
}),
|
||||
},
|
||||
watch: {
|
||||
propertyList() {
|
||||
this.localPropertyList = this.propertyList;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
addItem() {
|
||||
//Check to make sure it isn't blank
|
||||
if (this.newPropertyItem === "") {
|
||||
return;
|
||||
}
|
||||
|
||||
//Depending on the mode (New or Edit) - depends which function we are using
|
||||
if (this.isNewMode) {
|
||||
this.newModeAddItem();
|
||||
} else {
|
||||
this.editModeAddItem();
|
||||
}
|
||||
|
||||
//Push changes upstream
|
||||
this.sendPropertyListUp();
|
||||
|
||||
//Close the modal
|
||||
document.getElementById(
|
||||
`addItemClose${this.propertyName}`
|
||||
).click();
|
||||
},
|
||||
deleteItem() {
|
||||
//Construct the data_to_send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set("delete_item_id", this.deleteItemId);
|
||||
|
||||
//Only have the destination if remove cards model is false
|
||||
if (!this.removeCardsModel) {
|
||||
data_to_send.set("destination_item_id", this.destinationItemId);
|
||||
}
|
||||
|
||||
// URL
|
||||
const url = `${this.rootUrl}kanban_${this.propertyName.toLowerCase()}/${this.kanbanBoardId}/delete/`;
|
||||
|
||||
//Use axios to send data to backend
|
||||
this.axios.post(
|
||||
url,
|
||||
data_to_send
|
||||
).then(() => {
|
||||
//Filter out the id we want to remove
|
||||
this.localPropertyList = this.localPropertyList.filter(
|
||||
(row) => {
|
||||
//Filter out the id we don't want
|
||||
return row.id !== this.deleteItemId;
|
||||
}
|
||||
);
|
||||
|
||||
//Send the data upstream
|
||||
this.$emit("update_property_list", {
|
||||
source: this.source,
|
||||
data: this.localPropertyList,
|
||||
});
|
||||
|
||||
//Close the dialog
|
||||
document.getElementById(
|
||||
`deleteItemClose${this.propertyName}`
|
||||
).click();
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Can not delete item",
|
||||
message: `Sorry, but we are having issues deleting item - Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
editItem(event) {
|
||||
//If read only - ignore
|
||||
if (this.isReadOnly) return;
|
||||
|
||||
//Get the id and title from the item
|
||||
this.newPropertyItem = event.target.dataset.title;
|
||||
this.singleItemId = event.target.dataset.id;
|
||||
this.columnPropertyModel = event.target.dataset.property;
|
||||
|
||||
//Open up the modal
|
||||
this.openModal();
|
||||
},
|
||||
async editModeAddItem() {
|
||||
// Create variable names
|
||||
const name = `kanban_${this.propertyName.toLowerCase()}_name`,
|
||||
sort_number = `kanban_${this.propertyName.toLowerCase()}_sort_number`,
|
||||
single_item_id = this.singleItemId;
|
||||
|
||||
// Create the data_to_send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set(name, this.newPropertyItem);
|
||||
data_to_send.set(sort_number, this.getMaxId() + 1);
|
||||
|
||||
//If property name is a column, we add in the column properties as data to send
|
||||
if (this.propertyName === "Column") {
|
||||
data_to_send.set(
|
||||
"kanban_column_property",
|
||||
this.columnPropertyModel
|
||||
);
|
||||
}
|
||||
|
||||
// Check to see if we are editing an existing item, or adding
|
||||
let url = "";
|
||||
if (single_item_id === "") {
|
||||
//Get the url
|
||||
url = `/kanban_${this.propertyName.toLowerCase()}/${this.kanbanBoardId}/new/`;
|
||||
} else {
|
||||
//Get the url
|
||||
url = `/kanban_${this.propertyName.toLowerCase()}/${this.singleItemId}/edit/`;
|
||||
}
|
||||
|
||||
// Send data
|
||||
await this.axios.post(
|
||||
url,
|
||||
data_to_send
|
||||
).then((response) => {
|
||||
//Data
|
||||
const data = response.data[0];
|
||||
|
||||
//Add as a new item
|
||||
if (single_item_id === "") {
|
||||
//Add as a new item
|
||||
this.localPropertyList.push({
|
||||
id: data.pk,
|
||||
property: data.fields.kanban_column_property,
|
||||
title: data.fields[name],
|
||||
});
|
||||
} else {
|
||||
//Item already exists - edit the item.
|
||||
this.localPropertyList.forEach((row) => {
|
||||
//If the id is the same - update the values
|
||||
if (parseInt(row.id) === parseInt(this.singleItemId)) {
|
||||
row.title = this.newPropertyItem;
|
||||
row.property = this.columnPropertyModel;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Reset variables now we are finished
|
||||
this.singleItemId = "";
|
||||
this.newPropertyItem = "";
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Can not add/edit",
|
||||
message: `Sorry, but we are having issues editing or adding - Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
getMaxId() {
|
||||
//Lets use some math trickery
|
||||
const ids = this.localPropertyList.map(
|
||||
(property) => property.id
|
||||
);
|
||||
|
||||
//Now lets sort from smallest to largest
|
||||
const sorted = ids.sort((a, b) => a - b);
|
||||
|
||||
//Return the last array
|
||||
return sorted[ids.length - 1];
|
||||
},
|
||||
newModeAddItem(/*var*/) {
|
||||
//NEW MODE -> we are creating a NEW kanban board
|
||||
//Depending if there is an ID associated with this depends if we are actually adding an extra item or
|
||||
//editing an already existing one.
|
||||
if (this.singleItemId === "") {
|
||||
//Add as a new item
|
||||
this.localPropertyList.push({
|
||||
id: this.getMaxId() + 1,
|
||||
property: this.columnPropertyModel,
|
||||
title: this.newPropertyItem,
|
||||
});
|
||||
} else {
|
||||
//Item already exists - edit the item.
|
||||
this.localPropertyList.forEach((row) => {
|
||||
//If the id is the same - update the values
|
||||
if (parseInt(row.id) === parseInt(this.singleItemId)) {
|
||||
row.title = this.newPropertyItem;
|
||||
row.property = this.columnPropertyModel;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Reset variables
|
||||
this.singleItemId = "";
|
||||
this.newPropertyItem = "";
|
||||
},
|
||||
openModal() {
|
||||
const newItemModal = new Modal(
|
||||
document.getElementById(`addItem${this.propertyName}`)
|
||||
);
|
||||
newItemModal.show();
|
||||
},
|
||||
removeItem(id) {
|
||||
if (this.isNewMode) {
|
||||
//Filter out the id we want to remove
|
||||
this.localPropertyList = this.localPropertyList.filter(
|
||||
(row) => {
|
||||
//Filter out the id we don't want
|
||||
return row.id !== id;
|
||||
}
|
||||
);
|
||||
|
||||
//Send the data upstream
|
||||
this.sendPropertyListUp();
|
||||
} else {
|
||||
//Store the id to delete
|
||||
this.deleteItemId = id;
|
||||
|
||||
//Create an array of potential destinations for the cards
|
||||
this.newCardDestinationList = this.localPropertyList
|
||||
.filter((row) => {
|
||||
return row.id !== this.deleteItemId;
|
||||
})
|
||||
.map((row) => {
|
||||
return {
|
||||
value: row.id,
|
||||
label: row.title,
|
||||
};
|
||||
});
|
||||
|
||||
//Pick the first option by default
|
||||
this.destinationItemId =
|
||||
this.newCardDestinationList[0].value;
|
||||
|
||||
//Show the delete modal
|
||||
const deleteItemModal = new Modal(
|
||||
document.getElementById(
|
||||
`deleteItem${this.propertyName}`
|
||||
)
|
||||
);
|
||||
deleteItemModal.show();
|
||||
}
|
||||
},
|
||||
sendPropertyListUp() {
|
||||
this.$emit("update_property_list", {
|
||||
source: this.source,
|
||||
data: this.localPropertyList,
|
||||
});
|
||||
|
||||
if (!this.isNewMode) {
|
||||
//Use is in Edit mode - send the data to the backend
|
||||
// Check to see if we are editing an existing item, or adding
|
||||
const url = `/kanban_${this.propertyName.toLowerCase()}/${
|
||||
this.kanbanBoardId
|
||||
}/resort/`;
|
||||
|
||||
//Create data_to_send
|
||||
const data_to_send = new FormData();
|
||||
|
||||
// Insert a new row for each group list item
|
||||
this.localPropertyList.forEach((row) => {
|
||||
data_to_send.append("item", row.id);
|
||||
});
|
||||
|
||||
this.axios.post(
|
||||
url,
|
||||
data_to_send
|
||||
).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Can not apply resort",
|
||||
message: `Sorry, we've had an issue resorting. Please refresh the page. Error -> ${error}`,
|
||||
extra_classes: "bg-danger",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
43
NearBeach/src/js/components/kanban/KanbanPublicLinks.vue
Normal file
43
NearBeach/src/js/components/kanban/KanbanPublicLinks.vue
Normal file
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<list-public-links
|
||||
:is-read-only="isReadOnly"
|
||||
override-destination="kanban_board"
|
||||
:override-location-id="locationId"
|
||||
></list-public-links>
|
||||
</div>
|
||||
</div>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//Component
|
||||
import ListPublicLinks from "Modules/sub_modules/ListPublicLinks.vue"
|
||||
|
||||
//Composables
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
|
||||
export default {
|
||||
name: "KanbanPublicLinks",
|
||||
components: {
|
||||
ListPublicLinks,
|
||||
},
|
||||
props: {
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
locationId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
methods: {useNBTheme},
|
||||
}
|
||||
</script>
|
||||
74
NearBeach/src/js/components/kanban/KanbanRow.vue
Normal file
74
NearBeach/src/js/components/kanban/KanbanRow.vue
Normal file
@@ -0,0 +1,74 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="userLevel > 1"
|
||||
class="kanban-row"
|
||||
>
|
||||
<!-- Users can edit kanban board - can drag -->
|
||||
<kanban-column-draggable
|
||||
v-for="column in columnResults"
|
||||
:key="column.pk"
|
||||
:level-id="levelId"
|
||||
:column-id="column.pk"
|
||||
:column-property="column.fields.kanban_column_property"
|
||||
:new-card-info="newCardInfo"
|
||||
@double_clicked_card="doubleClickedCard($event)"
|
||||
></kanban-column-draggable>
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="kanban-row"
|
||||
>
|
||||
<!-- Read Only Users -->
|
||||
<kanban-column
|
||||
v-for="column in columnResults"
|
||||
:key="column.pk"
|
||||
:level-id="levelId"
|
||||
:column-id="column.pk"
|
||||
:new-card-info="newCardInfo"
|
||||
@double_clicked_card="doubleClickedCard($event)"
|
||||
></kanban-column>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapGetters} from "vuex";
|
||||
import KanbanColumn from "./KanbanColumn.vue";
|
||||
import KanbanColumnDraggable from "./KanbanColumnDraggable.vue";
|
||||
|
||||
export default {
|
||||
name: "KanbanRow",
|
||||
components: {
|
||||
KanbanColumn,
|
||||
KanbanColumnDraggable,
|
||||
},
|
||||
props: {
|
||||
levelId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
newCardInfo: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
emits: [
|
||||
'double_clicked_card',
|
||||
],
|
||||
computed: {
|
||||
...mapGetters({
|
||||
columnResults: "getColumnResults",
|
||||
userLevel: "getUserLevel",
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
doubleClickedCard(data) {
|
||||
//Emit the card id up stream
|
||||
this.$emit("double_clicked_card", data);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
357
NearBeach/src/js/components/kanban/NewKanban.vue
Normal file
357
NearBeach/src/js/components/kanban/NewKanban.vue
Normal file
@@ -0,0 +1,357 @@
|
||||
<template>
|
||||
<n-config-provider :theme="useNBTheme(theme)">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1>New Kanban</h1>
|
||||
<hr/>
|
||||
|
||||
<div class="row">
|
||||
<!-- DESCRIPTION -->
|
||||
<div class="col-md-4">
|
||||
<strong>Please note</strong>
|
||||
<p class="text-instructions">Board names must be unique.</p>
|
||||
</div>
|
||||
|
||||
<!-- BOARD NAME -->
|
||||
<div class="col-md-8">
|
||||
<div class="form-group">
|
||||
<label
|
||||
>Kanban Board Name
|
||||
<validation-rendering
|
||||
:error-list="v$.kanbanBoardNameModel.$errors"
|
||||
></validation-rendering>
|
||||
<span
|
||||
v-if="!uniqueKanbanBoardName"
|
||||
class="error"
|
||||
>
|
||||
Please supply a unique name</span
|
||||
>
|
||||
<span
|
||||
v-if="checkingKanbanBoardName"
|
||||
class="error"
|
||||
>
|
||||
Checking kanban name...</span
|
||||
>
|
||||
</label>
|
||||
<input
|
||||
v-model="kanbanBoardNameModel"
|
||||
type="text"
|
||||
class="form-control"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
|
||||
<!-- Properties for the drag and drop coloumns/levels -->
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h2>Columns & Levels</h2>
|
||||
<p class="text-instructions">
|
||||
Drag the cards around to sort out the columns how you
|
||||
want them.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<kanban-property-order
|
||||
:property-list="columnModel"
|
||||
:is-dirty="v$.columnModel.$dirty"
|
||||
property-name="Column"
|
||||
source="columnModel"
|
||||
@update_property_list="updatePropertyList($event)"
|
||||
></kanban-property-order>
|
||||
</div>
|
||||
<div class="d-block d-md-none d-lg-none d-xl-none d-xxl-none mt-3">
|
||||
<hr />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<kanban-property-order
|
||||
:property-list="levelModel"
|
||||
:is-dirty="v$.columnModel.$dirty"
|
||||
property-name="Level"
|
||||
source="levelModel"
|
||||
@update_property_list="updatePropertyList($event)"
|
||||
></kanban-property-order>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Group Permissions -->
|
||||
<hr/>
|
||||
<group-permissions
|
||||
:display-group-permission-issue="displayGroupPermissionIssue"
|
||||
:group-results="groupResults"
|
||||
:user-group-permissions="userGroupPermissions"
|
||||
:is-dirty="v$.groupModel.$dirty"
|
||||
destination="kanban_board"
|
||||
@update_group_model="updateGroupModel($event)"
|
||||
></group-permissions>
|
||||
|
||||
<!-- SAVE -->
|
||||
<hr/>
|
||||
<div class="row submit-row">
|
||||
<div class="col-md-12">
|
||||
<button
|
||||
class="btn btn-primary save-changes"
|
||||
:disabled="disableSubmitButton"
|
||||
@click="addNewKanban"
|
||||
>
|
||||
Add Kanban
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</n-config-provider>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import KanbanPropertyOrder from "./KanbanPropertyOrder.vue";
|
||||
import GroupPermissions from "Components/permissions/GroupPermissions.vue";
|
||||
|
||||
// Validation
|
||||
import useVuelidate from "@vuelidate/core";
|
||||
import {required} from "@vuelidate/validators";
|
||||
import ValidationRendering from "Components/validation/ValidationRendering.vue";
|
||||
|
||||
//Composables
|
||||
import {useNBTheme} from "Composables/theme/useNBTheme";
|
||||
|
||||
export default {
|
||||
name: "NewKanban",
|
||||
components: {
|
||||
GroupPermissions,
|
||||
KanbanPropertyOrder,
|
||||
ValidationRendering,
|
||||
},
|
||||
props: {
|
||||
groupResults: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
rootUrl: {
|
||||
type: String,
|
||||
default: "/",
|
||||
},
|
||||
theme: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
userGroupPermissions: {
|
||||
type: Array,
|
||||
default: () => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
return {v$: useVuelidate()};
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
checkingKanbanBoardName: false,
|
||||
columnModel: [
|
||||
{
|
||||
id: 0,
|
||||
property: "Normal",
|
||||
title: "Backlog",
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
property: "Blocked",
|
||||
title: "Blocked",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
property: "Normal",
|
||||
title: "In Progress",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
property: "Normal",
|
||||
title: "Review and QA",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
property: "Closed",
|
||||
title: "Completed",
|
||||
},
|
||||
],
|
||||
disableSubmitButton: false,
|
||||
displayGroupPermissionIssue: false,
|
||||
groupModel: [],
|
||||
kanbanBoardNameModel: "",
|
||||
levelModel: [
|
||||
{
|
||||
id: 0,
|
||||
title: "Sprint 1",
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
title: "Sprint 2",
|
||||
},
|
||||
],
|
||||
searchTimeout: "",
|
||||
uniqueKanbanBoardName: true,
|
||||
};
|
||||
},
|
||||
validations: {
|
||||
columnModel: {
|
||||
required,
|
||||
},
|
||||
groupModel: {
|
||||
required,
|
||||
},
|
||||
kanbanBoardNameModel: {
|
||||
required,
|
||||
},
|
||||
levelModel: {
|
||||
required,
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
kanbanBoardNameModel() {
|
||||
//Apply checking flag
|
||||
this.checkingKanbanBoardName = true;
|
||||
|
||||
//Reset the timer if it exists
|
||||
if (this.searchTimeout !== "") {
|
||||
//Stop the clock!
|
||||
clearTimeout(this.searchTimeout);
|
||||
}
|
||||
|
||||
// If the obj.search is defined, we want to use the search Defined. Otherwise search undefined
|
||||
if (this.kanbanBoardNameModel === undefined) {
|
||||
// Reset the clock, to only search if there is an uninterupted 0.5s of no typing.
|
||||
this.searchTimeout = setTimeout(
|
||||
this.checkKanbanBoardName,
|
||||
500
|
||||
);
|
||||
} else {
|
||||
// Reset the clock, to only search if there is an uninterupted 0.5s of no typing.
|
||||
if (this.kanbanBoardNameModel.length >= 3) {
|
||||
this.searchTimeout = setTimeout(
|
||||
this.checkKanbanBoardName,
|
||||
500,
|
||||
this.kanbanBoardNameModel,
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
useNBTheme,
|
||||
addNewKanban() {
|
||||
//Check form validation
|
||||
this.v$.$touch();
|
||||
|
||||
if (
|
||||
this.v$.$invalid ||
|
||||
!this.uniqueKanbanBoardName ||
|
||||
this.checkingKanbanBoardName ||
|
||||
this.displayGroupPermissionIssue
|
||||
) {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Please check validation",
|
||||
message: "Sorry, but can you please fix all validation issues.",
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
});
|
||||
|
||||
//Just return - as we do not need to do the rest of this function
|
||||
return;
|
||||
}
|
||||
|
||||
//Disable submit button
|
||||
this.disableSubmitButton = true;
|
||||
|
||||
//Create the data_to_send
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set(
|
||||
"kanban_board_name",
|
||||
this.kanbanBoardNameModel
|
||||
);
|
||||
|
||||
//Loop through all the column models
|
||||
this.columnModel.forEach((column) => {
|
||||
data_to_send.append("column_title", column.title);
|
||||
data_to_send.append("column_property", column.property);
|
||||
});
|
||||
|
||||
this.levelModel.forEach((level) => {
|
||||
data_to_send.append("level_title", level.title);
|
||||
});
|
||||
|
||||
this.groupModel.forEach((single_group) => {
|
||||
data_to_send.append("group_list", single_group);
|
||||
});
|
||||
|
||||
//Use axios to send the data
|
||||
this.axios.post(
|
||||
`${this.rootUrl}new_kanban_save/`,
|
||||
data_to_send
|
||||
).then((response) => {
|
||||
//Go to that webpage
|
||||
window.location.href = response.data;
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Issue Creating new Kanban board",
|
||||
message: `Issues creating new kanban board -> Error ${error}`,
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
});
|
||||
|
||||
this.disableSubmitButton = false;
|
||||
});
|
||||
},
|
||||
checkKanbanBoardName() {
|
||||
//Send the Kanban board name to the backend - it will send back the results.
|
||||
const data_to_send = new FormData();
|
||||
data_to_send.set(
|
||||
"kanban_board_name",
|
||||
this.kanbanBoardNameModel
|
||||
);
|
||||
|
||||
//Use axios to query the database
|
||||
this.axios.post(
|
||||
`${this.rootUrl}kanban_information/check_kanban_board_name/`,
|
||||
data_to_send
|
||||
).then((response) => {
|
||||
//If the data came back empty - then the kanban board name is unique
|
||||
this.uniqueKanbanBoardName = response.data.length === 0;
|
||||
|
||||
//Checking kanban board name is finished
|
||||
this.checkingKanbanBoardName = false;
|
||||
}).catch((error) => {
|
||||
this.$store.dispatch("newToast", {
|
||||
header: "Issue checking Kanban board name",
|
||||
message: `Issues checking kanban board name -> Error ${error}`,
|
||||
extra_classes: "bg-warning text-dark",
|
||||
delay: 0,
|
||||
});
|
||||
});
|
||||
},
|
||||
updateGroupModel(data) {
|
||||
this.groupModel = data;
|
||||
|
||||
//Calculate to see if the user's groups exist in the groupModel AND
|
||||
//Make sure the user has ENOUGH permissions.
|
||||
this.displayGroupPermissionIssue = this.userGroupPermissions.filter(row => {
|
||||
//Condition 1 - group model includes current group
|
||||
//Condition 2 - user has create permissions on group
|
||||
const condition_1 = this.groupModel.includes(row.group_id);
|
||||
const condition_2 = row.object_permission_value >= 3;
|
||||
|
||||
return condition_1 && condition_2;
|
||||
}).length === 0;
|
||||
},
|
||||
updatePropertyList(data) {
|
||||
this[data.source] = data.data;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
497
NearBeach/src/js/components/modules/ParentModules.vue
Normal file
497
NearBeach/src/js/components/modules/ParentModules.vue
Normal 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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
|
||||
202
NearBeach/src/js/components/modules/sub_modules/BugsModule.vue
Normal file
202
NearBeach/src/js/components/modules/sub_modules/BugsModule.vue
Normal 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>
|
||||
|
||||
|
||||
113
NearBeach/src/js/components/modules/sub_modules/ChildSprints.vue
Normal file
113
NearBeach/src/js/components/modules/sub_modules/ChildSprints.vue
Normal 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>
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
162
NearBeach/src/js/components/modules/sub_modules/ListNotes.vue
Normal file
162
NearBeach/src/js/components/modules/sub_modules/ListNotes.vue
Normal 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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
242
NearBeach/src/js/components/modules/sub_modules/ObjectLinks.vue
Normal file
242
NearBeach/src/js/components/modules/sub_modules/ObjectLinks.vue
Normal 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>
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user