<?php

namespace App\Admin\Controllers;

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

/**
 * 店铺认证记录
 *
 * @property ShopAuthRecordService $service
 */
class ShopAuthRecordController extends AdminController
{
	protected string $serviceName = ShopAuthRecordService::class;

	public function list()
	{
		$crud = $this->baseCRUD()
			->filterTogglable(false)
			->headerToolbar([
				$this->createButton('dialog'),
				...$this->baseHeaderToolBar()
			])
			->columns([
				amis()->TableColumn('id', 'ID')->sortable(),
				amis()->TableColumn('shop_id', '店铺编号'),
				amis()->TableColumn('shop_name', '店铺名称'),
				amis()->TableColumn('shop_desc', '店铺描述'),
				amis()->TableColumn('shop_address', '店铺地址'),
				amis()->TableColumn('contact_phone', '店铺联系电话'),
				amis()->TableColumn('contact_name', '店铺联系人'),
				amis()->TableColumn('contact_id_card', '店铺联系人身份证'),
				amis()->TableColumn('id_card_front_photo', '店铺联系人身份证正面'),
				amis()->TableColumn('id_card_back_photo', '店铺联系人身份证反面'),
				amis()->TableColumn('business_license', '店铺营业执照'),
				amis()->TableColumn('license_front_photo', '店铺营业执照正面'),
				amis()->TableColumn('license_back_photo', '店铺营业执照反面'),
				amis()->TableColumn('storefront_photo', '店铺门头照'),
				amis()->TableColumn('storefront_front_photo', '店铺门头照正面'),
				amis()->TableColumn('storefront_back_photo', '店铺门头照反面'),
				amis()->TableColumn('longitude', '店铺经营地址经度'),
				amis()->TableColumn('latitude', '店铺经营地址纬度'),
				amis()->TableColumn('operating_area', '店铺经营面积'),
				amis()->TableColumn('operating_years', '店铺经营年限')->sortable(),
				amis()->TableColumn('technician_count', '店铺技师人数')->sortable(),
				amis()->TableColumn('business_hours', '店铺营业时间'),
				amis()->TableColumn('rating', '评分'),
				amis()->TableColumn('auditor', '审核人'),
				amis()->TableColumn('audit_time', '审核时间'),
				amis()->TableColumn('audit_remark', '审核回馈'),
				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('shop_id', '店铺编号'),
			amis()->TextControl('shop_name', '店铺名称'),
			amis()->TextControl('shop_desc', '店铺描述'),
			amis()->TextControl('shop_address', '店铺地址'),
			amis()->TextControl('contact_phone', '店铺联系电话'),
			amis()->TextControl('contact_name', '店铺联系人'),
			amis()->TextControl('contact_id_card', '店铺联系人身份证'),
			amis()->TextControl('id_card_front_photo', '店铺联系人身份证正面'),
			amis()->TextControl('id_card_back_photo', '店铺联系人身份证反面'),
			amis()->TextControl('business_license', '店铺营业执照'),
			amis()->TextControl('license_front_photo', '店铺营业执照正面'),
			amis()->TextControl('license_back_photo', '店铺营业执照反面'),
			amis()->TextControl('storefront_photo', '店铺门头照'),
			amis()->TextControl('storefront_front_photo', '店铺门头照正面'),
			amis()->TextControl('storefront_back_photo', '店铺门头照反面'),
			amis()->TextControl('longitude', '店铺经营地址经度'),
			amis()->TextControl('latitude', '店铺经营地址纬度'),
			amis()->TextControl('operating_area', '店铺经营面积'),
			amis()->TextControl('operating_years', '店铺经营年限'),
			amis()->TextControl('technician_count', '店铺技师人数'),
			amis()->TextControl('business_hours', '店铺营业时间'),
			amis()->TextControl('rating', '评分'),
			amis()->TextControl('auditor', '审核人'),
			amis()->TextControl('audit_time', '审核时间'),
			amis()->TextControl('audit_remark', '审核回馈'),
			amis()->TextControl('state', '审核状态'),
		]);
	}

	public function detail()
	{
		return $this->baseDetail()->body([
			amis()->TextControl('id', 'ID')->static(),
			amis()->TextControl('shop_id', '店铺编号')->static(),
			amis()->TextControl('shop_name', '店铺名称')->static(),
			amis()->TextControl('shop_desc', '店铺描述')->static(),
			amis()->TextControl('shop_address', '店铺地址')->static(),
			amis()->TextControl('contact_phone', '店铺联系电话')->static(),
			amis()->TextControl('contact_name', '店铺联系人')->static(),
			amis()->TextControl('contact_id_card', '店铺联系人身份证')->static(),
			amis()->TextControl('id_card_front_photo', '店铺联系人身份证正面')->static(),
			amis()->TextControl('id_card_back_photo', '店铺联系人身份证反面')->static(),
			amis()->TextControl('business_license', '店铺营业执照')->static(),
			amis()->TextControl('license_front_photo', '店铺营业执照正面')->static(),
			amis()->TextControl('license_back_photo', '店铺营业执照反面')->static(),
			amis()->TextControl('storefront_photo', '店铺门头照')->static(),
			amis()->TextControl('storefront_front_photo', '店铺门头照正面')->static(),
			amis()->TextControl('storefront_back_photo', '店铺门头照反面')->static(),
			amis()->TextControl('longitude', '店铺经营地址经度')->static(),
			amis()->TextControl('latitude', '店铺经营地址纬度')->static(),
			amis()->TextControl('operating_area', '店铺经营面积')->static(),
			amis()->TextControl('operating_years', '店铺经营年限')->static(),
			amis()->TextControl('technician_count', '店铺技师人数')->static(),
			amis()->TextControl('business_hours', '店铺营业时间')->static(),
			amis()->TextControl('rating', '评分')->static(),
			amis()->TextControl('auditor', '审核人')->static(),
			amis()->TextControl('audit_time', '审核时间')->static(),
			amis()->TextControl('audit_remark', '审核回馈')->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(),
		]);
	}
}