IO-3020 IO-3036 Remove date restriction and lock down feature based reports.
This commit is contained in:
@@ -8,6 +8,7 @@ import { selectPrintCenter } from "../../redux/modals/modals.selectors";
|
|||||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||||
|
import LockWrapperComponent from "../lock-wrapper/lock-wrapper.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
printCenterModal: selectPrintCenter,
|
printCenterModal: selectPrintCenter,
|
||||||
@@ -42,7 +43,12 @@ export function PrintCenterItemComponent({
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (disabled) return <li className="print-center-item">{item.title} </li>;
|
if (disabled || item.featureNameRestricted)
|
||||||
|
return (
|
||||||
|
<li className="print-center-item">
|
||||||
|
<LockWrapperComponent featureName={item.featureNameRestricted}>{item.title}</LockWrapperComponent>
|
||||||
|
</li>
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<li>
|
<li>
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component";
|
|||||||
import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component";
|
import VendorSearchSelect from "../vendor-search-select/vendor-search-select.component";
|
||||||
import ReportCenterModalFiltersSortersComponent from "./report-center-modal-filters-sorters-component";
|
import ReportCenterModalFiltersSortersComponent from "./report-center-modal-filters-sorters-component";
|
||||||
import "./report-center-modal.styles.scss";
|
import "./report-center-modal.styles.scss";
|
||||||
|
import LockWrapperComponent from "../lock-wrapper/lock-wrapper.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
reportCenterModal: selectReportCenter,
|
reportCenterModal: selectReportCenter,
|
||||||
@@ -185,13 +186,23 @@ export function ReportCenterModalComponent({ reportCenterModal, bodyshop }) {
|
|||||||
</BlurWrapperComponent>
|
</BlurWrapperComponent>
|
||||||
) : (
|
) : (
|
||||||
<ul style={{ listStyleType: "none", columns: "2 auto" }}>
|
<ul style={{ listStyleType: "none", columns: "2 auto" }}>
|
||||||
{grouped[key].map((item) => (
|
{grouped[key].map((item) =>
|
||||||
<li key={item.key}>
|
item.featureNameRestricted ? (
|
||||||
<Radio key={item.key} value={item.key}>
|
<li key={item.key}>
|
||||||
{item.title}
|
<LockWrapperComponent featureName={item.featureNameRestricted}>
|
||||||
</Radio>
|
<Radio key={item.key} value={item.key}>
|
||||||
</li>
|
{item.title}
|
||||||
))}
|
</Radio>
|
||||||
|
</LockWrapperComponent>
|
||||||
|
</li>
|
||||||
|
) : (
|
||||||
|
<li key={item.key}>
|
||||||
|
<Radio key={item.key} value={item.key}>
|
||||||
|
{item.title}
|
||||||
|
</Radio>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
)}
|
)}
|
||||||
</Card.Grid>
|
</Card.Grid>
|
||||||
@@ -297,16 +308,13 @@ export function ReportCenterModalComponent({ reportCenterModal, bodyshop }) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
validator: (_, value) => {
|
validator: (_, value) => {
|
||||||
if (
|
if (value && value[0] && value[1]) {
|
||||||
!import.meta.env.VITE_APP_IS_TEST &&
|
const relatedRestrictedReport = restrictedReports.find((r) => r.key === key);
|
||||||
import.meta.env.PROD &&
|
if (relatedRestrictedReport) {
|
||||||
value &&
|
const diffInDays = (value[1] - value[0]) / (1000 * 3600 * 24);
|
||||||
value[0] &&
|
if (diffInDays > relatedRestrictedReport.days) {
|
||||||
value[1]
|
return Promise.reject(t("general.validation.dateRangeExceeded"));
|
||||||
) {
|
}
|
||||||
const diffInDays = (value[1] - value[0]) / (1000 * 3600 * 24);
|
|
||||||
if (diffInDays > 92) {
|
|
||||||
return Promise.reject(t("general.validation.dateRangeExceeded"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
@@ -369,3 +377,14 @@ export function ReportCenterModalComponent({ reportCenterModal, bodyshop }) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const restrictedReports = [
|
||||||
|
{ key: "job_costing_ro", days: 183 },
|
||||||
|
{ key: "job_costing_ro_date_summary", days: 183 },
|
||||||
|
{ key: "job_costing_ro_csr", days: 183 },
|
||||||
|
{ key: "job_costing_ro_ins_co", days: 183 },
|
||||||
|
{ key: "job_costing_ro_date_detail", days: 183 },
|
||||||
|
{ key: "job_costing_ro_estimator", days: 183 },
|
||||||
|
{ key: "job_lifecycle_date_detail", days: 183 },
|
||||||
|
{ key: "job_lifecycle_date_summary", days: 183 }
|
||||||
|
];
|
||||||
|
|||||||
@@ -342,7 +342,8 @@ export const TemplateList = (type, context) => {
|
|||||||
subject: i18n.t("printcenter.jobs.purchases_by_ro_detail"),
|
subject: i18n.t("printcenter.jobs.purchases_by_ro_detail"),
|
||||||
key: "purchases_by_ro_detail",
|
key: "purchases_by_ro_detail",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
group: "financial"
|
group: "financial",
|
||||||
|
featureNameRestricted: "bills"
|
||||||
},
|
},
|
||||||
purchases_by_ro_summary: {
|
purchases_by_ro_summary: {
|
||||||
title: i18n.t("printcenter.jobs.purchases_by_ro_summary"),
|
title: i18n.t("printcenter.jobs.purchases_by_ro_summary"),
|
||||||
@@ -350,7 +351,8 @@ export const TemplateList = (type, context) => {
|
|||||||
subject: i18n.t("printcenter.jobs.purchases_by_ro_summary"),
|
subject: i18n.t("printcenter.jobs.purchases_by_ro_summary"),
|
||||||
key: "purchases_by_ro_summary",
|
key: "purchases_by_ro_summary",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
group: "financial"
|
group: "financial",
|
||||||
|
featureNameRestricted: "bills"
|
||||||
},
|
},
|
||||||
filing_coversheet_portrait: {
|
filing_coversheet_portrait: {
|
||||||
title: i18n.t("printcenter.jobs.filing_coversheet_portrait"),
|
title: i18n.t("printcenter.jobs.filing_coversheet_portrait"),
|
||||||
@@ -398,7 +400,8 @@ export const TemplateList = (type, context) => {
|
|||||||
key: "csi_invitation",
|
key: "csi_invitation",
|
||||||
subject: i18n.t("printcenter.jobs.csi_invitation"),
|
subject: i18n.t("printcenter.jobs.csi_invitation"),
|
||||||
disabled: false,
|
disabled: false,
|
||||||
group: "post"
|
group: "post",
|
||||||
|
featureNameRestricted: "csi"
|
||||||
},
|
},
|
||||||
window_tag_sublet: {
|
window_tag_sublet: {
|
||||||
title: i18n.t("printcenter.jobs.window_tag_sublet"),
|
title: i18n.t("printcenter.jobs.window_tag_sublet"),
|
||||||
@@ -549,7 +552,8 @@ export const TemplateList = (type, context) => {
|
|||||||
subject: i18n.t("printcenter.jobs.timetickets_ro"),
|
subject: i18n.t("printcenter.jobs.timetickets_ro"),
|
||||||
key: "timetickets_ro",
|
key: "timetickets_ro",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
group: "financial"
|
group: "financial",
|
||||||
|
featureNameRestricted: "timetickets"
|
||||||
},
|
},
|
||||||
dms_posting_sheet: {
|
dms_posting_sheet: {
|
||||||
title: i18n.t("printcenter.jobs.dms_posting_sheet"),
|
title: i18n.t("printcenter.jobs.dms_posting_sheet"),
|
||||||
@@ -576,7 +580,8 @@ export const TemplateList = (type, context) => {
|
|||||||
key: "committed_timetickets_ro",
|
key: "committed_timetickets_ro",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
group: "financial",
|
group: "financial",
|
||||||
enhanced_payroll: true
|
enhanced_payroll: true,
|
||||||
|
featureNameRestricted: "timetickets"
|
||||||
},
|
},
|
||||||
job_lifecycle_ro: {
|
job_lifecycle_ro: {
|
||||||
title: i18n.t("printcenter.jobs.job_lifecycle_ro"),
|
title: i18n.t("printcenter.jobs.job_lifecycle_ro"),
|
||||||
@@ -584,7 +589,8 @@ export const TemplateList = (type, context) => {
|
|||||||
subject: i18n.t("printcenter.jobs.job_lifecycle_ro"),
|
subject: i18n.t("printcenter.jobs.job_lifecycle_ro"),
|
||||||
key: "job_lifecycle_ro",
|
key: "job_lifecycle_ro",
|
||||||
disabled: false,
|
disabled: false,
|
||||||
group: "post"
|
group: "post",
|
||||||
|
featureNameRestricted: "lifecycle"
|
||||||
},
|
},
|
||||||
job_tasks: {
|
job_tasks: {
|
||||||
title: i18n.t("printcenter.jobs.job_tasks"),
|
title: i18n.t("printcenter.jobs.job_tasks"),
|
||||||
@@ -628,7 +634,8 @@ export const TemplateList = (type, context) => {
|
|||||||
description: "",
|
description: "",
|
||||||
key: "csi_invitation_action",
|
key: "csi_invitation_action",
|
||||||
subject: i18n.t("printcenter.jobs.csi_invitation_action"),
|
subject: i18n.t("printcenter.jobs.csi_invitation_action"),
|
||||||
disabled: false
|
disabled: false,
|
||||||
|
featureNameRestricted: "csi"
|
||||||
},
|
},
|
||||||
individual_job_note: {
|
individual_job_note: {
|
||||||
title: i18n.t("printcenter.jobs.individual_job_note"),
|
title: i18n.t("printcenter.jobs.individual_job_note"),
|
||||||
@@ -1606,7 +1613,8 @@ export const TemplateList = (type, context) => {
|
|||||||
object: i18n.t("reportcenter.labels.objects.exportlogs"),
|
object: i18n.t("reportcenter.labels.objects.exportlogs"),
|
||||||
field: i18n.t("exportlogs.fields.createdat")
|
field: i18n.t("exportlogs.fields.createdat")
|
||||||
},
|
},
|
||||||
group: "customers"
|
group: "customers",
|
||||||
|
featureNameRestricted: "export"
|
||||||
},
|
},
|
||||||
export_receivables: {
|
export_receivables: {
|
||||||
title: i18n.t("reportcenter.templates.export_receivables"),
|
title: i18n.t("reportcenter.templates.export_receivables"),
|
||||||
@@ -1619,7 +1627,8 @@ export const TemplateList = (type, context) => {
|
|||||||
object: i18n.t("reportcenter.labels.objects.exportlogs"),
|
object: i18n.t("reportcenter.labels.objects.exportlogs"),
|
||||||
field: i18n.t("exportlogs.fields.createdat")
|
field: i18n.t("exportlogs.fields.createdat")
|
||||||
},
|
},
|
||||||
group: "sales"
|
group: "sales",
|
||||||
|
featureNameRestricted: "export"
|
||||||
},
|
},
|
||||||
parts_backorder: {
|
parts_backorder: {
|
||||||
title: i18n.t("reportcenter.templates.parts_backorder"),
|
title: i18n.t("reportcenter.templates.parts_backorder"),
|
||||||
@@ -1684,7 +1693,8 @@ export const TemplateList = (type, context) => {
|
|||||||
object: i18n.t("reportcenter.labels.objects.jobs"),
|
object: i18n.t("reportcenter.labels.objects.jobs"),
|
||||||
field: i18n.t("jobs.fields.date_open")
|
field: i18n.t("jobs.fields.date_open")
|
||||||
},
|
},
|
||||||
group: "jobs"
|
group: "jobs",
|
||||||
|
featureNameRestricted: "timetickets"
|
||||||
},
|
},
|
||||||
work_in_progress_committed_labour: {
|
work_in_progress_committed_labour: {
|
||||||
title: i18n.t("reportcenter.templates.work_in_progress_committed_labour"),
|
title: i18n.t("reportcenter.templates.work_in_progress_committed_labour"),
|
||||||
@@ -1698,7 +1708,8 @@ export const TemplateList = (type, context) => {
|
|||||||
field: i18n.t("jobs.fields.date_open")
|
field: i18n.t("jobs.fields.date_open")
|
||||||
},
|
},
|
||||||
group: "jobs",
|
group: "jobs",
|
||||||
enhanced_payroll: true
|
enhanced_payroll: true,
|
||||||
|
featureNameRestricted: "timetickets"
|
||||||
},
|
},
|
||||||
work_in_progress_payables: {
|
work_in_progress_payables: {
|
||||||
title: i18n.t("reportcenter.templates.work_in_progress_payables"),
|
title: i18n.t("reportcenter.templates.work_in_progress_payables"),
|
||||||
@@ -1711,7 +1722,8 @@ export const TemplateList = (type, context) => {
|
|||||||
object: i18n.t("reportcenter.labels.objects.jobs"),
|
object: i18n.t("reportcenter.labels.objects.jobs"),
|
||||||
field: i18n.t("jobs.fields.date_open")
|
field: i18n.t("jobs.fields.date_open")
|
||||||
},
|
},
|
||||||
group: "jobs"
|
group: "jobs",
|
||||||
|
featureNameRestricted: "bills"
|
||||||
},
|
},
|
||||||
lag_time: {
|
lag_time: {
|
||||||
title: i18n.t("reportcenter.templates.lag_time"),
|
title: i18n.t("reportcenter.templates.lag_time"),
|
||||||
@@ -1802,7 +1814,8 @@ export const TemplateList = (type, context) => {
|
|||||||
object: i18n.t("reportcenter.labels.objects.csi"),
|
object: i18n.t("reportcenter.labels.objects.csi"),
|
||||||
field: i18n.t("csi.fields.created_at") // Also date invoice.
|
field: i18n.t("csi.fields.created_at") // Also date invoice.
|
||||||
},
|
},
|
||||||
group: "customers"
|
group: "customers",
|
||||||
|
featureNameRestricted: "csi"
|
||||||
},
|
},
|
||||||
estimates_written_converted: {
|
estimates_written_converted: {
|
||||||
title: i18n.t("reportcenter.templates.estimates_written_converted"),
|
title: i18n.t("reportcenter.templates.estimates_written_converted"),
|
||||||
@@ -1839,7 +1852,8 @@ export const TemplateList = (type, context) => {
|
|||||||
object: i18n.t("reportcenter.labels.objects.jobs"),
|
object: i18n.t("reportcenter.labels.objects.jobs"),
|
||||||
field: i18n.t("jobs.fields.date_invoiced")
|
field: i18n.t("jobs.fields.date_invoiced")
|
||||||
},
|
},
|
||||||
group: "jobs"
|
group: "jobs",
|
||||||
|
featureNameRestricted: "bills"
|
||||||
},
|
},
|
||||||
parts_received_not_scheduled: {
|
parts_received_not_scheduled: {
|
||||||
title: i18n.t("reportcenter.templates.parts_received_not_scheduled"),
|
title: i18n.t("reportcenter.templates.parts_received_not_scheduled"),
|
||||||
@@ -1935,7 +1949,8 @@ export const TemplateList = (type, context) => {
|
|||||||
object: i18n.t("reportcenter.labels.objects.jobs"),
|
object: i18n.t("reportcenter.labels.objects.jobs"),
|
||||||
field: i18n.t("jobs.fields.date_invoiced")
|
field: i18n.t("jobs.fields.date_invoiced")
|
||||||
},
|
},
|
||||||
group: "jobs"
|
group: "jobs",
|
||||||
|
featureNameRestricted: "export"
|
||||||
},
|
},
|
||||||
purchase_return_ratio_grouped_by_vendor_detail: {
|
purchase_return_ratio_grouped_by_vendor_detail: {
|
||||||
title: i18n.t("reportcenter.templates.purchase_return_ratio_grouped_by_vendor_detail"),
|
title: i18n.t("reportcenter.templates.purchase_return_ratio_grouped_by_vendor_detail"),
|
||||||
@@ -1996,7 +2011,8 @@ export const TemplateList = (type, context) => {
|
|||||||
object: i18n.t("reportcenter.labels.objects.jobs"),
|
object: i18n.t("reportcenter.labels.objects.jobs"),
|
||||||
field: i18n.t("jobs.fields.date_exported")
|
field: i18n.t("jobs.fields.date_exported")
|
||||||
},
|
},
|
||||||
group: "sales"
|
group: "sales",
|
||||||
|
featureNameRestricted: "export"
|
||||||
},
|
},
|
||||||
exported_gsr_by_ro_labor: {
|
exported_gsr_by_ro_labor: {
|
||||||
title: i18n.t("reportcenter.templates.exported_gsr_by_ro_labor"),
|
title: i18n.t("reportcenter.templates.exported_gsr_by_ro_labor"),
|
||||||
@@ -2009,7 +2025,8 @@ export const TemplateList = (type, context) => {
|
|||||||
object: i18n.t("reportcenter.labels.objects.jobs"),
|
object: i18n.t("reportcenter.labels.objects.jobs"),
|
||||||
field: i18n.t("jobs.fields.date_exported")
|
field: i18n.t("jobs.fields.date_exported")
|
||||||
},
|
},
|
||||||
group: "sales"
|
group: "sales",
|
||||||
|
featureNameRestricted: "export"
|
||||||
},
|
},
|
||||||
jobs_scheduled_completion: {
|
jobs_scheduled_completion: {
|
||||||
title: i18n.t("reportcenter.templates.jobs_scheduled_completion"),
|
title: i18n.t("reportcenter.templates.jobs_scheduled_completion"),
|
||||||
@@ -2119,7 +2136,8 @@ export const TemplateList = (type, context) => {
|
|||||||
object: i18n.t("reportcenter.labels.objects.jobs"),
|
object: i18n.t("reportcenter.labels.objects.jobs"),
|
||||||
field: i18n.t("jobs.fields.date_invoiced")
|
field: i18n.t("jobs.fields.date_invoiced")
|
||||||
},
|
},
|
||||||
group: "jobs"
|
group: "jobs",
|
||||||
|
featureNameRestricted: "lifecycle"
|
||||||
},
|
},
|
||||||
job_lifecycle_date_summary: {
|
job_lifecycle_date_summary: {
|
||||||
title: i18n.t("reportcenter.templates.job_lifecycle_date_summary"),
|
title: i18n.t("reportcenter.templates.job_lifecycle_date_summary"),
|
||||||
@@ -2131,7 +2149,8 @@ export const TemplateList = (type, context) => {
|
|||||||
object: i18n.t("reportcenter.labels.objects.jobs"),
|
object: i18n.t("reportcenter.labels.objects.jobs"),
|
||||||
field: i18n.t("jobs.fields.date_invoiced")
|
field: i18n.t("jobs.fields.date_invoiced")
|
||||||
},
|
},
|
||||||
group: "jobs"
|
group: "jobs",
|
||||||
|
featureNameRestricted: "lifecycle"
|
||||||
},
|
},
|
||||||
tasks_date: {
|
tasks_date: {
|
||||||
title: i18n.t("reportcenter.templates.tasks_date"),
|
title: i18n.t("reportcenter.templates.tasks_date"),
|
||||||
|
|||||||
Reference in New Issue
Block a user