Files
globelus.pl/templates_user/globelus/firms/adverts-list.php
Jacek Pyziak fcf8af71aa Add event handler for checkbox changes to manage refresh button state
- Implemented a new event listener for checkboxes with class 'g-checkbox'.
- The listener updates the state of the '.multi-refresh' button based on the checked status of the checkbox.
- Ensured that the refresh button is enabled or disabled appropriately when checkboxes are checked or unchecked.
2025-06-28 22:05:30 +02:00

767 lines
40 KiB
PHP

<? global $lang, $globelus_settings;?>
<link class="footer" rel="stylesheet" type="text/css" href="/libraries/framework/vendor/plugins/datatables/media/css/dataTables.plugins.css">
<link class="footer" rel="stylesheet" type="text/css" href="/libraries/framework/vendor/plugins/datatables/media/css/dataTables.bootstrap.css">
<script class="footer" type="text/javascript">
var dir = '/plugins/grid';
</script>
<script class="footer" src="/libraries/framework/vendor/jquery/jquery_ui/jquery-ui.min.js"></script>
<script class="footer" src="/libraries/framework/vendor/plugins/moment/moment.js"></script>
<script class="footer" src="/libraries/framework/vendor/plugins/moment/pl.js"></script>
<script class="footer" src="/libraries/framework/vendor/plugins/datepicker/js/bootstrap-datetimepicker.js"></script>
<script class="footer" src="/libraries/framework/vendor/plugins/daterange/daterangepicker.js"></script>
<div id="user-panel">
<?= \Tpl::view( 'globelus/firms/_partials/menu', [
'active' => 'ogloszenia'
] );?>
<div class="mini-box fluid">
<div class="title">
Twoje oferty pracy
<span class="pull-right text-danger small">
Posiadasz <?= (int)$this -> firm_points;?> pkt. <a href="/panel-pracodawcy/zakup-punktow">Doładuj konto.</a>
</span>
</div>
<div class="subtitle">
<?= $lang['moje-ogloszenia-podtytul'];?>
<? if ( $this -> user['profile_completed'] ):?>
<a href="/panel-pracodawcy/dodaj-ogloszenie" class="btn btn-success btn-add-advert"><?= $lang['dodaj-ogloszenie'];?></a>
<? endif;?>
</div>
<? if ( !$this -> user['profile_completed'] ):?>
<div class="alert alert-danger">Aby móc dodawać ogłoszenia uzupełnij podstawowe dane o firmie.</div>
<? endif;?>
<p class="legend hidden">
<span style="color: #2cbd2b;">Na zielono oznaczono ogłoszenia wyróżnione na górze listy ogłoszeń. Koszt wyróżnienia ogłoszenia: <strong><?= $globelus_settings['pkt-polecanie-ogloszenia'];?> pkt.</strong></span><br />
<span style="color: #f70;">Na pomarańczowo oznaczono ogłoszenia polecane na stronie głównej. Koszt polecenia ogłoszenia: <strong><?= $globelus_settings['pkt-polecanie-ogloszenia'];?> pkt.</strong></span><br />
<span>Koszt odświeżenia ogłoszenia: <strong><?= $globelus_settings['pkt-odswiezenie-ogloszenia'];?> pkt.</strong></span>
</p>
<div class="row">
<div class="col-12">
<div class="content profil">
<div class="row">
<?
if ( $this -> user['profile_completed'] ):
global $database;
$gdb = [
'database_type' => 'mysql',
'database_name' => $database['name'],
'server' => $database['host'],
'username' => $database['user'],
'password' => $database['password'],
'charset' => 'utf8'
];
include 'plugins/grid/gdb.min.php';
include 'plugins/grid/grid.php';
include 'plugins/grid/grid-view.php';
$grid = new \grid( 'ogloszenia-' . $this -> user['id'] );
$grid -> gdb_opt = $gdb;
$grid -> lp = true;
$grid -> sql = 'SELECT '
. 'ga.id, title, ga.visible, date_add, ga.visits, ga.active_to, ga.highlight, ga.highlight_to, ga.main_page_to, ga.old, main_page, ga.last_refresh, refresh_count, highlight_left, main_page_left, '
. 'disabled_by_admin, additional_promotion, '
. '( SELECT COUNT(0) FROM globelus_adverts_answers WHERE advert_id = ga.id AND deleted = 0 ) AS answers, '
. '( SELECT COUNT(0) FROM globelus_adverts_answers WHERE advert_id = ga.id AND displayed = 0 AND deleted = 0 ) AS answers_nondisplayed, '
. 'IF ( ga.last_refresh IS NOT NULL, ga.last_refresh, ga.date_add ) AS date_refresh '
. 'FROM '
. 'globelus_adverts AS ga '
. 'LEFT JOIN globelus_adverts_categories AS gac ON gac.id = category_id '
. 'INNER JOIN globelus_users AS gu ON ga.user_id = gu.id '
. 'WHERE '
. 'user_id = ' . (int)$this -> user['id'] . ' '
. '[where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) '
. 'FROM '
. 'globelus_adverts AS ga '
. 'LEFT JOIN globelus_adverts_categories AS gac ON gac.id = category_id '
. 'INNER JOIN globelus_users AS gu ON ga.user_id = gu.id '
. 'WHERE '
. 'user_id = ' . (int)$this -> user['id'] . ' '
. '[where] ';
$grid -> debug = false;
$grid -> context_menu = false;
$grid -> condensed = true;
$grid -> multiselect = true;
$grid -> hide_columns = false;
$grid -> order = [ 'column' => 'date_refresh', 'type' => 'DESC' ];
$grid -> search = [
[ 'name' => 'Tytuł', 'db' => 'title', 'type' => 'text' ],
[ 'name' => 'Widoczne', 'db' => 'ga.visible', 'column' => 'visible', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ],
[ 'name' => 'Wyróżnione', 'db' => 'ga.highlight', 'column' => 'highlight', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ],
[ 'name' => 'Polecone', 'db' => 'ga.main_page', 'column' => 'main_page', 'type' => 'select', 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ] ]
];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
], [
'name' => 'Tytuł',
'db' => 'title',
'sort' => true,
'th' => [ 'style' => 'min-width: 400px;' ],
'php' =>
'if ( [additional_promotion] ) { '
. 'echo "<i class=\'fa fa-star text-blue\'></i> "; '
. '} '
. 'echo "<a href=\'/oferta/[id]/" . \\S::seo( \'[title]\', true ) . "\' target=\'blank\'>" '
. ' . addslashes( mb_substr( \'[title]\', 0, 60, \'UTF-8\' ) ); '
. 'if ( strlen( \'[title]\' ) > 60 ) echo "..."; echo "</a>"; '
. 'if ( "[highlight]" )'
. ' echo "<p class=\'small\'>Ogłoszenie wyróżnione do <b>[highlight_to]</b></p>";'
. 'if ( "[main_page]" )'
. ' echo "<p class=\'small\'>Ogłoszenie polecone na stronie głównej do <b>[main_page_to]</b></p>";'
. 'if ( [disabled_by_admin] ) '
. 'echo "<p class=\'info text-danger text-italic\' style=\'font-size: 12px;\'>Ogłoszenie wyłączone przez administratora.</p>";'
], [
'name' => 'Ważność',
'db' => 'active_to',
'sort' => true,
'th' => [ 'style' => 'min-width: 100px;' ],
'php' => 'if ( [old] ) { '
. 'echo "ogłoszenie wygasłe"; '
. '} else { '
. 'if ( "[active_to]" != null ) { '
. 'echo date( "Y-m-d", strtotime( "[active_to]" ) ); '
. '} else { '
. 'echo "bezterminowo"; '
. '} '
. '}'
], [
'name' => 'Wyś.',
'td' => [ 'class' => 'g-center' ],
'db' => 'visits',
'sort' => true
], [
'name' => 'CV',
'td' => [ 'class' => 'g-center' ],
'db' => 'answers',
'sort' => true,
'php' => 'echo "<a href=\'/panel-pracodawcy/odpowiedzi/[id]\' class=\'"; if ( [answers_nondisplayed] ) echo " btn-danger "; else echo " btn-gray "; echo "\'>[answers]</a>"; '
], [
'name' => 'Widoczne',
'db' => 'visible',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 100px;' ],
'sort' => true
], [
'name' => 'Wyróźnione',
'db' => 'highlight',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 100px;' ],
'sort' => true
], [
'name' => 'Polecone',
'db' => 'main_page',
'replace' => [ 'array' => [ 0 => '<span style="color: #FF0000;">nie</span>', 1 => 'tak' ] ],
'td' => [ 'class' => 'g-center' ],
'th' => [ 'class' => 'g-center', 'style' => 'width: 100px;' ],
'sort' => true
], [
'name' => 'Opcje',
'th' => [ 'style' => 'width: 150px;' ],
'tr_second' => true,
'php' =>
// 'if ( "[last_refresh]" == null or \front\factory\GlobelusFirms::get_firm_points( ' . $this -> user['id'] . ' ) < ' . $globelus_settings['pkt-odswiezenie-ogloszenia'] . ' ) '
// . ' $refresh_diff = \S::date_diff( date( \'Y-m-d H:i:s\', strtotime( "[date_add]" ) ), date( \'Y-m-d H:i:s\' ), 60 * 60 * 24 ); '
// . 'else '
// . '$refresh_diff = \S::date_diff( date( \'Y-m-d H:i:s\', strtotime( "[last_refresh]" ) ), date( \'Y-m-d H:i:s\' ), 60 * 60 * 24 ); '
// . 'if ( [refresh_count] < 10 and \'[active_to]\' > date( \'Y-m-d\' ) and \front\factory\GlobelusFirms::get_firm_points( ' . $this -> user['id'] . ' ) >= ' . $globelus_settings['pkt-odswiezenie-ogloszenia'] . ' ) { '
// . 'if ( $refresh_diff >= 5 ) { '
// . 'echo "<p><a href=\'/panel-pracodawcy/odswiez-ogloszenie/[id]/\' style=\'color: #000;\'>odśwież (" . ( 10 - [refresh_count] ) . ")</a></p>"; '
// . '} '
// . '}'
//sprawdzanie czy ogłoszenie nie jest wygasłe
'if ( [old] ) {'
. 'echo "<a href=\'#\' class=\'btn btn-sm btn-dark btn-disabled\'>ogłoszenie wygasłe</a>";'
. '}'
//sprawdzanie ilości punktów
. 'if ( [disabled_by_admin] ) { '
. '$class = \'btn-disabled\'; $title = \'Ogłoszenie zostało wyłączone przez administratora.\'; '
. '} else { '
. 'if ( ![visible] ) { '
. '$class = \'btn-disabled\'; $title = \'Nie można odświeżyć ogłoszenia, które nie jest opublikowane.\';'
. '} else { '
. 'if ( ' . $this -> firm_points . ' < ' . $globelus_settings['pkt-odswiezenie-ogloszenia'] . ' ) { '
. '$class = \'btn-disabled\'; $title = \'Nie posiadasz wystarczającej liczby punktów, aby odświeżyć ogłoszenie.\';'
. '} else {'
//sprawdzanie czy ogłoszenie nie jest wygasłe
. 'if ( \'[active_to]\' < date( \'Y-m-d\' ) or [old] ) { '
. '$class = \'btn-disabled\'; $title = \'Ogłoszenia wygasłego nie można odświeżyć.\';'
. '} else { '
//sprawdzanie kiedy ogłoszenie było ostatnio odświeżone
. 'if ( "[last_refresh]" == null ) '
. '$refresh_diff = \S::date_diff( date( \'Y-m-d H:i:s\', strtotime( "[date_add]" ) ), date( \'Y-m-d H:i:s\' ), 60 * 60 * 24 ); '
. 'else '
. '$refresh_diff = \S::date_diff( date( \'Y-m-d H:i:s\', strtotime( "[last_refresh]" ) ), date( \'Y-m-d H:i:s\' ), 60 * 60 * 24 ); '
. 'if ( $refresh_diff < 1 ) { '
. '$class = \'btn-disabled\'; $title = \'Ogłoszenie można odświeżać nie częściej niż co 24 godziny.\';'
. '} else {'
. '$class = \'\'; $title = \'\'; '
. '} '
. '} '
. '} '
. '} '
. '} '
. 'if ( $title ) '
. 'echo "<span class=\'container-tooltip\' data-tippy-content=\'" . $title . "\'><a href=\'#\' class=\'advert-refresh btn btn-primary btn-sm " . $class . "\' advert-id=\'[id]\'>odśwież</a></span>"; '
. 'else '
. 'echo "<a href=\'#\' class=\'advert-refresh btn btn-primary btn-sm " . $class . "\' advert-id=\'[id]\'>odśwież</a>"; '
. 'if ( "[last_refresh]" )'
. '$add_diff = \S::date_diff( date( "Y-m-d H:i:s", strtotime( "[last_refresh]" ) ), date( "Y-m-d H:i:s" ), 60 * 60 * 24 ); '
. 'else '
. '$add_diff = \S::date_diff( date( "Y-m-d H:i:s", strtotime( "[date_add]" ) ), date( "Y-m-d H:i:s" ), 60 * 60 * 24 ); '
//dodatkowa promocja - sprawdzenie czy ogłoszenie jest opublikowane
. 'if ( [disabled_by_admin] ) { '
. '$class4 = \'btn-disabled\'; $title4 = \'Ogłoszenie zostało wyłączone przez administratora.\'; '
. '} else { '
. 'if ( ![visible] ) { '
. '$class4 = \'btn-disabled\'; $title4 = \'Nie można włączyć dodatkowej promocji ogłoszenia, które nie jest opublikowane.\'; '
. '} else {'
//dodatkowa promocja - sprawdzenie czy ogłoszenie nie ma już włączonęj dodatkowej promocji
. 'if ( [additional_promotion] ) { '
. '$class4 = \'btn-disabled\'; $title4 = \'Ogłoszenie ma już włączoną dodatkową promocję.\'; '
. '} else {'
//dodatkowa promocja - sprawdzenie ilości dostępnych punktów
. 'if ( ' . $this -> firm_points . ' < ' . $globelus_settings['pkt-dodatkowa-promocja-ogloszenia'] . ' ) { '
. '$class4 = \'btn-disabled\'; $title4 = \'Nie posiadasz wystarczającej ilości punktów, aby włączyć dodatkową promocję ogłoszenia.\'; '
. '} '
. 'else {'
. '$class4 = \'\'; $title4 = \'\'; '
. '} '
. '} '
. '} '
. '} '
//przycisk dodatkowej promocji
. 'if ( $title4 ) '
. 'echo "<span class=\'container-tooltip\' data-tippy-content=\'" . $title4 . "\'>" '
. '. "<a href=\'#\' class=\'advert_highlight btn btn-primary btn-sm " . $class4 . "\' advert-id=\'[id]\'>dodatkowa promocja</a>" '
. '. "</span>"; '
//wyróżnienie - sprawdzanie czy ogłoszenie jest opublikowane
. 'if ( [disabled_by_admin] ) { '
. '$class2 = \'btn-disabled\'; $title2 = \'Ogłoszenie zostało wyłączone przez administratora.\'; '
. '} else { '
. 'if ( ![visible] ) { '
. '$class2 = \'btn-disabled\'; $title2 = \'Nie można włączyć wyróżnienia ogłoszenia, które nie jest opublikowane.\'; '
. '} '
. 'else {'
//wyróznienie - sprawdzenie czy ogłoszenie nie jest już wyróżnione
. 'if ( [highlight] ) { '
. '$class2 = \'btn-disabled\'; $title2 = \'Ogłoszenie jest już wyróżnione.\'; '
. '} '
. 'else {'
//wyróżnienie - sprawdzenie ilości dostępnych punktów
. 'if ( ' . $this -> firm_points . ' < ' . $globelus_settings['pkt-wyroznienie-ogloszenia'] . ' ) { '
. '$class2 = \'btn-disabled\'; $title2 = \'Nie posiadasz wystarczającej ilości punktów, aby włączyć wyróżnienie ogłoszenie.\'; '
. '} '
. 'else {'
. '$class2 = \'\'; $title2 = \'\'; '
. '} '
. '} '
. '} '
. '} '
//przycisk wyróżnienie
. 'if ( $title2 ) '
. 'echo "<span class=\'container-tooltip\' data-tippy-content=\'" . $title2 . "\'>" '
. '. "<a href=\'#\' class=\'advert_highlight btn btn-primary btn-sm " . $class2 . "\' advert-id=\'[id]\'>włącz wyróżnienie</a>" '
. '. "</span>"; '
. 'else '
. 'echo "<a href=\'#\' class=\'advert_highlight btn btn-primary btn-sm\' advert-id=\'[id]\'>włącz wyróżnienie</a>"; '
//polecenie - sprawdzenie czy ogłoszenie jest opulikowane
. 'if ( [disabled_by_admin] ) { '
. '$class3 = \'btn-disabled\'; $title3 = \'Ogłoszenie zostało wyłączone przez administratora.\'; '
. '} else { '
. 'if ( ![visible] ) { '
. '$class3 = \'btn-disabled\'; $title3 = \'Nie można włączyć polecenia ogłoszenia, które nie jest opublikowane.\'; '
. '} '
. 'else {'
//polecenie - sprawdzenie czy ogłoszenie nie jest już polecane
. 'if ( [main_page] ) { '
. '$class3 = \'btn-disabled\'; $title3 = \'Ogłoszenie jest już polecane na stronie głónej.\'; '
. '} '
. 'else {'
//wyróżnienie - sprawdzenie ilości dostępnych punktów
. 'if ( ' . $this -> firm_points . ' < ' . $globelus_settings['pkt-wyroznienie-ogloszenia'] . ' ) { '
. '$class3 = \'btn-disabled\'; $title3 = \'Nie posiadasz wystarczającej ilości punktów, aby wyróżnić ogłoszenie.\'; '
. '} '
. 'else {'
. '$class3 = \'\'; $title3 = \'\'; '
. '} '
. '} '
. '} '
. '} '
//przycisk polecenie
. 'if ( $title3 ) '
. 'echo "<span class=\'container-tooltip\' data-tippy-content=\'" . $title3 . "\'>" '
. '. "<a href=\'#\' class=\'advert_main_page btn btn-primary btn-sm " . $class3 . "\' advert-id=\'[id]\'>włącz polecenie</a>" '
. '. "</span>"; '
. 'else '
. 'echo "<a href=\'#\' class=\'advert_main_page btn btn-primary btn-sm\' advert-id=\'[id]\'>włącz polecenie</a>"; '
. 'if ( ![disabled_by_admin] ) { '
. 'if ( [visible] ) '
. 'echo "<a href=\'#\' class=\'btn btn-sm btn-primary advert-disable\' advert-id=\'[id]\'>wyłącz ogłoszenie</a>"; '
. 'else { '
//sprawdzenie ile ktoś ma ogłoszeń
. 'if ( ' . $this -> adverts_count . ' >= ' . $globelus_settings['limit-ogloszen'] . ' ) { '
. 'if ( ' . $this -> firm_points . ' < ' . $globelus_settings['pkt-dodanie-ogloszenia-powyzej-limitu'] . ' ) { '
. 'echo "<span class=\'container-tooltip\' data-tippy-content=\'Niestety posiadasz zbyt mało punktów aby opublikować nowe ogłoszenie.\'>" '
. '. "<a href=\'#\' class=\'advert-public btn btn-primary btn-sm btn-disabled\' advert-id=\'[id]\'>publikuj</a>" '
. '. "</span>"; '
. '} else { '
. 'echo "<a href=\'#\' class=\'btn btn-sm btn-primary advert-public\' advert-id=\'[id]\'>publikuj</a>"; '
. '} '
. '} '
. 'else {'
. 'echo "<a href=\'#\' class=\'btn btn-sm btn-primary advert-public\' advert-id=\'[id]\'>publikuj</a>"; '
. '} '
. '} '
. 'echo \'<a href="/panel-pracodawcy/edytuj-ogloszenie/[id]" class="btn btn-sm btn-primary advert-edit" title="edytuj" style="font-size: 12px;">edytuj</a>\';'
. '} '
. 'echo \'<a href="#" class="btn btn-primary advert-delete" advert-id="[id]" title="usuń">usuń</a>\'; '
]
];
$grid -> buttons = [
[
'class' => 'btn-danger multi-disable',
'label' => 'Wyłącz',
'url' => '/globelusFirms/multi_disable/'
], [
'class' => 'btn-danger multi-delete',
'label' => 'Usuń',
'url' => '/globelusFirms/multi_delete/'
], [
'class' => 'btn-primary multi-refresh',
'label' => 'Odśwież',
'url' => '/globelusFirms/multi_refresh/'
]
];
echo $grid -> draw();
endif;
?>
</div>
</div>
</div>
</div>
</div>
</div>
<script class="footer" src="/libraries/framework/vendor/plugins/datatables/media/js/jquery.dataTables.js"></script>
<script class="footer" src="/libraries/framework/vendor/plugins/datatables/media/js/dataTables.bootstrap.js"></script>
<script class="footer" type="text/javascript">
function odmiana_slowa_ogloszenie( liczba )
{
var slowo = 'ogłoszenie';
if ( liczba == 1 ) return slowo;
if ( liczba > 1 && liczba < 5 ) return 'ogłoszenia';
if ( liczba >= 5 ) return 'ogłoszeń';
}
$( function()
{
tippy('[data-tippy-content]', {
theme: 'material'
});
$( 'body' ).on( click_event, '.advert_highlight', function(e)
{
e.preventDefault();
var advert_id = $( this ).attr( 'advert-id' );
$.alert(
{
title: 'Wyróżnienie ogłoszenia',
icon: 'fa fa-exclamation',
content: 'Wyróżnienie ogłoszenia kosztuje <b><?= $globelus_settings['pkt-wyroznienie-ogloszenia'];?> punktów<\/b>, zostaną one pobrane z Twojego konta.',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
columnClass: 'large',
theme: 'modern',
buttons:
{
cancel:
{
text: '<?= $lang['anuluj'];?>',
action: function() {}
},
confirm:
{
text: '<?= $lang['zatwierdz'];?>',
btnClass: 'btn-blue',
keys: ['enter'],
action: function()
{
document.location.href='/globelusFirms/advert_highlight_enable/advert-id=' + advert_id;
}
}
}
});
});
$( 'body' ).on( click_event, '.advert-refresh', function(e)
{
e.preventDefault();
var advert_id = $( this ).attr( 'advert-id' );
$.alert(
{
title: 'Odświeżenie ogłoszenia',
icon: 'fa fa-exclamation',
content: 'Odświeżenie ogłoszenia kosztuje <b><?= $globelus_settings['pkt-odswiezenie-ogloszenia'];?> punkt<\/b>, zostanie on pobrany z Twojego konta.',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
columnClass: 'large',
theme: 'modern',
buttons:
{
cancel:
{
text: '<?= $lang['anuluj'];?>',
action: function() {}
},
confirm:
{
text: '<?= $lang['zatwierdz'];?>',
btnClass: 'btn-blue',
keys: ['enter'],
action: function()
{
document.location.href = '/panel-pracodawcy/odswiez-ogloszenie/' + advert_id + '/';
}
}
}
});
});
$( 'input.g-checkbox' ).on( 'ifChanged', function( event ) {
$( '.multi-refresh' ).removeClass( 'btn-disabled' );
var refresh_button = $( this ).closest( 'tr' ).next( 'tr' ).find( '.advert-refresh' );
if ( refresh_button.hasClass( 'btn-disabled' ) && event.target.checked ) {
$( '.multi-refresh' ).addClass( 'btn-disabled' );
}
});
$( 'body' ).on( click_event, '.multi-refresh', function(e)
{
e.preventDefault();
var ids = getCheckedIds( 'ogloszenia-<?= $this -> user['id'];?>' );
var points = <?= $globelus_settings['pkt-odswiezenie-ogloszenia'];?> * ids.length;
var href = $( this ).attr( 'href' );
$.alert(
{
title: 'Odświeżenie ogłoszeń',
icon: 'fa fa-exclamation',
content: 'Odświeżasz ' + ids.length + ' ' + odmiana_slowa_ogloszenie( ids.length ) + '. Z Twojego konta zostanie pobrane <b>' + points + ' punktów<\/b>.',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
columnClass: 'large',
theme: 'modern',
buttons:
{
cancel:
{
text: '<?= $lang['anuluj'];?>',
action: function() {}
},
confirm:
{
text: '<?= $lang['zatwierdz'];?>',
btnClass: 'btn-blue',
keys: ['enter'],
action: function()
{
$.ajax({
type: 'POST',
cache: false,
url: href,
data: {
ids: ids
},
beforeSend: function() {},
success: function( data ) {
document.location.reload();
}
});
}
}
}
});
});
$( 'body' ).on( click_event, '.multi-delete', function(e)
{
var ids = getCheckedIds( 'ogloszenia-<?= $this -> user['id'];?>' );
var href = $( this ).attr( 'href' );
$.alert(
{
title: 'Usunięcie ogłoszeń',
icon: 'fa fa-exclamation',
content: 'Na pewno chcesz usunąć wybrane ogłoszenia?',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
columnClass: 'large',
theme: 'modern',
buttons:
{
cancel:
{
text: '<?= $lang['anuluj'];?>',
action: function() {}
},
confirm:
{
text: '<?= $lang['zatwierdz'];?>',
btnClass: 'btn-red',
keys: ['enter'],
action: function()
{
$.ajax({
type: 'POST',
cache: false,
url: href,
data: {
ids: ids
},
beforeSend: function() {},
success: function( data ) {
document.location.reload();
}
});
}
}
}
});
return false;
});
$( 'body' ).on( click_event, '.multi-disable', function(e)
{
var ids = getCheckedIds( 'ogloszenia-<?= $this -> user['id'];?>' );
var href = $( this ).attr( 'href' );
$.alert(
{
title: 'Wyłączenie ogłoszeń',
icon: 'fa fa-exclamation',
content: 'Na pewno chcesz wyłączyć wybrane ogłoszenia?',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
columnClass: 'large',
theme: 'modern',
buttons:
{
cancel:
{
text: '<?= $lang['anuluj'];?>',
action: function() {}
},
confirm:
{
text: '<?= $lang['zatwierdz'];?>',
btnClass: 'btn-red',
keys: ['enter'],
action: function()
{
$.ajax({
type: 'POST',
cache: false,
url: href,
data: {
ids: ids
},
beforeSend: function() {},
success: function( data ) {
document.location.reload();
}
});
}
}
}
});
return false;
});
$( 'body' ).on( click_event, '.advert-disable', function(e)
{
e.preventDefault();
var advert_id = $( this ).attr( 'advert-id' );
$.alert(
{
title: 'Wyłączenie ogłoszenia',
icon: 'fa fa-exclamation',
content: '<?= $lang['potwierdz-wylaczenie-ogloszenia'];?>',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
columnClass: 'large',
theme: 'modern',
buttons:
{
cancel:
{
text: '<?= $lang['anuluj'];?>',
action: function() {}
},
confirm:
{
text: '<?= $lang['zatwierdz'];?>',
btnClass: 'btn-red',
keys: ['enter'],
action: function()
{
document.location.href='/globelusFirms/advert_disable/advert-id=' + advert_id;
}
}
}
});
});
$( 'body' ).on( click_event, '.advert-public', function(e)
{
e.preventDefault();
var advert_id = $( this ).attr( 'advert-id' );
<? if ( $this -> adverts_count >= $globelus_settings['limit-ogloszen'] and $this -> firm_points >= $globelus_settings['pkt-dodanie-ogloszenia-powyzej-limitu'] ):?>
$.alert(
{
title: 'Publikowanie ogłoszenia',
icon: 'fa fa-exclamation',
content: 'Posiadasz już opulikowanych <b><?= $this -> adverts_count;?> ogłoszeń<\/b>.<br>Każde nowe opublikowane ogłoszenie to koszt <b><?= $globelus_settings['pkt-dodanie-ogloszenia-powyzej-limitu'];?> punktów.<\/b>',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
columnClass: 'large',
theme: 'modern',
buttons:
{
cancel:
{
text: '<?= $lang['anuluj'];?>',
action: function() {}
},
confirm:
{
text: '<?= $lang['zatwierdz'];?>',
btnClass: 'btn-blue',
keys: ['enter'],
action: function()
{
document.location.href='/globelusFirms/advert_enable/advert-id=' + advert_id;
}
}
}
});
<? endif;?>
<? if ( $this -> adverts_count < $globelus_settings['limit-ogloszen'] ):?>
document.location.href='/globelusFirms/advert_enable/advert-id=' + advert_id;
<? endif;?>
});
$( 'body' ).on( click_event, '.advert_main_page', function(e)
{
e.preventDefault();
var advert_id = $( this ).attr( 'advert-id' );
$.alert(
{
title: 'Polecenie ogłoszenia',
icon: 'fa fa-exclamation',
content: 'Włączenie polecenia ogłoszenia kosztuje <b><?= $globelus_settings['pkt-polecanie-ogloszenia'];?> punktów<\/b>, zostaną one pobrane z Twojego konta.',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
columnClass: 'large',
theme: 'modern',
buttons:
{
cancel:
{
text: '<?= $lang['anuluj'];?>',
action: function() {}
},
confirm:
{
text: '<?= $lang['zatwierdz'];?>',
btnClass: 'btn-blue',
keys: ['enter'],
action: function()
{
document.location.href='/globelusFirms/advert_main_page_enable/advert-id=' + advert_id;
}
}
}
});
});
$( 'body' ).on( click_event, '.advert-delete', function(e)
{
e.preventDefault();
var advert_id = $( this ).attr( 'advert-id' );
$.alert(
{
title: 'Usunięcie ogłoszenia',
icon: 'fa fa-exclamation',
content: 'Na pewno chcesz usunąć wybrane ogłoszenie?<br/><strong>Tej operacji nie można cofnąć.</strong>',
closeIcon: true,
closeIconClass: 'fa fa-close',
typeAnimated: true,
animation: 'opacity',
columnClass: 'large',
theme: 'modern',
buttons:
{
cancel:
{
text: '<?= $lang['anuluj'];?>',
action: function() {}
},
confirm:
{
text: '<?= $lang['zatwierdz'];?>',
btnClass: 'btn-danger',
keys: ['enter'],
action: function()
{
document.location.href='/globelusFirms/advert_delete/advert-id=' + advert_id;
}
}
}
});
});
});
</script>