Class: Reservation

Reservation

Reservation

new Reservation()

Extends

Members

addBarcode

Adds a barcode

archive

Archive a transaction

canArchive

Checks if we can archive a transaction (based on status)

canGenerateDocument

Checks if we can generate a document for this reservation (based on status)

canUndoArchive

Checks if we can unarchive a transaction (based on status)

clearFlag

Clears the flag of an item

clearLabel

Clears the label of an item

setFlag

Sets the flag of an item

setLabel

Sets the label of an item

undoArchive

Undo archive of a transaction

updateFields

Update fields of a document

Methods

inherited addComment(comment, skipRead){promise}

Adds a comment by string

Name Type Description
comment
skipRead

inherited addItems(items, skipRead){promise}

addItems; adds a bunch of Items to the transaction using a list of item ids It creates the transaction if it doesn't exist yet

Name Type Description
items
skipRead

inherited attach(attachmentId, skipRead){promise}

attaches an Attachment object

Name Type Description
attachmentId
skipRead

canAddItems(){boolean}

Checks if items can be added to the reservation (based on status)

canCancel(){boolean}

Checks if the reservation can be cancelled

cancel(message, skipRead, skipErrorHandling){*}

Cancels the booked reservation and sets the status to cancelled

Name Type Description
message
skipRead
skipErrorHandling

cancelRepeat(message, skipRead, skipErrorHandling){*}

Cancels repeated reservations and sets the status to cancelled

Name Type Description
message
skipRead
skipErrorHandling

canDelete(){boolean}

Checks if the reservation can be deleted

canEdit(){boolean}

Checks if the reservation can be edited

canGoToOrder(){boolean}

Checks if the reservation has an order linked to it

canMakeOrder(){boolean}

Checks if the reservation can be turned into an order

canRemoveItems(){boolean}

Checks if items can be removed from the reservation (based on status)

canReserve(){boolean}

Checks if the reservation can be booked

canReserveAgain(){boolean}

Checks if the reservation can be reserved again (based on status)

canReserveRepeat(){boolean}

Checks if the reservation can be into recurring reservations (based on status)

canSwapItems(){boolean}

Checks if items can be swapped in the reservation (based on status)

canUndoReserve(){boolean}

Checks if the reservation can be undone (based on status)

inherited clearContact(skipRead){promise}

Clears the contact for this transaction

Name Type Description
skipRead

skip parsing the returned json response into the transaction

inherited clearCover(skipRead){promise}

Clears the cover image

Name Type Description
skipRead

inherited clearDueDate(skipRead){promise}

Clear the transaction due date

Name Type Description
skipRead

inherited clearField(field, skipRead)

Clears a custom field

Name Type Description
field
skipRead

clearFromDate(skipRead){*}

Clear the reservation from date

Name Type Description
skipRead

inherited clearItems(skipRead){promise}

clearItems; removes all Items from the transaction It deletes the transaction if it's empty afterwards and autoCleanup is true

Name Type Description
skipRead

inherited clearLocation(skipRead){promise}

Clears the location for this transaction

Name Type Description
skipRead

skip parsing the returned json response into the transaction

inherited clearName(skipRead){promise}

Clears transaction name

Name Type Description
skipRead

skip parsing the returned json response into the transaction

clearToDate(skipRead){*}

Clears the reservation to date

Name Type Description
skipRead

inherited create(skipRead){promise}

Creates an object by the default api.create

Name Type Description
skipRead

skips reading the response via _fromJson (false)

inherited delete(){promise}

Deletes an object by the default api.delete

inherited deleteComment(id, skipRead){promise}

Deletes a Comment by id

Name Type Description
id
skipRead

inherited detach(attachmentId, skipRead){promise}

detaches an Attachment by kvId (guid)

Name Type Description
attachmentId
skipRead

inherited discardChanges(){promise}

Discards any changes made to the object from the previously loaded raw response or resets it when no old raw response was found

inherited existsInDb(){boolean}

Checks if the document exists in the database

generateDocument(template, signature, skipRead){promise}

Generates a PDF document for the reservation

Name Type Description
template string

id

signature string

(base64)

skipRead bool

inherited get(_fields){promise}

Gets an object by the default api.get

Name Type Description
_fields

getDuration(){duration}

Gets a moment duration object

getFriendlyDuration(){string}

Gets a friendly order duration or empty string

inherited getMaxDate(){Moment}

DEPRECATED Gets the latest possible date to end this transaction

Returns:
date

inherited getMaxDateDue(){Moment}

Gets the highest possible due date, by default same as getMaxDateDue

