Merge branch 'administativePages' of https://gitlab.com/kluppsoftware/smart-energia-web into administativePages

This commit is contained in:
joseCorte-exe 2022-06-28 16:38:19 -03:00
commit 65ca7b792a
6 changed files with 30 additions and 12 deletions

View File

@ -20,7 +20,7 @@ export const TableView = styled.main`
border-radius: 16px; border-radius: 16px;
tr { tr {
th { th {
font-family: 'poppins'; font-family: 'Poppins';
font-weight: 500; font-weight: 500;
font-size: 16px; font-size: 16px;
color: #6A707E; color: #6A707E;
@ -28,13 +28,13 @@ export const TableView = styled.main`
td { td {
:nth-child(3) { :nth-child(3) {
font-family: 'poppins'; font-family: 'Poppins';
font-weight: 500; font-weight: 500;
font-size: 16px; font-size: 16px;
color: #6A707E; color: #6A707E;
} }
:nth-child(4) { :nth-child(4) {
font-family: 'poppins'; font-family: 'Poppins';
font-weight: 400; font-weight: 400;
font-size: 12px; font-size: 12px;
color: #828282; color: #828282;

View File

@ -11,7 +11,7 @@ export const LoginButtonView = styled.button`
background: rgb(2,0,36); background: rgb(2,0,36);
background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(37,79,127,1) 35%, rgba(136,136,136,1) 100%); background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(37,79,127,1) 35%, rgba(136,136,136,1) 100%);
font-family: 'Nunito Sans'; font-family: 'Poppins';
font-weight: 700; font-weight: 700;
font-size: calc(99.98% + 10px); font-size: calc(99.98% + 10px);
line-height: 44px; line-height: 44px;

View File

@ -8,7 +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 PdfThumbnail from 'react-pdf-thumbnail';
import FormData from 'form-data'; import FormData from 'form-data';
@ -58,12 +58,12 @@ export default function industryInfo({userName}: any) {
<IndustryInfoView> <IndustryInfoView>
<Snackbar open={openSnackSuccess} autoHideDuration={4000} onClose={handleCloseSnack}> <Snackbar open={openSnackSuccess} autoHideDuration={4000} onClose={handleCloseSnack}>
<Alert onClose={handleCloseSnack} severity="success" sx={{ width: '100%' }}> <Alert onClose={handleCloseSnack} severity="success" sx={{ width: '100%' }}>
PDF Baixado com Sucesso! PDF enviado com Sucesso!
</Alert> </Alert>
</Snackbar> </Snackbar>
<Snackbar open={openSnackError} autoHideDuration={4000} onClose={handleCloseSnack}> <Snackbar open={openSnackError} autoHideDuration={4000} onClose={handleCloseSnack}>
<Alert onClose={handleCloseSnack} severity="error" sx={{ width: '100%' }}> <Alert onClose={handleCloseSnack} severity="error" sx={{ width: '100%' }}>
PDF não baixado! Falha ao enviar PDF!
</Alert> </Alert>
</Snackbar> </Snackbar>
<Head> <Head>

View File

@ -64,3 +64,4 @@ export default function ForgotPassword() {
</ForgotPasswordView> </ForgotPasswordView>
) )
} }

View File

@ -70,7 +70,7 @@ export default function Home() {
}else{ }else{
try { try {
await signIn({email, password}).then((res: any) => { await signIn({email, password}).then((res: any) => {
if (res.response.status === 422 || res.response.status === 401) { if (res.response.status === 422 || res.response.status === 401 || res.response.status === 500 ) {
setOpenSnackError(true) setOpenSnackError(true)
} }
}) })
@ -91,8 +91,8 @@ export default function Home() {
useEffect(() => { useEffect(() => {
setValues({ setValues({
password: null, password: (''),
showPassword: false, showPassword: null,
}); });
setEmail("") setEmail("")
}, [rota]) }, [rota])

View File

@ -36,8 +36,24 @@ export default function ResumoOperacao({tableData, clientsData, userName, client
setUnidade(event.target.value); setUnidade(event.target.value);
}; };
function stringToBytes(text) {
const length = text.length;
const result = new Uint8Array(length);
for (let i = 0; i < length; i++) {
const code = text.charCodeAt(i);
const byte = code > 255 ? 32 : code;
result[i] = byte;
}
return result;
}
// const originalString = 'ååå';
// const bytes = stringToBytes(originalString);
// const blob = new Blob([bytes.buffer], { type: 'text/plain; charset=ISO-8859-1' });
function downloadCSVFile(csv, filename) { function downloadCSVFile(csv, filename) {
const csv_file = new Blob([csv], {type: "text/csv"});
const csv_file = new Blob(["\ufeff",csv], {type: "text/csv"});
const download_link = document.createElement("a"); const download_link = document.createElement("a");
@ -63,7 +79,8 @@ export default function ResumoOperacao({tableData, clientsData, userName, client
row.push(cols[j].innerText); row.push(cols[j].innerText);
} }
data.push(row.join(","));
data.push(row.join(";"));
} }
downloadCSVFile(data.join("\n"), filename); downloadCSVFile(data.join("\n"), filename);