moves createrecord component to use new modal
This commit is contained in:
parent
85289889f4
commit
cef7693026
|
@ -67,39 +67,37 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div class="actions">
|
||||||
<h4 class="budibase__title--4">Create / Edit Record</h4>
|
<h4 class="budibase__title--4">Create / Edit Record</h4>
|
||||||
<ErrorsBox {errors} />
|
<ErrorsBox {errors} />
|
||||||
<div class="actions">
|
<form class="uk-form-stacked">
|
||||||
<form class="uk-form-stacked">
|
{#if !record}
|
||||||
{#if !record}
|
<div class="uk-margin">
|
||||||
<div class="uk-margin">
|
<label class="uk-form-label" for="form-stacked-text">Model</label>
|
||||||
<label class="uk-form-label" for="form-stacked-text">Model</label>
|
<Select bind:value={selectedModel}>
|
||||||
<Select bind:value={selectedModel}>
|
{#each models as model}
|
||||||
{#each models as model}
|
<option value={model}>{model.name}</option>
|
||||||
<option value={model}>{model.name}</option>
|
{/each}
|
||||||
{/each}
|
</Select>
|
||||||
</Select>
|
</div>
|
||||||
</div>
|
{/if}
|
||||||
{/if}
|
{#each modelFields || [] as field}
|
||||||
{#each modelFields || [] as field}
|
<RecordFieldControl record={editingRecord} {field} {errors} />
|
||||||
<RecordFieldControl record={editingRecord} {field} {errors} />
|
{/each}
|
||||||
{/each}
|
</form>
|
||||||
</form>
|
|
||||||
<footer>
|
|
||||||
<ActionButton alert on:click={onClosed}>Cancel</ActionButton>
|
|
||||||
<ActionButton on:click={saveRecord}>Save</ActionButton>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<footer>
|
||||||
|
<ActionButton alert on:click={onClosed}>Cancel</ActionButton>
|
||||||
|
<ActionButton on:click={saveRecord}>Save</ActionButton>
|
||||||
|
</footer>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
.actions {
|
||||||
|
padding: 30px;
|
||||||
|
}
|
||||||
footer {
|
footer {
|
||||||
position: absolute;
|
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
width: 100%;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
background: #fafafa;
|
background: #fafafa;
|
||||||
|
border-radius: 0.5rem;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,8 +1,25 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { getContext } from "svelte"
|
||||||
import ModelDataTable from "components/database/ModelDataTable"
|
import ModelDataTable from "components/database/ModelDataTable"
|
||||||
import { store, backendUiStore } from "builderStore"
|
import { store, backendUiStore } from "builderStore"
|
||||||
import ActionButton from "components/common/ActionButton.svelte"
|
import ActionButton from "components/common/ActionButton.svelte"
|
||||||
import * as api from "components/database/ModelDataTable/api"
|
import * as api from "components/database/ModelDataTable/api"
|
||||||
|
import { CreateEditRecordModal } from "components/database/ModelDataTable/modals"
|
||||||
|
|
||||||
|
const { open, close } = getContext("simple-modal")
|
||||||
|
|
||||||
|
const createNewRecord = () => {
|
||||||
|
console.log("TEST")
|
||||||
|
selectedRecord = null
|
||||||
|
open(
|
||||||
|
CreateEditRecordModal,
|
||||||
|
{
|
||||||
|
onClosed: close,
|
||||||
|
record: selectedRecord,
|
||||||
|
},
|
||||||
|
{ styleContent: { padding: "0" } }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export let selectedDatabase
|
export let selectedDatabase
|
||||||
|
|
||||||
|
@ -21,12 +38,7 @@
|
||||||
<div class="database-actions">
|
<div class="database-actions">
|
||||||
<div class="budibase__label--big">{breadcrumbs}</div>
|
<div class="budibase__label--big">{breadcrumbs}</div>
|
||||||
{#if $backendUiStore.selectedDatabase.id}
|
{#if $backendUiStore.selectedDatabase.id}
|
||||||
<ActionButton
|
<ActionButton primary on:click={createNewRecord}>
|
||||||
primary
|
|
||||||
on:click={() => {
|
|
||||||
selectedRecord = null
|
|
||||||
backendUiStore.actions.modals.show('RECORD')
|
|
||||||
}}>
|
|
||||||
Create new record
|
Create new record
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
Loading…
Reference in New Issue