forked from enviPath/enviPy
136 lines
3.7 KiB
HTML
136 lines
3.7 KiB
HTML
{% load static %}
|
|
<dialog
|
|
id="add_structure_modal"
|
|
class="modal"
|
|
x-data="modalForm()"
|
|
@close="reset()"
|
|
>
|
|
<div class="modal-box max-w-4xl">
|
|
<!-- Header -->
|
|
<h3 class="text-lg font-bold">Create a new Structure</h3>
|
|
|
|
<!-- Close button (X) -->
|
|
<form method="dialog">
|
|
<button
|
|
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
:disabled="isSubmitting"
|
|
>
|
|
✕
|
|
</button>
|
|
</form>
|
|
|
|
<!-- Body -->
|
|
<div class="py-4">
|
|
<form
|
|
id="add_structure_modal_form"
|
|
accept-charset="UTF-8"
|
|
action="{% url 'package compound structure list' meta.current_package.uuid compound.uuid %}"
|
|
data-remote="true"
|
|
method="post"
|
|
>
|
|
{% csrf_token %}
|
|
<div class="form-control mb-3">
|
|
<label class="label" for="structure-name">
|
|
<span class="label-text">Name</span>
|
|
</label>
|
|
<input
|
|
id="structure-name"
|
|
type="text"
|
|
class="input input-bordered w-full"
|
|
name="structure-name"
|
|
placeholder="Name"
|
|
/>
|
|
</div>
|
|
|
|
<div class="form-control mb-3">
|
|
<label class="label" for="structure-description">
|
|
<span class="label-text">Description</span>
|
|
</label>
|
|
<input
|
|
id="structure-description"
|
|
type="text"
|
|
class="input input-bordered w-full"
|
|
name="structure-description"
|
|
placeholder="Description"
|
|
/>
|
|
</div>
|
|
|
|
<div class="form-control mb-3">
|
|
<label class="label" for="structure-smiles">
|
|
<span class="label-text">SMILES</span>
|
|
</label>
|
|
<div class="join mx-auto w-full">
|
|
<input
|
|
type="text"
|
|
class="input input-bordered join-item w-full"
|
|
name="structure-smiles"
|
|
placeholder="SMILES"
|
|
id="structure-smiles"
|
|
/>
|
|
<input
|
|
type="hidden"
|
|
name="structure-molfile"
|
|
id="structure-molfile"
|
|
/>
|
|
<button
|
|
type="button"
|
|
id="render-structure-smiles"
|
|
class="btn join-item"
|
|
>
|
|
Render
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-3">
|
|
{% with iframe_id="add_structure_ketcher" height="624" text_input_id="structure-smiles" molfile_input_id="structure-molfile" %}
|
|
{% include "components/ketcher.html" %}
|
|
{% endwith %}
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Footer -->
|
|
<div class="modal-action">
|
|
<button
|
|
type="button"
|
|
class="btn"
|
|
onclick="this.closest('dialog').close()"
|
|
:disabled="isSubmitting"
|
|
>
|
|
Close
|
|
</button>
|
|
<button
|
|
type="button"
|
|
class="btn btn-primary"
|
|
@click="submit('add_structure_modal_form')"
|
|
:disabled="isSubmitting"
|
|
>
|
|
<span x-show="!isSubmitting">Submit</span>
|
|
<span
|
|
x-show="isSubmitting"
|
|
class="loading loading-spinner loading-sm"
|
|
></span>
|
|
<span x-show="isSubmitting">Submitting...</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Backdrop -->
|
|
<form method="dialog" class="modal-backdrop">
|
|
<button :disabled="isSubmitting">close</button>
|
|
</form>
|
|
</dialog>
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
const renderButton = document.getElementById("render-structure-smiles");
|
|
renderButton.addEventListener("click", async function (e) {
|
|
let smiles = document.getElementById("structure-smiles").value.trim();
|
|
|
|
if (smiles) {
|
|
setKetcherMolecule(smiles, false);
|
|
}
|
|
});
|
|
});
|
|
</script>
|