Commit a8b609c4 authored by Alfansyah Fadlian's avatar Alfansyah Fadlian

Merge branch 'dev' of https://git.mdd.co.id:44195/muhammadsuryono/meser into dashboard

parents b1efe15a a45d5419
...@@ -63,6 +63,7 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -63,6 +63,7 @@ public class FormProductActivity extends AppCompatActivity {
private boolean isUpdate = false; private boolean isUpdate = false;
String locationPath = null; String locationPath = null;
int idCategorySelected = 0; int idCategorySelected = 0;
public int id = 0;
private String[] permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, private String[] permissions = new String[]{Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE}; Manifest.permission.WRITE_EXTERNAL_STORAGE};
...@@ -297,7 +298,22 @@ public class FormProductActivity extends AppCompatActivity { ...@@ -297,7 +298,22 @@ public class FormProductActivity extends AppCompatActivity {
} }
private int getCategory(String s) { private int getCategory(String s) {
return 1;
Log.i("CATEGORY", "getCategory: "+s);
CategoryServise categoryServise = client.Client(CategoryServise.class);
categoryServise.getCategoryByName(s).enqueue(new Callback<DataResponse<List<CategoryModels>>>() {
@Override
public void onResponse(Call<DataResponse<List<CategoryModels>>> call, Response<DataResponse<List<CategoryModels>>> response) {
Log.i("CHDJHD", "getCategory: "+utils.convertGson(response.body()));
id = response.body().getData().get(0).getIdCategory();
}
@Override
public void onFailure(Call<DataResponse<List<CategoryModels>>> call, Throwable t) {
}
});
return id;
} }
private void openFile(){ private void openFile(){
......
...@@ -56,6 +56,7 @@ import com.yono.messeripos.utils.Utils; ...@@ -56,6 +56,7 @@ import com.yono.messeripos.utils.Utils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import okhttp3.ResponseBody;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.Callback; import retrofit2.Callback;
import retrofit2.Response; import retrofit2.Response;
...@@ -139,6 +140,11 @@ public class MainActivity extends AppCompatActivity { ...@@ -139,6 +140,11 @@ public class MainActivity extends AppCompatActivity {
productAdapterListener(); productAdapterListener();
categoryAdapterListener(); categoryAdapterListener();
formCategoryListener(); formCategoryListener();
punyaAbiCoba();
}
private void punyaAbiCoba() {
} }
private void toolbarSetOnItemClicked() { private void toolbarSetOnItemClicked() {
......
...@@ -23,6 +23,9 @@ public interface CategoryServise { ...@@ -23,6 +23,9 @@ public interface CategoryServise {
@GET(ApiHelper.VERSI_API_1+"product-category-id/{id}") @GET(ApiHelper.VERSI_API_1+"product-category-id/{id}")
Call<DataResponse<List<ProductModels>>> getCategoryById(@Path("id") int id); Call<DataResponse<List<ProductModels>>> getCategoryById(@Path("id") int id);
@GET(ApiHelper.VERSI_API_1+"category-name/{id}")
Call<DataResponse<List<CategoryModels>>> getCategoryByName(@Path("id") String name);
@POST(ApiHelper.VERSI_API_1+"category") @POST(ApiHelper.VERSI_API_1+"category")
Call<DataResponse<CategoryModels>> addCategory(@Body CategoryModels categoryModels); Call<DataResponse<CategoryModels>> addCategory(@Body CategoryModels categoryModels);
......
...@@ -7,18 +7,22 @@ import com.yono.messeripos.response.DataResponse; ...@@ -7,18 +7,22 @@ import com.yono.messeripos.response.DataResponse;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import okhttp3.MultipartBody; import okhttp3.MultipartBody;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call; import retrofit2.Call;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.DELETE; import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.Multipart; import retrofit2.http.Multipart;
import retrofit2.http.POST; import retrofit2.http.POST;
import retrofit2.http.PUT; import retrofit2.http.PUT;
import retrofit2.http.Part; import retrofit2.http.Part;
import retrofit2.http.Path; import retrofit2.http.Path;
import retrofit2.http.QueryMap;
public interface ProductService { public interface ProductService {
@GET(ApiHelper.VERSI_API_1+"products") @GET(ApiHelper.VERSI_API_1+"products")
...@@ -43,4 +47,7 @@ public interface ProductService { ...@@ -43,4 +47,7 @@ public interface ProductService {
@Part("stock") Integer stock, @Part("stock") Integer stock,
@Part("category_id") int category_id @Part("category_id") int category_id
); );
@POST("https://ws-dev.oktapos.com/ws/synitem")
Call<ResponseBody> syncData();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment