@@ -5,6 +5,8 @@ import { ErrorMessagesService } from '../../_messages/error-messages.service';
55import { ProgressSpinnerService } from '../../_messages/progress-spinner.service' ;
66import { ReferenceComponent } from '../reference/reference.component' ;
77
8+ declare const PCore : any ;
9+
810@Component ( {
911 selector : 'app-assignment' ,
1012 templateUrl : './assignment.component.html' ,
@@ -44,6 +46,7 @@ export class AssignmentComponent implements OnInit {
4446 init : boolean ;
4547 finishAssignment : any ;
4648 navigateToStep : any ;
49+ saveAssignment : any ;
4750 cancelAssignment : any ;
4851 cancelCreateStageAssignment : any ;
4952 showPage : any ;
@@ -183,6 +186,7 @@ export class AssignmentComponent implements OnInit {
183186 // store off bound functions to above pointers
184187 this . finishAssignment = actionsAPI . finishAssignment . bind ( actionsAPI ) ;
185188 this . navigateToStep = actionsAPI . navigateToStep . bind ( actionsAPI ) ;
189+ this . saveAssignment = actionsAPI . saveAssignment . bind ( actionsAPI ) ;
186190 this . cancelAssignment = actionsAPI . cancelAssignment . bind ( actionsAPI ) ;
187191 this . showPage = actionsAPI . showPage . bind ( actionsAPI ) ;
188192
@@ -267,6 +271,13 @@ export class AssignmentComponent implements OnInit {
267271 return arIndicies ;
268272 }
269273
274+ onSaveActionSuccess ( data ) {
275+ this . actionsAPI . cancelAssignment ( this . itemKey$ ) . then ( ( ) => {
276+ this . psService . sendMessage ( false ) ;
277+ this . PCore$ . getPubSubUtils ( ) . publish ( this . PCore$ . getConstants ( ) . PUB_SUB_EVENTS . EVENT_CANCEL ) ;
278+ } ) ;
279+ }
280+
270281 onActionButtonClick ( oData : any ) {
271282 this . buttonClick ( oData . action , oData . buttonType ) ;
272283 }
@@ -311,6 +322,26 @@ export class AssignmentComponent implements OnInit {
311322 }
312323 break ;
313324
325+ case 'saveAssignment' : {
326+ const caseID = this . pConn$ . getCaseInfo ( ) . getKey ( ) ;
327+ const assignmentID = this . pConn$ . getCaseInfo ( ) . getAssignmentID ( ) ;
328+ const savePromise = this . saveAssignment ( this . itemKey$ ) ;
329+
330+ savePromise
331+ . then ( ( ) => {
332+ const caseType = this . pConn$
333+ . getCaseInfo ( )
334+ . c11nEnv . getValue ( PCore . getConstants ( ) . CASE_INFO . CASE_TYPE_ID ) ;
335+ this . PCore$ . getPubSubUtils ( ) . publish ( "cancelPressed" ) ;
336+ this . onSaveActionSuccess ( { caseType, caseID, assignmentID } ) ;
337+ } )
338+ . catch ( ( ) => {
339+ this . psService . sendMessage ( false ) ;
340+ } ) ;
341+
342+ break ;
343+ }
344+
314345 case 'cancelAssignment' :
315346 this . bReInit = true ;
316347 this . erService . sendMessage ( 'dismiss' , '' ) ;
0 commit comments