Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

Fix-317: Dialog check added to Payroll Edit/Delete #180

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package org.apache.fineract.ui.online.customers.customerpayroll.editcustomerpayroll

import android.content.Context
import android.content.DialogInterface
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.stepstone.stepper.Step
import com.stepstone.stepper.VerificationError
Expand All @@ -16,12 +17,11 @@ import org.apache.fineract.data.models.payroll.PayrollConfiguration
import org.apache.fineract.ui.adapters.PayrollAllocationAdapter
import org.apache.fineract.ui.base.FineractBaseActivity
import org.apache.fineract.ui.base.FineractBaseFragment
import org.apache.fineract.ui.online.customers.customerpayroll.editcustomerpayroll
.editpayrollbottomsheet.EditPayrollBottomSheet
import org.apache.fineract.ui.online.customers.customerpayroll.editcustomerpayroll
.editpayrollbottomsheet.OnBottomSheetDialogListener
import org.apache.fineract.ui.online.customers.customerpayroll.editcustomerpayroll.editpayrollbottomsheet.EditPayrollBottomSheet
import org.apache.fineract.ui.online.customers.customerpayroll.editcustomerpayroll.editpayrollbottomsheet.OnBottomSheetDialogListener
import org.apache.fineract.ui.online.customers.customerpayroll.editcustomerpayroll.editpayrollbottomsheet.PayrollSource
import org.apache.fineract.utils.ConstantKeys
import org.apache.fineract.utils.MaterialDialog
import javax.inject.Inject


Expand Down Expand Up @@ -107,14 +107,15 @@ class EditPayrollAllocationFragment : FineractBaseFragment(), Step,
}

override fun onClickDelete(payrollAllocation: PayrollAllocation, position: Int) {
payrollAllocations.removeAt(position)
payrollAllocationAdapter.setPayrollAllocations(payrollAllocations)
dialog(position, getString(R.string.dialog_title_confirm_deletion),
getString(R.string.dialog_message_confirm_name_deletion, "Payroll"),
getString(R.string.delete), null)
}

override fun editPayrollAllocation(payrollAllocation: PayrollAllocation, position: Int) {
payrollAllocations.removeAt(position)
payrollAllocations.add(position, payrollAllocation)
payrollAllocationAdapter.setPayrollAllocations(payrollAllocations)
dialog(position, getString(R.string.dialog_title_confirm_update),
getString(R.string.dialog_message_confirm_name_updation, "Payroll"),
getString(R.string.update), payrollAllocation)
}

override fun addPayrollAllocation(payrollAllocation: PayrollAllocation) {
Expand All @@ -131,4 +132,20 @@ class EditPayrollAllocationFragment : FineractBaseFragment(), Step,

}

}
fun dialog(position: Int, title: String, message: String, btnMessage: String, payrollAllocation: PayrollAllocation?) {
MaterialDialog.Builder()
.init(context)
.setTitle(title)
.setMessage(message)
.setPositiveButton(btnMessage) { dialog: DialogInterface?, _: Int ->
payrollAllocations.removeAt(position)
if (payrollAllocation != null) {
payrollAllocations.add(position, payrollAllocation)
}
payrollAllocationAdapter.setPayrollAllocations(payrollAllocations)
dialog?.dismiss()
}.setNegativeButton(getString(R.string.dialog_action_cancel))
.createMaterialDialog()
.show()
}
}
2 changes: 2 additions & 0 deletions app/src/main/res/values-ml-rIN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,6 @@
<string name="hello_blank_fragment">ഹലോ ശൂന്യമായ ശകലം</string>
<string name="dialog_message_camera_permission_never_ask_again">നിങ്ങൾ അനുമതി നിഷേധിച്ചു ഈ അനുമതിയില്ലാതെ നിങ്ങൾക്ക് ക്യാമറ സ്കാൻ ചെയ്യാൻ കഴിയില്ല. ഇത് സജ്ജീകരണങ്ങളിൽ പ്രാപ്തമാക്കുകനിങ്ങൾ അനുമതി നിഷേധിച്ചു ഈ അനുമതിയില്ലാതെ നിങ്ങൾക്ക് ക്യാമറ സ്കാൻ ചെയ്യാൻ കഴിയില്ല. ഇത് സജ്ജീകരണങ്ങളിൽ പ്രാപ്തമാക്കുക</string>
<string name="msg_setting_activity_not_found">ക്രമീകരണ പ്രവർത്തനം എന്തോ തെറ്റായി സംഭവിച്ചു. \'ക്രമീകരണങ്ങൾ\' എന്നതിലേക്ക് പോയി സ്വമേധയാ അനുമതി അനുവദിക്കുക.</string>
<string name="dialog_message_confirm_name_updation">നിങ്ങൾക്ക് അപ്‌ഡേറ്റ് ചെയ്യണോ %s?</string>
<string name="dialog_title_confirm_update">അപ്‌ഡേറ്റ് സ്ഥിരീകരിക്കുക</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@
<string name="dialog_action_delete">Delete</string>
<string name="dialog_action_logout">Logout</string>
<string name="dialog_title_confirm_deletion">Confirm deletion</string>
<string name="dialog_title_confirm_update">Confirm update</string>
<string name="dialog_title_confirm_logout">Confirm logout</string>
<string name="dialog_message_confirmation_delete_identification_card">Do you want to delete this identification card?</string>
<string name="dialog_message_confirmation_delete_identification_card_scan">Do you want to delete this identification card scan?</string>
Expand Down Expand Up @@ -535,6 +536,7 @@
<string name="please_click_back_again_to_exit">Please click BACK again to exit</string>
<string name="update">Update</string>
<string name="dialog_message_confirm_name_deletion">Do you want to delete %s?</string>
<string name="dialog_message_confirm_name_updation">Do you want to update %s?</string>
<string name="edit_group">Edit Group</string>
<string name="updating_group_please_wait">Updating Group, please wait...</string>
<string name="please_verify_following_group_task">Please verify the following tasks before you can %1$s this group</string>
Expand Down