Display project exports in modal box
This commit is contained in:
@@ -12,6 +12,7 @@ Improvements:
|
|||||||
* Open form to create customer filters in modal box
|
* Open form to create customer filters in modal box
|
||||||
* Open project activities in modal box
|
* Open project activities in modal box
|
||||||
* Display project analytics in modal box
|
* Display project analytics in modal box
|
||||||
|
* Display project exports in modal box
|
||||||
|
|
||||||
Version 1.0.36 (Dec 30, 2016)
|
Version 1.0.36 (Dec 30, 2016)
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|||||||
@@ -24,27 +24,29 @@ class ExportController extends BaseController
|
|||||||
private function common($model, $method, $filename, $action, $page_title)
|
private function common($model, $method, $filename, $action, $page_title)
|
||||||
{
|
{
|
||||||
$project = $this->getProject();
|
$project = $this->getProject();
|
||||||
$from = $this->request->getStringParam('from');
|
|
||||||
$to = $this->request->getStringParam('to');
|
|
||||||
|
|
||||||
if ($from && $to) {
|
if ($this->request->isPost()) {
|
||||||
$data = $this->$model->$method($project['id'], $from, $to);
|
$values = $this->request->getValues();
|
||||||
$this->response->withFileDownload($filename.'.csv');
|
$from = empty($values['from']) ? '' : $values['from'];
|
||||||
$this->response->csv($data);
|
$to = empty($values['to']) ? '' : $values['to'];
|
||||||
|
|
||||||
|
if ($from && $to) {
|
||||||
|
$data = $this->$model->$method($project['id'], $from, $to);
|
||||||
|
$this->response->withFileDownload($filename.'.csv');
|
||||||
|
$this->response->csv($data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$this->response->html($this->template->render('export/'.$action, array(
|
||||||
$this->response->html($this->helper->layout->project('export/'.$action, array(
|
'values' => array(
|
||||||
'values' => array(
|
|
||||||
'controller' => 'ExportController',
|
|
||||||
'action' => $action,
|
|
||||||
'project_id' => $project['id'],
|
'project_id' => $project['id'],
|
||||||
'from' => $from,
|
'from' => '',
|
||||||
'to' => $to,
|
'to' => '',
|
||||||
),
|
),
|
||||||
'errors' => array(),
|
'errors' => array(),
|
||||||
'project' => $project,
|
'project' => $project,
|
||||||
'title' => $page_title,
|
'title' => $page_title,
|
||||||
), 'export/sidebar'));
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
17
app/Template/export/header.php
Normal file
17
app/Template/export/header.php
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<div class="page-header">
|
||||||
|
<h2><?= $this->text->e($project['name']) ?> > <?= $title ?></h2>
|
||||||
|
<ul>
|
||||||
|
<li <?= $this->app->checkMenuSelection('ExportController', 'tasks') ?>>
|
||||||
|
<?= $this->modal->replaceLink(t('Tasks'), 'ExportController', 'tasks', array('project_id' => $project['id'])) ?>
|
||||||
|
</li>
|
||||||
|
<li <?= $this->app->checkMenuSelection('ExportController', 'subtasks') ?>>
|
||||||
|
<?= $this->modal->replaceLink(t('Subtasks'), 'ExportController', 'subtasks', array('project_id' => $project['id'])) ?>
|
||||||
|
</li>
|
||||||
|
<li <?= $this->app->checkMenuSelection('ExportController', 'transitions') ?>>
|
||||||
|
<?= $this->modal->replaceLink(t('Task transitions'), 'ExportController', 'transitions', array('project_id' => $project['id'])) ?>
|
||||||
|
</li>
|
||||||
|
<li <?= $this->app->checkMenuSelection('ExportController', 'summary') ?>>
|
||||||
|
<?= $this->modal->replaceLink(t('Daily project summary'), 'ExportController', 'summary', array('project_id' => $project['id'])) ?>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<div class="sidebar">
|
|
||||||
<ul>
|
|
||||||
<li <?= $this->app->checkMenuSelection('ExportController', 'tasks') ?>>
|
|
||||||
<?= $this->url->link(t('Tasks'), 'ExportController', 'tasks', array('project_id' => $project['id'])) ?>
|
|
||||||
</li>
|
|
||||||
<li <?= $this->app->checkMenuSelection('ExportController', 'subtasks') ?>>
|
|
||||||
<?= $this->url->link(t('Subtasks'), 'ExportController', 'subtasks', array('project_id' => $project['id'])) ?>
|
|
||||||
</li>
|
|
||||||
<li <?= $this->app->checkMenuSelection('ExportController', 'transitions') ?>>
|
|
||||||
<?= $this->url->link(t('Task transitions'), 'ExportController', 'transitions', array('project_id' => $project['id'])) ?>
|
|
||||||
</li>
|
|
||||||
<li <?= $this->app->checkMenuSelection('ExportController', 'summary') ?>>
|
|
||||||
<?= $this->url->link(t('Daily project summary'), 'ExportController', 'summary', array('project_id' => $project['id'])) ?>
|
|
||||||
</li>
|
|
||||||
<?= $this->hook->render('template:export:sidebar') ?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
@@ -1,20 +1,16 @@
|
|||||||
<div class="page-header">
|
<?= $this->render('export/header', array('project' => $project, 'title' => $title)) ?>
|
||||||
<h2><?= t('Subtasks export') ?></h2>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="alert alert-info"><?= t('This report contains all subtasks information for the given date range.') ?></p>
|
<p class="alert alert-info"><?= t('This report contains all subtasks information for the given date range.') ?></p>
|
||||||
|
|
||||||
<form method="get" action="?" autocomplete="off">
|
<form class="js-modal-ignore-form" method="post" action="<?= $this->url->href('ExportController', 'subtasks', array('project_id' => $project['id'])) ?>" autocomplete="off">
|
||||||
|
<?= $this->form->csrf() ?>
|
||||||
<?= $this->form->hidden('controller', $values) ?>
|
|
||||||
<?= $this->form->hidden('action', $values) ?>
|
|
||||||
<?= $this->form->hidden('project_id', $values) ?>
|
<?= $this->form->hidden('project_id', $values) ?>
|
||||||
<?= $this->form->date(t('Start date'), 'from', $values) ?>
|
<?= $this->form->date(t('Start date'), 'from', $values) ?>
|
||||||
<?= $this->form->date(t('End date'), 'to', $values) ?>
|
<?= $this->form->date(t('End date'), 'to', $values) ?>
|
||||||
|
|
||||||
<div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button type="submit" class="btn btn-blue"><?= t('Execute') ?></button>
|
<button type="submit" class="btn btn-blue js-form-export"><?= t('Export') ?></button>
|
||||||
|
<?= t('or') ?>
|
||||||
|
<?= $this->url->link(t('cancel'), 'ExportController', 'subtasks', array('project_id' => $project['id']), false, 'js-modal-close') ?>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
<div class="page-header">
|
<?= $this->render('export/header', array('project' => $project, 'title' => $title)) ?>
|
||||||
<h2><?= t('Daily project summary export') ?></h2>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="alert alert-info"><?= t('This export contains the number of tasks per column grouped per day.') ?></p>
|
<p class="alert alert-info"><?= t('This export contains the number of tasks per column grouped per day.') ?></p>
|
||||||
|
|
||||||
<form method="get" action="?" autocomplete="off">
|
<form class="js-modal-ignore-form" method="post" action="<?= $this->url->href('ExportController', 'summary', array('project_id' => $project['id'])) ?>" autocomplete="off">
|
||||||
<?= $this->form->hidden('controller', $values) ?>
|
<?= $this->form->csrf() ?>
|
||||||
<?= $this->form->hidden('action', $values) ?>
|
|
||||||
<?= $this->form->hidden('project_id', $values) ?>
|
<?= $this->form->hidden('project_id', $values) ?>
|
||||||
|
|
||||||
<?= $this->form->date(t('Start date'), 'from', $values) ?>
|
<?= $this->form->date(t('Start date'), 'from', $values) ?>
|
||||||
<?= $this->form->date(t('End date'), 'to', $values) ?>
|
<?= $this->form->date(t('End date'), 'to', $values) ?>
|
||||||
|
|
||||||
<div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button type="submit" class="btn btn-blue"><?= t('Execute') ?></button>
|
<button type="submit" class="btn btn-blue js-form-export"><?= t('Export') ?></button>
|
||||||
|
<?= t('or') ?>
|
||||||
|
<?= $this->url->link(t('cancel'), 'ExportController', 'summary', array('project_id' => $project['id']), false, 'js-modal-close') ?>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,20 +1,16 @@
|
|||||||
<div class="page-header">
|
<?= $this->render('export/header', array('project' => $project, 'title' => $title)) ?>
|
||||||
<h2><?= t('Tasks exportation') ?></h2>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="alert alert-info"><?= t('This report contains all tasks information for the given date range.') ?></p>
|
<p class="alert alert-info"><?= t('This report contains all tasks information for the given date range.') ?></p>
|
||||||
|
|
||||||
<form method="get" action="?" autocomplete="off">
|
<form class="js-modal-ignore-form" method="post" action="<?= $this->url->href('ExportController', 'tasks', array('project_id' => $project['id'])) ?>" autocomplete="off">
|
||||||
<?= $this->form->hidden('controller', $values) ?>
|
<?= $this->form->csrf() ?>
|
||||||
<?= $this->form->hidden('action', $values) ?>
|
|
||||||
<?= $this->form->hidden('project_id', $values) ?>
|
<?= $this->form->hidden('project_id', $values) ?>
|
||||||
|
|
||||||
<?= $this->form->date(t('Start date'), 'from', $values) ?>
|
<?= $this->form->date(t('Start date'), 'from', $values) ?>
|
||||||
<?= $this->form->date(t('End date'), 'to', $values) ?>
|
<?= $this->form->date(t('End date'), 'to', $values) ?>
|
||||||
|
|
||||||
<div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button type="submit" class="btn btn-blue"><?= t('Execute') ?></button>
|
<button type="submit" class="btn btn-blue js-form-export"><?= t('Export') ?></button>
|
||||||
|
<?= t('or') ?>
|
||||||
|
<?= $this->url->link(t('cancel'), 'ExportController', 'tasks', array('project_id' => $project['id']), false, 'js-modal-close') ?>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,21 +1,16 @@
|
|||||||
<div class="page-header">
|
<?= $this->render('export/header', array('project' => $project, 'title' => $title)) ?>
|
||||||
<h2><?= t('Task transitions export') ?></h2>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="alert alert-info"><?= t('This report contains all column moves for each task with the date, the user and the time spent for each transition.') ?></p>
|
<p class="alert alert-info"><?= t('This report contains all column moves for each task with the date, the user and the time spent for each transition.') ?></p>
|
||||||
|
|
||||||
<form method="get" action="?" autocomplete="off">
|
<form class="js-modal-ignore-form" method="post" action="<?= $this->url->href('ExportController', 'transitions', array('project_id' => $project['id'])) ?>" autocomplete="off">
|
||||||
|
<?= $this->form->csrf() ?>
|
||||||
<?= $this->form->hidden('controller', $values) ?>
|
|
||||||
<?= $this->form->hidden('action', $values) ?>
|
|
||||||
<?= $this->form->hidden('project_id', $values) ?>
|
<?= $this->form->hidden('project_id', $values) ?>
|
||||||
|
|
||||||
<?= $this->form->date(t('Start date'), 'from', $values) ?>
|
<?= $this->form->date(t('Start date'), 'from', $values) ?>
|
||||||
<?= $this->form->date(t('End date'), 'to', $values) ?>
|
<?= $this->form->date(t('End date'), 'to', $values) ?>
|
||||||
|
|
||||||
<div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div>
|
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button type="submit" class="btn btn-blue"><?= t('Execute') ?></button>
|
<button type="submit" class="btn btn-blue js-form-export"><?= t('Export') ?></button>
|
||||||
|
<?= t('or') ?>
|
||||||
|
<?= $this->url->link(t('cancel'), 'ExportController', 'transitions', array('project_id' => $project['id']), false, 'js-modal-close') ?>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
<?php if ($this->user->hasProjectAccess('ExportController', 'tasks', $project['id'])): ?>
|
<?php if ($this->user->hasProjectAccess('ExportController', 'tasks', $project['id'])): ?>
|
||||||
<li>
|
<li>
|
||||||
<?= $this->url->icon('upload', t('Exports'), 'ExportController', 'tasks', array('project_id' => $project['id'])) ?>
|
<?= $this->modal->medium('upload', t('Exports'), 'ExportController', 'tasks', array('project_id' => $project['id'])) ?>
|
||||||
</li>
|
</li>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
||||||
|
|||||||
6
assets/js/app.min.js
vendored
6
assets/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
9
assets/js/components/form-export.js
Normal file
9
assets/js/components/form-export.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
KB.onClick('.js-form-export', function(e) {
|
||||||
|
var formElement = document.querySelector('#modal-content form');
|
||||||
|
var fromElement = formElement.querySelector('#form-from');
|
||||||
|
var toElement = formElement.querySelector('#form-to');
|
||||||
|
|
||||||
|
if (fromElement.value !== '' && toElement.value !== '') {
|
||||||
|
formElement.submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getForm() {
|
function getForm() {
|
||||||
return document.querySelector('#modal-content form');
|
return document.querySelector('#modal-content form:not(.js-modal-ignore-form)');
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
|
|||||||
@@ -212,8 +212,6 @@ List of template hooks:
|
|||||||
| `template:dashboard:show` | Main page of the dashboard |
|
| `template:dashboard:show` | Main page of the dashboard |
|
||||||
| `template:dashboard:subtasks:header:before-timetracking` | Header of Subtask table before Time Tracking |
|
| `template:dashboard:subtasks:header:before-timetracking` | Header of Subtask table before Time Tracking |
|
||||||
| `template:dashboard:subtasks:rows` | Column on row of Subtask table of the dashboard |
|
| `template:dashboard:subtasks:rows` | Column on row of Subtask table of the dashboard |
|
||||||
| `template:export:sidebar` | Sidebar on export pages |
|
|
||||||
| `template:import:sidebar` | Sidebar on import pages |
|
|
||||||
| `template:header:dropdown` | Page header dropdown menu (user avatar icon) |
|
| `template:header:dropdown` | Page header dropdown menu (user avatar icon) |
|
||||||
| `template:header:creation-dropdown` | Page header dropdown menu (plus icon) |
|
| `template:header:creation-dropdown` | Page header dropdown menu (plus icon) |
|
||||||
| `template:layout:head` | Page layout `<head/>` tag |
|
| `template:layout:head` | Page layout `<head/>` tag |
|
||||||
|
|||||||
Reference in New Issue
Block a user