package com.example.myapplication.components.templates

import TextNice
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import com.example.myapplication.R
import com.example.myapplication.components.funs.createProductCard
import com.example.myapplication.database.entities.Product
import com.example.myapplication.product.ProductOld
import myColor3

@Composable
fun CatalogItems (navController: NavController, title: String, products: MutableList<Product>){

    LazyColumn (
        contentPadding = PaddingValues(horizontal = 16.dp, vertical = 8.dp),
    ){
        item {
            TextNice(title)
        }
        item{
            for (product in products){
                createProductCard(product.name, product.price, product.img, { }, { })
            }
        }
        item {
            Button(
                onClick = { navController.navigate("addProduct") },
                colors = ButtonDefaults.buttonColors(
                    containerColor= Color.Transparent,
                    contentColor = myColor3
                ),
                contentPadding = PaddingValues(0.dp),
                modifier = Modifier.size(50.dp).padding(top = 10.dp)

            ) {
                Image(
                    painter = painterResource(id = R.drawable.add),
                    contentDescription = null,
                    modifier = Modifier.size(50.dp)
                )
            }
        }
    }
}