feat: refs #7572 refactorUploadFront

This commit is contained in:
Sergio De la torre 2025-02-14 11:57:29 +01:00
parent 6f155fbe36
commit f96d809afe
7 changed files with 41 additions and 11 deletions

View File

@ -18,6 +18,7 @@ import com.esafirm.imagepicker.features.registerImagePicker
import com.esafirm.imagepicker.model.Image
import es.verdnatura.R
import es.verdnatura.databinding.FragmentPackagingObsBinding
import es.verdnatura.domain.ConstAndValues.COMPANYFK
import es.verdnatura.domain.ConstAndValues.ENTRYID
import es.verdnatura.domain.ConstAndValues.ENTRYNUMBERIMAGES
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONORIGINAL
@ -60,6 +61,7 @@ class ObservFragment(
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
private var layoutManager: LinearLayoutManager? = null
private lateinit var customDialogList: CustomDialogList
private var dmsType: Int? = null
companion object {
fun newInstance(entryPoint: String) = ObservFragment(entryPoint)
@ -79,6 +81,7 @@ class ObservFragment(
setEvents()
setObservations()
loadImages()
viewModel.getTypeDMS()
super.init()
}
@ -244,8 +247,8 @@ class ObservFragment(
warehouseId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
WAREHOUSEFK
),
companyId = 442,
dmsTypeId = 27,
companyId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(COMPANYFK),
dmsTypeId = dmsType!!,
reference = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
ENTRYID
).toString(),
@ -266,6 +269,18 @@ class ObservFragment(
openSummary()
}
}
dmsTypeId.observe(viewLifecycleOwner) {
if (it.id == 0) {
ma.messageWithSound(
message = getString(R.string.errorDMS),
isError = true,
isPlayed = true
)
} else {
dmsType = it.id
}
}
}
}
@ -278,13 +293,14 @@ class ObservFragment(
val drawable = getDrawableFromImageUri(requireContext(), (item as Image).uri)
val bitmap = drawable!!.toBitmap()
viewModel.entryUploadPhotoSalix(
idEntry = mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID),
warehouseId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
WAREHOUSEFK
),
companyId = 442,
dmsTypeId = 27,
companyId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(COMPANYFK),
dmsTypeId = dmsType!!,
reference = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
ENTRYID
).toString(),
@ -294,7 +310,6 @@ class ObservFragment(
hasFile = false,
urlImage = saveBitmapAsTempFile(requireContext(), bitmap)
)
}
}, object : OnImageTrashClickListener {

View File

@ -49,8 +49,15 @@ class PackagingCountFragment(
override fun init() {
viewModel.getItemsPackaging(
mobileApplication.dataStoreApp.readDataStoreKey(SUPPLIERID),
mobileApplication.dataStoreApp.readDataStoreKey(ENTRYID)
mobileApplication.dataStoreApp.readDataStoreKey<Int>(SUPPLIERID),
mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)
)
println(
"EntryId ${mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)} \n SupplierId ${
mobileApplication.dataStoreApp.readDataStoreKey<Int>(
SUPPLIERID
)
}"
)
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
@ -106,8 +113,8 @@ class PackagingCountFragment(
event.getContentIfNotHandled().notNull {
viewModel.getItemsPackaging(
mobileApplication.dataStoreApp.readDataStoreKey(SUPPLIERID),
mobileApplication.dataStoreApp.readDataStoreKey(ENTRYID)
mobileApplication.dataStoreApp.readDataStoreKey<Int>(SUPPLIERID),
mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)
)
}

View File

@ -48,8 +48,8 @@ class PackagingSummaryFragment(
viewModel.getItemsPackaging(
mobileApplication.dataStoreApp.readDataStoreKey(SUPPLIERID),
mobileApplication.dataStoreApp.readDataStoreKey(ENTRYID)
mobileApplication.dataStoreApp.readDataStoreKey<Int>(SUPPLIERID),
mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)
)
ma.hideBottomNavigation(View.GONE)

View File

@ -921,6 +921,8 @@
<string name="actionParking">{\"action\":\"Se acepta el cambio de %1$s de %2$s a %3$s por el usuario %4$s\"}</string>
<string name="tansferItem">{\"action\":\"Se acepta el cambio de %1$s el artículo %2$s a %3$s por el usuario %4$s\"}</string>
<string name="reserve">Reserva</string>
<string name="shelvingItems">No hay artículos en el carro para cambiar su matrícula</string>
<string name="errorDMS">No se puede obterner el tipo DMS. Póngase en contacto con dpto Informática</string>
</resources>

View File

@ -921,5 +921,7 @@
<string name="actionParking">{\"action\":\"Se acepta el cambio de %1$s de %2$s a %3$s por el usuario %4$s\"}</string>
<string name="tansferItem">{\"action\":\"Se acepta el cambio de %1$s el artículo %2$s a %3$s por el usuario %4$s\"}</string>
<string name="reserve">Reserva</string>
<string name="shelvingItems">No hay artículos en el carro para cambiar su matrícula</string>
<string name="errorDMS">No se puede obterner el tipo DMS. Póngase en contacto con dpto Informática</string>
</resources>

View File

@ -921,5 +921,7 @@
<string name="actionParking">{\"action\":\"Se acepta el cambio de %1$s de %2$s a %3$s por el usuario %4$s\"}</string>
<string name="tansferItem">{\"action\":\"Se acepta el cambio de %1$s el artículo %2$s a %3$s por el usuario %4$s\"}</string>
<string name="reserve">Reserva</string>
<string name="shelvingItems">No hay artículos en el carro para cambiar su matrícula</string>
<string name="errorDMS">No se puede obterner el tipo DMS. Póngase en contacto con dpto Informática</string>
</resources>

View File

@ -925,5 +925,7 @@
<string name="actionParking">{\"action\":\"Se acepta el cambio de %1$s de %2$s a %3$s por el usuario %4$s\"}</string>
<string name="tansferItem">{\"action\":\"Se acepta el cambio de %1$s el artículo %2$s a %3$s por el usuario %4$s\"}</string>
<string name="reserve">Reserva</string>
<string name="shelvingItems">No hay artículos en el carro para cambiar su matrícula</string>
<string name="errorDMS">No se puede obterner el tipo DMS. Póngase en contacto con dpto Informática</string>
</resources>