File

src/lib/model/inbox-item.model.ts

Description

Items emitted by the inbox service

Index

Properties
Methods

Constructor

constructor(json: any)

Creates a new instance

Parameters :
Name Type Optional Description
json any no

The JSON object received from the backend. This will be used to construct the new inbox item instance

Properties

accepted
accepted: boolean
Type : boolean

Flag indicating whether or not the entry has been accepted

description
description: string
Type : string

Items description

duetime
duetime: Date
Type : Date

The date the item is due.

iconId
iconId: string
Type : string

Items icon ID

id
id: string
Type : string

Items ID

isdeputy
isdeputy: boolean
Type : boolean

Flag indicating that the current user got this task in substitute

received
received: Date
Type : Date

The date the item was received

sourceId
sourceId: string
Type : string

ID of the object that caused the inbox entry. In case of type SUBSCRIPTION and RESUBMISSION this is the id of the dms object, for type BPM it is a process id

target
target: any
Type : any
title
title: string
Type : string

Items title

type
type: string
Type : string

Items type ('BPM', 'RESUBMISSION', 'SUBSCRIPTION')

Static TYPE_BPM
TYPE_BPM: string
Type : string
Default value : 'BPM'
Static TYPE_RESUBMISSION
TYPE_RESUBMISSION: string
Type : string
Default value : 'RESUBMISSION'
Static TYPE_SUBSCRIPTION
TYPE_SUBSCRIPTION: string
Type : string
Default value : 'SUBSCRIPTION'

Methods

isOverdue
isOverdue()

Determines whether or not the inbox item is overdue

Returns : any

True when inbox item is overdue, false otherwise

import moment from 'moment';

/**
 * Items emitted by the inbox service
 */
export class InboxItem {

  public static TYPE_BPM = 'BPM';
  public static TYPE_RESUBMISSION = 'RESUBMISSION';
  public static TYPE_SUBSCRIPTION = 'SUBSCRIPTION';

  /**
   * Items ID
   */
  id: string;
  /**
   * Items title
   */
  title: string;
  /**
   * Items description
   */
  description: string;
  /**
   * Items type ('BPM', 'RESUBMISSION', 'SUBSCRIPTION')
   */
  type: string;
  /**
   * ID of the object that caused the inbox entry.
   * In case of type SUBSCRIPTION and RESUBMISSION this is the id of the dms object,
   * for type BPM it is a process id
   */
  sourceId: string;
  /**
   * Items icon ID
   */
  iconId: string;
  /**
   * Flag indicating whether or not the entry has been accepted
   */
  accepted: boolean;
  /**
   * Flag indicating that the current user got this task in substitute
   */
  isdeputy: boolean;
  /**
   * The date the item is due.
   */
  duetime: Date;
    /**
   * The date the item was received
   */
  received: Date;
  target: any;

  /**
   * Creates a new instance
   * @param json The JSON object received from the backend. This will be used to construct the new inbox item instance
   */
  constructor(json: any) {
    // todo: jsut use Object assign when backend changes are done
    // Object.assign(this, json);

    this.id = json.inboxentryid;
    this.title = json.title;
    this.description = json.description;
    this.type = json.type;
    this.sourceId = json.source ? json.source.id : null;
    this.iconId = json.target && json.target.icon ? json.target.icon.id : null;
    this.accepted = json.accepted;
    this.isdeputy = json.isdeputy;
    this.duetime = json.duetime;
    this.received = json.receivetime;
    this.target = json.target;
  }

  /**
   * Determines whether or not the inbox item is overdue
   * @returns True when inbox item is overdue, false otherwise
   */
  isOverdue() {
    return this.duetime && moment(this.duetime).isBefore(moment());
  }
}

/**
 * InboxState
 */
export interface InboxState {
  totalmessages: number;
  overduemessages: number;
  unreadmessages: number;
  calculationtime: Date;
}

results matching ""

    No results matching ""