Browse Source

DESIGN implement api's

pms_issue/31163_FaceVerification
Tamojit Biswas 1 year ago
parent
commit
682e5f503c
16 changed files with 1090 additions and 257 deletions
  1. +237
    -31
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/ApprovalListActivity.java
  2. +1
    -1
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java
  3. +165
    -18
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/LeaveRequestDetailsActivity.java
  4. +72
    -43
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/PermissionRequestActivity.java
  5. +188
    -48
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/ReportActivity.java
  6. +13
    -64
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/ReportDetailsActivity.java
  7. +105
    -0
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/models/ApprovalModel.java
  8. +46
    -0
      examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/models/ReportModel.java
  9. +4
    -3
      examples/example_bestshot/example/app/src/main/res/layout/activity_approval_new_list.xml
  10. +36
    -17
      examples/example_bestshot/example/app/src/main/res/layout/activity_leave_request_details.xml
  11. +30
    -29
      examples/example_bestshot/example/app/src/main/res/layout/activity_permission_request.xml
  12. +10
    -1
      examples/example_bestshot/example/app/src/main/res/layout/activity_report.xml
  13. +13
    -0
      examples/example_bestshot/example/app/src/main/res/layout/dialog_approve.xml
  14. +2
    -2
      examples/example_bestshot/example/app/src/main/res/layout/layout.xml
  15. +1
    -0
      examples/example_bestshot/example/app/src/main/res/layout/listview_layout.xml
  16. +167
    -0
      examples/example_bestshot/example/app/src/main/res/layout/report_list.xml

+ 237
- 31
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/ApprovalListActivity.java View File

@ -2,13 +2,20 @@ package ru.visionlab.femdemo;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListAdapter; import android.widget.ListAdapter;
import android.widget.ListView; import android.widget.ListView;
import android.widget.SimpleAdapter; import android.widget.SimpleAdapter;
@ -24,8 +31,13 @@ import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import cn.pedant.SweetAlert.SweetAlertDialog;
import ru.visionlab.femdemo.models.ApprovalModel;
public class ApprovalListActivity extends AppCompatActivity { public class ApprovalListActivity extends AppCompatActivity {
@ -35,9 +47,12 @@ public class ApprovalListActivity extends AppCompatActivity {
String RequestID,EmployeeID,EmployeeName,LDate,LTimeOut,LTimeIn,NoOfHrs,LeaveType,ApproverID,ApproverName,Reason; String RequestID,EmployeeID,EmployeeName,LDate,LTimeOut,LTimeIn,NoOfHrs,LeaveType,ApproverID,ApproverName,Reason;
ListView lv; ListView lv;
ArrayList<HashMap<String,String>> arrayList;
boolean isreject;
ArrayList<ApprovalModel> arrayList=new ArrayList<ApprovalModel>();
String Employeeid;
String Employeeid,RegisterUser;
EditText ed_remarks;
private String permissionid;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -47,6 +62,8 @@ public class ApprovalListActivity extends AppCompatActivity {
SharedPreferences shared = getSharedPreferences("MyPrefs", MODE_PRIVATE); SharedPreferences shared = getSharedPreferences("MyPrefs", MODE_PRIVATE);
Employeeid = shared.getString("Employeeid", ""); Employeeid = shared.getString("Employeeid", "");
RegisterUser = shared.getString("RegisterUser", "");
back = findViewById(R.id.back); back = findViewById(R.id.back);
back.setOnClickListener(new View.OnClickListener() { back.setOnClickListener(new View.OnClickListener() {
@ -57,7 +74,7 @@ public class ApprovalListActivity extends AppCompatActivity {
} }
}); });
arrayList=new ArrayList<>();
arrayList=new ArrayList<ApprovalModel>();
lv = findViewById(R.id.listview); lv = findViewById(R.id.listview);
@ -90,38 +107,59 @@ public class ApprovalListActivity extends AppCompatActivity {
try { try {
arrayList.clear();
JSONArray jsonArray=new JSONArray(response); JSONArray jsonArray=new JSONArray(response);
for(int i = 0;i<jsonArray.length();i++){
JSONObject jb1=jsonArray.getJSONObject(0);
RequestID = jb1.getString("RequestID");
EmployeeID = jb1.getString("EmployeeID");
EmployeeName = jb1.getString("EmployeeName");
LDate = jb1.getString("LDate");
LTimeOut = jb1.getString("LTimeOut");
LTimeIn = jb1.getString("LTimeIn");
NoOfHrs = jb1.getString("NoOfHrs");
LeaveType = jb1.getString("LeaveType");
ApproverID = jb1.getString("ApproverID");
ApproverName = jb1.getString("ApproverName");
Reason = jb1.getString("Reason");
HashMap<String,String> data = new HashMap<>();
data.put("EmployeeName",EmployeeName);
data.put("EmployeeID",EmployeeID);
data.put("LeaveType",LeaveType);
data.put("ApproverName",ApproverName);
arrayList.add(data);
ListAdapter adapter = new SimpleAdapter(ApprovalListActivity.this,arrayList,R.layout.listview_layout
,new String[]{"EmployeeName","EmployeeID","LeaveType","ApproverName"},new int[]{R.id.EmployeeNameVal,R.id.EmployeeIDVal,R.id.LeaveTypeVal,R.id.ApproverNameVal});
lv.setAdapter(adapter);
for(int i = 0;i<jsonArray.length();i++) {
JSONObject jb1 = jsonArray.getJSONObject(i);
RequestID = jb1.getString("RequestID");
EmployeeID = jb1.getString("EmployeeID");
EmployeeName = jb1.getString("EmployeeName");
LDate = jb1.getString("LDate");
LTimeOut = jb1.getString("LTimeOut");
LTimeIn = jb1.getString("LTimeIn");
NoOfHrs = jb1.getString("NoOfHrs");
LeaveType = jb1.getString("LeaveType");
ApproverID = jb1.getString("ApproverID");
ApproverName = jb1.getString("ApproverName");
Reason = jb1.getString("Reason");
// HashMap<String,String> data = new HashMap<>();
// data.put("EmployeeName",EmployeeName);
// data.put("EmployeeID",EmployeeID);
// data.put("LeaveType",LeaveType);
// data.put("ApproverName",ApproverName);
ApprovalModel approvalModel = new ApprovalModel();
approvalModel.setApproverID(jb1.getString("ApproverID"));
approvalModel.setRequestID(jb1.getString("RequestID"));
approvalModel.setEmployeeID(jb1.getString("EmployeeID"));
approvalModel.setEmployeeName(jb1.getString("EmployeeName"));
approvalModel.setLDate(jb1.getString("LDate"));
approvalModel.setLTimeOut(jb1.getString("LTimeOut"));
approvalModel.setLTimeIn(jb1.getString("LTimeIn"));
approvalModel.setNoOfHrs(jb1.getString("NoOfHrs"));
approvalModel.setLeaveType(jb1.getString("LeaveType"));
approvalModel.setApproverName(jb1.getString("ApproverName"));
approvalModel.setReason(jb1.getString("Reason"));
arrayList.add(approvalModel);
}
// ListAdapter adapter = new SimpleAdapter(ApprovalListActivity.this,arrayList,R.layout.listview_layout
// ,new String[]{"EmployeeName","EmployeeID","LeaveType","ApproverName"},new int[]{R.id.EmployeeNameVal,R.id.EmployeeIDVal,R.id.LeaveTypeVal,R.id.ApproverNameVal});
// lv.setAdapter(adapter);
// ArrayAdapter<ApprovalModel> adapter = new ArrayAdapter<ApprovalModel>(getApplicationContext(),R.layout.listview_layout,arrayList);
lv.setAdapter(new Nr());
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override @Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
ApprovalModel approvalModel=arrayList.get(i);
Intent intent = new Intent(ApprovalListActivity.this,LeaveRequestDetailsActivity.class); Intent intent = new Intent(ApprovalListActivity.this,LeaveRequestDetailsActivity.class);
Bundle bundle=new Bundle();
bundle.putSerializable("Approvaldata", (Serializable) approvalModel);
intent.putExtras(bundle);
startActivity(intent); startActivity(intent);
} }
}); });
@ -137,11 +175,158 @@ public class ApprovalListActivity extends AppCompatActivity {
ApproverIDVal.setText(ApproverID); ApproverIDVal.setText(ApproverID);
ApproverNameVal.setText(ApproverName); ApproverNameVal.setText(ApproverName);
ReasonVal.setText(Reason); ReasonVal.setText(Reason);
*/ }
*/
} catch (JSONException e) {
throw new RuntimeException(e);
}
loading.dismiss();
}
}, new com.android.volley.Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Log.d("error-=>",error.getMessage());
Toast.makeText(ApprovalListActivity.this, "Failed to get response = " + error.getMessage(), Toast.LENGTH_SHORT).show();
loading.dismiss();
System.out.println("Error message: "+ error.getMessage());
}
})
{
};
Volley.newRequestQueue(ApprovalListActivity.this).add(stringRequest);
}
private class Nr extends BaseAdapter {
@Override
public int getCount() {
return arrayList.size();
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getLayoutInflater();
View v = inflater.inflate(R.layout.listview_layout, null);
TextView EmployeeNameVal=v.findViewById(R.id.EmployeeNameVal);
TextView EmployeeIDVal=v.findViewById(R.id.EmployeeIDVal);
TextView LeaveTypeVal=v.findViewById(R.id.LeaveTypeVal);
TextView ApproverNameVal=v.findViewById(R.id.ApproverNameVal);
LinearLayout ll_approve=v.findViewById(R.id.ll_approve);
EmployeeNameVal.setText(arrayList.get(position).getEmployeeName());
EmployeeIDVal.setText(arrayList.get(position).getEmployeeID());
LeaveTypeVal.setText(arrayList.get(position).getLeaveType());
ApproverNameVal.setText(arrayList.get(position).getApproverName());
permissionid=arrayList.get(position).getRequestID();
// ll_approve.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// isreject=false;
// AlertDialog.Builder builder = new AlertDialog.Builder(ApprovalListActivity.this);
// builder.setTitle("Remarks");
// builder.setCancelable(false);
//
// // set the custom layout
// final View customLayout = getLayoutInflater().inflate(R.layout.dialog_approve, null);
// builder.setView(customLayout);
//
// // add a button
// builder.setPositiveButton("Save", (dialog, which) -> {
// // send data from the AlertDialog to the Activity
// ed_remarks = customLayout.findViewById(R.id.ed_remarks);
//
// if(ed_remarks.getText().toString().isEmpty())
// {
// Toast.makeText(ApprovalListActivity.this, "Please enter remars", Toast.LENGTH_SHORT).show();
// builder.show();
// return;
//
// }
// else {
// PermissionApprovalAction();
// }
//
// });
// // create and show the alert dialog
// AlertDialog dialog = builder.create();
// dialog.show();
// }
// });
return v;
}
}
public void PermissionApprovalAction(){
final ProgressDialog loading = ProgressDialog.show(ApprovalListActivity.this, "Fetching information", "Please wait ", false, false);
String url= "http://43.242.212.92:7001/api/lgt/PermissionApprovalAction";
StringRequest stringRequest=new StringRequest(Request.Method.POST, url, new com.android.volley.Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject = new JSONObject(response);
String _statusMessage = jsonObject.getString("_statusMessage");
String _statusCode=jsonObject.getString("_statusCode");
if(_statusCode.equals("200"))
{
String message;
if(isreject)
{
message="Leave Rejected";
}
else {
message="Leave Approved";
}
new SweetAlertDialog(ApprovalListActivity.this, SweetAlertDialog.SUCCESS_TYPE)
.setTitleText(message)
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sDialog) {
sDialog.dismissWithAnimation();
PermissionApprovalList();
}
}).show();
}
else
{
Toast.makeText(ApprovalListActivity.this, _statusMessage, Toast.LENGTH_LONG).show();
}
} catch (JSONException e) { } catch (JSONException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
loading.dismiss(); loading.dismiss();
} }
@ -157,8 +342,29 @@ public class ApprovalListActivity extends AppCompatActivity {
} }
}) })
{ {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
params.put("permissionID",permissionid);
params.put("approverID", Employeeid);
params.put("actionby", RegisterUser);
params.put("remark", ed_remarks.getText().toString());
if(isreject)
{
params.put("actionflag", "R");
}
else
{
params.put("actionflag", "A");
}
System.out.println("params in Approve "+params);
return params;
}
}; };
Volley.newRequestQueue(ApprovalListActivity.this).add(stringRequest); Volley.newRequestQueue(ApprovalListActivity.this).add(stringRequest);
} }
}
}

