2019-01-19 21:55:06 +01:00
|
|
|
import { WorkflowState } from 'app/shared/models/motions/workflow-state';
|
2019-01-17 17:13:34 +01:00
|
|
|
import { ViewMotion } from './view-motion';
|
2018-11-30 09:24:07 +01:00
|
|
|
import { CreateMotion } from './create-motion';
|
2019-02-01 13:56:08 +01:00
|
|
|
import { ViewUser } from 'app/site/users/models/view-user';
|
|
|
|
import { ViewMotionBlock } from './view-motion-block';
|
|
|
|
import { ViewItem } from 'app/site/agenda/models/view-item';
|
|
|
|
import { ViewCategory } from './view-category';
|
|
|
|
import { ViewWorkflow } from './view-workflow';
|
2018-11-30 09:24:07 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create motion class for the View. Its different to ViewMotion in fact that the submitter handling is different
|
|
|
|
* on motion creation.
|
|
|
|
*
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
export class ViewCreateMotion extends ViewMotion {
|
|
|
|
protected _motion: CreateMotion;
|
|
|
|
|
|
|
|
public get motion(): CreateMotion {
|
|
|
|
return this._motion;
|
|
|
|
}
|
|
|
|
|
2019-02-01 13:56:08 +01:00
|
|
|
public get submitters(): ViewUser[] {
|
2018-11-30 09:24:07 +01:00
|
|
|
return this._submitters;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get submitters_id(): number[] {
|
|
|
|
return this.motion ? this.motion.submitters_id : null;
|
|
|
|
}
|
|
|
|
|
2019-02-01 13:56:08 +01:00
|
|
|
public set submitters(users: ViewUser[]) {
|
2018-11-30 09:24:07 +01:00
|
|
|
this._submitters = users;
|
|
|
|
this._motion.submitters_id = users.map(user => user.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
public constructor(
|
|
|
|
motion?: CreateMotion,
|
2019-02-01 13:56:08 +01:00
|
|
|
category?: ViewCategory,
|
|
|
|
submitters?: ViewUser[],
|
|
|
|
supporters?: ViewUser[],
|
|
|
|
workflow?: ViewWorkflow,
|
2018-11-30 09:24:07 +01:00
|
|
|
state?: WorkflowState,
|
2019-02-01 13:56:08 +01:00
|
|
|
item?: ViewItem,
|
|
|
|
block?: ViewMotionBlock
|
2018-11-30 09:24:07 +01:00
|
|
|
) {
|
2019-01-17 17:13:34 +01:00
|
|
|
super(motion, category, submitters, supporters, workflow, state, item, block, null);
|
2018-11-30 09:24:07 +01:00
|
|
|
}
|
|
|
|
|
2019-02-08 16:02:46 +01:00
|
|
|
public getVerboseName = () => {
|
|
|
|
throw new Error('This should not be used');
|
|
|
|
};
|
|
|
|
|
2018-11-30 09:24:07 +01:00
|
|
|
/**
|
|
|
|
* Duplicate this motion into a copy of itself
|
|
|
|
*/
|
|
|
|
public copy(): ViewCreateMotion {
|
|
|
|
return new ViewCreateMotion(
|
|
|
|
this._motion,
|
|
|
|
this._category,
|
|
|
|
this._submitters,
|
|
|
|
this._supporters,
|
|
|
|
this._workflow,
|
|
|
|
this._state
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|