Beispiel #1
0
def makeMortgageDivs(num_mortgages=3):
    mortgageComparison = mort.MortgageComparison()
    mortgageComparison.setDefaults(
        tvmRate='0.0%',
        mortgageRate='4.0%',
        downPayment='0.2',
        inflationRate='0.0%',
        rentalRate='0.0%',
        houseCost='$1',
    )

    num_mortgages = 3
    for i in range(num_mortgages):
        mortgageComparison.addMortgage(name='Mortgage {}'.format(i + 1))

    mortgageComparison.simulateMortgages()
    mGroups = []
    # Create column for global options
    mGlob = [html.H5('Common options')]
    for j, (glob, globC) in enumerate(zip(globs, globsC)):
        mGlob += [
            html.Label(glob, className='field-label'),
            dcc.Input(
                id='{}'.format(globC),
                value=str(
                    getattr(mortgageComparison.mortgages[0], globC).value),
                type='text',
            )
        ]
    mGroups.append(html.P(mGlob, className='pinput pretty-container'))
    for i, mortgage in enumerate(mortgageComparison.mortgages):
        mInput = [
            #html.H5(mortgage.name, style={'color':rgb2hex(mortgage.color)}, className='mortgage-name')
            dcc.Input(mortgage.name,
                      style={'color': rgb2hex(mortgage.color)},
                      className='mortgage-name')
        ]
        for j, (field, fieldC) in enumerate(zip(fields, fieldsC)):
            mInput += [
                html.Label(field, className='field-label'),
                dcc.Input(
                    id='{}{}'.format(fieldC, i),
                    value=str(getattr(mortgage, fieldC).value),
                    type='text',
                )
            ]
        mGroups.append(html.Div(mInput, className='pinput pretty-container'))
    return html.Div(mGroups, className='input-wrapper'),
Beispiel #2
0
    def reorder_list(self):
        activeList = []
        inactiveList = []
        for div in self.divsList:
            if div.active:
                activeList.append(div)
            else:
                inactiveList.append(div)
        self.divsList = activeList + inactiveList


max_input_boxes = 6
init_input_boxes = 2
# Create mortgages
mortgageComparison = mort.MortgageComparison()
# Set defaults
mortgageComparison.setDefaults(
    tvmRate='0.0%',
    mortgageRate='4.0%',
    downPayment='0.2',
    inflationRate='0.0%',
    rentalRate='0.0%',
    houseCost='$1',
)

inputBoxes = InputBoxes()
for i in range(max_input_boxes):
    if i < init_input_boxes:
        active = True
    else: