initial commit
This commit is contained in:
+48
-4
@@ -19,6 +19,7 @@ class Booking {
|
|||||||
String code;
|
String code;
|
||||||
String information;
|
String information;
|
||||||
|
|
||||||
|
int weekday = -1;
|
||||||
String holiday = '';
|
String holiday = '';
|
||||||
String dayLeft = '';
|
String dayLeft = '';
|
||||||
String dayRight = '';
|
String dayRight = '';
|
||||||
@@ -45,10 +46,11 @@ class Booking {
|
|||||||
required this.information,
|
required this.information,
|
||||||
}) {
|
}) {
|
||||||
PublicHolidays h = PublicHolidays(year: bookingDay.year);
|
PublicHolidays h = PublicHolidays(year: bookingDay.year);
|
||||||
|
|
||||||
|
weekday = bookingDay.weekday;
|
||||||
holiday = h.holiday(bookingDay);
|
holiday = h.holiday(bookingDay);
|
||||||
dayLeft = DateFormat('EEEE - dd').format(bookingDay);
|
dayLeft = DateFormat('EEEE - dd').format(bookingDay);
|
||||||
dayRight = DateFormat('dd - EEEE').format(bookingDay);
|
dayRight = DateFormat('dd - EEEE').format(bookingDay);
|
||||||
pause = '';
|
pause = '';
|
||||||
durationIs = '';
|
durationIs = '';
|
||||||
durationShould = '';
|
durationShould = '';
|
||||||
@@ -78,6 +80,8 @@ class BookingDataSource extends DataGridSource {
|
|||||||
void buildDataGridRow() {
|
void buildDataGridRow() {
|
||||||
_bookingDataGridRows = booking
|
_bookingDataGridRows = booking
|
||||||
.map<DataGridRow>((e) => DataGridRow(cells: [
|
.map<DataGridRow>((e) => DataGridRow(cells: [
|
||||||
|
DataGridCell<String>(columnName: 'code', value: e.code),
|
||||||
|
DataGridCell<int>(columnName: 'weekday', value: e.weekday),
|
||||||
DataGridCell<String>(columnName: 'dayLeft', value: e.dayLeft),
|
DataGridCell<String>(columnName: 'dayLeft', value: e.dayLeft),
|
||||||
DataGridCell<String>(columnName: 'holiday', value: e.holiday),
|
DataGridCell<String>(columnName: 'holiday', value: e.holiday),
|
||||||
DataGridCell<String>(
|
DataGridCell<String>(
|
||||||
@@ -148,7 +152,6 @@ class BookingDataSource extends DataGridSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Booking> booking = [];
|
List<Booking> booking = [];
|
||||||
|
|
||||||
List<DataGridRow> _bookingDataGridRows = [];
|
List<DataGridRow> _bookingDataGridRows = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -156,10 +159,51 @@ class BookingDataSource extends DataGridSource {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
DataGridRowAdapter buildRow(DataGridRow row) {
|
DataGridRowAdapter buildRow(DataGridRow row) {
|
||||||
|
Color colBG = Colors.white;
|
||||||
|
String code = row.getCells().toList()[0].value;
|
||||||
|
int weekday = row.getCells().toList()[1].value;
|
||||||
|
String holiday = row.getCells().toList()[3].value;
|
||||||
|
|
||||||
|
if (code == 'U') {
|
||||||
|
colBG = Color.fromARGB(255, 127, 127, 255);
|
||||||
|
}
|
||||||
|
if (weekday == 6 || weekday == 7) {
|
||||||
|
colBG = Color.fromARGB(255, 255, 165, 0);
|
||||||
|
}
|
||||||
|
if (holiday != '') {
|
||||||
|
colBG = Color.fromARGB(255, 255, 165, 0);
|
||||||
|
}
|
||||||
|
if (code == 'T') {
|
||||||
|
colBG = Color.fromARGB(255, 127, 127, 255);
|
||||||
|
}
|
||||||
|
if (code == 'SU') {
|
||||||
|
colBG = Color.fromARGB(255, 127, 127, 255);
|
||||||
|
}
|
||||||
|
if (code == 'K') {
|
||||||
|
colBG = Colors.yellow;
|
||||||
|
}
|
||||||
|
if (code == 'G') {
|
||||||
|
colBG = Color.fromARGB(255, 191, 191, 255);
|
||||||
|
}
|
||||||
|
if (code == 'T') {
|
||||||
|
colBG = Colors.red;
|
||||||
|
}
|
||||||
|
|
||||||
return DataGridRowAdapter(
|
return DataGridRowAdapter(
|
||||||
cells: row.getCells().map<Widget>((e) {
|
cells: row.getCells().map<Widget>((e) {
|
||||||
|
if (e.columnName == 'dayRight' ||
|
||||||
|
e.columnName == 'holiday' ||
|
||||||
|
e.columnName == 'information') {
|
||||||
|
return Container(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
color: colBG,
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(e.value.toString() == '99:99' ? '' : e.value.toString()),
|
||||||
|
);
|
||||||
|
}
|
||||||
return Container(
|
return Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.centerRight,
|
||||||
|
color: colBG,
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Text(e.value.toString() == '99:99' ? '' : e.value.toString()),
|
child: Text(e.value.toString() == '99:99' ? '' : e.value.toString()),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class _MonthlyScreenState extends State<MonthlyScreen> {
|
|||||||
leave4: DateTime(1900, 1, 1),
|
leave4: DateTime(1900, 1, 1),
|
||||||
come5: DateTime(1900, 1, 1),
|
come5: DateTime(1900, 1, 1),
|
||||||
leave5: DateTime(1900, 1, 1),
|
leave5: DateTime(1900, 1, 1),
|
||||||
code: '',
|
code: 'U',
|
||||||
information: '',
|
information: '',
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -79,13 +79,27 @@ class _MonthlyScreenState extends State<MonthlyScreen> {
|
|||||||
|
|
||||||
List<GridColumn> getColumns() {
|
List<GridColumn> getColumns() {
|
||||||
return <GridColumn>[
|
return <GridColumn>[
|
||||||
|
GridColumn(
|
||||||
|
columnName: 'code',
|
||||||
|
visible: false,
|
||||||
|
label: Container(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: const Text('code'))),
|
||||||
|
GridColumn(
|
||||||
|
columnName: 'weekday',
|
||||||
|
visible: false,
|
||||||
|
label: Container(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
child: const Text('weekday'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'dayLeft',
|
columnName: 'dayLeft',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerRight,
|
||||||
child: const Text('dayLeft'))),
|
child: const Text('day'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'holiday',
|
columnName: 'holiday',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
@@ -99,70 +113,70 @@ class _MonthlyScreenState extends State<MonthlyScreen> {
|
|||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('come1'))),
|
child: const Text('come 1'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'leave1',
|
columnName: 'leave1',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('leave1'))),
|
child: const Text('leave 1'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'come2',
|
columnName: 'come2',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('come2'))),
|
child: const Text('come 2'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'leave2',
|
columnName: 'leave2',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('leave2'))),
|
child: const Text('leave 2'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'come3',
|
columnName: 'come3',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('come3'))),
|
child: const Text('come 3'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'leave3',
|
columnName: 'leave3',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('leave3'))),
|
child: const Text('leave 3'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'come4',
|
columnName: 'come4',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('come4'))),
|
child: const Text('come 4'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'leave4',
|
columnName: 'leave4',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('leave4'))),
|
child: const Text('leave 4'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'come5',
|
columnName: 'come5',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('come5'))),
|
child: const Text('come 5'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'leave5',
|
columnName: 'leave5',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('leave5'))),
|
child: const Text('leave 5'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'pause',
|
columnName: 'pause',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
@@ -183,14 +197,14 @@ class _MonthlyScreenState extends State<MonthlyScreen> {
|
|||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('durationIs'))),
|
child: const Text('duration Is'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'durationShould',
|
columnName: 'durationShould',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('durationShould'))),
|
child: const Text('duration Should'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'diff',
|
columnName: 'diff',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
@@ -211,7 +225,7 @@ class _MonthlyScreenState extends State<MonthlyScreen> {
|
|||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('currentDiff'))),
|
child: const Text('current Diff'))),
|
||||||
GridColumn(
|
GridColumn(
|
||||||
columnName: 'decimal',
|
columnName: 'decimal',
|
||||||
columnWidthMode: ColumnWidthMode.auto,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
@@ -225,7 +239,7 @@ class _MonthlyScreenState extends State<MonthlyScreen> {
|
|||||||
label: Container(
|
label: Container(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: const Text('dayRight'))),
|
child: const Text('day'))),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+21
-15
@@ -39,21 +39,27 @@
|
|||||||
<!-- This script adds the flutter initialization JS code -->
|
<!-- This script adds the flutter initialization JS code -->
|
||||||
<script src="flutter.js" defer></script>
|
<script src="flutter.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<div id="loading"></div>
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener('load', function(ev) {
|
window.addEventListener('load', function(ev) {
|
||||||
// Download main.dart.js
|
var loading = document.querySelector('#loading');
|
||||||
|
loading.textContent = "Loading workinghours...";
|
||||||
_flutter.loader.loadEntrypoint({
|
_flutter.loader.loadEntrypoint({
|
||||||
serviceWorker: {
|
serviceWorker: {
|
||||||
serviceWorkerVersion: serviceWorkerVersion,
|
serviceWorkerVersion: serviceWorkerVersion,
|
||||||
},
|
},
|
||||||
onEntrypointLoaded: function(engineInitializer) {
|
onEntrypointLoaded: async function(engineInitializer) {
|
||||||
engineInitializer.initializeEngine().then(function(appRunner) {
|
loading.textContent = "Initializing engine...";
|
||||||
appRunner.runApp();
|
|
||||||
});
|
let appRunner = await engineInitializer.initializeEngine({
|
||||||
}
|
hostElement: document.querySelector("#flutter_app"),
|
||||||
|
renderer: "html"
|
||||||
|
});
|
||||||
|
|
||||||
|
loading.textContent = "Running app...";
|
||||||
|
await appRunner.runApp();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user