Dodaj pole użytkowników do formularza zapisu filtrów, usuń klasę Backpro oraz zaktualizuj daty zakończenia pracy w zadaniach

This commit is contained in:
2025-02-18 21:57:20 +01:00
parent b0c463efc4
commit a736510c66
13 changed files with 253 additions and 179 deletions

View File

@@ -197,20 +197,20 @@
"layout": {
"style.css": {
"type": "-",
"size": 21444,
"lmtime": 1739798821470,
"size": 21465,
"lmtime": 1739868350549,
"modified": false
},
"style.css.map": {
"type": "-",
"size": 37204,
"lmtime": 1739798821470,
"size": 37249,
"lmtime": 1739868350549,
"modified": false
},
"style.scss": {
"type": "-",
"size": 25893,
"lmtime": 1739798821070,
"size": 25925,
"lmtime": 1739868350325,
"modified": false
}
},

View File

@@ -1,18 +0,0 @@
<?
namespace controls;
class Backpro
{
static public function domain_hide()
{
if ( \factory\Domains::domain_hide( \S::get( 'domain_id' ) ) )
\S::alert( 'Domena została ukryta.' );
header( 'Location: /domains/list/' );
exit;
}
static public function domains_list()
{
return \Tpl::view( 'backpro/domains/list' );
}
}

View File

