<?php

namespace App\Admin\Controllers;

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

/**
 * 店铺
 *
 * @property ShopInfoService $service
 */
class ShopInfoController extends AdminController
{
	protected string $serviceName = ShopInfoService::class;

	public function list()
	{
		$crud = $this->baseCRUD()
			->filterTogglable(false)
			->headerToolbar([
				$this->createButton('dialog'),
				...$this->baseHeaderToolBar()
			])
			->columns([
				amis()->TableColumn('id', 'ID')->sortable(),
				amis()->TableColumn('auth_record_id', '店铺认证记录编号'),
				amis()->TableColumn('salesperson_id', '业务员编号'),
				amis()->TableColumn('state', '状态'),
				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('auth_record_id', '店铺认证记录编号'),
			amis()->TextControl('salesperson_id', '业务员编号'),
			amis()->TextControl('state', '状态'),
		]);
	}

	public function detail()
	{
		return $this->baseDetail()->body([
			amis()->TextControl('id', 'ID')->static(),
			amis()->TextControl('auth_record_id', '店铺认证记录编号')->static(),
			amis()->TextControl('salesperson_id', '业务员编号')->static(),
			amis()->TextControl('state', '状态')->static(),
			amis()->TextControl('created_at', admin_trans('admin.created_at'))->static(),
			amis()->TextControl('updated_at', admin_trans('admin.updated_at'))->static(),
		]);
	}
}