import ConsentApprover from 'clinical6/src/helpers/consent/ConsentApprover.js'
ConsentApprover
Mixin Extends:
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'
}
}
}
}
});
Constructor Summary
Public Constructor | ||
public |
constructor(json: Object) 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 |
async save(): Promise<ConsentApprover> 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 |
|
Public Constructors
public constructor(json: Object) source
Constructor for helper class representing a Consent Approver
Override:
ConsentApproverModel#constructorParams:
Name | Type | Attribute | Description |
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
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 });
public async save(): Promise<ConsentApprover> source
Saves a consent approver (insert if id doesn't exist, update if it does)
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());