Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
B
Byodv2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dio Maulana
Byodv2
Commits
0d8c9359
Commit
0d8c9359
authored
Sep 28, 2022
by
Dio Maulana
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perbaikan untuk multi
parent
89abd9a1
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
289 additions
and
200 deletions
+289
-200
order_bloc.dart
lib/bloc/order_bloc.dart
+1
-1
order_detail_variant.dart
lib/bloc/order_detail_variant.dart
+7
-7
note_modal_bottom_sheet.dart
lib/helper/widget/note_modal_bottom_sheet.dart
+1
-1
bottom_sheet_menu.dart
lib/ui/home/bottom_sheet_menu.dart
+4
-3
bottom_sheet_menu_new.dart
lib/ui/home/bottom_sheet_menu_new.dart
+4
-3
bottom_sheet_note.dart
lib/ui/home/bottom_sheet_note.dart
+1
-1
fav_grid_menu.dart
lib/ui/home/fav_grid_menu.dart
+6
-5
menu.dart
lib/ui/home/menu.dart
+53
-47
menu_favorite.dart
lib/ui/home/menu_favorite.dart
+21
-17
menu_list_utama.dart
lib/ui/home/menu_list_utama.dart
+61
-38
new_home2.dart
lib/ui/home/new_home2.dart
+5
-5
variant_cat.dart
lib/ui/home/variant_cat.dart
+16
-14
variant_cat_new.dart
lib/ui/home/variant_cat_new.dart
+60
-15
view_bill_new.dart
lib/ui/viewbill/view_bill_new.dart
+49
-43
No files found.
lib/bloc/order_bloc.dart
View file @
0d8c9359
...
...
@@ -6,7 +6,7 @@ import '../models/orders.dart';
class
OrdersBloc
extends
Cubit
<
List
<
Orders
>>
{
OrdersBloc
()
:
super
([]);
void
insertData
(
List
<
dynamic
>
list
,
BuildContext
context
)
{
void
insertData
(
List
<
dynamic
>
list
)
{
if
(
list
[
0
][
0
]
==
'editVariant'
)
{
// hanya ketika bottom sheet muncul untuk order yang mempunyai variant
// Orders singleOrder = list[0][1];
...
...
lib/bloc/order_detail_variant.dart
View file @
0d8c9359
...
...
@@ -29,11 +29,11 @@ class OrderDetailVariant extends Cubit<OrderDetail> {
totalItem:
totalItem
,
totalHarga:
totalHarga
,
note:
note
,
orderVariant:
orderVariant
);
orderVariant:
orderVariant
,
);
context
.
read
<
OrdersBloc
>().
insertData
([
[
'editVariant'
,
orders
,
listCurrentOrder
,
orderDetailNow
]
],
context
);
]);
emit
(
orderDetailNow
);
}
}
lib/helper/widget/note_modal_bottom_sheet.dart
View file @
0d8c9359
...
...
@@ -98,7 +98,7 @@ class NoteModalBottomSheet extends StatelessWidget {
amountParseToInt
(
menuItem
.
price
),
noteController
.
text
]
]
,
context
);
]);
}
else
if
(
from
==
fromBill
)
{
if
(
idOrderan
!=
''
)
{
Api
.
changeOrderDetail
(
...
...
lib/ui/home/bottom_sheet_menu.dart
View file @
0d8c9359
...
...
@@ -186,7 +186,8 @@ class _ShowMenuModalState extends State<ShowMenuModal> {
builder:
(
context
)
{
return
CustomizeVariant
(
orders:
list
[
indexListOrderan
],
variantCat:
widget
.
variantCat
);
variantCat:
widget
.
variantCat
,
);
},
);
}
...
...
@@ -206,7 +207,7 @@ class _ShowMenuModalState extends State<ShowMenuModal> {
?
list
[
indexListOrderan
].
note
:
''
,
]
]
,
context
);
]);
Navigator
.
pop
(
context
);
}
}
...
...
lib/ui/home/bottom_sheet_menu_new.dart
View file @
0d8c9359
...
...
@@ -152,7 +152,8 @@ class ShowMenuBottomSheet extends StatelessWidget {
builder:
(
context
)
{
return
CustomizeVariant
(
orders:
list
[
indexListOrderan
],
variantCat:
menuDetail
[
i
].
variantCat
);
variantCat:
menuDetail
[
i
].
variantCat
,
);
},
);
}
...
...
@@ -172,7 +173,7 @@ class ShowMenuBottomSheet extends StatelessWidget {
?
list
[
indexListOrderan
].
note
:
''
,
]
]
,
context
);
]);
Navigator
.
pop
(
context
);
}
}
...
...
lib/ui/home/bottom_sheet_note.dart
View file @
0d8c9359
...
...
@@ -121,7 +121,7 @@ GestureDetector noteMenu(
hargaFix
,
noteController
.
text
]
]
,
context
);
]);
}
else
if
(
callFrom
==
fromBill
)
{
await
Api
.
changeOrderDetail
(
context
,
...
...
lib/ui/home/fav_grid_menu.dart
View file @
0d8c9359
...
...
@@ -234,7 +234,7 @@ class FavGridMenu extends StatelessWidget {
amountParseToInt
(
menuFav
.
price
),
(
indexListOrderan
!=
-
1
)
?
list
[
indexListOrderan
].
note
:
''
]
]
,
context
);
]);
// setState(() {});
}
}
...
...
@@ -258,7 +258,7 @@ class FavGridMenu extends StatelessWidget {
amountParseToInt
(
menuFav
.
price
),
(
indexListOrderan
!=
-
1
)
?
list
[
indexListOrderan
].
note
:
''
,
]
]
,
context
);
]);
}
return
AnimatedSwitcher
(
...
...
@@ -313,7 +313,8 @@ class FavGridMenu extends StatelessWidget {
builder:
(
context
)
{
return
CustomizeVariant
(
orders:
list
[
indexListOrderan
],
variantCat:
menuFav
.
variantCat
);
variantCat:
menuFav
.
variantCat
,
);
},
);
}
...
...
@@ -334,7 +335,7 @@ class FavGridMenu extends StatelessWidget {
?
list
[
indexListOrderan
].
note
:
''
]
]
,
context
);
]);
// setState(() {});
}
}
...
...
lib/ui/home/menu.dart
View file @
0d8c9359
...
...
@@ -271,14 +271,16 @@ class _MenuViewState extends State<MenuView> {
builder:
(
context
)
{
return
CustomizeVariant
(
orders:
list
[
indexListOrderan
],
variantCat:
widget
.
variantCat
);
variantCat:
widget
.
variantCat
,
);
},
);
}
}
else
{
if
(
initialValue
==
0
)
{
initialValue
+=
1
;
context
.
read
<
OrdersBloc
>().
insertData
([
context
.
read
<
OrdersBloc
>().
insertData
(
[
[
widget
.
id
,
widget
.
namaMenu
,
...
...
@@ -292,7 +294,8 @@ class _MenuViewState extends State<MenuView> {
?
list
[
indexListOrderan
].
note
:
''
]
],
context
);
],
);
// setState(() {});
}
}
...
...
@@ -341,7 +344,8 @@ class _MenuViewState extends State<MenuView> {
initialValue
-=
1
;
context
.
read
<
OrdersBloc
>()
.
insertData
([
.
insertData
(
[
[
widget
.
id
,
widget
.
namaMenu
,
...
...
@@ -356,7 +360,8 @@ class _MenuViewState extends State<MenuView> {
.
note
:
''
]
],
context
);
],
);
// setState(() {});
}
},
...
...
@@ -394,9 +399,8 @@ class _MenuViewState extends State<MenuView> {
GestureDetector
(
onTap:
()
{
initialValue
+=
1
;
context
.
read
<
OrdersBloc
>()
.
insertData
([
context
.
read
<
OrdersBloc
>().
insertData
(
[
[
widget
.
id
,
widget
.
namaMenu
,
...
...
@@ -407,10 +411,12 @@ class _MenuViewState extends State<MenuView> {
orderVariants
,
widget
.
hargaFix
,
(
indexListOrderan
!=
-
1
)
?
list
[
indexListOrderan
].
note
?
list
[
indexListOrderan
]
.
note
:
''
,
]
],
context
);
],
);
// setState(() {});
},
child:
Container
(
...
...
lib/ui/home/menu_favorite.dart
View file @
0d8c9359
...
...
@@ -100,7 +100,7 @@ class _MenuFavoriteState extends State<MenuFavorite> {
initialValue
+=
1
;
context
.
read
<
OrdersBloc
>().
insertData
([
[
widget
.
id
,
widget
.
namaMenu
,
1
,
widget
.
hargaFix
,
list
]
]
,
context
);
]);
setState
(()
{});
}
},
...
...
@@ -123,7 +123,8 @@ class _MenuFavoriteState extends State<MenuFavorite> {
onTap:
()
{
if
(
initialValue
>
0
)
{
initialValue
-=
1
;
context
.
read
<
OrdersBloc
>().
insertData
([
context
.
read
<
OrdersBloc
>().
insertData
(
[
[
widget
.
id
,
widget
.
namaMenu
,
...
...
@@ -131,7 +132,8 @@ class _MenuFavoriteState extends State<MenuFavorite> {
widget
.
hargaFix
,
list
]
],
context
);
],
);
setState
(()
{});
}
},
...
...
@@ -152,7 +154,8 @@ class _MenuFavoriteState extends State<MenuFavorite> {
GestureDetector
(
onTap:
()
{
initialValue
+=
1
;
context
.
read
<
OrdersBloc
>().
insertData
([
context
.
read
<
OrdersBloc
>().
insertData
(
[
[
widget
.
id
,
widget
.
namaMenu
,
...
...
@@ -160,7 +163,8 @@ class _MenuFavoriteState extends State<MenuFavorite> {
widget
.
hargaFix
,
list
]
],
context
);
],
);
setState
(()
{});
},
child:
Icon
(
...
...
lib/ui/home/menu_list_utama.dart
View file @
0d8c9359
...
...
@@ -190,12 +190,12 @@ class MenuListUtama extends StatelessWidget {
BlocBuilder
addRemoveQuantity
(
BuildContext
context
,
FilterMenu
menuUtama
)
{
List
<
OrderVariant
>
orderVariants
=
[];
return
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>(
builder:
(
context
Orders
,
list
)
{
builder:
(
context
,
listOrders
)
{
bool
addCondition
;
// true untuk menampilkan tambah, false untuk menampilkan quantity plus minus
int
indexListOrderan
=
list
.
indexWhere
((
listOrderan
)
=>
listOrderan
.
id
==
menuUtama
.
id
);
int
initialValue
;
int
indexListOrderan
=
listOrders
.
indexWhere
((
listOrderan
)
=>
listOrderan
.
id
==
menuUtama
.
id
);
int
initialValue
=
0
;
if
(
indexListOrderan
!=
-
1
)
{
if
(
menuUtama
.
variantCat
.
isNotEmpty
)
{
addCondition
=
true
;
// kalau menu itu ada variantnya, biarin true
...
...
@@ -203,7 +203,16 @@ class MenuListUtama extends StatelessWidget {
addCondition
=
false
;
}
initialValue
=
list
[
indexListOrderan
].
totalItem
;
if
(
listOrders
[
indexListOrderan
].
orderDetail
.
isNotEmpty
)
{
for
(
int
d
=
0
;
d
<
listOrders
[
indexListOrderan
].
orderDetail
.
length
;
d
++)
{
initialValue
+=
listOrders
[
indexListOrderan
].
orderDetail
[
d
].
totalItem
;
}
}
else
{
initialValue
=
listOrders
[
indexListOrderan
].
totalItem
;
}
}
else
{
addCondition
=
true
;
initialValue
=
0
;
...
...
@@ -215,7 +224,9 @@ class MenuListUtama extends StatelessWidget {
variantButtonCount
=
'
$initialValue
Items'
;
}
final
noteController
=
TextEditingController
(
text:
(
indexListOrderan
!=
-
1
)
?
list
[
indexListOrderan
].
note
:
''
);
text:
(
indexListOrderan
!=
-
1
)
?
listOrders
[
indexListOrderan
].
note
:
''
);
void
minus
()
{
FocusScopeNode
currentFocus
=
FocusScope
.
of
(
context
);
...
...
@@ -231,13 +242,15 @@ class MenuListUtama extends StatelessWidget {
menuUtama
.
name
,
initialValue
,
amountParseToInt
(
menuUtama
.
price
),
list
,
list
Orders
,
menuUtama
.
imageUrlMedium
,
orderVariants
,
amountParseToInt
(
menuUtama
.
price
),
(
indexListOrderan
!=
-
1
)
?
list
[
indexListOrderan
].
note
:
''
(
indexListOrderan
!=
-
1
)
?
listOrders
[
indexListOrderan
].
note
:
''
]
]
,
context
);
]);
// setState(() {});
}
}
...
...
@@ -249,19 +262,23 @@ class MenuListUtama extends StatelessWidget {
currentFocus
.
unfocus
();
}
initialValue
+=
1
;
context
.
read
<
OrdersBloc
>().
insertData
([
context
.
read
<
OrdersBloc
>().
insertData
(
[
[
menuUtama
.
id
,
menuUtama
.
name
,
initialValue
,
amountParseToInt
(
menuUtama
.
price
),
list
,
listOrders
,
menuUtama
.
imageUrlMedium
,
orderVariants
,
amountParseToInt
(
menuUtama
.
price
),
(
indexListOrderan
!=
-
1
)
?
list
[
indexListOrderan
].
note
:
''
,
(
indexListOrderan
!=
-
1
)
?
listOrders
[
indexListOrderan
].
note
:
''
,
]
],
context
);
],
);
}
return
AnimatedSwitcher
(
...
...
@@ -325,6 +342,9 @@ class MenuListUtama extends StatelessWidget {
amountParseToInt
(
menuUtama
.
price
),
variantCategories:
menuUtama
.
variantCat
,
namaMenu:
menuUtama
.
name
,
idItem:
menuUtama
.
id
,
listCurrentOrder:
listOrders
,
imageUrl:
menuUtama
.
imageUrlMedium
,
),
),
);
...
...
@@ -335,29 +355,32 @@ class MenuListUtama extends StatelessWidget {
context:
context
,
builder:
(
context
)
{
return
CustomizeVariant
(
orders:
list
[
indexListOrderan
],
variantCat:
menuUtama
.
variantCat
);
orders:
listOrders
[
indexListOrderan
],
variantCat:
menuUtama
.
variantCat
,
);
},
);
}
}
else
{
if
(
initialValue
==
0
)
{
initialValue
+=
1
;
context
.
read
<
OrdersBloc
>().
insertData
([
context
.
read
<
OrdersBloc
>().
insertData
(
[
[
menuUtama
.
id
,
menuUtama
.
name
,
initialValue
,
amountParseToInt
(
menuUtama
.
price
),
list
,
listOrders
,
menuUtama
.
imageUrlMedium
,
orderVariants
,
amountParseToInt
(
menuUtama
.
price
),
(
indexListOrderan
!=
-
1
)
?
list
[
indexListOrderan
].
note
?
listOrders
[
indexListOrderan
].
note
:
''
]
],
context
);
],
);
// setState(() {});
}
}
...
...
@@ -426,7 +449,7 @@ class MenuListUtama extends StatelessWidget {
initialValue:
initialValue
,
orderVariants:
orderVariants
,
menuItem:
menuUtama
,
lisrOrders:
list
,
lisrOrders:
list
Orders
,
from:
fromMenu
,
contextFrom:
context
,
);
...
...
lib/ui/home/new_home2.dart
View file @
0d8c9359
...
...
@@ -441,7 +441,7 @@ class _NewHome2State extends State<NewHome2> {
return
BlocBuilder
<
OrdersBloc
,
List
<
Orders
>>(
builder:
(
context
Orders
,
listOrders
)
{
builder:
(
context
,
listOrders
)
{
int
totalItem
=
0
;
int
totalHarga
=
0
;
if
(
listOrders
.
isNotEmpty
)
{
...
...
@@ -907,11 +907,11 @@ class _NewHome2State extends State<NewHome2> {
int
tableMode
,
String
namaPelanggan
,
double
widthScreen
)
{
String
i
temString
;
String
totalI
temString
;
if
(
totalItem
>
1
)
{
i
temString
=
'
$totalItem
Items'
;
totalI
temString
=
'
$totalItem
Items'
;
}
else
{
i
temString
=
'
$totalItem
Item'
;
totalI
temString
=
'
$totalItem
Item'
;
}
final
nameController
=
TextEditingController
();
return
GestureDetector
(
...
...
@@ -1111,7 +1111,7 @@ class _NewHome2State extends State<NewHome2> {
alignment:
Alignment
.
centerLeft
,
child:
defaultText
(
context
,
i
temString
,
totalI
temString
,
style:
textCountItem
(),
),
),
...
...
lib/ui/home/variant_cat.dart
View file @
0d8c9359
...
...
@@ -345,7 +345,8 @@ class _VariantCatState extends State<VariantCat> {
}
}
if
(
prosesOrderan
)
{
context
.
read
<
OrdersBloc
>().
insertData
([
context
.
read
<
OrdersBloc
>().
insertData
(
[
[
widget
.
idItem
,
widget
.
namaMenu
,
...
...
@@ -359,7 +360,8 @@ class _VariantCatState extends State<VariantCat> {
?
''
:
noteCatController
.
text
]
],
context
);
],
);
Navigator
.
pop
(
context
);
}
else
{
EasyLoading
.
showToast
(
...
...
lib/ui/home/variant_cat_new.dart
View file @
0d8c9359
// ignore_for_file: sized_box_for_whitespace, must_be_immutable
import
'package:byod/helper/helper.dart'
;
import
'package:byod/helper/widget/button_modal.dart'
;
import
'package:byod/helper/widget/style.dart'
;
import
'package:byod/models/order_details.dart'
;
import
'package:byod/ui/home/variant_new.dart'
;
import
'package:byod/ui/screen_responsive.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_bloc/flutter_bloc.dart'
;
import
'package:flutter_easyloading/flutter_easyloading.dart'
;
import
'../../bloc/order_bloc.dart'
;
import
'../../bloc/order_variant_temporary.dart'
;
import
'../../bloc/order_variant_value.dart'
;
import
'../../helper/widget/plus_minus_button.dart'
;
import
'../../main.dart'
;
import
'../../models/order_variants.dart'
;
import
'../../models/orders.dart'
;
import
'../../models/variant_categories.dart'
;
class
VariantCatNew
extends
StatefulWidget
{
final
List
<
VariantCategories
>
variantCategories
;
final
int
initPrice
;
final
String
namaMenu
;
final
String
idItem
;
final
List
<
Orders
>
listCurrentOrder
;
final
String
imageUrl
;
const
VariantCatNew
({
Key
?
key
,
required
this
.
variantCategories
,
required
this
.
initPrice
,
required
this
.
namaMenu
,
required
this
.
idItem
,
required
this
.
listCurrentOrder
,
required
this
.
imageUrl
,
})
:
super
(
key:
key
);
@override
...
...
@@ -93,6 +103,8 @@ class _VariantCatNewState extends State<VariantCatNew> {
satuanPrice:
satuanPrice
,
totalPrice:
totalPrice
,
context:
context
,
orderVariants:
orderVariants
,
noteCatController:
noteCatController
,
),
isCoreLayout:
true
,
widthScreen:
MediaQuery
.
of
(
context
).
size
.
width
,
...
...
@@ -118,6 +130,8 @@ class CoreVariant extends StatelessWidget {
required
this
.
satuanPrice
,
required
this
.
totalPrice
,
required
this
.
context
,
required
this
.
orderVariants
,
required
this
.
noteCatController
,
})
:
super
(
key:
key
);
final
double
widthScreen
;
...
...
@@ -129,6 +143,8 @@ class CoreVariant extends StatelessWidget {
final
int
satuanPrice
;
final
int
totalPrice
;
final
BuildContext
context
;
final
List
<
OrderVariant
>
orderVariants
;
final
TextEditingController
noteCatController
;
void
plus
()
{
initialValue
+=
1
;
context
...
...
@@ -301,6 +317,7 @@ class CoreVariant extends StatelessWidget {
Container
(
height:
35
,
child:
TextField
(
controller:
noteCatController
,
maxLength:
maxLengthTextField
,
autofocus:
false
,
style:
const
TextStyle
(
...
...
@@ -397,21 +414,49 @@ class CoreVariant extends StatelessWidget {
const
SizedBox
(
height:
14
,
),
Container
(
height:
43
,
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
33
),
color:
buttonColor
,
),
child:
Center
(
child:
defaultText
(
context
,
'Tambahkan - Rp
${formatNumber().format(totalPrice)}
'
,
style:
addButton
(
font:
14
,
),
),
),
GestureDetector
(
onTap:
()
{
bool
prosesOrderan
=
true
;
for
(
int
y
=
0
;
y
<
widget
.
variantCategories
.
length
;
y
++)
{
if
(
widget
.
variantCategories
[
y
].
type
==
typeMandatory
)
{
int
index
=
orderVariants
.
indexWhere
((
order
)
=>
order
.
categoryId
==
widget
.
variantCategories
[
y
].
id
);
if
(
index
==
-
1
)
{
prosesOrderan
=
false
;
}
}
}
if
(
prosesOrderan
)
{
context
.
read
<
OrdersBloc
>().
insertData
(
[
[
widget
.
idItem
,
widget
.
namaMenu
,
initialValue
,
widget
.
initPrice
,
widget
.
listCurrentOrder
,
widget
.
imageUrl
,
orderVariants
,
totalPrice
,
(
noteCatController
.
text
.
isEmpty
)
?
''
:
noteCatController
.
text
]
],
);
Navigator
.
pop
(
context
);
}
else
{
EasyLoading
.
showToast
(
'Masih ada variant yang belum dipilih'
);
}
},
child:
ButtonComponent
(
buttonColor:
buttonColor
,
teksButton:
'Tambahkan - Rp
${formatNumber().format(totalPrice)}
'
),
)
],
),
...
...
lib/ui/viewbill/view_bill_new.dart
View file @
0d8c9359
...
...
@@ -512,10 +512,9 @@ class CoreBill extends StatelessWidget {
isHistory:
isHistory
,
tableStatus:
dataBill
[
0
].
tableStatus
,
),
const
SizedBox
(
height:
24
,
),
const
AddMoreOrder
(),
(
dataBill
[
0
].
tableStatus
==
tableStatusOpen
)
?
const
AddMoreOrder
()
:
const
SizedBox
(),
const
SizedBox
(
height:
24
,
),
...
...
@@ -1838,7 +1837,12 @@ class AddMoreOrder extends StatelessWidget {
color:
backgroundWhite
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
paddingLeftRight
),
// color: Colors.red,
child:
Row
(
child:
Column
(
children:
[
const
SizedBox
(
height:
24
,
),
Row
(
children:
[
Expanded
(
child:
Container
(
...
...
@@ -1886,6 +1890,8 @@ class AddMoreOrder extends StatelessWidget {
)
],
),
],
),
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment