|
|
|
@ -1,5 +1,17 @@ |
|
|
|
|
<script> |
|
|
|
|
let Data = new GetJson("/api/admin/table/{{ .Table }}/{{ .Id }}/"); |
|
|
|
|
|
|
|
|
|
const PostForm = async (url, data) => { |
|
|
|
|
console.log("DATA", JSON.stringify(data)); |
|
|
|
|
return await fetch(url, { |
|
|
|
|
method: "POST", |
|
|
|
|
mode: "same-origin", |
|
|
|
|
body: JSON.stringify(data), |
|
|
|
|
headers: { |
|
|
|
|
'Content-Type': 'application/json' |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<blockstart> |
|
|
|
@ -13,15 +25,15 @@ |
|
|
|
|
<template x-for="(value, key) in item"> |
|
|
|
|
<div> |
|
|
|
|
<label x-text="key" x-bind:for="key"></label> |
|
|
|
|
<input x-text="value" x-bind:value="value" x-bind:id="key" /> |
|
|
|
|
<input x-text="value" x-model="item[key]" x-bind:id="key" /> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
</middle> |
|
|
|
|
<bottom> |
|
|
|
|
<button-group> |
|
|
|
|
<button type="button">Back</button> |
|
|
|
|
<button type="submit">Update</button> |
|
|
|
|
<button type="button">Delete</button> |
|
|
|
|
<button type="button" @click.prevent="PostForm('/api/admin/table/{{ .Table }}/{{ .Id }}/', item)">Update</button> |
|
|
|
|
<button type="button" @click.prevent="console.log('DELETE', item.id)">Delete</button> |
|
|
|
|
</button-group> |
|
|
|
|
</bottom> |
|
|
|
|
</card> |
|
|
|
|