Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Walter Felipe
pad-upe
Commits
f7ba4896
Commit
f7ba4896
authored
Dec 15, 2022
by
alissonalbuquerque
Browse files
add correções para importação de usuarios
parent
19514579
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/UserController.php
View file @
f7ba4896
...
@@ -130,13 +130,22 @@ class UserController extends Controller
...
@@ -130,13 +130,22 @@ class UserController extends Controller
unset
(
$excel
[
0
]);
unset
(
$excel
[
0
]);
$excel
=
array_filter
(
$excel
,
function
(
$row
)
{
$email
=
trim
(
$row
[
7
]);
return
strstr
(
$email
,
'@'
);
}
);
$importCount
=
0
;
$duplicados
=
0
;
foreach
(
$excel
as
$row
)
foreach
(
$excel
as
$row
)
{
{
$email
=
trim
(
strtolower
(
$row
[
7
]));
$email
=
trim
(
strtolower
(
$row
[
7
]));
if
(
$email
==
"#n/a"
||
$email
==
"-"
)
{
$userQuery
=
User
::
initQuery
()
->
whereEmail
(
$email
)
->
first
();
continue
;
}
else
{
if
(
$userQuery
===
null
)
{
$password
=
explode
(
"@"
,
$email
);
$password
=
explode
(
"@"
,
$email
);
$password
=
array_shift
(
$password
);
$password
=
array_shift
(
$password
);
...
@@ -147,19 +156,26 @@ class UserController extends Controller
...
@@ -147,19 +156,26 @@ class UserController extends Controller
$user
->
password
=
Hash
::
make
(
$password
);
$user
->
password
=
Hash
::
make
(
$password
);
$user
->
status
=
Status
::
ATIVO
;
$user
->
status
=
Status
::
ATIVO
;
$user
->
save
();
if
(
$user
->
save
())
{
$userType
=
new
UserType
();
$userType
->
user_id
=
$user
->
id
;
$userType
->
type
=
UserTYPE
::
TEACHER
;
$userType
->
status
=
Status
::
ATIVO
;
$userType
->
selected
=
true
;
$userType
=
new
UserTyp
e
()
;
if
(
$userType
->
sav
e
()
)
$userType
->
user_id
=
$user
->
id
;
{
$userType
->
type
=
UserTYPE
::
TEACHER
;
$importCount
++
;
$userType
->
status
=
Status
::
ATIVO
;
}
$userType
->
selected
=
true
;
}
$userType
->
save
();
}
else
{
$duplicados
++
;
}
}
}
}
return
redirect
()
->
route
(
'user_import_view'
)
->
with
(
'success'
,
'Importado com Sucesso
'
);
return
redirect
()
->
route
(
'user_import_view'
)
->
with
(
'success'
,
sprintf
(
'Importado com Sucesso
! Importados: %d | Duplicados: %d'
,
$importCount
,
$duplicados
)
);
}
}
public
function
actionImportView
()
public
function
actionImportView
()
...
...
app/Models/User.php
View file @
f7ba4896
...
@@ -198,6 +198,22 @@ class User extends Authenticatable
...
@@ -198,6 +198,22 @@ class User extends Authenticatable
return
new
UserQuery
(
get_called_class
());
return
new
UserQuery
(
get_called_class
());
}
}
public
function
dashboardName
()
{
$name
=
$this
->
name
;
$split
=
explode
(
' '
,
$name
);
$dashboardName
=
''
;
if
(
count
(
$split
)
>=
2
)
{
$dashboardName
=
array_shift
(
$split
)
.
' '
.
array_shift
(
$split
);
}
else
{
$dashboardName
=
array_shift
(
$split
);
}
return
$dashboardName
;
}
/**
/**
* @return string
* @return string
*/
*/
...
...
resources/views/auth/login.blade.php
View file @
f7ba4896
...
@@ -20,34 +20,34 @@
...
@@ -20,34 +20,34 @@
<!--
Informações
-->
<!--
Informações
-->
<
div
class
=
"half p-4 py-md-5 bg-primary"
>
<
div
class
=
"half p-4 py-md-5 bg-primary"
>
<
div
class
=
"w-100"
>
<
div
class
=
"w-100"
>
<
h4
class
=
"mb-4"
>
Informações
</
h4
>
<
h4
class
=
"mb-4"
>
Informações
</
h4
>
</
div
>
</
div
>
<
p
class
=
"w-100 text-center"
>
&
mdash
;
Atenção
&
mdash
;
</
p
>
<
p
class
=
"w-100 text-center"
>
Teste
de
Homologação
</
p
>
<
p
class
=
"w-100 text-center"
>
O
primeiro
acesso
deve
ser
realizado
utilizando
seu
e
-
mail
<!--
<
p
class
=
"w-100 text-center"
>
O
primeiro
acesso
deve
ser
realizado
utilizando
seu
e
-
mail
e
CPF
,
nos
campos
de
login
e
senha
respectivamente
</
p
>
e
CPF
,
nos
campos
de
login
e
senha
respectivamente
</
p
>
-->
</
div
>
</
div
>
<!--
Login
-->
<!--
Login
-->
<
div
class
=
"half p-4 py-md-5"
>
<
div
class
=
"half p-4 py-md-5"
>
<
div
class
=
"w-100"
>
<
div
class
=
"w-100"
>
<
h4
class
=
"mb-4"
>
Acesso
PAD
</
h4
>
<
h4
class
=
"mb-4"
>
Login
</
h4
>
</
div
>
</
div
>
<
div
class
=
"form-group mt-3"
>
<
div
class
=
"form-group mt-3"
>
<
label
class
=
"label"
for
=
"name"
>
Endereço
de
e
mail
</
label
>
<
label
class
=
"label"
for
=
"name"
>
E
-
mail
</
label
>
<
input
type
=
"email"
name
=
"email"
class
=
"form-control"
placeholder
=
"e
x: nome
@upe.br"
:
value
=
"old('email')"
required
<
input
type
=
"email"
name
=
"email"
class
=
"form-control"
placeholder
=
"e
mail
@upe.br"
:
value
=
"old('email')"
required
autofocus
/>
autofocus
/>
</
div
>
</
div
>
<
div
class
=
"form-group"
>
<
div
class
=
"form-group"
>
<
label
class
=
"label"
for
=
"password"
>
Senha
</
label
>
<
label
class
=
"label"
for
=
"password"
>
Senha
</
label
>
<
input
id
=
"password-field"
type
=
"password"
name
=
"password"
class
=
"form-control"
<
input
id
=
"password-field"
type
=
"password"
name
=
"password"
class
=
"form-control"
:
value
=
"__('Password')"
placeholder
=
"
S
enha"
required
/>
:
value
=
"__('Password')"
placeholder
=
"
s
enha"
required
/>
<
span
toggle
=
"#password-field"
<
span
toggle
=
"#password-field"
class
=
"fa fa-fw fa-eye field-icon toggle-password"
></
span
>
class
=
"fa fa-fw fa-eye field-icon toggle-password"
></
span
>
</
div
>
</
div
>
<
div
class
=
"form-group"
>
<
div
class
=
"form-group"
>
<
button
type
=
"submit"
class
=
"form-control btn btn-secondary rounded submit px-3"
>
Entrar
</
button
>
<
button
type
=
"submit"
class
=
"form-control btn btn-secondary rounded submit px-3"
>
Entrar
</
button
>
</
div
>
</
div
>
<
div
class
=
"form-group d-md-flex"
>
<!--
<
div
class
=
"form-group d-md-flex"
>
<
div
class
=
"w-50 text-left"
>
<
div
class
=
"w-50 text-left"
>
<
label
class
=
"checkbox-wrap checkbox-primary mb-0"
<
label
class
=
"checkbox-wrap checkbox-primary mb-0"
style
=
"color: rgb(22, 21, 21);"
>
style
=
"color: rgb(22, 21, 21);"
>
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
<
div
class
=
"w-50 text-md-right"
>
<
div
class
=
"w-50 text-md-right"
>
<
a
href
=
"#"
style
=
"color: rgb(22, 21, 21);"
></
a
>
<
a
href
=
"#"
style
=
"color: rgb(22, 21, 21);"
></
a
>
</
div
>
</
div
>
</
div
>
</
div
>
-->
</
div
>
</
div
>
</
form
>
</
form
>
</
div
>
</
div
>
...
...
resources/views/layouts/navigation.blade.php
View file @
f7ba4896
...
@@ -18,8 +18,8 @@
...
@@ -18,8 +18,8 @@
<div
class=
"content-user-info"
>
<div
class=
"content-user-info"
>
<div
class=
"text-center"
>
<div
class=
"text-center"
>
<div
class=
"font-medium text-base text-gray-800"
>
{{ Auth::user()->
n
ame }}
</div>
<div
class=
"font-medium text-base text-gray-800"
>
{{ Auth::user()->
dashboardN
ame
()
}}
</div>
<div
class=
"font-medium text-sm text-gray-500"
>
{{ Auth::user()->email }}
</div>
<div
class=
"mt-3"
>
<div
class=
"mt-3"
>
<a
class=
"{{ $edit_active }}"
href=
"{{ route('edit_perfil') }}"
>
<a
class=
"{{ $edit_active }}"
href=
"{{ route('edit_perfil') }}"
>
<i
class=
"bi bi-gear-fill"
></i>
<i
class=
"bi bi-gear-fill"
></i>
...
...
resources/views/users/importView.blade.php
View file @
f7ba4896
<!doctype html>
<!doctype html>
<html
lang=
"
en
"
>
<html
lang=
"
pt-br
"
>
<head>
<head>
<meta
charset=
"utf-8"
>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
>
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
<body>
<body>
<div
class=
"container mt-5"
>
<div
class=
"container mt-5"
>
<form
action=
"{{route('user_import')}}"
method=
"post"
enctype=
"multipart/form-data"
>
<form
action=
"{{route('user_import')}}"
method=
"post"
enctype=
"multipart/form-data"
>
<h3
class=
"text-center mb-5"
>
Importar Professores
- Dev In Test
</h3>
<h3
class=
"text-center mb-5"
>
Importar Professores
</h3>
@csrf
@csrf
@if ($message = Session::get('success'))
@if ($message = Session::get('success'))
<div
class=
"alert alert-success"
>
<div
class=
"alert alert-success"
>
...
@@ -40,7 +40,7 @@
...
@@ -40,7 +40,7 @@
<label
class=
"custom-file-label"
for=
"chooseFile"
>
Select file
</label>
<label
class=
"custom-file-label"
for=
"chooseFile"
>
Select file
</label>
</div>
</div>
<button
type=
"submit"
name=
"submit"
class=
"btn btn-primary btn-block mt-4"
>
<button
type=
"submit"
name=
"submit"
class=
"btn btn-primary btn-block mt-4"
>
Upload Files
Importar Arquivo
</button>
</button>
</form>
</form>
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment