add task based items to invoices using the mobile app #541
This commit is contained in:
parent
5edaa9f233
commit
c84f43e4cc
|
|
@ -1552,7 +1552,8 @@ class TaskItemFields {
|
|||
|
||||
abstract class InvoiceItemEntity
|
||||
implements Built<InvoiceItemEntity, InvoiceItemEntityBuilder> {
|
||||
factory InvoiceItemEntity({String? productKey, double? quantity}) {
|
||||
factory InvoiceItemEntity(
|
||||
{String? productKey, double? quantity, String? typeId}) {
|
||||
return _$InvoiceItemEntity._(
|
||||
productKey: productKey ?? '',
|
||||
notes: '',
|
||||
|
|
@ -1565,7 +1566,7 @@ abstract class InvoiceItemEntity
|
|||
taxRate2: 0,
|
||||
taxName3: '',
|
||||
taxRate3: 0,
|
||||
typeId: TYPE_STANDARD,
|
||||
typeId: typeId ?? TYPE_STANDARD,
|
||||
customValue1: '',
|
||||
customValue2: '',
|
||||
customValue3: '',
|
||||
|
|
|
|||
|
|
@ -252,7 +252,9 @@ class ItemEditDetailsState extends State<ItemEditDetails> {
|
|||
child: Column(
|
||||
children: <Widget>[
|
||||
DecoratedFormField(
|
||||
label: localization.product,
|
||||
label: widget.invoiceItem.isTask
|
||||
? localization.service
|
||||
: localization.product,
|
||||
controller: _productKeyController,
|
||||
onSavePressed: widget.entityViewModel.onSavePressed,
|
||||
keyboardType: TextInputType.text,
|
||||
|
|
@ -296,7 +298,9 @@ class ItemEditDetailsState extends State<ItemEditDetails> {
|
|||
value: _custom4Controller.text,
|
||||
),
|
||||
DecoratedFormField(
|
||||
label: localization.unitCost,
|
||||
label: widget.invoiceItem.isTask
|
||||
? localization.rate
|
||||
: localization.unitCost,
|
||||
controller: _costController,
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(decimal: true, signed: true),
|
||||
|
|
@ -304,7 +308,9 @@ class ItemEditDetailsState extends State<ItemEditDetails> {
|
|||
),
|
||||
company.enableProductQuantity
|
||||
? DecoratedFormField(
|
||||
label: localization.quantity,
|
||||
label: widget.invoiceItem.isTask
|
||||
? localization.hours
|
||||
: localization.quantity,
|
||||
controller: _qtyController,
|
||||
keyboardType: TextInputType.numberWithOptions(
|
||||
decimal: true, signed: true),
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class _InvoiceItemSelectorState extends State<InvoiceItemSelector>
|
|||
with SingleTickerProviderStateMixin {
|
||||
String? _filter;
|
||||
String? _filterClientId;
|
||||
TabController? _tabController;
|
||||
late TabController _tabController;
|
||||
final List<BaseEntity> _selected = [];
|
||||
|
||||
final _textController = TextEditingController();
|
||||
|
|
@ -57,15 +57,17 @@ class _InvoiceItemSelectorState extends State<InvoiceItemSelector>
|
|||
@override
|
||||
void dispose() {
|
||||
_textController.dispose();
|
||||
_tabController!.dispose();
|
||||
_tabController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _addBlankItem(CompanyEntity company) {
|
||||
widget.onItemsSelected!([
|
||||
InvoiceItemEntity(
|
||||
quantity:
|
||||
company.defaultQuantity || !company.enableProductQuantity ? 1 : 0)
|
||||
quantity:
|
||||
company.defaultQuantity || !company.enableProductQuantity ? 1 : 0,
|
||||
typeId: _tabController.index == 1 ? InvoiceItemEntity.TYPE_TASK : null,
|
||||
)
|
||||
]);
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue