feat reservas refs #6861

This commit is contained in:
Sergio De la torre 2024-07-23 08:48:13 +02:00
parent 401d062115
commit 03b3ac7a81
2 changed files with 17 additions and 3 deletions

View File

@ -59,8 +59,8 @@ class SectorCollectionReserveFragment(
}
override fun onResume() {
onBack = true
super.onPause()
onBack = true
super.onResume()
}
override fun init() {

View File

@ -17,10 +17,13 @@ import es.verdnatura.presentation.common.OnCollectionTicketSelectedListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.TAG
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.common.convertToDateString
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.sacador.adapter.CollectionAdapterNew
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
import java.text.SimpleDateFormat
import java.util.Calendar
class SacadorFragmentNew(
var type: String
@ -219,7 +222,8 @@ class SacadorFragmentNew(
it.list.forEach {
//lolass
if (!it.created.contains("17 Jul")) {
var myDate = getCalendarForDateMinusOneDay(requireContext()).convertToDateString()
if (!it.created.contains(myDate)) {
myCollectionsList.add(CollectionTicket(it.collectionFk, it.created))
}
}
@ -265,6 +269,16 @@ class SacadorFragmentNew(
}
}
fun getCalendarForDateMinusOneDay(context: Context): Calendar {
val cal = Calendar.getInstance()
cal.add(Calendar.DAY_OF_YEAR, -1)
val sdf = SimpleDateFormat(context.getString(R.string.dateFormat))
val formattedDate = sdf.format(cal.time)
val resultCal = Calendar.getInstance()
resultCal.time = sdf.parse(formattedDate)!!
return resultCal
}
private fun createCollectionList(collections: List<CollectionTicket>) {
collectionsList = ArrayList()