API Docs for: 2.6
Show:

customer_card Class

Module: customer_card

Provides the customer card functionalities.

Methods

config

(
  • path
)

Configures the module by using the specified JSON configuration file.

Parameters:

  • path String

    The path of the JSON configuration file

getAllCustomerCards

(
  • username
  • num
  • format
  • cb
)

Gets all authorized customer cards of the user and returns them in the specified format.

Parameters:

  • username String

    The identifier of the user

  • num String

    The number used to search the customer cards.

  • format String

    The format of the customer card data to be returned. It is contained in the data key of the returned object

  • cb Function

    The callback function

getCcIndexFromFilename

(
  • filename
)
String

Returns the customer card index from the customer card filename.

Parameters:

  • filename String

    The name of the file of the customer card template.

Returns:

String:

The customer card index.

getCcNameFromFilename

(
  • filename
)
String

Returns the customer card name from the customer card filename.

Parameters:

  • filename String

    The name of the file of the customer card template.

Returns:

String:

The customer card name.

getCustomerCardByNum

(
  • ccName
  • num
  • cb
)

Gets a customer card.

Parameters:

  • ccName String

    The name of the customer card to search

  • num String

    The number used to search the customer card.

  • cb Function

    The callback function

getCustomerCardHTML

(
  • name
  • data
)
String private

Return the customer card in HTML format.

Parameters:

  • name String

    The customer card name

  • data Array

    The customer card data

Returns:

String:

The customer card in HTML format or an empty string in error case.

initEjsTemplates

() private

Initializes the ejs templates used to render the customer cards. The default templates are in the DEFAULT_TEMPLATES_DIR but the templates present in customTemplatesPath are more priority.

setCompAuthorization

(
  • ca
)

Set the authorization architect component used by customer card functions.

Parameters:

  • ca Object

    The authorization architect component.

setDbconn

(
  • dbConnMod
)

Set the module to be used for database functionalities.

Parameters:

  • dbConnMod Object

    The dbconn module.

setLogger

(
  • log
)
static

Set the logger to be used.

Parameters:

  • log Object

    The logger object. It must have at least three methods: info, warn and error as console object.

start

()

Initialize the ejs templates used to render the customer cards.

Properties

compAuthorization

Object private

The authorization architect component used for customer card functions.

customTemplatesPath

String private

The directory path of the custom templates used by the customer card component. All templates in this path are more priority than the default ones.

dbconn

Object private

The dbconn module.

DEFAULT_TEMPLATES_DIR

String private final

The default directory of the customer cards templates.

Default: "templates/locales/it"

ejsTemplates

Object private

All the ejs templates used for the customer cards. The keys are the name of the customer card and the values are objects. These objects have two keys:

  • index: the sequence used to show the customer card in order
  • content: the content of the customer card

IDLOG

String private final

The module identifier used by the logger.

Default: [customer_card]

logger

Object private

The logger. It must have at least three methods: info, warn and error.

Default: console

TEMPLATE_EXTENSION

String private final

The default file extension of the customer cards templates.

Default: ".ejs"