mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
Update CompanyDetail page
This commit is contained in:
parent
0fdc56d299
commit
e5f09acf3f
2
lib/l10n
2
lib/l10n
@ -1 +1 @@
|
||||
Subproject commit f53df5968c451c511152d931ef32290644e21747
|
||||
Subproject commit 15a67a8aa7ec5af876b0467152de13baff8f7806
|
@ -1,5 +1,7 @@
|
||||
|
||||
import 'package:inventree/api.dart';
|
||||
import 'package:inventree/api_form.dart';
|
||||
import 'package:inventree/app_colors.dart';
|
||||
import 'package:inventree/inventree/company.dart';
|
||||
import 'package:inventree/widget/refreshable_state.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@ -21,30 +23,64 @@ class CompanyDetailWidget extends StatefulWidget {
|
||||
|
||||
class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
|
||||
|
||||
final InvenTreeCompany company;
|
||||
_CompanyDetailState(this.company);
|
||||
|
||||
final _editCompanyKey = GlobalKey<FormState>();
|
||||
final InvenTreeCompany company;
|
||||
|
||||
@override
|
||||
String getAppBarTitle(BuildContext context) => L10().company;
|
||||
|
||||
@override
|
||||
List<Widget> getAppBarActions(BuildContext context) {
|
||||
|
||||
List<Widget> actions = [];
|
||||
|
||||
actions.add(
|
||||
IconButton(
|
||||
icon: FaIcon(FontAwesomeIcons.globe),
|
||||
onPressed: () async {
|
||||
company.goToInvenTreePage();
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
actions.add(
|
||||
IconButton(
|
||||
icon: FaIcon(FontAwesomeIcons.edit),
|
||||
tooltip: L10().edit,
|
||||
onPressed: () {
|
||||
editCompany(context);
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
return actions;
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> request() async {
|
||||
await company.reload();
|
||||
}
|
||||
|
||||
_CompanyDetailState(this.company) {
|
||||
// TODO
|
||||
}
|
||||
void editCompany(BuildContext context) async {
|
||||
|
||||
void editCompanyDialog() {
|
||||
|
||||
// Values which can be edited
|
||||
var _name;
|
||||
var _description;
|
||||
var _website;
|
||||
|
||||
// TODO - API form
|
||||
launchApiForm(
|
||||
context,
|
||||
L10().companyEdit,
|
||||
company.url,
|
||||
{
|
||||
"name": {},
|
||||
"description": {},
|
||||
"website": {},
|
||||
"is_supplier": {},
|
||||
"is_manufacturer": {},
|
||||
"is_customer": {},
|
||||
"currency": {},
|
||||
},
|
||||
modelData: company.jsondata,
|
||||
onSuccess: refresh
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _companyTiles() {
|
||||
@ -57,11 +93,7 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
|
||||
child: ListTile(
|
||||
title: Text("${company.name}"),
|
||||
subtitle: Text("${company.description}"),
|
||||
leading: InvenTreeAPI().getImage(company.image),
|
||||
trailing: IconButton(
|
||||
icon: FaIcon(FontAwesomeIcons.edit),
|
||||
onPressed: editCompanyDialog,
|
||||
),
|
||||
leading: InvenTreeAPI().getImage(company.image, width: 40, height: 40),
|
||||
),
|
||||
));
|
||||
|
||||
@ -105,9 +137,9 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
|
||||
if (company.link.isNotEmpty) {
|
||||
tiles.add(ListTile(
|
||||
title: Text("${company.link}"),
|
||||
leading: FaIcon(FontAwesomeIcons.link),
|
||||
leading: FaIcon(FontAwesomeIcons.link, color: COLOR_CLICK),
|
||||
onTap: () {
|
||||
// TODO - Open external link
|
||||
company.openLink();
|
||||
},
|
||||
));
|
||||
|
||||
@ -125,6 +157,10 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
|
||||
tiles.add(Divider());
|
||||
}
|
||||
|
||||
if (company.isManufacturer) {
|
||||
// TODO - Add list of manufacturer parts
|
||||
}
|
||||
|
||||
if (company.isCustomer) {
|
||||
|
||||
// TODO - Add list of sales orders
|
||||
|
Loading…
x
Reference in New Issue
Block a user