+ 1
- 1
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/CheckInActivity.java View File

@ -365,7 +365,7 @@ public class CheckInActivity extends AppCompatActivity {
new SweetAlertDialog(CheckInActivity.this, SweetAlertDialog.SUCCESS_TYPE) new SweetAlertDialog(CheckInActivity.this, SweetAlertDialog.SUCCESS_TYPE)
.setTitleText(valueFromApiCheckIn) .setTitleText(valueFromApiCheckIn)
.setConfirmText("OK")
.setConfirmText("Successfully Login")
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() { .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override @Override
public void onClick(SweetAlertDialog sDialog) { public void onClick(SweetAlertDialog sDialog) {


+ 165
- 18
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/LeaveRequestDetailsActivity.java View File

@ -2,13 +2,18 @@ package ru.visionlab.femdemo;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.android.volley.Request; import com.android.volley.Request;
@ -23,21 +28,44 @@ import org.json.JSONObject;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import cn.pedant.SweetAlert.SweetAlertDialog;
import ru.visionlab.femdemo.R; import ru.visionlab.femdemo.R;
import ru.visionlab.femdemo.models.ApprovalModel;
public class LeaveRequestDetailsActivity extends AppCompatActivity { public class LeaveRequestDetailsActivity extends AppCompatActivity {
Button btnapprove,btnreject;
Button btnapprove,btnreject,btn_leav_type;
ImageButton back; ImageButton back;
TextView emp_name,leavtype,leavdate,hours,txt_time_in,txt_time_out,txt_approver_name,txt_reason;
ApprovalModel approvalModel;
String empname,LeaveType,LDate,NoOfHrs,LTimeIn,LTimeOut,ApproverName,Reason;
String[] separated;
private String Employeeid;
private String RegisterUser,permissionID;
EditText ed_remarks;
boolean isreject;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_leave_request_details); setContentView(R.layout.activity_leave_request_details);
back = findViewById(R.id.back); back = findViewById(R.id.back);
emp_name = findViewById(R.id.emp_name);
leavtype = findViewById(R.id.leavtype);
leavdate = findViewById(R.id.leavdate);
btn_leav_type = findViewById(R.id.btn_leav_type);
hours = findViewById(R.id.hours);
txt_time_in = findViewById(R.id.txt_time_in);
txt_time_out = findViewById(R.id.txt_time_out);
txt_approver_name = findViewById(R.id.txt_approver_name);
txt_reason = findViewById(R.id.txt_reason);
btnapprove = findViewById(R.id.btnapprove);
btnreject = findViewById(R.id.btnreject);
back.setOnClickListener(new View.OnClickListener() { back.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -45,19 +73,110 @@ public class LeaveRequestDetailsActivity extends AppCompatActivity {
} }
}); });
btnapprove = findViewById(R.id.btnapprove);
approvalModel=(ApprovalModel) getIntent().getSerializableExtra("Approvaldata");
// fill employee details
empname=(approvalModel.getEmployeeName());
LeaveType=(approvalModel.getLeaveType());
LDate=(approvalModel.getLDate());
NoOfHrs=(approvalModel.getNoOfHrs());
LTimeIn=(approvalModel.getLTimeIn());
LTimeOut=(approvalModel.getLTimeOut());
ApproverName=(approvalModel.getApproverName());
Reason=(approvalModel.getReason());
permissionID=(approvalModel.getRequestID());
separated=LDate.split(" ");
Log.d("empname",empname);
emp_name.setText(empname);
leavtype.setText(LeaveType);
leavdate.setText(separated[0]);
btn_leav_type.setText(LeaveType);
hours.setText(NoOfHrs);
txt_time_in.setText(LTimeIn);
txt_time_out.setText(LTimeOut);
txt_approver_name.setText(ApproverName);
txt_reason.setText(Reason);
SharedPreferences shared = getSharedPreferences("MyPrefs", MODE_PRIVATE);
Employeeid = shared.getString("Employeeid", "");
RegisterUser = shared.getString("RegisterUser", "");
btnapprove.setOnClickListener(new View.OnClickListener() { btnapprove.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
PermissionApprovalAction();
isreject=false;
AlertDialog.Builder builder = new AlertDialog.Builder(LeaveRequestDetailsActivity.this);
builder.setTitle("Remarks");
builder.setCancelable(false);
// set the custom layout
final View customLayout = getLayoutInflater().inflate(R.layout.dialog_approve, null);
builder.setView(customLayout);
// add a button
builder.setPositiveButton("Save", (dialog, which) -> {
// send data from the AlertDialog to the Activity
ed_remarks = customLayout.findViewById(R.id.ed_remarks);
if(ed_remarks.getText().toString().isEmpty())
{
Toast.makeText(LeaveRequestDetailsActivity.this, "Please enter remars", Toast.LENGTH_SHORT).show();
builder.show();
return;
}
else {
PermissionApprovalAction();
}
});
// create and show the alert dialog
AlertDialog dialog = builder.create();
dialog.show();
} }
}); });
btnreject = findViewById(R.id.btnreject);
btnreject.setOnClickListener(new View.OnClickListener() { btnreject.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
PermissionApprovalAction();
isreject=true;
AlertDialog.Builder builder = new AlertDialog.Builder(LeaveRequestDetailsActivity.this);
builder.setTitle("Remarks");
builder.setCancelable(false);
// set the custom layout
final View customLayout = getLayoutInflater().inflate(R.layout.dialog_approve, null);
builder.setView(customLayout);
// add a button
builder.setPositiveButton("Save", (dialog, which) -> {
// send data from the AlertDialog to the Activity
ed_remarks = customLayout.findViewById(R.id.ed_remarks);
if(ed_remarks.getText().toString().isEmpty())
{
Toast.makeText(LeaveRequestDetailsActivity.this, "Please enter remarks", Toast.LENGTH_SHORT).show();
builder.show();
return;
}
else {
PermissionApprovalAction();
}
});
// create and show the alert dialog
AlertDialog dialog = builder.create();
dialog.show();
} }
}); });
} }
@ -75,14 +194,36 @@ public class LeaveRequestDetailsActivity extends AppCompatActivity {
try { try {
JSONObject jsonObject = new JSONObject(response); JSONObject jsonObject = new JSONObject(response);
String _statusMessage3 = jsonObject.getString("_statusMessage");
System.out.println("_statusMessage "+_statusMessage3);
if(_statusMessage3.equals("Saved Successfully")){
Intent intent = new Intent(LeaveRequestDetailsActivity.this, ApprovalListActivity.class);
startActivity(intent);
finish();
String _statusMessage = jsonObject.getString("_statusMessage");
String _statusCode=jsonObject.getString("_statusCode");
if(_statusCode.equals("200"))
{
String message;
if(isreject)
{
message="Leave Rejected";
}
else {
message="Leave Approved";
}
new SweetAlertDialog(LeaveRequestDetailsActivity.this, SweetAlertDialog.SUCCESS_TYPE)
.setTitleText(message)
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sDialog) {
sDialog.dismissWithAnimation();
Intent intent = new Intent(LeaveRequestDetailsActivity.this, ApprovalListActivity.class);startActivity(intent);
}
}).show();
}
else
{
Toast.makeText(LeaveRequestDetailsActivity.this, _statusMessage, Toast.LENGTH_LONG).show();
} }
} catch (JSONException e) { } catch (JSONException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -108,14 +249,20 @@ public class LeaveRequestDetailsActivity extends AppCompatActivity {
protected Map<String, String> getParams() { protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("permissionID", "27507");
params.put("eleavetype", "27256");
params.put("actionby", "asaif");
params.put("remark", "Testing Approve");
params.put("actionflag", "A");
params.put("permissionID",permissionID );
params.put("approverID", Employeeid);
params.put("actionby", RegisterUser);
params.put("remark", ed_remarks.getText().toString());
if(isreject)
{
params.put("actionflag", "R");
}
else
{
params.put("actionflag", "A");
}
System.out.println("params in Approve "+params);
return params; return params;
} }
}; };


+ 72
- 43
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/PermissionRequestActivity.java View File

@ -74,6 +74,8 @@ public class PermissionRequestActivity extends AppCompatActivity {
String timeset, timeSetFrom,RegisterUser; String timeset, timeSetFrom,RegisterUser;
EditText txtDate, txtTime; EditText txtDate, txtTime;
private int mYear, mMonth, mDay; private int mYear, mMonth, mDay;
private String code_type="P";
@ -94,7 +96,7 @@ public class PermissionRequestActivity extends AppCompatActivity {
txt_p_date = findViewById(R.id.txtPDate); txt_p_date = findViewById(R.id.txtPDate);
txt_from_date = findViewById(R.id.txt_from_date); txt_from_date = findViewById(R.id.txt_from_date);
txt_to_date = findViewById(R.id.txt_to_date); txt_to_date = findViewById(R.id.txt_to_date);
btnSubmit = findViewById(R.id.btnSubmit);
IsELeaveApprover(); IsELeaveApprover();
//PermissionInsert(); //PermissionInsert();
@ -107,6 +109,8 @@ public class PermissionRequestActivity extends AppCompatActivity {
System.out.println("Current date and time "+currentDateandTime); System.out.println("Current date and time "+currentDateandTime);
txt_p_date.setText(currentDateandTime);
spinner = findViewById(R.id.spinner); spinner = findViewById(R.id.spinner);
// ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.spinner_items, android.R.layout.simple_spinner_item); // ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.spinner_items, android.R.layout.simple_spinner_item);
@ -122,7 +126,7 @@ public class PermissionRequestActivity extends AppCompatActivity {
// Do something with the selected item // Do something with the selected item
code_type=permissionModel.Permission_code;
if (permissionModel.Permission_code.toUpperCase().equals("O")) if (permissionModel.Permission_code.toUpperCase().equals("O"))
{ {
@ -154,21 +158,21 @@ public class PermissionRequestActivity extends AppCompatActivity {
private_date.setOnClickListener(new View.OnClickListener() { private_date.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
final Calendar c = Calendar.getInstance();
mYear = c.get(Calendar.YEAR);
mMonth = c.get(Calendar.MONTH);
mDay = c.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePickerDialog = new DatePickerDialog(PermissionRequestActivity.this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) {
txt_p_date.setText(dayOfMonth + "-" + (monthOfYear + 1) + "-" + year);
}
}, mYear, mMonth, mDay);
datePickerDialog.show();
// final Calendar c = Calendar.getInstance();
// mYear = c.get(Calendar.YEAR);
// mMonth = c.get(Calendar.MONTH);
// mDay = c.get(Calendar.DAY_OF_MONTH);
//
// DatePickerDialog datePickerDialog = new DatePickerDialog(PermissionRequestActivity.this,
// new DatePickerDialog.OnDateSetListener() {
//
// @Override
// public void onDateSet(DatePicker view, int year,
// int monthOfYear, int dayOfMonth) {
// txt_p_date.setText(dayOfMonth + "/" + (monthOfYear + 1) + "/" + year);
// }
// }, mYear, mMonth, mDay);
// datePickerDialog.show();
} }
}); });
official_from_date.setOnClickListener(new View.OnClickListener() { official_from_date.setOnClickListener(new View.OnClickListener() {
@ -185,7 +189,7 @@ public class PermissionRequestActivity extends AppCompatActivity {
@Override @Override
public void onDateSet(DatePicker view, int year, public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) { int monthOfYear, int dayOfMonth) {
txt_from_date.setText(dayOfMonth + "-" + (monthOfYear + 1) + "-" + year);
txt_from_date.setText(dayOfMonth + "/" + (monthOfYear + 1) + "/" + year);
} }
}, mYear, mMonth, mDay); }, mYear, mMonth, mDay);
datePickerDialog.show(); datePickerDialog.show();
@ -205,7 +209,7 @@ public class PermissionRequestActivity extends AppCompatActivity {
@Override @Override
public void onDateSet(DatePicker view, int year, public void onDateSet(DatePicker view, int year,
int monthOfYear, int dayOfMonth) { int monthOfYear, int dayOfMonth) {
txt_to_date.setText(dayOfMonth + "-" + (monthOfYear + 1) + "-" + year);
txt_to_date.setText(dayOfMonth + "/" + (monthOfYear + 1) + "/" + year);
} }
}, mYear, mMonth, mDay); }, mYear, mMonth, mDay);
datePickerDialog.show(); datePickerDialog.show();
@ -237,7 +241,7 @@ public class PermissionRequestActivity extends AppCompatActivity {
} }
}); });
btnSubmit = findViewById(R.id.btnSubmit);
btnSubmit.setOnClickListener(new View.OnClickListener() { btnSubmit.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -321,7 +325,7 @@ public class PermissionRequestActivity extends AppCompatActivity {
int minute) { int minute) {
timeset="";
if(hourOfDay>12) if(hourOfDay>12)
{ {
hourOfDay-=12; hourOfDay-=12;
@ -333,7 +337,7 @@ public class PermissionRequestActivity extends AppCompatActivity {
} }
textTimeTo.setText(hourOfDay + ":" + minute+" "+timeset);
textTimeTo.setText(hourOfDay+":"+minute+" "+timeset);
} }
}, mHour, mMinute, false); }, mHour, mMinute, false);
timePickerDialog.show(); timePickerDialog.show();
@ -362,23 +366,42 @@ public class PermissionRequestActivity extends AppCompatActivity {
StringRequest stringRequest=new StringRequest(Request.Method.POST, url, new com.android.volley.Response.Listener<String>() { StringRequest stringRequest=new StringRequest(Request.Method.POST, url, new com.android.volley.Response.Listener<String>() {
@Override @Override
public void onResponse(String response) { public void onResponse(String response) {
JSONObject jsonObject= null;
try {
jsonObject = new JSONObject(response);
} catch (JSONException e) {
throw new RuntimeException(e);
}
// try {
// jsonObject = new JSONObject(response);
// } catch (JSONException e) {
// throw new RuntimeException(e);
// }
try { try {
JSONObject jsonObject = new JSONObject(response);
_statusMessage = jsonObject.getString("_statusMessage"); _statusMessage = jsonObject.getString("_statusMessage");
String _statusCode=jsonObject.getString("_statusCode");
loading.dismiss(); loading.dismiss();
new SweetAlertDialog(PermissionRequestActivity.this, SweetAlertDialog.SUCCESS_TYPE)
.setTitleText("Permission successful")
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sDialog) {
sDialog.dismissWithAnimation();
}
}).show();
if(_statusCode.equals("200"))
{
new SweetAlertDialog(PermissionRequestActivity.this, SweetAlertDialog.SUCCESS_TYPE)
.setTitleText("Permission request Successful")
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sDialog) {
sDialog.dismissWithAnimation();
}
}).show();
txt_from_date.setText("From Date");
txt_to_date.setText("To Date");
textTimeTo.setText("Time to");
textTimeFrom.setText("Time from");
txt_p_date.setText(currentDateandTime);
edtRemarks.setText("");
}
else {
Toast.makeText(PermissionRequestActivity.this, _statusMessage, Toast.LENGTH_LONG).show();
}
} catch (JSONException e) { } catch (JSONException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -402,16 +425,22 @@ public class PermissionRequestActivity extends AppCompatActivity {
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
params.put("employeeid", Employeeid); params.put("employeeid", Employeeid);
params.put("eleavetype", permission_code);
params.put("pdate", currentDateandTime);
params.put("eleavetype", code_type);
if(code_type.equals("O")) {
params.put("pdate", currentDateandTime);
}
else {
params.put("pdate", currentDateandTime);
}
params.put("fromtime", textTimeFrom.getText().toString()); params.put("fromtime", textTimeFrom.getText().toString());
params.put("totime", textTimeTo.getText().toString()); params.put("totime", textTimeTo.getText().toString());
params.put("reason", edtRemarks.getText().toString()); params.put("reason", edtRemarks.getText().toString());
params.put("attachment", ""); params.put("attachment", "");
params.put("userid", RegisterUser); params.put("userid", RegisterUser);
if(permission_code.equals("O")){
params.put("startdate", fromDate);
params.put("enddate", toDate);
if(code_type.equals("O")){
params.put("startdate", txt_from_date.getText().toString());
params.put("enddate", txt_to_date.getText().toString());
} }
else { else {
params.put("startdate", ""); params.put("startdate", "");
@ -532,7 +561,7 @@ public class PermissionRequestActivity extends AppCompatActivity {
@Override @Override
public void onResponse(String response) { public void onResponse(String response) {
Toast.makeText(PermissionRequestActivity.this, "Response successful1", Toast.LENGTH_SHORT).show();
// Toast.makeText(PermissionRequestActivity.this, "Response successful1", Toast.LENGTH_SHORT).show();
loading.dismiss(); loading.dismiss();
} }
@ -540,7 +569,7 @@ public class PermissionRequestActivity extends AppCompatActivity {
@Override @Override
public void onErrorResponse(VolleyError error) { public void onErrorResponse(VolleyError error) {
// Log.d("error-=>",error.getMessage()); // Log.d("error-=>",error.getMessage());
Toast.makeText(PermissionRequestActivity.this, "Failed to get response = " + error.getMessage(), Toast.LENGTH_SHORT).show();
// / Toast.makeText(PermissionRequestActivity.this, "Failed to get response = " + error.getMessage(), Toast.LENGTH_SHORT).show();
loading.dismiss(); loading.dismiss();
System.out.println("Error message: "+ error.getMessage()); System.out.println("Error message: "+ error.getMessage());


+ 188
- 48
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/ReportActivity.java View File

@ -5,12 +5,18 @@ import androidx.appcompat.app.AppCompatActivity;
import android.app.DatePickerDialog; import android.app.DatePickerDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.DatePicker; import android.widget.DatePicker;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -23,9 +29,13 @@ import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
import cn.pedant.SweetAlert.SweetAlertDialog;
import ru.visionlab.femdemo.models.ApprovalModel;
import ru.visionlab.femdemo.models.ReportModel;
public class ReportActivity extends AppCompatActivity { public class ReportActivity extends AppCompatActivity {
@ -41,25 +51,30 @@ public class ReportActivity extends AppCompatActivity {
String valuefromApi=""; String valuefromApi="";
String passingDateFrom,passingDateTo; String passingDateFrom,passingDateTo;
String Employeeid;
String RegisterUser;
String pdate,Check_In,Check_Out,status;
ListView listview_report;
ArrayList<ReportModel> reportList=new ArrayList<ReportModel>();
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_report); setContentView(R.layout.activity_report);
btnReport = findViewById(R.id.btnReport);
btnReport.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
SharedPreferences shared = getSharedPreferences("MyPrefs", MODE_PRIVATE);
Intent intent = new Intent(ReportActivity.this, ReportDetailsActivity.class);
intent.putExtra("passingDateFrom",passingDateFrom);
intent.putExtra("passingDateTo",passingDateTo);
startActivity(intent);
//getReport();
}
});
Employeeid = shared.getString("Employeeid", "");
RegisterUser = shared.getString("RegisterUser", "");
toDate = findViewById(R.id.toDate);
listview_report=findViewById(R.id.listview_report);
textToDate = findViewById(R.id.textToDate);
fromDate = findViewById(R.id.fromDate);
textFromDate = findViewById(R.id.textFromDate);
back = findViewById(R.id.back); back = findViewById(R.id.back);
btnReport = findViewById(R.id.btnReport);
back.setOnClickListener(new View.OnClickListener() { back.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -70,8 +85,6 @@ public class ReportActivity extends AppCompatActivity {
} }
}); });
fromDate = findViewById(R.id.fromDate);
textFromDate = findViewById(R.id.textFromDate);
fromDate.setOnClickListener(new View.OnClickListener() { fromDate.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -91,14 +104,14 @@ public class ReportActivity extends AppCompatActivity {
// on below line we are setting date to our text view. // on below line we are setting date to our text view.
textFromDate.setText(dayOfMonth + "/" + (monthOfYear + 1) + "/" + year); textFromDate.setText(dayOfMonth + "/" + (monthOfYear + 1) + "/" + year);
yearFrom = year;
dayOfmonthFrom = dayOfMonth;
monthOfYearFrom = monthOfYear;
System.out.println("Date from values: " + dayOfmonthFrom + "/" + (monthOfYearFrom + 1) + "/" + yearFrom);
passingDateFrom = dayOfmonthFrom + "/" + (monthOfYearFrom + 1) + "/" + yearFrom;
System.out.println("passingDateFrom " + passingDateFrom);
// yearFrom = year;
// dayOfmonthFrom = dayOfMonth;
// monthOfYearFrom = monthOfYear;
//
// System.out.println("Date from values: " + dayOfmonthFrom + "/" + (monthOfYearFrom + 1) + "/" + yearFrom);
//
// passingDateFrom = dayOfmonthFrom + "/" + (monthOfYearFrom + 1) + "/" + yearFrom;
// System.out.println("passingDateFrom " + passingDateFrom);
} }
}, },
// on below line we are passing year, // on below line we are passing year,
@ -111,8 +124,7 @@ public class ReportActivity extends AppCompatActivity {
} }
}); });
toDate = findViewById(R.id.toDate);
textToDate = findViewById(R.id.textToDate);
toDate.setOnClickListener(new View.OnClickListener() { toDate.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -132,14 +144,14 @@ public class ReportActivity extends AppCompatActivity {
// on below line we are setting date to our text view. // on below line we are setting date to our text view.
textToDate.setText(dayOfMonth + "/" + (monthOfYear + 1) + "/" + year); textToDate.setText(dayOfMonth + "/" + (monthOfYear + 1) + "/" + year);
yearTo = year;
dayOfmonthTo = dayOfMonth;
monthOfYearTo = monthOfYear;
System.out.println("Date from values: " + dayOfmonthTo + "/" + (monthOfYearTo + 1) + "/" + yearTo);
passingDateTo = dayOfmonthTo + "/" + (monthOfYearTo + 1) + "/" + yearTo;
System.out.println("passingDateTo " + passingDateTo);
// yearTo = year;
// dayOfmonthTo = dayOfMonth;
// monthOfYearTo = monthOfYear;
//
// System.out.println("Date from values: " + dayOfmonthTo + "/" + (monthOfYearTo + 1) + "/" + yearTo);
//
// passingDateTo = dayOfmonthTo + "/" + (monthOfYearTo + 1) + "/" + yearTo;
// System.out.println("passingDateTo " + passingDateTo);
} }
}, },
@ -152,26 +164,119 @@ public class ReportActivity extends AppCompatActivity {
} }
}); });
btnReport.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(textFromDate.getText().toString().equals("From date"))
{
Toast.makeText(ReportActivity.this, "From date is required", Toast.LENGTH_SHORT).show();
}
else if(textToDate.getText().toString().equals("To date"))
{
Toast.makeText(ReportActivity.this, "To date is required", Toast.LENGTH_SHORT).show();
return;
}
else
{
getReport(Employeeid,textFromDate.getText().toString(),textToDate.getText().toString());
}
// Intent intent = new Intent(ReportActivity.this, ReportDetailsActivity.class);
// intent.putExtra("passingDateFrom",passingDateFrom);
// intent.putExtra("passingDateTo",passingDateTo);
// startActivity(intent);
//getReport();
}
});
} }
public void getReport(){
public void getReport(String employeeid, String fromdate, String todate){
final ProgressDialog loading = ProgressDialog.show(ReportActivity.this, "Authenticating", "Please wait ", false, false); final ProgressDialog loading = ProgressDialog.show(ReportActivity.this, "Authenticating", "Please wait ", false, false);
//String url= "http://43.242.212.92:7001/api/lgt/AttendanceReport";
//String url= "http://43.242.212.92:7001/api/lgt/AttendanceReport?employeeid="+"101"+"&fromdate="+"06/06/2023"+"&todate="+"06/07/2023";
String url= "http://43.242.212.92:7001/api/lgt/AttendanceReport?employeeid="+"101"+"&fromdate="+dayOfmonthFrom + "/" + (monthOfYearFrom + 1) + "/" + yearFrom+"&todate="+dayOfmonthTo + "/" + (monthOfYearTo + 1) + "/" + yearTo;
String url= "http://43.242.212.92:7001/api/lgt/AttendanceReport?employeeid="+employeeid+"&fromdate="+fromdate+"&todate="+todate;
System.out.println("report url :"+url);
StringRequest stringRequest=new StringRequest(Request.Method.GET, url, new com.android.volley.Response.Listener<String>() { StringRequest stringRequest=new StringRequest(Request.Method.GET, url, new com.android.volley.Response.Listener<String>() {
@Override @Override
public void onResponse(String response) { public void onResponse(String response) {
try { try {
if(!reportList.isEmpty())
{
reportList.clear();
}
JSONObject jsonObject=new JSONObject(response); JSONObject jsonObject=new JSONObject(response);
JSONObject jb1=jsonObject.getJSONObject("statusModel"); JSONObject jb1=jsonObject.getJSONObject("statusModel");
valuefromApi = jb1.getString("_statusMessage"); valuefromApi = jb1.getString("_statusMessage");
System.out.println("Report status from api " + valuefromApi); System.out.println("Report status from api " + valuefromApi);
JSONArray jsonArray=jsonObject.getJSONArray("_lstAttendanceData");
for(int i=0;i<jsonArray.length();i++)
{
JSONObject jb2=jsonArray.getJSONObject(i);
pdate=jb2.getString("pdate");
Check_In=jb2.getString("Check_In");
Check_Out=jb2.getString("Check_Out");
status=jb2.getString("status");
ReportModel reportModel=new ReportModel();
reportModel.setPdate(pdate);
reportModel.setCheck_In(Check_In);
reportModel.setCheck_Out(Check_Out);
reportModel.setStatus(status);
reportList.add(reportModel);
}
if(valuefromApi.equals("success"))
{
listview_report.setVisibility(View.VISIBLE);
new SweetAlertDialog(ReportActivity.this, SweetAlertDialog.SUCCESS_TYPE)
.setTitleText("Reports found")
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sDialog) {
sDialog.dismissWithAnimation();
listview_report.setAdapter(new Nr());
listview_report.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
// ReportModel reportModel=reportList.get(i);
// Intent intent = new Intent(ReportActivity.this,LeaveRequestDetailsActivity.class);
// Bundle bundle=new Bundle();
// bundle.putSerializable("Reportdata", (Serializable) reportModel);
// intent.putExtras(bundle);
// startActivity(intent);
}
});
}
}).show();
}
else
{
listview_report.setVisibility(View.GONE);
new SweetAlertDialog(ReportActivity.this, SweetAlertDialog.ERROR_TYPE)
.setTitleText("No data founds")
.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
@Override
public void onClick(SweetAlertDialog sDialog) {
sDialog.dismissWithAnimation();
}
}).show();
}
} catch (JSONException e) { } catch (JSONException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
Toast.makeText(ReportActivity.this, valuefromApi, Toast.LENGTH_SHORT).show();
loading.dismiss(); loading.dismiss();
} }
@ -187,17 +292,52 @@ public class ReportActivity extends AppCompatActivity {
} }
}) })
{ {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
/*params.put("employeeid", "101");
params.put("fromdate", "06/06/2023");
params.put("todate", "06/07/2023");*/
return params;
}
// @Override
// protected Map<String, String> getParams() {
// Map<String, String> params = new HashMap<String, String>();
//
// params.put("employeeid", "101");
// params.put("fromdate", "06/06/2023");
// params.put("todate", "06/07/2023");
//
// return params;
// }
}; };
Volley.newRequestQueue(ReportActivity.this).add(stringRequest); Volley.newRequestQueue(ReportActivity.this).add(stringRequest);
} }
private class Nr extends BaseAdapter {
@Override
public int getCount() {
return reportList.size();
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getLayoutInflater();
View v = inflater.inflate(R.layout.report_list, null);
TextView txt_pdate=v.findViewById(R.id.txt_pdate);
TextView txt_checkin=v.findViewById(R.id.txt_checkin);
TextView txt_checkout=v.findViewById(R.id.txt_checkout);
TextView txt_status=v.findViewById(R.id.txt_status);
txt_pdate.setText(reportList.get(position).getPdate());
txt_checkin.setText(reportList.get(position).getCheck_In());
txt_checkout.setText(reportList.get(position).getCheck_Out());
txt_status.setText(reportList.get(position).getStatus());
return v;
}
}
} }

