diff --git a/catavento/lib/constants.dart b/catavento/lib/constants.dart index 7971c98..b54b747 100644 --- a/catavento/lib/constants.dart +++ b/catavento/lib/constants.dart @@ -1,6 +1,6 @@ const loginRoute = "/login/"; const homeRoute = "/home/"; -const crudFuncionariosRoute = "/dashboard-admin-crud-funcionarios"; +const crudFuncionariosRoute = "/dashboardEmployees"; const supabaseUrl = 'https://gfxmrqhwjqekfzrlurqr.supabase.co'; const supabaseKey = String.fromEnvironment('ANON_KEY'); const timeFormat = 'yyyy-MM-dd HH:mm:ss'; diff --git a/catavento/lib/main.dart b/catavento/lib/main.dart index c793d63..2656787 100644 --- a/catavento/lib/main.dart +++ b/catavento/lib/main.dart @@ -1,8 +1,9 @@ import 'package:catavento/bloc/demanda_bloc.dart'; import 'package:catavento/constants.dart'; -import 'package:catavento/screens/dashboardAdmin/dashboard_admin.dart'; +import 'package:catavento/views/login_view.dart'; +import 'screens/DashboardAdmin/dashboard_admin.dart'; import 'package:catavento/screens/Login/login.dart'; -import 'package:catavento/screens/employee-management.dart'; +import 'package:catavento/screens/dashboardFuncionarios/employee-management.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:supabase_flutter/supabase_flutter.dart'; @@ -20,7 +21,7 @@ void main() { ), home: const LoadView(), routes: { - loginRoute: (context) => const Login(), + loginRoute: (context) => const LoginView(), homeRoute: (context) => const DashBoardAdmin(), crudFuncionariosRoute: (context) => EmployeeManagement(), }, diff --git a/catavento/lib/screens/DashboardAdmin/components/demandCard.dart b/catavento/lib/screens/DashboardAdmin/components/demandCard.dart index d94ea74..4587197 100644 --- a/catavento/lib/screens/DashboardAdmin/components/demandCard.dart +++ b/catavento/lib/screens/DashboardAdmin/components/demandCard.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:catavento/bloc/demanda_bloc.dart'; import 'package:catavento/shared/widgets/dialog.dart'; -import 'package:catavento/screens/dashboardAdmin/components/infoCard.dart'; +import 'infoCard.dart'; import 'package:catavento/shared/widgets/inputs.dart'; import 'package:catavento/shared/widgets/confirmDialog.dart'; diff --git a/catavento/lib/screens/dashboardAdmin/components/showCustomDialog.dart b/catavento/lib/screens/DashboardAdmin/components/showCustomDialog.dart similarity index 98% rename from catavento/lib/screens/dashboardAdmin/components/showCustomDialog.dart rename to catavento/lib/screens/DashboardAdmin/components/showCustomDialog.dart index 06cd2e7..700d5a1 100644 --- a/catavento/lib/screens/dashboardAdmin/components/showCustomDialog.dart +++ b/catavento/lib/screens/DashboardAdmin/components/showCustomDialog.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; -import 'package:catavento/screens/dashboardAdmin/components/stage_demand.dart'; +import 'package:catavento/screens/DashboardAdmin/components/stage_demand.dart'; class ShowCustomDialog extends StatelessWidget { final String name; diff --git a/catavento/lib/screens/dashboardAdmin/components/stage_demand.dart b/catavento/lib/screens/DashboardAdmin/components/stage_demand.dart similarity index 100% rename from catavento/lib/screens/dashboardAdmin/components/stage_demand.dart rename to catavento/lib/screens/DashboardAdmin/components/stage_demand.dart diff --git a/catavento/lib/screens/Login/login.dart b/catavento/lib/screens/Login/login.dart index b0a9060..2e8c315 100644 --- a/catavento/lib/screens/Login/login.dart +++ b/catavento/lib/screens/Login/login.dart @@ -1,4 +1,3 @@ -import 'dart:js_interop'; import 'dart:developer'; import 'package:flutter/material.dart'; import 'components/input_purple.dart'; diff --git a/catavento/lib/screens/dashboardAdmin/components/confirmDialog.dart b/catavento/lib/screens/dashboardAdmin/components/confirmDialog.dart deleted file mode 100644 index dc9b50b..0000000 --- a/catavento/lib/screens/dashboardAdmin/components/confirmDialog.dart +++ /dev/null @@ -1,82 +0,0 @@ -import 'package:flutter/material.dart'; - -class ConfirmDialog extends StatelessWidget { - final String title; - final String contente; - final VoidCallback onConfirm; - - const ConfirmDialog({ - super.key, - required this.title, - required this.contente, - required this.onConfirm, - }); - - @override - Widget build(BuildContext context) { - return AlertDialog( - title: Text( - title, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - ), - ), - content: Text( - contente, - style: TextStyle( - fontSize: 20, - color: Colors.black, - ), - ), - actions: [ - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox( - width: 137, - height: 57, - child: ElevatedButton( - onPressed: onConfirm, - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFF50B432), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(22))), - child: Text( - "Sim", - style: TextStyle( - fontSize: 20, - color: Colors.white, - ), - )), - ), - SizedBox( - width: 40, - ), - SizedBox( - width: 137, - height: 57, - child: TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - style: TextButton.styleFrom( - backgroundColor: Color(0xFFD54A3D), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(22))), - child: Text( - "Não", - style: TextStyle( - fontSize: 20, - color: Colors.white, - ), - )), - ) - ], - )), - ], - ); - } -} diff --git a/catavento/lib/screens/dashboardAdmin/components/demandCard.dart b/catavento/lib/screens/dashboardAdmin/components/demandCard.dart deleted file mode 100644 index d94ea74..0000000 --- a/catavento/lib/screens/dashboardAdmin/components/demandCard.dart +++ /dev/null @@ -1,198 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:catavento/bloc/demanda_bloc.dart'; -import 'package:catavento/shared/widgets/dialog.dart'; -import 'package:catavento/screens/dashboardAdmin/components/infoCard.dart'; -import 'package:catavento/shared/widgets/inputs.dart'; -import 'package:catavento/shared/widgets/confirmDialog.dart'; - -class DemandCard extends StatelessWidget { - final String nomeDemanda; - final String status; - final String codigo; - final String descricao; - final int id; - final String imagemUrl; - final int order; - final DemandaBloc bloc; // BACKEND - - const DemandCard({ - super.key, - required this.nomeDemanda, - required this.codigo, - required this.status, - required this.descricao, - required this.id, - required this.order, - required this.imagemUrl, - required this.bloc, // BACKEND - }); - - @override - Widget build(BuildContext context) { - final TextEditingController nomeController = - TextEditingController(text: nomeDemanda); - final TextEditingController codigoController = - TextEditingController(text: codigo); - final TextEditingController descricaoController = - TextEditingController(text: descricao); - - return Card( - margin: EdgeInsets.symmetric(vertical: 8.0), - child: ListTile( - title: Text(nomeDemanda), - subtitle: Text( - 'Código: ${codigo.isNotEmpty ? codigo : 'Sem código'}\nStatus: $status'), - trailing: Row( - mainAxisSize: MainAxisSize.min, - children: [ - imagemUrl.isNotEmpty - ? Image.network(imagemUrl, width: 50, height: 50) - : Icon(Icons.image, size: 50), - IconButton( - icon: Icon(Icons.info), - onPressed: () { - _showInfoDialog(context, nomeDemanda, codigo, descricao, status, - "https://via.placeholder.com/150"); - }, - ), - // botão de Editar. - IconButton( - icon: Icon(Icons.edit), - onPressed: () { - // editar a demanda - _showEditDialog( - context, - nomeController, - codigoController, - descricaoController, - bloc); // BACKEND (não retirar o bloc, o resto OK) - }, - ), - // 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 - bloc.add(DemandaDelete(id, order)); // BACKEND - }, - ); - }, - ); - }), - ], - ), - ), - ); - } - - // Função para mostrar as informações da demanda em um diálogo - void _showInfoDialog(BuildContext context, String nome, String codigo, - String descricao, String status, String imageUrl) { - showDialog( - context: context, - builder: (BuildContext context) { - return ReusableDialog( - title: "Informações da Demanda", - body: InfoCard( - nome: nome, - codigo: codigo, - descricao: descricao, - status: status, - imageUrl: imageUrl, - ), - confirmBeforeClose: false, - ); - }, - ); - } - - void _showEditDialog( - BuildContext context, - TextEditingController nomeController, - TextEditingController codigoController, - TextEditingController descricaoController, - DemandaBloc bloc) { - showDialog( - context: context, - builder: (context) { - return ReusableDialog( - title: "Editar Demanda", - confirmBeforeClose: true, // Ativa a confirmação para fechar a janela - body: SingleChildScrollView( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - InputTextField( - labelText: "Nome da Demanda", - hintText: "Digite o nome da demanda", - controller: nomeController, - ), - const SizedBox(height: 10), - InputTextField( - labelText: "Código da Demanda", - hintText: "Digite o código da demanda", - controller: codigoController, - ), - const SizedBox(height: 10), - InputTextField( - labelText: "Descrição", - hintText: "Digite a descrição", - controller: descricaoController, - maxLines: 3, - keyboardType: TextInputType.multiline, - ), - const SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - ElevatedButton( - onPressed: () { - // Conexão com o Backend - bloc.add(DemandaUpdate( - id, - order, - nomeController.text, - codigoController.text, - descricaoController.text, - )); - Navigator.pop(context); - }, - style: ElevatedButton.styleFrom( - backgroundColor: const Color(0xFF50B432), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(22), - ), - ), - child: const Text("Salvar"), - ), - const SizedBox(width: 10), - ElevatedButton( - onPressed: () { - Navigator.pop(context); - }, - style: ElevatedButton.styleFrom( - backgroundColor: const Color(0xFFD54A3D), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(22), - ), - ), - child: const Text("Cancelar"), - ), - ], - ), - ], - ), - ), - ); - }, - ); - } -} diff --git a/catavento/lib/screens/dashboardAdmin/components/graph.dart b/catavento/lib/screens/dashboardAdmin/components/graph.dart deleted file mode 100644 index f4b04d4..0000000 --- a/catavento/lib/screens/dashboardAdmin/components/graph.dart +++ /dev/null @@ -1,122 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:fl_chart/fl_chart.dart'; - -class PizzaChart extends StatelessWidget { - final int completas; - final int restantes; - final List colors; - - const PizzaChart({ - super.key, - required this.completas, - required this.restantes, - required this.colors, - }); - - @override - Widget build(BuildContext context) { - final total = completas + restantes; - final completasPercent = completas / total; - final restantesPercent = restantes / total; - - return LayoutBuilder( - builder: (context, constraints) { - return SizedBox( - width: constraints.maxWidth, - height: constraints.maxHeight, - child: PieChart( - PieChartData( - sections: [ - PieChartSectionData( - value: completasPercent * 100, - title: '${(completasPercent * 100).toStringAsFixed(1)}%', - color: colors[0], - radius: constraints.maxWidth * 0.3, - ), - PieChartSectionData( - value: restantesPercent * 100, - title: '${(restantesPercent * 100).toStringAsFixed(1)}%', - color: colors[1], - radius: constraints.maxWidth * 0.3, - ), - ], - centerSpaceRadius: - constraints.maxWidth * 0.15, // Espaço no centro - ), - ), - ); - }, - ); - } -} - -class ChartContainer extends StatelessWidget { - final int completas; - final int restantes; - final List colors; - - const ChartContainer({ - super.key, - required this.completas, - required this.restantes, - required this.colors, - }); - - @override - Widget build(BuildContext context) { - return Container( - width: double.infinity, - height: 150, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(12), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.2), - blurRadius: 8, - offset: Offset(0, 4), - ), - ], - ), - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0), - child: Row( - children: [ - // Texto à esquerda - Expanded( - flex: 2, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Completas: $completas", - style: TextStyle(fontSize: 16, color: Colors.black), - ), - SizedBox(height: 5), - Text( - "Restantes: $restantes", - style: TextStyle(fontSize: 16, color: Colors.black), - ), - SizedBox(height: 10), - Text( - "Total: ${completas + restantes}", - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ], - ), - ), - // Gráfico à direita - Expanded( - flex: 3, - child: PizzaChart( - completas: completas, - restantes: restantes, - colors: colors, - ), - ), - ], - ), - ), - ); - } -} diff --git a/catavento/lib/screens/dashboardAdmin/components/header.dart b/catavento/lib/screens/dashboardAdmin/components/header.dart deleted file mode 100644 index b931fb2..0000000 --- a/catavento/lib/screens/dashboardAdmin/components/header.dart +++ /dev/null @@ -1,68 +0,0 @@ -import 'package:flutter/material.dart'; - -class Header extends StatelessWidget { - final String title; - final bool showHistoricoButton; - - const Header( - {super.key, required this.title, this.showHistoricoButton = true}); - - @override - Widget build(BuildContext context) { - return Padding( - padding: const EdgeInsets.all(2.0), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconMenu(), - if (showHistoricoButton) // o header mostra o botão somente se showHistoricoButton for true - ElevatedButton( - onPressed: () {}, - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFF015C98), - padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10), - ), - child: Text('Ver histórico', - style: TextStyle(fontSize: 16, color: Colors.white)), - ), - ], - ), - Text( - title, - style: TextStyle( - fontSize: 26, - fontWeight: FontWeight.bold, - color: Color(0xFF015C98), - ), - ), - ], - ), - ); - } -} - -// Icon Menu -class IconMenu extends StatefulWidget { - const IconMenu({super.key}); - - @override - State createState() { - return IconMenuState(); - } -} - -class IconMenuState extends State { - @override - Widget build(BuildContext context) { - return IconButton( - iconSize: 35, - onPressed: () { - // Lógica do menu - }, - icon: Icon(Icons.menu), - color: Color(0xFF015C98), - ); - } -} diff --git a/catavento/lib/screens/dashboardAdmin/components/menu.dart b/catavento/lib/screens/dashboardAdmin/components/menu.dart deleted file mode 100644 index b81755b..0000000 --- a/catavento/lib/screens/dashboardAdmin/components/menu.dart +++ /dev/null @@ -1,51 +0,0 @@ -import 'package:flutter/material.dart'; - -class Navbar extends StatelessWidget { - @override - Widget build(BuildContext context) { - return Drawer( - child: Column( - children: [ - UserAccountsDrawerHeader( - accountName: const Text( - 'João das Couves', // depois alterar aqui pra pegar o nome no banco de dados - style: TextStyle(color: Color.fromARGB(255, 0, 0, 0)), - ), - accountEmail: const Text( - 'Administrador', // depois alterar aqui pra pegar o setor no banco de dados - style: TextStyle(color: Color.fromARGB(255, 0, 0, 0)), - ), - currentAccountPicture: CircleAvatar( - backgroundColor: Colors.grey.shade200, - child: const Icon(Icons.person), - ), - decoration: BoxDecoration( - color: Color(0xFFF4D5D7), - ), - ), - ListTile( - title: const Text('Demandas'), - onTap: () { - Navigator.pushReplacementNamed(context, '/home/'); - }, - ), - ListTile( - title: const Text('Funcionários'), - onTap: () { - Navigator.pushReplacementNamed( - context, '/dashboard-admin-crud-funcionarios'); - }, - ), - ListTile( - title: const Text('Produtos'), - onTap: () {}, - ), - ListTile( - title: const Text('Sair da Conta'), - onTap: () {}, - ), - ], - ), - ); - } -} diff --git a/catavento/lib/screens/dashboardAdmin/dashboard_admin.dart b/catavento/lib/screens/dashboardAdmin/dashboard_admin.dart deleted file mode 100644 index 83e972e..0000000 --- a/catavento/lib/screens/dashboardAdmin/dashboard_admin.dart +++ /dev/null @@ -1,378 +0,0 @@ -import 'dart:io'; -import 'package:catavento/screens/DashboardAdmin/components/demandCard.dart'; -import 'package:flutter/material.dart'; -import 'package:intl/intl.dart'; -import 'package:flutter/services.dart'; -import 'package:image_picker/image_picker.dart'; - -// BACKEND -import 'package:catavento/bloc/demanda_bloc.dart'; -import 'package:catavento/bloc/demanda_controller.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import '../../services/table_import/table_import.dart'; -import '../../services/table_import/table_picker.dart'; - -// components -import 'package:catavento/shared/widgets/header.dart'; -import 'package:catavento/shared/widgets/menu.dart'; -import 'package:catavento/shared/widgets/dialog.dart'; -import 'package:catavento/shared/widgets/inputs.dart'; -import 'package:catavento/screens/DashboardAdmin/components/quadroPrioridade.dart'; -import 'package:catavento/screens/DashboardAdmin/components/quadroGrafico.dart'; -import 'package:catavento/screens/DashboardAdmin/components/search.dart'; - -class DashBoardAdmin extends StatelessWidget { - const DashBoardAdmin({super.key}); - - @override - Widget build(BuildContext context) { - String formattedDate = DateFormat('dd/MM/yyyy').format(DateTime.now()); - - return Scaffold( - drawer: Navbar(), - appBar: CustomHeader(title: 'Demandas atuais $formattedDate'), - extendBodyBehindAppBar: true, - body: Stack( - children: [ - Container( - width: double.infinity, - height: double.infinity, - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [Color(0xFF75CDF3), Color(0xFFB2E8FF)], - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - ), - ), - child: Center(child: AddDemandPageAdmin()), - ), - ], - ), - floatingActionButton: FloatingActionButton( - backgroundColor: Color(0xFF015C98), - onPressed: () async { - final filePath = await tablePicker(); - if (filePath != null) { - await importExcelToSupabase(filePath); - } - }, - child: Icon(Icons.upload_file, color: Colors.white), - ), - ); - } -} - -//Estrutura da pagina -class AddDemandPageAdmin extends StatefulWidget { - const AddDemandPageAdmin({super.key}); - - @override - State createState() { - return AddDemandPageAdminState(); - } -} - -class AddDemandPageAdminState extends State { - late final DemandaController demandaController; - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - final size = MediaQuery.of(context).size; // Obtém o tamanho da tela - - return SingleChildScrollView( - child: Padding( - padding: EdgeInsets.all(20), - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - // Barra de Pesquisa - Padding( - padding: EdgeInsets.zero, - child: Search(), - ), - SizedBox(height: 20), - - // Ajustando a altura com Flex/Expanded - Padding( - padding: EdgeInsets.symmetric(horizontal: 0), - child: LayoutBuilder( - builder: (context, constraints) { - return constraints.maxWidth > 600 - ? Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - // ainda falta ajustar a responsividade desse quadro, além de q o design vai mudar - Flexible( - flex: 1, - child: QuadroPrioridade(), - ), - SizedBox(width: 15), - Flexible( - flex: 2, - child: ListDemanda(), - ), - SizedBox(width: 15), - Flexible( - flex: 1, - child: QuadroGrafico(), - ), - ], - ) - : Column( - children: [ - Expanded( - child: QuadroPrioridade(), - ), - SizedBox(height: size.height * 0.02), - Expanded( - child: ListDemanda(), - ), - SizedBox(height: size.height * 0.02), - Expanded( - child: QuadroGrafico(), - ), - ], - ); - }, - ), - ), - ], - ), - ), - ), - ); - } - - @override - void dispose() { - super.dispose(); - } -} - -class ListDemanda extends StatefulWidget { - const ListDemanda({super.key}); - - @override - State createState() { - return ListDemandaState(); - } -} - -class ListDemandaState extends State { - File? foto; - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - final size = MediaQuery.of(context).size; // Tamanho da tela - return Container( - padding: EdgeInsets.all(10.0), - width: size.width * 0.9, - height: size.height * 0.65, - decoration: BoxDecoration( - color: Color(0xFFFFFFFF), - borderRadius: BorderRadius.circular(17), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.3), - spreadRadius: 1, - blurRadius: 5, - offset: Offset(0, 3), - ), - ], - ), - child: Column( - children: [ - Expanded( - child: BlocBuilder( - builder: (context, state) { - return ListView.builder( - itemCount: state.databaseResponse.length, - itemBuilder: (context, index) { - final demanda = state.databaseResponse[index]; - return DemandCard( - nomeDemanda: - demanda['nome_demanda'] ?? 'Nome não disponível', - status: demanda['status'] ?? 'Status não disponível', - codigo: demanda['codigo'] ?? 'Sem código', - descricao: demanda['descricao'] ?? 'Sem descricao', - id: demanda['id'], - imagemUrl: demanda['imagem_url'] ?? '', - order: index, - bloc: context.read(), // BACKEND - ); - }, - ); - }, - ), - ), - SizedBox(height: 10), // Espaço entre a lista e o botão - ButtonAddDemanda( - bloc: context.read(), // BACKEND - ), - ], - ), - ); - } -} - -//ignore: must_be_immutable -class ButtonAddDemanda extends StatelessWidget { - final DemandaBloc bloc; // BACKEND - ButtonAddDemanda({ - super.key, - required this.bloc, // BACKEND - }); - - final TextEditingController _nomeController = TextEditingController(); - final TextEditingController _codigoController = TextEditingController(); - final TextEditingController _descricaoController = TextEditingController(); - File? fotoSelecionada; - - Future _selecionarFoto(BuildContext context) async { - final ImagePicker picker = ImagePicker(); - final XFile? imagemSelecionada = await picker.pickImage( - source: ImageSource.gallery, - maxHeight: 800, - maxWidth: 800, - imageQuality: 85, - ); - - if (imagemSelecionada != null) { - fotoSelecionada = File(imagemSelecionada.path); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('Foto selecionada com sucesso!')), - ); - } - } - - @override - Widget build(BuildContext context) { - return SizedBox( - width: 189, - height: 47, - child: ElevatedButton( - onPressed: () { - addInfoDemand(context); - }, - style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFF015C98), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(22))), - child: Text( - "Adicionar Demanda", - style: TextStyle( - color: Colors.white, - ), - ), - ), - ); - } - - Future addInfoDemand(BuildContext context) => showDialog( - context: context, - builder: (BuildContext context) { - return ReusableDialog( - title: "Nova demanda", - confirmBeforeClose: true, - body: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: InputTextField( - labelText: "Código", - hintText: "Código da demanda", - controller: _codigoController, - keyboardType: TextInputType.number, - inputFormatters: [ - FilteringTextInputFormatter.digitsOnly - ], - ), - ), - Expanded( - child: InputTextField( - labelText: "Nome", - hintText: "Nome da demanda", - controller: _nomeController, - ), - ), - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - InputTextField( - labelText: "Descrição", - hintText: "Digite a descrição", - controller: _descricaoController, - maxLines: 3, - ), - ], - ), - const SizedBox(height: 20), - Row( - children: [ - Expanded( - child: ElevatedButton( - onPressed: () { - _selecionarFoto(context); - }, - child: const Text("Selecionar Foto"), - ), - ), - ], - ), - const SizedBox(height: 10), - ElevatedButton( - onPressed: () async { - if (_nomeController.text.isNotEmpty && - _codigoController.text.isNotEmpty) { - bloc.add(DemandaCreate( - nomeDemanda: _nomeController.text, - codigo: _codigoController.text, - descricao: _descricaoController.text, - foto: fotoSelecionada, - )); - Navigator.pop(context); - } else { - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: - Text("Por favor, preencha todos os campos"), - ), - ); - } - }, - style: ElevatedButton.styleFrom( - backgroundColor: const Color(0xFF015C98), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(22), - ), - ), - child: const Text( - "Cadastrar demanda", - style: TextStyle(color: Colors.white), - ), - ), - ], - ), - ), - ); - }, - ); -} diff --git a/catavento/lib/screens/dashboardAdmin/components/ativAndamentoCard.dart b/catavento/lib/screens/dashboardFuncionarios/components/ativAndamentoCard.dart similarity index 100% rename from catavento/lib/screens/dashboardAdmin/components/ativAndamentoCard.dart rename to catavento/lib/screens/dashboardFuncionarios/components/ativAndamentoCard.dart diff --git a/catavento/lib/screens/dashboardAdmin/components/funcionarioCard.dart b/catavento/lib/screens/dashboardFuncionarios/components/funcionarioCard.dart similarity index 95% rename from catavento/lib/screens/dashboardAdmin/components/funcionarioCard.dart rename to catavento/lib/screens/dashboardFuncionarios/components/funcionarioCard.dart index 003bda0..15368b3 100644 --- a/catavento/lib/screens/dashboardAdmin/components/funcionarioCard.dart +++ b/catavento/lib/screens/dashboardFuncionarios/components/funcionarioCard.dart @@ -1,8 +1,8 @@ -import 'package:catavento/screens/dashboardAdmin/components/infoFuncionarios.dart'; -import 'package:catavento/screens/dashboardAdmin/components/showDialog.dart'; +import 'package:catavento/screens/dashboardFuncionarios/components/infoFuncionarios.dart'; +import 'package:catavento/shared/widgets/showDialog.dart'; import 'package:flutter/material.dart'; -import 'input.dart'; -import 'confirmDialog.dart'; +import '../../../shared/widgets/input.dart'; +import 'package:catavento/shared/widgets/confirmDialog.dart'; class FuncionarioCard extends StatefulWidget { final String nomeFuncionario; diff --git a/catavento/lib/screens/dashboardAdmin/components/infoFuncionarios.dart b/catavento/lib/screens/dashboardFuncionarios/components/infoFuncionarios.dart similarity index 100% rename from catavento/lib/screens/dashboardAdmin/components/infoFuncionarios.dart rename to catavento/lib/screens/dashboardFuncionarios/components/infoFuncionarios.dart diff --git a/catavento/lib/screens/dashboardFuncionarios/dashboard_funcionarios.dart b/catavento/lib/screens/dashboardFuncionarios/dashboard_funcionarios.dart index 6daf9bf..d3671b9 100644 --- a/catavento/lib/screens/dashboardFuncionarios/dashboard_funcionarios.dart +++ b/catavento/lib/screens/dashboardFuncionarios/dashboard_funcionarios.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:catavento/screens/dashboardAdmin/components/menu.dart'; +import 'package:catavento/shared/widgets/menu.dart'; import '../../services/table_import/table_import.dart'; import '../../services/table_import/table_picker.dart'; diff --git a/catavento/lib/screens/employee-management.dart b/catavento/lib/screens/dashboardFuncionarios/employee-management.dart similarity index 50% rename from catavento/lib/screens/employee-management.dart rename to catavento/lib/screens/dashboardFuncionarios/employee-management.dart index 91e6d7d..06ab1bc 100644 --- a/catavento/lib/screens/employee-management.dart +++ b/catavento/lib/screens/dashboardFuncionarios/employee-management.dart @@ -1,12 +1,29 @@ +import 'package:catavento/bloc/usuario_bloc.dart'; +import 'package:catavento/shared/widgets/confirmDialog.dart'; +import 'package:catavento/shared/widgets/graficInfo.dart'; +import 'package:catavento/screens/DashboardAdmin/dashboard_admin.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'components/ativAndamentoCard.dart'; +import 'package:catavento/shared/widgets/input.dart'; import 'package:flutter/material.dart'; - -import 'DashboardAdmin/components/background.dart'; -import 'DashboardAdmin/components/blocks.dart'; -import 'DashboardAdmin/components/header.dart'; -import 'DashboardAdmin/components/input.dart'; -import 'DashboardAdmin/components/showDialog.dart'; +import 'package:catavento/shared/widgets/background.dart'; +import 'package:catavento/shared/widgets/header.dart'; +import 'package:catavento/shared/widgets/blocks.dart'; +import 'package:catavento/shared/widgets/showDialog.dart'; +import 'package:catavento/shared/widgets/menu.dart'; +import 'components/funcionarioCard.dart'; class EmployeeManagement extends StatelessWidget { + + final List> ativAndamento = [ + {'nome': 'nomeFuncionario', 'demanda': 'nomeDemanda'}, + {'nome': 'nomeFuncionario', 'demanda': 'nomeDemanda'}, + {'nome': 'nomeFuncionario', 'demanda': 'nomeDemanda'}, + {'nome': 'nomeFuncionario', 'demanda': 'nomeDemanda'}, + {'nome': 'nomeFuncionario', 'demanda': 'nomeDemanda'}, + {'nome': 'nomeFuncionario', 'demanda': 'nomeDemanda'}, + ]; + final List> funcionarios = [ {'nome': 'nomeFuncionario', 'setor': 'nomeCargo', 'status': 'Ativo'}, {'nome': 'nomeFuncionario', 'setor': 'nomeCargo', 'status': 'Ativo'}, @@ -19,11 +36,54 @@ class EmployeeManagement extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( + drawer: Navbar(), + appBar: AppBar( + backgroundColor: Colors.transparent, + elevation: 0, + iconTheme: const IconThemeData( + color: Color(0xFF015C98), + ), + leading: Builder( + builder: (BuildContext context) { + return Padding( + padding: const EdgeInsets.only(left: 20), // Padding aqui + child: Material( + color: Colors.transparent, // Mantém o fundo transparente + child: InkWell( + onTap: () { + Scaffold.of(context).openDrawer(); // Abre o Drawer + }, + ), + ), + ); + }, + ), + actions: [ + Padding( + padding: const EdgeInsets.only( + right: 20), // Ajuste o valor conforme necessário + child: TextButton.icon( + icon: const Icon(Icons.history, size: 18.0), + label: const Text("Ver Histórico"), + onPressed: () {}, + style: TextButton.styleFrom( + foregroundColor: Colors.white, + backgroundColor: const Color(0xFF015C98), + padding: + const EdgeInsets.symmetric(horizontal: 15, vertical: 10), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), + ), + ), + ), + ], + ), + extendBodyBehindAppBar: true, body: BackgroundPage( gradientColors: [Color(0xFF75CDF3), Color(0xFFB2E8FF)], children: [ - Header(title: "Funcionários"), - SizedBox(height: MediaQuery.of(context).size.height * 0.05), + CustomHeader(title: "Funcionários"), Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, @@ -32,39 +92,38 @@ class EmployeeManagement extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Blocks( - color: Colors.white, - height: 97, - width: 321, - borderRadius: 26, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Icon( - Icons.group, - size: 30, - color: Color(0xFF015C98), - ), - SizedBox( - width: MediaQuery.of(context).size.height * 0.04), - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [], - ) - ], - )), + /*Blocks( Precisa do backend para funcionar. + color: Colors.white, + height: 97, + width: 321, + borderRadius: 26, + child: + Graficinfo( + size: 50, + icons: Icons.group_add, + colorIcons: Color(0xFF015C98), + info: 'Funcionários', + dataKey: 'total', + buildWhen: (previous, current) => previous.metaData != current.metaData, + ) + ),*/ + SizedBox(height: MediaQuery.of(context).size.height * 0.02), - /*Blocks( + /*Blocks( Precisa do backend para funcionar color: Colors.white, height: 97, width: 321, borderRadius: 26, - children: [ - - ], + child: + Graficinfo( + size: 50, + icons: Icons.verified, + colorIcons: Colors.green, + info: 'Funcionários presentes', + dataKey: 'funcionarios', + buildWhen: (previous, current) => previous.metaData != current.metaData, + ) ),*/ SizedBox(height: MediaQuery.of(context).size.height * 0.02), @@ -82,71 +141,43 @@ class EmployeeManagement extends StatelessWidget { height: 402, title: 'Novo funcionário', child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Inputs( - text: "Nome:", - hint: "Nome do funcionário", - ), - SizedBox( - height: - MediaQuery.of(context).size.height * - 0.02), - Inputs( - text: "Setor:", - hint: "Setor do funcionário", - ), - SizedBox( - height: - MediaQuery.of(context).size.height * - 0.02), - Inputs( - text: "Email:", - hint: "Email do funcionário", - ), - SizedBox( - height: - MediaQuery.of(context).size.height * - 0.02), - Inputs( - text: "Nome de usuário:", - hint: "Nome de usuário do funcionário", - ), - SizedBox( - height: - MediaQuery.of(context).size.height * - 0.02), - Inputs( - text: "Senha:", - hint: "Senha para o funcionário", - ), - 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), - )))) - ]), + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + + children: [ + Inputs(text: "Nome:",hint: "Nome do funcionário",), + SizedBox(height: MediaQuery.of(context).size.height * 0.02), + Inputs(text: "Setor:",hint: "Setor do funcionário",), + SizedBox(height: MediaQuery.of(context).size.height * 0.02), + Inputs(text: "Email:",hint: "Email do funcionário",), + SizedBox(height: MediaQuery.of(context).size.height * 0.02), + Inputs(text: "Nome de usuário:",hint: "Nome de usuário do funcionário",), + SizedBox(height: MediaQuery.of(context).size.height * 0.02), + Inputs(text: "Senha:",hint: "Senha para o funcionário",), + 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), + ) + + ) + ) + ) + ] + ), ); }, ); @@ -167,10 +198,10 @@ class EmployeeManagement extends StatelessWidget { ), SizedBox(width: MediaQuery.of(context).size.height * 0.07), - /*Blocks( + Blocks( + title: "Todos os funcionários", color: Colors.white, - height: 559, - width: 346, + borderRadius: 26, child: SizedBox( height: MediaQuery.of(context).size.height * 0.6, @@ -193,9 +224,8 @@ class EmployeeManagement extends StatelessWidget { SizedBox(width: MediaQuery.of(context).size.height * 0.07), Blocks( + title: "Atividades em andamento", color: Colors.white, - height: 559, - width: 380, borderRadius: 26, child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -256,11 +286,11 @@ class EmployeeManagement extends StatelessWidget { ], ) - )*/ + ) ], ), ], ), ); } -} +} \ No newline at end of file diff --git a/catavento/lib/screens/dashboardAdmin/components/background.dart b/catavento/lib/shared/widgets/background.dart similarity index 100% rename from catavento/lib/screens/dashboardAdmin/components/background.dart rename to catavento/lib/shared/widgets/background.dart diff --git a/catavento/lib/screens/dashboardAdmin/components/blocks.dart b/catavento/lib/shared/widgets/blocks.dart similarity index 81% rename from catavento/lib/screens/dashboardAdmin/components/blocks.dart rename to catavento/lib/shared/widgets/blocks.dart index d9383aa..ff6df14 100644 --- a/catavento/lib/screens/dashboardAdmin/components/blocks.dart +++ b/catavento/lib/shared/widgets/blocks.dart @@ -26,17 +26,14 @@ class Blocks extends StatefulWidget { class BlocksState extends State { @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; + final double defaultHeight = MediaQuery.of(context).size.height * 0.75; + final double defaultWidth = MediaQuery.of(context).size.width * 0.3; return Stack( children: [ Container( - width: blockWidth, - height: blockHeight, + height: widget.height ?? defaultHeight, + width: widget.width ?? defaultWidth, padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: widget.color, diff --git a/catavento/lib/screens/dashboardAdmin/components/graficInfo.dart b/catavento/lib/shared/widgets/graficInfo.dart similarity index 100% rename from catavento/lib/screens/dashboardAdmin/components/graficInfo.dart rename to catavento/lib/shared/widgets/graficInfo.dart diff --git a/catavento/lib/screens/dashboardAdmin/components/input.dart b/catavento/lib/shared/widgets/input.dart similarity index 100% rename from catavento/lib/screens/dashboardAdmin/components/input.dart rename to catavento/lib/shared/widgets/input.dart diff --git a/catavento/lib/shared/widgets/menu.dart b/catavento/lib/shared/widgets/menu.dart index 7efcd07..e0f9862 100644 --- a/catavento/lib/shared/widgets/menu.dart +++ b/catavento/lib/shared/widgets/menu.dart @@ -27,11 +27,15 @@ class Navbar extends StatelessWidget { ), ListTile( title: const Text('Demandas'), - onTap: () {}, + onTap: () { + Navigator.pushNamed(context, '/home/'); + }, ), ListTile( title: const Text('Funcionários'), - onTap: () {}, + onTap: () { + Navigator.pushNamed(context, '/dashboardEmployees'); + }, ), ListTile( title: const Text('Produtos'), diff --git a/catavento/lib/screens/dashboardAdmin/components/showDialog.dart b/catavento/lib/shared/widgets/showDialog.dart similarity index 100% rename from catavento/lib/screens/dashboardAdmin/components/showDialog.dart rename to catavento/lib/shared/widgets/showDialog.dart diff --git a/catavento/pubspec.lock b/catavento/pubspec.lock index 6ebffd0..c54d64c 100644 --- a/catavento/pubspec.lock +++ b/catavento/pubspec.lock @@ -85,10 +85,10 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.0" cross_file: dependency: transitive description: @@ -364,18 +364,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.7" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.8" leak_tracker_testing: dependency: transitive description: @@ -620,7 +620,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: @@ -633,10 +633,10 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.12.0" storage_client: dependency: transitive description: @@ -657,10 +657,10 @@ packages: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" supabase: dependency: transitive description: @@ -689,10 +689,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.3" typed_data: dependency: transitive description: @@ -777,10 +777,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b url: "https://pub.dev" source: hosted - version: "14.2.5" + version: "14.3.0" web: dependency: transitive description: