<?php $this->extend('form_row'); ?>
<?php $this->block('label'); ?>
<?php
$arrNewFiles = [];
foreach ((array)$_SESSION['FILES'] as $file) {
$arrNewFiles[] = $file['short_tmp_name'];
}
$arrNewFiles = array_unique($arrNewFiles);
?>
<div class="row">
<div class="col col-md-6">
<div id="drag-and-drop-zone" class="dm-uploader card text-center">
<h3 class="card-title">Drag & drop here</h3>
<?php if ($this->label): ?>
<label for="ctrl_<?= $this->id ?>"<?php if ($this->class): ?> class="<?= $this->class ?>"<?php endif; ?>>
<?php if ($this->mandatory): ?>
<span class="invisible"><?= $this->mandatoryField ?> </span><?= $this->label ?><span class="mandatory">*</span>
<?php else: ?>
<?= $this->label ?>
<?php endif; ?>
</label>
<?php endif; ?>
<?php $this->endblock(); ?>
<?php $this->block('field'); ?>
<?php if ($this->hasErrors()): ?>
<p class="error"><?= $this->getErrorAsString() ?></p>
<?php endif; ?>
<input type="file" name="temp_dmuploader" class="invisible">
<div class="button button-primary trigger-button">
<span>Or, Click to Open the File Browser</span>
<input type="hidden" name="<?= $this->name ?>_dmuploader" id="ctrl_<?= $this->id ?>_dmuploader" class="<?php if ($this->class) echo ' ' . $this->class; ?>"<?= $this->getAttributes() ?>>
<input type="hidden" name="<?= $this->name ?>" id="ctrl_<?= $this->id ?>" class="dmupload<?php if ($this->class) echo ' ' . $this->class; ?>"<?= $this->getAttributes() ?> value="<?= specialchars(implode(',', $arrNewFiles)) ?>">
</div>
</div>
</div>
<div class="col col-md-6">
<div id="file-list" class="card filesList">
<ul id="files">
<li class="empty">No files uploaded</li>
</ul>
</div>
</div>
</div>
<script type="text/html" id="files-template">
<li class="media">
<img class="mr-3 mb-2 preview-img" src="/files/assets/img/placeholder/placeholder-upload.jpg" alt="Generic placeholder image">
<div class="media-body mb-1">
<p class="mb-2">
<strong>%%filename%%</strong> - Status: <span class="text-muted">Waiting</span>
</p>
<div class="progress mb-2">
<div class="progress-bar progress-bar-striped progress-bar-animated bg-primary"
role="progressbar"
style="width: 0%"
aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
</div>
</div>
<hr class="mt-1 mb-1" />
</div>
</li>
</script>
<?php $this->endblock(); ?>