+ 13
- 64
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/ReportDetailsActivity.java View File

@ -31,7 +31,7 @@ public class ReportDetailsActivity extends AppCompatActivity {
ImageView back; ImageView back;
String Employeeid;
String Employeeid,pdate,Check_In,Check_Out,status;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -39,8 +39,8 @@ public class ReportDetailsActivity extends AppCompatActivity {
setContentView(R.layout.activity_report_details); setContentView(R.layout.activity_report_details);
SharedPreferences shared = getSharedPreferences("MyPrefs", MODE_PRIVATE); SharedPreferences shared = getSharedPreferences("MyPrefs", MODE_PRIVATE);
Employeeid = shared.getString("Employeeid", ""); Employeeid = shared.getString("Employeeid", "");
Intent intent=getIntent();
empIdVal = findViewById(R.id.empIdVal); empIdVal = findViewById(R.id.empIdVal);
pdateVal = findViewById(R.id.pdateVal); pdateVal = findViewById(R.id.pdateVal);
@ -52,78 +52,27 @@ public class ReportDetailsActivity extends AppCompatActivity {
back.setOnClickListener(new View.OnClickListener() { back.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
Intent intent = new Intent(ReportDetailsActivity.this, ReportActivity.class);
startActivity(intent);
onBackPressed();
} }
}); });
Intent intent = getIntent();
passingDateFrom = intent.getStringExtra("passingDateFrom");
passingDateTo = intent.getStringExtra("passingDateTo");
System.out.println("passingDateFrom " + passingDateFrom + " " + passingDateTo);
getReport();
}
pdate=intent.getStringExtra("pdate");
Check_In=intent.getStringExtra("Check_In");
Check_Out=intent.getStringExtra("Check_Out");
status=intent.getStringExtra("status");
public void getReport(){
final ProgressDialog loading = ProgressDialog.show(ReportDetailsActivity.this, "Authenticating", "Please wait ", false, false);
empIdVal.setText(Employeeid);
pdateVal.setText(pdate);
Check_InVal.setText(Check_In);
Check_OutVal.setText(Check_Out);
statusVal.setText(status);
String url= "http://43.242.212.92:7001/api/lgt/AttendanceReport?employeeid="+Employeeid+"&fromdate="+passingDateFrom+"&todate="+passingDateTo;
StringRequest stringRequest=new StringRequest(Request.Method.GET, url, new com.android.volley.Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonObject=new JSONObject(response);
JSONArray jsonArray=jsonObject.getJSONArray("_lstAttendanceData");
JSONObject jb1=jsonArray.getJSONObject(0);
String EmployeeID = jb1.getString("EmployeeID");
String pdate = jb1.getString("pdate");
String Check_In = jb1.getString("Check_In");
String Check_Out = jb1.getString("Check_Out");
String status = jb1.getString("status");
empIdVal.setText(EmployeeID);
pdateVal.setText(pdate);
Check_InVal.setText(Check_In);
Check_OutVal.setText(Check_Out);
statusVal.setText(status);
System.out.println("data from api " + EmployeeID + " " + pdate+" "+Check_In+" "+Check_Out+" "+status);
} catch (JSONException e) {
throw new RuntimeException(e);
}
Toast.makeText(ReportDetailsActivity.this, "Successfull" , Toast.LENGTH_SHORT).show();
loading.dismiss();
}
}, new com.android.volley.Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Log.d("error-=>",error.getMessage());
Toast.makeText(ReportDetailsActivity.this, "Failed to get response = " + error.getMessage(), Toast.LENGTH_SHORT).show();
loading.dismiss();
System.out.println("Error message: "+ error.getMessage());
}
})
{
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
}
/*params.put("employeeid", "101");
params.put("fromdate", "06/06/2023");
params.put("todate", "06/07/2023");*/
return params;
}
};
Volley.newRequestQueue(ReportDetailsActivity.this).add(stringRequest);
}
} }

