"use strict";

var logger = require("log4js")
                .getLogger("itemsBuilder"),
    _ = require("lodash"),
    VError = require("verror"),
    moment = require("moment"),
    momentRange = require("moment-range"),
    PLANS = require("./importer.js").Importer.PLANS;

momentRange.extendMoment(moment);

var ItemsBuilder = function() {};

ItemsBuilder.RATE_TO_PLANS = {
    ANNUALFEE: PLANS.GENERIC_ANNUALLY,
    MONTHLYFEE: PLANS.GENERIC_MONTHLY,
    QUARTERLYFEE: PLANS.GENERIC_QUARTERLY
};

//TODO: move into separate file or configuration

ItemsBuilder.PERSONAL = {"Personal Plus": 1};

ItemsBuilder.STORAGE_PRORATION_CREDIT = {
    "Additional Storage: 10GB -- Proration Credit": 1,
    "Extra storage: 500 GB -- Proration Credit": 1,
    "Additional Storage: 500GB -- Proration Credit": 1
};

ItemsBuilder.STORAGE_PRORATION = {
import Moment from 'moment';
import { extendMoment } from 'moment-range';
import cssModules from 'react-css-modules';
import React from 'react';
import PropTypes from 'prop-types';
import momentPropTypes from 'react-moment-proptypes';
import SettingsEthernet from 'material-ui/svg-icons/action/settings-ethernet';
import _ from 'lodash';
import styles from './availability-grid.css';

const moment = extendMoment(Moment);

// calculate the numbers of cells to offset the hours grid
// since we only want display the full hours
const inicialOffSet = (allTimes) => {
  if (allTimes[0].minutes() !== 0) {
    return 4 - (allTimes[0].minutes() / 15);
  }
  return 0;
};

// depois
const cellForOffsetAfterjump = (jumpIndexAllTimes, allTimes) => {
  const nextfullHour = moment(allTimes[jumpIndexAllTimes]).startOf('hour').add(1, 'h');
  const numCells = nextfullHour.diff(moment(allTimes[jumpIndexAllTimes]), 'minutes') / 15;
  const cell = (numCells < 4) ? <div style={{ minWidth: `${numCells * 13}px` }} /> : null;
  return cell;
};

// antes
const sizeLastCellBeforeJump = (allTimes, jumpIndexAllTimes) => `${((((allTimes[jumpIndexAllTimes - 1].minute()) / 15) + 1) * 12.5)}px`;
Ejemplo n.º 3
0
import { extendMoment } from 'moment-range';
import jszip from 'jszip';

require( 'datatables.net' )();
require( 'datatables.net-bs' )();
require( 'datatables.net-responsive-bs' )(window, $);
require( 'datatables.net-buttons/js/dataTables.buttons.js' )(window, $);
require( 'datatables.net-buttons/js/buttons.html5.js' )(window, $, jszip);

require("datatables.net-bs/css/dataTables.bootstrap.css");
require("datatables.net-responsive-bs/css/responsive.bootstrap.css");

require("sweetalert2/dist/sweetalert2.css");

require('jquery-validation');

extendMoment(moment);
import origMoment from 'moment';
import { extendMoment } from 'moment-range';
const moment = extendMoment(origMoment);

export default moment;
import momentTimezone from "moment-timezone";
import { extendMoment } from "moment-range";

const moment = extendMoment(momentTimezone);

moment.tz.setDefault(INFOSCREEN_CONFIG.timezone);

const potentialLocales = [
  INFOSCREEN_CONFIG.locale,
  INFOSCREEN_CONFIG.locale.toLowerCase(),
  INFOSCREEN_CONFIG.locale.split("-")[0]
];

const locale = moment.locale(potentialLocales);

moment.updateLocale(locale, {
  calendar: INFOSCREEN_CONFIG.moment.calendar
});

export default {};