Stammdaten
This commit is contained in:
parent
bb1e1ecc95
commit
8b1ec3818c
27 changed files with 4185 additions and 59 deletions
|
@ -13,10 +13,12 @@
|
|||
},
|
||||
"buttons": {
|
||||
"delete": "Löschen",
|
||||
"edit": "Bearbeiten",
|
||||
"cancel": "Abbrechen",
|
||||
"save": "Speichern",
|
||||
"print_all": "Alles drucken",
|
||||
"print": "Drucken"
|
||||
"print": "Drucken",
|
||||
"upload_image": "Bild hochladen"
|
||||
},
|
||||
"spacer": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
|
||||
},
|
||||
|
|
|
@ -14,6 +14,7 @@ import 'package:ambito/src/pages/calendar/calendar_page_year.dart';
|
|||
import 'package:ambito/src/pages/cart/cart_page.dart';
|
||||
import 'package:ambito/src/pages/dashboard/areas/dashboard_areas_page.dart';
|
||||
import 'package:ambito/src/pages/dashboard/dashboard_page.dart';
|
||||
import 'package:ambito/src/pages/dashboard/master_data/master_data_page.dart';
|
||||
import 'package:ambito/src/pages/error/error_page.dart';
|
||||
import 'package:ambito/src/pages/measure/categories/measure_categories_page.dart';
|
||||
import 'package:ambito/src/pages/measure/create/measure_create_page.dart';
|
||||
|
@ -43,6 +44,7 @@ void main() async {
|
|||
BaseApi().getContent('funding_program'),
|
||||
BaseApi().getContent('business'),
|
||||
BaseApi().getContent('area'),
|
||||
BaseApi().getContent('login'),
|
||||
]);
|
||||
List<int> myCartIds = [];
|
||||
|
||||
|
@ -202,9 +204,9 @@ class Ambito extends StatelessWidget {
|
|||
),
|
||||
GetPage(
|
||||
name: '/dashboard/stammdaten',
|
||||
page: () => DashboardPage(
|
||||
page: () => MasterDataPage(
|
||||
businessId: prefs.getInt('currentUser') ?? 100,
|
||||
userId: 0,
|
||||
userId: 1,
|
||||
),
|
||||
),
|
||||
GetPage(
|
||||
|
|
|
@ -70,4 +70,5 @@ const baserowIds = {
|
|||
"source": 334231,
|
||||
"cart": 406916,
|
||||
"cart_element": 407428,
|
||||
"login": 410129,
|
||||
};
|
||||
|
|
|
@ -74,6 +74,12 @@ class Business extends BaseEntity with EntityWithId {
|
|||
@JsonKey(name: 'field_2428872')
|
||||
List<IdValue>? experienceReport;
|
||||
|
||||
@JsonKey(name: 'field_3137840')
|
||||
String? notice;
|
||||
|
||||
@JsonKey(name: 'field_3136789')
|
||||
List<IdValue>? logins;
|
||||
|
||||
factory Business.fromJson(Map<String, dynamic> json) =>
|
||||
_$BusinessFromJson(json);
|
||||
|
||||
|
|
|
@ -128,6 +128,15 @@ const BusinessSchema = IsarGeneratedSchema(
|
|||
type: IsarType.objectList,
|
||||
target: 'IdValue',
|
||||
),
|
||||
IsarPropertySchema(
|
||||
name: 'notice',
|
||||
type: IsarType.string,
|
||||
),
|
||||
IsarPropertySchema(
|
||||
name: 'logins',
|
||||
type: IsarType.objectList,
|
||||
target: 'IdValue',
|
||||
),
|
||||
],
|
||||
indexes: [
|
||||
IsarIndexSchema(
|
||||
|
@ -380,6 +389,31 @@ int serializeBusiness(IsarWriter writer, Business object) {
|
|||
IsarCore.endList(writer, listWriter);
|
||||
}
|
||||
}
|
||||
{
|
||||
final value = object.notice;
|
||||
if (value == null) {
|
||||
IsarCore.writeNull(writer, 27);
|
||||
} else {
|
||||
IsarCore.writeString(writer, 27, value);
|
||||
}
|
||||
}
|
||||
{
|
||||
final list = object.logins;
|
||||
if (list == null) {
|
||||
IsarCore.writeNull(writer, 28);
|
||||
} else {
|
||||
final listWriter = IsarCore.beginList(writer, 28, list.length);
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
{
|
||||
final value = list[i];
|
||||
final objectWriter = IsarCore.beginObject(listWriter, i);
|
||||
serializeIdValue(objectWriter, value);
|
||||
IsarCore.endObject(listWriter, objectWriter);
|
||||
}
|
||||
}
|
||||
IsarCore.endList(writer, listWriter);
|
||||
}
|
||||
}
|
||||
return object.id;
|
||||
}
|
||||
|
||||
|
@ -478,6 +512,32 @@ Business deserializeBusiness(IsarReader reader) {
|
|||
}
|
||||
}
|
||||
}
|
||||
object.notice = IsarCore.readString(reader, 27);
|
||||
{
|
||||
final length = IsarCore.readList(reader, 28, IsarCore.readerPtrPtr);
|
||||
{
|
||||
final reader = IsarCore.readerPtr;
|
||||
if (reader.isNull) {
|
||||
object.logins = null;
|
||||
} else {
|
||||
final list = List<IdValue>.filled(length, IdValue(), growable: true);
|
||||
for (var i = 0; i < length; i++) {
|
||||
{
|
||||
final objectReader = IsarCore.readObject(reader, i);
|
||||
if (objectReader.isNull) {
|
||||
list[i] = IdValue();
|
||||
} else {
|
||||
final embedded = deserializeIdValue(objectReader);
|
||||
IsarCore.freeReader(objectReader);
|
||||
list[i] = embedded;
|
||||
}
|
||||
}
|
||||
}
|
||||
IsarCore.freeReader(reader);
|
||||
object.logins = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
object.id = IsarCore.readId(reader);
|
||||
return object;
|
||||
}
|
||||
|
@ -605,6 +665,35 @@ dynamic deserializeBusinessProp(IsarReader reader, int property) {
|
|||
}
|
||||
}
|
||||
}
|
||||
case 27:
|
||||
return IsarCore.readString(reader, 27);
|
||||
case 28:
|
||||
{
|
||||
final length = IsarCore.readList(reader, 28, IsarCore.readerPtrPtr);
|
||||
{
|
||||
final reader = IsarCore.readerPtr;
|
||||
if (reader.isNull) {
|
||||
return null;
|
||||
} else {
|
||||
final list =
|
||||
List<IdValue>.filled(length, IdValue(), growable: true);
|
||||
for (var i = 0; i < length; i++) {
|
||||
{
|
||||
final objectReader = IsarCore.readObject(reader, i);
|
||||
if (objectReader.isNull) {
|
||||
list[i] = IdValue();
|
||||
} else {
|
||||
final embedded = deserializeIdValue(objectReader);
|
||||
IsarCore.freeReader(objectReader);
|
||||
list[i] = embedded;
|
||||
}
|
||||
}
|
||||
}
|
||||
IsarCore.freeReader(reader);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
case 0:
|
||||
return IsarCore.readId(reader);
|
||||
default:
|
||||
|
@ -637,6 +726,7 @@ sealed class _BusinessUpdate {
|
|||
String? addressRegion,
|
||||
String? addressFederalState,
|
||||
String? businessBio,
|
||||
String? notice,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -670,6 +760,7 @@ class _BusinessUpdateImpl implements _BusinessUpdate {
|
|||
Object? addressRegion = ignore,
|
||||
Object? addressFederalState = ignore,
|
||||
Object? businessBio = ignore,
|
||||
Object? notice = ignore,
|
||||
}) {
|
||||
return collection.updateProperties([
|
||||
id
|
||||
|
@ -696,6 +787,7 @@ class _BusinessUpdateImpl implements _BusinessUpdate {
|
|||
if (addressRegion != ignore) 23: addressRegion as String?,
|
||||
if (addressFederalState != ignore) 24: addressFederalState as String?,
|
||||
if (businessBio != ignore) 25: businessBio as String?,
|
||||
if (notice != ignore) 27: notice as String?,
|
||||
}) >
|
||||
0;
|
||||
}
|
||||
|
@ -726,6 +818,7 @@ sealed class _BusinessUpdateAll {
|
|||
String? addressRegion,
|
||||
String? addressFederalState,
|
||||
String? businessBio,
|
||||
String? notice,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -759,6 +852,7 @@ class _BusinessUpdateAllImpl implements _BusinessUpdateAll {
|
|||
Object? addressRegion = ignore,
|
||||
Object? addressFederalState = ignore,
|
||||
Object? businessBio = ignore,
|
||||
Object? notice = ignore,
|
||||
}) {
|
||||
return collection.updateProperties(id, {
|
||||
if (name != ignore) 1: name as String?,
|
||||
|
@ -783,6 +877,7 @@ class _BusinessUpdateAllImpl implements _BusinessUpdateAll {
|
|||
if (addressRegion != ignore) 23: addressRegion as String?,
|
||||
if (addressFederalState != ignore) 24: addressFederalState as String?,
|
||||
if (businessBio != ignore) 25: businessBio as String?,
|
||||
if (notice != ignore) 27: notice as String?,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -817,6 +912,7 @@ sealed class _BusinessQueryUpdate {
|
|||
String? addressRegion,
|
||||
String? addressFederalState,
|
||||
String? businessBio,
|
||||
String? notice,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -850,6 +946,7 @@ class _BusinessQueryUpdateImpl implements _BusinessQueryUpdate {
|
|||
Object? addressRegion = ignore,
|
||||
Object? addressFederalState = ignore,
|
||||
Object? businessBio = ignore,
|
||||
Object? notice = ignore,
|
||||
}) {
|
||||
return query.updateProperties(limit: limit, {
|
||||
if (name != ignore) 1: name as String?,
|
||||
|
@ -874,6 +971,7 @@ class _BusinessQueryUpdateImpl implements _BusinessQueryUpdate {
|
|||
if (addressRegion != ignore) 23: addressRegion as String?,
|
||||
if (addressFederalState != ignore) 24: addressFederalState as String?,
|
||||
if (businessBio != ignore) 25: businessBio as String?,
|
||||
if (notice != ignore) 27: notice as String?,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -915,6 +1013,7 @@ class _BusinessQueryBuilderUpdateImpl implements _BusinessQueryUpdate {
|
|||
Object? addressRegion = ignore,
|
||||
Object? addressFederalState = ignore,
|
||||
Object? businessBio = ignore,
|
||||
Object? notice = ignore,
|
||||
}) {
|
||||
final q = query.build();
|
||||
try {
|
||||
|
@ -941,6 +1040,7 @@ class _BusinessQueryBuilderUpdateImpl implements _BusinessQueryUpdate {
|
|||
if (addressRegion != ignore) 23: addressRegion as String?,
|
||||
if (addressFederalState != ignore) 24: addressFederalState as String?,
|
||||
if (businessBio != ignore) 25: businessBio as String?,
|
||||
if (notice != ignore) 27: notice as String?,
|
||||
});
|
||||
} finally {
|
||||
q.close();
|
||||
|
@ -5262,6 +5362,218 @@ extension BusinessQueryFilter
|
|||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> noticeIsNull() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(const IsNullCondition(property: 27));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> noticeIsNotNull() {
|
||||
return QueryBuilder.apply(not(), (query) {
|
||||
return query.addFilterCondition(const IsNullCondition(property: 27));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> noticeEqualTo(
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
EqualCondition(
|
||||
property: 27,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> noticeGreaterThan(
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
GreaterCondition(
|
||||
property: 27,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition>
|
||||
noticeGreaterThanOrEqualTo(
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
GreaterOrEqualCondition(
|
||||
property: 27,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> noticeLessThan(
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
LessCondition(
|
||||
property: 27,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition>
|
||||
noticeLessThanOrEqualTo(
|
||||
String? value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
LessOrEqualCondition(
|
||||
property: 27,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> noticeBetween(
|
||||
String? lower,
|
||||
String? upper, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
BetweenCondition(
|
||||
property: 27,
|
||||
lower: lower,
|
||||
upper: upper,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> noticeStartsWith(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
StartsWithCondition(
|
||||
property: 27,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> noticeEndsWith(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
EndsWithCondition(
|
||||
property: 27,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> noticeContains(
|
||||
String value,
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
ContainsCondition(
|
||||
property: 27,
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> noticeMatches(
|
||||
String pattern,
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
MatchesCondition(
|
||||
property: 27,
|
||||
wildcard: pattern,
|
||||
caseSensitive: caseSensitive,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> noticeIsEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
const EqualCondition(
|
||||
property: 27,
|
||||
value: '',
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> noticeIsNotEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
const GreaterCondition(
|
||||
property: 27,
|
||||
value: '',
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> loginsIsNull() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(const IsNullCondition(property: 28));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> loginsIsNotNull() {
|
||||
return QueryBuilder.apply(not(), (query) {
|
||||
return query.addFilterCondition(const IsNullCondition(property: 28));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> loginsIsEmpty() {
|
||||
return not().group(
|
||||
(q) => q.loginsIsNull().or().loginsIsNotEmpty(),
|
||||
);
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> loginsIsNotEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(
|
||||
const GreaterOrEqualCondition(property: 28, value: null),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterFilterCondition> idEqualTo(
|
||||
int value,
|
||||
) {
|
||||
|
@ -5824,6 +6136,27 @@ extension BusinessQuerySortBy on QueryBuilder<Business, Business, QSortBy> {
|
|||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterSortBy> sortByNotice(
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(
|
||||
27,
|
||||
caseSensitive: caseSensitive,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterSortBy> sortByNoticeDesc(
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(
|
||||
27,
|
||||
sort: Sort.desc,
|
||||
caseSensitive: caseSensitive,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterSortBy> sortById() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(0);
|
||||
|
@ -6147,6 +6480,20 @@ extension BusinessQuerySortThenBy
|
|||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterSortBy> thenByNotice(
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(27, caseSensitive: caseSensitive);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterSortBy> thenByNoticeDesc(
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(27, sort: Sort.desc, caseSensitive: caseSensitive);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterSortBy> thenById() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(0);
|
||||
|
@ -6315,6 +6662,13 @@ extension BusinessQueryWhereDistinct
|
|||
return query.addDistinctBy(25, caseSensitive: caseSensitive);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, Business, QAfterDistinct> distinctByNotice(
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addDistinctBy(27, caseSensitive: caseSensitive);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension BusinessQueryProperty1
|
||||
|
@ -6479,6 +6833,18 @@ extension BusinessQueryProperty1
|
|||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, String?, QAfterProperty> noticeProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(27);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, List<IdValue>?, QAfterProperty> loginsProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(28);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, int, QAfterProperty> idProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(0);
|
||||
|
@ -6654,6 +7020,18 @@ extension BusinessQueryProperty2<R>
|
|||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, (R, String?), QAfterProperty> noticeProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(27);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, (R, List<IdValue>?), QAfterProperty> loginsProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(28);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, (R, int), QAfterProperty> idProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(0);
|
||||
|
@ -6841,6 +7219,19 @@ extension BusinessQueryProperty3<R1, R2>
|
|||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, (R1, R2, String?), QOperations> noticeProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(27);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, (R1, R2, List<IdValue>?), QOperations>
|
||||
loginsProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(28);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<Business, (R1, R2, int), QOperations> idProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addProperty(0);
|
||||
|
@ -6886,6 +7277,10 @@ Business _$BusinessFromJson(Map<String, dynamic> json) => Business()
|
|||
..addressFederalState = json['field_2404136'] as String?
|
||||
..businessBio = json['field_2404138'] as String?
|
||||
..experienceReport = (json['field_2428872'] as List<dynamic>?)
|
||||
?.map((e) => IdValue.fromJson(e as Map<String, dynamic>))
|
||||
.toList()
|
||||
..notice = json['field_3137840'] as String?
|
||||
..logins = (json['field_3136789'] as List<dynamic>?)
|
||||
?.map((e) => IdValue.fromJson(e as Map<String, dynamic>))
|
||||
.toList();
|
||||
|
||||
|
@ -6919,4 +7314,6 @@ Map<String, dynamic> _$BusinessToJson(Business instance) => <String, dynamic>{
|
|||
'field_2404138': instance.businessBio,
|
||||
'field_2428872':
|
||||
instance.experienceReport?.map((e) => e.toJson()).toList(),
|
||||
'field_3137840': instance.notice,
|
||||
'field_3136789': instance.logins?.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
|
|
62
lib/src/entity/login/login.dart
Normal file
62
lib/src/entity/login/login.dart
Normal file
|
@ -0,0 +1,62 @@
|
|||
import 'package:ambito/src/entity/_general/file/file_part.dart';
|
||||
import 'package:ambito/src/entity/_general/id_value/id_value.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';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../_general/file/thumbnail.dart';
|
||||
import '../_general/file/thumbnails.dart';
|
||||
|
||||
part 'login.g.dart';
|
||||
|
||||
@collection
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class Login extends BaseEntity with EntityWithId {
|
||||
Login();
|
||||
|
||||
@JsonKey(name: 'field_3136271')
|
||||
String? username;
|
||||
@JsonKey(name: 'field_3136278')
|
||||
String? password;
|
||||
@JsonKey(name: 'field_3136279')
|
||||
List<FilePart>? images;
|
||||
@JsonKey(name: 'field_3136280')
|
||||
String? salutation;
|
||||
@JsonKey(name: 'field_3136281')
|
||||
String? title;
|
||||
@JsonKey(name: 'field_3136282')
|
||||
String? firstName;
|
||||
@JsonKey(name: 'field_3136283')
|
||||
String? lastName;
|
||||
@JsonKey(name: 'field_3136294')
|
||||
String? phone;
|
||||
@JsonKey(name: 'field_3136284')
|
||||
String? email;
|
||||
@JsonKey(name: 'field_3136285')
|
||||
List<IdValue>? business;
|
||||
|
||||
factory Login.fromJson(Map<String, dynamic> json) => _$LoginFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$LoginToJson(this);
|
||||
}
|
||||
|
||||
extension LoginExtension on Login {
|
||||
Widget? getImage() {
|
||||
Widget? image;
|
||||
if (images != null && images!.isNotEmpty) {
|
||||
if (images![0].thumbnails?.cardCover?.url != null) {
|
||||
image = CachedNetworkImage(
|
||||
width: 100,
|
||||
height: 100,
|
||||
imageUrl: images![0].thumbnails!.cardCover!.url!,
|
||||
placeholder: (context, url) => const CircularProgressIndicator(),
|
||||
errorWidget: (context, url, error) => const Icon(Icons.error),
|
||||
fit: BoxFit.cover,
|
||||
);
|
||||
}
|
||||
}
|
||||
return image;
|
||||
}
|
||||
}
|
2729
lib/src/entity/login/login.g.dart
Normal file
2729
lib/src/entity/login/login.g.dart
Normal file
File diff suppressed because it is too large
Load diff
22
lib/src/entity/login/login_repository.dart
Normal file
22
lib/src/entity/login/login_repository.dart
Normal file
|
@ -0,0 +1,22 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:ambito/src/entity/login/login.dart';
|
||||
import 'package:ambito/src/packages/ambito_db/base_db.dart';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
|
||||
import '../../consts/consts.dart';
|
||||
|
||||
class LoginRepository extends BaseDB {
|
||||
@override
|
||||
IsarCollection collection = isar.logins;
|
||||
|
||||
Login? getLogin(String username, String password) {
|
||||
return isar.logins
|
||||
.where()
|
||||
.usernameEqualTo(username)
|
||||
.and()
|
||||
.passwordEqualTo(sha1.convert(utf8.encode(password)).toString())
|
||||
.findFirst();
|
||||
}
|
||||
}
|
|
@ -18,73 +18,73 @@ class MeasureMonthsDatasource extends DataGridSource {
|
|||
value: dataGridRow.name,
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'jan',
|
||||
columnName: 'Jan',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![0]
|
||||
: dataGridRow.maintenanceList![0],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'feb',
|
||||
columnName: 'Feb',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![1]
|
||||
: dataGridRow.maintenanceList![1],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'mar',
|
||||
columnName: 'Mär',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![2]
|
||||
: dataGridRow.maintenanceList![2],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'apr',
|
||||
columnName: 'Apr',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![3]
|
||||
: dataGridRow.maintenanceList![3],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'may',
|
||||
columnName: 'Mai',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![4]
|
||||
: dataGridRow.maintenanceList![4],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'jun',
|
||||
columnName: 'Jun',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![5]
|
||||
: dataGridRow.maintenanceList![5],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'jul',
|
||||
columnName: 'Jul',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![6]
|
||||
: dataGridRow.maintenanceList![6],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'aug',
|
||||
columnName: 'Aug',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![7]
|
||||
: dataGridRow.maintenanceList![7],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'sep',
|
||||
columnName: 'Sep',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![8]
|
||||
: dataGridRow.maintenanceList![8],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'oct',
|
||||
columnName: 'Okt',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![9]
|
||||
: dataGridRow.maintenanceList![9],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'nov',
|
||||
columnName: 'Nov',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![10]
|
||||
: dataGridRow.maintenanceList![10],
|
||||
),
|
||||
DataGridCell<bool>(
|
||||
columnName: 'dec',
|
||||
columnName: 'Dez',
|
||||
value: type == 'apply'
|
||||
? dataGridRow.applyList![11]
|
||||
: dataGridRow.maintenanceList![11],
|
||||
|
@ -114,6 +114,7 @@ class MeasureMonthsDatasource extends DataGridSource {
|
|||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: InkWell(
|
||||
child: Text(
|
||||
dataGridCell.value,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
|
@ -121,9 +122,10 @@ class MeasureMonthsDatasource extends DataGridSource {
|
|||
color: theme.currentColorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Widget content = SizedBox();
|
||||
Widget? content;
|
||||
if (type == 'apply' && dataGridCell.value == true) {
|
||||
content = Icon(
|
||||
Icons.carpenter_outlined,
|
||||
|
@ -139,7 +141,7 @@ class MeasureMonthsDatasource extends DataGridSource {
|
|||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: content,
|
||||
child: content ?? SizedBox(),
|
||||
);
|
||||
},
|
||||
).toList());
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'dart:convert';
|
|||
import 'package:ambito/main.dart';
|
||||
import 'package:ambito/src/entity/area/area_repository.dart';
|
||||
import 'package:ambito/src/entity/entities.dart';
|
||||
import 'package:ambito/src/entity/login/login_repository.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/general/measure_general_repository.dart';
|
||||
|
@ -12,9 +13,11 @@ import 'package:ambito/src/packages/ambito_api/restclient.dart';
|
|||
import 'package:get/get.dart';
|
||||
|
||||
import '../../config/config.dart';
|
||||
import '../../consts/consts.dart';
|
||||
import '../../entity/area/area.dart';
|
||||
import '../../entity/business/business_repository.dart';
|
||||
import '../../entity/funding_program/funding_program_repository.dart';
|
||||
import '../../entity/login/login.dart';
|
||||
import '../../entity/measure/measure_repository.dart';
|
||||
|
||||
class BaseApi {
|
||||
|
@ -30,6 +33,7 @@ class BaseApi {
|
|||
'area': AreaRepository().put,
|
||||
'business': BusinessRepository().put,
|
||||
'funding_program': FundingProgramRepository().put,
|
||||
'login': LoginRepository().put,
|
||||
'measure_types': MeasureRepository().put,
|
||||
'measure_general': MeasureGeneralRepository().put,
|
||||
'measure_details': MeasureDetailsRepository().put,
|
||||
|
@ -37,15 +41,31 @@ class BaseApi {
|
|||
};
|
||||
}
|
||||
|
||||
Future<bool> patchContent(String table, int id, dynamic body) async {
|
||||
Future<dynamic> patchContent(String table, int id, dynamic body,
|
||||
[bool autosave = true]) async {
|
||||
init();
|
||||
int tableId = tables[table] ?? 0;
|
||||
|
||||
if (tableId <= 0) return false;
|
||||
|
||||
logger.d(body);
|
||||
|
||||
var response = await RestClient().patch('$tableId/$id/', body);
|
||||
if (response.statusCode != 200) Get.toNamed('/error');
|
||||
return true;
|
||||
if (response.statusCode != 200) {
|
||||
logger.e(response.headers);
|
||||
logger.e(response.body);
|
||||
Get.toNamed('/error');
|
||||
}
|
||||
|
||||
if (autosave == true) {
|
||||
final repositoryMap = _getMap();
|
||||
var model = _createModelFromJson(table, jsonDecode(response.body));
|
||||
var repositoryFunction = repositoryMap[table];
|
||||
if (repositoryFunction == null) return false;
|
||||
repositoryFunction(model);
|
||||
}
|
||||
|
||||
return response.body;
|
||||
}
|
||||
|
||||
Future<bool> deleteContent(String table, int id) async {
|
||||
|
@ -99,6 +119,7 @@ class BaseApi {
|
|||
'area': AreaRepository().put,
|
||||
'business': BusinessRepository().put,
|
||||
'funding_program': FundingProgramRepository().put,
|
||||
'login': LoginRepository().put,
|
||||
'measure_types': MeasureRepository().put,
|
||||
'measure_general': MeasureGeneralRepository().put,
|
||||
'measure_details': MeasureDetailsRepository().put,
|
||||
|
@ -136,6 +157,8 @@ class BaseApi {
|
|||
return MeasureTypesDetails.fromJson(json);
|
||||
case 'funding_program':
|
||||
return FundingProgram.fromJson(json);
|
||||
case 'login':
|
||||
return Login.fromJson(json);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -127,7 +127,6 @@ class RestClient {
|
|||
final String uriString = '$baseUrl$endpoint';
|
||||
final Uri uri = Uri.parse(uriString);
|
||||
final Map<String, String> headers = _getHeaders();
|
||||
logger.d(jsonEncode(body));
|
||||
return _performRequest(
|
||||
() {
|
||||
return _client.patch(
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:ambito/src/entity/entities.dart';
|
|||
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/login/login.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';
|
||||
|
@ -41,6 +42,7 @@ class AmbitoIsarDB {
|
|||
ListMeasureSchema,
|
||||
ListMeasureSingleSchema,
|
||||
ListMeasureTypeGroupCategorySchema,
|
||||
LoginSchema,
|
||||
MaterialSchema,
|
||||
MeasureMonthsSchema,
|
||||
MeasureCompleteSchema,
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:convert';
|
||||
|
||||
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';
|
||||
|
@ -6,9 +8,13 @@ import 'package:isar/isar.dart';
|
|||
import 'package:screen_breakpoints/screen_breakpoints.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:toggle_switch/toggle_switch.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../consts/consts.dart';
|
||||
import '../../widgets/buttons/print_button.dart';
|
||||
import '../../widgets/page/base_page.dart';
|
||||
|
||||
class CalendarPage extends StatefulWidget {
|
||||
|
@ -34,6 +40,8 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
|
||||
final GlobalKey<SfDataGridState> key = GlobalKey<SfDataGridState>();
|
||||
|
||||
return BasePage().getPage(
|
||||
context,
|
||||
SingleChildScrollView(
|
||||
|
@ -88,12 +96,47 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
});
|
||||
},
|
||||
),
|
||||
Spacer(),
|
||||
PrintButton(
|
||||
onPressed: () async {
|
||||
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(
|
||||
'Dingens"',
|
||||
PdfStandardFont(
|
||||
PdfFontFamily.helvetica, 13,
|
||||
style: PdfFontStyle.bold),
|
||||
bounds:
|
||||
const Rect.fromLTWH(0, 25, 400, 60),
|
||||
);
|
||||
headerFooterExport.pdfDocumentTemplate.top =
|
||||
header;
|
||||
},
|
||||
cellExport: (details) {},
|
||||
fitAllColumnsInOnePage: true,
|
||||
);
|
||||
final List<int> bytes = document.saveSync();
|
||||
launchUrl(Uri.parse(
|
||||
"data:application/octet-stream;base64,${base64Encode(bytes)}"));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
theme.verticalSpacer,
|
||||
Expanded(
|
||||
child: gridWidget(
|
||||
mm,
|
||||
key,
|
||||
),
|
||||
),
|
||||
theme.verticalSpacerMax,
|
||||
|
@ -107,7 +150,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
));
|
||||
}
|
||||
|
||||
Widget gridWidget(List<MeasureMonths> mm) {
|
||||
Widget gridWidget(List<MeasureMonths> mm, GlobalKey<SfDataGridState> key) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
|
||||
return SizedBox(
|
||||
|
@ -121,13 +164,15 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
),
|
||||
),
|
||||
child: SfDataGrid(
|
||||
allowSorting: true,
|
||||
isScrollbarAlwaysShown: true,
|
||||
key: key,
|
||||
allowSorting: false,
|
||||
source:
|
||||
MeasureMonthsDatasource(areas: mm, context: context, type: type),
|
||||
columnWidthMode: ColumnWidthMode.fill,
|
||||
columns: [
|
||||
GridColumn(
|
||||
columnName: 'name',
|
||||
columnName: 'Bezeichnung',
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
|
@ -141,7 +186,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'jan',
|
||||
columnName: 'Jan',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
|
@ -156,7 +201,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'feb',
|
||||
columnName: 'Feb',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
|
@ -171,7 +216,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'mar',
|
||||
columnName: 'Mär',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
|
@ -186,7 +231,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'apr',
|
||||
columnName: 'Apr',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
|
@ -201,7 +246,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'may',
|
||||
columnName: 'Mai',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
|
@ -216,7 +261,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'jun',
|
||||
columnName: 'Jun',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
|
@ -231,7 +276,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'jul',
|
||||
columnName: 'Jul',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
|
@ -246,7 +291,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'aug',
|
||||
columnName: 'Aug',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
|
@ -261,7 +306,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'sep',
|
||||
columnName: 'Sep',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
|
@ -276,7 +321,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'oct',
|
||||
columnName: 'Okt',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
|
@ -291,7 +336,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'nov',
|
||||
columnName: 'Nov',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
|
@ -306,7 +351,7 @@ class CalendarPageState extends State<CalendarPage> {
|
|||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'dec',
|
||||
columnName: 'Dez',
|
||||
maximumWidth: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
|
|
|
@ -114,6 +114,7 @@ class DashboardAreasPageState extends State<DashboardAreasPage> {
|
|||
padding: context.breakpoint.padding,
|
||||
child: SizedBox(
|
||||
width: 1152,
|
||||
height: MediaQuery.of(context).size.height - 80,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
@ -541,6 +542,7 @@ class DashboardAreasPageState extends State<DashboardAreasPage> {
|
|||
|
||||
return SizedBox(
|
||||
width: 1152,
|
||||
height: MediaQuery.of(context).size.height - 80,
|
||||
child: SfDataGridTheme(
|
||||
data: SfDataGridThemeData(
|
||||
headerColor: theme.currentColorScheme.primaryContainer,
|
||||
|
|
|
@ -13,6 +13,7 @@ extension NormalLayoutDashboardPage on DashboardPageState {
|
|||
const Spacer(),
|
||||
SizedBox(
|
||||
width: 532,
|
||||
height: 532,
|
||||
child: mapWidget,
|
||||
),
|
||||
],
|
||||
|
|
613
lib/src/pages/dashboard/master_data/master_data_page.dart
Normal file
613
lib/src/pages/dashboard/master_data/master_data_page.dart
Normal file
|
@ -0,0 +1,613 @@
|
|||
import 'package:ambito/src/entity/_general/id_value/id_value.dart';
|
||||
import 'package:ambito/src/packages/ambito_api/base_api.dart';
|
||||
import 'package:ambito/src/widgets/buttons/edit_button.dart';
|
||||
import 'package:ambito/src/widgets/buttons/outline_button.dart';
|
||||
import 'package:ambito/src/widgets/buttons/save_buttons_group_with_cancel_action.dart';
|
||||
import 'package:ambito/src/widgets/buttons/upload_image_button.dart';
|
||||
import 'package:ambito/src/widgets/form/form_builder_fields/fbf_dropdown.dart';
|
||||
import 'package:ambito/src/widgets/form/form_builder_fields/fbf_text.dart';
|
||||
import 'package:ambito/src/widgets/form/form_builder_fields/fbf_textfield.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:screen_breakpoints/screen_breakpoints.dart';
|
||||
import 'package:toggle_switch/toggle_switch.dart';
|
||||
|
||||
import '../../../consts/consts.dart';
|
||||
import '../../../entity/business/business.dart';
|
||||
import '../../../entity/login/login.dart';
|
||||
import '../../../packages/ambito_theme/ambito_theme.dart';
|
||||
import '../../../widgets/form/form_builder_fields/fbf_password.dart';
|
||||
import '../../../widgets/page/base_page.dart';
|
||||
|
||||
class MasterDataPage extends StatefulWidget {
|
||||
const MasterDataPage(
|
||||
{super.key, required this.businessId, required this.userId});
|
||||
|
||||
final int businessId;
|
||||
final int userId;
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => MasterDataPageState();
|
||||
}
|
||||
|
||||
class MasterDataPageState extends State<MasterDataPage> {
|
||||
Login? login;
|
||||
Business? business;
|
||||
bool editMode = false;
|
||||
|
||||
final formKeyPersonal = GlobalKey<FormBuilderState>();
|
||||
final formKeyBusiness = GlobalKey<FormBuilderState>();
|
||||
|
||||
int display = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
login = isar.logins.where().idEqualTo(widget.userId).findFirst();
|
||||
|
||||
if (login != null) {
|
||||
int businessId = login!.business!.first.id!;
|
||||
business = isar.business.where().idEqualTo(businessId).findFirst();
|
||||
}
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
|
||||
return BasePage().getPage(
|
||||
context,
|
||||
SingleChildScrollView(
|
||||
child: Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: Padding(
|
||||
padding: context.breakpoint.padding,
|
||||
child: SizedBox(
|
||||
width: 1152,
|
||||
height: MediaQuery.of(context).size.height - 80,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
theme.verticalSpacer,
|
||||
Text(
|
||||
'Stammdaten',
|
||||
style: theme.titleMedium,
|
||||
),
|
||||
theme.verticalSpacer,
|
||||
Row(
|
||||
children: [
|
||||
ToggleSwitch(
|
||||
initialLabelIndex: display,
|
||||
totalSwitches: 2,
|
||||
minWidth: 200,
|
||||
borderWidth: 1,
|
||||
labels: const ['Persönliches', 'Betriebsstätte'],
|
||||
activeBgColor: [theme.currentColorScheme.secondary],
|
||||
borderColor: [theme.currentColorScheme.secondary],
|
||||
inactiveBgColor: Colors.white,
|
||||
activeFgColor: theme.currentColorScheme.onSecondary,
|
||||
customTextStyles: [theme.bodyMedium],
|
||||
onToggle: (index) {
|
||||
setState(() {
|
||||
display = index ?? 0;
|
||||
});
|
||||
},
|
||||
),
|
||||
const Spacer(),
|
||||
(editMode == false)
|
||||
? EditButton(onPressed: () {
|
||||
setState(() {
|
||||
editMode = true;
|
||||
});
|
||||
})
|
||||
: SaveButtonsGroupWithCancelAction(
|
||||
onPressedCancel: () {
|
||||
setState(() {
|
||||
editMode = false;
|
||||
});
|
||||
},
|
||||
onPressedSave: () async {
|
||||
await prefs.setBool('extended_json', false);
|
||||
if (display == 0) {
|
||||
Login changedlogin = Login()
|
||||
..id = widget.userId
|
||||
..username = login!.username
|
||||
..images = []
|
||||
..salutation = formKeyPersonal.currentState!
|
||||
.fields['salutation']!.value ??
|
||||
''
|
||||
..salutation = formKeyPersonal.currentState!
|
||||
.fields['salutation']!.value ??
|
||||
''
|
||||
..title = formKeyPersonal.currentState!
|
||||
.fields['title']!.value ??
|
||||
''
|
||||
..firstName = formKeyPersonal.currentState!
|
||||
.fields['firstName']!.value ??
|
||||
''
|
||||
..lastName = formKeyPersonal.currentState!
|
||||
.fields['lastName']!.value ??
|
||||
''
|
||||
..email = formKeyPersonal.currentState!
|
||||
.fields['email']!.value ??
|
||||
''
|
||||
..phone = formKeyPersonal.currentState!
|
||||
.fields['phone']!.value ??
|
||||
''
|
||||
..password = formKeyPersonal.currentState!
|
||||
.fields['password']!.value ??
|
||||
''
|
||||
..business = [
|
||||
IdValue()
|
||||
..id = business!.id
|
||||
..value = business!.name
|
||||
];
|
||||
|
||||
final ret = await BaseApi().patchContent(
|
||||
'login',
|
||||
login!.id,
|
||||
changedlogin.toJson(),
|
||||
true,
|
||||
);
|
||||
}
|
||||
setState(() {
|
||||
editMode = false;
|
||||
});
|
||||
await prefs.setBool('extended_json', true);
|
||||
Get.to(() => MasterDataPage(
|
||||
businessId: business!.id,
|
||||
userId: widget.userId));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
theme.verticalSpacer,
|
||||
(display == 0)
|
||||
? personalWidget(context, theme, login!, formKeyPersonal)
|
||||
: businessWidget(
|
||||
context, theme, business!, formKeyBusiness),
|
||||
theme.verticalSpacer,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget personalWidget(BuildContext context, AmbitoTheme theme, Login login,
|
||||
GlobalKey<FormBuilderState> formKey) {
|
||||
return SizedBox(
|
||||
width: 1152,
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
color: theme.currentColorScheme.tertiary,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: (editMode == false)
|
||||
? personalDisplay(context, theme, login)
|
||||
: personalEdit(context, theme, login, formKey),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget personalDisplay(BuildContext context, AmbitoTheme theme, Login login) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Persönliches',
|
||||
style: theme.headlineSmall,
|
||||
),
|
||||
theme.verticalSpacer,
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
child: login.getImage() != null
|
||||
? login.getImage()!
|
||||
: Icon(
|
||||
Icons.camera_alt_outlined,
|
||||
size: 100,
|
||||
),
|
||||
),
|
||||
theme.verticalSpacerSmall,
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 20,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
login.salutation ?? '',
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
theme.horizontalSpacerSmall,
|
||||
Text(
|
||||
login.title ?? '',
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
login.firstName ?? '',
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
theme.horizontalSpacerSmall,
|
||||
Text(
|
||||
login.lastName ?? '',
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.email_outlined),
|
||||
theme.horizontalSpacerSmall,
|
||||
Text(
|
||||
login.email ?? '',
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.phone_outlined),
|
||||
theme.horizontalSpacerSmall,
|
||||
Text(
|
||||
login.phone ?? '',
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget personalEdit(BuildContext context, AmbitoTheme theme, Login login,
|
||||
GlobalKey<FormBuilderState> formKey) {
|
||||
List<String> salutationOptions = ['Herr', 'Frau', 'Ohne Anrede'];
|
||||
|
||||
return FormBuilder(
|
||||
key: formKey,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Persönliches',
|
||||
style: theme.headlineSmall,
|
||||
),
|
||||
theme.verticalSpacer,
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
child: login.getImage() != null
|
||||
? login.getImage()!
|
||||
: Icon(
|
||||
Icons.camera_alt_outlined,
|
||||
size: 100,
|
||||
),
|
||||
),
|
||||
theme.horizontalSpacer,
|
||||
UploadImageButton(
|
||||
onPressed: () {},
|
||||
),
|
||||
],
|
||||
),
|
||||
theme.verticalSpacer,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 20,
|
||||
children: [
|
||||
FormBuilderFieldsDropDown.build(
|
||||
theme,
|
||||
'salutation',
|
||||
'Anrede',
|
||||
login.salutation,
|
||||
salutationOptions,
|
||||
),
|
||||
FormBuilderFieldsText.build(
|
||||
theme,
|
||||
'firstName',
|
||||
'Vorname',
|
||||
login.firstName,
|
||||
),
|
||||
FormBuilderFieldsText.build(
|
||||
theme,
|
||||
'email',
|
||||
'E-Mail',
|
||||
login.email,
|
||||
),
|
||||
FormBuilderFieldsPassword.build(
|
||||
theme,
|
||||
'password',
|
||||
'Passwort',
|
||||
login.password,
|
||||
),
|
||||
],
|
||||
)),
|
||||
theme.horizontalSpacer,
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 20,
|
||||
children: [
|
||||
FormBuilderFieldsText.build(
|
||||
theme,
|
||||
'title',
|
||||
'Titel',
|
||||
login.title,
|
||||
),
|
||||
FormBuilderFieldsText.build(
|
||||
theme,
|
||||
'lastName',
|
||||
'Nachname',
|
||||
login.lastName,
|
||||
),
|
||||
FormBuilderFieldsText.build(
|
||||
theme,
|
||||
'phone',
|
||||
'Telefon',
|
||||
login.phone,
|
||||
),
|
||||
WidgetOutlineButton(
|
||||
onPressed: () {},
|
||||
title: 'Passwort ändern',
|
||||
backgroundColor: theme.currentColorScheme.onPrimary,
|
||||
foregroundColor: theme.currentColorScheme.secondary,
|
||||
borderColor: theme.currentColorScheme.secondary,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget businessWidget(BuildContext context, AmbitoTheme theme,
|
||||
Business business, GlobalKey<FormBuilderState> formKey) {
|
||||
return SizedBox(
|
||||
width: 1152,
|
||||
child: Card(
|
||||
elevation: 0,
|
||||
color: theme.currentColorScheme.tertiary,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: (editMode == false)
|
||||
? businessDisplay(context, theme, business)
|
||||
: businessEdit(context, theme, business, formKey),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget businessDisplay(
|
||||
BuildContext context, AmbitoTheme theme, Business business) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Betriebsstätte',
|
||||
style: theme.headlineSmall,
|
||||
),
|
||||
theme.verticalSpacer,
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 20,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
business.name ?? '',
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(Icons.location_city_outlined),
|
||||
theme.horizontalSpacerSmall,
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 10,
|
||||
children: [
|
||||
Text(
|
||||
business.addressStreet ?? '',
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
Text(
|
||||
business.addressPostalCode ?? '',
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
Text(
|
||||
business.addressCity ?? '',
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
business.addressRegion ?? '',
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
Text(
|
||||
business.addressFederalState ?? '',
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(Icons.note_alt_outlined),
|
||||
theme.horizontalSpacerSmall,
|
||||
Expanded(
|
||||
child: Text(
|
||||
business.notice ?? '',
|
||||
style: theme.bodyMedium,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget businessEdit(BuildContext context, AmbitoTheme theme,
|
||||
Business business, GlobalKey<FormBuilderState> formKey) {
|
||||
List<String> regions = [
|
||||
'Ahr',
|
||||
'Baden',
|
||||
'Franken',
|
||||
'Hessische Bergtraße',
|
||||
'Mittelrhein',
|
||||
'Mosel',
|
||||
'Nahe',
|
||||
'Pfalz',
|
||||
'Rheingau',
|
||||
'Rheinhessen',
|
||||
'Saale-Unstrut',
|
||||
'Sachsen',
|
||||
'Württemberg',
|
||||
];
|
||||
List<String> bundeslaender = [
|
||||
'Baden-Württemberg',
|
||||
'Bayern',
|
||||
'Berlin',
|
||||
'Brandenburg',
|
||||
'Bremen',
|
||||
'Hamburg',
|
||||
'Hessen',
|
||||
'Mecklenburg-Vorpommern',
|
||||
'Niedersachsen',
|
||||
'Nordrhein-Westfalen',
|
||||
'Rheinland-Pfalz',
|
||||
'Saarland',
|
||||
'Sachsen',
|
||||
'Sachsen-Anhalt',
|
||||
'Schleswig-Holstein',
|
||||
'Thüringen'
|
||||
];
|
||||
|
||||
return FormBuilder(
|
||||
key: formKey,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Betriebsstätte',
|
||||
style: theme.headlineSmall,
|
||||
),
|
||||
theme.verticalSpacer,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 20,
|
||||
children: [
|
||||
FormBuilderFieldsText.build(
|
||||
theme,
|
||||
'name',
|
||||
'Bezeichnung',
|
||||
business.name,
|
||||
),
|
||||
FormBuilderFieldsText.build(
|
||||
theme,
|
||||
'postalCode',
|
||||
'PLZ',
|
||||
business.addressPostalCode,
|
||||
),
|
||||
FormBuilderFieldsDropDown.build(
|
||||
theme,
|
||||
'federalState',
|
||||
'Bundesland',
|
||||
business.addressFederalState,
|
||||
bundeslaender,
|
||||
),
|
||||
],
|
||||
)),
|
||||
theme.horizontalSpacer,
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 20,
|
||||
children: [
|
||||
FormBuilderFieldsText.build(
|
||||
theme,
|
||||
'addressStreet',
|
||||
'Adresse',
|
||||
business.addressStreet,
|
||||
),
|
||||
FormBuilderFieldsText.build(
|
||||
theme,
|
||||
'addressCity',
|
||||
'Stadt',
|
||||
business.addressCity,
|
||||
),
|
||||
FormBuilderFieldsDropDown.build(
|
||||
theme,
|
||||
'region',
|
||||
'Region',
|
||||
business.addressRegion,
|
||||
regions,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
theme.verticalSpacer,
|
||||
FormBuilderFieldsTextField.build(
|
||||
theme,
|
||||
'notice',
|
||||
'Notiz',
|
||||
business.notice,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
23
lib/src/widgets/buttons/cancel_button_with_action.dart
Normal file
23
lib/src/widgets/buttons/cancel_button_with_action.dart
Normal file
|
@ -0,0 +1,23 @@
|
|||
import 'package:ambito/src/extensions/extensions.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../packages/ambito_theme/ambito_theme.dart';
|
||||
import 'outline_button.dart';
|
||||
|
||||
class CancelButtonWithAction extends StatelessWidget {
|
||||
final VoidCallback onPressed;
|
||||
|
||||
const CancelButtonWithAction({super.key, required this.onPressed});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
return WidgetOutlineButton(
|
||||
onPressed: onPressed,
|
||||
title: context.translate('page.general.buttons.cancel'),
|
||||
backgroundColor: theme.currentColorScheme.onPrimary,
|
||||
foregroundColor: theme.currentColorScheme.secondary,
|
||||
borderColor: theme.currentColorScheme.secondary,
|
||||
);
|
||||
}
|
||||
}
|
23
lib/src/widgets/buttons/edit_button.dart
Normal file
23
lib/src/widgets/buttons/edit_button.dart
Normal file
|
@ -0,0 +1,23 @@
|
|||
import 'package:ambito/src/extensions/extensions.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../packages/ambito_theme/ambito_theme.dart';
|
||||
import 'outline_button.dart';
|
||||
|
||||
class EditButton extends StatelessWidget {
|
||||
final VoidCallback onPressed;
|
||||
|
||||
const EditButton({super.key, required this.onPressed});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
return WidgetOutlineButton(
|
||||
onPressed: onPressed,
|
||||
title: context.translate('page.general.buttons.edit'),
|
||||
backgroundColor: theme.currentColorScheme.secondary,
|
||||
foregroundColor: theme.currentColorScheme.onPrimary,
|
||||
borderColor: theme.currentColorScheme.secondary,
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
import 'package:ambito/src/widgets/buttons/cancel_button_with_action.dart';
|
||||
import 'package:ambito/src/widgets/buttons/save_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../packages/ambito_theme/ambito_theme.dart';
|
||||
|
||||
class SaveButtonsGroupWithCancelAction extends StatelessWidget {
|
||||
final VoidCallback onPressedCancel;
|
||||
final VoidCallback onPressedSave;
|
||||
|
||||
const SaveButtonsGroupWithCancelAction(
|
||||
{super.key, required this.onPressedCancel, required this.onPressedSave});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
|
||||
return Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
CancelButtonWithAction(onPressed: onPressedCancel),
|
||||
theme.horizontalSpacer,
|
||||
SaveButton(onPressed: onPressedSave),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
23
lib/src/widgets/buttons/upload_image_button.dart
Normal file
23
lib/src/widgets/buttons/upload_image_button.dart
Normal file
|
@ -0,0 +1,23 @@
|
|||
import 'package:ambito/src/extensions/extensions.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../packages/ambito_theme/ambito_theme.dart';
|
||||
import 'outline_button.dart';
|
||||
|
||||
class UploadImageButton extends StatelessWidget {
|
||||
final VoidCallback onPressed;
|
||||
|
||||
const UploadImageButton({super.key, required this.onPressed});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final AmbitoTheme theme = getTheme(context);
|
||||
return WidgetOutlineButton(
|
||||
onPressed: onPressed,
|
||||
title: context.translate('page.general.buttons.upload_image'),
|
||||
backgroundColor: theme.currentColorScheme.secondary,
|
||||
foregroundColor: theme.currentColorScheme.onPrimary,
|
||||
borderColor: theme.currentColorScheme.secondary,
|
||||
);
|
||||
}
|
||||
}
|
37
lib/src/widgets/form/form_builder_fields/fbf_dropdown.dart
Normal file
37
lib/src/widgets/form/form_builder_fields/fbf_dropdown.dart
Normal file
|
@ -0,0 +1,37 @@
|
|||
import 'package:ambito/src/packages/ambito_theme/ambito_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
|
||||
class FormBuilderFieldsDropDown {
|
||||
static Widget build(
|
||||
AmbitoTheme theme,
|
||||
String name,
|
||||
String label,
|
||||
String? initial,
|
||||
List<String> options,
|
||||
) {
|
||||
return FormBuilderDropdown(
|
||||
name: name,
|
||||
isDense: true,
|
||||
initialValue: initial,
|
||||
decoration: InputDecoration(
|
||||
fillColor: theme.currentColorScheme.onPrimary,
|
||||
filled: true,
|
||||
labelText: label,
|
||||
hintText: label,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
items: options
|
||||
.map(
|
||||
(option) => DropdownMenuItem(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
value: option,
|
||||
child: Text(option),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
}
|
27
lib/src/widgets/form/form_builder_fields/fbf_password.dart
Normal file
27
lib/src/widgets/form/form_builder_fields/fbf_password.dart
Normal file
|
@ -0,0 +1,27 @@
|
|||
import 'package:ambito/src/packages/ambito_theme/ambito_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
|
||||
class FormBuilderFieldsPassword {
|
||||
static Widget build(
|
||||
AmbitoTheme theme,
|
||||
String name,
|
||||
String label,
|
||||
String? initial,
|
||||
) {
|
||||
return FormBuilderTextField(
|
||||
name: name,
|
||||
obscureText: true,
|
||||
initialValue: initial,
|
||||
decoration: InputDecoration(
|
||||
fillColor: theme.currentColorScheme.onPrimary,
|
||||
labelText: label,
|
||||
filled: true,
|
||||
hintText: label,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
26
lib/src/widgets/form/form_builder_fields/fbf_text.dart
Normal file
26
lib/src/widgets/form/form_builder_fields/fbf_text.dart
Normal file
|
@ -0,0 +1,26 @@
|
|||
import 'package:ambito/src/packages/ambito_theme/ambito_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
|
||||
class FormBuilderFieldsText {
|
||||
static Widget build(
|
||||
AmbitoTheme theme,
|
||||
String name,
|
||||
String label,
|
||||
String? initial,
|
||||
) {
|
||||
return FormBuilderTextField(
|
||||
name: name,
|
||||
initialValue: initial,
|
||||
decoration: InputDecoration(
|
||||
fillColor: theme.currentColorScheme.onPrimary,
|
||||
labelText: label,
|
||||
filled: true,
|
||||
hintText: label,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
28
lib/src/widgets/form/form_builder_fields/fbf_textfield.dart
Normal file
28
lib/src/widgets/form/form_builder_fields/fbf_textfield.dart
Normal file
|
@ -0,0 +1,28 @@
|
|||
import 'package:ambito/src/packages/ambito_theme/ambito_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
|
||||
class FormBuilderFieldsTextField {
|
||||
static Widget build(
|
||||
AmbitoTheme theme,
|
||||
String name,
|
||||
String label,
|
||||
String? initial,
|
||||
) {
|
||||
return FormBuilderTextField(
|
||||
name: name,
|
||||
maxLines: 5,
|
||||
initialValue: initial,
|
||||
decoration: InputDecoration(
|
||||
fillColor: theme.currentColorScheme.onPrimary,
|
||||
labelText: label,
|
||||
filled: true,
|
||||
isDense: true,
|
||||
hintText: label,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -52,23 +52,6 @@ class MapWidgetState extends State<MapWidget> {
|
|||
width: double.infinity,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_drawPolygon = !_drawPolygon;
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.polyline_outlined,
|
||||
color: (_drawPolygon
|
||||
? theme.currentColorScheme.primary
|
||||
: theme.currentColorScheme.outline),
|
||||
))
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: GoogleMap(
|
||||
onTap: (position) {
|
||||
|
@ -114,6 +97,23 @@ class MapWidgetState extends State<MapWidget> {
|
|||
},
|
||||
),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_drawPolygon = !_drawPolygon;
|
||||
});
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.polyline_outlined,
|
||||
color: (_drawPolygon
|
||||
? theme.currentColorScheme.primary
|
||||
: theme.currentColorScheme.outline),
|
||||
))
|
||||
],
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
|
|
|
@ -1376,7 +1376,7 @@ packages:
|
|||
source: hosted
|
||||
version: "28.1.33"
|
||||
syncfusion_flutter_pdf:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: syncfusion_flutter_pdf
|
||||
sha256: bdd6b6c085fc39fbcfbf641efbf7f97d9c39b58e57accc47fca4f9db592b2294
|
||||
|
|
|
@ -72,6 +72,7 @@ dependencies:
|
|||
syncfusion_flutter_datagrid_export: ^28.1.33
|
||||
url_launcher_web: ^2.3.3
|
||||
url_launcher: ^6.3.1
|
||||
syncfusion_flutter_pdf: ^28.1.33
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue