From 7e75319c08ed0142331e2a048221f21ced3bc26b Mon Sep 17 00:00:00 2001 From: Andrew Sutherland Date: Tue, 26 Mar 2019 10:40:53 -0700 Subject: [PATCH 01/25] BA-1131 - Move CWU create/edit to modal --- .../proposals/client/config/ProposalRouter.ts | 48 ---------- .../controllers/ProposalEditCWUController.ts | 18 ++-- .../directives/ProposalApplyDirective.ts | 89 +++++++++++++++---- .../client/views/cwu-proposal-edit.html | 2 +- .../views/proposal-apply.directive.html | 11 +-- 5 files changed, 90 insertions(+), 78 deletions(-) diff --git a/modules/proposals/client/config/ProposalRouter.ts b/modules/proposals/client/config/ProposalRouter.ts index 887fd98b9..2332deece 100644 --- a/modules/proposals/client/config/ProposalRouter.ts +++ b/modules/proposals/client/config/ProposalRouter.ts @@ -143,54 +143,6 @@ import { IProposalService } from '../services/ProposalService'; } }) - // create a new CWU proposal and edit it - .state('proposaladmin.createcwu', { - url: '/createcwu/:opportunityId', - data: { - roles: ['user'], - notroles: ['gov'] - }, - templateUrl: '/modules/proposals/client/views/cwu-proposal-edit.html', - controller: 'ProposalEditCWUController', - controllerAs: 'ppp', - resolve: { - proposal: [ - 'ProposalService', - (ProposalService: IProposalService) => { - return new ProposalService(); - } - ], - opportunity: [ - '$stateParams', - 'OpportunitiesService', - ($stateParams: StateParams, OpportunitiesService: IOpportunitiesService) => { - return OpportunitiesService.get({ - opportunityId: $stateParams.opportunityId - }).$promise; - } - ], - org: [ - 'AuthenticationService', - 'OrgService', - (AuthenticationService: IAuthenticationService, OrgService) => { - if (!AuthenticationService.user) { - return {}; - } - return OrgService.myadmin().$promise.then(orgs => { - if (orgs && orgs.length > 0) { - return orgs[0]; - } else { - return null; - } - }); - } - ], - editing() { - return false; - } - } - }) - // edit a SWU proposal .state('proposaladmin.editswu', { url: '/:proposalId/editswu/:opportunityId', diff --git a/modules/proposals/client/controllers/ProposalEditCWUController.ts b/modules/proposals/client/controllers/ProposalEditCWUController.ts index bbbb6f08a..cfd000348 100644 --- a/modules/proposals/client/controllers/ProposalEditCWUController.ts +++ b/modules/proposals/client/controllers/ProposalEditCWUController.ts @@ -1,7 +1,7 @@ 'use strict'; import { StateService } from '@uirouter/core'; -import angular, { angularFileUpload, IFormController, IRootScopeService, uiNotification } from 'angular'; +import angular, { angularFileUpload, IFormController, IRootScopeService, ui, uiNotification } from 'angular'; import moment from 'moment-timezone'; import { Settings } from 'tinymce'; import { IOpportunitiesService, IOpportunityResource } from '../../../opportunities/client/services/OpportunitiesService'; @@ -26,7 +26,8 @@ export default class ProposalEditCWUController { 'UsersService', 'Notification', 'org', - 'TinyMceConfiguration' + 'TinyMceConfiguration', + '$uibModalInstance' ]; public members: any[]; @@ -49,7 +50,8 @@ export default class ProposalEditCWUController { private UsersService: IUserService, private Notification: uiNotification.INotificationService, public org: IOrgResource, - public TinyMceConfiguration: Settings + public TinyMceConfiguration: Settings, + private $uibModalInstance: ui.bootstrap.IModalServiceInstance ) { // if not editing (i.e. creating), ensure that the current user doesn't already have a proposal started for this opp // if they do, transition to edit view for that proposal @@ -99,16 +101,14 @@ export default class ProposalEditCWUController { updatedProposal = await this.ProposalService.create(this.proposal).$promise; } - this.refreshProposal(updatedProposal); this.Notification.success({ message: ` ${successMessage}` }); - this.proposalForm.$setPristine(); - // if this is a newly created proposal, transition to edit view - if (!this.editing) { - this.$state.go('proposaladmin.editcwu', { proposalId: this.proposal._id, opportunityId: this.opportunity.code }); - } + // close the modal and include the proposal in the response + this.$uibModalInstance.close({ + proposal: updatedProposal + }); } catch (error) { this.handleError(error); } diff --git a/modules/proposals/client/directives/ProposalApplyDirective.ts b/modules/proposals/client/directives/ProposalApplyDirective.ts index 3b3b453de..15e9d5324 100644 --- a/modules/proposals/client/directives/ProposalApplyDirective.ts +++ b/modules/proposals/client/directives/ProposalApplyDirective.ts @@ -1,12 +1,14 @@ 'use strict'; +import { StateParams } from '@uirouter/core'; import angular, { IController, IScope } from 'angular'; import moment from 'moment-timezone'; -import { IOpportunityResource } from '../../../opportunities/client/services/OpportunitiesService'; +import { IOpportunitiesService, IOpportunityResource } from '../../../opportunities/client/services/OpportunitiesService'; import { IOrgCommonService } from '../../../orgs/client/services/OrgCommonService'; -import { IOrgResource } from '../../../orgs/client/services/OrgService'; +import { IOrgResource, IOrgService } from '../../../orgs/client/services/OrgService'; import { IAuthenticationService } from '../../../users/client/services/AuthenticationService'; -import { IProposalResource } from '../services/ProposalService'; +import ProposalEditCWUController from '../controllers/ProposalEditCWUController'; +import { IProposalResource, IProposalService } from '../services/ProposalService'; interface IProposalApplyScope extends IScope { opportunity: IOpportunityResource; @@ -23,22 +25,86 @@ enum UserStates { } export class ProposalApplyDirectiveController implements IController { - public static $inject = ['$scope', 'AuthenticationService', 'OrgCommonService']; + public static $inject = ['$scope', 'AuthenticationService', 'OrgCommonService', 'modalService']; public opportunity: IOpportunityResource; public proposal: IProposalResource; public org: IOrgResource; public userState: UserStates; public userStates = UserStates; - constructor($scope: IProposalApplyScope, AuthenticationService: IAuthenticationService, private OrgCommonService: IOrgCommonService) { + constructor(private $scope: IProposalApplyScope, private AuthenticationService: IAuthenticationService, private OrgCommonService: IOrgCommonService, private modalService: any) { this.opportunity = $scope.opportunity; this.proposal = $scope.proposal; this.org = $scope.org; this.userState = this.userStates.NOTHING; - const isUser = !!AuthenticationService.user; - const isAdmin = isUser && AuthenticationService.user.roles.includes('admin'); - const isGov = isUser && AuthenticationService.user.roles.includes('gov'); + this.refreshDirective(); + } + + public async openProposalApplicationDialog(editing: boolean, proposalId?: string): Promise { + + const modalResponse = await this.modalService.showModal({ + size: 'lg', + templateUrl: '/modules/proposals/client/views/cwu-proposal-edit.html', + controller: ProposalEditCWUController, + controllerAs: 'ppp', + resolve: { + editing: () => editing, + proposal: [ + 'ProposalService', + (ProposalService: IProposalService) => { + if (!editing) { + return new ProposalService(); + } else { + return ProposalService.get({ proposalId }).$promise; + } + } + ], + opportunity: [ + '$stateParams', + 'OpportunitiesService', + ($stateParams: StateParams, OpportunitiesService: IOpportunitiesService) => { + return OpportunitiesService.get({ + opportunityId: $stateParams.opportunityId + }).$promise; + } + ], + org: [ + 'AuthenticationService', + 'OrgService', + (AuthenticationService: IAuthenticationService, OrgService: IOrgService) => { + if (!AuthenticationService.user) { + return {}; + } + return OrgService.myadmin().$promise.then(orgs => { + if (orgs && orgs.length > 0) { + return orgs[0]; + } else { + return null; + } + }); + } + ] + } + }); + + this.$scope.proposal = modalResponse.proposal; + this.refreshDirective(); + } + + // Format dates to always be in PST (America/Vancouver timezone) + public formatDate(date: string, includeTime: boolean): string { + const momentDate = moment(date); + const dateFormat = includeTime ? 'MMMM Do YYYY, HH:mm z' : 'MMMM Do YYYY'; + return momentDate.tz('America/Vancouver').format(dateFormat); + } + + private refreshDirective(): void { + this.proposal = this.$scope.proposal; + + const isUser = !!this.AuthenticationService.user; + const isAdmin = isUser && this.AuthenticationService.user.roles.includes('admin'); + const isGov = isUser && this.AuthenticationService.user.roles.includes('gov'); const isProposal = this.proposal && this.proposal._id; const canEdit = !isAdmin && !isGov; @@ -54,13 +120,6 @@ export class ProposalApplyDirectiveController implements IController { } } } - - // Format dates to always be in PST (America/Vancouver timezone) - public formatDate(date: string, includeTime: boolean): string { - const momentDate = moment(date); - const dateFormat = includeTime ? 'MMMM Do YYYY, HH:mm z' : 'MMMM Do YYYY'; - return momentDate.tz('America/Vancouver').format(dateFormat); - } } angular.module('proposals').directive('proposalApply', () => { diff --git a/modules/proposals/client/views/cwu-proposal-edit.html b/modules/proposals/client/views/cwu-proposal-edit.html index f29285ec0..4f1dcc311 100644 --- a/modules/proposals/client/views/cwu-proposal-edit.html +++ b/modules/proposals/client/views/cwu-proposal-edit.html @@ -26,7 +26,7 @@ -
+
diff --git a/modules/proposals/client/views/proposal-apply.directive.html b/modules/proposals/client/views/proposal-apply.directive.html index 9bb1efd6e..5c3bf8ea7 100644 --- a/modules/proposals/client/views/proposal-apply.directive.html +++ b/modules/proposals/client/views/proposal-apply.directive.html @@ -53,7 +53,7 @@
-
@@ -69,8 +69,8 @@  You can make updates or withdraw your Proposal until .  
@@ -81,8 +81,9 @@ to be considered for this opportunity.   From c8f0df1b86b182071cb9cbb73a376a389ab2e022 Mon Sep 17 00:00:00 2001 From: Andrew Sutherland Date: Wed, 27 Mar 2019 11:17:46 -0700 Subject: [PATCH 02/25] BA-1131 - Proposals autosave on creation to allow immediate attachments --- .../controllers/ProposalEditCWUController.ts | 62 ++++++++----------- .../directives/ProposalApplyDirective.ts | 41 +++++++++--- .../views/proposal-apply.directive.html | 8 +-- .../controllers/ProposalsServerController.ts | 2 +- 4 files changed, 65 insertions(+), 48 deletions(-) diff --git a/modules/proposals/client/controllers/ProposalEditCWUController.ts b/modules/proposals/client/controllers/ProposalEditCWUController.ts index cfd000348..b16d090e1 100644 --- a/modules/proposals/client/controllers/ProposalEditCWUController.ts +++ b/modules/proposals/client/controllers/ProposalEditCWUController.ts @@ -9,15 +9,14 @@ import { IOrgResource } from '../../../orgs/client/services/OrgService'; import { IAuthenticationService } from '../../../users/client/services/AuthenticationService'; import { IUserService } from '../../../users/client/services/UsersService'; import { IUser } from '../../../users/shared/IUserDTO'; +import { ProposalModalActions } from '../directives/ProposalApplyDirective'; import { IProposalResource, IProposalService } from '../services/ProposalService'; export default class ProposalEditCWUController { public static $inject = [ - 'editing', '$scope', 'ask', 'Upload', - '$state', 'proposal', 'opportunity', 'AuthenticationService', @@ -37,11 +36,9 @@ export default class ProposalEditCWUController { private user: IUser; constructor( - public editing: boolean, private $scope: IRootScopeService, private ask, private Upload: angularFileUpload.IUploadService, - private $state: StateService, public proposal: IProposalResource, public opportunity: IOpportunityResource, private AuthenticationService: IAuthenticationService, @@ -53,10 +50,6 @@ export default class ProposalEditCWUController { public TinyMceConfiguration: Settings, private $uibModalInstance: ui.bootstrap.IModalServiceInstance ) { - // if not editing (i.e. creating), ensure that the current user doesn't already have a proposal started for this opp - // if they do, transition to edit view for that proposal - this.checkForExisting(); - // refresh the view based on passed in proposal this.refreshProposal(this.proposal); @@ -94,12 +87,10 @@ export default class ProposalEditCWUController { // Save the proposal this.copyUserInfo(); - let updatedProposal: IProposalResource; - if (this.editing) { - updatedProposal = await this.ProposalService.update(this.proposal).$promise; - } else { - updatedProposal = await this.ProposalService.create(this.proposal).$promise; + if (this.proposal.status === 'New') { + this.proposal.status = 'Draft'; } + const updatedProposal = await this.ProposalService.update(this.proposal).$promise; this.Notification.success({ message: ` ${successMessage}` @@ -107,6 +98,7 @@ export default class ProposalEditCWUController { // close the modal and include the proposal in the response this.$uibModalInstance.close({ + action: ProposalModalActions.SAVED, proposal: updatedProposal }); } catch (error) { @@ -114,9 +106,16 @@ export default class ProposalEditCWUController { } } - // Leave the edit view - public close(): void { - this.$state.go('opportunities.viewcwu', { opportunityId: this.opportunity.code }); + // Leave the edit view - if this was a brand new opportunity (i.e. not previously saved), delete it + public async close(): Promise { + + if (this.proposal.status === 'New') { + await this.proposal.$remove(); + } + + this.$uibModalInstance.close({ + action: ProposalModalActions.CANCELLED + }); } // Delete a proposal @@ -128,10 +127,12 @@ export default class ProposalEditCWUController { try { await this.proposal.$remove(); this.proposalForm.$setPristine(); - this.$state.go('opportunities.viewcwu', { opportunityId: this.opportunity.code }); this.Notification.success({ message: ' Proposal Deleted' }); + this.$uibModalInstance.close({ + action: ProposalModalActions.DELETED + }); } catch (error) { this.handleError(error); } @@ -162,11 +163,15 @@ export default class ProposalEditCWUController { // Submit the proposal this.copyUserInfo(); - await this.ProposalService.submit(this.proposal).$promise; + const submittedProposal = await this.ProposalService.submit(this.proposal).$promise; this.Notification.success({ message: ' Your proposal has been submitted' }); - this.close(); + + this.$uibModalInstance.close({ + action: ProposalModalActions.SAVED, + proposal: submittedProposal + }); } catch (error) { this.handleError(error); } @@ -202,7 +207,7 @@ export default class ProposalEditCWUController { message: ' Attachment Uploaded' }); - const updatedProposal = response.data as IProposalResource; + const updatedProposal = new this.ProposalService(response.data); this.refreshProposal(updatedProposal); } catch (error) { this.handleError(error); @@ -263,16 +268,6 @@ export default class ProposalEditCWUController { } } - private async checkForExisting(): Promise { - if (!this.editing) { - const myProposal = await this.ProposalService.getMyProposal({ opportunityId: this.opportunity.code }).$promise; - - if (myProposal && myProposal._id) { - this.$state.go('proposaladmin.editcwu', { proposalId: myProposal._id, opportunityId: this.opportunity.code }); - } - } - } - private refreshProposal(newProposal: IProposalResource): void { this.proposal = newProposal; @@ -282,15 +277,10 @@ export default class ProposalEditCWUController { this.members = this.org.members.concat(this.org.admins); } - this.title = this.editing ? 'Edit' : 'Create'; + this.title = 'Edit'; if (!this.proposal.team) { this.proposal.team = []; } - - // ensure status set accordingly - if (!this.editing) { - this.proposal.status = 'New'; - } } // Copy over user and org information to the proposal diff --git a/modules/proposals/client/directives/ProposalApplyDirective.ts b/modules/proposals/client/directives/ProposalApplyDirective.ts index 15e9d5324..71be1b656 100644 --- a/modules/proposals/client/directives/ProposalApplyDirective.ts +++ b/modules/proposals/client/directives/ProposalApplyDirective.ts @@ -7,6 +7,7 @@ import { IOpportunitiesService, IOpportunityResource } from '../../../opportunit import { IOrgCommonService } from '../../../orgs/client/services/OrgCommonService'; import { IOrgResource, IOrgService } from '../../../orgs/client/services/OrgService'; import { IAuthenticationService } from '../../../users/client/services/AuthenticationService'; +import { IUser } from '../../../users/shared/IUserDTO'; import ProposalEditCWUController from '../controllers/ProposalEditCWUController'; import { IProposalResource, IProposalService } from '../services/ProposalService'; @@ -24,11 +25,18 @@ enum UserStates { NOTHING } +export enum ProposalModalActions { + CANCELLED = 0, + SAVED, + DELETED +} + export class ProposalApplyDirectiveController implements IController { public static $inject = ['$scope', 'AuthenticationService', 'OrgCommonService', 'modalService']; public opportunity: IOpportunityResource; public proposal: IProposalResource; public org: IOrgResource; + public user: IUser; public userState: UserStates; public userStates = UserStates; @@ -37,11 +45,11 @@ export class ProposalApplyDirectiveController implements IController { this.proposal = $scope.proposal; this.org = $scope.org; this.userState = this.userStates.NOTHING; - + this.user = this.AuthenticationService.user; this.refreshDirective(); } - public async openProposalApplicationDialog(editing: boolean, proposalId?: string): Promise { + public async openProposalApplicationDialog(proposalId?: string): Promise { const modalResponse = await this.modalService.showModal({ size: 'lg', @@ -49,12 +57,21 @@ export class ProposalApplyDirectiveController implements IController { controller: ProposalEditCWUController, controllerAs: 'ppp', resolve: { - editing: () => editing, proposal: [ 'ProposalService', - (ProposalService: IProposalService) => { - if (!editing) { - return new ProposalService(); + async (ProposalService: IProposalService) => { + if (!proposalId) { + // create a new proposal, and immediately save, the proposal edit controller will handle cleaning up if the user opts not to save their draft + const proposal = new ProposalService(); + proposal.opportunity = this.opportunity; + + proposal.businessName = this.user.businessName; + proposal.businessAddress = this.user.businessAddress; + proposal.businessContactName = this.user.businessContactName; + proposal.businessContactEmail = this.user.businessContactEmail; + proposal.businessContactPhone = this.user.businessContactPhone; + const newProposal = await ProposalService.create(proposal).$promise; + return newProposal; } else { return ProposalService.get({ proposalId }).$promise; } @@ -88,7 +105,17 @@ export class ProposalApplyDirectiveController implements IController { } }); - this.$scope.proposal = modalResponse.proposal; + let action: ProposalModalActions = ProposalModalActions.CANCELLED; + if (modalResponse && modalResponse.action) { + action = modalResponse.action; + } + + if (action === ProposalModalActions.SAVED) { + this.$scope.proposal = modalResponse.proposal; + } else { + this.$scope.proposal = null; + } + this.refreshDirective(); } diff --git a/modules/proposals/client/views/proposal-apply.directive.html b/modules/proposals/client/views/proposal-apply.directive.html index 5c3bf8ea7..a67911b80 100644 --- a/modules/proposals/client/views/proposal-apply.directive.html +++ b/modules/proposals/client/views/proposal-apply.directive.html @@ -53,7 +53,7 @@
-
@@ -69,19 +69,19 @@  You can make updates or withdraw your Proposal until .  
-
+
 You have a Proposal in DRAFT!  Submit before to be considered for this opportunity.   diff --git a/modules/proposals/server/controllers/ProposalsServerController.ts b/modules/proposals/server/controllers/ProposalsServerController.ts index 8ec70134d..345a87e03 100644 --- a/modules/proposals/server/controllers/ProposalsServerController.ts +++ b/modules/proposals/server/controllers/ProposalsServerController.ts @@ -90,7 +90,7 @@ class ProposalsServerController { // administrator public async create(req: Request, res: Response): Promise { const proposal = new ProposalModel(req.body); - proposal.status = 'Draft'; + proposal.status = 'New'; proposal.user = req.user; // set the audit fields so we know who did what when From 4eff49eb8ff762c6319a26be6c47265ba43d10c3 Mon Sep 17 00:00:00 2001 From: Mark Wilson Date: Wed, 15 May 2019 15:49:01 -0700 Subject: [PATCH 03/25] BA-1152 // Remove tabs from CWU proposal --- .../client/views/cwu-proposal-edit.html | 109 +++++++----------- 1 file changed, 39 insertions(+), 70 deletions(-) diff --git a/modules/proposals/client/views/cwu-proposal-edit.html b/modules/proposals/client/views/cwu-proposal-edit.html index 4f1dcc311..da8802d1e 100644 --- a/modules/proposals/client/views/cwu-proposal-edit.html +++ b/modules/proposals/client/views/cwu-proposal-edit.html @@ -11,6 +11,8 @@
+ + - - - Company - -
-
+ - - - Proposal - -
-
- - - - Attachments - -
-
- - - - Terms - -
-
- - -
-
-
- - - - - -
-
-
+ + + +
+ +
+ + + +
+ + \ No newline at end of file From 32c412e4956918103039422b008e50b8a74d8ba8 Mon Sep 17 00:00:00 2001 From: Mark Wilson Date: Thu, 16 May 2019 09:46:24 -0700 Subject: [PATCH 04/25] BA-1156 // Remove 'Withdraw' option from CWU proposal --- modules/proposals/client/views/cwu-proposal-edit.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/proposals/client/views/cwu-proposal-edit.html b/modules/proposals/client/views/cwu-proposal-edit.html index da8802d1e..d5aabaf2e 100644 --- a/modules/proposals/client/views/cwu-proposal-edit.html +++ b/modules/proposals/client/views/cwu-proposal-edit.html @@ -49,9 +49,6 @@ -
From a66a3f3d599de248875f54584939f1742827cac7 Mon Sep 17 00:00:00 2001 From: Mark Wilson Date: Thu, 16 May 2019 09:55:59 -0700 Subject: [PATCH 05/25] BA-1157 // Restyle 'Delete proposal' button --- modules/proposals/client/views/cwu-proposal-edit.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/proposals/client/views/cwu-proposal-edit.html b/modules/proposals/client/views/cwu-proposal-edit.html index d5aabaf2e..263270f65 100644 --- a/modules/proposals/client/views/cwu-proposal-edit.html +++ b/modules/proposals/client/views/cwu-proposal-edit.html @@ -46,8 +46,8 @@ From 036f321e7266ba04c8418a9c19d589b0287e1989 Mon Sep 17 00:00:00 2001 From: Mark Wilson Date: Thu, 16 May 2019 11:23:25 -0700 Subject: [PATCH 07/25] BA-1158 // Add way to access CWU proposal after closing deadline Did some minor styling here, but some logic changes are needed so that the alert linking to a submitted proposal persists even after the closing deadline. --- .../views/proposal-apply.directive.html | 40 ++++++++----------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/modules/proposals/client/views/proposal-apply.directive.html b/modules/proposals/client/views/proposal-apply.directive.html index a67911b80..4b8918362 100644 --- a/modules/proposals/client/views/proposal-apply.directive.html +++ b/modules/proposals/client/views/proposal-apply.directive.html @@ -51,42 +51,34 @@
+
- - -
-
-   Your Proposal has been submitted! -  You can make updates or withdraw your Proposal until . -   - -
-
-
+ + + + +
-  You have a Proposal in DRAFT!  Submit before - - to be considered for this opportunity.   - + You have a proposal in draft. Submit before + + to be considered for this opportunity. View proposal
+
-
From 07aa55215bddb3ceafd6a3d1788f9e301f71fca3 Mon Sep 17 00:00:00 2001 From: kvangorp Date: Mon, 10 Jun 2019 13:33:09 -0700 Subject: [PATCH 08/25] BA-1158: Enable users to view their CWU proposal after the closing deadline --- .../client/views/cwu-opportunity-view.html | 4 ++-- .../controllers/ProposalEditCWUController.ts | 14 ++++++++++++++ .../client/directives/ProposalApplyDirective.ts | 4 ++++ .../views/cwu-proposal-edit-attachments.html | 6 +++--- .../proposals/client/views/cwu-proposal-edit.html | 6 +++--- .../client/views/proposal-apply.directive.html | 15 ++++++++++----- 6 files changed, 36 insertions(+), 13 deletions(-) diff --git a/modules/opportunities/client/views/cwu-opportunity-view.html b/modules/opportunities/client/views/cwu-opportunity-view.html index 5463cae67..791f09cb2 100644 --- a/modules/opportunities/client/views/cwu-opportunity-view.html +++ b/modules/opportunities/client/views/cwu-opportunity-view.html @@ -129,9 +129,9 @@
-
+
- +
diff --git a/modules/proposals/client/controllers/ProposalEditCWUController.ts b/modules/proposals/client/controllers/ProposalEditCWUController.ts index b16d090e1..113f42ca1 100644 --- a/modules/proposals/client/controllers/ProposalEditCWUController.ts +++ b/modules/proposals/client/controllers/ProposalEditCWUController.ts @@ -34,6 +34,7 @@ export default class ProposalEditCWUController { public proposalForm: IFormController; private user: IUser; + private isclosed: boolean; constructor( private $scope: IRootScopeService, @@ -55,6 +56,12 @@ export default class ProposalEditCWUController { // set the user this.user = this.AuthenticationService.user; + + this.init(); + } + + private async init(){ + this.isclosed = await this.isClosed(); } // Format dates to always be in PST (America/Vancouver timezone) @@ -254,6 +261,13 @@ export default class ProposalEditCWUController { } } + // Determine whether the deadline for the opportunity has passed + public async isClosed(){ + const response = await this.OpportunitiesService.getDeadlineStatus({ opportunityId: this.opportunity._id }).$promise; + return response.deadlineStatus === 'CLOSED'; + } + + // Determine whether the deadline for the opportunity has passed and send an error if it has private async checkDeadline(): Promise { // Check with server to ensure deadline hasn't passed const response = await this.OpportunitiesService.getDeadlineStatus({ opportunityId: this.opportunity._id }).$promise; diff --git a/modules/proposals/client/directives/ProposalApplyDirective.ts b/modules/proposals/client/directives/ProposalApplyDirective.ts index 71be1b656..a865c8136 100644 --- a/modules/proposals/client/directives/ProposalApplyDirective.ts +++ b/modules/proposals/client/directives/ProposalApplyDirective.ts @@ -15,6 +15,7 @@ interface IProposalApplyScope extends IScope { opportunity: IOpportunityResource; proposal?: IProposalResource; org: IOrgResource; + isclosed: boolean; } enum UserStates { @@ -34,6 +35,7 @@ export enum ProposalModalActions { export class ProposalApplyDirectiveController implements IController { public static $inject = ['$scope', 'AuthenticationService', 'OrgCommonService', 'modalService']; public opportunity: IOpportunityResource; + public isclosed: boolean; public proposal: IProposalResource; public org: IOrgResource; public user: IUser; @@ -42,6 +44,7 @@ export class ProposalApplyDirectiveController implements IController { constructor(private $scope: IProposalApplyScope, private AuthenticationService: IAuthenticationService, private OrgCommonService: IOrgCommonService, private modalService: any) { this.opportunity = $scope.opportunity; + this.isclosed = $scope.isclosed; this.proposal = $scope.proposal; this.org = $scope.org; this.userState = this.userStates.NOTHING; @@ -156,6 +159,7 @@ angular.module('proposals').directive('proposalApply', () => { templateUrl: '/modules/proposals/client/views/proposal-apply.directive.html', scope: { opportunity: '=', + isclosed: '=', proposal: '=', org: '=' }, diff --git a/modules/proposals/client/views/cwu-proposal-edit-attachments.html b/modules/proposals/client/views/cwu-proposal-edit-attachments.html index d78181472..753840e6f 100644 --- a/modules/proposals/client/views/cwu-proposal-edit-attachments.html +++ b/modules/proposals/client/views/cwu-proposal-edit-attachments.html @@ -1,6 +1,6 @@
-
Upload any supporting material here.
-
+
Upload any supporting material here.
+
Upload a file   Max 3 MB per file
@@ -14,7 +14,7 @@ {{file.name}} - + diff --git a/modules/proposals/client/views/cwu-proposal-edit.html b/modules/proposals/client/views/cwu-proposal-edit.html index 7317317a2..eebd3aa0c 100644 --- a/modules/proposals/client/views/cwu-proposal-edit.html +++ b/modules/proposals/client/views/cwu-proposal-edit.html @@ -1,5 +1,5 @@ -