Manual Reference Source Test
public class | source

ConsentApprover

Helper class representing approvers that have been created. Allows for approvers to be selected for consenting on a form or template.

Example:

// To get a list of ConsentApprovers use clinical6.get
import { clinical6, ConsentApprover } from 'clinical6';
clinical6.get(ConsentApprover).then(c => console.log(c));

// To get a single ConsentApprover, you can also use clinical6
clinical6.get({ id: 5, type: 'consent_approvers'});

// To save or insert, you can either use the .save() capability or clinical6
myConsentApprover.save(); // insert if no id, save if id
clinical6.insert(new ConsentApprover({...}));
clinical6.update(myConsentApprover);

// Typically use clinical6.get()
clinical6.get(ConsentApprover).then(consentApprover => console.log(consentApprover));

const consentApprover = new ConsentApprover({
  data: {
   id: 14,
   type: 'consent__approvers',
   attributes: {
     first_name: 'Snoop',
     last_name: 'Dogg',
     email: 'email@address.com',
     password: 'password',
     title: 'title'
   },
   relationships: {
     consent_form_version: {
       data: {
         id: 1,
         type: 'consent__form_versions'
       }
     }
   }
 }
});

Test:

Static Member Summary

Static Public Members
public static get

Constructor Summary

Public Constructor
public

Constructor for helper class representing a Consent Approver

Member Summary

Public Members
public get
public set
public get
public set

Method Summary

Public Methods
public

Deletes an approver

public

Saves a consent approver (insert if id doesn't exist, update if it does)

Inherited Summary

From class ConsentApproverModel
public
public
public
public
public
public

Static Public Members

public static get type: String source

Public Constructors

public constructor(json: Object) source

Constructor for helper class representing a Consent Approver

Override:

ConsentApproverModel#constructor

Params:

NameTypeAttributeDescription
json Object

json api response from server

Public Members

public get approverGroups: ApproverGroup source

public set approverGroups: ApproverGroup[] source

public get consentFormVersion: ConsentFormVersion source

public set consentFormVersion: ConsentFormVersion source

Public Methods

public delete(): Promise<ConsentApprover> source

Deletes an approver

Return:

Promise<ConsentApprover>

Returns a promise via ajax call.

Example:

import { ConsentApprover, Client } from 'clinical6';

// Removes content from server and local storage
const consentApprover = new ConsentApprover({...});
consentApprover.delete();

// No longer in storage
Client.instance.storageUtility.has('consentApprover', { id: 1 });

Test:

public async save(): Promise<ConsentApprover> source

Saves a consent approver (insert if id doesn't exist, update if it does)

Return:

Promise<ConsentApprover>

Returns a promise via ajax call.

Example:

import { ConsentApprover, clinical6 } from 'clinical6';

// Inserts new consentApprover (no existing id)
const consentApprover = new ConsentApprover(
  "type": "consent__approvers",
  "attributes": {
    "first_name": "firstname",
    "last_name": "lastname",
    "email": "email"
  });

consentApprover.save();

// Updates existing consentApprover(has existing id)
clinical6.get(ConsentApprover).then(consentApprovers => consentApprovers[0].save());

Test: