-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathadjustment_block.py
58 lines (53 loc) · 2.65 KB
/
adjustment_block.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 30 13:56:20 2018
@author: agarw
"""
import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html
from datetime import datetime as dt
def add_adj_block(number_of_adj):
'''
'''
adj_block = []
dash_dependencies_Input = []
for i in range(number_of_adj-1):
one_adj_block(adj_block, adj_block_number=i, final_adj_block=0)
dash_dependencies_Input.append(dash.dependencies.Input('adj-input-' + str(int(i)), 'value'))
one_adj_block(adj_block, adj_block_number=i+1, final_adj_block=1)
dash_dependencies_Input.append(dash.dependencies.Input('adj-input-' + str(int(i+1)), 'value'))
return adj_block, dash_dependencies_Input
def one_adj_block(listadjelements, adj_block_number=0, final_adj_block=1):
'''
'''
print('----->>> creating adj block number' + str(adj_block_number))
if final_adj_block == 1:
listadjelements.append(
html.Div(children=[html.Label('Forecast Adj-' + str(int(adj_block_number+1))),
dcc.DatePickerRange(id = 'datepicker-' + str(int(adj_block_number)),
start_date_placeholder_text="Start Period",
end_date_placeholder_text="End Period",
calendar_orientation='horizontal',
clearable=True,
with_portal=True,
start_date=dt.now()),
dcc.Input(id='adj-input-' + str(int(adj_block_number)), type='text'),
], id='adj-master-block-' + str(int(adj_block_number)), style={'display': 'none', 'fontSize': '8'})
)
listadjelements.append(html.Button('Adj Forecast', id='adj-forecast', style={'display': 'none'}))
else:
listadjelements.append(
html.Div(children=[html.Label('Forecast Adj-' + str(int(adj_block_number+1))),
dcc.DatePickerRange(id = 'datepicker-' + str(int(adj_block_number)),
start_date_placeholder_text="Start Period",
end_date_placeholder_text="End Period",
calendar_orientation='horizontal',
clearable=True,
with_portal=True,
start_date=dt.now()),
dcc.Input(id='adj-input-' + str(int(adj_block_number)), type='text'),
], id='adj-master-block-' + str(int(adj_block_number)), style={'display': 'none', 'fontSize': '8px'})
)
return listadjelements