Manual Reference Source Test
import Location from 'clinical6/src/helpers/Location.js'
public class | source

Location

Expression Extends:

class Location extends aggregate(LocationModel, Helper)

Helper class representing a location object. Location must have, at a minimum, one of the following:

  • latitude and longitude OR
  • country, state, ZIP code, city, and address

Test:

Static Member Summary

Static Public Members
public static get

Constructor Summary

Public Constructor
public

Constructor for helper class representing a Location

Member Summary

Public Members
public get
public set

Method Summary

Public Methods
public

async save(): Promise<Location>

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

public

toJSON(): *

Static Public Members

public static get type: String source

Public Constructors

public constructor(json: Object) source

Constructor for helper class representing a Location

Params:

NameTypeAttributeDescription
json Object

json api response from server

Public Members

public get localizable: Object source

public set localizable: Object source

Public Methods

public async save(): Promise<Location> source

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

Return:

Promise<Location>

Returns a promise via ajax call.

Example:

import { Location, clinical6 } from 'clinical6';

// Inserts new role (no existing id)
const location = new Location({
  "title": "Test Location",
  "address_line_1": "New Hospital",
  "address_line_3": "Unit #59",
  "city": "Poway",
  "state": "CA",
  "country": "USA",
  "zip_code": "92064"
});
location.save();

// Updates existing location(has existing id)
clinical6.get(Location).then(locations => locations[0].save());

Test:

public toJSON(): * source

Return:

*