Skip to content

Commit

Permalink
06/09/2023
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomjerry12345 committed Sep 5, 2023
1 parent 03cc334 commit fc0a306
Show file tree
Hide file tree
Showing 13 changed files with 382 additions and 364 deletions.
123 changes: 0 additions & 123 deletions lib/screens/DataAnggota.dart

This file was deleted.

16 changes: 8 additions & 8 deletions lib/screens/dashboard_screen.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:web_dashboard_app_tut/screens/DataAnggota.dart';
import 'package:web_dashboard_app_tut/screens/data_buku.dart';
import 'package:web_dashboard_app_tut/screens/peminjaman.dart';
import 'package:web_dashboard_app_tut/screens/pengembalian.dart';
import 'package:web_dashboard_app_tut/screens/qr_code.dart';
import 'package:web_dashboard_app_tut/screens/data_anggota/data_anggota.dart';
import 'package:web_dashboard_app_tut/screens/data_buku/data_buku.dart';
import 'package:web_dashboard_app_tut/screens/peminjaman/peminjaman.dart';
import 'package:web_dashboard_app_tut/screens/pengembalian/pengembalian.dart';
import 'package:web_dashboard_app_tut/screens/scan/scan.dart';
import 'package:web_dashboard_app_tut/widget/gambar.dart';

class DashboardScreen extends StatefulWidget {
Expand Down Expand Up @@ -84,7 +84,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
destinations: [
NavigationRailDestination(
icon: Icon(Icons.qr_code),
label: Text("Qr Code"),
label: Text("Scan"),
),
NavigationRailDestination(
icon: Icon(Icons.book),
Expand All @@ -110,14 +110,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
selectedIndex: index),
),
index == 0
? Home()
? Scan()
: index == 1
? DataBuku()
: index == 2
? Peminjaman()
: index == 3
? pengembalian()
: dataanggota()
: DataAnggota()
],
),
);
Expand Down
88 changes: 88 additions & 0 deletions lib/screens/data_anggota/data_anggota.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class DataAnggota extends StatefulWidget {
const DataAnggota({Key? key}) : super(key: key);

@override
State<DataAnggota> createState() => _DataAnggotaState();
}

class _DataAnggotaState extends State<DataAnggota> {
FirebaseFirestore firestore = FirebaseFirestore.instance;

@override
Widget build(BuildContext context) {
return StreamBuilder<QuerySnapshot>(
stream: firestore.collection("users").snapshots(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return Expanded(
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(left: 20, right: 20, top: 30, bottom: 10),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"Data Anggota",
style: TextStyle(fontSize: 25, fontWeight: FontWeight.w600),
),
],
),
),
Padding(
padding: EdgeInsets.only(left: 10, right: 10, bottom: 40, top: 15),
child: Column(
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
headingRowColor: MaterialStateProperty.resolveWith(
(states) => Colors.blue.shade200),
columns: [
DataColumn(label: Text("No Anggota")),
DataColumn(label: Text("Nama")),
DataColumn(label: Text("Email")),
DataColumn(label: Text("Pekerjaan")),
DataColumn(label: Text("Alamat")),
DataColumn(label: Text("No Hp")),
DataColumn(label: Text("Nama Ibu")),
DataColumn(label: Text("No Hp Ibu")),
],
rows: List<DataRow>.generate(snapshot.data!.docs.length, (index) {
DocumentSnapshot data = snapshot.data!.docs[index];

return DataRow(cells: [
DataCell(Text(data['no_anggota'])),
DataCell(Text(data['nama'])),
DataCell(Text(data['email'])),
DataCell(Text(data['pekerjaan'])),
DataCell(Text(data['alamat'])),
DataCell(Text(data['hp'])),
DataCell(Text(data['ibu_kandung'])),
DataCell(Text(data['no_hp_ibu_kandung'])),
]);
})),
),
//Now let's set the pagination
SizedBox(
height: 40.0,
),
],
),
),
],
),
);
} else {
return Expanded(
child: Center(child: CircularProgressIndicator()),
);
}
});
}
}
File renamed without changes.
100 changes: 0 additions & 100 deletions lib/screens/detail_peminjaman.dart

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import 'package:flutter/material.dart';
import 'package:web_dashboard_app_tut/services/FirebaseServices.dart';
import 'package:web_dashboard_app_tut/widget/header/header_widget.dart';

import '../utils/log_utils.dart';

class Peminjaman extends StatefulWidget {
const Peminjaman({Key? key}) : super(key: key);

Expand Down Expand Up @@ -46,7 +44,6 @@ class _PeminjamanState extends State<Peminjaman> {

for (var item in data) {
Map<String, dynamic> d = item.data() as Map<String, dynamic>;
log("d", v: d);
String namaPeminjam = d["nama_peminjam"];
if (!groupedData.containsKey(namaPeminjam)) {
groupedData[namaPeminjam] = [d.cast<String, String>()];
Expand All @@ -63,8 +60,8 @@ class _PeminjamanState extends State<Peminjaman> {
rows.add(
DataRow(cells: [
DataCell(Text(item['judul_buku']!)),
DataCell(Text(item['tanggal_peminjaman']!)),
DataCell(Text(item['tanggal_pengembalian']!)),
DataCell(Text(item['pengarang']!)),
DataCell(Text(item['rak']!)),
]),
);
}
Expand Down Expand Up @@ -98,8 +95,8 @@ class _PeminjamanState extends State<Peminjaman> {
child: DataTable(
columns: [
DataColumn(label: Text('Judul Buku')),
DataColumn(label: Text('Tanggal Peminjaman')),
DataColumn(label: Text('Tanggal Pengembalian')),
DataColumn(label: Text('Pengarang')),
DataColumn(label: Text('Rak')),
],
rows: _buildDataTableRows(peminjamData),
),
Expand Down
Loading

0 comments on commit fc0a306

Please sign in to comment.