The common module bundles all common helpers together
- Copyright:
- CHECKROOM NV 2015
Methods
-
getActiveItems(items){Array}
-
getActiveItems
Name Type Description items
Array -
getAvailableItems(items){Array}
-
getAvailableItems
Name Type Description items
Array -
getAvatarInitial(name, size){string}
-
Returns an avatar image with the initials of the user source: http://codepen.io/leecrossley/pen/CBHca
Name Type Description name
string name for which to display the initials
size
string Possible values XS,S,M,L,XL
Returns:
image url
-
getCategoryKeyFromName(name){string}
-
Creates a category key from a friendly name
Name Type Description name
string -
getCategoryNameFromKey(key){string}
-
Creates a name from a category key
Name Type Description key
string -
getCategorySummary(items){string}
-
getCategorySummary
Name Type Description items
array -
getCheqRoomRedirectUrl(codeId){string}
-
getCheqRoomRedirectUrl
Name Type Description codeId
-
getCheqRoomRedirectUrlQR(codeId, size){string}
-
getCheqRoomRedirectUrlQR
Name Type Description codeId
size
-
getCheqRoomRedirectUrlQR(urlApi, code, size){string}
-
getQRCodeUrl
Name Type Description urlApi
string code
string size
number -
getCheqRoomRedirectUrlQR(urlApi, code, size){string}
-
getBarcodeUrl
Name Type Description urlApi
string code
string size
number -
getContactImageCDNUrl(){string}
-
getContactImageCDNUrl
Name Type Description cr.Contact
or contact object
Returns:
path or base64 image
-
getContactImageUrl(){string}
-
getContactImageUrl
Name Type Description cr.Contact
or contact object
Returns:
path or base64 image
-
getDocumentIds(docs){array}
-
getDocumentIds
Name Type Description docs
-
getFileNameFromUrl(url){string}
-
getFileNameFromUrl
Name Type Description url
-
getFriendlyConflictKind(kind){string}
-
getFriendlyConflictKind
Name Type Description kind
-
getFriendlyItemStatus(status){string}
-
getFriendlyItemStatus
Name Type Description status
-
getFriendlyKitStatus(status){string}
-
getFriendlyKitStatus
Name Type Description status
-
getFriendlyOrderCss(status){string}
-
getFriendlyOrderCss
Name Type Description status
string -
getFriendlyOrderDuration(transaction, dateHelper){string}
-
getFriendlyOrderDuration Gets a friendly duration for a given order
Name Type Description transaction
dateHelper
-
getFriendlyOrderSize(order){string}
-
getFriendlyOrderSize
Name Type Description order
object -
getFriendlyOrderStatus(status){string}
-
getFriendlyOrderStatus
Name Type Description status
string -
getFriendlyReservationCss(status){string}
-
getFriendlyReservationCss
Name Type Description status
string -
getFriendlyReservationDuration(transaction, dateHelper){string}
-
getFriendlyReservationDuration Gets a friendly duration for a given reservation
Name Type Description transaction
dateHelper
-
getFriendlyReservationFrequency(frequency){string}
-
getFriendlyReservationFrequency
Name Type Description frequency
string -
getFriendlyReservationStatus(status){string}
-
getFriendlyReservationStatus
Name Type Description status
string -
getFriendlyTemplateCss(status){string}
-
getFriendlyTemplateCss
Name Type Description status
string -
getFriendlyTemplateSize(width, height, unit){string}
-
getFriendlyTemplateSize
Name Type Description width
float height
float unit
string -
getFriendlyTemplateStatus(status){string}
-
getFriendlyTemplateStatus
Name Type Description status
string -
getIconAvatar(size){string}
-
Returns an icon avatar image from FontAwesome collection
Name Type Description size
string Possible values XS,S,M,L,XL
Returns:
image url
-
getImageCDNUrl(settings, groupId, attachmentId, size){string}
-
getImageCDNUrl
Name Type Description settings
groupId
attachmentId
size
-
getImageUrl(ds, pk, size, bustCache){string}
-
getImageUrl
Name Type Description ds
pk
size
bustCache
-
getImgFileNameFromName(name){string}
-
getImgFileNameFromName
Name Type Description name
-
getItemIds(items){array}
-
getItemIds
Name Type Description items
-
getItemsByStatus(items, comparator){Array}
-
getItemsByStatus
Name Type Description items
Array comparator
string | function -
getItemStatusCss(status){string}
-
getItemStatusCss
Name Type Description status
-
getItemStatusIcon(status){string}
-
getItemStatusIcon
Name Type Description status
-
getItemSummary(items){string}
-
getItemSummary
Works much like getCategorySummary but prefers making summaries with kit names in it
Name Type Description items
array -
getKitIds(items){array}
-
getKitIds
Name Type Description items
-
getKitStatus(status){string}
-
getKitStatus Available => if all items in the kit are available Checking out => if all item in the kit is checking out Checked out => if all item in the kit is checked out Expired => if all item in the kit is expired Unknown => if not all items in the kit have the same status
Name Type Description status
-
getKitStatusCss(status){string}
-
getKitStatusCss
Name Type Description status
-
getMaintenanceAvatar(size){string}
-
Returns an maintenace avatar image
Name Type Description size
string Possible values XS,S,M,L,XL
Returns:
image url
-
getOrderCss(order, now){string}
-
getOrderCss
Name Type Description order
object now
moment -
getOrderDuration(){duration}
-
getOrderDuration Gets a moment duration object
-
getOrderStatus(order, now){string}
-
getOrderStatus
Name Type Description order
object now
moment -
getReservationCss(reservation){string}
-
getReservationCss
Name Type Description reservation
object -
getReservationDuration(transaction){duration}
-
getReservationDuration Return a Moment duration for a given reservation
Name Type Description transaction
-
getTransactionSummary(transaction, emptyText){string}
-
getTransactionSummary Return a friendly summary for a given transaction or custom name
Name Type Description transaction
object emptyText
string -
getUserImageCDNUrl(){string}
-
getUserImageCDNUrl
Name Type Description cr.User
or user object
Returns:
path or base64 image
-
getUserImageUrl(){string}
-
getUserImageUrl
Name Type Description cr.User
or user object
Returns:
path or base64 image
-
isCodeFromScanner(urlPart){Boolean}
-
isCodeFromScanner
Name Type Description urlPart
-
isCodeValid(codeId){Boolean}
-
isCodeValid
Name Type Description codeId
-
isFreeEmail(email){boolean}
-
isFreeEmail
Name Type Description email
-
isNumeric(value, onlyInteger){Boolean}
-
isNumeric https://stackoverflow.com/questions/18082/validate-decimal-numbers-in-javascript-isnumeric
Name Type Description value
string onlyInteger
boolean -
isOrderArchived(order){Boolean}
-
isOrderArchived
Name Type Description order
object -
isOrderOverdue(order, now){Boolean}
-
isOrderOverdue
Name Type Description order
object now
moment -
isReservationArchived(reservation){Boolean}
-
isReservationArchived
Name Type Description reservation
object -
isReservationInThePast(reservation, now){Boolean}
-
isReservationInThePast
Name Type Description reservation
object now
moment -
isReservationOverdue(reservation, now){Boolean}
-
isReservationOverdue
Name Type Description reservation
object now
moment -
isValidBarcode(barCode){Boolean}
-
isBarcodeValid
Name Type Description barCode
string -
isValidDate(value){Boolean}
-
isValidDate
Name Type Description value
string -
isValidDocQRCode(qrCode){Boolean}
-
isValidDocQRCode For example: http://cheqroom.com/qr/eeaa37ed
Name Type Description qrCode
string -
isValidEmail(email){Boolean}
-
isValidEmail
Name Type Description email
string -
isValidItemQRCode(qrCode){Boolean}
-
isValidItemQRCode
Name Type Description qrCode
string -
isValidKitQRCode(qrCode){Boolean}
-
isValidKitQRCode
Name Type Description qrCode
string -
isValidPassword(password){boolean}
-
isValidPassword
Name Type Description password
-
isValidPhone(phone){Boolean}
-
isValidPhone
Name Type Description phone
string -
isValidQRCode(qrCode){Boolean}
-
isValidQRCode
Name Type Description qrCode
string -
isValidTransferQRCode(qrCode){Boolean}
-
isValidTransferQRCode For example: http://cheqroom.com/ordertransfer/tTfZXW6eTianQU3UQVELdn
Name Type Description qrCode
string -
isValidURL(url){boolean}
-
isValidURL
Name Type Description url
string -
kitCanCheckout(kit){boolean}
-
Checks if a kit can be checked out (any items available)
Name Type Description kit
-
kitCanReleaseCustody(kit){boolean}
-
Checks if custody can be released for a kit (based on status)
Name Type Description kit
-
kitCanReserve(kit){boolean}
-
Checks if a kit can be reserved (any items active)
Name Type Description kit
-
kitCanTakeCustody(kit){boolean}
-
Checks if custody can be taken for a kit (based on status)
Name Type Description kit
-
kitCanTransferCustody(kit){boolean}
-
Checks if custody can be transferred for a kit (based on status)
Name Type Description kit
-
makeFileNameJpg(name){string}
-
makeFileNameJpg
Name Type Description name
-
searchDocument(doc, value, fields)
-
Checks if a given object (document) contains given value
Name Type Description doc
value
fields