import { MatDialog } from "@angular/material/dialog";
import { Router } from "@angular/router";
import Parse from "parse";
import { ParseSchema } from "./func-parse";

export const EduTextbook:ParseSchema = {
    title:"教材",
    className:"EduTextbook",
    emptyImg:"/img/webhook-empty.png",
    include:["user"],
    buttons:[
        // 仅在 /nav-author/manage/space 显示的编辑
        {
            name:"编辑",
            place:"item",
            show:(options:{object:Parse.Object})=>{
                if(location?.pathname=='/nav-author/manage/space'){
                    return true
                }
                return false
            },
            handle:(options:{dialog:MatDialog,object:Parse.Object,router?:Router})=>{
                options.router?.navigate(['/nav-author/manage/apply',{id:options.object.id}])
            }
        },
    ],
    fieldsArray:[
        {key:"title",name:"教材名称",type:"String",isHeader:true},
        {key:"desc",name:"教材描述",type:"String"},
        {key:"user",name:"创建人",type:"Pointer",targetClass:"_User",isHeader:true,showName:"${mobile}"},
    ]
}