update
This commit is contained in:
148
templates/finances/fakturownia-import-panel.php
Normal file
148
templates/finances/fakturownia-import-panel.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
$esc = function( $value )
|
||||
{
|
||||
return htmlspecialchars( (string)$value, ENT_QUOTES, 'UTF-8' );
|
||||
};
|
||||
?>
|
||||
<style>
|
||||
.fakturownia-panel {
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.fakturownia-panel .panel-heading {
|
||||
padding: 12px 14px;
|
||||
}
|
||||
.fakturownia-panel .panel-title {
|
||||
margin: 0;
|
||||
line-height: 1.3;
|
||||
}
|
||||
.fakturownia-panel .panel-body {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.fakturownia-panel .panel-body > :last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.fakturownia-panel .select2-container {
|
||||
min-width: 320px !important;
|
||||
}
|
||||
</style>
|
||||
<div class="panel panel-default fakturownia-panel">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">Import faktur z Fakturowni</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<? if ( is_array( $this -> fakturownia_last_summary ) && isset( $this -> fakturownia_last_summary['summary'] ) ): ?>
|
||||
<div class="alert alert-info mb15">
|
||||
Ostatni import: <?= $esc( $this -> fakturownia_last_summary['at'] ?? '-' ); ?><br>
|
||||
Zaimportowano: <strong><?= (int)( $this -> fakturownia_last_summary['summary']['imported'] ?? 0 ); ?></strong>,
|
||||
pominieto: <strong><?= (int)( $this -> fakturownia_last_summary['summary']['skipped'] ?? 0 ); ?></strong>,
|
||||
brak mapowan: <strong><?= (int)( $this -> fakturownia_last_summary['summary']['unmapped'] ?? 0 ); ?></strong>,
|
||||
bledy: <strong><?= (int)( $this -> fakturownia_last_summary['summary']['errors'] ?? 0 ); ?></strong>
|
||||
</div>
|
||||
<? endif; ?>
|
||||
|
||||
<? if ( is_array( $this -> fakturownia_pending_clients ) && count( $this -> fakturownia_pending_clients ) ): ?>
|
||||
<h5>Brakujace mapowania klientow</h5>
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Klient z Fakturowni</th>
|
||||
<th>CRM klient</th>
|
||||
<th style="width: 130px;">Akcja</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<? foreach ( $this -> fakturownia_pending_clients as $row ): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?= $esc( $row['external_name'] ); ?><br>
|
||||
<small class="text-muted">Klucz: <?= $esc( $row['external_key'] ); ?> | wystapienia: <?= (int)$row['hits']; ?></small>
|
||||
</td>
|
||||
<td>
|
||||
<form method="post" action="/finances/fakturownia_client_mapping_save/" class="form-inline">
|
||||
<input type="hidden" name="csrf_token" value="<?= \S::csrf_token(); ?>">
|
||||
<input type="hidden" name="external_key" value="<?= $esc( $row['external_key'] ); ?>">
|
||||
<input type="hidden" name="external_name" value="<?= $esc( $row['external_name'] ); ?>">
|
||||
<select name="crm_client_id" class="form-control input-sm js-fakturownia-client-select" required>
|
||||
<option value="">Wybierz klienta</option>
|
||||
<? foreach ( $this -> fakturownia_crm_clients as $client ): ?>
|
||||
<option value="<?= (int)$client['id']; ?>"><?= $esc( $client['firm'] ); ?></option>
|
||||
<? endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<button type="submit" class="btn btn-success btn-sm">Zapisz</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<? endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<? endif; ?>
|
||||
|
||||
<? if ( is_array( $this -> fakturownia_pending_items ) && count( $this -> fakturownia_pending_items ) ): ?>
|
||||
<h5 class="mt20">Brakujace mapowania produktow/uslug</h5>
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Pozycja z faktury</th>
|
||||
<th>Kategoria finansowa</th>
|
||||
<th style="width: 130px;">Akcja</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<? foreach ( $this -> fakturownia_pending_items as $row ): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?= $esc( $row['external_name'] ); ?><br>
|
||||
<small class="text-muted">Klucz: <?= $esc( $row['external_key'] ); ?> | wystapienia: <?= (int)$row['hits']; ?></small>
|
||||
</td>
|
||||
<td>
|
||||
<form method="post" action="/finances/fakturownia_item_mapping_save/" class="form-inline">
|
||||
<input type="hidden" name="csrf_token" value="<?= \S::csrf_token(); ?>">
|
||||
<input type="hidden" name="external_key" value="<?= $esc( $row['external_key'] ); ?>">
|
||||
<input type="hidden" name="external_name" value="<?= $esc( $row['external_name'] ); ?>">
|
||||
<select name="finance_category_id" class="form-control input-sm" required>
|
||||
<option value="">Wybierz kategorie</option>
|
||||
<? foreach ( $this -> fakturownia_categories as $category ): ?>
|
||||
<option value="<?= (int)$category['id']; ?>">
|
||||
<?= $esc( $category['name'] ); ?> (grupa: <?= (int)$category['group_id']; ?>)
|
||||
</option>
|
||||
<? endforeach; ?>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<button type="submit" class="btn btn-success btn-sm">Zapisz</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<? endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<? endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
if ( typeof jQuery === 'undefined' || !jQuery.fn.select2 )
|
||||
return;
|
||||
|
||||
var selects = jQuery( '.js-fakturownia-client-select' );
|
||||
if ( !selects.length )
|
||||
return;
|
||||
|
||||
selects.select2({
|
||||
theme: 'bootstrap-5',
|
||||
width: '100%',
|
||||
placeholder: 'Wyszukaj klienta CRM'
|
||||
});
|
||||
|
||||
selects.on( 'select2:open', function() {
|
||||
setTimeout( function() {
|
||||
var searchField = document.querySelector( '.select2-container--open .select2-search__field' );
|
||||
if ( searchField )
|
||||
searchField.focus();
|
||||
}, 0 );
|
||||
} );
|
||||
})();
|
||||
</script>
|
||||
@@ -46,6 +46,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="finance-import-panel" style="clear: both; margin-top: 15px;">
|
||||
<? include 'fakturownia-import-panel.php'; ?>
|
||||
</div>
|
||||
<div class="finance-manager">
|
||||
<div class="column-left">
|
||||
<div class="clients-list-container">
|
||||
@@ -307,4 +310,4 @@ $(function() {
|
||||
$(this).parents('.input-group').children('input').trigger('click');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -1,48 +1,70 @@
|
||||
<div class="tasks_main_view">
|
||||
<div class="_left_column">
|
||||
<select name="filtr" class="form-control">
|
||||
<option value="">--- wybierz filtr ---</option>
|
||||
<? foreach ( $this -> tasks_filtrs as $filtr ):?>
|
||||
<option value="<?= $filtr[ 'id' ];?>"><?= $filtr[ 'name' ];?></option>
|
||||
<? endforeach;?>
|
||||
</select>
|
||||
<div class="_buttons">
|
||||
<a href="#" class="btn btn-success btn_small" id="_new_filtr">zapisz</a>
|
||||
<a href="#" class="btn btn-primary btn_small" id="_update_filtr">aktualizuj</a>
|
||||
<!-- set default -->
|
||||
<a href="#" class="btn btn-dark btn_small" id="_set_default_filtr">domyślny</a>
|
||||
</div>
|
||||
<div class="_projects">
|
||||
<h4>Projekty</h4>
|
||||
<? foreach ( $this -> projects as $project ):?>
|
||||
<div class="_project">
|
||||
<div class="project_row">
|
||||
<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' ];?> <span class="project_count">(<?= (int)$project['total_tasks'];?>)</span>
|
||||
</label>
|
||||
<? if ( \controls\Users::permissions( $this -> user['id'], 'projects', 'project_delete' ) ):?>
|
||||
<a href="#" class="project_delete_inline" project_id="<?= (int)$project['id'];?>" project_name="<?= htmlspecialchars( $project['name'] );?>" title="Usuń projekt">
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
<? endif;?>
|
||||
<div class="filters_panel">
|
||||
<div class="filters_panel_header">
|
||||
<div class="filters_panel_title">
|
||||
<i class="fa fa-filter"></i>
|
||||
<h3>Filtry</h3>
|
||||
</div>
|
||||
<span class="active_filters_badge">Aktywne: <strong id="active_filters_count">0</strong></span>
|
||||
</div>
|
||||
<div class="filters_controls">
|
||||
<label class="filters_label" for="tasks_saved_filter">Zapisany filtr</label>
|
||||
<select name="filtr" id="tasks_saved_filter" class="form-control">
|
||||
<option value="">--- wybierz filtr ---</option>
|
||||
<? foreach ( $this -> tasks_filtrs as $filtr ):?>
|
||||
<option value="<?= $filtr[ 'id' ];?>"><?= $filtr[ 'name' ];?></option>
|
||||
<? endforeach;?>
|
||||
</select>
|
||||
<div class="_buttons">
|
||||
<a href="#" class="btn btn-success btn_small" id="_new_filtr"><i class="fa fa-plus"></i>Zapisz</a>
|
||||
<a href="#" class="btn btn-primary btn_small" id="_update_filtr"><i class="fa fa-refresh"></i>Aktualizuj</a>
|
||||
<!-- set default -->
|
||||
<a href="#" class="btn btn-dark btn_small" id="_set_default_filtr"><i class="fa fa-star-o"></i>Domyślny</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="filters_section _projects">
|
||||
<div class="filters_section_header">
|
||||
<h4>Projekty</h4>
|
||||
<input type="text" class="form-control filters_search" data-filter-target="projects" placeholder="Szukaj projektu...">
|
||||
</div>
|
||||
<div class="filters_section_list">
|
||||
<? foreach ( $this -> projects as $project ):?>
|
||||
<div class="_project filters_item" data-filter-item="projects">
|
||||
<div class="project_row">
|
||||
<label for="project_<?= $project[ 'id' ];?>">
|
||||
<input id="project_<?= $project[ 'id' ];?>" 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' ];?> <span class="project_count">(<?= (int)$project['total_tasks'];?>)</span>
|
||||
</label>
|
||||
<? if ( \controls\Users::permissions( $this -> user['id'], 'projects', 'project_delete' ) ):?>
|
||||
<a href="#" class="project_delete_inline" project_id="<?= (int)$project['id'];?>" project_name="<?= htmlspecialchars( $project['name'] );?>" title="Usuń projekt">
|
||||
<i class="fa fa-trash"></i>
|
||||
</a>
|
||||
<? endif;?>
|
||||
</div>
|
||||
</div>
|
||||
<? endforeach;?>
|
||||
</div>
|
||||
</div>
|
||||
<? if ( $this -> user['id'] == 1 ):?>
|
||||
<div class="filters_section _users">
|
||||
<div class="filters_section_header">
|
||||
<h4>Użytkownicy</h4>
|
||||
<input type="text" class="form-control filters_search" data-filter-target="users" placeholder="Szukaj użytkownika...">
|
||||
</div>
|
||||
<div class="filters_section_list">
|
||||
<? foreach ( $this -> users as $user ):?>
|
||||
<div class="_user filters_item" data-filter-item="users">
|
||||
<label for="user_<?= $user[ 'id' ];?>">
|
||||
<input id="user_<?= $user[ 'id' ];?>" 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>
|
||||
</div>
|
||||
<? endforeach;?>
|
||||
<? endif;?>
|
||||
</div>
|
||||
<? if ( $this -> user['id'] == 1 ):?>
|
||||
<div class="_users">
|
||||
<h4>Użytkownicy</h4>
|
||||
<? 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>
|
||||
<? endif;?>
|
||||
</div>
|
||||
<div class="_right_column">
|
||||
<div class="action_menu">
|
||||
@@ -134,79 +156,23 @@
|
||||
<div class="task_popup">
|
||||
|
||||
</div>
|
||||
<style type="text/css">
|
||||
.tasks_main_view ._left_column {
|
||||
width: fit-content;
|
||||
min-width: 350px;
|
||||
max-width: 520px;
|
||||
}
|
||||
|
||||
.tasks_main_view ._right_column {
|
||||
flex: 1;
|
||||
max-width: none;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.tasks_main_view ._left_column ._projects ._project .project_row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.tasks_main_view ._left_column ._projects ._project .project_row label {
|
||||
margin: 0;
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tasks_main_view ._left_column ._projects ._project .project_row .project_count {
|
||||
display: inline-block;
|
||||
margin-left: 3px;
|
||||
padding: 0 6px;
|
||||
border-radius: 10px;
|
||||
background: #1f3d72;
|
||||
color: #fff;
|
||||
font-weight: 700;
|
||||
font-size: 11px;
|
||||
line-height: 18px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.tasks_main_view ._left_column ._projects ._project .project_delete_inline {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #cc563d;
|
||||
background: #cc563d;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
transition: all .2s ease;
|
||||
margin: 1px 0;
|
||||
}
|
||||
|
||||
.tasks_main_view ._left_column ._projects ._project .project_delete_inline:hover {
|
||||
background: #b74831;
|
||||
border-color: #b74831;
|
||||
}
|
||||
|
||||
.tasks_main_view ._left_column ._projects ._project .project_delete_inline i {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.gantt-target .gantt-container.gantt-draggable {
|
||||
cursor: grab;
|
||||
}
|
||||
|
||||
.gantt-target .gantt-container.gantt-dragging {
|
||||
cursor: grabbing;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
let isProgrammaticUpdate = false;
|
||||
function updateActiveFiltersCounter()
|
||||
{
|
||||
var activeFiltersCount = $( '.tasks_main_view input.g-checkbox:checked' ).length;
|
||||
$( '#active_filters_count' ).text( activeFiltersCount );
|
||||
}
|
||||
|
||||
function applyFiltersSearch( target, value )
|
||||
{
|
||||
var normalizedValue = value.toLowerCase().trim();
|
||||
$( '.tasks_main_view [data-filter-item="' + target + '"]' ).each(function() {
|
||||
var itemText = $( this ).text().toLowerCase();
|
||||
var shouldShow = normalizedValue === '' || itemText.indexOf( normalizedValue ) !== -1;
|
||||
$( this ).toggle( shouldShow );
|
||||
});
|
||||
}
|
||||
|
||||
var tasks = [
|
||||
<?
|
||||
@@ -1368,7 +1334,8 @@
|
||||
});
|
||||
|
||||
isProgrammaticUpdate = false;
|
||||
// wywołuj z tablicami, nie ze stringami
|
||||
updateActiveFiltersCounter();
|
||||
// wywoluj z tablicami, nie ze stringami
|
||||
reload_tasks(projectsArr, usersArr);
|
||||
}
|
||||
}
|
||||
@@ -1512,6 +1479,13 @@
|
||||
radioClass: 'iradio_square-blue',
|
||||
});
|
||||
|
||||
updateActiveFiltersCounter();
|
||||
|
||||
$( '.tasks_main_view' ).on( 'input', '.filters_search', function() {
|
||||
var target = $( this ).attr( 'data-filter-target' );
|
||||
applyFiltersSearch( target, $( this ).val() );
|
||||
});
|
||||
|
||||
$(".tasks_main_view input.g-checkbox").on('ifChanged', function (e) {
|
||||
$(this).trigger("change", e);
|
||||
});
|
||||
@@ -1529,6 +1503,7 @@
|
||||
}).get();
|
||||
projects.join( "," );
|
||||
users.join( "," );
|
||||
updateActiveFiltersCounter();
|
||||
reload_tasks( projects, users );
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user