Skip to content

Commit

Permalink
Merge pull request #37 from FGA0138-MDS-Ajax/25-gerenciamento-funcion…
Browse files Browse the repository at this point in the history
…arios

25 gerenciamento funcionarios
  • Loading branch information
JAugustoM authored Dec 16, 2024
2 parents 2aa471a + 3266093 commit 3b52972
Show file tree
Hide file tree
Showing 11 changed files with 857 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"cmake.sourceDirectory": "/home/melkor/Desktop/schl/4semestre/MDS/GITHUB/2024.2-Fehu/catavento/linux"
"cmake.sourceDirectory": "C:/FlutterProjects/fehu/2024.2-Fehu/catavento/linux"
}
4 changes: 2 additions & 2 deletions catavento/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:catavento/bloc/demanda_bloc.dart';
import 'package:catavento/constants.dart';
import 'package:catavento/screens/Login/login.dart';
import 'package:catavento/screens/dashboardAdmin/dashboard_admin.dart';
import 'package:catavento/screens/dashboardFuncionarios/dashboard_funcionarios.dart';
import 'package:catavento/screens/employee-management.dart';
import 'package:catavento/views/login_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand All @@ -23,7 +23,7 @@ void main() {
routes: {
loginRoute: (context) => const LoginView(),
homeRoute: (context) => const DashBoardAdmin(),
crudFuncionariosRoute: (context) => const DashBoardFuncionarios(),
crudFuncionariosRoute: (context) => EmployeeManagement(),
},
),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:flutter/material.dart';


class AtivAndamentoCard extends StatelessWidget {
final String nomeFuncionario;
final String nomeDemanda;

const AtivAndamentoCard({
super.key,
required this.nomeFuncionario,
required this.nomeDemanda,
});

@override
Widget build(BuildContext context) {

return Card(
margin: EdgeInsets.symmetric(vertical: 8.0),
child: ListTile(
title: Text(nomeFuncionario),
subtitle: Text(
'Em andamento: $nomeDemanda'
),
),
);
}
}
41 changes: 41 additions & 0 deletions catavento/lib/screens/dashboardAdmin/components/background.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';

class BackgroundPage extends StatelessWidget {
final Color? backgroundColor;
final List<Color>? gradientColors;
final List<Widget>children;

BackgroundPage({
this.backgroundColor,
this.gradientColors,
required this.children,
});

@override
Widget build(BuildContext context) {
return Stack(
children: [
//Cor de fundo
Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(
color: backgroundColor,
gradient: gradientColors != null
? LinearGradient(
colors: gradientColors!,
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
)
: null,
),
),

//Conteúdo
Column(
children: children,
)
],
);
}
}
77 changes: 77 additions & 0 deletions catavento/lib/screens/dashboardAdmin/components/blocks.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import 'dart:ffi';

import 'package:flutter/material.dart';

class Blocks extends StatefulWidget {
final String? title;
final double? height;
final double? width;
final double borderRadius;
final Color color;
final Widget child;

Blocks({
this.title,
this.height,
this.width,
this.borderRadius = 16.0,
required this.color,
required this.child,
});

@override
State<Blocks> createState() {
return BlocksState();
}
}

class BlocksState extends State<Blocks> {

@override
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
double screenHeight = MediaQuery.of(context).size.height;

double blockWidth = widget.width ?? screenWidth * 0.9;
double blockHeight = widget.height ?? screenHeight * 0.5;

return Stack(
children: [
Container(
width: blockWidth,
height: blockHeight,
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: widget.color,
borderRadius: BorderRadius.circular(widget.borderRadius)
),
),

if (widget.title != null)
Positioned(
top: 10,
left: 0,
right: 0,
child: Center(
child: Text(
widget.title!,
style: TextStyle(
fontSize: 16,
color: Colors.black,
fontWeight: FontWeight.bold,
),
),
),
),

Positioned.fill(
child: Align(
alignment: Alignment.center,
child: widget.child,
),
),

],
);
}
}
144 changes: 144 additions & 0 deletions catavento/lib/screens/dashboardAdmin/components/funcionarioCard.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import 'package:catavento/screens/components/infoFuncionarios.dart';
import 'package:catavento/screens/components/showDialog.dart';
import 'package:flutter/material.dart';
import 'input.dart';
import 'confirmDialog.dart';

