PDF Export
This commit is contained in:
parent
bb16516891
commit
bb1e1ecc95
22 changed files with 1911 additions and 394 deletions
|
@ -64,6 +64,8 @@ void main() async {
|
|||
}
|
||||
}*/
|
||||
|
||||
MeasureRepository().buildMeasureComplete();
|
||||
|
||||
/*BaseApi().getContent('cart', false).then((carts) {
|
||||
logger.i(carts);
|
||||
for (final cart in carts) {
|
||||
|
@ -82,6 +84,8 @@ void main() async {
|
|||
|
||||
await MeasureRepository().getCategoriesGroupsAndTypes();
|
||||
|
||||
MeasureRepository().buildMeasureMonths();
|
||||
|
||||
runApp(const Ambito());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,31 +1,35 @@
|
|||
import 'package:ambito/src/entity/cart/cart_element.dart';
|
||||
import 'package:ambito/src/entity/entities.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_spinbox/flutter_spinbox.dart';
|
||||
import 'package:syncfusion_flutter_datagrid/datagrid.dart';
|
||||
|
||||
import '../../packages/ambito_theme/ambito_theme.dart';
|
||||
|
||||
class CartDataSource extends DataGridSource {
|
||||
CartDataSource(
|
||||
{required List<CartElement> cartElements, required this.context}) {
|
||||
{required this.cartElements,
|
||||
required this.context,
|
||||
required this.controller}) {
|
||||
dataGridRows = cartElements
|
||||
.map<DataGridRow>(
|
||||
(dataGridRow) => DataGridRow(
|
||||
cells: [
|
||||
DataGridCell<String>(
|
||||
columnName: 'name',
|
||||
columnName: 'Material',
|
||||
value: dataGridRow.name,
|
||||
),
|
||||
DataGridCell<String>(
|
||||
columnName: 'amount',
|
||||
columnName: 'Menge',
|
||||
value: dataGridRow.amount,
|
||||
),
|
||||
DataGridCell<List<IdValue>>(
|
||||
columnName: 'provider',
|
||||
columnName: 'Anbieter',
|
||||
value: dataGridRow.provider,
|
||||
),
|
||||
DataGridCell<String>(
|
||||
columnName: 'price',
|
||||
columnName: 'Richtpreis',
|
||||
value: dataGridRow.price.toString(),
|
||||
),
|
||||
],
|
||||
|
@ -35,8 +39,15 @@ class CartDataSource extends DataGridSource {
|
|||
}
|
||||
|
||||
final BuildContext context;
|
||||
final List<CartElement> cartElements;
|
||||
|
||||
List<DataGridRow> dataGridRows = [];
|
||||
final DataGridController controller;
|
||||
|
||||
dynamic newCellValue;
|
||||
|
||||
/// Helps to control the editable text in the [TextField] widget.
|
||||
TextEditingController editingController = TextEditingController();
|
||||
|
||||
@override
|
||||
List<DataGridRow> get rows => dataGridRows;
|
||||
|
@ -47,7 +58,7 @@ class CartDataSource extends DataGridSource {
|
|||
|
||||
double completePrice = double.tryParse(row
|
||||
.getCells()
|
||||
.where((cell) => cell.columnName == 'price')
|
||||
.where((cell) => cell.columnName == 'Richtpreis')
|
||||
.first
|
||||
.value
|
||||
.toString() ??
|
||||
|
@ -56,7 +67,7 @@ class CartDataSource extends DataGridSource {
|
|||
|
||||
int amount = int.tryParse(row
|
||||
.getCells()
|
||||
.where((cell) => cell.columnName == 'amount')
|
||||
.where((cell) => cell.columnName == 'Menge')
|
||||
.first
|
||||
.value
|
||||
.toString() ??
|
||||
|
@ -70,7 +81,7 @@ class CartDataSource extends DataGridSource {
|
|||
return DataGridRowAdapter(
|
||||
cells: row.getCells().map<Widget>(
|
||||
(dataGridCell) {
|
||||
if (dataGridCell.columnName == 'provider') {
|
||||
if (dataGridCell.columnName == 'Anbieter') {
|
||||
final providerString =
|
||||
dataGridCell.value.map((ele) => ele.value).toList().join(', ');
|
||||
return Container(
|
||||
|
@ -86,7 +97,7 @@ class CartDataSource extends DataGridSource {
|
|||
);
|
||||
}
|
||||
|
||||
if (dataGridCell.columnName == 'price') {
|
||||
if (dataGridCell.columnName == 'Richtpreis') {
|
||||
final priceString = amount == 1
|
||||
? '${dataGridCell.value ?? '0'}€'
|
||||
: '${completePrice.toStringAsFixed(2)}€ (${dataGridCell.value ?? '0'}€ pro Stk.)';
|
||||
|
@ -102,42 +113,15 @@ class CartDataSource extends DataGridSource {
|
|||
),
|
||||
);
|
||||
}
|
||||
if (dataGridCell.columnName == 'amount') {
|
||||
if (dataGridCell.columnName == 'Menge') {
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.remove,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 4.0, horizontal: 18.0),
|
||||
iconSize: 16.0,
|
||||
color: Theme.of(context).primaryColor,
|
||||
onPressed: () {},
|
||||
),
|
||||
Text(
|
||||
child: Text(
|
||||
dataGridCell.value,
|
||||
textAlign: TextAlign.center,
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
Icons.add,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 4.0, horizontal: 18.0),
|
||||
iconSize: 16.0,
|
||||
color: Theme.of(context).primaryColor,
|
||||
onPressed: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
return Container(
|
||||
|
@ -154,4 +138,54 @@ class CartDataSource extends DataGridSource {
|
|||
},
|
||||
).toList());
|
||||
}
|
||||
|
||||
@override
|
||||
Widget? buildEditWidget(DataGridRow dataGridRow,
|
||||
RowColumnIndex rowColumnIndex, GridColumn column, CellSubmit submitCell) {
|
||||
// Text going to display on editable widget
|
||||
final String displayText = dataGridRow
|
||||
.getCells()
|
||||
.firstWhereOrNull((DataGridCell dataGridCell) =>
|
||||
dataGridCell.columnName == column.columnName)
|
||||
?.value
|
||||
?.toString() ??
|
||||
'';
|
||||
|
||||
// The new cell value must be reset.
|
||||
// To avoid committing the [DataGridCell] value that was previously edited
|
||||
// into the current non-modified [DataGridCell].
|
||||
newCellValue = null;
|
||||
|
||||
final int dataRowIndex = dataGridRows.indexOf(dataGridRow);
|
||||
|
||||
final bool isNumericType = column.columnName == 'Menge';
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(0),
|
||||
alignment: isNumericType ? Alignment.centerRight : Alignment.centerLeft,
|
||||
child: SpinBox(
|
||||
min: 1,
|
||||
max: 100,
|
||||
value: double.parse(displayText),
|
||||
onChanged: (value) {
|
||||
//cartElements[dataRowIndex].amount = value.toString();
|
||||
},
|
||||
),
|
||||
/*NumberInputWithIncrementDecrement(
|
||||
controller: editingController,
|
||||
buttonArrangement: ButtonArrangement.incRightDecLeft,
|
||||
min: 1,
|
||||
initialValue: int.parse(displayText),
|
||||
enableMinMaxClamping: true,
|
||||
incIcon: Icons.add,
|
||||
decIcon: Icons.remove,
|
||||
onChanged: (value) {
|
||||
logger.d('changed to $value');
|
||||
},
|
||||
onSubmitted: (value) {
|
||||
logger.i('submitted $value');
|
||||
},
|
||||
),*/
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:ambito/src/entity/_general/file/file_part.dart';
|
||||
import 'package:ambito/src/entity/_general/id_value_color/id_value_color.dart';
|
||||
import 'package:ambito/src/entity/base_entity.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
|
@ -13,11 +14,10 @@ part 'measure_complete.g.dart';
|
|||
|
||||
@JsonSerializable()
|
||||
@collection
|
||||
class MeasureComplete {
|
||||
MeasureComplete({required this.id, required this.name});
|
||||
class MeasureComplete extends BaseEntity with EntityWithId {
|
||||
MeasureComplete();
|
||||
|
||||
final int id;
|
||||
final String name;
|
||||
String? name;
|
||||
FilePart? image;
|
||||
String? description;
|
||||
String? target;
|
||||
|
@ -66,8 +66,9 @@ class MeasureComplete {
|
|||
List<String> helper = [];
|
||||
List<FilePart> helperFiles = [];
|
||||
|
||||
MeasureComplete mc =
|
||||
MeasureComplete(id: json['id'], name: json['field_3021886']);
|
||||
MeasureComplete mc = MeasureComplete()
|
||||
..id = json['id']
|
||||
..name = json['field_3021886'];
|
||||
if (json['field_2402548'] != null && json['field_2402548'].isNotEmpty) {
|
||||
mc.image = FilePart.fromJson(json['field_2402548'][0]);
|
||||
} else {
|
||||
|
|
|
@ -204,7 +204,14 @@ const MeasureCompleteSchema = IsarGeneratedSchema(
|
|||
|
||||
@isarProtected
|
||||
int serializeMeasureComplete(IsarWriter writer, MeasureComplete object) {
|
||||
IsarCore.writeString(writer, 1, object.name);
|
||||
{
|
||||
final value = object.name;
|
||||
if (value == null) {
|
||||
IsarCore.writeNull(writer, 1);
|
||||
} else {
|
||||
IsarCore.writeString(writer, 1, value);
|
||||
}
|
||||
}
|
||||
{
|
||||
final value = object.image;
|
||||
if (value == null) {
|
||||
|
@ -593,14 +600,8 @@ int serializeMeasureComplete(IsarWriter writer, MeasureComplete object) {
|
|||
|
||||
@isarProtected
|
||||
MeasureComplete deserializeMeasureComplete(IsarReader reader) {
|
||||
final int _id;
|
||||
_id = IsarCore.readId(reader);
|
||||
final String _name;
|
||||
_name = IsarCore.readString(reader, 1) ?? '';
|
||||
final object = MeasureComplete(
|
||||
id: _id,
|
||||
name: _name,
|
||||
);
|
||||
final object = MeasureComplete();
|
||||
object.name = IsarCore.readString(reader, 1);
|
||||
{
|
||||
final objectReader = IsarCore.readObject(reader, 2);
|
||||
if (objectReader.isNull) {
|
||||
|
@ -840,16 +841,15 @@ MeasureComplete deserializeMeasureComplete(IsarReader reader) {
|
|||
}
|
||||
}
|
||||
}
|
||||
object.id = IsarCore.readId(reader);
|
||||
return object;
|
||||
}
|
||||
|
||||
@isarProtected
|
||||
dynamic deserializeMeasureCompleteProp(IsarReader reader, int property) {
|
||||
switch (property) {
|
||||
case 0:
|
||||
return IsarCore.readId(reader);
|
||||
case 1:
|
||||
return IsarCore.readString(reader, 1) ?? '';
|
||||
return IsarCore.readString(reader, 1);
|
||||
case 2:
|
||||
{
|
||||
final objectReader = IsarCore.readObject(reader, 2);
|
||||
|
@ -1131,6 +1131,8 @@ dynamic deserializeMeasureCompleteProp(IsarReader reader, int property) {
|
|||
}
|
||||
}
|
||||
}
|
||||
case 0:
|
||||
return IsarCore.readId(reader);
|
||||
default:
|
||||
throw ArgumentError('Unknown property: $property');
|
||||
}
|
||||
|
@ -1578,94 +1580,22 @@ extension MeasureCompleteQueryBuilderUpdate
|
|||
extension MeasureCompleteQueryFilter
|
||||
on QueryBuilder<MeasureComplete, MeasureComplete, QFilterCondition> {
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
idEqualTo(
|
||||
int value,
|
||||
) {
|
||||
nameIsNull() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
EqualCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
return query.addFilterCondition(const IsNullCondition(property: 1));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
idGreaterThan(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
GreaterCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
idGreaterThanOrEqualTo(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
GreaterOrEqualCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
idLessThan(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
LessCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
idLessThanOrEqualTo(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
LessOrEqualCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
idBetween(
|
||||
int lower,
|
||||
int upper,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
BetweenCondition(
|
||||
property: 0,
|
||||
lower: lower,
|
||||
upper: upper,
|
||||
),
|
||||
);
|
||||
nameIsNotNull() {
|
||||
return QueryBuilder.apply(not(), (query) {
|
||||
return query.addFilterCondition(const IsNullCondition(property: 1));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
nameEqualTo(
|
||||
String value, {
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
|
@ -1681,7 +1611,7 @@ extension MeasureCompleteQueryFilter
|
|||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
nameGreaterThan(
|
||||
String value, {
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
|
@ -1697,7 +1627,7 @@ extension MeasureCompleteQueryFilter
|
|||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
nameGreaterThanOrEqualTo(
|
||||
String value, {
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
|
@ -1713,7 +1643,7 @@ extension MeasureCompleteQueryFilter
|
|||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
nameLessThan(
|
||||
String value, {
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
|
@ -1729,7 +1659,7 @@ extension MeasureCompleteQueryFilter
|
|||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
nameLessThanOrEqualTo(
|
||||
String value, {
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
|
@ -1745,8 +1675,8 @@ extension MeasureCompleteQueryFilter
|
|||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
nameBetween(
|
||||
String lower,
|
||||
String upper, {
|
||||
String? lower,
|
||||
String? upper, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
|
@ -9643,6 +9573,92 @@ extension MeasureCompleteQueryFilter
|
|||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
idEqualTo(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
EqualCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
idGreaterThan(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
GreaterCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
idGreaterThanOrEqualTo(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
GreaterOrEqualCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
idLessThan(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
LessCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
idLessThanOrEqualTo(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
LessOrEqualCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterFilterCondition>
|
||||
idBetween(
|
||||
int lower,
|
||||
int upper,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
BetweenCondition(
|
||||
property: 0,
|
||||
lower: lower,
|
||||
upper: upper,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureCompleteQueryObject
|
||||
|
@ -9657,18 +9673,6 @@ extension MeasureCompleteQueryObject
|
|||
|
||||
extension MeasureCompleteQuerySortBy
|
||||
on QueryBuilder<MeasureComplete, MeasureComplete, QSortBy> {
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterSortBy> sortById() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(0);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterSortBy> sortByIdDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(0, sort: Sort.desc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterSortBy> sortByName(
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
|
@ -10277,22 +10281,22 @@ extension MeasureCompleteQuerySortBy
|
|||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureCompleteQuerySortThenBy
|
||||
on QueryBuilder<MeasureComplete, MeasureComplete, QSortThenBy> {
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterSortBy> thenById() {
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterSortBy> sortById() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(0);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterSortBy> thenByIdDesc() {
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterSortBy> sortByIdDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(0, sort: Sort.desc);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureCompleteQuerySortThenBy
|
||||
on QueryBuilder<MeasureComplete, MeasureComplete, QSortThenBy> {
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterSortBy> thenByName(
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
|
@ -10698,6 +10702,18 @@ extension MeasureCompleteQuerySortThenBy
|
|||
return query.addSortBy(40, sort: Sort.desc, caseSensitive: caseSensitive);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterSortBy> thenById() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(0);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, MeasureComplete, QAfterSortBy> thenByIdDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(0, sort: Sort.desc);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureCompleteQueryWhereDistinct
|
||||
|
@ -10985,13 +11001,7 @@ extension MeasureCompleteQueryWhereDistinct
|
|||
|
||||
extension MeasureCompleteQueryProperty1
|
||||
on QueryBuilder<MeasureComplete, MeasureComplete, QProperty> {
|
||||
QueryBuilder<MeasureComplete, int, QAfterProperty> idProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(0);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, String, QAfterProperty> nameProperty() {
|
||||
QueryBuilder<MeasureComplete, String?, QAfterProperty> nameProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(1);
|
||||
});
|
||||
|
@ -11266,17 +11276,17 @@ extension MeasureCompleteQueryProperty1
|
|||
return query.addProperty(42);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureCompleteQueryProperty2<R>
|
||||
on QueryBuilder<MeasureComplete, R, QAfterProperty> {
|
||||
QueryBuilder<MeasureComplete, (R, int), QAfterProperty> idProperty() {
|
||||
QueryBuilder<MeasureComplete, int, QAfterProperty> idProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, (R, String), QAfterProperty> nameProperty() {
|
||||
extension MeasureCompleteQueryProperty2<R>
|
||||
on QueryBuilder<MeasureComplete, R, QAfterProperty> {
|
||||
QueryBuilder<MeasureComplete, (R, String?), QAfterProperty> nameProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(1);
|
||||
});
|
||||
|
@ -11565,17 +11575,17 @@ extension MeasureCompleteQueryProperty2<R>
|
|||
return query.addProperty(42);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureCompleteQueryProperty3<R1, R2>
|
||||
on QueryBuilder<MeasureComplete, (R1, R2), QAfterProperty> {
|
||||
QueryBuilder<MeasureComplete, (R1, R2, int), QOperations> idProperty() {
|
||||
QueryBuilder<MeasureComplete, (R, int), QAfterProperty> idProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, (R1, R2, String), QOperations> nameProperty() {
|
||||
extension MeasureCompleteQueryProperty3<R1, R2>
|
||||
on QueryBuilder<MeasureComplete, (R1, R2), QAfterProperty> {
|
||||
QueryBuilder<MeasureComplete, (R1, R2, String?), QOperations> nameProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(1);
|
||||
});
|
||||
|
@ -11867,6 +11877,12 @@ extension MeasureCompleteQueryProperty3<R1, R2>
|
|||
return query.addProperty(42);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureComplete, (R1, R2, int), QOperations> idProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
|
@ -11874,10 +11890,9 @@ extension MeasureCompleteQueryProperty3<R1, R2>
|
|||
// **************************************************************************
|
||||
|
||||
MeasureComplete _$MeasureCompleteFromJson(Map<String, dynamic> json) =>
|
||||
MeasureComplete(
|
||||
id: (json['id'] as num).toInt(),
|
||||
name: json['name'] as String,
|
||||
)
|
||||
MeasureComplete()
|
||||
..id = (json['id'] as num).toInt()
|
||||
..name = json['name'] as String?
|
||||
..image = json['image'] == null
|
||||
? null
|
||||
: FilePart.fromJson(json['image'] as Map<String, dynamic>)
|
||||
|
|
|
@ -8,11 +8,11 @@ class MeasureDetailsRepository extends BaseDB {
|
|||
@override
|
||||
IsarCollection collection = isar.measureDetails;
|
||||
|
||||
MeasureDetails getDetailsForMeasure(String measure) {
|
||||
MeasureDetails? getDetailsForMeasure(String measure) {
|
||||
List<MeasureDetails> all = isar.measureDetails.where().findAll();
|
||||
return all
|
||||
.where(
|
||||
(el) => el.measure!.map((m) => m.value).toList().contains(measure))
|
||||
.first;
|
||||
.firstOrNull;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ import 'package:ambito/src/entity/lists/list_repository.dart';
|
|||
import 'package:ambito/src/entity/measure/category/measure_category.dart';
|
||||
import 'package:ambito/src/entity/measure/complete/measure_complete.dart';
|
||||
import 'package:ambito/src/entity/measure/measure_grouping.dart';
|
||||
import 'package:ambito/src/entity/measure/months/measure_months.dart';
|
||||
import 'package:ambito/src/entity/measure/types_details/measure_types_details_repository.dart';
|
||||
import 'package:ambito/src/extensions/extensions.dart';
|
||||
import 'package:ambito/src/packages/ambito_db/base_db.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
|
@ -11,6 +13,7 @@ import 'package:isar/isar.dart';
|
|||
import '../../consts/consts.dart';
|
||||
import '../../packages/ambito_notifier/notifier/filter_notifier.dart';
|
||||
import '../../widgets/form/fields/field_dropdown.dart';
|
||||
import 'details/measure_details_repository.dart';
|
||||
import 'group/measure_group.dart';
|
||||
|
||||
class MeasureRepository extends BaseDB {
|
||||
|
@ -260,4 +263,68 @@ class MeasureRepository extends BaseDB {
|
|||
MeasureComplete? getMeasureCompleteByName(String name) {
|
||||
return isar.measureCompletes.where().nameEqualTo(name).findFirst();
|
||||
}
|
||||
|
||||
void buildMeasureComplete() {
|
||||
List<MeasureComplete> allMeasureCompletes = [];
|
||||
|
||||
List<MeasureGeneral> measuresGeneral =
|
||||
isar.measureGenerals.where().findAll();
|
||||
|
||||
for (final measureGeneral in measuresGeneral) {
|
||||
Map<String, dynamic> combined = {'id': measureGeneral.id};
|
||||
|
||||
// Fetch related details and types
|
||||
final measureDetails =
|
||||
MeasureDetailsRepository().getDetailsForMeasure(measureGeneral.name!);
|
||||
|
||||
final MeasureTypes? measureType = MeasureRepository().getTypeByName(
|
||||
measureGeneral.measureType!.map((el) => el.value).first ?? '');
|
||||
final measureTypesDetails = MeasureTypesDetailsRepository()
|
||||
.getTypeDetailsForType(measureType?.measureType ?? '');
|
||||
// Save preferences and populate combined map
|
||||
prefs.setBool('extended_json', true).then((_) {
|
||||
_mergeToCombinedMap(combined, measureGeneral?.toJson());
|
||||
_mergeToCombinedMap(combined, measureDetails?.toJson());
|
||||
_mergeToCombinedMap(combined, measureType?.toJson());
|
||||
_mergeToCombinedMap(combined, measureTypesDetails?.toJson());
|
||||
|
||||
isar.write((isar) {
|
||||
isar.measureCompletes.put(MeasureComplete.fromJson(combined));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _mergeToCombinedMap(
|
||||
Map<String, dynamic> combined, Map<String, dynamic>? data) {
|
||||
data?.forEach((key, value) {
|
||||
if (key != 'id') {
|
||||
combined[key] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void buildMeasureMonths() {
|
||||
List<MeasureComplete> allCompletes =
|
||||
isar.measureCompletes.where().findAll();
|
||||
List<MeasureMonths> measureMonths = [];
|
||||
|
||||
for (final complete in allCompletes) {
|
||||
List<bool> apply = months
|
||||
.map((item) => complete.applyMonths?.contains(item) ?? false)
|
||||
.toList();
|
||||
List<bool> maint = months
|
||||
.map((item) => complete.maintenanceMonths?.contains(item) ?? false)
|
||||
.toList();
|
||||
final measureMonth = MeasureMonths()
|
||||
..id = complete.id
|
||||
..name = complete.name
|
||||
..maintenanceList = maint
|
||||
..applyList = apply;
|
||||
|
||||
isar.write((isar) {
|
||||
isar.measureMonths.put(measureMonth);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
46
lib/src/entity/measure/months/measure_months.dart
Normal file
46
lib/src/entity/measure/months/measure_months.dart
Normal file
|
@ -0,0 +1,46 @@
|
|||
import 'package:ambito/src/entity/base_entity.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'measure_months.g.dart';
|
||||
|
||||
@collection
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class MeasureMonths extends BaseEntity with EntityWithId {
|
||||
MeasureMonths();
|
||||
|
||||
String? name;
|
||||
List<bool>? maintenanceList = [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
];
|
||||
List<bool>? applyList = [
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
];
|
||||
|
||||
factory MeasureMonths.fromJson(Map<String, dynamic> json) =>
|
||||
_$MeasureMonthsFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$MeasureMonthsToJson(this);
|
||||
}
|
850
lib/src/entity/measure/months/measure_months.g.dart
Normal file
850
lib/src/entity/measure/months/measure_months.g.dart
Normal file
|
@ -0,0 +1,850 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'measure_months.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// _IsarCollectionGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: duplicate_ignore, invalid_use_of_protected_member, lines_longer_than_80_chars, constant_identifier_names, avoid_js_rounded_ints, no_leading_underscores_for_local_identifiers, require_trailing_commas, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_in_if_null_operators, library_private_types_in_public_api, prefer_const_constructors
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
extension GetMeasureMonthsCollection on Isar {
|
||||
IsarCollection<int, MeasureMonths> get measureMonths => this.collection();
|
||||
}
|
||||
|
||||
const MeasureMonthsSchema = IsarGeneratedSchema(
|
||||
schema: IsarSchema(
|
||||
name: 'MeasureMonths',
|
||||
idName: 'id',
|
||||
embedded: false,
|
||||
properties: [
|
||||
IsarPropertySchema(
|
||||
name: 'name',
|
||||
type: IsarType.string,
|
||||
),
|
||||
IsarPropertySchema(
|
||||
name: 'maintenanceList',
|
||||
type: IsarType.boolList,
|
||||
),
|
||||
IsarPropertySchema(
|
||||
name: 'applyList',
|
||||
type: IsarType.boolList,
|
||||
),
|
||||
],
|
||||
indexes: [],
|
||||
),
|
||||
converter: IsarObjectConverter<int, MeasureMonths>(
|
||||
serialize: serializeMeasureMonths,
|
||||
deserialize: deserializeMeasureMonths,
|
||||
deserializeProperty: deserializeMeasureMonthsProp,
|
||||
),
|
||||
embeddedSchemas: [],
|
||||
);
|
||||
|
||||
@isarProtected
|
||||
int serializeMeasureMonths(IsarWriter writer, MeasureMonths object) {
|
||||
{
|
||||
final value = object.name;
|
||||
if (value == null) {
|
||||
IsarCore.writeNull(writer, 1);
|
||||
} else {
|
||||
IsarCore.writeString(writer, 1, value);
|
||||
}
|
||||
}
|
||||
{
|
||||
final list = object.maintenanceList;
|
||||
if (list == null) {
|
||||
IsarCore.writeNull(writer, 2);
|
||||
} else {
|
||||
final listWriter = IsarCore.beginList(writer, 2, list.length);
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
IsarCore.writeBool(listWriter, i, list[i]);
|
||||
}
|
||||
IsarCore.endList(writer, listWriter);
|
||||
}
|
||||
}
|
||||
{
|
||||
final list = object.applyList;
|
||||
if (list == null) {
|
||||
IsarCore.writeNull(writer, 3);
|
||||
} else {
|
||||
final listWriter = IsarCore.beginList(writer, 3, list.length);
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
IsarCore.writeBool(listWriter, i, list[i]);
|
||||
}
|
||||
IsarCore.endList(writer, listWriter);
|
||||
}
|
||||
}
|
||||
return object.id;
|
||||
}
|
||||
|
||||
@isarProtected
|
||||
MeasureMonths deserializeMeasureMonths(IsarReader reader) {
|
||||
final object = MeasureMonths();
|
||||
object.name = IsarCore.readString(reader, 1);
|
||||
{
|
||||
final length = IsarCore.readList(reader, 2, IsarCore.readerPtrPtr);
|
||||
{
|
||||
final reader = IsarCore.readerPtr;
|
||||
if (reader.isNull) {
|
||||
object.maintenanceList = null;
|
||||
} else {
|
||||
final list = List<bool>.filled(length, false, growable: true);
|
||||
for (var i = 0; i < length; i++) {
|
||||
list[i] = IsarCore.readBool(reader, i);
|
||||
}
|
||||
IsarCore.freeReader(reader);
|
||||
object.maintenanceList = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
final length = IsarCore.readList(reader, 3, IsarCore.readerPtrPtr);
|
||||
{
|
||||
final reader = IsarCore.readerPtr;
|
||||
if (reader.isNull) {
|
||||
object.applyList = null;
|
||||
} else {
|
||||
final list = List<bool>.filled(length, false, growable: true);
|
||||
for (var i = 0; i < length; i++) {
|
||||
list[i] = IsarCore.readBool(reader, i);
|
||||
}
|
||||
IsarCore.freeReader(reader);
|
||||
object.applyList = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
object.id = IsarCore.readId(reader);
|
||||
return object;
|
||||
}
|
||||
|
||||
@isarProtected
|
||||
dynamic deserializeMeasureMonthsProp(IsarReader reader, int property) {
|
||||
switch (property) {
|
||||
case 1:
|
||||
return IsarCore.readString(reader, 1);
|
||||
case 2:
|
||||
{
|
||||
final length = IsarCore.readList(reader, 2, IsarCore.readerPtrPtr);
|
||||
{
|
||||
final reader = IsarCore.readerPtr;
|
||||
if (reader.isNull) {
|
||||
return null;
|
||||
} else {
|
||||
final list = List<bool>.filled(length, false, growable: true);
|
||||
for (var i = 0; i < length; i++) {
|
||||
list[i] = IsarCore.readBool(reader, i);
|
||||
}
|
||||
IsarCore.freeReader(reader);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
final length = IsarCore.readList(reader, 3, IsarCore.readerPtrPtr);
|
||||
{
|
||||
final reader = IsarCore.readerPtr;
|
||||
if (reader.isNull) {
|
||||
return null;
|
||||
} else {
|
||||
final list = List<bool>.filled(length, false, growable: true);
|
||||
for (var i = 0; i < length; i++) {
|
||||
list[i] = IsarCore.readBool(reader, i);
|
||||
}
|
||||
IsarCore.freeReader(reader);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
case 0:
|
||||
return IsarCore.readId(reader);
|
||||
default:
|
||||
throw ArgumentError('Unknown property: $property');
|
||||
}
|
||||
}
|
||||
|
||||
sealed class _MeasureMonthsUpdate {
|
||||
bool call({
|
||||
required int id,
|
||||
String? name,
|
||||
});
|
||||
}
|
||||
|
||||
class _MeasureMonthsUpdateImpl implements _MeasureMonthsUpdate {
|
||||
const _MeasureMonthsUpdateImpl(this.collection);
|
||||
|
||||
final IsarCollection<int, MeasureMonths> collection;
|
||||
|
||||
@override
|
||||
bool call({
|
||||
required int id,
|
||||
Object? name = ignore,
|
||||
}) {
|
||||
return collection.updateProperties([
|
||||
id
|
||||
], {
|
||||
if (name != ignore) 1: name as String?,
|
||||
}) >
|
||||
0;
|
||||
}
|
||||
}
|
||||
|
||||
sealed class _MeasureMonthsUpdateAll {
|
||||
int call({
|
||||
required List<int> id,
|
||||
String? name,
|
||||
});
|
||||
}
|
||||
|
||||
class _MeasureMonthsUpdateAllImpl implements _MeasureMonthsUpdateAll {
|
||||
const _MeasureMonthsUpdateAllImpl(this.collection);
|
||||
|
||||
final IsarCollection<int, MeasureMonths> collection;
|
||||
|
||||
@override
|
||||
int call({
|
||||
required List<int> id,
|
||||
Object? name = ignore,
|
||||
}) {
|
||||
return collection.updateProperties(id, {
|
||||
if (name != ignore) 1: name as String?,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureMonthsUpdate on IsarCollection<int, MeasureMonths> {
|
||||
_MeasureMonthsUpdate get update => _MeasureMonthsUpdateImpl(this);
|
||||
|
||||
_MeasureMonthsUpdateAll get updateAll => _MeasureMonthsUpdateAllImpl(this);
|
||||
}
|
||||
|
||||
sealed class _MeasureMonthsQueryUpdate {
|
||||
int call({
|
||||
String? name,
|
||||
});
|
||||
}
|
||||
|
||||
class _MeasureMonthsQueryUpdateImpl implements _MeasureMonthsQueryUpdate {
|
||||
const _MeasureMonthsQueryUpdateImpl(this.query, {this.limit});
|
||||
|
||||
final IsarQuery<MeasureMonths> query;
|
||||
final int? limit;
|
||||
|
||||
@override
|
||||
int call({
|
||||
Object? name = ignore,
|
||||
}) {
|
||||
return query.updateProperties(limit: limit, {
|
||||
if (name != ignore) 1: name as String?,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureMonthsQueryUpdate on IsarQuery<MeasureMonths> {
|
||||
_MeasureMonthsQueryUpdate get updateFirst =>
|
||||
_MeasureMonthsQueryUpdateImpl(this, limit: 1);
|
||||
|
||||
_MeasureMonthsQueryUpdate get updateAll =>
|
||||
_MeasureMonthsQueryUpdateImpl(this);
|
||||
}
|
||||
|
||||
class _MeasureMonthsQueryBuilderUpdateImpl
|
||||
implements _MeasureMonthsQueryUpdate {
|
||||
const _MeasureMonthsQueryBuilderUpdateImpl(this.query, {this.limit});
|
||||
|
||||
final QueryBuilder<MeasureMonths, MeasureMonths, QOperations> query;
|
||||
final int? limit;
|
||||
|
||||
@override
|
||||
int call({
|
||||
Object? name = ignore,
|
||||
}) {
|
||||
final q = query.build();
|
||||
try {
|
||||
return q.updateProperties(limit: limit, {
|
||||
if (name != ignore) 1: name as String?,
|
||||
});
|
||||
} finally {
|
||||
q.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureMonthsQueryBuilderUpdate
|
||||
on QueryBuilder<MeasureMonths, MeasureMonths, QOperations> {
|
||||
_MeasureMonthsQueryUpdate get updateFirst =>
|
||||
_MeasureMonthsQueryBuilderUpdateImpl(this, limit: 1);
|
||||
|
||||
_MeasureMonthsQueryUpdate get updateAll =>
|
||||
_MeasureMonthsQueryBuilderUpdateImpl(this);
|
||||
}
|
||||
|
||||
extension MeasureMonthsQueryFilter
|
||||
on QueryBuilder<MeasureMonths, MeasureMonths, QFilterCondition> {
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
nameIsNull() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(const IsNullCondition(property: 1));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
nameIsNotNull() {
|
||||
return QueryBuilder.apply(not(), (query) {
|
||||
return query.addFilterCondition(const IsNullCondition(property: 1));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition> nameEqualTo(
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
EqualCondition(
|
||||
property: 1,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
nameGreaterThan(
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
GreaterCondition(
|
||||
property: 1,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
nameGreaterThanOrEqualTo(
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
GreaterOrEqualCondition(
|
||||
property: 1,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
nameLessThan(
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
LessCondition(
|
||||
property: 1,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
nameLessThanOrEqualTo(
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
LessOrEqualCondition(
|
||||
property: 1,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition> nameBetween(
|
||||
String? lower,
|
||||
String? upper, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
BetweenCondition(
|
||||
property: 1,
|
||||
lower: lower,
|
||||
upper: upper,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
nameStartsWith(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
StartsWithCondition(
|
||||
property: 1,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
nameEndsWith(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
EndsWithCondition(
|
||||
property: 1,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
nameContains(String value, {bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
ContainsCondition(
|
||||
property: 1,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition> nameMatches(
|
||||
String pattern,
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
MatchesCondition(
|
||||
property: 1,
|
||||
wildcard: pattern,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
nameIsEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
const EqualCondition(
|
||||
property: 1,
|
||||
value: '',
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
nameIsNotEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
const GreaterCondition(
|
||||
property: 1,
|
||||
value: '',
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
maintenanceListIsNull() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(const IsNullCondition(property: 2));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
maintenanceListIsNotNull() {
|
||||
return QueryBuilder.apply(not(), (query) {
|
||||
return query.addFilterCondition(const IsNullCondition(property: 2));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
maintenanceListElementEqualTo(
|
||||
bool value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
EqualCondition(
|
||||
property: 2,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
maintenanceListIsEmpty() {
|
||||
return not().group(
|
||||
(q) => q.maintenanceListIsNull().or().maintenanceListIsNotEmpty(),
|
||||
);
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
maintenanceListIsNotEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
const GreaterOrEqualCondition(property: 2, value: null),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
applyListIsNull() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(const IsNullCondition(property: 3));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
applyListIsNotNull() {
|
||||
return QueryBuilder.apply(not(), (query) {
|
||||
return query.addFilterCondition(const IsNullCondition(property: 3));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
applyListElementEqualTo(
|
||||
bool value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
EqualCondition(
|
||||
property: 3,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
applyListIsEmpty() {
|
||||
return not().group(
|
||||
(q) => q.applyListIsNull().or().applyListIsNotEmpty(),
|
||||
);
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
applyListIsNotEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
const GreaterOrEqualCondition(property: 3, value: null),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition> idEqualTo(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
EqualCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
idGreaterThan(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
GreaterCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
idGreaterThanOrEqualTo(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
GreaterOrEqualCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition> idLessThan(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
LessCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition>
|
||||
idLessThanOrEqualTo(
|
||||
int value,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
LessOrEqualCondition(
|
||||
property: 0,
|
||||
value: value,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterFilterCondition> idBetween(
|
||||
int lower,
|
||||
int upper,
|
||||
) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
BetweenCondition(
|
||||
property: 0,
|
||||
lower: lower,
|
||||
upper: upper,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureMonthsQueryObject
|
||||
on QueryBuilder<MeasureMonths, MeasureMonths, QFilterCondition> {}
|
||||
|
||||
extension MeasureMonthsQuerySortBy
|
||||
on QueryBuilder<MeasureMonths, MeasureMonths, QSortBy> {
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterSortBy> sortByName(
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(
|
||||
1,
|
||||
caseSensitive: caseSensitive,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterSortBy> sortByNameDesc(
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(
|
||||
1,
|
||||
sort: Sort.desc,
|
||||
caseSensitive: caseSensitive,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterSortBy> sortById() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(0);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterSortBy> sortByIdDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(0, sort: Sort.desc);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureMonthsQuerySortThenBy
|
||||
on QueryBuilder<MeasureMonths, MeasureMonths, QSortThenBy> {
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterSortBy> thenByName(
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(1, caseSensitive: caseSensitive);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterSortBy> thenByNameDesc(
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(1, sort: Sort.desc, caseSensitive: caseSensitive);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterSortBy> thenById() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(0);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterSortBy> thenByIdDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(0, sort: Sort.desc);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureMonthsQueryWhereDistinct
|
||||
on QueryBuilder<MeasureMonths, MeasureMonths, QDistinct> {
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterDistinct> distinctByName(
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addDistinctBy(1, caseSensitive: caseSensitive);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterDistinct>
|
||||
distinctByMaintenanceList() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addDistinctBy(2);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, MeasureMonths, QAfterDistinct>
|
||||
distinctByApplyList() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addDistinctBy(3);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureMonthsQueryProperty1
|
||||
on QueryBuilder<MeasureMonths, MeasureMonths, QProperty> {
|
||||
QueryBuilder<MeasureMonths, String?, QAfterProperty> nameProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(1);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, List<bool>?, QAfterProperty>
|
||||
maintenanceListProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(2);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, List<bool>?, QAfterProperty> applyListProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(3);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, int, QAfterProperty> idProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureMonthsQueryProperty2<R>
|
||||
on QueryBuilder<MeasureMonths, R, QAfterProperty> {
|
||||
QueryBuilder<MeasureMonths, (R, String?), QAfterProperty> nameProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(1);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, (R, List<bool>?), QAfterProperty>
|
||||
maintenanceListProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(2);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, (R, List<bool>?), QAfterProperty>
|
||||
applyListProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(3);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, (R, int), QAfterProperty> idProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension MeasureMonthsQueryProperty3<R1, R2>
|
||||
on QueryBuilder<MeasureMonths, (R1, R2), QAfterProperty> {
|
||||
QueryBuilder<MeasureMonths, (R1, R2, String?), QOperations> nameProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(1);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, (R1, R2, List<bool>?), QOperations>
|
||||
maintenanceListProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(2);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, (R1, R2, List<bool>?), QOperations>
|
||||
applyListProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(3);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<MeasureMonths, (R1, R2, int), QOperations> idProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
MeasureMonths _$MeasureMonthsFromJson(Map<String, dynamic> json) =>
|
||||
MeasureMonths()
|
||||
..id = (json['id'] as num).toInt()
|
||||
..name = json['name'] as String?
|
||||
..maintenanceList = (json['maintenanceList'] as List<dynamic>?)
|
||||
?.map((e) => e as bool)
|
||||
.toList()
|
||||
..applyList =
|
||||
(json['applyList'] as List<dynamic>?)?.map((e) => e as bool).toList();
|
||||
|
||||
Map<String, dynamic> _$MeasureMonthsToJson(MeasureMonths instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'maintenanceList': instance.maintenanceList,
|
||||
'applyList': instance.applyList,
|
||||
};
|
147
lib/src/entity/measure/months/measure_months_datasource.dart
Normal file
147
lib/src/entity/measure/months/measure_months_datasource.dart
Normal file
|
@ -0,0 +1,147 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:syncfusion_flutter_datagrid/datagrid.dart';
|
||||
|
||||
import '../../../packages/ambito_theme/ambito_theme.dart';
|
||||
import 'measure_months.dart';
|
||||
|
||||
class MeasureMonthsDatasource extends DataGridSource {
|
||||
MeasureMonthsDatasource(
|
||||
{required List<MeasureMonths> areas,
|
||||
required this.context,
|
||||
required this.type}) {
|
||||
dataGridRows = areas
|
||||
.map<DataGridRow>(
|
||||
(dataGridRow) => DataGridRow(
|
||||
cells: [
|
||||
DataGridCell<String>(
|
||||
columnName: 'measure',
|
||||
value: dataGridRow.name,
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'jan',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![0]
|
||||
: dataGridRow.maintenanceList![0],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'feb',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![1]
|
||||
: dataGridRow.maintenanceList![1],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'mar',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![2]
|
||||
: dataGridRow.maintenanceList![2],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'apr',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![3]
|
||||
: dataGridRow.maintenanceList![3],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'may',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![4]
|
||||
: dataGridRow.maintenanceList![4],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'jun',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![5]
|
||||
: dataGridRow.maintenanceList![5],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'jul',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![6]
|
||||
: dataGridRow.maintenanceList![6],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'aug',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![7]
|
||||
: dataGridRow.maintenanceList![7],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'sep',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![8]
|
||||
: dataGridRow.maintenanceList![8],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'oct',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![9]
|
||||
: dataGridRow.maintenanceList![9],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'nov',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![10]
|
||||
: dataGridRow.maintenanceList![10],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'dec',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![11]
|
||||
: dataGridRow.maintenanceList![11],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
|
||||
final BuildContext context;
|
||||
final String type;
|
||||
|
||||
List<DataGridRow> dataGridRows = [];
|
||||
|
||||
@override
|
||||
List<DataGridRow> get rows => dataGridRows;
|
||||
|
||||
@override
|
||||
DataGridRowAdapter? buildRow(DataGridRow row) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
|
||||
return DataGridRowAdapter(
|
||||
cells: row.getCells().map<Widget>(
|
||||
(dataGridCell) {
|
||||
if (dataGridCell.columnName == 'measure') {
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Text(
|
||||
dataGridCell.value,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Widget content = SizedBox();
|
||||
if (type == 'apply' && dataGridCell.value == true) {
|
||||
content = Icon(
|
||||
Icons.carpenter_outlined,
|
||||
color: theme.currentColorScheme.secondary,
|
||||
);
|
||||
}
|
||||
if (type == 'maintenance' && dataGridCell.value == true) {
|
||||
content = Icon(
|
||||
Icons.eco_outlined,
|
||||
color: theme.currentColorScheme.secondary,
|
||||
);
|
||||
}
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: content,
|
||||
);
|
||||
},
|
||||
).toList());
|
||||
}
|
||||
}
|
|
@ -5,9 +5,11 @@ import 'package:ambito/src/entity/lists/list_measure.dart';
|
|||
import 'package:ambito/src/entity/lists/list_measure_single.dart';
|
||||
import 'package:ambito/src/entity/lists/list_measure_type_group_category.dart';
|
||||
import 'package:ambito/src/entity/measure/category/measure_category.dart';
|
||||
import 'package:ambito/src/entity/measure/complete/measure_complete.dart';
|
||||
import 'package:ambito/src/entity/measure/details/measure_details.dart';
|
||||
import 'package:ambito/src/entity/measure/group/measure_group.dart';
|
||||
import 'package:ambito/src/entity/measure/measure_grouping.dart';
|
||||
import 'package:ambito/src/entity/measure/months/measure_months.dart';
|
||||
import 'package:ambito/src/entity/measure/types_details/measure_types_details.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
|
@ -40,6 +42,8 @@ class AmbitoIsarDB {
|
|||
ListMeasureSingleSchema,
|
||||
ListMeasureTypeGroupCategorySchema,
|
||||
MaterialSchema,
|
||||
MeasureMonthsSchema,
|
||||
MeasureCompleteSchema,
|
||||
MeasureTypesSchema,
|
||||
MeasureTypesDetailsSchema,
|
||||
MeasureGeneralSchema,
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
import 'package:ambito/src/entity/_general/filter/item_filter.dart';
|
||||
import 'package:ambito/src/entity/_general/filter/item_filter_repository.dart';
|
||||
import 'package:ambito/src/entity/measure/measure_repository.dart';
|
||||
import 'package:ambito/src/entity/measure/types/measure_types.dart';
|
||||
import 'package:ambito/src/extensions/extensions.dart';
|
||||
import 'package:ambito/src/entity/measure/months/measure_months.dart';
|
||||
import 'package:ambito/src/entity/measure/months/measure_months_datasource.dart';
|
||||
import 'package:ambito/src/packages/ambito_theme/ambito_theme.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:screen_breakpoints/screen_breakpoints.dart';
|
||||
import 'package:syncfusion_flutter_calendar/calendar.dart';
|
||||
import 'package:syncfusion_flutter_core/theme.dart';
|
||||
import 'package:syncfusion_flutter_datagrid/datagrid.dart';
|
||||
import 'package:toggle_switch/toggle_switch.dart';
|
||||
|
||||
import '../../consts/consts.dart';
|
||||
import '../../widgets/appbar/ambito_appbar.dart';
|
||||
import '../../widgets/page/base_page.dart';
|
||||
|
||||
class CalendarPage extends StatefulWidget {
|
||||
const CalendarPage({super.key});
|
||||
|
@ -20,148 +19,310 @@ class CalendarPage extends StatefulWidget {
|
|||
}
|
||||
|
||||
class CalendarPageState extends State<CalendarPage> {
|
||||
List<Appointment> appointments = <Appointment>[];
|
||||
int display = 0;
|
||||
|
||||
Set<ItemFilter>? monthFilter = {};
|
||||
String type = 'maintenance';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
initDataSource();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
initDataSource() {
|
||||
monthFilter = ItemFilterRepository().getByType('month');
|
||||
for (String month in months) {
|
||||
DateTime now = DateTime.now();
|
||||
int monthInt = months.indexOf(month) + 1;
|
||||
|
||||
DateTime startDate = DateTime(now.year, monthInt, 1, 0, 0, 0);
|
||||
DateTime endDate = DateTime(
|
||||
now.year, monthInt, startDate.lastDayOfMonth.day, 23, 59, 59);
|
||||
|
||||
ItemFilter? itemFilter =
|
||||
monthFilter?.firstWhereOrNull((item) => item.name == month);
|
||||
if (itemFilter != null) {
|
||||
List<MeasureTypes?> currentMeasures =
|
||||
MeasureRepository().getByIds(itemFilter.ids!);
|
||||
for (var measure in currentMeasures) {
|
||||
appointments.add(
|
||||
Appointment(
|
||||
startTime: startDate,
|
||||
endTime: endDate,
|
||||
isAllDay: true,
|
||||
subject: measure!.measureType ?? '',
|
||||
color: actionGroupColors[measure.measureGroup!.value!]!,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<MeasureMonths> mm = isar.measureMonths.where().sortByName().findAll();
|
||||
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AmbitoAppbar(
|
||||
links: const ['dashboard', 'massnahmen'],
|
||||
breakpoint: Breakpoint.fromContext(context),
|
||||
theme: theme,
|
||||
),
|
||||
body: Center(
|
||||
return BasePage().getPage(
|
||||
context,
|
||||
SingleChildScrollView(
|
||||
child: Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: SfCalendar(
|
||||
firstDayOfWeek: 1,
|
||||
showNavigationArrow: true,
|
||||
view: CalendarView.month,
|
||||
dataSource: _AppointmentDataSource(appointments),
|
||||
monthViewSettings: const MonthViewSettings(
|
||||
appointmentDisplayMode: MonthAppointmentDisplayMode.appointment,
|
||||
appointmentDisplayCount: 64,
|
||||
padding: context.breakpoint.padding,
|
||||
child: SizedBox(
|
||||
width: 1152,
|
||||
height: MediaQuery.of(context).size.height - 80,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: 40),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
theme.verticalSpacerMax,
|
||||
Text(
|
||||
'Kalender',
|
||||
textAlign: TextAlign.start,
|
||||
style: theme.headlineLarge.copyWith(
|
||||
color: theme.currentColorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
theme.verticalSpacer,
|
||||
Row(
|
||||
children: [
|
||||
ToggleSwitch(
|
||||
initialLabelIndex: display,
|
||||
totalSwitches: 2,
|
||||
minWidth: 200,
|
||||
borderWidth: 1,
|
||||
labels: const ['Pflege', 'Maßnahme'],
|
||||
activeBgColor: [
|
||||
theme.currentColorScheme.secondary
|
||||
],
|
||||
borderColor: [theme.currentColorScheme.secondary],
|
||||
inactiveBgColor: Colors.white,
|
||||
activeFgColor:
|
||||
theme.currentColorScheme.onSecondary,
|
||||
customTextStyles: [theme.bodyMedium],
|
||||
onToggle: (index) {
|
||||
setState(() {
|
||||
display = index ?? 0;
|
||||
if (display == 0) {
|
||||
type = 'maintenance';
|
||||
} else {
|
||||
type = 'apply';
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
theme.verticalSpacer,
|
||||
Expanded(
|
||||
child: gridWidget(
|
||||
mm,
|
||||
),
|
||||
),
|
||||
theme.verticalSpacerMax,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Widget gridWidget(List<MeasureMonths> mm) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
|
||||
return SizedBox(
|
||||
width: 1152,
|
||||
child: SfDataGridTheme(
|
||||
data: SfDataGridThemeData(
|
||||
headerColor: theme.currentColorScheme.primaryContainer,
|
||||
sortIcon: Icon(
|
||||
Icons.keyboard_arrow_down,
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
child: SfDataGrid(
|
||||
allowSorting: true,
|
||||
source:
|
||||
MeasureMonthsDatasource(areas: mm, context: context, type: type),
|
||||
columnWidthMode: ColumnWidthMode.fill,
|
||||
columns: [
|
||||
GridColumn(
|
||||
columnName: 'name',
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Bezeichnung',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'jan',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Jan',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'feb',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Feb',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'mar',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Mär',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'apr',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Apr',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'may',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Mai',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'jun',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Jun',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'jul',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Jul',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'aug',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Aug',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'sep',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Sep',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'oct',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Okt',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'nov',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Nov',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'dec',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
'Dez',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.bodyMedium.copyWith(
|
||||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_AppointmentDataSource _getCalendarDataSource() {
|
||||
List<Appointment> appointments = <Appointment>[];
|
||||
appointments.add(Appointment(
|
||||
startTime: DateTime.now(),
|
||||
endTime: DateTime.now().add(const Duration(minutes: 10)),
|
||||
subject: 'Meeting',
|
||||
isAllDay: true,
|
||||
color: Colors.blue,
|
||||
startTimeZone: '',
|
||||
endTimeZone: '',
|
||||
));
|
||||
|
||||
return _AppointmentDataSource(appointments);
|
||||
}
|
||||
}
|
||||
|
||||
class _AppointmentDataSource extends CalendarDataSource {
|
||||
_AppointmentDataSource(List<Appointment> source) {
|
||||
appointments = source;
|
||||
}
|
||||
}
|
||||
|
||||
/*class ActionDataSource extends CalendarDataSource {
|
||||
ActionDataSource(List<Action> source) {
|
||||
appointments = source;
|
||||
}
|
||||
|
||||
@override
|
||||
DateTime getStartTime(int index) {
|
||||
return appointments![index].from;
|
||||
}
|
||||
|
||||
@override
|
||||
DateTime getEndTime(int index) {
|
||||
return appointments![index].to;
|
||||
}
|
||||
|
||||
@override
|
||||
bool isAllDay(int index) {
|
||||
return appointments![index].isAllDay;
|
||||
}
|
||||
|
||||
@override
|
||||
String getSubject(int index) {
|
||||
return appointments![index].eventName;
|
||||
}
|
||||
|
||||
@override
|
||||
String getStartTimeZone(int index) {
|
||||
return appointments![index].startTimeZone;
|
||||
}
|
||||
|
||||
@override
|
||||
String getEndTimeZone(int index) {
|
||||
return appointments![index].endTimeZone;
|
||||
}
|
||||
|
||||
@override
|
||||
Color getColor(int index) {
|
||||
return appointments![index].background;
|
||||
}
|
||||
}
|
||||
|
||||
class Action {
|
||||
Action(
|
||||
{this.eventName = '',
|
||||
required this.from,
|
||||
required this.to,
|
||||
required this.background,
|
||||
this.isAllDay = false});
|
||||
|
||||
String eventName;
|
||||
DateTime from;
|
||||
DateTime to;
|
||||
Color background;
|
||||
bool isAllDay;
|
||||
}*/
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:ambito/src/entity/cart/cart_datasource.dart';
|
||||
|
@ -13,7 +14,12 @@ import 'package:screen_breakpoints/screen_breakpoints.dart';
|
|||
import 'package:screenshot/screenshot.dart';
|
||||
import 'package:syncfusion_flutter_core/theme.dart';
|
||||
import 'package:syncfusion_flutter_datagrid/datagrid.dart';
|
||||
import 'package:syncfusion_flutter_datagrid_export/export.dart';
|
||||
import 'package:syncfusion_flutter_pdf/pdf.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../consts/consts.dart';
|
||||
import '../../entity/_general/id_value/id_value.dart';
|
||||
import '../../entity/cart/cart.dart';
|
||||
import '../../entity/measure/general/measure_general_repository.dart';
|
||||
import '../../widgets/buttons/print_all_button.dart';
|
||||
|
@ -43,6 +49,8 @@ class CartPageState extends State<CartPage> {
|
|||
final ScreenshotController screenshotController = ScreenshotController();
|
||||
Uint8List? _imageFile;
|
||||
|
||||
final DataGridController _dataGridController = DataGridController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
@ -109,13 +117,12 @@ class CartPageState extends State<CartPage> {
|
|||
List<Widget> children = [];
|
||||
|
||||
if (carts != null) {
|
||||
int counter = 0;
|
||||
for (final cart in carts) {
|
||||
final measure = MeasureGeneralRepository().getByName(cart.name!);
|
||||
|
||||
final elements = CartRepository().getElementsByCartId(cart.id);
|
||||
|
||||
double sum = 0;
|
||||
final GlobalKey<SfDataGridState> key = GlobalKey<SfDataGridState>();
|
||||
|
||||
for (final element in elements) {
|
||||
sum = sum +
|
||||
|
@ -123,10 +130,7 @@ class CartPageState extends State<CartPage> {
|
|||
(double.tryParse(element.price ?? '0') ?? 0));
|
||||
}
|
||||
|
||||
final card = ExportFrame(
|
||||
exportDelegate: exportDelegate,
|
||||
frameId: 'cart${cart.id}',
|
||||
child: SizedBox(
|
||||
final card = SizedBox(
|
||||
width: 1152,
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
|
@ -140,8 +144,8 @@ class CartPageState extends State<CartPage> {
|
|||
children: [
|
||||
Text(
|
||||
cart.name!,
|
||||
style: theme.labelLarge.copyWith(
|
||||
color: theme.currentColorScheme.primary),
|
||||
style: theme.labelLarge
|
||||
.copyWith(color: theme.currentColorScheme.primary),
|
||||
),
|
||||
const Spacer(),
|
||||
SizedBox(
|
||||
|
@ -158,7 +162,7 @@ class CartPageState extends State<CartPage> {
|
|||
],
|
||||
),
|
||||
theme.verticalSpacerSmall,
|
||||
gridWidget(elements ?? []),
|
||||
gridWidget(elements ?? [], key),
|
||||
theme.verticalSpacer,
|
||||
Row(
|
||||
children: [
|
||||
|
@ -170,9 +174,48 @@ class CartPageState extends State<CartPage> {
|
|||
Spacer(),
|
||||
PrintButton(
|
||||
onPressed: () async {
|
||||
final pdf = await exportDelegate
|
||||
.exportToPdfDocument('cart${cart.id}');
|
||||
await saveFile(pdf, '${cart.id}.pdf');
|
||||
PdfDocument document =
|
||||
key.currentState!.exportToPdfDocument(
|
||||
headerFooterExport:
|
||||
(DataGridPdfHeaderFooterExportDetails
|
||||
headerFooterExport) {
|
||||
final double width = headerFooterExport.pdfPage
|
||||
.getClientSize()
|
||||
.width;
|
||||
final PdfPageTemplateElement header =
|
||||
PdfPageTemplateElement(
|
||||
Rect.fromLTWH(0, 0, width, 65));
|
||||
header.graphics.drawString(
|
||||
'Warenkorb für "${cart.name!}"',
|
||||
PdfStandardFont(PdfFontFamily.helvetica, 13,
|
||||
style: PdfFontStyle.bold),
|
||||
bounds: const Rect.fromLTWH(0, 25, 400, 60),
|
||||
);
|
||||
headerFooterExport.pdfDocumentTemplate.top =
|
||||
header;
|
||||
},
|
||||
cellExport: (details) {
|
||||
if (details.cellType ==
|
||||
DataGridExportCellType.row &&
|
||||
details.columnName == 'Anbieter') {
|
||||
if (details.cellValue.toString() == '[]') {
|
||||
details.pdfCell.value = '-';
|
||||
} else {
|
||||
List<String> values = [];
|
||||
for (IdValue idValue
|
||||
in (details.cellValue as List<IdValue>)) {
|
||||
values.add(idValue.value ?? '');
|
||||
}
|
||||
logger.d(values.join(', '));
|
||||
details.pdfCell.value = values.join(', ');
|
||||
}
|
||||
}
|
||||
},
|
||||
fitAllColumnsInOnePage: true,
|
||||
);
|
||||
final List<int> bytes = document.saveSync();
|
||||
launchUrl(Uri.parse(
|
||||
"data:application/octet-stream;base64,${base64Encode(bytes)}"));
|
||||
},
|
||||
),
|
||||
],
|
||||
|
@ -181,11 +224,9 @@ class CartPageState extends State<CartPage> {
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
children.add(card);
|
||||
children.add(theme.verticalSpacerMax);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,7 +239,8 @@ class CartPageState extends State<CartPage> {
|
|||
);
|
||||
}
|
||||
|
||||
Widget gridWidget(List<CartElement> cartElements) {
|
||||
Widget gridWidget(
|
||||
List<CartElement> cartElements, GlobalKey<SfDataGridState> key) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
|
||||
return SfDataGridTheme(
|
||||
|
@ -210,12 +252,22 @@ class CartPageState extends State<CartPage> {
|
|||
),
|
||||
),
|
||||
child: SfDataGrid(
|
||||
controller: _dataGridController,
|
||||
key: key,
|
||||
allowSorting: true,
|
||||
source: CartDataSource(cartElements: cartElements, context: context),
|
||||
allowEditing: true,
|
||||
selectionMode: SelectionMode.single,
|
||||
editingGestureType: EditingGestureType.doubleTap,
|
||||
navigationMode: GridNavigationMode.cell,
|
||||
source: CartDataSource(
|
||||
cartElements: cartElements,
|
||||
context: context,
|
||||
controller: _dataGridController),
|
||||
columnWidthMode: ColumnWidthMode.fill,
|
||||
columns: [
|
||||
GridColumn(
|
||||
columnName: 'name',
|
||||
columnName: 'Material',
|
||||
allowEditing: true,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
|
@ -229,8 +281,9 @@ class CartPageState extends State<CartPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'amount',
|
||||
columnName: 'Menge',
|
||||
maximumWidth: 150,
|
||||
allowEditing: true,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
|
@ -244,9 +297,10 @@ class CartPageState extends State<CartPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'provider',
|
||||
columnName: 'Anbieter',
|
||||
maximumWidth: 200,
|
||||
allowSorting: false,
|
||||
allowEditing: false,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
|
@ -260,8 +314,9 @@ class CartPageState extends State<CartPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'price',
|
||||
columnName: 'Richtpreis',
|
||||
allowSorting: true,
|
||||
allowEditing: false,
|
||||
maximumWidth: 250,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
|
|
|
@ -114,7 +114,6 @@ class DashboardAreasPageState extends State<DashboardAreasPage> {
|
|||
padding: context.breakpoint.padding,
|
||||
child: SizedBox(
|
||||
width: 1152,
|
||||
height: 1152,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import 'package:ambito/src/entity/entities.dart';
|
||||
import 'package:ambito/src/entity/measure/details/measure_details.dart';
|
||||
import 'package:ambito/src/entity/measure/details/measure_details_repository.dart';
|
||||
import 'package:ambito/src/entity/measure/measure_repository.dart';
|
||||
import 'package:ambito/src/entity/measure/types_details/measure_types_details.dart';
|
||||
import 'package:ambito/src/entity/measure/types_details/measure_types_details_repository.dart';
|
||||
import 'package:ambito/src/extensions/extensions.dart';
|
||||
import 'package:ambito/src/pages/measure/detail/cards/main/combined_card.dart';
|
||||
import 'package:ambito/src/pages/measure/detail/cards/main/gallery_card.dart';
|
||||
|
@ -63,13 +60,12 @@ class MeasureDetailPageState extends State<MeasureDetailPage> {
|
|||
super.initState();
|
||||
|
||||
// Parse ID from parameters
|
||||
id = int.tryParse(Get.parameters['id'] ?? '0') ?? 0;
|
||||
|
||||
// Initialize combined map with ID
|
||||
Map<String, dynamic> combined = {'id': id};
|
||||
//Map<String, dynamic> combined = {'id': id};
|
||||
|
||||
// Retrieve measureGeneral data
|
||||
measureGeneral = isar.measureGenerals.where().idEqualTo(id!).findFirst();
|
||||
/* measureGeneral = isar.measureGenerals.where().idEqualTo(id!).findFirst();
|
||||
|
||||
if (measureGeneral != null) {
|
||||
// Fetch related details and types
|
||||
|
@ -92,7 +88,7 @@ class MeasureDetailPageState extends State<MeasureDetailPage> {
|
|||
});
|
||||
|
||||
logger.d(measure!.toJson());
|
||||
});
|
||||
});*/
|
||||
|
||||
// Add scroll listener for the back-to-top button
|
||||
scrollController.addListener(() {
|
||||
|
@ -116,6 +112,12 @@ class MeasureDetailPageState extends State<MeasureDetailPage> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
|
||||
id = int.tryParse(Get.parameters['id'] ?? '0') ?? 0;
|
||||
|
||||
MeasureComplete? measure =
|
||||
isar.measureCompletes.where().idEqualTo(id!).findFirst()!;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AmbitoAppbar(
|
||||
links: const ['dashboard', 'massnahmen'],
|
||||
|
@ -239,7 +241,7 @@ class MeasureDetailPageState extends State<MeasureDetailPage> {
|
|||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
measure.name,
|
||||
measure.name!,
|
||||
style: theme.currentThemeData.textTheme.headlineMedium,
|
||||
),
|
||||
),
|
||||
|
|
|
@ -322,8 +322,4 @@ class MeasuresPageState extends State<MeasuresPage> {
|
|||
),
|
||||
);
|
||||
}
|
||||
|
||||
bool _hasCommonItems(List listOne, List listTwo) {
|
||||
return listOne.toSet().intersection(listTwo.toSet()).isNotEmpty;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,13 @@
|
|||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <isar_flutter_libs/isar_flutter_libs_plugin.h>
|
||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||
|
||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
g_autoptr(FlPluginRegistrar) isar_flutter_libs_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "IsarFlutterLibsPlugin");
|
||||
isar_flutter_libs_plugin_register_with_registrar(isar_flutter_libs_registrar);
|
||||
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
||||
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
isar_flutter_libs
|
||||
url_launcher_linux
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
|
|
@ -10,6 +10,7 @@ import isar_flutter_libs
|
|||
import path_provider_foundation
|
||||
import shared_preferences_foundation
|
||||
import sqflite_darwin
|
||||
import url_launcher_macos
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
|
||||
|
@ -17,4 +18,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
|||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||
}
|
||||
|
|
120
pubspec.lock
120
pubspec.lock
|
@ -464,6 +464,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
flutter_spinbox:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_spinbox
|
||||
sha256: "38d8c1a3a39f0fa72823d4470785f5e165f2deb53531ca7803b54ba45e4dbd46"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.13.1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
|
@ -730,6 +738,14 @@ packages:
|
|||
url: "https://pub.isar-community.dev"
|
||||
source: hosted
|
||||
version: "4.0.3"
|
||||
jiffy:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: jiffy
|
||||
sha256: "1c1b86459969ff9f32dc5b0ffe392f1e08181e66396cf9dd8fa7c90552a691af"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.2"
|
||||
jovial_misc:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -874,6 +890,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
number_inc_dec:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: number_inc_dec
|
||||
sha256: af0a35f923a2e67532bc6579e8fbf0093be8ea185e48bb543db4e3e355017ec5
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.8.0"
|
||||
octo_image:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1335,6 +1359,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "28.1.33"
|
||||
syncfusion_flutter_datagrid_export:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: syncfusion_flutter_datagrid_export
|
||||
sha256: "8f948663820f1c987430df9243b48e83d1e4ba3823ed3fb8c054f5d6b6ade2f8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "28.1.33"
|
||||
syncfusion_flutter_datepicker:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -1343,6 +1375,22 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "28.1.33"
|
||||
syncfusion_flutter_pdf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: syncfusion_flutter_pdf
|
||||
sha256: bdd6b6c085fc39fbcfbf641efbf7f97d9c39b58e57accc47fca4f9db592b2294
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "28.1.33"
|
||||
syncfusion_flutter_xlsio:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: syncfusion_flutter_xlsio
|
||||
sha256: dfe4ab39ae2c3fad1b2e9696e69d30099a54913bcc78c17df39c44c517de72b0
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "28.1.33"
|
||||
syncfusion_localizations:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -1351,6 +1399,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "28.1.33"
|
||||
syncfusion_officecore:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: syncfusion_officecore
|
||||
sha256: c771b542eeb8ed90344e32dadc5ae8a54292ce159c1f98db1a8b16c71a7c2f37
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "28.1.33"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1431,6 +1487,70 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.2"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: url_launcher
|
||||
sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.1"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: "6fc2f56536ee873eeb867ad176ae15f304ccccc357848b351f6f0d8d4a40d193"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.14"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_ios
|
||||
sha256: "16a513b6c12bb419304e72ea0ae2ab4fed569920d1c7cb850263fe3acc824626"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.2"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_linux
|
||||
sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.1"
|
||||
url_launcher_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_macos
|
||||
sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.2"
|
||||
url_launcher_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_platform_interface
|
||||
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
url_launcher_web:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: url_launcher_web
|
||||
sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.3"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_windows
|
||||
sha256: "44cf3aabcedde30f2dba119a9dea3b0f2672fbe6fa96e85536251d678216b3c4"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.3"
|
||||
uuid:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -67,6 +67,11 @@ dependencies:
|
|||
cross_file: ^0.3.4+2
|
||||
screenshot: ^3.0.0
|
||||
webview_flutter_web: ^0.2.3+4
|
||||
number_inc_dec: ^0.8.0
|
||||
flutter_spinbox: ^0.13.1
|
||||
syncfusion_flutter_datagrid_export: ^28.1.33
|
||||
url_launcher_web: ^2.3.3
|
||||
url_launcher: ^6.3.1
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <geolocator_windows/geolocator_windows.h>
|
||||
#include <isar_flutter_libs/isar_flutter_libs_plugin.h>
|
||||
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
GeolocatorWindowsRegisterWithRegistrar(
|
||||
|
@ -17,4 +18,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
|
|||
registry->GetRegistrarForPlugin("IsarFlutterLibsPlugin"));
|
||||
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
||||
UrlLauncherWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
|||
geolocator_windows
|
||||
isar_flutter_libs
|
||||
permission_handler_windows
|
||||
url_launcher_windows
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
|
Loading…
Reference in a new issue