Merge branch 'administativePages' of https://gitlab.com/kluppsoftware/smart-energia-web into administativePages
This commit is contained in:
commit
d880d2ddc9
@ -55,6 +55,7 @@
|
|||||||
"react-hook-form": "^7.32.2",
|
"react-hook-form": "^7.32.2",
|
||||||
"react-icons": "^4.3.1",
|
"react-icons": "^4.3.1",
|
||||||
"react-input-mask": "^2.0.4",
|
"react-input-mask": "^2.0.4",
|
||||||
|
"react-pdf-thumbnail": "^0.1.0",
|
||||||
"styled-components": "^5.3.5",
|
"styled-components": "^5.3.5",
|
||||||
"tinymce": "^6.0.3",
|
"tinymce": "^6.0.3",
|
||||||
"yup": "^0.32.11"
|
"yup": "^0.32.11"
|
||||||
|
|||||||
@ -49,7 +49,16 @@ export default function Chart({ title, data1, data2, label, subtitle, dataset1,
|
|||||||
datalabels: {
|
datalabels: {
|
||||||
display: true,
|
display: true,
|
||||||
color: barLabel? 'black' : "rgba(255, 255, 255, 0)",
|
color: barLabel? 'black' : "rgba(255, 255, 255, 0)",
|
||||||
formatter: Math.round,
|
formatter: (value, ctx) => {
|
||||||
|
let sum = 0;
|
||||||
|
const dataArr = ctx.chart.data.datasets[0].data;
|
||||||
|
dataArr.map(data => {
|
||||||
|
sum += data;
|
||||||
|
});
|
||||||
|
const result = `${parseFloat(value).toLocaleString('pt-br')}`
|
||||||
|
|
||||||
|
return value==null? null : result
|
||||||
|
},
|
||||||
anchor: "end",
|
anchor: "end",
|
||||||
offset: -20,
|
offset: -20,
|
||||||
align: "start",
|
align: "start",
|
||||||
|
|||||||
@ -78,7 +78,6 @@ export function LineBarChart2({ title, subtitle, data1, data2, data3, label, red
|
|||||||
|
|
||||||
const currentTime = new Date();
|
const currentTime = new Date();
|
||||||
|
|
||||||
|
|
||||||
const labels = label
|
const labels = label
|
||||||
|
|
||||||
const options: any = {
|
const options: any = {
|
||||||
@ -88,12 +87,21 @@ export function LineBarChart2({ title, subtitle, data1, data2, data3, label, red
|
|||||||
display: true,
|
display: true,
|
||||||
color: barLabel? 'black' : "rgba(255, 255, 255, 0)",
|
color: barLabel? 'black' : "rgba(255, 255, 255, 0)",
|
||||||
// backgroundColor: '#255488',
|
// backgroundColor: '#255488',
|
||||||
formatter: Math.round,
|
|
||||||
anchor: "end",
|
anchor: "end",
|
||||||
offset: -20,
|
offset: -20,
|
||||||
align: "start",
|
align: "start",
|
||||||
font: {
|
font: {
|
||||||
size: 12
|
size: 12
|
||||||
|
},
|
||||||
|
formatter: (value, ctx) => {
|
||||||
|
let sum = 0;
|
||||||
|
const dataArr = ctx.chart.data.datasets[0].data;
|
||||||
|
dataArr.map(data => {
|
||||||
|
sum += data;
|
||||||
|
});
|
||||||
|
const result = `${parseFloat(value).toLocaleString('pt-br')}`
|
||||||
|
|
||||||
|
return value==null? null : result
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
|
|||||||
@ -46,7 +46,7 @@ export function SingleBar({ title, subtitle, dataProps, label, dataset, barLabel
|
|||||||
sum += data;
|
sum += data;
|
||||||
});
|
});
|
||||||
const percentage = (dataProps[ctx.dataIndex].econ_percentual*100).toFixed(0)+"%";
|
const percentage = (dataProps[ctx.dataIndex].econ_percentual*100).toFixed(0)+"%";
|
||||||
const result = `${parseFloat(value).toFixed(0)}\n ${percentage}`
|
const result = `${parseFloat(value).toLocaleString('pt-br')}\n ${percentage}`
|
||||||
|
|
||||||
return value==null? null : result
|
return value==null? null : result
|
||||||
},
|
},
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import PageTitle from '../../../components/pageTitle/PageTitle'
|
|||||||
import { IndustryInfoView } from '../../../styles/layouts/industryInfo/IndustryInfoView'
|
import { IndustryInfoView } from '../../../styles/layouts/industryInfo/IndustryInfoView'
|
||||||
import InputUploadPdf from '../../../components/inputUploadPdf/inputUpload';
|
import InputUploadPdf from '../../../components/inputUploadPdf/inputUpload';
|
||||||
import { api } from '../../../services/api'
|
import { api } from '../../../services/api'
|
||||||
|
import PdfThumbnail from 'react-pdf-thumbnail';
|
||||||
|
|
||||||
import FormData from 'form-data';
|
import FormData from 'form-data';
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ export default function industryInfo({userName}: any) {
|
|||||||
const [pdf, setPdf] = useState<any>();
|
const [pdf, setPdf] = useState<any>();
|
||||||
function onChange(e) {
|
function onChange(e) {
|
||||||
setPdf(e.target.files[0])
|
setPdf(e.target.files[0])
|
||||||
|
console.log(pdf)
|
||||||
}
|
}
|
||||||
|
|
||||||
const [openSnackSuccess, setOpenSnackSuccess] = useState<boolean>(false);
|
const [openSnackSuccess, setOpenSnackSuccess] = useState<boolean>(false);
|
||||||
@ -70,17 +72,10 @@ export default function industryInfo({userName}: any) {
|
|||||||
<Header name={userName} />
|
<Header name={userName} />
|
||||||
<div className='title'>
|
<div className='title'>
|
||||||
<PageTitle title='Info Setorial' subtitle='Realize o upload da última versão de info setorial' />
|
<PageTitle title='Info Setorial' subtitle='Realize o upload da última versão de info setorial' />
|
||||||
<InputUploadView>
|
<form action="">
|
||||||
<div className="update">
|
<label htmlFor="">Escolher arquivo</label>
|
||||||
<form action="">
|
<input type="file" name='arquivo' id='arquivo' onChange={onChange}/>
|
||||||
<div className='testess'>
|
</form>
|
||||||
<label htmlFor="arquivo"> <p className='TitleButton'> Enviar PDF </p> </label>
|
|
||||||
<input type="file" name='arquivo' id='arquivo' onChange={onChange} />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</InputUploadView>
|
|
||||||
{/* <InputUploadPdf/> */}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<BasicButton onClick={() => handleCreateClient()} title='Atualizar'/>
|
<BasicButton onClick={() => handleCreateClient()} title='Atualizar'/>
|
||||||
|
|||||||
@ -52,7 +52,7 @@ export default function Dashboard({grossAnualGraph, grossAnualYears, grossMensal
|
|||||||
</GraphCard>
|
</GraphCard>
|
||||||
|
|
||||||
<GraphCard title='Economia Bruta Mensal' subtitle='Economia Bruta Estimada e Acumulada mensal - (Valores em R$)' singleBar>
|
<GraphCard title='Economia Bruta Mensal' subtitle='Economia Bruta Estimada e Acumulada mensal - (Valores em R$)' singleBar>
|
||||||
<SingleBar title='Economia Bruta Estimada e Acumulada' subtitle='(Valores em R$)'
|
<SingleBar title='' subtitle=''
|
||||||
dataset='Acumulada'
|
dataset='Acumulada'
|
||||||
dataProps={grossMensalGraph}
|
dataProps={grossMensalGraph}
|
||||||
label={grossMensalYears}
|
label={grossMensalYears}
|
||||||
|
|||||||
@ -36,10 +36,10 @@ export default function Home() {
|
|||||||
const [state, setstate] = useState(false);
|
const [state, setstate] = useState(false);
|
||||||
|
|
||||||
const [values, setValues] = useState({
|
const [values, setValues] = useState({
|
||||||
|
|
||||||
password: null,
|
password: null,
|
||||||
showPassword: false,
|
showPassword: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [email, setEmail] = useState<string>("")
|
const [email, setEmail] = useState<string>("")
|
||||||
const [password, setPassword] = useState<string>()
|
const [password, setPassword] = useState<string>()
|
||||||
|
|
||||||
|
|||||||
@ -130,6 +130,39 @@ export default function pld({tableData, graphByHourData, graphByMonthData, userN
|
|||||||
|
|
||||||
const dateFormated = new Date()
|
const dateFormated = new Date()
|
||||||
|
|
||||||
|
function downloadCSVFile(csv, filename) {
|
||||||
|
const csv_file = new Blob([csv], {type: "text/csv"});
|
||||||
|
|
||||||
|
const download_link = document.createElement("a");
|
||||||
|
|
||||||
|
download_link.download = filename;
|
||||||
|
|
||||||
|
download_link.href = window.URL.createObjectURL(csv_file);
|
||||||
|
|
||||||
|
download_link.style.display = "none";
|
||||||
|
|
||||||
|
document.body.appendChild(download_link);
|
||||||
|
|
||||||
|
download_link.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
function htmlToCSV(html, filename) {
|
||||||
|
const data = [];
|
||||||
|
const rows = document.querySelectorAll("table tr");
|
||||||
|
|
||||||
|
for (let i = 0; i < rows.length; i++) {
|
||||||
|
const row = [], cols: any = rows[i].querySelectorAll("td, th");
|
||||||
|
|
||||||
|
for (let j = 0; j < cols.length; j++) {
|
||||||
|
row.push(cols[j].innerText);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.push(row.join(","));
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadCSVFile(data.join("\n"), filename);
|
||||||
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getDataByHour()
|
getDataByHour()
|
||||||
getDataByDay()
|
getDataByDay()
|
||||||
@ -215,7 +248,10 @@ export default function pld({tableData, graphByHourData, graphByMonthData, userN
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div className='btnDownload'>
|
<div className='btnDownload'>
|
||||||
<BasicButton onClick={() => console.log()} title='Download'/>
|
<BasicButton onClick={() => {
|
||||||
|
const html = document.querySelector("table").outerHTML;
|
||||||
|
htmlToCSV(html, "tabela_PLD.csv");
|
||||||
|
}} title='Download'/>
|
||||||
</div>
|
</div>
|
||||||
<section>
|
<section>
|
||||||
|
|
||||||
|
|||||||
@ -26,24 +26,50 @@ export const IndustryInfoView = styled.main`
|
|||||||
|
|
||||||
color: #FFFFFF;
|
color: #FFFFFF;
|
||||||
}
|
}
|
||||||
.inputTeste{
|
|
||||||
|
form {
|
||||||
|
label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
position: absolute;
|
||||||
|
width: 150px;
|
||||||
|
margin-left: 10px;
|
||||||
|
transform: translateY(20px);
|
||||||
|
background-color: #254F7F;
|
||||||
|
color: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="file"] {
|
||||||
|
padding-top: 20px;
|
||||||
|
padding-left: 41px;
|
||||||
|
width: 350px;
|
||||||
|
height: 60px;
|
||||||
|
border: 1px solid black;
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .inputTeste{
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top:-10px;
|
|
||||||
width: 50%;
|
width: 50%;
|
||||||
margin-bottom: 50px;
|
|
||||||
height: 50px;
|
height: 50px;
|
||||||
background: white;
|
background: white;
|
||||||
border: 3px solid #254F7F;
|
|
||||||
border-radius:10px;
|
border-radius:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
input[type="file"] {
|
input[type="file"] {
|
||||||
display: none;
|
display: block;
|
||||||
}
|
}
|
||||||
label {
|
|
||||||
padding: 20px 10px;
|
label {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
padding: 2px 10px;
|
||||||
width: 200px;
|
width: 200px;
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
@ -52,7 +78,7 @@ label {
|
|||||||
display: block;
|
display: block;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
25
yarn.lock
25
yarn.lock
@ -2245,6 +2245,11 @@ dom-helpers@^5.0.1:
|
|||||||
"@babel/runtime" "^7.8.7"
|
"@babel/runtime" "^7.8.7"
|
||||||
csstype "^3.0.2"
|
csstype "^3.0.2"
|
||||||
|
|
||||||
|
dommatrix@^1.0.1:
|
||||||
|
version "1.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/dommatrix/-/dommatrix-1.0.3.tgz#e7c18e8d6f3abdd1fef3dd4aa74c4d2e620a0525"
|
||||||
|
integrity sha512-l32Xp/TLgWb8ReqbVJAFIvXmY7go4nTxxlWiAFyhoQw9RKEOHBZNnyGvJWqDVSPmq3Y9HlM4npqF/T6VMOXhww==
|
||||||
|
|
||||||
eastasianwidth@^0.2.0:
|
eastasianwidth@^0.2.0:
|
||||||
version "0.2.0"
|
version "0.2.0"
|
||||||
resolved "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz"
|
resolved "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz"
|
||||||
@ -4006,6 +4011,14 @@ patternomaly@^1.3.2:
|
|||||||
version "1.3.2"
|
version "1.3.2"
|
||||||
resolved "https://registry.yarnpkg.com/patternomaly/-/patternomaly-1.3.2.tgz#70b8db17d7318ab1471cc43f94011bb866c54d09"
|
resolved "https://registry.yarnpkg.com/patternomaly/-/patternomaly-1.3.2.tgz#70b8db17d7318ab1471cc43f94011bb866c54d09"
|
||||||
|
|
||||||
|
pdfjs-dist@^2.7.570:
|
||||||
|
version "2.14.305"
|
||||||
|
resolved "https://registry.yarnpkg.com/pdfjs-dist/-/pdfjs-dist-2.14.305.tgz#ed2ecb439ff8af5446c90a310ebd30bc1a91df62"
|
||||||
|
integrity sha512-5f7i25J1dKIBczhgfxEgNxfYNIxXEdxqo6Qb4ehY7Ja+p6AI4uUmk/OcVGXfRGm2ys5iaJJhJUwBFwv6Jl/Qww==
|
||||||
|
dependencies:
|
||||||
|
dommatrix "^1.0.1"
|
||||||
|
web-streams-polyfill "^3.2.1"
|
||||||
|
|
||||||
picocolors@^1.0.0:
|
picocolors@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz"
|
resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz"
|
||||||
@ -4145,6 +4158,13 @@ react-is@^16.13.1, react-is@^16.7.0:
|
|||||||
version "17.0.2"
|
version "17.0.2"
|
||||||
resolved "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz"
|
resolved "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz"
|
||||||
|
|
||||||
|
react-pdf-thumbnail@^0.1.0:
|
||||||
|
version "0.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/react-pdf-thumbnail/-/react-pdf-thumbnail-0.1.0.tgz#6b8ddf861252acb2b137dfd42007f545fde52ef9"
|
||||||
|
integrity sha512-VzkGUmgAheqxQsMTcUjOFrATtEdG2C9YRkMb0GFkf9JyfTDdBjkyu1/gVLk9CYVKWkgyNID34/G0TTX60XJuyA==
|
||||||
|
dependencies:
|
||||||
|
pdfjs-dist "^2.7.570"
|
||||||
|
|
||||||
react-transition-group@^4.4.0, react-transition-group@^4.4.2:
|
react-transition-group@^4.4.0, react-transition-group@^4.4.2:
|
||||||
version "4.4.2"
|
version "4.4.2"
|
||||||
resolved "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.2.tgz"
|
resolved "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.2.tgz"
|
||||||
@ -4769,6 +4789,11 @@ wcwidth@^1.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
defaults "^1.0.3"
|
defaults "^1.0.3"
|
||||||
|
|
||||||
|
web-streams-polyfill@^3.2.1:
|
||||||
|
version "3.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6"
|
||||||
|
integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==
|
||||||
|
|
||||||
which-boxed-primitive@^1.0.2:
|
which-boxed-primitive@^1.0.2:
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz"
|
resolved "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user