class FuncionarioCard extends StatefulWidget{
final String nomeFuncionario;
final String status;
final String setor;

const FuncionarioCard({
super.key,
required this.nomeFuncionario,
required this.setor,
required this.status,
});

@override
State<FuncionarioCard> createState() {
return FuncionarioCardState();
}
}

class FuncionarioCardState extends State<FuncionarioCard>{

@override
Widget build(BuildContext context) {

return Card(
margin: EdgeInsets.symmetric(vertical: 8.0),
child: ListTile(
title: Text(widget.nomeFuncionario),
subtitle: Text(
'Setor: ${widget.setor}\nStatus: ${widget.status}'),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
icon: Icon(Icons.info),
onPressed: () {
//Lógica ao clicar
showDialog(
context: context,
builder: (BuildContext context) {
return Showdialog(
width: 463,
height: 402,
title: 'nomeFuncionario', //Inserir o nome do funcionario
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,

children: [
Infofuncionarios(nome: "Fulano", email: "email", status: "Ativo", setor: "Montagem", demanda: "Hello Kitty") //Trocar para as informações do banco de dados
]
),
);
},
);

},
),
// botão de Editar.
IconButton(
icon: Icon(Icons.edit),
onPressed: () {
// editar a demanda
showDialog(
context: context,
builder: (BuildContext context) {
return Showdialog(
width: 463,
height: 402,
title: 'Editar',
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,

children: [
Inputs(text: "Nome:",),
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
Inputs(text: "Setor:",),
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
Inputs(text: "Email:",),
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
Inputs(text: "Nome de usuário:",),
SizedBox(height: MediaQuery.of(context).size.height * 0.02),
Inputs(text: "Senha:",),
SizedBox(height: MediaQuery.of(context).size.height * 0.08),

Positioned.fill(
child: Center(
child: ElevatedButton(onPressed: (){
//Lógica do botão
Navigator.pop(context);
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.green,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(22)
)
),
child: Text(
"Cadastrar",
style: TextStyle(color: Colors.white),
)

)
)
)
]
),
);
},
);

},
),
// apagar
IconButton(
icon: Icon(Icons.delete),
onPressed: () async {
showDialog(
context: context,
builder: (BuildContext context) {
return ConfirmDialog(
title: 'Confirmar Exclusão',
contente:
'Tem certeza de que deseja apagar esta demanda?',
onConfirm: () {
Navigator.of(context).pop(); // Fecha o diálogo
//Lógica do botão
},
);
},
);
}),
],
),
),
);
}
}
73 changes: 73 additions & 0 deletions catavento/lib/screens/dashboardAdmin/components/graficInfo.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';


class Graficinfo<B extends BlocBase<S>, S> extends StatefulWidget {
final double? size;
final IconData icons;
final Color colorIcons;
final String info;
final String dataKey;
final BlocBuilderCondition<S> buildWhen;

Graficinfo ({
this.size,
required this.icons,
required this.colorIcons,
required this.info,
required this.dataKey,
required this.buildWhen,

});

@override
State<Graficinfo<B, S>> createState() {
return GraficinfoState<B, S>();
}
}

class GraficinfoState<B extends BlocBase<S>, S> extends State<Graficinfo<B, S>> {
@override
Widget build(BuildContext context) {
return BlocBuilder<B, S>(
buildWhen: widget.buildWhen,
builder: (context, response) {
final metaData = (response as dynamic).metaData;

return Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Icon(
widget.icons,
size: widget.size,
color: widget.colorIcons,
),
SizedBox(width: 20),

Center( // Adicionado Center para centralizar o conteúdo dentro do Column
child: Column(
crossAxisAlignment: CrossAxisAlignment.center, // Centralizado horizontalmente
children: [
Text(
"${metaData[widget.dataKey] ?? '--'}",
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
SizedBox(height: 2),
Text(
widget.info,
style: TextStyle(fontSize: 18, color: Colors.black),
),
],
),
),
]
);
}
);
}
}
Loading

0 comments on commit 3b52972

Please sign in to comment.