From 2b39cae4245ef74e6b674f5c0631f45eee4713bd Mon Sep 17 00:00:00 2001 From: mchouliara Date: Mon, 2 Sep 2024 11:41:13 +0300 Subject: [PATCH] remove edit actions from public plans/descriptions, small change in styles --- .../description-listing-item.component.ts | 6 +++--- .../listing-item/plan-listing-item.component.ts | 12 ++++++------ frontend/src/styles.scss | 8 ++------ 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts b/frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts index d3ff4f5e6..50851de5d 100644 --- a/frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts +++ b/frontend/src/app/ui/description/listing/listing-item/description-listing-item.component.ts @@ -90,13 +90,13 @@ export class DescriptionListingItemComponent extends BaseComponent implements On this.isDeleted = false; } - this.canDelete = (this.authService.hasPermission(AppPermission.DeleteDescription) || + this.canDelete = !this.isPublic && (this.authService.hasPermission(AppPermission.DeleteDescription) || this.description.authorizationFlags?.some(x => x === AppPermission.DeleteDescription)) && this.description.belongsToCurrentTenant != false; - this.canEdit = (this.authService.hasPermission(AppPermission.EditDescription) || + this.canEdit = !this.isPublic && (this.authService.hasPermission(AppPermission.EditDescription) || this.description.authorizationFlags?.some(x => x === AppPermission.EditDescription)) && this.description.belongsToCurrentTenant != false; - this.canInvitePlanUsers = (this.authService.hasPermission(AppPermission.InvitePlanUsers) || + this.canInvitePlanUsers = !this.isPublic && (this.authService.hasPermission(AppPermission.InvitePlanUsers) || this.description.authorizationFlags?.some(x => x === AppPermission.InvitePlanUsers)) && this.description.belongsToCurrentTenant != false; } diff --git a/frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.ts b/frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.ts index fef65b09b..508eb87a2 100644 --- a/frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.ts +++ b/frontend/src/app/ui/plan/listing/listing-item/plan-listing-item.component.ts @@ -237,15 +237,15 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit { } canEditPlan(): boolean { - return (this.isDraft) && (this.plan.authorizationFlags?.some(x => x === AppPermission.EditPlan) || this.authentication.hasPermission(AppPermission.EditPlan)) && this.isPublic == false && this.plan.belongsToCurrentTenant != false; + return (this.isDraft) && (this.plan.authorizationFlags?.some(x => x === AppPermission.EditPlan) || this.authentication.hasPermission(AppPermission.EditPlan)) && !this.isPublic && this.plan.belongsToCurrentTenant != false; } canCreateNewVersion(): boolean { - return (this.plan.authorizationFlags?.some(x => x === AppPermission.CreateNewVersionPlan) || this.authentication.hasPermission(AppPermission.CreateNewVersionPlan)) && this.plan.versionStatus === PlanVersionStatus.Current && this.isPublic == false && this.plan.belongsToCurrentTenant != false; + return (this.plan.authorizationFlags?.some(x => x === AppPermission.CreateNewVersionPlan) || this.authentication.hasPermission(AppPermission.CreateNewVersionPlan)) && this.plan.versionStatus === PlanVersionStatus.Current && !this.isPublic && this.plan.belongsToCurrentTenant != false; } canDeletePlan(): boolean { - return (this.plan.authorizationFlags?.some(x => x === AppPermission.DeletePlan) || this.authentication.hasPermission(AppPermission.DeletePlan)) && this.isPublic == false && this.plan.belongsToCurrentTenant != false; + return (this.plan.authorizationFlags?.some(x => x === AppPermission.DeletePlan) || this.authentication.hasPermission(AppPermission.DeletePlan)) && !this.isPublic && this.plan.belongsToCurrentTenant != false; } canClonePlan(): boolean { @@ -253,7 +253,7 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit { } canFinalizePlan(): boolean { - return (this.plan.authorizationFlags?.some(x => x === AppPermission.FinalizePlan) || this.authentication.hasPermission(AppPermission.FinalizePlan)) && this.isPublic == false && this.plan.belongsToCurrentTenant != false; + return (this.plan.authorizationFlags?.some(x => x === AppPermission.FinalizePlan) || this.authentication.hasPermission(AppPermission.FinalizePlan)) && !this.isPublic && this.plan.belongsToCurrentTenant != false; } canExportPlan(): boolean { @@ -261,10 +261,10 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit { } canInvitePlanUsers(): boolean { - return (this.plan.authorizationFlags?.some(x => x === AppPermission.InvitePlanUsers) || this.authentication.hasPermission(AppPermission.InvitePlanUsers)) && this.isPublic == false && this.plan.belongsToCurrentTenant != false; + return (this.plan.authorizationFlags?.some(x => x === AppPermission.InvitePlanUsers) || this.authentication.hasPermission(AppPermission.InvitePlanUsers)) && !this.isPublic && this.plan.belongsToCurrentTenant != false; } canAssignPlanUsers(): boolean { - return (this.plan.authorizationFlags?.some(x => x === AppPermission.AssignPlanUsers) || this.authentication.hasPermission(AppPermission.AssignPlanUsers)) && this.isPublic == false && this.plan.belongsToCurrentTenant != false; + return (this.plan.authorizationFlags?.some(x => x === AppPermission.AssignPlanUsers) || this.authentication.hasPermission(AppPermission.AssignPlanUsers)) && !this.isPublic && this.plan.belongsToCurrentTenant != false; } } diff --git a/frontend/src/styles.scss b/frontend/src/styles.scss index 5394d5323..1039f28be 100644 --- a/frontend/src/styles.scss +++ b/frontend/src/styles.scss @@ -401,11 +401,12 @@ $mat-dark-theme: mat.m2-define-dark-theme((color: (primary: $mat-dark-theme-prim @include mat.all-component-densities(-10); } -button,.mdc-button,.mat-mdc-button, .mdc-button:has(.material-icons,mat-icon,[matButtonIcon]) { +button,.mdc-button,.mat-mdc-button, .mdc-button:has(.material-icons,mat-icon,[matButtonIcon]), .md-button { &.rounded-btn{ font-size: 0.87rem; padding: 0.62rem 1.87rem; height: 40px; + font-weight: 400; border-radius: 30px; border: none; @@ -465,11 +466,6 @@ button,.mdc-button,.mat-mdc-button, .mdc-button:has(.material-icons,mat-icon,[ma border: 0px; } } - - &.md-button { - padding: 0.62rem 1.87rem; - font-weight: 400; - } &.mat-mdc-button.mat-mdc-button-disabled { background-color: #CBCBCB; //!important