imports/vx/both/code/util.js
/**
     * Extract report parameters from UI and return them in object form.
     *
     * @param {string} reportType Report type.
     * @return {object} Report parameter values object.
     */
Extract report parameters from UI and return them in object form.
@param {string} reportType Report type.
@return {object} Report parameter values object.
Extract report parameters from UI and return them in object form . @param { string } reportType Report type . @return { object } Report parameter values object .
reportParameterValues(reportType) {
        let reportParameterDefinitions = Util.reportParameterDefinitions(reportType)
        let timezone = Util.reportTimezone(reportType, Meteor.userId())
        let reportParameterValues = {}
        _.each(reportParameterDefinitions, reportParameterDefinition => {
            let component = UX.findComponentById(reportParameterDefinition.fieldName)
            if (!component) {
                OLog.error("util.js reportParameterValues unable to find component for fieldName=" + reportParameterDefinition.fieldName)
                return
            }
            switch (reportParameterDefinition.type) {
            case "DATE":
                switch (reportParameterDefinition.subtype) {
                case "START_OF_DAY":
                    reportParameterValues[reportParameterDefinition.fieldName] =
                        moment.tz(component.getValue(), timezone).startOf("day").toDate()
                    break
                case "END_OF_DAY":
                    reportParameterValues[reportParameterDefinition.fieldName] =
                        moment.tz(component.getValue(), timezone).endOf("day").toDate()
                    break
                }
                break
            default :
                reportParameterValues[reportParameterDefinition.fieldName] = component.getValue()
                break
            }
        })
        return reportParameterValues
    }
reportParameterValues ( reportType ) { let reportParameterDefinitions = Util . reportParameterDefinitions ( reportType ) let timezone = Util . reportTimezone ( reportType , Meteor . userId ( ) ) let reportParameterValues = { } _ . each ( reportParameterDefinitions , reportParameterDefinition => { let component = UX . findComponentById ( reportParameterDefinition . fieldName ) if ( ! component ) { OLog . error ( "util.js reportParameterValues unable to find component for fieldName=" + reportParameterDefinition . fieldName ) return } switch ( reportParameterDefinition . type ) { case "DATE" : switch ( reportParameterDefinition . subtype ) { case "START_OF_DAY" : reportParameterValues [ reportParameterDefinition . fieldName ] = moment . tz ( component . getValue ( ) , timezone ) . startOf ( "day" ) . toDate ( ) break case "END_OF_DAY" : reportParameterValues [ reportParameterDefinition . fieldName ] = moment . tz ( component . getValue ( ) , timezone ) . endOf ( "day" ) . toDate ( ) break } break default : reportParameterValues [ reportParameterDefinition . fieldName ] = component . getValue ( ) break } } ) return reportParameterValues }
Extract report parameters from UI and return them in object form.
Extract report parameters from UI and return them in object form .