resq/templates/geofence/form.html.twig
2019-06-03 08:05:10 +00:00

96 lines
3.8 KiB
Twig

{% extends 'base.html.twig' %}
{% block body %}
<!-- BEGIN: Subheader -->
<div class="m-subheader">
<div class="d-flex align-items-center">
<div class="mr-auto">
<h3 class="m-subheader__title">Geofence</h3>
</div>
</div>
</div>
<!-- END: Subheader -->
<div class="m-content">
<!--Begin::Section-->
<div class="row">
<div class="col-xl-12">
<div class="m-portlet m-portlet--mobile">
<div class="m-portlet__head">
<div class="m-portlet__head-caption">
<div class="m-portlet__head-title">
<span class="m-portlet__head-icon">
<i class="fa fa-building"></i>
</span>
<h3 class="m-portlet__head-text">
New Coverage Area
</h3>
</div>
</div>
</div>
<form id="row-form" class="m-form m-form--label-align-right">
<div class="m-portlet__body">
<div class="form-group m-form__group row no-border">
<div class="col-lg-6">
<label data-field="kml_file">
KML File
</label>
<div class="m-dropzone dropzone m-dropzone--primary" action="{{ url('geofence_upload_kml') }}" id="kml-file">
<div class="m-dropzone__msg dz-message needsclick">
<h3 class="m-dropzone__msg-title">
Drop files here or click to upload.
</h3>
<span class="m-dropzone__msg-desc">
Upload only valid KML files
</span>
</div>
</div>
<div class="form-control-feedback hide" data-field="kml_file"></div>
</div>
</div>
</div>
<div class="m-portlet__foot m-portlet__foot--fit">
<div class="m-form__actions m-form__actions--solid m-form__actions--right">
<div class="row">
<div class="col-lg-12">
<a href="{{ url('geofence_list') }}" class="btn btn-success">Submit</button>
<a href="{{ url('geofence_list') }}" class="btn btn-secondary">Back</a>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}
{% block scripts %}
<script>
// image upload
Dropzone.options.kmlFile = {
paramName: "kml_file", // The name that will be used to transfer the file
maxFiles: 1,
uploadMultiple: false,
maxFilesize: 5, // MB
addRemoveLinks: true,
acceptedFiles: "text/xml, .kml",
accept: function(file, done) {
done();
},
init: function() {
this.on("maxfilesexceeded", function(file) {
// limit to one file, overwrite old one
this.removeAllFiles();
this.addFile(file);
});
},
success: function(file, response) {
if (response.success) {
$("input[name='kml_file']").val(response.filename);
}
}
};
</script>
{% endblock %}