+ 105
- 0
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/models/ApprovalModel.java View File

@ -0,0 +1,105 @@
package ru.visionlab.femdemo.models;
import java.io.Serializable;
public class ApprovalModel implements Serializable {
String RequestID,EmployeeID,EmployeeName,LDate,
LTimeOut,LTimeIn,NoOfHrs,LeaveType,
ApproverID,ApproverName,Reason,_statusCode;
public String getRequestID() {
return RequestID;
}
public void setRequestID(String requestID) {
RequestID = requestID;
}
public String getEmployeeID() {
return EmployeeID;
}
public void setEmployeeID(String employeeID) {
EmployeeID = employeeID;
}
public String getEmployeeName() {
return EmployeeName;
}
public void setEmployeeName(String employeeName) {
EmployeeName = employeeName;
}
public String getLDate() {
return LDate;
}
public void setLDate(String LDate) {
this.LDate = LDate;
}
public String getLTimeOut() {
return LTimeOut;
}
public void setLTimeOut(String LTimeOut) {
this.LTimeOut = LTimeOut;
}
public String getLTimeIn() {
return LTimeIn;
}
public void setLTimeIn(String LTimeIn) {
this.LTimeIn = LTimeIn;
}
public String getNoOfHrs() {
return NoOfHrs;
}
public void setNoOfHrs(String noOfHrs) {
NoOfHrs = noOfHrs;
}
public String getLeaveType() {
return LeaveType;
}
public void setLeaveType(String leaveType) {
LeaveType = leaveType;
}
public String getApproverID() {
return ApproverID;
}
public void setApproverID(String approverID) {
ApproverID = approverID;
}
public String getApproverName() {
return ApproverName;
}
public void setApproverName(String approverName) {
ApproverName = approverName;
}
public String getReason() {
return Reason;
}
public void setReason(String reason) {
Reason = reason;
}
public String get_statusCode() {
return _statusCode;
}
public void set_statusCode(String _statusCode) {
this._statusCode = _statusCode;
}
}

+ 46
- 0
examples/example_bestshot/example/app/src/main/java/ru/visionlab/femdemo/models/ReportModel.java View File

@ -0,0 +1,46 @@
package ru.visionlab.femdemo.models;
public class ReportModel {
String EmployeeID,pdate,Check_In,Check_Out,status;
public String getEmployeeID() {
return EmployeeID;
}
public void setEmployeeID(String employeeID) {
EmployeeID = employeeID;
}
public String getPdate() {
return pdate;
}
public void setPdate(String pdate) {
this.pdate = pdate;
}
public String getCheck_In() {
return Check_In;
}
public void setCheck_In(String check_In) {
Check_In = check_In;
}
public String getCheck_Out() {
return Check_Out;
}
public void setCheck_Out(String check_Out) {
Check_Out = check_Out;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}

+ 4
- 3
examples/example_bestshot/example/app/src/main/res/layout/activity_approval_new_list.xml View File

@ -2,9 +2,9 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:orientation="vertical"
android:padding="23dp"
>
android:padding="23dp">
<LinearLayout <LinearLayout
android:id="@+id/lin1" android:id="@+id/lin1"
@ -22,7 +22,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Approval list"
android:text="Request list"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" android:textStyle="bold"
android:textColor="@color/black" android:textColor="@color/black"
@ -36,6 +36,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/listview" android:id="@+id/listview"
tools:listitem="@layout/listview_layout"
android:layout_marginTop="20dp"/> android:layout_marginTop="20dp"/>
</LinearLayout> </LinearLayout>

+ 36
- 17
examples/example_bestshot/example/app/src/main/res/layout/activity_leave_request_details.xml View File

@ -9,6 +9,14 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="23dp"> android:padding="23dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -62,21 +70,24 @@
android:orientation="vertical"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/emp_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Madelyn Lubin"
android:text=""
android:textStyle="bold" android:textStyle="bold"
android:textColor="#000000"/> android:textColor="#000000"/>
<TextView <TextView
android:id="@+id/leavdate"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Tue, 22 - Thu, 24 Feb 2023"
android:text=""
android:textStyle="normal" android:textStyle="normal"
android:textColor="#5F5F5F"/> android:textColor="#5F5F5F"/>
<TextView <TextView
android:id="@+id/leavtype"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Casual Leave"
android:text=""
android:textStyle="bold" android:textStyle="bold"
android:textColor="#3553BB"/> android:textColor="#3553BB"/>
@ -89,9 +100,10 @@
android:layout_marginLeft="15dp"> android:layout_marginLeft="15dp">
<TextView <TextView
android:id="@+id/hours"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="03"
android:text=""
android:textSize="26sp" android:textSize="26sp"
android:textStyle="bold" android:textStyle="bold"
android:textColor="#000000" android:textColor="#000000"
@ -101,7 +113,7 @@
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Days"
android:text="Hours"
android:textSize="26sp" android:textSize="26sp"
android:textStyle="normal" android:textStyle="normal"
android:textColor="#000000" android:textColor="#000000"
@ -114,26 +126,29 @@
</LinearLayout> </LinearLayout>
<Button <Button
android:id="@+id/btn_leav_type"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/bg_btn_with_stroke_grey" android:background="@drawable/bg_btn_with_stroke_grey"
android:text="Casual Leave"
android:text=""
android:textAlignment="viewStart" android:textAlignment="viewStart"
android:textColor="#3553BB" android:textColor="#3553BB"
android:padding="5dp" android:padding="5dp"
android:layout_marginTop="10dp"/> android:layout_marginTop="10dp"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Total Leave this year"
android:text="Time In"
android:textColor="#A1A1A1" android:textColor="#A1A1A1"
android:layout_marginTop="30dp"/> android:layout_marginTop="30dp"/>
<TextView <TextView
android:id="@+id/txt_time_in"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="23 days"
android:text=""
android:textColor="#434343" android:textColor="#434343"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:textSize="18sp" android:textSize="18sp"
@ -142,14 +157,15 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Substitute"
android:text="Time Out"
android:textColor="#A1A1A1" android:textColor="#A1A1A1"
android:layout_marginTop="30dp"/>
android:layout_marginTop="20dp"/>
<TextView <TextView
android:id="@+id/txt_time_out"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Richard Wilson"
android:text=""
android:textColor="#434343" android:textColor="#434343"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:textSize="18sp" android:textSize="18sp"
@ -160,12 +176,13 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Approver" android:text="Approver"
android:textColor="#A1A1A1" android:textColor="#A1A1A1"
android:layout_marginTop="30dp"/>
android:layout_marginTop="20dp"/>
<TextView <TextView
android:id="@+id/txt_approver_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Michael Adams"
android:text=""
android:textColor="#434343" android:textColor="#434343"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:textSize="18sp" android:textSize="18sp"
@ -174,14 +191,15 @@
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="HR Contact"
android:text="Reason"
android:textColor="#A1A1A1" android:textColor="#A1A1A1"
android:layout_marginTop="30dp"/>
android:layout_marginTop="20dp"/>
<TextView <TextView
android:id="@+id/txt_reason"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="HR Contact"
android:text=""
android:textColor="#434343" android:textColor="#434343"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:textSize="18sp" android:textSize="18sp"
@ -207,6 +225,7 @@
android:text="Reject" android:text="Reject"
android:textColor="@color/white"/> android:textColor="@color/white"/>
</LinearLayout>
</ScrollView>
</LinearLayout> </LinearLayout>

+ 30
- 29
examples/example_bestshot/example/app/src/main/res/layout/activity_permission_request.xml View File

@ -195,6 +195,36 @@
/> />
</RelativeLayout> </RelativeLayout>
<LinearLayout
android:id="@+id/timePickerFrom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/bg_button_time"
android:layout_marginTop="25dp"
android:layout_marginLeft="14dp"
android:layout_marginRight="14dp"
>
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/calender"/>
<TextView
android:id="@+id/textTimeFrom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time from"
android:textColor="@color/black"
android:layout_gravity="center"
android:paddingLeft="100dp"
android:textSize="17sp"
android:textStyle="bold"
/>
</LinearLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/official_to_date" android:id="@+id/official_to_date"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -221,36 +251,7 @@
<LinearLayout
android:id="@+id/timePickerFrom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/bg_button_time"
android:layout_marginTop="25dp"
android:layout_marginLeft="14dp"
android:layout_marginRight="14dp"
>
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:src="@drawable/calender"/>
<TextView
android:id="@+id/textTimeFrom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time from"
android:textColor="@color/black"
android:layout_gravity="center"
android:paddingLeft="100dp"
android:textSize="17sp"
android:textStyle="bold"
/>
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/timePickerTo" android:id="@+id/timePickerTo"
android:layout_width="match_parent" android:layout_width="match_parent"


+ 10
- 1
examples/example_bestshot/example/app/src/main/res/layout/activity_report.xml View File

@ -113,11 +113,20 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="14dp" android:layout_marginLeft="14dp"
android:layout_marginRight="14dp" android:layout_marginRight="14dp"
android:layout_marginTop="70dp"
android:layout_marginTop="40dp"
android:background="@drawable/bg_btn_with_stroke" android:background="@drawable/bg_btn_with_stroke"
android:text="Submit" android:text="Submit"
android:textAllCaps="false" android:textAllCaps="false"
android:textColor="@color/white" android:textColor="@color/white"
/> />
<ListView
android:id="@+id/listview_report"
android:layout_width="match_parent"
android:layout_marginTop="30dp"
tools:listitem="@layout/report_list"
android:dividerHeight="5.0sp"
android:divider="@android:color/transparent"
android:layout_height="wrap_content"></ListView>
</LinearLayout> </LinearLayout>

+ 13
- 0
examples/example_bestshot/example/app/src/main/res/layout/dialog_approve.xml View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<EditText
android:id="@+id/ed_remarks"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

+ 2
- 2
examples/example_bestshot/example/app/src/main/res/layout/layout.xml View File

@ -72,7 +72,7 @@
android:id="@+id/request" android:id="@+id/request"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Permission"
android:text="Permission request"
android:layout_toRightOf="@id/req" android:layout_toRightOf="@id/req"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="38dp" android:layout_marginLeft="38dp"
@ -108,7 +108,7 @@
android:id="@+id/permissionApproval" android:id="@+id/permissionApproval"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Permission appoval"
android:text="Permission approval"
android:layout_toRightOf="@id/approval" android:layout_toRightOf="@id/approval"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="38dp" android:layout_marginLeft="38dp"


+ 1
- 0
examples/example_bestshot/example/app/src/main/res/layout/listview_layout.xml View File

@ -135,6 +135,7 @@
android:layout_marginRight="5dp"> android:layout_marginRight="5dp">
<LinearLayout <LinearLayout
android:id="@+id/ll_approve"
android:layout_width="90dp" android:layout_width="90dp"
android:layout_height="25dp" android:layout_height="25dp"
android:orientation="horizontal" android:orientation="horizontal"


+ 167
- 0
examples/example_bestshot/example/app/src/main/res/layout/report_list.xml View File

@ -0,0 +1,167 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:background="@drawable/edittext_border">
<!-- <RelativeLayout-->
<!-- android:id="@+id/rl_1"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- >-->
<!-- <TextView-->
<!-- android:id="@+id/EmployeeName"-->
<!-- android:text="Employee ID"-->
<!-- android:textSize="18sp"-->
<!-- android:textStyle="bold"-->
<!-- android:layout_width="fill_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:textColor="@color/colorPrimary" />-->
<!-- <TextView-->
<!-- android:id="@+id/emp_id"-->
<!-- android:text="Employee ID"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:textColor="#5d5d5d"-->
<!-- android:layout_alignParentRight="true"-->
<!-- android:gravity="center_horizontal"-->
<!-- />-->
<!-- </RelativeLayout>-->
<RelativeLayout
android:id="@+id/rl_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/pdate"
android:text="Private Date"
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimary" />
<TextView
android:id="@+id/txt_pdate"
android:text=""
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#5d5d5d"
android:layout_alignParentRight="true"
android:gravity="center_horizontal"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_3"
android:layout_below="@id/rl_2"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/checkin"
android:text="Check In"
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimary" />
<TextView
android:id="@+id/txt_checkin"
android:text=""
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#5d5d5d"
android:layout_alignParentRight="true"
android:gravity="center_horizontal"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_4"
android:layout_below="@id/rl_3"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/checkout"
android:text="Check Out"
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimary" />
<TextView
android:id="@+id/txt_checkout"
android:text=""
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#5d5d5d"
android:layout_alignParentRight="true"
android:gravity="center_horizontal"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_5"
android:layout_below="@id/rl_4"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/status"
android:text="Status"
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/colorPrimary" />
<TextView
android:id="@+id/txt_status"
android:text=""
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#5d5d5d"
android:layout_alignParentRight="true"
android:gravity="center_horizontal"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"></RelativeLayout>
</RelativeLayout>
</RelativeLayout>

Loading…
Cancel
Save