Egypt PD Added IR Visibility kpi
This commit is contained in:
@@ -225,6 +225,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
db.execSQL(TableBean.getTable_ORDER_RECEIVED_STATUS());//--Added 08.12.2022
|
||||
db.execSQL(TableBean.getAdhocJourneyplanAdditional());//--Added 7.10.2019
|
||||
db.execSQL(CommonString.CREATE_TABLE_IRPD);
|
||||
db.execSQL(CommonString.CREATE_TABLE_IRPD_VISIBILITY);
|
||||
db.execSQL(CommonString.CREATE_TABLE_INSERT_STOCK_DATA);
|
||||
} catch (SQLException e) {
|
||||
e.fillInStackTrace();
|
||||
@@ -289,11 +290,10 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
db.delete(CommonString.TABLE_INSERT_COMPETIOTIONN_PROMO_EXISTS, "STORE_ID" + "='" + storeid + "'", null);
|
||||
db.delete(CommonString.TABLE_INSERT_COMPETIOTIONN_PROMO, "STORE_ID" + "='" + storeid + "'", null);
|
||||
db.delete(CommonString.TABLE_IRPD, CommonString.KEY_STORE_ID + "='" + storeid + "'", null);
|
||||
|
||||
db.delete(CommonString.TABLE_IRPD_VISIBILITY, CommonString.KEY_STORE_ID + "='" + storeid + "'", null);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void deleteAllTables() {
|
||||
@@ -337,6 +337,7 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
db.delete(CommonString.TABLE_INSERT_ORDER_TAKING_DATA, null, null);
|
||||
db.delete(CommonString.TABLE_INSERT_STOCK, null, null);
|
||||
db.delete(CommonString.TABLE_IRPD, null, null);
|
||||
db.delete(CommonString.TABLE_IRPD_VISIBILITY, null, null);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -532,20 +533,17 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
ArrayList<BrandMasterGetterSetter> brandList = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
|
||||
try {
|
||||
|
||||
if (key_account_id != null) {
|
||||
dbcursor = db.rawQuery("SELECT * FROM(SELECT DISTINCT BR.BRAND_ID, SCM.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM " + tableName + " MS " +
|
||||
dbcursor = db.rawQuery("SELECT * FROM(SELECT DISTINCT BR.BRAND_ID, SCM.SUB_CATEGORY||'-'||BR.BRAND AS BRAND,SCM.SUB_CATEGORY_ID,SCM.SUB_CATEGORY FROM " + tableName + " MS " +
|
||||
"INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID " +
|
||||
"INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID WHERE MS.KEYACCOUNT_ID ='" + key_account_id + "' " +
|
||||
"AND STORETYPE_ID ='" + store_type_id + "' AND CLASS_ID = '" + class_id + "' AND BR.COMPANY_ID ='1' AND SCM.CATEGORY_ID = '" + category_id + "' ORDER BY SCM.SUB_CATEGORY_SEQUENCE, BR.BRAND_SEQUENCE ) As Brand", null);
|
||||
} else {
|
||||
dbcursor = db.rawQuery("SELECT * FROM(SELECT DISTINCT BR.BRAND_ID, SCM.SUB_CATEGORY||'-'||BR.BRAND AS BRAND FROM MAPPING_STOCK_STOREWISE MS " +
|
||||
dbcursor = db.rawQuery("SELECT * FROM(SELECT DISTINCT BR.BRAND_ID, SCM.SUB_CATEGORY||'-'||BR.BRAND AS BRAND,SCM.SUB_CATEGORY_ID,SCM.SUB_CATEGORY FROM MAPPING_STOCK_STOREWISE MS " +
|
||||
"INNER JOIN SKU_MASTER SM ON MS.SKU_ID = SM.SKU_ID INNER JOIN BRAND_MASTER BR ON SM.BRAND_ID=BR.BRAND_ID " +
|
||||
"INNER JOIN SUB_CATEGORY_MASTER SCM ON BR.SUB_CATEGORY_ID = SCM.SUB_CATEGORY_ID WHERE MS.STORE_ID ='" + store_id + "' " +
|
||||
" AND BR.COMPANY_ID ='1' AND SCM.CATEGORY_ID = '" + category_id + "' ORDER BY SCM.SUB_CATEGORY_SEQUENCE, BR.BRAND_SEQUENCE ) As Brand", null);
|
||||
|
||||
}
|
||||
|
||||
if (dbcursor != null) {
|
||||
@@ -561,7 +559,11 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
brand.setBRAND_ID(dbcursor.getString(dbcursor
|
||||
.getColumnIndexOrThrow("BRAND_ID")));
|
||||
|
||||
brand.setSUB_CATEGORY(dbcursor.getString(dbcursor
|
||||
.getColumnIndexOrThrow("SUB_CATEGORY")));
|
||||
|
||||
brand.setSUB_CATEGORY_ID(dbcursor.getString(dbcursor
|
||||
.getColumnIndexOrThrow("SUB_CATEGORY_ID")));
|
||||
brandList.add(brand);
|
||||
|
||||
dbcursor.moveToNext();
|
||||
@@ -2709,6 +2711,12 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
|
||||
sb.setBrand(cursordata.getString(cursordata
|
||||
.getColumnIndexOrThrow(CommonString.KEY_BRAND)));
|
||||
sb.setSubcat(cursordata.getString(cursordata
|
||||
.getColumnIndexOrThrow(CommonString.KEY_SUB_CATEGORY)));
|
||||
|
||||
sb.setSubcatid(cursordata.getString(cursordata
|
||||
.getColumnIndexOrThrow(CommonString.KEY_SUB_CATEGORY_ID)));
|
||||
|
||||
|
||||
sb.setQuantity(cursordata.getString(cursordata
|
||||
.getColumnIndexOrThrow(CommonString.KEY_QUANTITY)));
|
||||
@@ -3273,7 +3281,6 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
try {
|
||||
for (int i = 0; i < Mainlist.size(); i++) {
|
||||
AddittionalGetterSetter data = Mainlist.get(i);
|
||||
|
||||
values.put("Store_Id", data.getStore_id());
|
||||
values.put("categoryId", categoryId);
|
||||
values.put("brand_name", data.getBrand());
|
||||
@@ -3299,7 +3306,8 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
values1.put(CommonString.KEY_QUANTITY, skulist.get(j).getQuantity());
|
||||
values1.put(CommonString.KEY_SKU_ID, skulist.get(j).getSku_id());
|
||||
values1.put(CommonString.KEY_SKUNAME, skulist.get(j).getSku_name());
|
||||
|
||||
values1.put(CommonString.KEY_SUB_CATEGORY_ID, skulist.get(j).getSubcatid());
|
||||
values1.put(CommonString.KEY_SUB_CATEGORY, skulist.get(j).getSubcat());
|
||||
db.insert(CommonString.TABLE_INSERT_STOCK_DIALOG_MAIN, null, values1);
|
||||
}
|
||||
}
|
||||
@@ -4507,6 +4515,29 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
return filled;
|
||||
}
|
||||
|
||||
@SuppressLint("Recycle")
|
||||
public boolean isFilledIRPDVisidata(String store_id, String visit_date, String category_id) {
|
||||
boolean filled = false;
|
||||
Cursor dbcursor = null;
|
||||
try {
|
||||
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_IRPD_VISIBILITY +
|
||||
" WHERE " + CommonString.KEY_STORE_ID + "=" + store_id + " AND " + CommonString.KEY_VISIT_DATE + "='" + visit_date +
|
||||
"' AND " + CommonString.KEY_CATEGORY_ID + "=" + category_id, null);
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
String value = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IRPD_VISIBILITY_IMAGES));
|
||||
if (value != null && !value.isEmpty()) {
|
||||
filled = true;
|
||||
}
|
||||
dbcursor.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("Exception ", " when fetching Records!!!!!!!!!!!!!!!!!!!!! " + e.toString());
|
||||
return filled;
|
||||
}
|
||||
|
||||
return filled;
|
||||
}
|
||||
public void updateStore_wise_camera(Store_wise_camera_DataGetterSetter data) {
|
||||
ContentValues values = new ContentValues();
|
||||
try {
|
||||
@@ -10505,6 +10536,65 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<CategoryPictureGetterSetter> getirVisibilityData(String visitdate,String store_id, String categoryId) {
|
||||
ArrayList<CategoryPictureGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
try {
|
||||
dbcursor = db.rawQuery(
|
||||
"SELECT DISTINCT SB.SUB_CATEGORY_ID, SB.SUB_CATEGORY, " +
|
||||
"IFNULL(BR.PD_SUB_CATEGORY_CODE, '') AS PD_SUB_CATEGORY_CODE, " +
|
||||
"IFNULL(T.IRPD_VISIBILITY_IMAGES, '') AS IRPD_VISIBILITY_IMAGES, " +
|
||||
"IFNULL(T.IRPD_VISIBILITY_IMAGES_MODIFY, '') AS IRPD_VISIBILITY_IMAGES_MODIFY " +
|
||||
"FROM STOCK_DIALOG_MAIN SB " +
|
||||
"INNER JOIN SUB_CATEGORY_MASTER BR ON SB.SUB_CATEGORY_ID = BR.SUB_CATEGORY_ID " +
|
||||
"LEFT JOIN ( " +
|
||||
" SELECT * FROM " + CommonString.TABLE_IRPD_VISIBILITY +
|
||||
" WHERE STORE_ID = '" + store_id + "' " +
|
||||
" AND CATEGORY_ID = '" + categoryId + "' " +
|
||||
" AND VISIT_DATE = '" + visitdate + "'" +
|
||||
") AS T ON T.CATEGORY_ID = SB.categoryId AND T.SUB_CATEGORY_ID = SB.SUB_CATEGORY_ID " +
|
||||
"WHERE SB.STORE_ID = '" + store_id + "' AND SB.categoryId = '" + categoryId + "'",null);
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
CategoryPictureGetterSetter CPGS = new CategoryPictureGetterSetter();
|
||||
CPGS.setSUB_CATEGORY(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SUB_CATEGORY")));
|
||||
CPGS.setSUB_CATEGORY_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow("SUB_CATEGORY_ID")));
|
||||
CPGS.setSubCatCode(dbcursor.getString(dbcursor.getColumnIndexOrThrow("PD_SUB_CATEGORY_CODE")));
|
||||
// Retrieve image URIs from database
|
||||
String imgs = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IRPD_VISIBILITY_IMAGES));
|
||||
String imgs_modify = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IRPD_VISIBILITY_MODIFY_IMAGES));
|
||||
|
||||
// Split and map URIs and Modify URIs separately
|
||||
List<String> imageUris = imgs != null && !imgs.isEmpty()
|
||||
? Arrays.stream(imgs.split(", ")).collect(Collectors.toList())
|
||||
: new ArrayList<>();
|
||||
List<String> modifyUris = imgs_modify != null && !imgs_modify.isEmpty()
|
||||
? Arrays.stream(imgs_modify.split(", ")).collect(Collectors.toList())
|
||||
: new ArrayList<>();
|
||||
|
||||
// Create ImageUri objects with original URI and Modify URI
|
||||
ArrayList<ImageUri> imageUriList = new ArrayList<>();
|
||||
for (int i = 0; i < imageUris.size(); i++) {
|
||||
String uri = imageUris.get(i);
|
||||
String modifyUri = (i < modifyUris.size()) ? modifyUris.get(i) : uri; // Fallback to original if no modify URI
|
||||
imageUriList.add(new ImageUri(uri, modifyUri));
|
||||
}
|
||||
CPGS.setImageUris(imageUriList);
|
||||
CPGS.setSubCategoryCamera1("");
|
||||
CPGS.setSubCategoryCamera2("");
|
||||
list.add(CPGS);
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
return list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("Exception ", e.toString());
|
||||
// return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
public ArrayList<OrderReceivedStatus> getOrderstatusData(String storeid, String categoryid) {
|
||||
ArrayList<OrderReceivedStatus> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
@@ -10573,14 +10663,43 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
values.put(CommonString.KEY_IRPD_MODIFY_IMAGES, _list.get(i).getImageUris().stream().map(ImageUri::getModify_uri).collect(Collectors.toList()).stream().collect(Collectors.joining(", ")));
|
||||
l = db.insert(CommonString.TABLE_IRPD, null, values);
|
||||
Log.e("data_d", info.toString() + ","+_list.get(i).getImageUris().size());
|
||||
// Log.e("data_d", values.toString());
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
db.endTransaction();
|
||||
} catch (Exception ex) {
|
||||
Log.d("data_d ", " in Insert TABLE_IRPD " + ex);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
public long InsertPdImageVisibilityData(
|
||||
String visit_date, String storeId, String categoryId, List<CategoryPictureGetterSetter> _list,String savemode) {
|
||||
ContentValues values = new ContentValues();
|
||||
long l = 0;
|
||||
try {
|
||||
db.delete(CommonString.TABLE_IRPD_VISIBILITY,
|
||||
CommonString.KEY_STORE_ID + "=" + storeId + " AND " + CommonString.KEY_VISIT_DATE + "='" + visit_date + "' AND " +
|
||||
CommonString.KEY_CATEGORY_ID + "=" + categoryId, null);
|
||||
|
||||
db.beginTransaction();
|
||||
for (int i = 0; i < _list.size(); i++) {
|
||||
values.put(CommonString.KEY_SAVE_MODE, savemode);
|
||||
values.put(CommonString.KEY_STORE_ID, storeId);
|
||||
values.put(CommonString.KEY_VISIT_DATE, visit_date);
|
||||
values.put(CommonString.KEY_CATEGORY_ID, categoryId);
|
||||
values.put(CommonString.KEY_SUB_CATEGORY_ID, _list.get(i).getSUB_CATEGORY_ID());
|
||||
values.put(CommonString.KEY_SUB_CATEGORY_CODE, _list.get(i).getSubCatCode());
|
||||
List<String> info = _list.get(i).getImageUris().stream().map(ImageUri::getModify_uri).collect(Collectors.toList());
|
||||
values.put(CommonString.KEY_IRPD_VISIBILITY_IMAGES, _list.get(i).getImageUris().stream().map(ImageUri::getUri).collect(Collectors.toList()).stream().collect(Collectors.joining(", ")));
|
||||
values.put(CommonString.KEY_IRPD_VISIBILITY_MODIFY_IMAGES, _list.get(i).getImageUris().stream().map(ImageUri::getModify_uri).collect(Collectors.toList()).stream().collect(Collectors.joining(", ")));
|
||||
l = db.insert(CommonString.TABLE_IRPD_VISIBILITY, null, values);
|
||||
Log.e("data_d", info.toString() + ","+_list.get(i).getImageUris().size());
|
||||
}
|
||||
db.setTransactionSuccessful();
|
||||
db.endTransaction();
|
||||
} catch (Exception ex) {
|
||||
Log.d("data_d ", " in Insert TABLE_IRPD " + ex);
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
@@ -10660,6 +10779,44 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
return filled;
|
||||
}
|
||||
|
||||
public boolean isPdVisibility(String store_id, String date, String mode, String categoryId) {
|
||||
boolean filled = false;
|
||||
Cursor dbcursor = null;
|
||||
try {
|
||||
String query = "";
|
||||
if (mode != null) {
|
||||
query = "SELECT * FROM " + CommonString.TABLE_IRPD_VISIBILITY + " WHERE "
|
||||
+ CommonString.KEY_STORE_ID + " =" + store_id + " AND "
|
||||
+ CommonString.KEY_CATEGORY_ID + " =" + categoryId + " AND "
|
||||
+ CommonString.KEY_VISIT_DATE + " ='" + date + "'";
|
||||
} else {
|
||||
|
||||
}
|
||||
dbcursor = db.rawQuery(query, null);
|
||||
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
String common_status = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_SAVE_MODE));
|
||||
if (mode != null) {
|
||||
if (common_status != null && !common_status.equals("") && common_status.equalsIgnoreCase(CommonString.KEY_COMPELETE)) {
|
||||
filled = true;
|
||||
} else {
|
||||
filled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
return filled;
|
||||
}
|
||||
return filled;
|
||||
}
|
||||
|
||||
public ArrayList<CategoryPictureGetterSetter> getIrPDforUpload(String store_id, String visit_date) {
|
||||
ArrayList<CategoryPictureGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
@@ -10691,8 +10848,42 @@ public class GSKOrangeDB extends SQLiteOpenHelper {
|
||||
Log.d("Exception ", "get MSL_Availability server upload Data!" + e.toString());
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public ArrayList<CategoryPictureGetterSetter> getIrPDVisibilityforUpload(String store_id, String visit_date) {
|
||||
ArrayList<CategoryPictureGetterSetter> list = new ArrayList<>();
|
||||
Cursor dbcursor = null;
|
||||
try {
|
||||
dbcursor = db.rawQuery("SELECT * FROM " + CommonString.TABLE_IRPD_VISIBILITY + " WHERE " +
|
||||
CommonString.KEY_STORE_ID + "=" + store_id + " AND " + CommonString.KEY_VISIT_DATE + "='" + visit_date + "'", null);
|
||||
if (dbcursor != null) {
|
||||
dbcursor.moveToFirst();
|
||||
while (!dbcursor.isAfterLast()) {
|
||||
CategoryPictureGetterSetter cd = new CategoryPictureGetterSetter();
|
||||
cd.setCategoryId(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_CATEGORY_ID)));
|
||||
cd.setSUB_CATEGORY_ID(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_SUB_CATEGORY_ID)));
|
||||
cd.setSubCatCode(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_SUB_CATEGORY_CODE)));
|
||||
cd.setSubCategoryCamera2(dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IRPD_VISIBILITY_MODIFY_IMAGES)));
|
||||
String imgs = dbcursor.getString(dbcursor.getColumnIndexOrThrow(CommonString.KEY_IRPD_VISIBILITY_IMAGES));
|
||||
cd.setImageUris(imgs != null && !imgs.isEmpty() ? (ArrayList<ImageUri>) Arrays.stream(imgs.split(", "))
|
||||
.map(img -> new ImageUri(img, new File(img).getName())) // Extract file name as second parameter
|
||||
.collect(Collectors.toList()) : new ArrayList<>());
|
||||
|
||||
cd.setSubCategoryCamera1(imgs);
|
||||
list.add(cd);
|
||||
dbcursor.moveToNext();
|
||||
}
|
||||
dbcursor.close();
|
||||
return list;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("Exception ", "get MSL_Availability server upload Data!" + e.toString());
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
+26
-1
@@ -3,7 +3,32 @@ package cpm.com.gskmtorange.GetterSetter;
|
||||
public class AdditionalDialogGetterSetter {
|
||||
public String Display_id,display,brand_id,brand, trg_quantity, image1, image2, category_id,
|
||||
image3, BEFORE_QTY, camera1, camera2, camera3, AFTER_QTY, store_id, stock_count, question_id, question, answer, type,
|
||||
KEY_ID, unique_id,image_url, sku_id,quantity, process_id, sku_name, stock_flag;
|
||||
KEY_ID, unique_id,image_url, sku_id,quantity, process_id, sku_name, stock_flag,subcatid,subcat,subcatEng;
|
||||
|
||||
|
||||
public String getSubcatid() {
|
||||
return subcatid;
|
||||
}
|
||||
|
||||
public void setSubcatid(String subcatid) {
|
||||
this.subcatid = subcatid;
|
||||
}
|
||||
|
||||
public String getSubcat() {
|
||||
return subcat;
|
||||
}
|
||||
|
||||
public void setSubcat(String subcat) {
|
||||
this.subcat = subcat;
|
||||
}
|
||||
|
||||
public String getSubcatEng() {
|
||||
return subcatEng;
|
||||
}
|
||||
|
||||
public void setSubcatEng(String subcatEng) {
|
||||
this.subcatEng = subcatEng;
|
||||
}
|
||||
|
||||
public String getCOMMON_ID() {
|
||||
return COMMON_ID;
|
||||
|
||||
+27
@@ -59,6 +59,33 @@ public class AddittionalGetterSetter {
|
||||
|
||||
String Brand,Brand_id,Sku,Sku_id,Store_id,Image="";
|
||||
|
||||
String SubCatId,SubCat="";
|
||||
|
||||
public String getSubCatId() {
|
||||
return SubCatId;
|
||||
}
|
||||
|
||||
public void setSubCatId(String subCatId) {
|
||||
SubCatId = subCatId;
|
||||
}
|
||||
|
||||
public String getSubCat() {
|
||||
return SubCat;
|
||||
}
|
||||
|
||||
public void setSubCat(String subCat) {
|
||||
SubCat = subCat;
|
||||
}
|
||||
|
||||
public String getSubCatEng() {
|
||||
return SubCatEng;
|
||||
}
|
||||
|
||||
public void setSubCatEng(String subCatEng) {
|
||||
SubCatEng = subCatEng;
|
||||
}
|
||||
|
||||
String SubCatEng="";
|
||||
|
||||
String Image2="";
|
||||
|
||||
|
||||
@@ -139,6 +139,7 @@ public class CommonString {
|
||||
public static final String KEY_SUB_CATEGORY = "SUB_CATEGORY";
|
||||
public static final String KEY_SUB_CATEGORY_ID = "SUB_CATEGORY_ID";
|
||||
public static final String KEY_SUB_CATEGORY_CODE = "SUB_CATEGORY_CODE";
|
||||
public static final String KEY_SUB_CATEGORY_ENGLISH = "SUB_CATEGORY_ENGLISH";
|
||||
public static final String KEY_FROM = "FROM";
|
||||
public static final String KEY_CHAT_ID = "CHAT_ID";
|
||||
public static final String KEY_MESSAGE = "MESSAGE";
|
||||
@@ -699,7 +700,8 @@ public class CommonString {
|
||||
+ KEY_SKU_ID + " VARCHAR," + KEY_QUANTITY + " VARCHAR," + KEY_Common_ID + " VARCHAR,"
|
||||
+ "categoryId" + " VARCHAR,"
|
||||
+ KEY_SKUNAME + " VARCHAR,"
|
||||
+ KEY_PROCESS_ID + " VARCHAR)";
|
||||
+ KEY_SUB_CATEGORY_ID + " VARCHAR,"
|
||||
+ KEY_SUB_CATEGORY + " VARCHAR)";
|
||||
|
||||
//Tables related to T2p Compliance
|
||||
|
||||
@@ -1572,6 +1574,31 @@ public class CommonString {
|
||||
+ KEY_IRPD_IMAGES
|
||||
+ " VARCHAR)";
|
||||
|
||||
public static final String KEY_IRPD_VISIBILITY_IMAGES = "IRPD_VISIBILITY_IMAGES";
|
||||
public static final String KEY_IRPD_VISIBILITY_MODIFY_IMAGES = "IRPD_VISIBILITY_IMAGES_MODIFY";
|
||||
public static final String TABLE_IRPD_VISIBILITY = "DR_IRPD_VISIBILITY";
|
||||
public static final String CREATE_TABLE_IRPD_VISIBILITY = "CREATE TABLE IF NOT EXISTS "
|
||||
+ TABLE_IRPD_VISIBILITY
|
||||
+ " ("
|
||||
+ "KEY_ID"
|
||||
+ " INTEGER PRIMARY KEY AUTOINCREMENT ,"
|
||||
+ KEY_STORE_ID
|
||||
+ " INTEGER,"
|
||||
+ KEY_VISIT_DATE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_SAVE_MODE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_CATEGORY_ID
|
||||
+ " INTEGER,"
|
||||
+ KEY_SUB_CATEGORY_ID
|
||||
+ " INTEGER,"
|
||||
+ KEY_SUB_CATEGORY_CODE
|
||||
+ " VARCHAR,"
|
||||
+ KEY_IRPD_VISIBILITY_MODIFY_IMAGES
|
||||
+ " VARCHAR,"
|
||||
+ KEY_IRPD_VISIBILITY_IMAGES
|
||||
+ " VARCHAR)";
|
||||
|
||||
public static final String BACKUP_FOLDER_NAME = "HaleonMT_Backup";
|
||||
public static final String IMAGE_FOLDER_NAME = "HaleonMT_Images";
|
||||
public static final String Download_IMAGE_FOLDER = "Downloaded_HaleonMT_Images";
|
||||
|
||||
+13
-195
@@ -84,6 +84,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
ArrayList<AdditionalDialogGetterSetter> defdata = new ArrayList<AdditionalDialogGetterSetter>();
|
||||
Spinner spinner_brand, spinner_sku;
|
||||
Spinner spinner_brand_list, spinner_sku_list;
|
||||
String subcatid = "", subcat= "", subcatEng= "";
|
||||
AdditionalDialogGetterSetter additionalgeetersetter;
|
||||
public static ArrayList<AddittionalGetterSetter> data = new ArrayList<AddittionalGetterSetter>();
|
||||
ToggleButton btntoggle;
|
||||
@@ -248,20 +249,6 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
listdata.get(k).setSkuDialogList(db.getDialogStock(listdata.get(k).getKey_id()));
|
||||
|
||||
String tooglevalue = listdata.get(k).getBtn_toogle();
|
||||
|
||||
/*if (tooglevalue.equalsIgnoreCase("0")) {
|
||||
btnaddlayout.setVisibility(View.INVISIBLE);
|
||||
cardvew.setVisibility(View.INVISIBLE);
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
|
||||
maincard.setVisibility(View.INVISIBLE);
|
||||
btntoggle.setChecked(false);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
diaplylayout.setVisibility(View.INVISIBLE);
|
||||
cameralayout.setVisibility(View.INVISIBLE);
|
||||
btnsku.setVisibility(View.INVISIBLE);
|
||||
}*/
|
||||
|
||||
if (tooglevalue.equalsIgnoreCase("0")) {
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
//btnaddlayout.setVisibility(View.INVISIBLE);
|
||||
@@ -280,126 +267,18 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
fab_add.show();
|
||||
listviewlay.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
/* String KeyID = listdata.get(k).getKey_id();
|
||||
|
||||
uploadlist = db.getDialogStock(KeyID);*/
|
||||
|
||||
}
|
||||
|
||||
/* listdata = db.getAdditionalStock(store_id, categoryId);
|
||||
|
||||
for (int k = 0; k < listdata.size(); k++) {
|
||||
|
||||
String tooglevalue = listdata.get(k).getBtn_toogle();
|
||||
|
||||
if (tooglevalue.equalsIgnoreCase("0")) {
|
||||
btnaddlayout.setVisibility(View.INVISIBLE);
|
||||
cardvew.setVisibility(View.INVISIBLE);
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
|
||||
maincard.setVisibility(View.INVISIBLE);
|
||||
btntoggle.setChecked(false);
|
||||
brandlayout.setVisibility(View.GONE);
|
||||
diaplylayout.setVisibility(View.INVISIBLE);
|
||||
cameralayout.setVisibility(View.INVISIBLE);
|
||||
btnsku.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
/*if (listdata.size() > 0) {
|
||||
for (int i = 0; i < listdata.size(); i++) {
|
||||
if (listdata.get(i).getBtn_toogle().equalsIgnoreCase("0")) {
|
||||
listviewlay.setVisibility(View.INVISIBLE);
|
||||
maincard.setVisibility(View.INVISIBLE);
|
||||
cardvew.setVisibility(View.INVISIBLE);
|
||||
btnaddlayout.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
adapteradditional = new MyAdaptorAdditionalStock(AdditionalVisibility.this, listdata);
|
||||
listviewlay.setAdapter(adapteradditional);
|
||||
listviewlay.invalidateViews();
|
||||
btnaddlayout.setVisibility(View.VISIBLE);
|
||||
cardvew.setVisibility(View.VISIBLE);
|
||||
listviewlay.setVisibility(View.VISIBLE);
|
||||
maincard.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
if (togglevalue.equals("1")) {
|
||||
|
||||
//listdata = db.getAdditionalStock(store_id, categoryId);
|
||||
|
||||
if (listdata.size() > 0) {
|
||||
|
||||
db.deleteStockEntryMainTable(store_id, categoryId);
|
||||
|
||||
db.InsertMainListAdditionalData(listdata, categoryId);
|
||||
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
|
||||
/* AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
||||
AdditionalVisibility.this);
|
||||
// set title
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
// set dialog message
|
||||
alertDialogBuilder
|
||||
.setMessage(getResources().getString(R.string.title_activity_Want_save))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
db.deleteStockEntryMainTable(store_id, categoryId);
|
||||
|
||||
*//*for (int J = 0; J < listdata.size(); J++) {
|
||||
newadd = new AddittionalGetterSetter();
|
||||
newadd.setBrand(listdata.get(J).getBrand_id());
|
||||
newadd.setBrand_id(listdata.get(J).getBrand_id());
|
||||
newadd.setImage(listdata.get(J).getImage());
|
||||
newadd.setImage2(listdata.get(J).getImage2());
|
||||
newadd.setImage3(listdata.get(J).getImage3());
|
||||
newadd.setSku(listdata.get(J).getSku());
|
||||
newadd.setSku_id(listdata.get(J).getSku_id());
|
||||
newadd.setStore_id(listdata.get(J).getStore_id());
|
||||
newadd.setBtn_toogle(listdata.get(J).getBtn_toogle());
|
||||
newadd.setCategoryId(listdata.get(J).getCategoryId());
|
||||
String KeyID = listdata.get(J).getKey_id();
|
||||
|
||||
//additionalVisibilitySkuList = db.getDialogStock(KeyID);
|
||||
|
||||
db.InsertMainListAdditionalData(listdata, additionalVisibilitySkuList, categoryId);
|
||||
|
||||
KeyID = "";
|
||||
additionalVisibilitySkuList.clear();
|
||||
}*//*
|
||||
db.InsertMainListAdditionalData(listdata, categoryId);
|
||||
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
// if this button is clicked, just close
|
||||
// the dialog box and do nothing
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
// create alert dialog
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
|
||||
// show it
|
||||
alertDialog.show();*/
|
||||
|
||||
} else {
|
||||
Snackbar.make(view, getResources().getString(R.string.title_activity_Want_add), Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
||||
}
|
||||
@@ -407,7 +286,6 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
db.deleteStockEntryMainTable(store_id, categoryId);
|
||||
|
||||
listdata.clear();
|
||||
|
||||
newadd = new AddittionalGetterSetter();
|
||||
newadd.setBrand("");
|
||||
newadd.setBrand_id("");
|
||||
@@ -416,88 +294,34 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
newadd.setImage3("");
|
||||
newadd.setSku("");
|
||||
newadd.setSku_id("");
|
||||
newadd.setSubCat("");
|
||||
newadd.setSubCatId("");
|
||||
newadd.setStore_id(store_id);
|
||||
newadd.setBtn_toogle(togglevalue);
|
||||
newadd.setCategoryId(categoryId);
|
||||
|
||||
listdata.add(newadd);
|
||||
|
||||
db.InsertMainListAdditionalData(listdata, categoryId);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
|
||||
/* AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
|
||||
AdditionalVisibility.this);
|
||||
// set title
|
||||
alertDialogBuilder.setTitle(getResources().getString(R.string.dialog_title));
|
||||
// set dialog message
|
||||
alertDialogBuilder
|
||||
.setMessage(getResources().getString(R.string.title_activity_Want_save))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(getResources().getString(R.string.yes), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
||||
|
||||
db.deleteStockEntryMainTable(store_id, categoryId);
|
||||
|
||||
listdata.clear();
|
||||
|
||||
newadd = new AddittionalGetterSetter();
|
||||
newadd.setBrand("");
|
||||
newadd.setBrand_id("");
|
||||
newadd.setImage("");
|
||||
newadd.setImage2("");
|
||||
newadd.setImage3("");
|
||||
newadd.setSku("");
|
||||
newadd.setSku_id("");
|
||||
newadd.setStore_id(store_id);
|
||||
newadd.setBtn_toogle(togglevalue);
|
||||
newadd.setCategoryId(categoryId);
|
||||
|
||||
listdata.add(newadd);
|
||||
|
||||
db.InsertMainListAdditionalData(listdata, categoryId);
|
||||
finish();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
// if this button is clicked, just close
|
||||
// the dialog box and do nothing
|
||||
dialog.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
// create alert dialog
|
||||
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||
|
||||
// show it
|
||||
alertDialog.show();*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
fab_add.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
// Log.d("subcatdata",subcat + ","+subcatid);
|
||||
adGt = new AddittionalGetterSetter();
|
||||
adGt.setBrand(brand_list_name);
|
||||
adGt.setBrand_id(brand_list_id);
|
||||
adGt.setImage(img_str1);
|
||||
adGt.setImage2(img_str2);
|
||||
adGt.setImage3(img_str3);
|
||||
|
||||
adGt.setSku(sku_list_name);
|
||||
adGt.setSku_id(sku_list_id);
|
||||
adGt.setStore_id(store_id);
|
||||
adGt.setBtn_toogle(togglevalue);
|
||||
adGt.setCategoryId(categoryId);
|
||||
|
||||
ArrayList<AdditionalDialogGetterSetter> listdataTemp = new ArrayList<>();
|
||||
listdataTemp.addAll(defdata);
|
||||
adGt.setSkuDialogList(listdataTemp);
|
||||
@@ -519,10 +343,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
//Adding data to existing parent list
|
||||
listdata.add(adGt);
|
||||
editFlag = true;
|
||||
|
||||
clearViews();
|
||||
|
||||
|
||||
//listdata = db.getAdditionalStock(store_id, categoryId);
|
||||
if (listdata.size() > 0) {
|
||||
for (int i = 0; i < listdata.size(); i++) {
|
||||
@@ -813,10 +635,11 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
|
||||
/// new changes by jp
|
||||
if (camera_allow.equals("1")) {
|
||||
btnimage.setBackgroundResource(country_id.equals("6") ? R.mipmap.camera_orange : R.drawable.camera_orange_star_green);
|
||||
btnimage.setBackgroundResource(country_id.equals("6") ? R.mipmap.camera_orange_star_green : R.mipmap.camera_orange);
|
||||
btnimage1.setBackgroundResource(R.mipmap.camera_orange);
|
||||
btnimage2.setBackgroundResource(R.mipmap.camera_orange);
|
||||
} else {
|
||||
Log.d("camallow","false");
|
||||
btnimage.setBackgroundResource(R.mipmap.camera_grey);
|
||||
btnimage1.setBackgroundResource(R.mipmap.camera_grey);
|
||||
btnimage2.setBackgroundResource(R.mipmap.camera_grey);
|
||||
@@ -1361,6 +1184,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
|
||||
ab.setBrand(brand_name);
|
||||
ab.setBrand_id(brand_id);
|
||||
ab.setSubcat(subcat);
|
||||
ab.setSubcatid(subcatid);
|
||||
//ab.setDisplay_id(data.get(position).getDisplay_id());
|
||||
ab.setStore_id(store_id);
|
||||
// ab.setUnique_id(data.get(position).getUnique_id());
|
||||
@@ -1378,6 +1203,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
Edt_txt.setText("");
|
||||
SKU_ID = "";
|
||||
SKU_name = "";
|
||||
subcatid="";
|
||||
subcat="";
|
||||
// list = db.getDialogStock(store_id);
|
||||
linearlay.setVisibility(View.VISIBLE);
|
||||
cardlay.setVisibility(View.VISIBLE);
|
||||
@@ -1413,6 +1240,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
|
||||
brand_id = brandList.get(position).getBRAND_ID().get(0);
|
||||
brand_name = brandList.get(position).getBRAND().get(0);
|
||||
subcatid = brandList.get(position).getSUB_CATEGORY_ID().get(0);
|
||||
subcat = brandList.get(position).getSUB_CATEGORY().get(0);
|
||||
|
||||
if (country_id.equals("7") || country_id.equals("8") || country_id.equals("11") || country_id.equals("17")) {
|
||||
sku_list = db.getSkuT2PData(null, null, null, brand_id, store_id, CommonString.TABLE_MAPPING_STOCK_STOREWISE);
|
||||
@@ -1714,8 +1543,6 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
|
||||
@@ -1743,10 +1570,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
|
||||
boolean validateData(AddittionalGetterSetter data) {
|
||||
boolean flag = true;
|
||||
|
||||
String brandid = data.getBrand_id();
|
||||
String skuid = data.getSku_id();
|
||||
|
||||
String imageu = data.getImage();
|
||||
String toggleid = data.getBtn_toogle();
|
||||
ArrayList<AdditionalDialogGetterSetter> skuList = data.getSkuDialogList();
|
||||
@@ -1757,11 +1582,9 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
|
||||
if (/*brandid.equalsIgnoreCase("") ||*/ skuid.equalsIgnoreCase("")) {
|
||||
flag = false;
|
||||
|
||||
errormsg = getResources().getString(R.string.title_activity_select_dropdown);
|
||||
|
||||
} else if (camera_allow.equals("1")) {
|
||||
if (!country_id.equals("6") && (imageu == null || imageu.equalsIgnoreCase(""))) {
|
||||
if ((imageu == null || imageu.equalsIgnoreCase(""))) {
|
||||
flag = false;
|
||||
errormsg = getResources().getString(R.string.title_activity_take_image);
|
||||
} else if (skuList.size() == 0) {
|
||||
@@ -1774,15 +1597,10 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
|
||||
errormsg = getResources().getString(R.string.title_activity_fill_sku);
|
||||
flag = false;
|
||||
|
||||
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +169,6 @@ public class CheckoutActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
db.updateCheckoutStatus(store_id, CommonString.KEY_Y, table);
|
||||
|
||||
} else {
|
||||
if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
|
||||
return service;
|
||||
|
||||
@@ -0,0 +1,430 @@
|
||||
package cpm.com.gskmtorange.dailyentry
|
||||
|
||||
import android.Manifest
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.preference.PreferenceManager
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.net.toUri
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.sj.camera_lib_android.Database.ReactPendingData
|
||||
import com.sj.camera_lib_android.Database.ReactSingleImage
|
||||
import com.sj.camera_lib_android.models.ImageUploadModel
|
||||
import com.sj.camera_lib_android.utils.CameraSDK
|
||||
import cpm.com.gskmtorange.Database.GSKOrangeDB
|
||||
import cpm.com.gskmtorange.GetterSetter.CategoryPictureGetterSetter
|
||||
import cpm.com.gskmtorange.R
|
||||
import cpm.com.gskmtorange.adapter.SubCatPdAdapter
|
||||
import cpm.com.gskmtorange.adapter.data.ImageUri
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions
|
||||
import cpm.com.gskmtorange.constant.CommonFunctions.savefile
|
||||
import cpm.com.gskmtorange.constant.CommonString
|
||||
import cpm.com.gskmtorange.constant.CommonUtils
|
||||
import cpm.com.gskmtorange.databinding.ActivityPdimageBinding
|
||||
import cpm.com.gskmtorange.databinding.ActivityPdvisibilityBinding
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
|
||||
class PDVisibilityActivity : AppCompatActivity() {
|
||||
private var context: Context? = null
|
||||
var categoryName: String? = null
|
||||
var categoryId: String? = null
|
||||
var store_id: String? = null;
|
||||
var date: String? = null;
|
||||
var store_type_id: String? = null
|
||||
var class_id: String? = null
|
||||
var key_account_id: String? = null
|
||||
var country_id: String? = null
|
||||
var store_flag_str: String? = null
|
||||
private var preferences: SharedPreferences? = null
|
||||
var db: GSKOrangeDB? = null
|
||||
var listdat: ArrayList<CategoryPictureGetterSetter>? = ArrayList()
|
||||
var username: String? = ""
|
||||
private var kpi_name: String? = ""
|
||||
private lateinit var binding: ActivityPdvisibilityBinding
|
||||
private var adapter: SubCatPdAdapter? = null
|
||||
val PERMISSION_ALL: Int = 99
|
||||
private var _pos = -1;
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = ActivityPdvisibilityBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
setSupportActionBar(binding.toolbar)
|
||||
context = this
|
||||
db = GSKOrangeDB(context)
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
db?.open()
|
||||
preferences?.let {
|
||||
store_id = it.getString(CommonString.KEY_STORE_ID, "")
|
||||
username = it.getString(CommonString.KEY_USERNAME, "")
|
||||
store_type_id = it.getString(CommonString.KEY_STORETYPE_ID, "")
|
||||
class_id = it.getString(CommonString.KEY_CLASS_ID, "")
|
||||
key_account_id = it.getString(CommonString.KEY_KEYACCOUNT_ID, "")
|
||||
country_id = it.getString(CommonString.KEY_COUNTRY_ID, "")
|
||||
store_flag_str = it.getString(CommonString.KEY_STORE_FLAG, "")
|
||||
date = it.getString(CommonString.KEY_DATE, "")
|
||||
}
|
||||
|
||||
CommonFunctions.updateLangResources(
|
||||
context, preferences?.getString(CommonString.KEY_LANGUAGE, "")
|
||||
)
|
||||
intent?.let {
|
||||
categoryName = it.getStringExtra("categoryName")
|
||||
categoryId = it.getStringExtra("categoryId")
|
||||
Log.d("catdata",categoryId.toString() +","+categoryName);
|
||||
kpi_name = it.getStringExtra("kpi_name")
|
||||
}
|
||||
supportActionBar?.apply {
|
||||
setHomeButtonEnabled(true)
|
||||
setDisplayHomeAsUpEnabled(true)
|
||||
title = kpi_name
|
||||
}
|
||||
preferences?.getString(CommonString.KEY_PD_PROJECT_Id, "")?.let { projectId ->
|
||||
val userId = preferences?.getString(CommonString.KEY_PD_USER_Id, "")
|
||||
.takeIf { !it.isNullOrBlank() } ?: username
|
||||
|
||||
CommonUtils.initializePDSDK(
|
||||
this@PDVisibilityActivity,
|
||||
projectId = projectId,
|
||||
_userId = userId
|
||||
)
|
||||
}
|
||||
|
||||
registerIntentFilter(
|
||||
listOf(
|
||||
"DataSaved", "did-receive-queue-data", "did-receive-image-upload-status"
|
||||
)
|
||||
)
|
||||
|
||||
binding.apply {
|
||||
fab.setOnClickListener {
|
||||
if (validate()) {
|
||||
val builder = AlertDialog.Builder(this@PDVisibilityActivity)
|
||||
builder.setMessage(getString(R.string.check_save_message)).setCancelable(false)
|
||||
.setPositiveButton(getString(R.string.yes)) { dialog, _ ->
|
||||
// Handle Yes button click
|
||||
db?.open()
|
||||
db?.InsertPdImageVisibilityData(
|
||||
date,
|
||||
store_id,
|
||||
categoryId,
|
||||
listdat,
|
||||
CommonString.KEY_COMPELETE
|
||||
)?.let {
|
||||
if (it > 0) {
|
||||
Snackbar.make(
|
||||
binding.fab,
|
||||
resources.getString(R.string.save_message),
|
||||
Snackbar.LENGTH_LONG
|
||||
).setAction("Action", null).show()
|
||||
lifecycleScope.launch {
|
||||
delay(3000) // 3 seconds delay
|
||||
finish()
|
||||
}
|
||||
} else {
|
||||
Snackbar.make(
|
||||
binding.fab,
|
||||
resources.getString(R.string.save_message),
|
||||
Snackbar.LENGTH_LONG
|
||||
).setAction("Action", null).show()
|
||||
}
|
||||
}
|
||||
dialog.dismiss()
|
||||
}.setNegativeButton(getString(R.string.no)) { dialog, _ ->
|
||||
dialog.cancel()
|
||||
}
|
||||
val alert = builder.create()
|
||||
alert.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
callAdapter()
|
||||
checkAndRequestPermissions()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
db?.open()
|
||||
}
|
||||
|
||||
private fun validate(): Boolean {
|
||||
var checkFlag = true // Use local variable to avoid issues
|
||||
if (!listdat.isNullOrEmpty()) {
|
||||
for (data in listdat!!) { // Use standard loop for better control
|
||||
if (data.imageUris.isNullOrEmpty()) {
|
||||
checkFlag = false // Set false if validation fails
|
||||
Snackbar.make(
|
||||
binding.fab,
|
||||
"Please capture IR images of ${data.suB_CATEGORY}",
|
||||
Snackbar.LENGTH_SHORT
|
||||
).show()
|
||||
break // Stop further checks once an issue is found
|
||||
}
|
||||
}
|
||||
}
|
||||
return checkFlag // Correctly return validation result
|
||||
}
|
||||
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
val id = item.itemId
|
||||
if (id == android.R.id.home) {
|
||||
//showDataLossAlert();
|
||||
overridePendingTransition(R.anim.activity_back_in, R.anim.activity_back_out)
|
||||
finish()
|
||||
}
|
||||
if (id == R.id.action_settings) {
|
||||
return true
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
LocalBroadcastManager.getInstance(this@PDVisibilityActivity)
|
||||
.unregisterReceiver(myBroadcastReceiver) // onDestroy
|
||||
}
|
||||
|
||||
private fun registerIntentFilter(filters: List<String> = listOf()) {
|
||||
filters.forEach { filter ->
|
||||
LocalBroadcastManager.getInstance(this@PDVisibilityActivity)
|
||||
.registerReceiver(myBroadcastReceiver, IntentFilter(filter))
|
||||
}
|
||||
}
|
||||
|
||||
private val savedImages = mutableListOf<ImageUri>()
|
||||
private var myBroadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context?, intent: Intent?) {
|
||||
when (intent?.action) {
|
||||
"did-receive-queue-data" -> {
|
||||
val receivedList =
|
||||
intent.getParcelableArrayListExtra<ReactPendingData>("imageList")
|
||||
Log.d("DEBUG-LOG did-receive-queue-data", "$receivedList")
|
||||
if (receivedList.isNullOrEmpty()) {
|
||||
CameraSDK.uploadFailedImage(this@PDVisibilityActivity)
|
||||
}
|
||||
}
|
||||
|
||||
"did-receive-image-upload-status" -> {
|
||||
val receivedImage = intent.getParcelableExtra<ReactSingleImage>("image")
|
||||
Log.d("DEBUG-LOG did-receive-image-upload-status", "$receivedImage")
|
||||
}
|
||||
|
||||
"DataSaved" -> {
|
||||
val receivedList =
|
||||
intent.getParcelableArrayListExtra<ImageUploadModel>("imageListSaved")
|
||||
Log.d("DEBUG-LOG DataSaved", "$receivedList")
|
||||
receivedList?.let {
|
||||
savedImages.clear()
|
||||
it.forEach { item ->
|
||||
val dir = CommonString.getImagesFolder(context)
|
||||
val setName =
|
||||
store_id + "_" + username?.replace(".", "") + "_IRPD_VISI_IMG-" + File(
|
||||
item.uri
|
||||
).getName()
|
||||
savedImages.add(ImageUri(uri = item.uri, modify_uri = setName))
|
||||
savefile(item.uri.toUri(), "$dir $setName")
|
||||
}
|
||||
adapter?.updateItem(position = _pos, savedImages)
|
||||
Log.e("savedImages", savedImages.toString())
|
||||
_pos = -1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun launchCamera(subCat_code: String) {
|
||||
val uploadFrom = "TestApp"
|
||||
val uploadParams = JSONObject(
|
||||
"""
|
||||
{
|
||||
"shop_id": 62475,
|
||||
"project_id": "4f57635b-6b07-45bf-bfba-c61c2826b6db",
|
||||
"td_version_id": 178,
|
||||
"shelf_image_id": null,
|
||||
"asset_image_id": null,
|
||||
"shelf_type": "Primary Shelf",
|
||||
"category_id": 123,
|
||||
"user_id": 133,
|
||||
"isConnected": true,
|
||||
"sn_image_type": "skus",
|
||||
"image_type": "multiple",
|
||||
"seq_no": 1,
|
||||
"level": 1,
|
||||
"uploadOnlyOnWifi": 0,
|
||||
"app_session_id": "8e2faa6b-d6fe-413a-a693-76a0cbe0ce71",
|
||||
"metadata": { "Device_Name": "Samsung" }
|
||||
}
|
||||
"""
|
||||
)
|
||||
uploadParams.put("shop_id", store_id)
|
||||
uploadParams.put("user_id", username)
|
||||
uploadParams.put("category_id", subCat_code)
|
||||
uploadParams.put("project_id", preferences?.getString(CommonString.KEY_PD_PROJECT_Id, ""))
|
||||
|
||||
CameraSDK.startCamera(
|
||||
context = this,
|
||||
orientation = "",
|
||||
widthPercentage = 20,
|
||||
uploadParams = uploadParams,
|
||||
resolution = 3000,
|
||||
referenceUrl = "",
|
||||
allowBlurCheck = true,
|
||||
allowCrop = true,
|
||||
uploadFrom = uploadFrom,
|
||||
isRetake = false,
|
||||
showOverlapToggleButton = false,
|
||||
showGridLines = true,
|
||||
zoomLevel = 1.0,
|
||||
language_code = "en",
|
||||
isLambda = false
|
||||
)
|
||||
}
|
||||
|
||||
private fun callAdapter() {
|
||||
db?.open()
|
||||
listdat = db?.getirVisibilityData(date,store_id,categoryId)
|
||||
|
||||
Log.d("listdatsize", listdat?.size.toString())
|
||||
adapter = SubCatPdAdapter(
|
||||
category = categoryName,
|
||||
context = this,
|
||||
subcates = ArrayList(),
|
||||
btnlistener = object : SubCatPdAdapter.BtnClickListener {
|
||||
override fun onStartSessionClick(_pos: Int, data: CategoryPictureGetterSetter) {
|
||||
this@PDVisibilityActivity._pos = _pos
|
||||
launchCamera(data.subCatCode)
|
||||
Log.d("subCatCode", data.subCatCode)
|
||||
|
||||
}
|
||||
})
|
||||
binding.rlContent.apply {
|
||||
recyclerViewSubCat.adapter = adapter
|
||||
recyclerViewSubCat.layoutManager = LinearLayoutManager(this@PDVisibilityActivity)
|
||||
adapter?.addsubCatItems(listdat)
|
||||
}
|
||||
}
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
db?.open()
|
||||
if (!db!!.isPdVisibility(store_id, date, CommonString.KEY_COMPELETE, categoryId)) {
|
||||
db?.InsertPdImageVisibilityData(date, store_id, categoryId, listdat, CommonString.KEY_DRAFT)
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkAndRequestPermissions() {
|
||||
var read_phone_state = 0
|
||||
var write_storage = 0
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
write_storage =
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.READ_MEDIA_IMAGES)
|
||||
} else {
|
||||
read_phone_state =
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE)
|
||||
write_storage =
|
||||
ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
}
|
||||
|
||||
val listPermissionsNeeded: MutableList<String> = java.util.ArrayList()
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
if (write_storage != PackageManager.PERMISSION_GRANTED) {
|
||||
listPermissionsNeeded.add(Manifest.permission.READ_MEDIA_IMAGES)
|
||||
}
|
||||
} else {
|
||||
if (write_storage != PackageManager.PERMISSION_GRANTED) {
|
||||
listPermissionsNeeded.add(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
}
|
||||
}
|
||||
|
||||
if (listPermissionsNeeded.isNotEmpty()) {
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
listPermissionsNeeded.toTypedArray<String>(),
|
||||
PERMISSION_ALL
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<String>,
|
||||
grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (requestCode == PERMISSION_ALL) {
|
||||
val perms: MutableMap<String, Int> = HashMap()
|
||||
// Initialize the map with both permissions
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
perms[Manifest.permission.READ_MEDIA_IMAGES] = PackageManager.PERMISSION_GRANTED
|
||||
} else {
|
||||
perms[Manifest.permission.WRITE_EXTERNAL_STORAGE] =
|
||||
PackageManager.PERMISSION_GRANTED
|
||||
}
|
||||
// Fill with actual results from user
|
||||
if (grantResults.isNotEmpty()) {
|
||||
for (i in permissions.indices) perms[permissions[i]] = grantResults[i]
|
||||
// Check for both permissions//
|
||||
if (perms[Manifest.permission.READ_MEDIA_IMAGES] == PackageManager.PERMISSION_GRANTED &&
|
||||
perms[Manifest.permission.WRITE_EXTERNAL_STORAGE] == PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
Log.d("", "sms & location services permission granted")
|
||||
} else {
|
||||
Log.d("", "Some permissions are not granted ask again ")
|
||||
if (ActivityCompat.shouldShowRequestPermissionRationale(
|
||||
this,
|
||||
Manifest.permission.READ_MEDIA_IMAGES
|
||||
) ||
|
||||
ActivityCompat.shouldShowRequestPermissionRationale(
|
||||
this,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE
|
||||
)
|
||||
) {
|
||||
showDialogOK(
|
||||
"Photos or media Service Permission required for this app"
|
||||
) { _: DialogInterface?, which: Int ->
|
||||
when (which) {
|
||||
DialogInterface.BUTTON_POSITIVE -> checkAndRequestPermissions()
|
||||
DialogInterface.BUTTON_NEGATIVE -> {
|
||||
// proceed with logic by disabling the related features or quit the app.
|
||||
val startMain =
|
||||
Intent(Intent.ACTION_MAIN)
|
||||
startMain.addCategory(Intent.CATEGORY_HOME)
|
||||
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
startActivity(startMain)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showDialogOK(message: String, okListener: DialogInterface.OnClickListener) {
|
||||
AlertDialog.Builder(this).setMessage(message).setPositiveButton("OK", okListener)
|
||||
.setNegativeButton("Cancel", okListener).create().show()
|
||||
}
|
||||
}
|
||||
@@ -346,6 +346,7 @@ class PDimageActivity : AppCompatActivity() {
|
||||
override fun onStartSessionClick(_pos: Int, data: CategoryPictureGetterSetter) {
|
||||
this@PDimageActivity._pos = _pos
|
||||
launchCamera(data.subCatCode)
|
||||
Log.d("subCatCode", data.subCatCode)
|
||||
}
|
||||
})
|
||||
binding.rlContent.apply {
|
||||
|
||||
-6
@@ -469,9 +469,6 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
|
||||
|
||||
SoapObject request = new SoapObject(CommonString.NAMESPACE,
|
||||
CommonString.METHOD_UPLOAD_CURRENT_DATA);
|
||||
//request.addProperty("MID", "0");
|
||||
// request.addProperty("KEYS", "CURRENT_DATA");
|
||||
// request.addProperty("USERNAME", username);
|
||||
|
||||
request.addProperty("onXML", current_xml);
|
||||
|
||||
@@ -580,13 +577,10 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
|
||||
|
||||
//showAlert(getString(R.string.data_downloaded_successfully));
|
||||
} else {
|
||||
|
||||
GSKOrangeDB db = new GSKOrangeDB(StoreCheckoutImageActivity.this);
|
||||
db.open();
|
||||
|
||||
dialog.dismiss();
|
||||
db.deleteTableWithStoreID(store_id);
|
||||
|
||||
showAlert(getString(R.string.datanotfound) + " " + result);
|
||||
}
|
||||
}
|
||||
|
||||
+28
-2
@@ -492,6 +492,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<CategoryPictureGetterSetter> irVisibilityList = isPdVisibiltyMapping(category_id);
|
||||
if (irVisibilityList != null && !irVisibilityList.isEmpty() && camera_allow.equals("1")) {
|
||||
if (!db.isPdVisibility(store_id, visit_date, CommonString.KEY_COMPELETE, category_id)) {
|
||||
flag_filled = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
flag_filled = true;
|
||||
} else {
|
||||
flag_filled = false;
|
||||
@@ -517,6 +525,19 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
return ir_list;
|
||||
}
|
||||
|
||||
private ArrayList<CategoryPictureGetterSetter> isPdVisibiltyMapping(String categoryId) {
|
||||
ArrayList<CategoryPictureGetterSetter> ir_list;
|
||||
if (country_id.equals("8")) {
|
||||
ir_list = db.getirVisibilityData(date,store_id,categoryId);
|
||||
} else if (store_flag_str != null && store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
ir_list = db.getirVisibilityData(date,store_id,categoryId);
|
||||
} else {
|
||||
ir_list = db.getirVisibilityData(date,store_id,categoryId);
|
||||
}
|
||||
|
||||
return ir_list;
|
||||
}
|
||||
|
||||
private boolean isCategoryComplete(String category_id) {
|
||||
boolean flag_filled = true;
|
||||
|
||||
@@ -605,8 +626,14 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<CategoryPictureGetterSetter> irvisiList = isPdVisibiltyMapping(category_id);
|
||||
if (irvisiList != null && !irvisiList.isEmpty() && camera_allow.equals("1")) {
|
||||
if (!db.isPdVisibility(store_id, visit_date, CommonString.KEY_COMPELETE, category_id)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flag_filled;
|
||||
}
|
||||
|
||||
@@ -625,7 +652,6 @@ public class CategoryListActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return flag_filled;
|
||||
}
|
||||
|
||||
|
||||
+69
-31
@@ -21,6 +21,7 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -49,6 +50,7 @@ import cpm.com.gskmtorange.dailyentry.CounterfeitProductsActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.CreateSelfActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.NewStockDataActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.OrderTakingActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.PDVisibilityActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.PDimageActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.POGQuestionsActivity;
|
||||
import cpm.com.gskmtorange.dailyentry.StockActivity;
|
||||
@@ -476,7 +478,6 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
if (categoryId.equals("2")) {
|
||||
if (country_id.equals("6")) {
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
|
||||
if (db.getCompetitionPromoExistsAfterData(store_id, categoryId).size() > 0) {
|
||||
data.setCategory_img(R.mipmap.competition_done);
|
||||
} else {
|
||||
@@ -485,6 +486,11 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
|
||||
data.setCategory_name(getString(R.string.title_activity_competition_promo));
|
||||
categoryList.add(data);
|
||||
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
data.setCategory_img(R.mipmap.competition);
|
||||
data.setCategory_name("");
|
||||
categoryList.add(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -494,10 +500,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
if (ir_list != null && !ir_list.isEmpty() && camera_allow.equals("1")) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory);
|
||||
db.open();
|
||||
/*if (db.isFilledIRPDdata(store_id, visit_date, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory_done);
|
||||
}*/
|
||||
if (db.isSOSCategory(store_id, visit_date, CommonString.KEY_COMPELETE,categoryId)){
|
||||
if (db.isSOSCategory(store_id, visit_date, CommonString.KEY_COMPELETE, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory_done);
|
||||
}
|
||||
} else {
|
||||
@@ -506,7 +509,24 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
data.setCategory_name(getResources()
|
||||
.getString(R.string.title_activity_ir_image));
|
||||
categoryList.add(data);
|
||||
|
||||
//IR Visibility
|
||||
data = new DailyDataMenuGetterSetter();
|
||||
ArrayList<CategoryPictureGetterSetter> ir_visibility = isPdVisibiltyMapping();
|
||||
if (ir_visibility != null && !ir_visibility.isEmpty() && camera_allow.equals("1")) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory);
|
||||
db.open();
|
||||
if (db.isPdVisibility(store_id, visit_date, CommonString.KEY_COMPELETE, categoryId)) {
|
||||
data.setCategory_img(R.mipmap.picturecatogory_done);
|
||||
}
|
||||
} else {
|
||||
data.setCategory_img(R.mipmap.picturecatogory_grey);
|
||||
}
|
||||
|
||||
}
|
||||
data.setCategory_name(getResources()
|
||||
.getString(R.string.title_activity_ir_visibility));
|
||||
categoryList.add(data);
|
||||
|
||||
adapter = new DailyDataMenuAdapter(DailyDataMenuActivity.this, categoryList);
|
||||
recyclerView.setAdapter(adapter);
|
||||
@@ -615,6 +635,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
final DailyDataMenuGetterSetter dailyData = list.get(position);
|
||||
holder.categoryName.setText(dailyData.getCategory_name());
|
||||
holder.categoryIcon.setImageResource(dailyData.getCategory_img());
|
||||
holder.irview.setVisibility(View.GONE);
|
||||
db.open();
|
||||
visittypelist = db.getInsertedVisitType(store_id, visit_date, "3");
|
||||
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
|
||||
@@ -701,11 +722,25 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
holder.categoryName.setTextColor(ContextCompat.getColor(context, R.color.grey_background));
|
||||
}
|
||||
}
|
||||
} else if (dailyData.getCategory_name().equalsIgnoreCase(getString(R.string.title_activity_ir_image))) {
|
||||
}
|
||||
else if(dailyData.getCategory_name().equalsIgnoreCase("")){
|
||||
holder.lay_menu.setVisibility(View.GONE);
|
||||
holder.irview.setVisibility(View.GONE);
|
||||
holder.categoryName.setVisibility(View.GONE);
|
||||
}
|
||||
else if (dailyData.getCategory_name().equalsIgnoreCase(getString(R.string.title_activity_ir_image))) {
|
||||
holder.irview.setVisibility(View.VISIBLE);
|
||||
holder.categoryName.setTextColor(isPdIRMapping() != null && !isPdIRMapping().isEmpty() && camera_allow.equals("1")
|
||||
? ContextCompat.getColor(context, R.color.black) : ContextCompat.getColor(context, R.color.grey_background));
|
||||
}
|
||||
|
||||
else if (dailyData.getCategory_name().equalsIgnoreCase(getString(R.string.title_activity_ir_visibility))) {
|
||||
holder.irview.setVisibility(View.VISIBLE);
|
||||
holder.categoryName.setTextColor(isPdVisibiltyMapping() != null && !isPdVisibiltyMapping().isEmpty() && camera_allow.equals("1")
|
||||
? ContextCompat.getColor(context, R.color.black) : ContextCompat.getColor(context, R.color.grey_background));
|
||||
}
|
||||
else{
|
||||
holder.irview.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
holder.lay_menu.setOnClickListener(view -> {
|
||||
if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.daily_data_menu_promo_compliance))) {
|
||||
@@ -781,7 +816,18 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
}
|
||||
} else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.order_taking))) {
|
||||
}
|
||||
else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.title_activity_ir_visibility))) {
|
||||
if (isPdIRMapping() != null && !isPdIRMapping().isEmpty() && camera_allow.equals("1")) {
|
||||
Intent intent = new Intent(DailyDataMenuActivity.this, PDVisibilityActivity.class);
|
||||
intent.putExtra("kpi_name", dailyData.getCategory_name());
|
||||
intent.putExtra("categoryName", categoryName);
|
||||
intent.putExtra("categoryId", categoryId);
|
||||
startActivity(intent);
|
||||
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
|
||||
}
|
||||
}
|
||||
else if (dailyData.getCategory_name().equalsIgnoreCase(getResources().getString(R.string.order_taking))) {
|
||||
if (isMappingStockData()) {
|
||||
Intent intent = new Intent(DailyDataMenuActivity.this, OrderTakingActivity.class);
|
||||
intent.putExtra("categoryName", dailyData.getCategory_name());
|
||||
@@ -898,12 +944,16 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
TextView categoryName;
|
||||
ImageView categoryIcon;
|
||||
LinearLayout lay_menu;
|
||||
View irview;
|
||||
CardView cardView;
|
||||
|
||||
public MyViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
categoryName = (TextView) itemView.findViewById(R.id.categoryName);
|
||||
categoryIcon = (ImageView) itemView.findViewById(R.id.categoryIcon);
|
||||
lay_menu = (LinearLayout) itemView.findViewById(R.id.lay_menu);
|
||||
irview = itemView.findViewById(R.id.irview);
|
||||
cardView = itemView.findViewById(R.id.cardView);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -959,29 +1009,17 @@ public class DailyDataMenuActivity extends AppCompatActivity {
|
||||
return ir_list;
|
||||
}
|
||||
|
||||
/* private void check() {
|
||||
////IRPD-Upload Data
|
||||
String irPD_xmlData = "";
|
||||
String onXML = "";
|
||||
ArrayList<CategoryPictureGetterSetter> irdata = db.getIrPDforUpload(store_id, visit_date);
|
||||
if (irdata != null && !irdata.isEmpty()) {
|
||||
|
||||
for (int j = 0; j < irdata.size(); j++) {
|
||||
onXML = "[IR_DATA]"
|
||||
+ "[MID]" + 0 + "[/MID]"
|
||||
+ "[USERID]" + username + "[/USERID]"
|
||||
+ "[CATEGORY_ID]" + irdata.get(j).getCategoryId() + "[/CATEGORY_ID]"
|
||||
+ "[SUB_CATEGORY_ID]" + irdata.get(j).getSUB_CATEGORY_ID() + "[/SUB_CATEGORY_ID]"
|
||||
+ "[SUB_CATEGORY_CODE]" + irdata.get(j).getSubCatCode() + "[/SUB_CATEGORY_CODE]"
|
||||
+ "[IR_IMAGES]" + irdata.get(j).getSubCategoryCamera2() + "[/IR_IMAGES]"
|
||||
+ "[/IR_DATA]";
|
||||
|
||||
irPD_xmlData = irPD_xmlData + onXML;
|
||||
}
|
||||
|
||||
final String irpd_xml = "[DATA]" + irPD_xmlData + "[/DATA]";
|
||||
Log.e("irpd_xml",irpd_xml);
|
||||
private ArrayList<CategoryPictureGetterSetter> isPdVisibiltyMapping() {
|
||||
ArrayList<CategoryPictureGetterSetter> ir_list;
|
||||
if (country_id.equals("6")) {
|
||||
ir_list = db.getirVisibilityData(date,store_id,categoryId);
|
||||
} else if (store_flag_str != null && store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
|
||||
ir_list = db.getirVisibilityData(date,store_id,categoryId);
|
||||
} else {
|
||||
ir_list = db.getirVisibilityData(date,store_id,categoryId);
|
||||
}
|
||||
}*/
|
||||
return ir_list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1810,6 +1810,34 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
|
||||
data.name = getString(R.string.ir_data_upload);
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
////IRPDVisibility-Upload Data
|
||||
String irPD_visi_xmlData = "";
|
||||
onXML = "";
|
||||
ArrayList<CategoryPictureGetterSetter> ir_visi_data = db.getIrPDVisibilityforUpload(coverageList.get(i).getStoreId(), coverageList.get(i).getVisitDate());
|
||||
if (ir_visi_data != null && !ir_visi_data.isEmpty()) {
|
||||
for (int j = 0; j < ir_visi_data.size(); j++) {
|
||||
onXML = "[IR_VISIBILITY_DATA]" + "[MID]" + mid + "[/MID]" + "[USERID]" + userId + "[/USERID]" + "[CATEGORY_ID]" + ir_visi_data.get(j).getCategoryId() + "[/CATEGORY_ID]" + "[SUB_CATEGORY_ID]" + ir_visi_data.get(j).getSUB_CATEGORY_ID() + "[/SUB_CATEGORY_ID]" + "[SUB_CATEGORY_CODE]" + ir_visi_data.get(j).getSubCatCode() + "[/SUB_CATEGORY_CODE]" + "[IR_VISIBILITY_IMAGES]" + ir_visi_data.get(j).getSubCategoryCamera2() + "[/IR_VISIBILITY_IMAGES]" + "[/IR_VISIBILITY_DATA]";
|
||||
irPD_visi_xmlData = irPD_visi_xmlData + onXML;
|
||||
}
|
||||
final String irpd_xml = "[DATA]" + irPD_visi_xmlData + "[/DATA]";
|
||||
Log.e("irpd_visi_xml_data", irPD_visi_xmlData);
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||
request.addProperty("XMLDATA", irpd_xml);
|
||||
request.addProperty("KEYS", "IRPD_VISIBILITY_DATA_XML");
|
||||
request.addProperty("USERNAME", userId);
|
||||
request.addProperty("MID", mid);
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
result = envelope.getResponse();
|
||||
}
|
||||
data.value = 72;
|
||||
data.name = getString(R.string.ir_visibility_data_upload);
|
||||
publishProgress(data);
|
||||
|
||||
String visit_xml = "";
|
||||
onXML = "";
|
||||
ArrayList<Visit_Type_Master_GetterSetter> visittypelist = db.getUploadedVisitType(coverageList.get(i).getStoreId());
|
||||
|
||||
@@ -1494,7 +1494,6 @@ public class UploadActivity extends AppCompatActivity {
|
||||
data.name = getString(R.string.order_received_data_uploading);
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
////IRPD-Upload Data
|
||||
String irPD_xmlData = "";
|
||||
onXML = "";
|
||||
@@ -1502,10 +1501,8 @@ public class UploadActivity extends AppCompatActivity {
|
||||
if (irdata != null && !irdata.isEmpty()) {
|
||||
for (int j = 0; j < irdata.size(); j++) {
|
||||
onXML = "[IR_DATA]" + "[MID]" + mid + "[/MID]" + "[USERID]" + userId + "[/USERID]" + "[CATEGORY_ID]" + irdata.get(j).getCategoryId() + "[/CATEGORY_ID]" + "[SUB_CATEGORY_ID]" + irdata.get(j).getSUB_CATEGORY_ID() + "[/SUB_CATEGORY_ID]" + "[SUB_CATEGORY_CODE]" + irdata.get(j).getSubCatCode() + "[/SUB_CATEGORY_CODE]" + "[IR_IMAGES]" + irdata.get(j).getSubCategoryCamera2() + "[/IR_IMAGES]" + "[/IR_DATA]";
|
||||
|
||||
irPD_xmlData = irPD_xmlData + onXML;
|
||||
}
|
||||
|
||||
final String irpd_xml = "[DATA]" + irPD_xmlData + "[/DATA]";
|
||||
Log.e("irp_xml_data", irpd_xml);
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||
@@ -1513,22 +1510,46 @@ public class UploadActivity extends AppCompatActivity {
|
||||
request.addProperty("KEYS", "IR_DATA_XML");
|
||||
request.addProperty("USERNAME", userId);
|
||||
request.addProperty("MID", mid);
|
||||
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
result = envelope.getResponse();
|
||||
|
||||
}
|
||||
|
||||
data.value = 71;
|
||||
data.name = getString(R.string.ir_data_upload);
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
////IRPDVisibility-Upload Data
|
||||
String irPD_visi_xmlData = "";
|
||||
onXML = "";
|
||||
ArrayList<CategoryPictureGetterSetter> ir_visi_data = db.getIrPDVisibilityforUpload(coverageList.get(i).getStoreId(), coverageList.get(i).getVisitDate());
|
||||
if (ir_visi_data != null && !ir_visi_data.isEmpty()) {
|
||||
for (int j = 0; j < ir_visi_data.size(); j++) {
|
||||
onXML = "[IR_VISIBILITY_DATA]" + "[MID]" + mid + "[/MID]" + "[USERID]" + userId + "[/USERID]" + "[CATEGORY_ID]" + ir_visi_data.get(j).getCategoryId() + "[/CATEGORY_ID]" + "[SUB_CATEGORY_ID]" + ir_visi_data.get(j).getSUB_CATEGORY_ID() + "[/SUB_CATEGORY_ID]" + "[SUB_CATEGORY_CODE]" + ir_visi_data.get(j).getSubCatCode() + "[/SUB_CATEGORY_CODE]" + "[IR_VISIBILITY_IMAGES]" + ir_visi_data.get(j).getSubCategoryCamera2() + "[/IR_VISIBILITY_IMAGES]" + "[/IR_VISIBILITY_DATA]";
|
||||
irPD_visi_xmlData = irPD_visi_xmlData + onXML;
|
||||
}
|
||||
final String irpd_xml = "[DATA]" + irPD_visi_xmlData + "[/DATA]";
|
||||
Log.e("irpd_visi_xml_data", irPD_visi_xmlData);
|
||||
request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_UPLOAD_STOCK_XML_DATA);
|
||||
request.addProperty("XMLDATA", irpd_xml);
|
||||
request.addProperty("KEYS", "IRPD_VISIBILITY_DATA_XML");
|
||||
request.addProperty("USERNAME", userId);
|
||||
request.addProperty("MID", mid);
|
||||
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
|
||||
envelope.dotNet = true;
|
||||
envelope.setOutputSoapObject(request);
|
||||
androidHttpTransport = new HttpTransportSE(CommonString.URL);
|
||||
androidHttpTransport.call(CommonString.SOAP_ACTION + CommonString.METHOD_UPLOAD_STOCK_XML_DATA, envelope);
|
||||
result = envelope.getResponse();
|
||||
}
|
||||
data.value = 72;
|
||||
data.name = getString(R.string.ir_visibility_data_upload);
|
||||
publishProgress(data);
|
||||
|
||||
|
||||
String visit_xml = "";
|
||||
onXML = "";
|
||||
ArrayList<Visit_Type_Master_GetterSetter> visittypelist = db.getUploadedVisitType(coverageList.get(i).getStoreId());
|
||||
|
||||
@@ -124,15 +124,18 @@ public class UploadImageWithRetrofit {
|
||||
foldername = "CounterFeitImages";
|
||||
} else if (file[i].getName().contains("POImage")) {//added 15.04.2019
|
||||
foldername = "POImages";
|
||||
} else if (file[i].getName().contains("_IRPDIMG-")) {//added 15.04.2019
|
||||
foldername = "IRPD_Image";
|
||||
} else {
|
||||
}
|
||||
else if (file[i].getName().contains("_IRPDIMG-")) {//added 15.04.2019
|
||||
foldername = "IR_Images";
|
||||
}
|
||||
else if (file[i].getName().contains("_IRPD_VISI_IMG-")) {
|
||||
foldername = "IR_VisibilityImages";
|
||||
}
|
||||
else {
|
||||
foldername = "Bulkimages";
|
||||
}
|
||||
|
||||
filename = file[i].getName();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user