{# Save as modal component #}
<div class="modal fade" id="saveasModal" tabindex="-1" aria-labelledby="saveasModal" aria-hidden="true" >
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h1 class="modal-title fs-5" id="saveasModal">Save your script as </h1>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <form method="POST" name="save-as" action="{{ url_for('library.save_as') }}">
                <div class="modal-body">
                    <div class="mb-3">
                        <label class="form-label" for="run_name">Run Name</label>
                        <input class="form-control" type="text" name="run_name" id="run_name"
                               value="{{script.name if script.name else ''}}"
                               required="required">
                    </div>
                    <div class="mb-3">
                        <label for="description" class="form-label">Description</label>
                        <textarea class="form-control"
                                  name="description"
                                  id="description"
                                  maxlength="255"
                                  rows="2"
                                  placeholder="Describe your workflow here.">{{ script.description }}</textarea>
                        <div class="form-text text-end">Max 250 characters</div>
                    </div>
                    <div class="form-check form-switch">
                        <input class="form-check-input" type="checkbox" name="register_workflow" id="register_workflow">
                        <label class="input-group-label" for="register_workflow">Register this workflow</label>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal"> Close </button>
                    <button type="submit"  class="btn btn-primary" > Save </button>
                </div>
            </form>
        </div>
    </div>
</div> 