Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Commit 65749ed

Browse files
committed
dev: added delimitador de ponto, fixed colaborador render and fixed ponto approve
1 parent 2b4d8a3 commit 65749ed

File tree

25 files changed

+1078
-316
lines changed

25 files changed

+1078
-316
lines changed

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"jspdf": "^2.1.1",
1818
"jspdf-autotable": "^3.5.13",
1919
"leaflet": "^1.7.1",
20+
"leaflet-draw": "^1.0.4",
2021
"node-sass": "^4.14.1",
2122
"query-string": "^6.13.5",
2223
"rc-table": "^7.10.0",
@@ -30,7 +31,7 @@
3031
"react-dom": "^16.13.1",
3132
"react-icons": "^3.11.0",
3233
"react-intl": "^5.8.3",
33-
"react-leaflet": "^3.0.2",
34+
"react-leaflet": "2.7.0",
3435
"react-leaflet-draw": "^0.19.0",
3536
"react-lottie": "^1.2.3",
3637
"react-router-dom": "^5.2.0",
@@ -66,11 +67,12 @@
6667
},
6768
"devDependencies": {
6869
"@types/js-cookie": "^2.2.6",
70+
"@types/leaflet-geosearch": "^2.7.1",
6971
"@types/query-string": "^6.3.0",
7072
"@types/react-animate-on-scroll": "^2.1.2",
7173
"@types/react-datepicker": "^3.1.1",
7274
"@types/react-intl": "^3.0.0",
73-
"@types/react-leaflet": "^2.5.2",
75+
"@types/react-leaflet": "1.0.7",
7476
"@types/react-lottie": "^1.2.5",
7577
"@types/react-router-dom": "^5.1.5",
7678
"@types/react-table": "^7.0.23",

public/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
1212
crossorigin=""/>
1313
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
14+
<link
15+
rel="stylesheet"
16+
href="https://unpkg.com/leaflet-geosearch@3.0.0/dist/geosearch.css"
17+
/>
1418
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
1519
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
1620
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

src/Assets/animations/congrats.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

src/Components/GestorRender/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,14 @@ const GestorRender: React.FC<GestorRenderProps> = ({ info }) => {
162162
</div>
163163
<div className="grafico_users">
164164
<Card>
165-
<h3>Gráfico aqui</h3>
165+
<div className="home__header">
166+
<div className="header__title">
167+
<h3 className="tt-sub title-blue title-bold">
168+
Gráfico
169+
</h3>
170+
<p>Gráfico de usuários</p>
171+
</div>
172+
</div>
166173
</Card>
167174
</div>
168175
</div>

src/Components/MarcarPonto/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const MarcarPonto: React.FC<MarcarPontoProps> = ({ colaboradorId }) => {
4040
colaboradorId: colaboradorId,
4141
data: getTodayDate(),
4242
horario: datePonto.toString(),
43-
localizacao: userLocalization,
43+
localizacao: userLocalization.toString(),
4444
};
4545

4646
// setPontoStatus("ERROR");

src/Components/NavBarInterna/styles.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ header.header__nav-interna {
197197

198198
span {
199199
color: #fff;
200-
font-size: 10px;
200+
font-size: 8px;
201201
}
202202
}
203203

@@ -207,7 +207,7 @@ header.header__nav-interna {
207207
right: -102px;
208208
width: 247px;
209209
background-color: #fff;
210-
z-index: 2;
210+
z-index: 999;
211211
border-radius: 15px;
212212
box-shadow: -2px 8px 8px 0px #eaeaeaee;
213213
padding: 20px 10px;

src/Components/RenderSelectedRow/Pontos/AprovarPonto/index.tsx

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import {
1010
import MainContext from "../../../../Contexts/MainContext";
1111
import { insertNewLog } from "../../../../Services/ApiCalls";
1212
import { saveFromDate, showToast } from "../../../../Functions";
13-
import { MapContainer, Marker, Popup, TileLayer } from "react-leaflet";
13+
// @ts-ignore
14+
import { Map, Marker, Popup, TileLayer } from "react-leaflet";
1415

1516
interface AprovarPontoProps {
1617
dataPonto: any;
@@ -45,14 +46,7 @@ const AprovarPonto: React.FC<AprovarPontoProps> = ({ dataPonto }) => {
4546
}
4647
}, []);
4748

48-
const {
49-
data,
50-
horario,
51-
id,
52-
tipoDoRegistro,
53-
localizacao,
54-
observacao,
55-
} = dataPonto;
49+
const { data, horario, id, tipoDoRegistro, localizacao, obs } = dataPonto;
5650

5751
// State geral
5852
const [isSubmiting, setIsSubmiting] = useState(false);
@@ -62,10 +56,19 @@ const AprovarPonto: React.FC<AprovarPontoProps> = ({ dataPonto }) => {
6256
const [long, setLong] = useState(0);
6357

6458
const aprovarPonto = async () => {
59+
setIsSubmiting(true);
60+
6561
await api
66-
.patch(`${APROVAR_PONTO}/${id}`, {
67-
headers: { Authorization: token },
68-
})
62+
.patch(
63+
`${APROVAR_PONTO}/${id}`,
64+
{},
65+
{
66+
headers: {
67+
Authorization: token,
68+
"Access-Control-Allow-Origin": "*",
69+
},
70+
}
71+
)
6972
.then((resp) => {
7073
const { status } = resp;
7174

@@ -92,7 +95,7 @@ const AprovarPonto: React.FC<AprovarPontoProps> = ({ dataPonto }) => {
9295
setIsSubmiting(true);
9396
setUpdateError(true);
9497

95-
const { errors } = err.response.data;
98+
const { errors } = err.respons;
9699

97100
errors.map((err: any) =>
98101
showToast("ERROR", `${err.message}`, {})
@@ -106,9 +109,13 @@ const AprovarPonto: React.FC<AprovarPontoProps> = ({ dataPonto }) => {
106109

107110
const reprovarPonto = async () => {
108111
await api
109-
.patch(`${REPROVAR_PONTO}/${id}`, {
110-
headers: { Authorization: token },
111-
})
112+
.patch(
113+
`${REPROVAR_PONTO}/${id}`,
114+
{},
115+
{
116+
headers: { Authorization: token },
117+
}
118+
)
112119
.then((resp) => {
113120
const { status } = resp;
114121

@@ -186,21 +193,21 @@ const AprovarPonto: React.FC<AprovarPontoProps> = ({ dataPonto }) => {
186193
<p>Localização:</p>
187194
<br />
188195
<div className="m__map">
189-
<MapContainer
196+
<Map
190197
center={[lat, long]}
191198
zoom={16}
192199
scrollWheelZoom={true}
193200
>
194201
<TileLayer
195-
attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
196-
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
202+
attribution="google"
203+
url="http://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}"
197204
/>
198205
<Marker position={[lat, long]}>
199206
<Popup>
200207
Sua localização
201208
</Popup>
202209
</Marker>
203-
</MapContainer>
210+
</Map>
204211
</div>
205212
</div>
206213
</li>
@@ -217,9 +224,7 @@ const AprovarPonto: React.FC<AprovarPontoProps> = ({ dataPonto }) => {
217224
<div className="pnt__info">
218225
<p>
219226
Observação:{" "}
220-
<span>
221-
{observacao ? observacao : "-"}
222-
</span>
227+
<span>{obs ? obs : "-"}</span>
223228
</p>
224229
</div>
225230
</li>

src/Components/RenderSelectedRow/Pontos/AprovarPonto/styles.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
ul{
77
li{
8-
margin: 5px 0;
8+
margin: 15px 0;
99

1010
.pnt__info{
1111
p{

src/Components/RenderSelectedRow/Pontos/SelectedPonto/index.tsx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,23 @@ const SelectedPontos: React.FC<SelectedPontosProps> = ({ dataPonto }) => {
2727
removehasCloseEditModal,
2828
setOpenMoreInfo,
2929
} = useContext(MainContext);
30-
const { data, horario, id, tipoDoRegistro, localizacao } = dataPonto;
30+
const { data, horario, id, tipoDoRegistro, localizacao, obs } = dataPonto;
3131

3232
const allTiposArray = [
3333
{
34-
id: 1,
34+
id: 0,
3535
nome: "Início da Jornada",
3636
},
3737
{
38-
id: 2,
38+
id: 1,
3939
nome: "Início do Intervalo",
4040
},
4141
{
42-
id: 3,
42+
id: 2,
4343
nome: "Fim do Intervalo",
4444
},
4545
{
46-
id: 4,
46+
id: 3,
4747
nome: "Fim da Jornada",
4848
},
4949
];
@@ -53,6 +53,7 @@ const SelectedPontos: React.FC<SelectedPontosProps> = ({ dataPonto }) => {
5353
data,
5454
tipoDoRegistroId: 0,
5555
localizacao,
56+
observacao: obs,
5657
};
5758

5859
// State geral
@@ -81,7 +82,7 @@ const SelectedPontos: React.FC<SelectedPontosProps> = ({ dataPonto }) => {
8182
<Formik
8283
initialValues={formValues}
8384
onSubmit={async (values) => {
84-
const { id } = values;
85+
const { id, observacao } = values;
8586

8687
setIsSubmiting(true);
8788

@@ -90,6 +91,7 @@ const SelectedPontos: React.FC<SelectedPontosProps> = ({ dataPonto }) => {
9091
horario: time,
9192
tipoDoRegistroId: selectedTipo,
9293
localizacao: localizacao,
94+
obs: observacao,
9395
};
9496

9597
await api
@@ -231,6 +233,17 @@ const SelectedPontos: React.FC<SelectedPontosProps> = ({ dataPonto }) => {
231233
))}
232234
</select>
233235
</div>
236+
237+
<div className="form__group not__centered">
238+
<label htmlFor="">Observação</label>
239+
<textarea
240+
value={values.observacao}
241+
required
242+
className={`no-resize set-height`}
243+
onChange={handleChange("observacao")}
244+
/>
245+
</div>
246+
234247
<div className="form__group not__centered form__side-side">
235248
<button
236249
type="submit"

src/Components/UserRender/index.tsx

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,68 @@ import Card from "../Card";
44
import { Link } from "react-router-dom";
55
import MarcarPonto from "../MarcarPonto";
66
import { FaCog } from "react-icons/fa";
7-
import { ImBook } from "react-icons/im";
7+
import { BsClockHistory } from "react-icons/bs";
88
import MainContext from "../../Contexts/MainContext";
9+
import { getTodayInfo } from "../../Functions";
910

10-
interface UserRenderProps {}
11+
interface UserRenderProps {
12+
info: any;
13+
}
1114

12-
const UserRender: React.FC<UserRenderProps> = () => {
15+
const UserRender: React.FC<UserRenderProps> = ({ info }) => {
1316
const { currentLoggedUserId } = useContext(MainContext);
1417

1518
return (
16-
<div className="usrntad__rr">
17-
<div className="rr__top-row">
18-
<div className="tr__ponto">
19-
<Card size={2} height="full">
19+
<div className="admnntad__rr">
20+
<div className="adm__bemvindo">
21+
<div className="bem__vindo-info">
22+
<h2 className="tt-title title-blue title-bold">
23+
Bem Vindo
24+
</h2>
25+
<h3 className="tt-sub title-blue title-blue title-bold">
26+
{info.username}
27+
</h3>
28+
</div>
29+
30+
<div className="bem__vindo-date">
31+
<p>{getTodayInfo()}</p>
32+
</div>
33+
</div>
34+
<div className="user__grid--container">
35+
<div className="ponto">
36+
<Card height="height-100p">
2037
<MarcarPonto colaboradorId={currentLoggedUserId} />
2138
</Card>
2239
</div>
23-
<div className="tp__afins">
24-
<div className="afins__espelho">
40+
<div className="espelho">
41+
<Card isFlex={false}>
2542
<Link to="/dashboard/espelho">
26-
<Card height="100p">
27-
<div className="esp__icon">
28-
<ImBook color="#222" />
29-
</div>
30-
31-
<div className="esp__text">
32-
<h3>Espelho do ponto</h3>
33-
</div>
34-
</Card>
43+
<div className="header__title">
44+
<h3 className="tt-sub title-blue title-bold title-center">
45+
Espelho
46+
</h3>
47+
</div>
48+
<div className="grid__icon">
49+
<BsClockHistory size={90} color="#222" />
50+
</div>
3551
</Link>
36-
</div>
37-
<div className="afins__config">
52+
</Card>
53+
</div>
54+
<div className="config">
55+
<Card isFlex={false}>
3856
<Link to="/dashboard/settings">
39-
<Card height="100p">
40-
<div className="esp__icon">
41-
<FaCog color="#222" />
57+
<div className="home__header">
58+
<div className="header__title">
59+
<h3 className="tt-sub title-blue title-bold title-center">
60+
Configurações
61+
</h3>
4262
</div>
43-
44-
<div className="esp__text">
45-
<h3>Configurações</h3>
46-
</div>
47-
</Card>
63+
</div>
64+
<div className="grid__icon">
65+
<FaCog size={90} color="#222" />
66+
</div>
4867
</Link>
49-
</div>
68+
</Card>
5069
</div>
5170
</div>
5271
</div>

0 commit comments

Comments
 (0)