Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,6 @@
|
|
| 2 |
from __future__ import annotations
|
| 3 |
|
| 4 |
from datetime import datetime, date, time
|
| 5 |
-
import base64
|
| 6 |
|
| 7 |
import pandas as pd
|
| 8 |
import streamlit as st
|
|
@@ -12,92 +11,101 @@ from ppt_fill import fill_ppt
|
|
| 12 |
|
| 13 |
st.set_page_config(page_title="Reports 940", layout="centered")
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
-
center_b64 = get_base64_image("assets/center_logo.png")
|
| 18 |
-
amanah_b64 = get_base64_image("assets/amanah_logo.png")
|
| 19 |
-
|
| 20 |
-
page_css = f"""
|
| 21 |
<style>
|
| 22 |
-
.stAppViewContainer {
|
| 23 |
position: relative;
|
| 24 |
background: linear-gradient(to bottom, #043548 0%, #02141e 55%, #01080c 100%);
|
| 25 |
background-attachment: fixed;
|
| 26 |
-
}
|
| 27 |
|
| 28 |
-
main .block-container {
|
| 29 |
max-width: 900px;
|
| 30 |
-
padding-top:
|
| 31 |
-
}
|
| 32 |
|
| 33 |
-
[data-testid="stHeader"] {
|
| 34 |
background-color: rgba(0, 0, 0, 0);
|
| 35 |
-
}
|
| 36 |
|
| 37 |
-
.top-logos-
|
| 38 |
display: flex;
|
| 39 |
-
flex-direction: column;
|
| 40 |
-
align-items: center;
|
| 41 |
justify-content: center;
|
| 42 |
-
|
| 43 |
-
margin-bottom:
|
| 44 |
-
}
|
| 45 |
|
| 46 |
-
.vision-logo {
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
}
|
| 50 |
|
| 51 |
-
.
|
| 52 |
display: flex;
|
| 53 |
-
align-items: center;
|
| 54 |
justify-content: center;
|
| 55 |
-
|
| 56 |
-
|
|
|
|
| 57 |
|
| 58 |
-
.center-logo {
|
| 59 |
-
width: 260px;
|
| 60 |
height: auto;
|
| 61 |
-
|
|
|
|
| 62 |
|
| 63 |
-
.amanah-logo {
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
}
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
-
|
| 73 |
color: #ffffff !important;
|
| 74 |
-
}
|
| 75 |
</style>
|
| 76 |
"""
|
| 77 |
-
|
| 78 |
st.markdown(page_css, unsafe_allow_html=True)
|
| 79 |
|
| 80 |
st.markdown(
|
| 81 |
f"""
|
| 82 |
-
<div class="top-logos-
|
| 83 |
-
<img src="
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
</
|
| 88 |
</div>
|
| 89 |
""",
|
| 90 |
unsafe_allow_html=True,
|
| 91 |
)
|
| 92 |
|
| 93 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
uploaded_file = st.file_uploader("Upload file (Excel)", type=["xlsx"])
|
| 96 |
|
| 97 |
-
|
| 98 |
-
with
|
| 99 |
d_closed = st.date_input("Date", value=date.today())
|
| 100 |
-
with
|
| 101 |
t_closed = st.time_input("Time", value=time(8, 0))
|
| 102 |
|
| 103 |
CLOSED_DT = pd.Timestamp(datetime.combine(d_closed, t_closed))
|
|
@@ -122,8 +130,9 @@ if uploaded_file is not None:
|
|
| 122 |
)
|
| 123 |
with dl2:
|
| 124 |
st.download_button(
|
| 125 |
-
"Download PowerPoint
|
| 126 |
data=out_ppt.getvalue(),
|
| 127 |
file_name="report_balady.pptx",
|
| 128 |
mime="application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
| 129 |
)
|
|
|
|
|
|
| 2 |
from __future__ import annotations
|
| 3 |
|
| 4 |
from datetime import datetime, date, time
|
|
|
|
| 5 |
|
| 6 |
import pandas as pd
|
| 7 |
import streamlit as st
|
|
|
|
| 11 |
|
| 12 |
st.set_page_config(page_title="Reports 940", layout="centered")
|
| 13 |
|
| 14 |
+
VISION_URL = "https://huggingface.co/spaces/DAM20/Etmam/resolve/main/assets/vision2030_logo.png"
|
| 15 |
+
AMANAH_URL = "https://huggingface.co/spaces/DAM20/Etmam/resolve/main/assets/amanah_logo.png"
|
| 16 |
+
CENTER_URL = "https://huggingface.co/spaces/DAM20/Etmam/resolve/main/assets/center_logo.png"
|
| 17 |
|
| 18 |
+
page_css = """
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
<style>
|
| 20 |
+
.stAppViewContainer {
|
| 21 |
position: relative;
|
| 22 |
background: linear-gradient(to bottom, #043548 0%, #02141e 55%, #01080c 100%);
|
| 23 |
background-attachment: fixed;
|
| 24 |
+
}
|
| 25 |
|
| 26 |
+
main .block-container {
|
| 27 |
max-width: 900px;
|
| 28 |
+
padding-top: 7rem;
|
| 29 |
+
}
|
| 30 |
|
| 31 |
+
[data-testid="stHeader"] {
|
| 32 |
background-color: rgba(0, 0, 0, 0);
|
| 33 |
+
}
|
| 34 |
|
| 35 |
+
.top-logos-main {
|
| 36 |
display: flex;
|
|
|
|
|
|
|
| 37 |
justify-content: center;
|
| 38 |
+
margin-top: 2.5rem;
|
| 39 |
+
margin-bottom: 1.5rem;
|
| 40 |
+
}
|
| 41 |
|
| 42 |
+
.vision-logo {
|
| 43 |
+
height: 170px;
|
| 44 |
+
width: auto;
|
| 45 |
+
}
|
| 46 |
|
| 47 |
+
.middle-logos {
|
| 48 |
display: flex;
|
|
|
|
| 49 |
justify-content: center;
|
| 50 |
+
gap: 3rem;
|
| 51 |
+
margin-bottom: 3rem;
|
| 52 |
+
}
|
| 53 |
|
| 54 |
+
.center-logo {
|
|
|
|
| 55 |
height: auto;
|
| 56 |
+
width: 260px;
|
| 57 |
+
}
|
| 58 |
|
| 59 |
+
.amanah-logo {
|
| 60 |
+
height: 70px;
|
| 61 |
+
width: auto;
|
| 62 |
+
}
|
| 63 |
|
| 64 |
+
.title-block {
|
| 65 |
+
margin-bottom: 1.5rem;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.title-text {
|
| 69 |
+
font-size: 2.2rem;
|
| 70 |
+
font-weight: 700;
|
| 71 |
+
color: #ffffff;
|
| 72 |
+
}
|
| 73 |
|
| 74 |
+
h1, h2, h3, h4, h5, h6, p, label {
|
| 75 |
color: #ffffff !important;
|
| 76 |
+
}
|
| 77 |
</style>
|
| 78 |
"""
|
|
|
|
| 79 |
st.markdown(page_css, unsafe_allow_html=True)
|
| 80 |
|
| 81 |
st.markdown(
|
| 82 |
f"""
|
| 83 |
+
<div class="top-logos-main">
|
| 84 |
+
<img src="{VISION_URL}" class="vision-logo" />
|
| 85 |
+
</div>
|
| 86 |
+
<div class="middle-logos">
|
| 87 |
+
<img src="{CENTER_URL}" class="center-logo" />
|
| 88 |
+
<img src="{AMANAH_URL}" class="amanah-logo" />
|
| 89 |
</div>
|
| 90 |
""",
|
| 91 |
unsafe_allow_html=True,
|
| 92 |
)
|
| 93 |
|
| 94 |
+
st.markdown(
|
| 95 |
+
"""
|
| 96 |
+
<div class="title-block">
|
| 97 |
+
<span class="title-text">Reports 940</span>
|
| 98 |
+
</div>
|
| 99 |
+
""",
|
| 100 |
+
unsafe_allow_html=True,
|
| 101 |
+
)
|
| 102 |
|
| 103 |
uploaded_file = st.file_uploader("Upload file (Excel)", type=["xlsx"])
|
| 104 |
|
| 105 |
+
col1, col2 = st.columns(2)
|
| 106 |
+
with col1:
|
| 107 |
d_closed = st.date_input("Date", value=date.today())
|
| 108 |
+
with col2:
|
| 109 |
t_closed = st.time_input("Time", value=time(8, 0))
|
| 110 |
|
| 111 |
CLOSED_DT = pd.Timestamp(datetime.combine(d_closed, t_closed))
|
|
|
|
| 130 |
)
|
| 131 |
with dl2:
|
| 132 |
st.download_button(
|
| 133 |
+
"Download PowerPoint",
|
| 134 |
data=out_ppt.getvalue(),
|
| 135 |
file_name="report_balady.pptx",
|
| 136 |
mime="application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
| 137 |
)
|
| 138 |
+
|