fix: 🐛 show import config in all cases for conceptors
This commit is contained in:
parent
7e4b51125e
commit
d0640dc770
1 changed files with 14 additions and 13 deletions
|
|
@ -35,6 +35,7 @@ import { Methods } from "@/lib/enums";
|
|||
import { AppEnv, AuthProp, ConfigField, LaravelEnum, PageConfigModel } from "@/back/types/global";
|
||||
import SubmitButton from "@/back/Components/SubmitButton";
|
||||
import { useCrudSubmit } from "@/hooks/use-crud-submit";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export default function Form({
|
||||
model,
|
||||
|
|
@ -172,6 +173,18 @@ export default function Form({
|
|||
icon={<CogIcon className="mr-1" />}
|
||||
description={useTrans("back.form_subtitle_config")}
|
||||
>
|
||||
{/* Import configuration from json file. */}
|
||||
{auth.user.role === enumUserRole.conceptor.value && (
|
||||
<div className={cn('mb-3', { 'border-b pb-6 mb-6': !route().current('back.page-configs.edit') })}>
|
||||
<ImportConfigJson
|
||||
onConfirm={(value, overwrite) => {
|
||||
const newConfig = (!overwrite) ? [...data.config, ...value] : value;
|
||||
setData('config', newConfig as ConfigField[])
|
||||
setResetState(prev => prev + 1)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{/* Show only on editing page. */}
|
||||
{route().current('back.page-configs.edit') && (
|
||||
<div className="flex justify-center items-center border-b pb-6 mb-6 gap-1.5">
|
||||
|
|
@ -210,25 +223,13 @@ export default function Form({
|
|||
{auth.user.role === enumUserRole.conceptor.value && (
|
||||
<ExportConfigJson
|
||||
data={data.config}
|
||||
filename="page-config.json"
|
||||
filename={`${str(data.label).slug().value()}.json`}
|
||||
tooltipContent={useTrans('back.json_editor.export_tooltip')}
|
||||
disabled={!data.config.length}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{/* Show only on creating page. */}
|
||||
{auth.user.role === enumUserRole.conceptor.value && route().current('back.page-configs.create') && (
|
||||
<div className="border-b pb-6 mb-6">
|
||||
<ImportConfigJson
|
||||
onConfirm={(value, overwrite) => {
|
||||
const newConfig = (!overwrite) ? [...data.config, ...value] : value;
|
||||
setData('config', newConfig as ConfigField[])
|
||||
setResetState(prev => prev + 1)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<PageConfigDynamicFields
|
||||
key={resetState}
|
||||
name="config"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue