refs #5651 notifications

This commit is contained in:
Sergio De la torre 2023-06-15 07:50:59 +02:00
parent 86c51e4e99
commit c23ae39ae1
5 changed files with 47 additions and 33 deletions

View File

@ -9,10 +9,7 @@ import es.verdnatura.presentation.view.feature.collection.listSaleSalix
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
import es.verdnatura.presentation.view.feature.login.model.SalixGrupo import es.verdnatura.presentation.view.feature.login.model.SalixGrupo
import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix import es.verdnatura.presentation.view.feature.packaging.model.*
import es.verdnatura.presentation.view.feature.packaging.model.ItemSupplier
import es.verdnatura.presentation.view.feature.packaging.model.Supplier
import es.verdnatura.presentation.view.feature.packaging.model.obervationEntry
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
import okhttp3.MultipartBody import okhttp3.MultipartBody
@ -207,6 +204,12 @@ interface SalixService {
): ):
Call<EntrySalix> Call<EntrySalix>
@POST("notificationQueues")
fun notificationQueues(
@Body notificationQueue: notificationQueue
):
Call<Void>
@POST("Images/upload") @POST("Images/upload")
@Multipart @Multipart
fun uploadImage( fun uploadImage(

View File

@ -3,7 +3,6 @@ package es.verdnatura.presentation.view.feature.packaging.fragment
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build import android.os.Build
import android.text.InputType import android.text.InputType
import android.util.Log.d
import android.view.View import android.view.View
import android.widget.ImageView import android.widget.ImageView
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
@ -41,12 +40,6 @@ class PackagingCountFragment(
override fun init() { override fun init() {
/* binding.quantityPackaging.setOnClickListener {
ma.onPasillerosItemClickListener(
PasillerosItemVO(title = getString(R.string.titlePackagingObs)),
getString(R.string.titlePackagingObs)
)
}*/
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.getItemsPackaging( viewModel.getItemsPackaging(
getDataInt("SUPPLIERID"), getDataInt("ENTRYID") getDataInt("SUPPLIERID"), getDataInt("ENTRYID")
@ -61,7 +54,8 @@ class PackagingCountFragment(
private fun setToolBar() { private fun setToolBar() {
binding.mainToolbar.toolbarTitle.text = getData("ENTRYTYPE") + ": " + getData("SUPPLIERNAME") binding.mainToolbar.toolbarTitle.text =
"${getData("ENTRYTYPE")}: ${getData("SUPPLIERNAME")}"
val listIcons: ArrayList<ImageView> = ArrayList() val listIcons: ArrayList<ImageView> = ArrayList()
val iconNext = ImageView(context) val iconNext = ImageView(context)
@ -124,24 +118,18 @@ class PackagingCountFragment(
ItemSupplierAdapter(it.list, object : OnImageUpdateClickListener { ItemSupplierAdapter(it.list, object : OnImageUpdateClickListener {
override fun OnImageUpdateClickListener(item: Any) { override fun OnImageUpdateClickListener(item: Any) {
d("VERDNATURA::", "Seleccionado update" + (item as ItemSupplier).name) showCustomDialog("quantity", item as ItemSupplier)
showCustomDialog("quantity", item)
} }
}, object : OnImageTrashClickListener { }, object : OnImageTrashClickListener {
override fun OnImageTrashClickListener(item: Any) { override fun OnImageTrashClickListener(item: Any) {
d("VERDNATURA::", "Seleccionado trash" + (item as ItemSupplier).name) showCustomDialog("delete", item as ItemSupplier)
showCustomDialog("delete", item)
} }
}, object : OnEditSubQuantityListener { }, object : OnEditSubQuantityListener {
override fun OnEditSubQuantityListener(item: Any, text: String) { override fun OnEditSubQuantityListener(item: Any, text: String) {
d(
"VERDNATURA::",
"la subquantity es " + (item as ItemSupplier).name + "el valor es :" + text
)
hideKeyboard() hideKeyboard()
} }
}) })
@ -161,36 +149,28 @@ class PackagingCountFragment(
when (action) { when (action) {
"quantity" -> { "quantity" -> {
customDialogInput.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER) customDialogInput.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER)
// customDialogInput.getEditText().inputType = InputType.TYPE_CLASS_NUMBER
customDialogInput.setTitle(getString(R.string.quantityReviewed)) customDialogInput.setTitle(getString(R.string.quantityReviewed))
.setDescription(getString(R.string.Indicanuevacantidad)) .setDescription(getString(R.string.Indicanuevacantidad))
.setOkButton(getString(R.string.accept)) { .setOkButton(getString(R.string.accept)) {
if (!customDialogInput.getValue().isNullOrEmpty()) { if (!customDialogInput.getValue().isEmpty()) {
requireActivity().hideKeyboard() requireActivity().hideKeyboard()
} }
/* println("Cantidad total stickers ${item.quantityTotal}")
println("Cantidad entrada ${item.quantity}")
println("cantidad" + customDialogInput.getValue().toInt())
println("suma:"+item.quantity!!.plus(customDialogInput.getValue().toInt()))*/
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
viewModel.entry_addFromBuy( viewModel.entry_addFromBuy(
getDataInt("ENTRYID"), item = item.id!!.toInt(), getDataInt("ENTRYID"), item = item.id!!.toInt(),
(if (getData("ENTRYTYPE") == "Rec") { (if (getData("ENTRYTYPE") == "Rec") {
(item.printedStickers!!.plus(customDialogInput.getValue().toInt())) (item.printedStickers.plus(customDialogInput.getValue().toInt()))
} else { } else {
item.printedStickers!!.plus(customDialogInput.getValue().toInt() * -1) item.printedStickers.plus(customDialogInput.getValue().toInt() * -1)
}) as Number }) as Number
) )
customDialog.cancel() customDialog.cancel()
customDialogInput.dismiss() customDialogInput.dismiss()
customDialogInput.setValue("") customDialogInput.setValue("")
// requireActivity().showKeyboard()
}.setKoButton(getString(R.string.cancel)) { }.setKoButton(getString(R.string.cancel)) {
customDialog.cancel() customDialog.cancel()
customDialogInput.dismiss() customDialogInput.dismiss()
// requireActivity().showKeyboard()
}.setValue("") }.setValue("")
.show() .show()
@ -198,7 +178,6 @@ class PackagingCountFragment(
customDialogInput.currentFocus customDialogInput.currentFocus
customDialogInput.setFocusText() customDialogInput.setFocusText()
// requireActivity().showKeyboard()
} }
"delete" -> { "delete" -> {
customDialog.setTitle(getString(R.string.deleteEntryReviewed)) customDialog.setTitle(getString(R.string.deleteEntryReviewed))

View File

@ -113,6 +113,7 @@ class PackagingSummaryFragment(
R.string.accept R.string.accept
) )
) { ) {
viewModel.notificationQueues("modified-entry",getDataInt(USERFK),"""{"url":"${getData("base_urlSalix")}/#!/entry/${getDataInt("ENTRYID")}/summary"}""")
customDialog.dismiss() customDialog.dismiss()
} }

View File

@ -254,6 +254,31 @@ class PackagingViewModel(val context: Context) : BaseViewModel(context) {
} }
}) })
} }
fun notificationQueues(notification: String, workerfk: Int, bodyUrl: String) {
salix.notificationQueues(notificationQueue(notification,workerfk,bodyUrl))
.enqueue(object : SilexCallback<Void>(context){override fun onError(t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
t.message!!
)
)
}
override fun onSuccess(response: Response<Void>) {
_response.value = ResponseItemVO(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
}
})
}
fun entry_addFromPackaging(supplier: Number,isPackaging: Boolean) { fun entry_addFromPackaging(supplier: Number,isPackaging: Boolean) {
salix.addFromPackaging(supplier, isPackaging) salix.addFromPackaging(supplier, isPackaging)
.enqueue(object : SilexCallback<EntrySalix>(context) { .enqueue(object : SilexCallback<EntrySalix>(context) {

View File

@ -30,3 +30,9 @@ fun List<EntrySalix>.toDateFormat(): ArrayList<EntrySalix> {
data class obervationEntry( data class obervationEntry(
val observation:String val observation:String
) )
data class notificationQueue(
val notificationFk:String,
val authorFk:Int,
val params: String
)