Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
meser
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
Muhammad Suryono
meser
Commits
47e30e7c
Commit
47e30e7c
authored
Aug 28, 2020
by
Alfansyah Fadlian
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://git.mdd.co.id:44195/muhammadsuryono/meser
into dashboard
parents
80c1f7f6
a0cdffa2
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
208 additions
and
166 deletions
+208
-166
Project.xml
.idea/codeStyles/Project.xml
+0
-24
misc.xml
.idea/misc.xml
+1
-1
BottomSheets.java
app/src/main/java/com/yono/messeripos/BottomSheets.java
+3
-0
CartActivity.java
app/src/main/java/com/yono/messeripos/CartActivity.java
+25
-18
FormProductActivity.java
...rc/main/java/com/yono/messeripos/FormProductActivity.java
+94
-44
HistoryActivity.java
app/src/main/java/com/yono/messeripos/HistoryActivity.java
+1
-11
MainActivity.java
app/src/main/java/com/yono/messeripos/MainActivity.java
+12
-7
PaymentActivity.java
app/src/main/java/com/yono/messeripos/PaymentActivity.java
+2
-2
CartAdapter.java
...rc/main/java/com/yono/messeripos/adapter/CartAdapter.java
+2
-2
ProductAdapter.java
...main/java/com/yono/messeripos/adapter/ProductAdapter.java
+6
-0
ProductService.java
.../java/com/yono/messeripos/api/service/ProductService.java
+4
-0
PaymentsModels.java
.../main/java/com/yono/messeripos/models/PaymentsModels.java
+13
-0
fade_out.xml
app/src/main/res/anim/fade_out.xml
+7
-0
activity_bottom_sheets.xml
app/src/main/res/layout/activity_bottom_sheets.xml
+22
-18
activity_cart.xml
app/src/main/res/layout/activity_cart.xml
+0
-25
activity_main.xml
app/src/main/res/layout/activity_main.xml
+5
-5
item_cart.xml
app/src/main/res/layout/item_cart.xml
+1
-0
item_history.xml
app/src/main/res/layout/item_history.xml
+4
-5
item_list.xml
app/src/main/res/layout/item_list.xml
+4
-1
update.xml
app/src/main/res/menu/update.xml
+2
-3
No files found.
.idea/codeStyles/Project.xml
View file @
47e30e7c
<component
name=
"ProjectCodeStyleConfiguration"
>
<code_scheme
name=
"Project"
version=
"173"
>
<DBN-PSQL>
<case-options
enabled=
"true"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
<option
name=
"FUNCTION_CASE"
value=
"lower"
/>
<option
name=
"PARAMETER_CASE"
value=
"lower"
/>
<option
name=
"DATATYPE_CASE"
value=
"lower"
/>
<option
name=
"OBJECT_CASE"
value=
"preserve"
/>
</case-options>
<formatting-settings
enabled=
"false"
/>
</DBN-PSQL>
<DBN-SQL>
<case-options
enabled=
"true"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
<option
name=
"FUNCTION_CASE"
value=
"lower"
/>
<option
name=
"PARAMETER_CASE"
value=
"lower"
/>
<option
name=
"DATATYPE_CASE"
value=
"lower"
/>
<option
name=
"OBJECT_CASE"
value=
"preserve"
/>
</case-options>
<formatting-settings
enabled=
"false"
>
<option
name=
"STATEMENT_SPACING"
value=
"one_line"
/>
<option
name=
"CLAUSE_CHOP_DOWN"
value=
"chop_down_if_statement_long"
/>
<option
name=
"ITERATION_ELEMENTS_WRAPPING"
value=
"chop_down_if_not_single"
/>
</formatting-settings>
</DBN-SQL>
<DBN-PSQL>
<case-options
enabled=
"true"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
...
...
.idea/misc.xml
View file @
47e30e7c
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_8"
project-jdk-name=
"
JDK
"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_8"
project-jdk-name=
"
1.8
"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
<component
name=
"ProjectType"
>
...
...
app/src/main/java/com/yono/messeripos/BottomSheets.java
View file @
47e30e7c
package
com
.
yono
.
messeripos
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.os.Bundle
;
...
...
@@ -43,6 +44,7 @@ public class BottomSheets extends BottomSheetDialogFragment {
String
defaultText
=
"0"
;
Client
client
=
new
Client
();
public
static
long
grossAmount
;
SharedPreferences
sharedPreferences
;
PaymentsModels
paymentsModels
;
public
BottomSheets
(
PaymentsModels
paymentsModels
)
{
...
...
@@ -71,6 +73,7 @@ public class BottomSheets extends BottomSheetDialogFragment {
btnCash
=
v
.
findViewById
(
R
.
id
.
btnCash
);
totalHarga
=
v
.
findViewById
(
R
.
id
.
totalHarga
);
utils
=
new
Utils
();
// sharedPreferences = getActivity().getSharedPreferences(MainActivity.ORDER_ID, Context.MODE_PRIVATE);
long
ga
=
paymentsModels
.
getGrossAmount
();
String
setCurrency
=
utils
.
convertPrice
(
"Rp."
,
ga
);
...
...
app/src/main/java/com/yono/messeripos/CartActivity.java
View file @
47e30e7c
...
...
@@ -12,6 +12,8 @@ import android.util.Log;
import
android.view.View
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.view.animation.Animation
;
import
android.view.animation.AnimationUtils
;
import
android.widget.Button
;
import
android.widget.ImageView
;
import
android.widget.Toast
;
...
...
@@ -72,7 +74,6 @@ public class CartActivity extends AppCompatActivity {
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_cart
);
grandToral
=
findViewById
(
R
.
id
.
tvHarga
);
btnSaveCart
=
findViewById
(
R
.
id
.
btSave
);
cartEmptyImage
=
findViewById
(
R
.
id
.
cartEmpty
);
cartEmptyText
=
findViewById
(
R
.
id
.
cartEmptyText
);
...
...
@@ -94,17 +95,17 @@ public class CartActivity extends AppCompatActivity {
Window
w
=
getWindow
();
w
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
,
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
);
sharedPreferences
=
getSharedPreferences
(
SplashScreen
.
MY_SHARED_PREFERENCES
,
Context
.
MODE_PRIVATE
);
Log
.
i
(
"Id Order on acart"
,
"onCreate: "
+
orderId
);
if
(
orderId
.
isEmpty
()){
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
editor
.
putString
(
ORDER_ID
,
"MES-ORDER"
+
orderId
);
if
(
editor
.
commit
()){
Toast
.
makeText
(
CartActivity
.
this
,
orderId
,
Toast
.
LENGTH_LONG
).
show
();
}
}
sharedPreferences
=
getSharedPreferences
(
MainActivity
.
MY_SHARED_PREFERENCES
,
Context
.
MODE_PRIVATE
);
//
Log.i("Id Order on acart", "onCreate: "+orderId);
//
if (orderId.isEmpty()){
//
SharedPreferences.Editor editor = sharedPreferences.edit();
//
editor.putString(ORDER_ID, "MES-ORDER"+orderId);
//
//
if (editor.commit()){
//
Toast.makeText(CartActivity.this, orderId, Toast.LENGTH_LONG).show();
//
}
//
}
// Toolbars
MaterialToolbar
toolbars
=
findViewById
(
R
.
id
.
cAppBar
);
...
...
@@ -142,10 +143,6 @@ public class CartActivity extends AppCompatActivity {
});
// grandToral.setText(utils.convertPrice("Rp. ", utils.grandTotal));
cartAdapter
.
setListener
(
new
CartAdapter
.
CartListener
()
{
@Override
public
void
onDelete
(
ProductCartModels
productCartModels
)
{
...
...
@@ -233,7 +230,7 @@ public class CartActivity extends AppCompatActivity {
}
else
{
new
AlertDialog
.
Builder
(
CartActivity
.
this
)
.
setCancelable
(
false
)
.
setTitle
(
"Save n
we
Order"
)
.
setTitle
(
"Save n
ew
Order"
)
.
setMessage
(
"Erorr save!"
).
show
();
}
}
...
...
@@ -242,7 +239,7 @@ public class CartActivity extends AppCompatActivity {
public
void
onFailure
(
Call
<
DataResponse
<
PaymentsModels
>>
call
,
Throwable
t
)
{
new
AlertDialog
.
Builder
(
CartActivity
.
this
)
.
setCancelable
(
false
)
.
setTitle
(
"Save n
we
Order"
)
.
setTitle
(
"Save n
ew
Order"
)
.
setMessage
(
"Add new order failed, try again!"
).
show
();
}
});
...
...
@@ -250,4 +247,14 @@ public class CartActivity extends AppCompatActivity {
}
});
}
@Override
public
void
onBackPressed
()
{
if
(
sharedPreferences
.
getString
(
ORDER_ID
,
""
)
==
null
){
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
editor
.
putString
(
ORDER_ID
,
"MES-ORDER"
+
utils
.
timeStamp
());
editor
.
commit
();
}
super
.
onBackPressed
();
}
}
\ No newline at end of file
app/src/main/java/com/yono/messeripos/FormProductActivity.java
View file @
47e30e7c
...
...
@@ -71,6 +71,7 @@ public class FormProductActivity extends AppCompatActivity {
private
Utils
utils
=
new
Utils
();
ProgressDialog
progressDialog
;
Client
client
=
new
Client
();
ProductModels
productModelsIntent
;
@Override
public
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
...
...
@@ -90,7 +91,7 @@ public class FormProductActivity extends AppCompatActivity {
w
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
,
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
);
}
ProductModels
productModelsIntent
=
getIntent
().
getParcelableExtra
(
MainActivity
.
DATA_PRODUCT
);
productModelsIntent
=
getIntent
().
getParcelableExtra
(
MainActivity
.
DATA_PRODUCT
);
MaterialToolbar
toolbars
=
findViewById
(
R
.
id
.
topAppBarForm
);
...
...
@@ -110,6 +111,10 @@ public class FormProductActivity extends AppCompatActivity {
productModels
.
setPriceProduct
(
productModelsIntent
.
getPriceProduct
());
productModels
.
setStockProduct
(
productModelsIntent
.
getStockProduct
());
productModels
.
setImageProduct
(
productModelsIntent
.
getImageProduct
());
binding
.
setProductForm
(
productModelsIntent
);
binding
.
setPhoto
(
productModelsIntent
.
getImageProduct
());
binding
.
btnAdd
.
setText
(
"UPDATE PRODUCT"
);
}
else
{
productModelsIntent
=
new
ProductModels
(
""
,
0
,
0
,
utils
.
convertImageBase64Resource
(
getResources
(),
R
.
drawable
.
logo_32
));
...
...
@@ -169,52 +174,97 @@ public class FormProductActivity extends AppCompatActivity {
productModels
.
setStockProduct
(
Integer
.
parseInt
(
binding
.
etStock
.
getText
().
toString
()));
productModels
.
setCategoryProduct
(
binding
.
listCategory
.
getSelectedIndex
());
Log
.
i
(
"save_path"
,
"saveProduct: "
+
locationPath
);
if
(
locationPath
!=
null
){
File
fileImage
=
new
File
(
locationPath
);
Log
.
i
(
"save"
,
"saveProduct: "
+
locationPath
);
if
(
fileImage
.
exists
()){
if
(
!
productModels
.
getProductName
().
isEmpty
()
||
productModels
.
getPriceProduct
()
!=
0
||
productModels
.
getStockProduct
()
!=
0
){
progressDialog
.
setCancelable
(
false
);
progressDialog
.
show
();
ProductService
productService
=
client
.
Client
(
ProductService
.
class
);
Log
.
i
(
"data_post"
,
"saveProduct: "
+
utils
.
convertGson
(
productModels
));
productService
.
postProduct
(
productModels
).
enqueue
(
new
Callback
<
DataResponse
<
ProductModels
>>()
{
@Override
public
void
onResponse
(
Call
<
DataResponse
<
ProductModels
>>
call
,
Response
<
DataResponse
<
ProductModels
>>
response
)
{
Log
.
i
(
"Success Post"
,
"onResponse: "
+
utils
.
convertGson
(
response
.
body
()));
if
(
response
.
body
()
!=
null
){
new
AlertDialog
.
Builder
(
FormProductActivity
.
this
)
.
setCancelable
(
false
)
.
setTitle
(
"Add New Product"
)
.
setMessage
(
"Add new product success"
)
.
setPositiveButton
(
"Oke"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
startActivity
(
new
Intent
(
FormProductActivity
.
this
,
MainActivity
.
class
));
finish
();
}
}).
show
();
}
else
{
new
AlertDialog
.
Builder
(
FormProductActivity
.
this
)
.
setTitle
(
"Add New Product"
)
.
setMessage
(
"Add new product failed, try again!"
).
show
();
}
progressDialog
.
dismiss
();
}
@Override
public
void
onFailure
(
Call
<
DataResponse
<
ProductModels
>>
call
,
Throwable
t
)
{
progressDialog
.
dismiss
();
Log
.
e
(
"Error input"
,
"onFailure: "
,
t
);
if
(
isUpdate
){
Log
.
i
(
"update_path"
,
"saveProduct: "
+
locationPath
);
if
(
!
productModels
.
getProductName
().
isEmpty
()
||
productModels
.
getPriceProduct
()
!=
0
||
productModels
.
getStockProduct
()
!=
0
){
progressDialog
.
setCancelable
(
false
);
progressDialog
.
show
();
ProductService
productService
=
client
.
Client
(
ProductService
.
class
);
Log
.
i
(
"data_post"
,
"saveProduct: "
+
utils
.
convertGson
(
productModels
));
productService
.
updateProduct
(
productModels
,
productModelsIntent
.
getIdProduct
()).
enqueue
(
new
Callback
<
DataResponse
<
ProductModels
>>()
{
@Override
public
void
onResponse
(
Call
<
DataResponse
<
ProductModels
>>
call
,
Response
<
DataResponse
<
ProductModels
>>
response
)
{
Log
.
i
(
"Success Post"
,
"onResponse: "
+
utils
.
convertGson
(
response
.
body
()));
if
(
response
.
body
()
!=
null
){
new
AlertDialog
.
Builder
(
FormProductActivity
.
this
)
.
setCancelable
(
false
)
.
setTitle
(
"Update Product"
)
.
setMessage
(
"Update product success"
)
.
setPositiveButton
(
"Oke"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
startActivity
(
new
Intent
(
FormProductActivity
.
this
,
MainActivity
.
class
));
finish
();
}
}).
show
();
}
else
{
new
AlertDialog
.
Builder
(
FormProductActivity
.
this
)
.
setTitle
(
"Update Product"
)
.
setMessage
(
"Update product failed, try again!"
).
show
();
}
}
);
}
progressDialog
.
dismiss
(
);
}
@Override
public
void
onFailure
(
Call
<
DataResponse
<
ProductModels
>>
call
,
Throwable
t
)
{
progressDialog
.
dismiss
();
Log
.
e
(
"Error input"
,
"onFailure: "
,
t
);
}
});
}
}
else
{
Log
.
i
(
"save_path"
,
"saveProduct: "
+
locationPath
);
if
(
locationPath
!=
null
){
File
fileImage
=
new
File
(
locationPath
);
Log
.
i
(
"save"
,
"saveProduct: "
+
locationPath
);
if
(
fileImage
.
exists
()){
if
(
!
productModels
.
getProductName
().
isEmpty
()
||
productModels
.
getPriceProduct
()
!=
0
||
productModels
.
getStockProduct
()
!=
0
){
progressDialog
.
setCancelable
(
false
);
progressDialog
.
show
();
ProductService
productService
=
client
.
Client
(
ProductService
.
class
);
Log
.
i
(
"data_post"
,
"saveProduct: "
+
utils
.
convertGson
(
productModels
));
productService
.
postProduct
(
productModels
).
enqueue
(
new
Callback
<
DataResponse
<
ProductModels
>>()
{
@Override
public
void
onResponse
(
Call
<
DataResponse
<
ProductModels
>>
call
,
Response
<
DataResponse
<
ProductModels
>>
response
)
{
Log
.
i
(
"Success Post"
,
"onResponse: "
+
utils
.
convertGson
(
response
.
body
()));
if
(
response
.
body
()
!=
null
){
new
AlertDialog
.
Builder
(
FormProductActivity
.
this
)
.
setCancelable
(
false
)
.
setTitle
(
"Add New Product"
)
.
setMessage
(
"Add new product success"
)
.
setPositiveButton
(
"Oke"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
startActivity
(
new
Intent
(
FormProductActivity
.
this
,
MainActivity
.
class
));
finish
();
}
}).
show
();
}
else
{
new
AlertDialog
.
Builder
(
FormProductActivity
.
this
)
.
setTitle
(
"Add New Product"
)
.
setMessage
(
"Add new product failed, try again!"
).
show
();
}
progressDialog
.
dismiss
();
}
@Override
public
void
onFailure
(
Call
<
DataResponse
<
ProductModels
>>
call
,
Throwable
t
)
{
progressDialog
.
dismiss
();
Log
.
e
(
"Error input"
,
"onFailure: "
,
t
);
}
});
}
}
}
}
}
...
...
app/src/main/java/com/yono/messeripos/HistoryActivity.java
View file @
47e30e7c
...
...
@@ -66,21 +66,11 @@ public class HistoryActivity extends AppCompatActivity {
new
Observer
<
DataResponse
<
List
<
PaymentsModels
>>>()
{
@Override
public
void
onChanged
(
DataResponse
<
List
<
PaymentsModels
>>
listDataResponse
)
{
Log
.
i
(
"Hasil_transaksi"
,
"onChanged: "
+
utils
.
convertGson
(
listDataResponse
.
getData
()));
ArrayList
<
PaymentsModels
>
newData
=
new
ArrayList
<>();
newData
.
addAll
(
listDataResponse
.
getData
());
transactionAdapter
.
setTransactionAdapter
(
HistoryActivity
.
this
,
newData
);
/*
* SET RECYCLE VIEW MANAGER DISINI
* GUNAKAN LINEARLAYOUT MANAGER VERTICAL UNTUK SETTING LAYOUT MANAGER
*
* SET RECYCLEVIEW ADAPTER DENGAN TRANSACTION ADAPTER
*
* UNTUK BISA CLICK CARD VIEW NYA
* PANGGIL ADAPTERNYA KEMUDIAN .setList.....
* SILAHKAN PINDAH KE ACTIVITY SELANJUTNYA PADA ON.....
* */
loading
.
setVisibility
(
View
.
GONE
);
recyclerView
.
setLayoutManager
(
new
LinearLayoutManager
(
HistoryActivity
.
this
,
RecyclerView
.
VERTICAL
,
false
));
...
...
app/src/main/java/com/yono/messeripos/MainActivity.java
View file @
47e30e7c
...
...
@@ -31,6 +31,7 @@ import androidx.recyclerview.widget.GridLayoutManager;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
com.google.android.material.appbar.MaterialToolbar
;
import
com.google.android.material.button.MaterialButton
;
import
com.google.android.material.snackbar.Snackbar
;
import
com.google.gson.Gson
;
import
com.yono.messeripos.adapter.CategoryAdapter
;
...
...
@@ -72,8 +73,9 @@ public class MainActivity extends AppCompatActivity {
Client
client
=
new
Client
();
public
static
ArrayList
<
ProductModels
>
productModelsArrayList
=
new
ArrayList
<>();
public
static
final
String
DATA_PRODUCT
=
"DATA_PRODUCT"
;
public
static
final
String
MY_SHARED_PREFERENCES
=
"my_shared_preferences"
;
ProgressDialog
progressDialog
;
public
static
Boolean
cartOpen
;
MaterialButton
btnAddCart
;
@SuppressLint
(
"LongLogTag"
)
@Override
...
...
@@ -84,13 +86,14 @@ public class MainActivity extends AppCompatActivity {
ProductAdapter
adapter
=
new
ProductAdapter
();
binding
.
rvProduct
.
setAdapter
(
adapter
);
// binding.appBarUpdate.setVisibility(View.GONE);
showLoading
(
true
);
btnAddCart
=
findViewById
(
R
.
id
.
materialBtnAddCart
);
categoryAdapter
=
new
CategoryAdapter
();
productAdapter
=
new
ProductAdapter
();
mainViewModelsCart
=
new
ViewModelProvider
(
MainActivity
.
this
).
get
(
MainViewModelsCart
.
class
);
sharedPreferences
=
getSharedPreferences
(
SplashScreen
.
MY_SHARED_PREFERENCES
,
Context
.
MODE_PRIVATE
);
sharedPreferences
=
getSharedPreferences
(
MY_SHARED_PREFERENCES
,
Context
.
MODE_PRIVATE
);
checkout
=
sharedPreferences
.
getBoolean
(
CHECKOUT
,
false
);
orderId
=
sharedPreferences
.
getString
(
ORDER_ID
,
""
);
progressDialog
=
new
ProgressDialog
(
MainActivity
.
this
);
...
...
@@ -105,7 +108,7 @@ public class MainActivity extends AppCompatActivity {
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
editor
.
putString
(
ORDER_ID
,
"MES-ORDER"
+
utils
.
timeStamp
());
if
(
editor
.
commit
()){
Toast
.
makeText
(
MainActivity
.
this
,
orderId
,
Toast
.
LENGTH_LONG
).
show
();
//
Toast.makeText(MainActivity.this, orderId, Toast.LENGTH_LONG).show();
}
}
...
...
@@ -223,11 +226,9 @@ public class MainActivity extends AppCompatActivity {
}
private
void
mainViewModelsGetProduct
()
{
progressDialog
.
show
();
mainViewModels
.
getProduct
().
observe
(
this
,
new
Observer
<
DataResponse
<
List
<
ProductModels
<
CategoryModels
>>>>()
{
@Override
public
void
onChanged
(
DataResponse
<
List
<
ProductModels
<
CategoryModels
>>>
listDataResponse
)
{
progressDialog
.
dismiss
();
if
(
listDataResponse
.
getData
().
size
()
!=
0
)
{
List
<
ProductModels
<
CategoryModels
>>
productModels
=
listDataResponse
.
getData
();
productModelsArrayList
.
clear
();
...
...
@@ -262,10 +263,12 @@ public class MainActivity extends AppCompatActivity {
@Override
public
void
onDelete
(
ProductModels
product
,
int
position
)
{
progressDialog
.
show
();
ProductService
productService
=
client
.
Client
(
ProductService
.
class
);
productService
.
deleteProducts
(
product
.
getIdProduct
()).
enqueue
(
new
Callback
<
DataResponse
<
ProductModels
>>()
{
@Override
public
void
onResponse
(
Call
<
DataResponse
<
ProductModels
>>
call
,
Response
<
DataResponse
<
ProductModels
>>
response
)
{
progressDialog
.
dismiss
();
productModelsArrayList
.
remove
(
position
);
binding
.
rvProduct
.
removeViewAt
(
position
);
productAdapter
.
notifyItemRemoved
(
position
);
...
...
@@ -413,13 +416,15 @@ public class MainActivity extends AppCompatActivity {
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
getMenuInflater
().
inflate
(
R
.
menu
.
update
,
menu
);
return
true
;
}
@Override
public
boolean
onOptionsItemSelected
(
@NonNull
MenuItem
item
)
{
int
id
=
item
.
getItemId
();
if
(
id
==
R
.
id
.
menu_cart
){
if
(
id
==
R
.
id
.
menu_update
){
status_update
=
false
;
startActivity
(
new
Intent
(
MainActivity
.
this
,
MainActivity
.
class
));
finish
();
}
...
...
app/src/main/java/com/yono/messeripos/PaymentActivity.java
View file @
47e30e7c
...
...
@@ -77,7 +77,7 @@ public class PaymentActivity extends AppCompatActivity {
w
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
,
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
);
}
sharedPreferences
=
getSharedPreferences
(
SplashScreen
.
MY_SHARED_PREFERENCES
,
Context
.
MODE_PRIVATE
);
sharedPreferences
=
getSharedPreferences
(
MainActivity
.
MY_SHARED_PREFERENCES
,
Context
.
MODE_PRIVATE
);
paymentsModels
=
new
PaymentsModels
();
checkoutAdapter
=
new
CheckoutAdapter
();
...
...
@@ -91,7 +91,7 @@ public class PaymentActivity extends AppCompatActivity {
setSupportActionBar
(
toolbars
);
DividerItemDecoration
dividerItemDecoration
=
new
DividerItemDecoration
(
this
,
DividerItemDecoration
.
VERTICAL
);
mainViewModels
=
new
ViewModelProvider
(
PaymentActivity
.
this
).
get
(
MainViewModelsCart
.
class
);
mainViewModels
.
getCart
Product
(
).
observe
(
this
,
new
Observer
<
List
<
ProductCartModels
>>()
{
mainViewModels
.
getCart
ById
(
orderId
).
observe
(
this
,
new
Observer
<
List
<
ProductCartModels
>>()
{
@Override
public
void
onChanged
(
List
<
ProductCartModels
>
productCartModels
)
{
String
js
=
new
Gson
().
toJson
(
productCartModels
);
...
...
app/src/main/java/com/yono/messeripos/adapter/CartAdapter.java
View file @
47e30e7c
...
...
@@ -98,9 +98,9 @@ public class CartAdapter extends RecyclerView.Adapter<CartAdapter.MyViewHolder>
* */
subtotal
=
cartModels
.
getPrice_orders
()
*
cartModels
.
getQuantity_orders
();
utils
.
grandTotal
=
utils
.
grandTotal
+
(
cartModels
.
getPrice_orders
()
*
cartModels
.
getQuantity_orders
());
Log
.
d
(
"TAG"
,
"bindData: "
+
binding
.
getSubTotal
());
utils
.
grandTotal
=
(
cartModels
.
getPrice_orders
()
*
cartModels
.
getQuantity_orders
());
Log
.
i
(
"Grand Total"
,
"bindData: "
+
utils
.
grandTotal
);
CartActivity
.
grandToral
.
setText
(
utils
.
convertPrice
(
"Rp. "
,
utils
.
grandTotal
));
binding
.
setCarts
(
cartModels
);
binding
.
setPrice
(
utils
.
convertPrice
(
"Rp. "
,
cartModels
.
getPrice_orders
()));
...
...
app/src/main/java/com/yono/messeripos/adapter/ProductAdapter.java
View file @
47e30e7c
...
...
@@ -146,6 +146,12 @@ public class ProductAdapter extends RecyclerView.Adapter<ProductAdapter.MyViewHo
binding
.
setStatus
(
statusProduct
);
}
if
(
products
.
getStockProduct
()
<=
1
){
binding
.
materialBtnAddCart
.
setEnabled
(
false
);
}
else
{
binding
.
materialBtnAddCart
.
setEnabled
(
true
);
}
binding
.
materialBtnAddCart
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
...
...
app/src/main/java/com/yono/messeripos/api/service/ProductService.java
View file @
47e30e7c
...
...
@@ -16,6 +16,7 @@ import retrofit2.http.DELETE;
import
retrofit2.http.GET
;
import
retrofit2.http.Multipart
;
import
retrofit2.http.POST
;
import
retrofit2.http.PUT
;
import
retrofit2.http.Part
;
import
retrofit2.http.Path
;
...
...
@@ -30,6 +31,9 @@ public interface ProductService {
@POST
(
ApiHelper
.
VERSI_API_1
+
"product"
)
Call
<
DataResponse
<
ProductModels
>>
postProduct
(
@Body
ProductModels
productModels
);
@PUT
(
ApiHelper
.
VERSI_API_1
+
"product/{id}"
)
Call
<
DataResponse
<
ProductModels
>>
updateProduct
(
@Body
ProductModels
productModels
,
@Path
(
"id"
)
int
id
);
@Multipart
@POST
(
ApiHelper
.
VERSI_API_1
+
"product"
)
Call
<
DataResponse
<
ProductModels
>>
postProducts
(
...
...
app/src/main/java/com/yono/messeripos/models/PaymentsModels.java
View file @
47e30e7c
...
...
@@ -30,6 +30,10 @@ public class PaymentsModels {
@SerializedName
(
"updated_at"
)
private
String
updatedAt
;
@SerializedName
(
"va_number"
)
private
String
nomorPembayaran
;
public
PaymentsModels
()
{
}
...
...
@@ -96,4 +100,13 @@ public class PaymentsModels {
this
.
updatedAt
=
updatedAt
;
}
public
String
getNomorPembayaran
()
{
return
nomorPembayaran
;
}
public
void
setNomorPembayaran
(
String
nomorPembayaran
)
{
this
.
nomorPembayaran
=
nomorPembayaran
;
}
}
app/src/main/res/anim/fade_out.xml
0 → 100644
View file @
47e30e7c
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<translate
android:fromYDelta=
"0%"
android:toYDelta=
"100%"
android:duration=
"@android:integer/config_mediumAnimTime"
/>
</set>
\ No newline at end of file
app/src/main/res/layout/activity_bottom_sheets.xml
View file @
47e30e7c
...
...
@@ -16,6 +16,16 @@
android:textFontWeight=
"600"
android:layout_alignParentStart=
"true"
/>
<TextView
android:id=
"@+id/changeText"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Change"
android:textSize=
"20sp"
android:textFontWeight=
"600"
android:layout_below=
"@id/totalText"
android:layout_alignParentStart=
"true"
/>
<TextView
android:id=
"@+id/totalHarga"
android:layout_width=
"wrap_content"
...
...
@@ -25,13 +35,23 @@
android:textFontWeight=
"600"
android:layout_alignParentEnd=
"true"
/>
<TextView
android:id=
"@+id/hargaChange"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Rp. 600.000"
android:textSize=
"20sp"
android:textFontWeight=
"600"
android:layout_below=
"@id/totalHarga"
android:layout_alignParentEnd=
"true"
/>
<TextView
android:id=
"@+id/label"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Bayar"
android:textFontWeight=
"600"
android:layout_below=
"@id/
totalHarga
"
/>
android:layout_below=
"@id/
changeText
"
/>
<EditText
android:id=
"@+id/etBayar"
...
...
@@ -42,29 +62,13 @@
android:inputType=
"number"
android:imeOptions=
"actionDone"
/>
<TextView
android:id=
"@+id/textChange"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Change"
android:layout_below=
"@id/etBayar"
android:layout_alignParentEnd=
"true"
/>
<TextView
android:id=
"@+id/hargaChange"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Rp.20.000"
android:layout_below=
"@id/textChange"
android:layout_alignParentEnd=
"true"
/>
<Button
android:id=
"@+id/btnCash"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/hint_pay"
android:hint=
"Insert Money"
android:layout_below=
"@id/
hargaChange
"
/>
android:layout_below=
"@id/
etBayar
"
/>
</RelativeLayout>
...
...
app/src/main/res/layout/activity_cart.xml
View file @
47e30e7c
...
...
@@ -54,31 +54,6 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvCheckout"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"15dp"
android:fontFamily=
"@font/roboto"
android:text=
"Total"
android:textColor=
"#000"
android:textFontWeight=
"600"
android:textSize=
"24sp"
app:layout_constraintBottom_toTopOf=
"@+id/btSave"
app:layout_constraintStart_toStartOf=
"parent"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvHarga"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Rp. 600"
android:textSize=
"24sp"
android:textColor=
"#000"
android:textFontWeight=
"600"
android:layout_marginEnd=
"15dp"
app:layout_constraintBottom_toTopOf=
"@id/btCheckout"
app:layout_constraintEnd_toEndOf=
"parent"
/>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/btSave"
android:layout_width=
"0dp"
...
...
app/src/main/res/layout/activity_main.xml
View file @
47e30e7c
...
...
@@ -55,17 +55,17 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
tools:listitem=
"@layout/item_category"
android:layout_below=
"@id/topBar"
android:layout_above=
"@id/imgEmpty"
/>
android:layout_below=
"@id/topBar"
/>
<ImageView
android:id=
"@+id/imgEmpty"
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
0dp
"
android:visibility=
"gone"
android:src=
"@drawable/no"
android:layout_below=
"@id/topBar"
android:foregroundGravity=
"center"
/>
android:layout_alignParentBottom=
"true"
android:layout_below=
"@id/rvCategory"
/>
<ProgressBar
android:id=
"@+id/pbLoading"
...
...
app/src/main/res/layout/item_cart.xml
View file @
47e30e7c
...
...
@@ -29,6 +29,7 @@
android:layout_margin=
"12dp"
>
<com.google.android.material.card.MaterialCardView
android:id=
"@+id/cvCart"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
tools:ignore=
"MissingConstraints"
>
...
...
app/src/main/res/layout/item_history.xml
View file @
47e30e7c
...
...
@@ -79,13 +79,12 @@
android:id=
"@+id/tvVA"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"#000000"
android:textStyle=
"bold"
android:text=
"@{}"
android:textColor=
"#fff"
android:text=
"@{transaction.nomorPembayaran}"
android:textAllCaps=
"true"
android:textColor=
"#000"
android:textStyle=
"bold"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
tools:layout_editor_absoluteY=
"33dp"
tools:text=
"@tools:sample/first_names"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
app/src/main/res/layout/item_list.xml
View file @
47e30e7c
...
...
@@ -23,7 +23,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"
300dp
"
android:layout_height=
"
wrap_content
"
android:layout_marginHorizontal=
"5dp"
android:layout_marginVertical=
"10dp"
>
...
...
@@ -52,6 +52,7 @@
android:id=
"@+id/btnDelete"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_margin=
"10dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
android:src=
"@drawable/ic_baseline_delete_24"
/>
...
...
@@ -60,6 +61,7 @@
android:id=
"@+id/btnEdit"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:layout_margin=
"10dp"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
android:src=
"@drawable/ic_baseline_edit_24"
/>
...
...
@@ -121,6 +123,7 @@
android:layout_marginStart=
"10dp"
android:layout_marginEnd=
"10dp"
android:text=
"Add To Cart"
app:layout_constraintTop_toBottomOf=
"@id/price"
app:layout_constraintBottom_toBottomOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
app/src/main/res/menu/update.xml
View file @
47e30e7c
...
...
@@ -2,9 +2,8 @@
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<item
android:id=
"@+id/menu_
cart
"
android:id=
"@+id/menu_
update
"
app:showAsAction=
"always"
android:icon=
"@drawable/ic_baseline_shopping_cart_24"
android:actionLayout=
"@layout/custome_action_badge"
android:icon=
"@drawable/ic_baseline_done_24"
android:title=
"Cart"
/>
</menu>
\ No newline at end of file
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