<?php

namespace App\Admin\Actions\Grid;

use App\Admin\Actions\Form\BatchEditProductForm;
use Dcat\Admin\Grid\BatchAction;
use Dcat\Admin\Widgets\Modal;

class BatchProduct extends BatchAction
{
    /**
     * @return string
     */
	protected $title = '批量设置';




    public function render()
    {
        $form = BatchEditProductForm::make();

        return Modal::make()
            ->lg()
            ->title($this->title)
            ->body($form)
            ->onLoad($this->getModalScript())
            ->button($this->title);
    }

    protected function getModalScript()
    {
        return <<<JS
//获取选中的ID
let key = {$this->getSelectedKeysScript()}
$("#batch-id").val(key)
JS;

    }
}
