Adds the Flutter inventory app source, cleaned up for a shared repo: generic package name, no hardcoded ERP endpoints (moved to gitignored local config), no dead auth code, no debug logging of session data.
111 lines
2.5 KiB
Dart
111 lines
2.5 KiB
Dart
import 'package:inventory_app/utils.dart';
|
|
|
|
class Depot {
|
|
int? id;
|
|
String? name;
|
|
MetaFile? picture;
|
|
|
|
Depot({this.id, this.name, this.picture});
|
|
|
|
Depot.fromJson(Map<dynamic, dynamic> json) {
|
|
id = json['id'];
|
|
name = json['name'];
|
|
picture =
|
|
json['picture'] != null ? MetaFile.fromJson(json['picture']) : null;
|
|
}
|
|
|
|
Map<dynamic, dynamic> toJson() {
|
|
final Map<dynamic, dynamic> data = {};
|
|
data['id'] = this.id;
|
|
data['name'] = this.name;
|
|
if (picture != null) {
|
|
data['picture'] = picture!.toJson();
|
|
}
|
|
return data;
|
|
}
|
|
|
|
/// 👇 Get full image URL (you can customize baseUrl to be from `AxelorClient.baseUrl`)
|
|
String? get imageUrl {
|
|
if (picture?.id != null) {
|
|
return '${Utils.url}/ws/rest/com.axelor.meta.db.MetaFile/${picture!.id}/content/download';
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is Depot && runtimeType == other.runtimeType && id == other.id;
|
|
|
|
@override
|
|
int get hashCode => id.hashCode;
|
|
}
|
|
|
|
class Company {
|
|
String? code;
|
|
String? name;
|
|
int? id;
|
|
int? version;
|
|
|
|
Company({this.code, this.name, this.id, this.version});
|
|
|
|
Company.fromJson(Map<String, dynamic> json) {
|
|
code = json['code'];
|
|
name = json['name'];
|
|
id = json['id'];
|
|
version = json['$version'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['code'] = this.code;
|
|
data['name'] = this.name;
|
|
data['id'] = this.id;
|
|
data['$version'] = this.version;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class UpdatedBy {
|
|
String? code;
|
|
String? fullName;
|
|
int? id;
|
|
int? version;
|
|
|
|
UpdatedBy({this.code, this.fullName, this.id, this.version});
|
|
|
|
UpdatedBy.fromJson(Map<String, dynamic> json) {
|
|
code = json['code'];
|
|
fullName = json['fullName'];
|
|
id = json['id'];
|
|
version = json['$version'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['code'] = this.code;
|
|
data['fullName'] = this.fullName;
|
|
data['id'] = this.id;
|
|
data['$version'] = this.version;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class MetaFile {
|
|
String? fileName;
|
|
int? id;
|
|
int? version;
|
|
|
|
MetaFile({this.fileName, this.id, this.version});
|
|
|
|
MetaFile.fromJson(Map<String, dynamic> json) {
|
|
fileName = json['fileName'];
|
|
id = json['id'];
|
|
version = json['$version'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
return {'fileName': fileName, 'id': id, '\$version': version};
|
|
}
|
|
}
|