update
This commit is contained in:
@@ -706,6 +706,37 @@
|
||||
});
|
||||
});
|
||||
|
||||
// change task parent
|
||||
$( 'body' ).on( 'change', 'select[name="task_parent"]', function() {
|
||||
var task_id = $( this ).attr( 'task_id' );
|
||||
var parent_id = $( this ).val();
|
||||
|
||||
$.ajax({
|
||||
url: '/tasks/task_change_parent/',
|
||||
type: 'POST',
|
||||
data: {
|
||||
task_id: task_id,
|
||||
parent_id: parent_id
|
||||
},
|
||||
success: function( response )
|
||||
{
|
||||
var data = jQuery.parseJSON( response );
|
||||
if ( data.status == 'success' )
|
||||
{
|
||||
var projects = jQuery( 'input[name="projects"]:checked' ).map(function() {
|
||||
return this.value;
|
||||
}).get();
|
||||
projects.join( "," );
|
||||
var users = jQuery( 'input[name="users"]:checked' ).map(function() {
|
||||
return this.value;
|
||||
}).get();
|
||||
close_task_popup();
|
||||
reload_tasks( projects, users );
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$( 'body' ).on( 'change', 'select[name="task_status"]', function() {
|
||||
var task_id = $( this ).attr( 'task_id' );
|
||||
var status = $( this ).val();
|
||||
|
||||
@@ -265,6 +265,18 @@
|
||||
<? endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="current_parent" style="margin-top: 10px;">
|
||||
<select name="task_parent" class="form-control task_parent_select" task_id="<?= (int)$this -> task['id'];?>">
|
||||
<option value="0">-- bez zadania nadrzednego --</option>
|
||||
<? if ( is_array( $this -> parent_tasks ) ): foreach ( $this -> parent_tasks as $parent_task ):?>
|
||||
<? $parent_task_id = isset( $parent_task['id'] ) ? (int)$parent_task['id'] : 0;?>
|
||||
<? if ( !$parent_task_id or $parent_task_id === (int)$this -> task['id'] ) continue;?>
|
||||
<option value="<?= $parent_task_id;?>" <? if ( (int)$this -> task['parent_id'] === $parent_task_id ):?>selected="selected"<? endif;?>>
|
||||
<?= htmlspecialchars( (string)$parent_task['name'] );?><? if ( !empty( $parent_task['client'] ) ):?> - <?= htmlspecialchars( (string)$parent_task['client'] );?><? endif;?>
|
||||
</option>
|
||||
<? endforeach; endif;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="task-subtask-action">
|
||||
<a href="/tasks/task_edit/project_id=<?= (int)$this -> task['project_id'];?>&client_id=<?= (int)$this -> task['client_id'];?>&parent_id=<?= (int)$this -> task['id'];?>" class="btn btn-success btn-sm task-popup-compact-btn">Dodaj podzadanie</a>
|
||||
</div>
|
||||
@@ -327,7 +339,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<style type="text/css">
|
||||
.task_popup .task_details .content .right .client .select2-container {
|
||||
.task_popup .task_details .content .right .client .select2-container,
|
||||
.task_popup .task_details .content .right .project .select2-container {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
@@ -819,12 +832,20 @@
|
||||
if ( $.fn.select2 )
|
||||
{
|
||||
var client_select = popup.find( '.task_client_select' );
|
||||
var parent_select = popup.find( '.task_parent_select' );
|
||||
|
||||
client_select.select2({
|
||||
theme: 'bootstrap-5',
|
||||
width: '100%',
|
||||
placeholder: 'Wybierz klienta',
|
||||
dropdownParent: popup
|
||||
});
|
||||
parent_select.select2({
|
||||
theme: 'bootstrap-5',
|
||||
width: '100%',
|
||||
placeholder: 'Wybierz zadanie nadrzedne',
|
||||
dropdownParent: popup
|
||||
});
|
||||
|
||||
client_select.on( 'select2:open', function() {
|
||||
setTimeout( function() {
|
||||
|
||||
Reference in New Issue
Block a user