@@ -27,50 +27,57 @@ class Tasks
$open_task_id = \factory\Tasks::get_open_task_id( $user['id'] );
$projects = \S::get( 'projects' );
$users = \S::get( 'users' );
if ( $projects )
\S::set_session( 'selected_projects', $projects );
else
\S::del_session( 'selected_projects' );
if ( $users )
\S::set_session( 'selected_users', $users );
else
\S::del_session( 'selected_users' );
echo json_encode( [
'tasks_new' => \Tpl::view( 'tasks/main_view_by_ajax', [
'tasks' => \factory\Tasks::get_tasks( 0, $user['id'], $projects ),
'tasks' => \factory\Tasks::get_tasks( 0, $user['id'], $projects, $users ),
'user' => $user,
'statuses' => \factory\Tasks::get_statuses(),
'open_task_id' => $open_task_id
] ),
'tasks_to_review' => \Tpl::view( 'tasks/main_view_by_ajax', [
'tasks' => \factory\Tasks::get_tasks( 1, $user['id'], $projects ),
'tasks' => \factory\Tasks::get_tasks( 1, $user['id'], $projects, $users ),
'user' => $user,
'statuses' => \factory\Tasks::get_statuses(),
'open_task_id' => $open_task_id
] ),
'tasks_closed' => \Tpl::view( 'tasks/main_view_by_ajax', [
'tasks' => $show_tasks_closed == 'hide' ? null : \factory\Tasks::get_tasks( 2, $user['id'], $projects ),
'tasks' => $show_tasks_closed == 'hide' ? null : \factory\Tasks::get_tasks( 2, $user['id'], $projects, $users ),
'user' => $user,
'statuses' => \factory\Tasks::get_statuses(),
'open_task_id' => $open_task_id
] ),
'tasks_bulk' => \Tpl::view( 'tasks/main_view_by_ajax', [
'tasks' => \factory\Tasks::get_tasks( 3, $user['id'], $projects ),
'tasks' => \factory\Tasks::get_tasks( 3, $user['id'], $projects, $users ),
'user' => $user,
'statuses' => \factory\Tasks::get_statuses(),
'open_task_id' => $open_task_id
] ),
'tasks_suspended' => \Tpl::view( 'tasks/main_view_by_ajax', [
'tasks' => \factory\Tasks::get_tasks( 4, $user['id'], $projects ),
'tasks' => \factory\Tasks::get_tasks( 4, $user['id'], $projects, $users ),
'user' => $user,
'statuses' => \factory\Tasks::get_statuses(),
'open_task_id' => $open_task_id
] ),
'tasks_to_do' => \Tpl::view( 'tasks/main_view_by_ajax', [
'tasks' => \factory\Tasks::get_tasks( 5, $user['id'], $projects ),
'tasks' => \factory\Tasks::get_tasks( 5, $user['id'], $projects, $users ),
'user' => $user,
'statuses' => \factory\Tasks::get_statuses(),
'open_task_id' => $open_task_id
] ),
'tasks_fvat' => \Tpl::view( 'tasks/main_view_by_ajax', [
'tasks' => \factory\Tasks::get_tasks( 6, $user['id'], $projects ),
'tasks' => \factory\Tasks::get_tasks( 6, $user['id'], $projects, $users ),
'user' => $user,
'statuses' => \factory\Tasks::get_statuses(),
'open_task_id' => $open_task_id
@@ -100,20 +107,22 @@ class Tasks
$show_tasks_closed = \S::get_session( 'tasks_closed' );
return \Tpl::view( 'tasks/main_view', [
'tasks_new' => \factory\Tasks::get_tasks( 0, $user['id'], \S::get_session( 'selected_projects' ) ),
'tasks_to_review' => \factory\Tasks::get_tasks( 1, $user['id'], \S::get_session( 'selected_projects' ) ),
'tasks_closed' => $show_tasks_closed == 'hide' ? null : \factory\Tasks::get_tasks( 2, $user['id'], \S::get_session( 'selected_projects' ) ),
'tasks_bulk' => \factory\Tasks::get_tasks( 3, $user['id'], \S::get_session( 'selected_projects' ) ), // opłaty
'tasks_suspended' => \factory\Tasks::get_tasks( 4, $user['id'], \S::get_session( 'selected_projects' ) ), // projektowe
'tasks_to_do' => \factory\Tasks::get_tasks( 5, $user['id'], \S::get_session( 'selected_projects' ) ), // do zrobienia
'tasks_fvat' => \factory\Tasks::get_tasks( 6, $user['id'], \S::get_session( 'selected_projects' ) ), // faktury
'tasks_new' => \factory\Tasks::get_tasks( 0, $user['id'], \S::get_session( 'selected_projects' ), \S::get_session( 'selected_users' ) ),
'tasks_to_review' => \factory\Tasks::get_tasks( 1, $user['id'], \S::get_session( 'selected_projects' ), \S::get_session( 'selected_users' ) ),
'tasks_closed' => $show_tasks_closed == 'hide' ? null : \factory\Tasks::get_tasks( 2, $user['id'], \S::get_session( 'selected_projects' ), \S::get_session( 'selected_users' ) ), // zakończone
'tasks_bulk' => \factory\Tasks::get_tasks( 3, $user['id'], \S::get_session( 'selected_projects' ), \S::get_session( 'selected_users' ) ), // opłaty
'tasks_suspended' => \factory\Tasks::get_tasks( 4, $user['id'], \S::get_session( 'selected_projects' ), \S::get_session( 'selected_users' ) ), // projektowe
'tasks_to_do' => \factory\Tasks::get_tasks( 5, $user['id'], \S::get_session( 'selected_projects' ), \S::get_session( 'selected_users' ) ), // do zrobienia
'tasks_fvat' => \factory\Tasks::get_tasks( 6, $user['id'], \S::get_session( 'selected_projects' ), \S::get_session( 'selected_users' ) ), // faktury
'user' => $user,
'statuses' => \factory\Tasks::get_statuses(),
'open_task_id' => \factory\Tasks::get_open_task_id( $user['id'] ),
'projects' => \factory\Projects::user_projects( $user['id'] ),
'selected_projects' => \S::get_session( 'selected_projects' ),
'selected_users' => \S::get_session( 'selected_users' ),
'tasks_filtrs' => \factory\Tasks::get_filtrs( $user['id'] ),
'show_tasks_closed' => $show_tasks_closed
'show_tasks_closed' => $show_tasks_closed,
'users' => \factory\Users::users_list(),
] );
}
@@ -357,7 +366,8 @@ class Tasks
'status' => 'success',
'title' => 'Zapisz filtr',
'popup_content' => \Tpl::view( 'tasks/filtr_save_form', [
'projects' => \S::get( 'projects' )
'projects' => \S::get( 'projects' ),
'users' => \S::get( 'users' )
] )
] );
exit;
@@ -374,7 +384,7 @@ class Tasks
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania filtru wystąpił błąd. Proszę spróbować ponownie.' ];
if ( \factory\Tasks::filtr_save( $user['id'], \S::get( 'name' ), \S::get( 'projects' ), \S::get( 'is_default' ) ) )
if ( \factory\Tasks::filtr_save( $user['id'], \S::get( 'name' ), \S::get( 'projects' ), \S::get( 'users' ), \S::get( 'is_default' ) ) )
$response = [ 'status' => 'success', 'msg' => 'Filtr został zapisany.' ];
echo json_encode( $response );
@@ -391,7 +401,7 @@ class Tasks
$response = [ 'status' => 'error', 'msg' => 'Podczas aktualizacji filtru wystąpił błąd. Proszę spróbować ponownie.' ];
if ( \factory\Tasks::filtr_update( \S::get( 'filtr_id' ), \S::get( 'projects' ) ) )
if ( \factory\Tasks::filtr_update( \S::get( 'filtr_id' ), \S::get( 'projects' ), \S::get( 'users' ) ) )
$response = [ 'status' => 'success', 'msg' => 'Filtr został zaktualizowany.' ];
echo json_encode( $response );
@@ -406,12 +416,16 @@ class Tasks
] );
}
static public function change_task_work_date_start()
{
static public function change_task_work_date_start() {
$result = \factory\Tasks::change_task_work_date_start( \S::get( 'task_work_id' ), \S::get( 'date_start' ) );
exit;
}
static public function change_task_work_date_end() {
$result = \factory\Tasks::change_task_work_date_end( \S::get( 'task_work_id' ), \S::get( 'date_end' ) );
exit;
}
static public function work_delete() {
if ( \factory\Tasks::work_delete( \S::get( 'work_id' ) ) )

View File

@@ -7,20 +7,26 @@ class Users
public static function permissions( $user_id, $module = '', $action = '' )
{
// Pyziak Jacek
$permissions[ 1 ][ 'tasks' ] = true;
$permissions[ 1 ][ 'projects' ] = true;
$permissions[ 1 ][ 'finances' ] = true;
$permissions[ 1 ][ 'wiki' ] = true;
$permissions[ 1 ][ 'crm' ] = true;
$permissions[ 1 ][ 'work_time' ] = true;
// Pyziak Grzegorz
$permissions[ 3 ][ 'tasks' ] = true;
$permissions[ 3 ][ 'projects' ] = true;
$permissions[ 3 ][ 'finances' ] = true;
$permissions[ 3 ][ 'wiki' ] = true;
$permissions[ 3 ][ 'crm' ] = true;
$permissions[ 3 ][ 'work_time' ] = true;
// Roman Pyrih
$permissions[ 5 ][ 'projects' ] = true;
$permissions[ 5 ][ 'tasks' ] = true;
$permissions[ 5 ][ 'projects' ] = false;
$permissions[ 5 ][ 'finances' ] = false;
$permissions[ 5 ][ 'wiki' ] = true;
$permissions[ 5 ][ 'crm' ] = false;
$permissions[ 5 ][ 'work_time' ] = false;
if ( $action and isset( $permissions[ $user_id ][ $module ][ $action ] ) )
{

View File

@@ -3,13 +3,19 @@ namespace factory;
class Tasks
{
public static $statuses = [ 0 => 'nowe', 3 => 'do rozliczenia', 5 => 'do zrobienia', 4 => 'zawieszone', 1 => 'do sprawdzenia', 6 => 'faktury', 2 => 'zamknięte' ];
public static $statuses = [ 0 => 'nowe', 3 => 'do rozliczenia', 5 => 'do zrobienia', 4 => 'zaplanowane', 1 => 'do sprawdzenia', 6 => 'faktury', 2 => 'zamknięte' ];
static public function work_delete( $work_id ) {
global $mdb;
return $mdb -> update( 'tasks_work', [ 'deleted' => 1 ], [ 'id' => $work_id ] );
}
static public function change_task_work_date_end( $task_work_id, $date_end )
{
global $mdb;
return $mdb -> update( 'tasks_work', [ 'date_end' => $date_end ? date( 'Y-m-d H:i:s', strtotime( $date_end ) ) : null ], [ 'id' => $task_work_id ] );
}
static public function change_task_work_date_start( $task_work_id, $date_start )
{
global $mdb;
@@ -29,7 +35,7 @@ class Tasks
if ( $user['id'] == 1 )
return self::$statuses;
else
return [ 0 => 'nowe', 3 => 'do rozliczenia', 5 => 'do zrobienia', 4 => 'zawieszone', 1 => 'do sprawdzenia' ];
return [ 0 => 'nowe', 3 => 'do rozliczenia', 5 => 'do zrobienia', 4 => 'zaplanowane', 1 => 'do sprawdzenia' ];
}
static public function clear_task_opened( $task_id )
@@ -62,17 +68,17 @@ class Tasks
return $mdb -> select( 'tasks_filtrs', '*', [ 'user_id' => $user_id ] );
}
static public function filtr_update( $filtr_id, $projects )
{
static public function filtr_update( $filtr_id, $projects, $users ) {
global $mdb;
return $mdb -> update( 'tasks_filtrs', [
'projects' => $projects,
'users' => $users
], [
'id' => $filtr_id
] );
}
static public function filtr_save( $user_id, $name, $projects, $is_default ) {
static public function filtr_save( $user_id, $name, $projects, $users, $is_default ) {
global $mdb;
if ( $is_default ) {
@@ -83,6 +89,7 @@ class Tasks
'user_id' => $user_id,
'name' => $name,
'projects' => $projects,
'users' => $users,
'is_default' => $is_default
] );
@@ -129,7 +136,7 @@ class Tasks
] );
}
static public function get_tasks( int $status, $user_id, $projects = null )
static public function get_tasks( int $status, $user_id, $projects = null, $users = null )
{
global $mdb;
@@ -145,6 +152,11 @@ class Tasks
$sql .= ' AND project_id IN (' . implode( ',', $projects ) . ')';
}
if ( $users )
{
$sql .= ' AND id IN (SELECT task_id FROM task_user WHERE user_id IN (' . implode( ',', $users ) . '))';
}
if ( $user_id == 1 )
{
if ( in_array( $status, [ 0, 2, 3 ] ) )
@@ -161,6 +173,7 @@ class Tasks
else
$results = $mdb -> query( 'SELECT t.* FROM tasks t LEFT JOIN task_user tu ON t.id = tu.task_id WHERE t.status = ' . $status . ' AND tu.user_id = ' . $user_id . ' ' . $sql . ' ORDER BY t.open DESC, t.o ASC, t.status ASC, t.date_start IS NOT NULL DESC, t.date_start ASC, t.date_end IS NOT NULL DESC, t.date_end ASC, t.name ASC' ) -> fetchAll( \PDO::FETCH_ASSOC );
}
foreach ( $results as $row )
{
$row['users'] = $mdb -> select( 'task_user', 'user_id', [ 'task_id' => $row['id'] ] );

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -391,93 +391,95 @@ body>.top {
display: flex;
position: relative;
border-radius: .25rem;
flex-wrap: wrap;
&.notopened {
border: 2px solid $cRed;
}
.left {
width: 30px;
.top {
display: flex;
justify-content: space-between;
margin-bottom: 5px;
width: 100%;
.users {
._users {
display: flex;
gap: 5px;
flex-wrap: wrap;
.user {
display: flex;
width: 20px;
height: 20px;
border-radius: 50%;
width: 25px;
height: 25px;
border-radius: .25rem;
justify-content: center;
align-items: center;
color: #FFF;
font-size: 13px;
font-size: 12px;
}
}
._timer {
.recursively {
color: #ccc;
border-radius: 3px;
cursor: pointer;
margin-bottom: 5px;
width: 25px;
height: 25px;
text-align: center;
display: block;
i {
font-size: 15px;
}
}
.task_start {
display: block;
background: $cGreen;
color: #FFF;
border-radius: .25rem;
cursor: pointer;
margin-bottom: 5px;
width: 25px;
height: 25px;
text-align: center;
&.hidden {
display: none;
}
i {
font-size: 12px;
}
}
.task_end {
background: $cRed;
display: block;
color: #FFF;
border-radius: .25rem;
cursor: pointer;
margin-bottom: 5px;
width: 25px;
height: 25px;
text-align: center;
&.hidden {
display: none;
}
i {
font-size: 12px;
}
}
}
}
.middle {
width: calc(100% - 60px);
}
.right {
width: 30px;
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
.recursively {
color: #ccc;
border-radius: 3px;
cursor: pointer;
margin-bottom: 5px;
width: 22px;
height: 22px;
text-align: center;
i {
font-size: 15px;
}
}
.task_start {
background: $cGreen;
color: #FFF;
border-radius: 3px;
cursor: pointer;
margin-bottom: 5px;
width: 22px;
height: 22px;
text-align: center;
&.hidden {
display: none;
}
i {
font-size: 12px;
}
}
.task_end {
background: $cRed;
color: #FFF;
border-radius: 3px;
cursor: pointer;
margin-bottom: 5px;
width: 22px;
height: 22px;
text-align: center;
&.hidden {
display: none;
}
i {
font-size: 12px;
}
}
width: 100%;
}
.name {
@@ -1048,10 +1050,14 @@ body>.top {
gap: 20px;
.left {
display: flex;
gap: 20px;
flex-wrap: wrap;
width: calc(100% - 250px);
._projects,
._users {
display: flex;
gap: 20px;
flex-wrap: wrap;
}
}
.right {

View File

@@ -52,7 +52,7 @@
</div>
<div class="main-menu">
<ul>
<? if ( \controls\Users::permissions( $this -> user[ 'id' ], 'projects' ) ):?>
<? if ( \controls\Users::permissions( $this -> user[ 'id' ], 'tasks' ) ):?>
<li>
<a href="/tasks/main_view/">Zadania</a>
</li>
@@ -82,16 +82,6 @@
<a href="/wiki/main_view/">Wiki</a>
</li>
<? endif;?>
<? if ( \controls\Users::permissions( $this -> user[ 'id' ], 'zaplecze' ) ):?>
<li>
<a href="#">Zaplecze</a>
<ul>
<li>
<a href="/backpro/domains_list/">Domeny</a>
</li>
</ul>
</li>
<? endif;?>
</ul>
</div>
<div class="main">

View File

@@ -1,5 +1,6 @@
<form id="filtr_save_form" class="form_container">
<input type="hidden" name="projects" value="<?= $this -> projects;?>">
<input type="hidden" name="users" value="<?= $this -> users;?>">
<div class="form_group">
<label class="label">Nazwa:</label>
<div class="input">

View File

@@ -5,20 +5,34 @@
</div>
<div class="projects_container">
<div class="left">
<? foreach ( $this -> projects as $project ):?>
<div class="project">
<label for="project_<?= $project[ 'id' ];?>">
<input type="checkbox" class="g-checkbox" name="projects" value="<?= $project[ 'id' ];?>" <? if ( is_array( $this -> selected_projects ) and in_array( $project['id'], $this -> selected_projects ) ):?>checked<? endif;?>>
<?= $project[ 'name' ];?> <? if ( $project[ 'client_id' ] ):?>- <small><?= \factory\Crm::get_client_name( (int)$project[ 'client_id' ] );?><? endif;?></small>
</label>
<div class="_projects">
<? foreach ( $this -> projects as $project ):?>
<div class="_project">
<label for="project_<?= $project[ 'id' ];?>">
<input type="checkbox" class="g-checkbox" name="projects" value="<?= $project[ 'id' ];?>" <? if ( is_array( $this -> selected_projects ) and in_array( $project['id'], $this -> selected_projects ) ):?>checked<? endif;?>>
<?= $project[ 'name' ];?> <? if ( $project[ 'client_id' ] ):?>- <small><?= \factory\Crm::get_client_name( (int)$project[ 'client_id' ] );?><? endif;?></small>
</label>
</div>
<? endforeach;?>
</div>
<? if ( $this -> user['id'] == 1 ):?>
<div class="_users">
<? foreach ( $this -> users as $user ):?>
<div class="_user">
<label for="user_<?= $user[ 'id' ];?>">
<input type="checkbox" class="g-checkbox" name="users" value="<?= $user[ 'id' ];?>" <? if ( is_array( $this -> selected_users ) and in_array( $user['id'], $this -> selected_users ) ):?>checked<? endif;?>>
<?= $user[ 'name' ];?> <?= $user[ 'surname' ];?>
</label>
</div>
<? endforeach;?>
</div>
<? endforeach;?>
<? endif;?>
</div>
<div class="right">
<select name="filtr" class="form-control">
<option value="">--- wybierz filtr ---</option>
<? foreach ( $this -> tasks_filtrs as $filtr ):?>
<option value="<?= $filtr[ 'id' ];?>" projects="<?= $filtr['projects'];?>"><?= $filtr[ 'name' ];?></option>
<option value="<?= $filtr[ 'id' ];?>" projects="<?= $filtr['projects'];?>" users="<?= $filtr['users'];?>"><?= $filtr[ 'name' ];?></option>
<? endforeach;?>
</select>
<div class="buttons">
@@ -62,7 +76,7 @@
<? endif;?>
<!-- tasks_suspended -->
<div class="column tasks_suspended">
<h2>Zadania zawieszone (u klienta)</h2>
<h2>Zadania zaplanowane</h2>
<ul>
<? foreach ( $this -> tasks_suspended as $task ):?>
<?
@@ -142,14 +156,15 @@
</div>
<script type="text/javascript">
function reload_tasks( projects )
function reload_tasks( projects, users )
{
//load tasks by ajax
$.ajax({
url: '/tasks/main_view_by_ajax/',
type: 'POST',
data: {
projects: projects
projects: projects,
users: users
},
success: function( response2 )
{
@@ -212,7 +227,10 @@
type: 'POST',
data: {
filtr_id: filtr_id,
projects: jQuery( 'input.g-checkbox:checked' ).map(function() {
projects: jQuery( 'input[name="projects"].g-checkbox:checked' ).map(function() {
return this.value;
}).get().join( "," ),
users: jQuery( 'input[name="users"].g-checkbox:checked' ).map(function() {
return this.value;
}).get().join( "," )
},
@@ -227,7 +245,10 @@
url: '/tasks/filtr_save_form/',
type: 'POST',
data: {
projects: jQuery( 'input.g-checkbox:checked' ).map(function() {
projects: jQuery( 'input[name="projects"].g-checkbox:checked' ).map(function() {
return this.value;
}).get().join( "," ),
users: jQuery( 'input[name="users"].g-checkbox:checked' ).map(function() {
return this.value;
}).get().join( "," )
},
@@ -288,11 +309,14 @@
var data = jQuery.parseJSON( response );
if ( data.status == 'success' )
{
var checkedVals = jQuery( 'input[name="projects"]:checked' ).map(function() {
var projects = jQuery( 'input[name="projects"]:checked' ).map(function() {
return this.value;
}).get();
checkedVals.join( "," );
reload_tasks( checkedVals );
projects.join( "," );
var users = jQuery( 'input[name="users"]:checked' ).map(function() {
return this.value;
}).get();
reload_tasks( projects, users );
}
}
});
@@ -456,10 +480,10 @@
data = jQuery.parseJSON( response );
if ( data.status == 'success' )
{
$( 'li.task .right .task_end' ).addClass( 'hidden' ).removeClass( 'animate' );
$( 'li.task .right .task_start' ).removeClass( 'hidden' );
$( 'li[task_id="' + task_id + '"] .right .task_start' ).addClass( 'hidden' );
$( 'li[task_id="' + task_id + '"] .right .task_end' ).removeClass( 'hidden' ).addClass( 'animate' );
$( 'li.task .task_end' ).addClass( 'hidden' ).removeClass( 'animate' );
$( 'li.task .task_start' ).removeClass( 'hidden' );
$( 'li[task_id="' + task_id + '"] .task_start' ).addClass( 'hidden' );
$( 'li[task_id="' + task_id + '"] .task_end' ).removeClass( 'hidden' ).addClass( 'animate' );
$( '.task_popup .task_end' ).removeClass( 'hidden' ).addClass( 'animate' );
$( '.task_popup .task_start' ).addClass( 'hidden' );
}
@@ -483,8 +507,8 @@
data = jQuery.parseJSON( response );
if ( data.status == 'success' )
{
$( 'li[task_id="' + task_id + '"] .right .task_start' ).removeClass( 'hidden' );
$( 'li[task_id="' + task_id + '"] .right .task_end' ).addClass( 'hidden' ).removeClass( 'animate' );
$( 'li[task_id="' + task_id + '"] .task_start' ).removeClass( 'hidden' );
$( 'li[task_id="' + task_id + '"] .task_end' ).addClass( 'hidden' ).removeClass( 'animate' );
$( '.task_popup .task_end' ).addClass( 'hidden' ).removeClass( 'animate' );
$( '.task_popup .task_start' ).removeClass( 'hidden' );
}
@@ -630,6 +654,7 @@
e.preventDefault();
var name = $( '#filtr_save_form input[name="name"]' ).val();
var projects = $( '#filtr_save_form input[name="projects"]' ).val();
var users = $( '#filtr_save_form input[name="users"]' ).val();
var is_default = $( '#filtr_save_form input[name="is_default"]' ).is( ':checked' ) ? 1 : 0;
$.ajax({
@@ -639,6 +664,7 @@
data: {
name: name,
projects: projects,
users: users,
is_default: is_default
},
beforeSend: function() { },
@@ -656,17 +682,27 @@
$( 'body' ).on( 'change', 'select[name="filtr"]', function(e) {
e.preventDefault();
var projects = $( this ).find( 'option:selected' ).attr( 'projects' );
var users = $( this ).find( 'option:selected' ).attr( 'users' );
if ( projects )
{
var checkedVals = projects.split( "," );
var projects = projects.split( "," );
// toggle checkboxes and prevent load ajax twice
$( '.projects_container input.g-checkbox' ).each( function() {
if ( $.inArray( $( this ).val(), checkedVals ) !== -1 )
$( '.projects_container input[name="projects"].g-checkbox' ).each( function() {
if ( $.inArray( $( this ).val(), projects ) !== -1 )
$( this ).attr( 'checked', 'checked' );
else
$( this ).removeAttr( 'checked' );
});
reload_tasks( checkedVals );
var users = users.split( "," );
// toggle checkboxes and prevent load ajax twice
$( '.projects_container input[name="users"].g-checkbox' ).each( function() {
if ( $.inArray( $( this ).val(), users ) !== -1 )
$( this ).attr( 'checked', 'checked' );
else
$( this ).removeAttr( 'checked' );
});
reload_tasks( projects, users );
}
});
@@ -754,6 +790,28 @@
});
});
$( 'body' ).on( 'change', '.task_work_date_end', function()
{
var date_end = $( this ).val();
var task_work_id = $( this ).attr( 'task_work_id' );
$( this ).attr( 'disabled', 'disabled' );
$.ajax({
type: 'POST',
cache: false,
url: '/tasks/change_task_work_date_end/',
data: {
date_end: date_end,
task_work_id: task_work_id
},
beforeSend: function() { },
success: function( response )
{
$( '.task_work_end' ).removeAttr( 'disabled' );
}
});
});
$( 'body' ).on( 'click', '.task_popup .time_worked_toggle', function(e){
e.preventDefault();
$( '.task_popup .task_details' ).toggleClass( 'open_works_time' );
@@ -762,11 +820,15 @@
$( function()
{
$( '.projects_container input.g-checkbox').on( 'change', function (e) {
var checkedVals = jQuery( 'input.g-checkbox:checked' ).map(function() {
var projects = jQuery( 'input[name="projects"].g-checkbox:checked' ).map(function() {
return this.value;
}).get();
checkedVals.join( "," );
reload_tasks( checkedVals );
var users = jQuery( 'input[name="users"].g-checkbox:checked' ).map(function() {
return this.value;
}).get();
projects.join( "," );
users.join( "," );
reload_tasks( projects, users );
});
$( 'body' ).on( 'click', '.task_work_details ._work_delete', function(e)

View File

@@ -109,7 +109,7 @@
<? foreach ( $this -> task_works as $task_work ):?>
<div class="_line">
<div class="_user"><?= \factory\Users::user_details( $task_work['user_id'] )['name'] . ' ' . \factory\Users::user_details( $task_work['user_id'] )['surname'];?></div>
<input type="text" class="form-control task_work_date_start" task_work_id="<?= $task_work['id'];?>" value="<?= $task_work['date_start'];?>"><span>-</span><input type="text" class="form-control task_work_end" task_work_id="<?= $task_work['id'];?>" value="<?= $task_work['date_end'];?>">
<input type="text" class="form-control task_work_date_start" task_work_id="<?= $task_work['id'];?>" value="<?= $task_work['date_start'];?>"><span>-</span><input type="text" class="form-control task_work_date_end" task_work_id="<?= $task_work['id'];?>" value="<?= $task_work['date_end'];?>">
<a href="#" class="_work_delete" work_id="<?= $task_work['id'];?>" task_id="<?= $this -> task['id'];?>">
<i class="fa fa-trash"></i>
</a>

View File

@@ -1,7 +1,7 @@
<li class="task <? if ( !\factory\Tasks::is_taks_is_opened_by_user( $this -> task['id'], $this -> user['id'] ) ):?> notopened<? endif;?>" task_id="<?= $this -> task['id'];?>">
<div class="left">
<div class="users">
<div class="top">
<div class="_users">
<? if ( is_array( $this -> task['users'] ) ): foreach ( $this -> task['users'] as $user_tmp_id ):?>
<?
$user_tmp = \factory\Users::user_details( $user_tmp_id );
@@ -9,6 +9,19 @@
?>
<? endforeach; endif;?>
</div>
<div class="_timer">
<a href="#" class="task_start <? if ( $this -> task_open ):?> hidden<? endif;?>" task_id="<?= $this -> task['id'];?>">
<i class="fa fa-play"></i>
</a>
<a href="#" class="task_end <? if ( !$this -> task_open ):?> hidden<? else:?> animate<? endif;?>" task_id="<?= $this -> task['id'];?>">
<i class="fa fa-stop"></i>
</a>
<? if ( $this -> task['recursively'] ):?>
<div class="recursively">
<i class="fa fa-solid fa-repeat"></i>
</div>
<? endif;?>
</div>
</div>
<div class="middle">
<a href="#" class="name"><?= $this -> task['name'];?></a>
@@ -38,17 +51,4 @@
<? endif;?>
</div>
</div>
<div class="right">
<a href="#" class="task_start <? if ( $this -> task_open ):?> hidden<? endif;?>" task_id="<?= $this -> task['id'];?>">
<i class="fa fa-play"></i>
</a>
<a href="#" class="task_end <? if ( !$this -> task_open ):?> hidden<? else:?> animate<? endif;?>" task_id="<?= $this -> task['id'];?>">
<i class="fa fa-stop"></i>
</a>
<? if ( $this -> task['recursively'] ):?>
<div class="recursively">
<i class="fa fa-solid fa-repeat"></i>
</div>
<? endif;?>
</div>
</li>