inherited getMaxDateFrom(){Moment}

Gets the highest possible from date, by default years from now

inherited getMaxDateTo(){Moment}

Gets the highest possible to date, by default years from now

inherited getMinDate(){Moment}

DEPRECATED Gets the lowest possible date to start this transaction

Returns:
date

inherited getMinDateDue(){Moment}

Gets the lowest possible due date, by default same as getMinDateTo

inherited getMinDateFrom(){Moment}

Gets the lowest possible from date, by default now

inherited getMinDateTo(){Moment}

Gets the lowest possible to date, by default from +1 timeslot

inherited hasItems(itemIds){Array}

hasItems; Gets a list of items that are already part of the transaction

Name Type Description
itemIds

array of string values

inherited isDirty(){boolean}

Checks if the transaction is dirty and needs saving

inherited isEmpty(){boolean}

Checks if the transaction is empty

inherited isValid(){boolean}

Checks if the object is valid

makeOrder(skipErrorHandling){*}

Turns an open reservation into an order (which still needs to be checked out)

Name Type Description
skipErrorHandling

inherited reload(_fields){promise}

Reloads the object from db

Name Type Description
_fields

inherited removeItems(items, skipRead){promise}

removeItems; removes a bunch of Items from the transaction using a list of item ids It deletes the transaction if it's empty afterwards and autoCleanup is true

Name Type Description
items
skipRead

reserve(skipRead, skipErrorHandling){*}

Books the reservation and sets the status to open

Name Type Description
skipRead
skipErrorHandling

reserveAgain(fromDate, toDate, customer, location, skipRead){promise}

Creates a new, incomplete reservation with the same info as the original reservation but other fromDate, toDate Important; the response will be another Reservation document!

Name Type Description
fromDate
toDate
customer
location
skipRead

reserveRepeat(frequency, customer, location, until){promise}

Creates a list of new reservations with open status as the original reservation but other fromDate, toDate Important; the response will be a list of other Reservation documents

Name Type Description
frequency

(days, weeks, weekdays, months)

customer
location
until

inherited reset(){promise}

Resets the object

searchItems(params, useAvailabilies, onlyUnbooked){*}

Searches for Items that are available for this reservation

Name Type Description
params
useAvailabilies

(should always be true, we only use this flag for Order objects)

onlyUnbooked

inherited setContact(contactId, skipRead){promise}

Sets the contact for this transaction

Name Type Description
contactId
skipRead

skip parsing the returned json response into the transaction

inherited setCover(att, skipRead){promise}

Set the cover image to an Attachment

Name Type Description
att
skipRead

inherited setDueDate(date, skipRead){promise}

Set the transaction due date

Name Type Description
date
skipRead

inherited setField(field, value, skipRead){promise}

Sets a custom field

Name Type Description
field
value
skipRead

inherited setFields(fields, skipRead){promise}

Sets multiple custom fields in a single call

Name Type Description
fields
skipRead

setFromDate(date, skipRead){*}

setFromDate The from date must be: - bigger than minDate - smaller than maxDate - at least one interval before .to date (if set)

Name Type Description
date
skipRead

setFromToDate(from, to, skipRead){*}

Sets the reservation from / to dates in a single call

Name Type Description
from
to

(optional) if null, we'll take the default average checkout duration as due date

skipRead

inherited setLocation(locationId, skipRead){promise}

Sets the location for this transaction

Name Type Description
locationId
skipRead

skip parsing the returned json response into the transaction

inherited setName(name, skipRead){promise}

Sets transaction name

Name Type Description
name
skipRead

skip parsing the returned json response into the transaction

setToDate(date, skipRead){*}

setToDate The to date must be: - bigger than minDate - smaller than maxDate - at least one interval after the .from date (if set)

Name Type Description
date
skipRead

inherited suggestEndDate(m){*}

suggestEndDate, makes a new moment() object with a suggested end date, already rounded up according to the group.profile settings

Name Type Description
m Moment

a suggested end date for this transaction

inherited swapItem(fromItem, toItem, skipRead){promise}

swapItem; swaps one item for another in a transaction

Name Type Description
fromItem
toItem
skipRead

switchToOrder(){*}

Switch reservation to order

undoReserve(skipRead, skipErrorHandling){*}

Unbooks the reservation and sets the status to creating again

Name Type Description
skipRead
skipErrorHandling

inherited update(skipRead){promise}

Updates an object by the default api.update

Name Type Description
skipRead

skips reading the response via _fromJson (false)

inherited updateComment(id, comment, skipRead){promise}

Updates a comment by id

Name Type Description
id
comment
skipRead