<?php

namespace App\Admin\Controllers;

use App\Services\AgentProjectCateService;
use Slowlyo\OwlAdmin\Controllers\AdminController;

/**
 * 代理商项目分类
 *
 * @property AgentProjectCateService $service
 */
class AgentProjectCateController extends AdminController
{
	protected string $serviceName = AgentProjectCateService::class;

	public function list()
	{
		$crud = $this->baseCRUD()
			->filterTogglable(false)
			->headerToolbar([
				$this->createButton('dialog'),
				...$this->baseHeaderToolBar()
			])
			->columns([
				amis()->TableColumn('id', 'ID')->sortable(),
				amis()->TableColumn('agent_id', '代理商ID'),
				amis()->TableColumn('cate_id', '项目分类ID'),
				amis()->TableColumn('state', '状态(enable:启用 disable:禁用)'),
				amis()->TableColumn('created_at', admin_trans('admin.created_at'))->type('datetime')->sortable(),
				amis()->TableColumn('updated_at', admin_trans('admin.updated_at'))->type('datetime')->sortable(),
				$this->rowActions('dialog')
			]);

		return $this->baseList($crud);
	}

	public function form($isEdit = false)
	{
		return $this->baseForm()->body([
			amis()->TextControl('agent_id', '代理商ID'),
			amis()->TextControl('cate_id', '项目分类ID'),
			amis()->TextControl('state', '状态(enable:启用 disable:禁用)'),
		]);
	}

	public function detail()
	{
		return $this->baseDetail()->body([
			amis()->TextControl('id', 'ID')->static(),
			amis()->TextControl('agent_id', '代理商ID')->static(),
			amis()->TextControl('cate_id', '项目分类ID')->static(),
			amis()->TextControl('state', '状态(enable:启用 disable:禁用)')->static(),
			amis()->TextControl('created_at', admin_trans('admin.created_at'))->static(),
			amis()->TextControl('updated_at', admin_trans('admin.updated_at'))->static(),
		]);
	}
}