package formview

import (
	"go_dreamfactory/cmd/v2/lib/common"
	"go_dreamfactory/cmd/v2/model"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/theme"
	"fyne.io/fyne/v2/widget"
)

type SociatyAppListView struct {
	BaseformView
	applyList func()
	itemList  *common.ItemList
	flag      bool
}

func (this *SociatyAppListView) CreateView(t *model.TestCase) fyne.CanvasObject {
	this.itemList = common.NewItemList()

	this.itemList.ItemList = this.itemList.CreateDefaultCheckList()

	this.applyList = func() {
	}
	defer this.applyList()

	// 同意
	agreeBtn := widget.NewButton("同意", nil)

	// 拒绝
	refuseBtn := widget.NewButton("拒绝", nil)

	refreshBtn := widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), func() {
		this.itemList.Reset()
		this.applyList()
	})

	buttonBar := container.NewHBox(refreshBtn, agreeBtn, refuseBtn)
	c := container.NewBorder(buttonBar, nil, nil, nil, this.itemList.ItemList)
	return c
}
