fixing errors
This commit is contained in:
parent
d4e283cd15
commit
ad9e15ea21
@ -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"
|
||||||
|
|||||||
@ -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';
|
||||||
|
|
||||||
@ -74,10 +75,12 @@ export default function industryInfo({userName}: any) {
|
|||||||
<div className="update">
|
<div className="update">
|
||||||
<form action="">
|
<form action="">
|
||||||
<div className='testess'>
|
<div className='testess'>
|
||||||
<label htmlFor="arquivo"> <p className='TitleButton'> Enviar PDF </p> </label>
|
<label htmlFor="arquivo"><p className='TitleButton'> Enviar PDF </p></label>
|
||||||
<input type="file" name='arquivo' id='arquivo' onChange={onChange} />
|
<input type="file" name='arquivo' id='arquivo' onChange={onChange}/>
|
||||||
|
{/* <input type='file' accept='application/pdf' onChange={onChange} /> */}
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<p>{pdf}</p>
|
||||||
</div>
|
</div>
|
||||||
</InputUploadView>
|
</InputUploadView>
|
||||||
{/* <InputUploadPdf/> */}
|
{/* <InputUploadPdf/> */}
|
||||||
|
|||||||
@ -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>
|
||||||
|
|
||||||
|
|||||||
@ -29,21 +29,20 @@ export const IndustryInfoView = styled.main`
|
|||||||
.inputTeste{
|
.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 +51,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