Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .dart_tool/package_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@
"packageUri": "lib/",
"languageVersion": "3.3"
},
{
"name": "equatable",
"rootUri": "file:///C:/Users/PC/AppData/Local/Pub/Cache/hosted/pub.dev/equatable-2.0.7",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "fake_async",
"rootUri": "file:///C:/Users/PC/AppData/Local/Pub/Cache/hosted/pub.dev/fake_async-1.3.3",
Expand Down Expand Up @@ -169,6 +175,12 @@
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "fl_chart",
"rootUri": "file:///C:/Users/PC/AppData/Local/Pub/Cache/hosted/pub.dev/fl_chart-0.67.0",
"packageUri": "lib/",
"languageVersion": "3.2"
},
{
"name": "flutter",
"rootUri": "file:///C:/flutter/packages/flutter",
Expand Down
17 changes: 17 additions & 0 deletions .dart_tool/package_graph.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dio",
"firebase_auth",
"firebase_core",
"fl_chart",
"flutter",
"flutter_dotenv",
"flutter_web_plugins",
Expand Down Expand Up @@ -180,6 +181,14 @@
"meta"
]
},
{
"name": "fl_chart",
"version": "0.67.0",
"dependencies": [
"equatable",
"flutter"
]
},
{
"name": "flutter_web_plugins",
"version": "0.0.0",
Expand Down Expand Up @@ -565,6 +574,14 @@
"plugin_platform_interface"
]
},
{
"name": "equatable",
"version": "2.0.7",
"dependencies": [
"collection",
"meta"
]
},
{
"name": "sky_engine",
"version": "0.0.0",
Expand Down
Binary file modified build/7e4aebe516b998635f34742713e086a8.cache.dill.track.dill
Binary file not shown.
50 changes: 50 additions & 0 deletions build/flutter_assets/NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -3925,6 +3925,31 @@ which is quoted below:
full, permanent, irrevocable, nonexclusive and worldwide license for
all her or his copyright and related or neighboring legal rights in
the Work.
--------------------------------------------------------------------------------
equatable

MIT License

Copyright (c) 2024 Felix Angelov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--------------------------------------------------------------------------------
etc_decoder

Expand Down Expand Up @@ -5385,6 +5410,31 @@ firebase_core_web
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------
fl_chart

MIT License

Copyright (c) 2022 Flutter 4 Fun

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--------------------------------------------------------------------------------
flatbuffers

Expand Down
2 changes: 1 addition & 1 deletion lib/controllers/homepage_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class HomePageController extends ChangeNotifier {
? p.consultingType
: 'Sin categoría';

final DateTime? endDate = p.endDate;
final DateTime endDate = p.endDate;
final String dueLabel = endDate != null
? '${endDate.day.toString().padLeft(2, '0')}/'
'${endDate.month.toString().padLeft(2, '0')}/'
Expand Down
2 changes: 1 addition & 1 deletion lib/controllers/resources_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ class ResourcesController {

for (final doc in humanSnap.docs) {
if (doc.exists) {
final data = doc.data() as Map<String, dynamic>;
final data = doc.data();
if (data.containsKey('name')) {
final int currentUse = (data['use'] as num? ?? 0).toInt();
final int total = (data['totalUsage'] as num? ?? 0).toInt();
Expand Down
49 changes: 49 additions & 0 deletions lib/controllers/task_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,55 @@ class TaskController extends ChangeNotifier {
];
}

// ===================== REPORTING LOGIC (Task Count by Status) =====================

Map<String, int> _countTasksByStatus(List<Task> tasks) {
final Map<String, int> counts = {};
for (var task in tasks) {
final statusKey = _statusToString(task.status);
counts[statusKey] = (counts[statusKey] ?? 0) + 1;
}
return counts;
}

Stream<Map<String, int>> streamTaskStatusCounts() {
if (_currentProjectId == null) {
return const Stream<Map<String, int>>.empty();
}

return _firestore
.collection('projects')
.doc(_currentProjectId!)
.collection('tasks')
.snapshots()
.map((snapshot) {
final List<Task> tasks = snapshot.docs.map((doc) {
final Map<String, dynamic> data = doc.data();
return Task(
id: doc.id,
title: data['title'] ?? '',
description: data['description'] ?? '',
projectType: data['projectType'] ?? '',
assignee: data['assignee'] ?? '',
priority: _stringToPriority(
(data['priority'] ?? 'MEDIUM').toString(),
),
status: _stringToStatus(
(data['status'] ?? 'pendiente').toString(),
),
estimatedHours: (data['estimatedHours'] ?? 0).toDouble(),
dueTime: data['dueDate'] != null
? DateTime.parse(data['dueDate'] as String)
: null,
tags: List<String>.from(data['tags'] ?? <String>[]),
projectId: _currentProjectId!,
);
}).toList();

return _countTasksByStatus(tasks);
});
}

// ===== MAPPERS: PRIORITY & STATUS =====

Priority _stringToPriority(String priority) {
Expand Down
3 changes: 1 addition & 2 deletions lib/core/routes/app_routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:prolab_unimet/views/task_view.dart';
import 'package:provider/provider.dart';
import 'package:prolab_unimet/views/dashboard_view.dart';
import 'package:prolab_unimet/views/help_module_view.dart';
import 'package:prolab_unimet/controllers/settings_controller.dart';

// Define user roles for authorization
const userRoles = ['USER', 'ADMIN', 'COORDINATOR'];
Expand Down Expand Up @@ -96,7 +95,7 @@ final appRouter = GoRouter(
),
GoRoute(
path: '/admin-reports',
builder: (context, state) => const ReportsView(),
builder: (context, state) => ReportsView(),
redirect: (context, state) => _requireAuth(context, userRoles),
),
],
Expand Down
4 changes: 2 additions & 2 deletions lib/services/auth_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AuthService {
'role': role,
'token': token,
};
} on fb_auth.FirebaseAuthException catch (e) {
} on fb_auth.FirebaseAuthException {
rethrow;
} catch (e) {
// Non-Firebase auth error (network, Firestore, etc.)
Expand Down Expand Up @@ -137,7 +137,7 @@ class AuthService {
/// Returns a fresh ID token for the current user, if any.
Future<String?> getToken() async {
final fb_auth.User? user = _auth.currentUser;
return user != null ? user.getIdToken() : null;
return user?.getIdToken();
}

/// Signs out the current user.
Expand Down
4 changes: 2 additions & 2 deletions lib/views/components/resources/assign_resource.dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class _AssignResourceDialogState extends State<AssignResourceDialog> {

final List<String> nombres = snap.data!;
return DropdownButtonFormField<String>(
value: _selectedProject,
initialValue: _selectedProject,
items: nombres
.map(
(nombre) => DropdownMenuItem<String>(
Expand Down Expand Up @@ -166,7 +166,7 @@ class _AssignResourceDialogState extends State<AssignResourceDialog> {
const Text('Prioridad *'),
const SizedBox(height: 4),
DropdownButtonFormField<String>(
value: _selectedPriority,
initialValue: _selectedPriority,
items: const [
DropdownMenuItem(value: 'Alta', child: Text('Alta')),
DropdownMenuItem(value: 'Media', child: Text('Media')),
Expand Down
20 changes: 10 additions & 10 deletions lib/views/help_module_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,15 @@ class _FaqItem extends StatelessWidget {
),
),

trailing: Icon(
isExpanded ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Theme.of(context).colorScheme.primary,
),
tilePadding: const EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 4.0,
),

children: <Widget>[
Padding(
padding: const EdgeInsets.only(
Expand All @@ -424,15 +433,6 @@ class _FaqItem extends StatelessWidget {
),
),
],

trailing: Icon(
isExpanded ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down,
color: Theme.of(context).colorScheme.primary,
),
tilePadding: const EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 4.0,
),
),
),
);
Expand Down Expand Up @@ -594,7 +594,7 @@ class _QuickLinksSection extends StatelessWidget {
),
),
);
}).toList(),
}),
],
),
);
Expand Down
Loading