mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-10-31 13:25:40 +00:00 
			
		
		
		
	Refactor some more forms
This commit is contained in:
		| @@ -15,6 +15,19 @@ class InvenTreeCompany extends InvenTreeModel { | |||||||
|   @override |   @override | ||||||
|   String get URL => "company/"; |   String get URL => "company/"; | ||||||
|  |  | ||||||
|  |   @override | ||||||
|  |   Map<String, dynamic> formFields() { | ||||||
|  |     return { | ||||||
|  |       "name": {}, | ||||||
|  |       "description": {}, | ||||||
|  |       "website": {}, | ||||||
|  |       "is_supplier": {}, | ||||||
|  |       "is_manufacturer": {}, | ||||||
|  |       "is_customer": {}, | ||||||
|  |       "currency": {}, | ||||||
|  |     }; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   InvenTreeCompany() : super(); |   InvenTreeCompany() : super(); | ||||||
|  |  | ||||||
|   String get image => jsondata['image'] ?? jsondata['thumbnail'] ?? InvenTreeAPI.staticImage; |   String get image => jsondata['image'] ?? jsondata['thumbnail'] ?? InvenTreeAPI.staticImage; | ||||||
|   | |||||||
| @@ -65,20 +65,9 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> { | |||||||
|  |  | ||||||
|   void editCompany(BuildContext context) async { |   void editCompany(BuildContext context) async { | ||||||
|  |  | ||||||
|     launchApiForm( |     company.editForm( | ||||||
|       context, |       context, | ||||||
|       L10().companyEdit, |       L10().companyEdit, | ||||||
|       company.url, |  | ||||||
|       { |  | ||||||
|         "name": {}, |  | ||||||
|         "description": {}, |  | ||||||
|         "website": {}, |  | ||||||
|         "is_supplier": {}, |  | ||||||
|         "is_manufacturer": {}, |  | ||||||
|         "is_customer": {}, |  | ||||||
|         "currency": {}, |  | ||||||
|       }, |  | ||||||
|       modelData: company.jsondata, |  | ||||||
|       onSuccess: (data) async { |       onSuccess: (data) async { | ||||||
|         refresh(); |         refresh(); | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -46,16 +46,14 @@ class _PartNotesState extends RefreshableState<PartNotesWidget> { | |||||||
|           icon: FaIcon(FontAwesomeIcons.edit), |           icon: FaIcon(FontAwesomeIcons.edit), | ||||||
|           tooltip: L10().edit, |           tooltip: L10().edit, | ||||||
|           onPressed: () { |           onPressed: () { | ||||||
|             launchApiForm( |             part.editForm( | ||||||
|               context, |               context, | ||||||
|               L10().editNotes, |               L10().editNotes, | ||||||
|               part.url, |               fields: { | ||||||
|               { |  | ||||||
|                 "notes": { |                 "notes": { | ||||||
|                   "multiline": true, |                   "multiline": true, | ||||||
|                 } |                 } | ||||||
|               }, |               }, | ||||||
|               modelData: part.jsondata, |  | ||||||
|               onSuccess: (data) async { |               onSuccess: (data) async { | ||||||
|                 refresh(); |                 refresh(); | ||||||
|               } |               } | ||||||
|   | |||||||
| @@ -109,17 +109,15 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> { | |||||||
|  |  | ||||||
|   void _editStockItem(BuildContext context) async { |   void _editStockItem(BuildContext context) async { | ||||||
|  |  | ||||||
|     launchApiForm( |     item.editForm( | ||||||
|       context, |       context, | ||||||
|       L10().editItem, |       L10().editItem, | ||||||
|       item.url, |       fields: { | ||||||
|       { |  | ||||||
|         "status": {}, |         "status": {}, | ||||||
|         "batch": {}, |         "batch": {}, | ||||||
|         "packaging": {}, |         "packaging": {}, | ||||||
|         "link": {}, |         "link": {}, | ||||||
|       }, |       }, | ||||||
|       modelData: item.jsondata, |  | ||||||
|       onSuccess: (data) async { |       onSuccess: (data) async { | ||||||
|         refresh(); |         refresh(); | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -46,16 +46,14 @@ class _StockNotesState extends RefreshableState<StockNotesWidget> { | |||||||
|               icon: FaIcon(FontAwesomeIcons.edit), |               icon: FaIcon(FontAwesomeIcons.edit), | ||||||
|               tooltip: L10().edit, |               tooltip: L10().edit, | ||||||
|               onPressed: () { |               onPressed: () { | ||||||
|                 launchApiForm( |                 item.editForm( | ||||||
|                   context, |                   context, | ||||||
|                   L10().editNotes, |                   L10().editNotes, | ||||||
|                     item.url, |                   fields: { | ||||||
|                     { |  | ||||||
|                     "notes": { |                     "notes": { | ||||||
|                       "multiline": true, |                       "multiline": true, | ||||||
|                     } |                     } | ||||||
|                   }, |                   }, | ||||||
|                     modelData: item.jsondata, |  | ||||||
|                   onSuccess: (data) async { |                   onSuccess: (data) async { | ||||||
|                     refresh(); |                     refresh(); | ||||||
|                   } |                   } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user