Preview:
import { i18n } from 'meteor/universe:i18n';

import SimpleSchema from 'simpl-schema';

import ModuleTypes from '../subTypes';

export default {
  available: true,
  price: () => 25,
  type: ModuleTypes.CONSUMER,
  settings: new SimpleSchema({
    minDuration: {
      label: () => i18n.__('modules.reservations.settings.minDuration'),
      type: SimpleSchema.Integer,
      defaultValue: 30, // Minutes
      min: 0,
    },
    maxDuration: {
      label: () => i18n.__('modules.reservations.settings.maxDuration'),
      type: SimpleSchema.Integer,
      defaultValue: 600, // Minutes
      optional: true,
      min: 1,
    },
    durationGranularity: {
      label: () => i18n.__('modules.reservations.settings.durationGranularity.label'),
      type: SimpleSchema.Integer,
      defaultValue: 30, // Minutes
      optional: true,
      min: 1,
      max: 30,
      uniforms: {
        options: () =>
          new Array(60 / 5 + 1).fill(0).map((_, i) => {
            const n = i * 5 || 1;

            return {
              label: `${n} ${i18n.__(`modules.reservations.settings.durationGranularity.${i === 1 ? 'minute' : 'minutes'}`)}`,
              value: n,
            };
          }),
      },
    },
    Capacity: {
      label: () => i18n.__('modules.reservations.settings.capacity'),
      type: SimpleSchema.Integer,
      defaultValue: 1, // number of reservations
      optional: true,
      min: 0,
    },
    maxPeople: {
      label: () => i18n.__('modules.reservations.settings.maxPeople'),
      type: SimpleSchema.Integer,
      defaultValue: 12,
      min: 1,
    },
    minPeople: {
      label: () => i18n.__('modules.reservations.settings.minPeople'),
      type: SimpleSchema.Integer,
      defaultValue: 1,
      optional: true,
      min: 1,
    },
    minStartDate: {
      label: () => i18n.__('modules.reservations.settings.minStartDate'),
      type: SimpleSchema.Integer,
      defaultValue: 20, // Minutes
      optional: true,
      min: 0,
    },
    maxStartDate: {
      label: () => i18n.__('modules.reservations.settings.maxStartDate'),
      type: SimpleSchema.Integer,
      defaultValue: 365, // Year
      optional: true,
      min: 1,
    },
    managerIds: {
      label: () => i18n.__('modules.reservations.settings.managers'),
      type: Array,
      defaultValue: [],
      optional: true,
    },
    'managerIds.$': {
      type: String,
    },
    reminderEmailOffsetInHours: {
      helpText: () => i18n.__('modules.reservations.settings.reminderEmailOffset.help'),
      label: () => i18n.__('modules.reservations.settings.reminderEmailOffset.label'),
      type: SimpleSchema.Integer,
      defaultValue: 24,
      optional: true,
      min: -1,
      max: 31,
    },
    reservationInstructions: {
      label: () => i18n.__('modules.reservations.settings.reservationInstructions'),
      type: String,
      optional: true,
      uniforms: {
        multiline: true,
      },
    },
    approvalInstructions: {
      label: () => i18n.__('modules.reservations.settings.approvalInstructions'),
      type: String,
      optional: true,
      uniforms: {
        multiline: true,
      },
    },
  }),
};
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter