Compare commits
	
		
			2 Commits
		
	
	
		
			dedd0dd783
			...
			3808f3daf0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3808f3daf0 | |||
| 63a0812e52 | 
@ -0,0 +1,26 @@
 | 
			
		||||
package ru.visionlab.femdemo;
 | 
			
		||||
 | 
			
		||||
public class PermissionModel {
 | 
			
		||||
    public String getPermission_code() {
 | 
			
		||||
        return Permission_code;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setPermission_code(String permission_code) {
 | 
			
		||||
        Permission_code = permission_code;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    String Permission_NameEN,Permission_code;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public String getPermission_NameEN() {
 | 
			
		||||
        return Permission_NameEN;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public void setPermission_NameEN(String permission_NameEN) {
 | 
			
		||||
        Permission_NameEN = permission_NameEN;
 | 
			
		||||
    }
 | 
			
		||||
    @Override    public String toString() {
 | 
			
		||||
        return this.getPermission_NameEN(); // What to display in the Spinner list.
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -7,6 +7,8 @@ import android.app.TimePickerDialog;
 | 
			
		||||
import android.content.Intent;
 | 
			
		||||
import android.content.SharedPreferences;
 | 
			
		||||
import android.os.Bundle;
 | 
			
		||||
import android.os.PersistableBundle;
 | 
			
		||||
import android.util.Log;
 | 
			
		||||
import android.view.View;
 | 
			
		||||
import android.widget.AdapterView;
 | 
			
		||||
import android.widget.ArrayAdapter;
 | 
			
		||||
@ -14,6 +16,7 @@ import android.widget.Button;
 | 
			
		||||
import android.widget.EditText;
 | 
			
		||||
import android.widget.ImageButton;
 | 
			
		||||
import android.widget.LinearLayout;
 | 
			
		||||
import android.widget.RelativeLayout;
 | 
			
		||||
import android.widget.Spinner;
 | 
			
		||||
import android.widget.TextView;
 | 
			
		||||
import android.widget.TimePicker;
 | 
			
		||||
@ -28,6 +31,7 @@ import org.json.JSONArray;
 | 
			
		||||
import org.json.JSONException;
 | 
			
		||||
import org.json.JSONObject;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.text.SimpleDateFormat;
 | 
			
		||||
import java.util.Calendar;
 | 
			
		||||
import java.util.Date;
 | 
			
		||||
@ -54,11 +58,13 @@ public class PermissionRequestActivity extends AppCompatActivity {
 | 
			
		||||
 | 
			
		||||
    String permission_type,permission_code;
 | 
			
		||||
 | 
			
		||||
    String Employeeid,Permission_code_o,Permission_code_p;
 | 
			
		||||
    String fromDate,toDate,fromTime,toTime;
 | 
			
		||||
    ArrayList<PermissionModel> permission_type_list=new ArrayList<>();
 | 
			
		||||
    ArrayList<String> spinner_array=new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
    String currentDateandTime;
 | 
			
		||||
    // code for Niladri
 | 
			
		||||
 | 
			
		||||
    RelativeLayout private_date,official_from_date,official_to_date;
 | 
			
		||||
     String permission_code;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void onCreate(Bundle savedInstanceState) {
 | 
			
		||||
@ -70,6 +76,10 @@ public class PermissionRequestActivity extends AppCompatActivity {
 | 
			
		||||
 | 
			
		||||
        Employeeid = shared.getString("Employeeid", "");
 | 
			
		||||
 | 
			
		||||
        private_date=findViewById(R.id.private_date);
 | 
			
		||||
        official_from_date=findViewById(R.id.official_from_date);
 | 
			
		||||
        official_to_date=findViewById(R.id.official_to_date);
 | 
			
		||||
 | 
			
		||||
        IsELeaveApprover();
 | 
			
		||||
        //PermissionInsert();
 | 
			
		||||
        PermissionApprovalList();
 | 
			
		||||
@ -83,17 +93,33 @@ public class PermissionRequestActivity extends AppCompatActivity {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        spinner = findViewById(R.id.spinner);
 | 
			
		||||
        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.spinner_items, android.R.layout.simple_spinner_item);
 | 
			
		||||
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
 | 
			
		||||
        spinner.setAdapter(adapter);
 | 
			
		||||
//        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.spinner_items, android.R.layout.simple_spinner_item);
 | 
			
		||||
//        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
 | 
			
		||||
//        spinner.setAdapter(adapter);
 | 
			
		||||
 | 
			
		||||
        spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
 | 
			
		||||
                // Handle the selected item here
 | 
			
		||||
                permission_type = parentView.getItemAtPosition(position).toString();
 | 
			
		||||
                System.out.println("Value of permission_type "+permission_type);
 | 
			
		||||
                PermissionModel permissionModel=(PermissionModel) parentView.getSelectedItem();
 | 
			
		||||
                Log.d("code",permissionModel.Permission_code);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                // Do something with the selected item
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
                if (permissionModel.Permission_code.toUpperCase().equals("O"))
 | 
			
		||||
                {
 | 
			
		||||
                    official_from_date.setVisibility(View.VISIBLE);
 | 
			
		||||
                    official_to_date.setVisibility(View.VISIBLE);
 | 
			
		||||
                    private_date.setVisibility(View.GONE);
 | 
			
		||||
                }
 | 
			
		||||
               else
 | 
			
		||||
                {
 | 
			
		||||
                    official_from_date.setVisibility(View.GONE);
 | 
			
		||||
                    official_to_date.setVisibility(View.GONE);
 | 
			
		||||
                    private_date.setVisibility(View.VISIBLE);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
@ -102,6 +128,13 @@ public class PermissionRequestActivity extends AppCompatActivity {
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        private_date.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onClick(View v) {
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        back = findViewById(R.id.back);
 | 
			
		||||
        back.setOnClickListener(new View.OnClickListener() {
 | 
			
		||||
@ -413,28 +446,15 @@ public class PermissionRequestActivity extends AppCompatActivity {
 | 
			
		||||
 | 
			
		||||
        String url= "http://43.242.212.92:7001/api/lgt/PermissionTypes";
 | 
			
		||||
        StringRequest stringRequest=new StringRequest(Request.Method.GET, url, new com.android.volley.Response.Listener<String>() {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
            public void onResponse(String response) {
 | 
			
		||||
 | 
			
		||||
                Toast.makeText(PermissionRequestActivity.this, "Response successful2", Toast.LENGTH_SHORT).show();
 | 
			
		||||
                try {
 | 
			
		||||
                    JSONArray jsonArray = new JSONArray(response);
 | 
			
		||||
                    for (int i = 0;i< jsonArray.length();i++){
 | 
			
		||||
                        JSONObject jb1=jsonArray.getJSONObject(i);
 | 
			
		||||
                        permission_code=jb1.getString("Permission_code");
 | 
			
		||||
                        if(permission_code.equals("P"))
 | 
			
		||||
                        {
 | 
			
		||||
                            permission_code="P";
 | 
			
		||||
                        }
 | 
			
		||||
                        else {
 | 
			
		||||
                            permission_code="O";
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                } catch (JSONException e) {
 | 
			
		||||
                    throw new RuntimeException(e);
 | 
			
		||||
                }
 | 
			
		||||
                loading.dismiss();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }, new com.android.volley.Response.ErrorListener() {
 | 
			
		||||
 | 
			
		||||
@ -9,6 +9,17 @@
 | 
			
		||||
    android:orientation="vertical"
 | 
			
		||||
    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
 | 
			
		||||
        android:id="@+id/lin1"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
@ -36,9 +47,6 @@
 | 
			
		||||
    </LinearLayout>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <LinearLayout
 | 
			
		||||
        android:id="@+id/linearLayout1"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
@ -141,6 +149,74 @@
 | 
			
		||||
    </LinearLayout>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <RelativeLayout
 | 
			
		||||
        android:id="@+id/private_date"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="45dp"
 | 
			
		||||
        android:layout_marginLeft="14dp"
 | 
			
		||||
        android:layout_marginRight="14dp"
 | 
			
		||||
        android:background="@drawable/bg_button_time"
 | 
			
		||||
        android:layout_marginTop="25dp">
 | 
			
		||||
 | 
			
		||||
        <TextView
 | 
			
		||||
 | 
			
		||||
            android:layout_width="wrap_content"
 | 
			
		||||
            android:layout_height="wrap_content"
 | 
			
		||||
            android:text="Date"
 | 
			
		||||
            android:textColor="@color/black"
 | 
			
		||||
            android:layout_gravity="center"
 | 
			
		||||
            android:paddingLeft="135dp"
 | 
			
		||||
            android:textSize="17sp"
 | 
			
		||||
            android:textStyle="bold"
 | 
			
		||||
            />
 | 
			
		||||
 | 
			
		||||
    </RelativeLayout>
 | 
			
		||||
    <RelativeLayout
 | 
			
		||||
        android:id="@+id/official_from_date"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="45dp"
 | 
			
		||||
        android:layout_marginLeft="14dp"
 | 
			
		||||
        android:visibility="gone"
 | 
			
		||||
        android:layout_marginRight="14dp"
 | 
			
		||||
        android:background="@drawable/bg_button_time"
 | 
			
		||||
        android:layout_marginTop="25dp">
 | 
			
		||||
 | 
			
		||||
        <TextView
 | 
			
		||||
 | 
			
		||||
            android:layout_width="wrap_content"
 | 
			
		||||
            android:layout_height="wrap_content"
 | 
			
		||||
            android:text="From Date"
 | 
			
		||||
            android:textColor="@color/black"
 | 
			
		||||
            android:layout_gravity="center"
 | 
			
		||||
            android:paddingLeft="135dp"
 | 
			
		||||
            android:textSize="17sp"
 | 
			
		||||
            android:textStyle="bold"
 | 
			
		||||
            />
 | 
			
		||||
 | 
			
		||||
    </RelativeLayout>
 | 
			
		||||
    <RelativeLayout
 | 
			
		||||
        android:id="@+id/official_to_date"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="45dp"
 | 
			
		||||
        android:layout_marginLeft="14dp"
 | 
			
		||||
        android:visibility="gone"
 | 
			
		||||
        android:layout_marginRight="14dp"
 | 
			
		||||
        android:background="@drawable/bg_button_time"
 | 
			
		||||
        android:layout_marginTop="25dp">
 | 
			
		||||
 | 
			
		||||
        <TextView
 | 
			
		||||
            android:layout_width="wrap_content"
 | 
			
		||||
            android:layout_height="wrap_content"
 | 
			
		||||
            android:text="To Date"
 | 
			
		||||
            android:textColor="@color/black"
 | 
			
		||||
            android:layout_gravity="center"
 | 
			
		||||
            android:paddingLeft="135dp"
 | 
			
		||||
            android:textSize="17sp"
 | 
			
		||||
            android:textStyle="bold"
 | 
			
		||||
            />
 | 
			
		||||
 | 
			
		||||
    </RelativeLayout>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    <LinearLayout
 | 
			
		||||
@ -208,12 +284,14 @@
 | 
			
		||||
        android:id="@+id/edtRemarks"
 | 
			
		||||
        android:layout_width="match_parent"
 | 
			
		||||
        android:layout_height="80dp"
 | 
			
		||||
        android:padding="10dp"
 | 
			
		||||
        android:background="@drawable/edittext_border"
 | 
			
		||||
        android:layout_marginLeft="14dp"
 | 
			
		||||
        android:layout_marginRight="14dp"
 | 
			
		||||
        android:layout_marginTop="30dp"
 | 
			
		||||
        android:hint="Remarks"
 | 
			
		||||
        android:gravity="center"/>
 | 
			
		||||
 | 
			
		||||
        android:gravity="left"/>
 | 
			
		||||
 | 
			
		||||
    <Button
 | 
			
		||||
        android:id="@+id/btnSubmit"
 | 
			
		||||
@ -221,11 +299,12 @@
 | 
			
		||||
        android:layout_height="wrap_content"
 | 
			
		||||
        android:layout_marginLeft="14dp"
 | 
			
		||||
        android:layout_marginRight="14dp"
 | 
			
		||||
        android:layout_marginTop="210dp"
 | 
			
		||||
        android:layout_marginTop="100dp"
 | 
			
		||||
        android:background="@drawable/bg_btn_with_stroke"
 | 
			
		||||
        android:text="Submit"
 | 
			
		||||
        android:textAllCaps="false"
 | 
			
		||||
        android:textColor="@color/white"
 | 
			
		||||
        />
 | 
			
		||||
 | 
			
		||||
</LinearLayout>
 | 
			
		||||
</ScrollView>
 | 
			
		||||
</LinearLayout>
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user