first commit

This commit is contained in:
2024-12-12 15:33:18 +01:00
commit 2c8998663e
3360 changed files with 777573 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
<div class="panel panel-info panel-border top">
<div class="panel-heading">
<span class="panel-title">Edycja klienta: <u><?= $this -> _client['login'];?></u></span>
</div>
<div class="panel-heading p5" style="height: auto;">
<div class="row mb10 pl5">
<div class="col col-xs-12">
<?= \Html::button(
array(
'class' => 'btn btn-sm btn-success',
'text' => 'Zatwierdź',
'js' => 'checkForm( "formularz" );',
'icon' => 'fa-check-circle mr5'
)
);?>
<?= \Html::button(
array(
'class' => 'btn btn-sm btn-danger',
'text' => 'Anuluj',
'url' => '/?p=reseller_clients',
'icon' => 'fa-times mr5'
)
);?>
</div>
</div>
</div>
<div class="panel-body">
<form method="POST" action="/?p=reseller_clients" id="formularz" class="form-horizontal">
<input type="hidden" name="reseller_id" value="<?= $this -> _reseller_id;?>" />
<? if ( $this -> _client ):?>
<input type='hidden' name='rw' value='save' />
<input type='hidden' id="idk" name='client_id' value='<?= $this -> _client['id'];?>' />
<? else:?>
<input type='hidden' name='rw' value='add_new' />
<input type='hidden' name='check' value='<?= mktime();?>' />
<? endif;?>
<div class="row">
<div class="col col-md-6">
<?= \Html::input(
array(
'name' => 'login',
'class' => 'require',
'value' => $this -> _client['login'],
'label' => 'Login'
)
);?>
<?= \Html::input(
array(
'name' => 'password',
'label' => 'Hasło'
)
);?>
<?= \Html::input_switch(
array(
'name' => 'enabled',
'label' => 'Aktywny',
'checked' => $this -> _client['enabled'] ? true : false,
'values' => [
'0' => 'nie',
'1' => 'tak'
]
)
);?>
<div class="form-group">
<label class="col-lg-4 control-label">Strony:</label>
<div class="col-lg-8">
<div class="row">
<? if ( is_array( $this -> _sites ) ): foreach ( $this -> _sites as $site ):?>
<div class="col-xs-6">
<div class="checkbox-custom fill checkbox-primary mt10">
<input id="site_<?= $site['id'];?>" type="checkbox" value="<?= $site['id'];?>" name="sites[]" <? if ( in_array( $site['id'], $this -> _client['sites'] ) ):?>checked="checked"<? endif;?> />
<label for="site_<?= $site['id'];?>"><?= $site['name'];?></label>
</div>
</div>
<? endforeach; endif;?>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<script type='text/javascript'>
$( function()
{
disable_menu();
});
</script>

View File

@@ -0,0 +1,101 @@
<? global $config, $gdb, $mdb, $user;?>
<div class="panel panel-info panel-border top">
<div class="panel-heading">
<span class="panel-title">Lista klientów</span>
</div>
<div class="panel-body">
<?
$grid = new \grid( 'pro_rr_clients', 'reseller-clients-' . $user['id'] );
$grid -> sql = 'SELECT '
. 'id, login, enabled '
. 'FROM '
. 'pro_rr_clients AS prc '
. 'WHERE '
. 'reseller_id = ' . $user['id'] . ' [where] '
. 'ORDER BY '
. '[order_p1] [order_p2]';
$grid -> sql_count = 'SELECT '
. 'COUNT(0) '
. 'FROM '
. 'pro_rr_clients '
. 'WHERE '
. 'reseller_id = ' . $user['id'] . ' [where] ';
$grid -> debug = true;
$grid -> gdb_opt = $gdb;
$grid -> limit = 50;
$grid -> search = [
[ 'name' => 'Login', 'db' => 'login', 'type' => 'text' ]
];
$grid -> order = [ 'column' => 'login', 'type' => 'ASC' ];
$grid -> columns_view = [
[
'name' => 'Lp.',
'th' => [ 'class' => 'g-lp' ],
'td' => [ 'class' => 'g-center' ],
'autoincrement' => true
],
[
'name' => 'Login',
'db' => 'login',
'sort' => true
],
[
'name' => 'Aktywny',
'th' => [ 'style' => 'width: 120px; text-align: center;' ],
'td' => [ 'style' => 'text-align: center;' ],
'db' => 'enabled',
'replace' => [
'array' => [
0 => '<span class="text-danger">nie</span>',
1 => '<span class="text-primary">tak</span>'
]
],
'sort' => true
],
[
'name' => 'Akcja',
'action' => [ 'type' => 'edit', 'url' => '/?p=reseller_clients&rw=edit&id=[id]' ],
'th' => [ 'class' => 'g-center' ],
'td' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ]
],
[
'name' => 'Usuń',
'action' => [ 'type' => 'delete', 'url' => '/?p=reseller_clients&rw=del&id=[id]' ],
'th' => [ 'class' => 'g-center' ],
'td' => [ 'class' => 'g-center', 'style' => 'width: 50px;' ]
]
];
$grid -> buttons = [
[
'label' => 'Dodaj klienta',
'class' => 'btn-success',
'icon' => 'fa-plus-circle mr5',
'url' => '/?p=reseller_clients&rw=add'
]
];
$grid -> hide_columns = false;
echo $grid -> draw();
?>
</div>
</div>
<script type="text/javascript">
$( document ).ready( function()
{
$( 'body' ).on( 'click', '#downloads-delete', function()
{
$.prompt( 'Na pewno chcesz usunąć pobrane linki?', {
title: 'Potwierdź?',
submit: function(e,v,m,f)
{
if ( v === true )
$( '#f-downloads-delete' ).submit();
},
buttons: {
'tak': true,
'nie': false
},
focus: 0
});
});
});
</script>

View File

@@ -0,0 +1,190 @@
<div class="panel panel-info panel-border top">
<div class="panel-heading">
<span class="panel-title">Edycja stawek: <u><?= $this -> _phrase['phrase'];?></u></span>
</div>
<div class="panel-heading p5" style="height: auto;">
<div class="row mb10 pl5">
<div class="col col-xs-12">
<?= \Html::button(
array(
'class' => 'btn btn-sm btn-success',
'text' => 'Zatwierdź',
'js' => 'checkForm( "formularz" );',
'icon' => 'fa-check-circle'
)
);?>
<?= \Html::button(
array(
'class' => 'btn btn-sm btn-danger',
'text' => 'Anuluj',
'url' => '/?p=client_sites',
'icon' => 'fa-times'
)
);?>
</div>
</div>
</div>
<div class="panel-body">
<form method="POST" action="/?p=client_sites&id=<?= $this -> _site_id;?>" id="formularz" class="form-horizontal">
<input type="hidden" name="site_id" value="<?= $this -> _site_id;?>" />
<input type='hidden' name='phrase_id' value='<?= $this -> _phrase['id'];?>'>
<input type="hidden" name="reseller_id" value="<?= $this -> _reseller_id;?>" />
<input type='hidden' name='rw' value='save_costs' />
<div class="row">
<div class="col col-md-12 col-lg-8">
<div class="form-group">
<label class="col-lg-4 control-label">Zakresy:</label>
<div class="col-lg-8">
<div id="prices-edit">
<?
if ( !$this -> _prices )
{
$i = 1;
?>
<div class="price-box" id="price-box-1" count="1">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-5 text-left pb10">
od: <input type="text" class="form-control text-center from" id="from_1" name="from[1]" onChange="checkIntFrom( 1 )" value="1" style="width: 45px; margin: 0 5px; display: inline-block;" />
do: <input type="text" class="form-control text-center to" id="to_1" name="to[1]" onChange="checkIntTo( 1 )" value="1" style="width: 45px; margin: 0 5px; display: inline-block;" />
</div>
<div class="col-xs-12 col-sm-6 col-md-7 text-left pb10">
stawka / stawka m-c: <input type="text" class="form-control text-right" id="price_1" name="price[1]" onChange="checkPrice( 1 )" style="width: 60px; margin: 0 5px; display: inline-block;" /> /
<input type="text" class="form-control text-right" id="price_month_1" onChange="checkPriceMonth( 1 );" style="width: 60px; margin: 0 5px; display: inline-block" /> zł
<a href='#' onClick="deletePrice( 1 ); return false;">
<i class="fa fa-trash fa-lg ml10 text-danger"></i>
</a>
</a>
</div>
</div>
<div class="m5" style="border: 1px solid #ccc;"></div>
</div>
<?
}
else
{
$i = 0;
foreach ( $this -> _prices as $price )
{
$i++;
?>
<div class="price-box" id="price-box-<?= $i;?>" count="<?= $i;?>">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-5 text-left pb10">
od: <input type="text" class="form-control text-center from" id="from_<?= $i;?>" name="from[<?= $i;?>]" value="<?= $price['start'];?>" onChange="checkIntFrom( <?= $i;?> )" style="width: 45px; margin: 0 5px; display: inline-block;" />
do: <input type="text" class="form-control text-center to" id="to_<?= $i;?>" name="to[<?= $i;?>]" value="<?= $price['end'];?> "onChange="checkIntTo( <?= $i;?> )" style="width: 45px; margin: 0 5px; display: inline-block;" />
</div>
<div class="col-xs-12 col-sm-6 col-md-7 text-left pb10">
st. / st. m-c: <input type="text" class="form-control text-right" id="price_<?= $i;?>" value="<?= $price['price'];?>" name="price[<?= $i;?>]" onChange="checkPrice( <?= $i;?> )" style="width: 60px; margin: 0 5px; display: inline-block;" /> /
<input type="text" class="form-control text-right" id="price_month_<?= $i;?>" value="" onChange="checkPriceMonth( <?= $i;?> );" style="width: 60px; margin: 0 5px; display: inline-block" /> zł
<a href='#' onClick="deletePrice( <?= $i;?> ); return false;">
<i class="fa fa-trash fa-lg ml10 text-danger"></i>
</a>
</div>
</div>
<div class="m5" style="border: 1px solid #ccc;"></div>
</div>
<?
}
}
?>
</div>
<a onClick="addPriceBox(); return false;" class="btn btn-sm btn-success">dodaj zakres</a>
<input type="hidden" name="count_prices" id="count_prices" value="<?= $i;?>">
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<script type="text/javascript">
$( function()
{
disable_menu();
});
function deletePrice( id )
{
$( '#price-box-' + id ).remove();
}
function addPriceBox()
{
var i = 0;
var z = 0;
$( '.price-box' ).each( function()
{
if ( i < parseInt( $( this ).attr( 'count' ) ) )
i = parseInt( $( this ).attr( 'count' ) );
});
$( '.to' ).each( function()
{
if ( z < parseInt( $( this ).val() ) )
z = parseInt( $( this ).val() );
});
var text = '<div class="price-box" id="price-box-' + ( i + 1 ) + '" count="' + ( i + 1 ) + '">\n' +
'<div class="row">' +
'<div class="col-xs-12 col-sm-6 col-md-5 text-left pb10">' +
'od: <input type="text" class="form-control text-center from" value="' + ( z + 1 ) + '" id="from_' + ( i + 1 ) + '" name="from[' + ( i + 1 ) + ']" onChange="checkIntFrom( ' + ( i + 1 ) + ' )" style="width: 45px; margin: 0 5px; display: inline-block;" />' +
'do: <input type="text" class="form-control text-center to" value="' + ( z + 1 ) + '" id="to_' + ( i + 1 ) + '" name="to[' + ( i + 1 ) + ']" onChange="checkIntTo( ' + ( i + 1 ) + ' )" style="width: 45px; margin: 0 5px; display: inline-block;" />' +
'</div>' +
'<div class="col-xs-12 col-sm-6 col-md-7 text-left pb10">' +
'st. / st. m-c: <input type="text" class="form-control text-right" id="price_' + ( i + 1 ) + '" name="price[' + ( i + 1 ) + ']" onChange="checkPrice( ' + ( i + 1 ) + ' )" style="width: 60px; margin: 0 5px; display: inline-block;"> / ' +
'<input type="text" class="form-control text-right" id="price_month_' + ( i + 1 ) + '" onChange="checkPriceMonth( ' + ( i + 1 ) + ' )" style="width: 60px; margin: 0 5px; display: inline-block;"> zł' +
'&nbsp;<a href="#" onClick="deletePrice( ' + ( i + 1 ) + ' )">' +
'<i class="fa fa-trash fa-lg text-danger ml10"></i>' +
'</a>' +
'</div>' +
'</div>' +
'<div class="m5" style="border: 1px solid #ccc;"></div>' +
'</div>';
$ ( '#prices-edit' ).append( text );
$( '#count_prices' ).val( z + 1 );
}
function checkIntFrom( id )
{
var val = $( '#from_' + id ).val();
val = parseInt( val );
if ( !val )
val = 1;
$( '#from_' + id ).val( val )
}
function checkIntTo( id )
{
var val = $( '#to_' + id ).val();
val = parseInt( val );
if ( !val )
val = 1;
$( '#to_' + id ).val( val )
}
function checkPriceMonth( id )
{
var val = $( '#price_month_' + id ).val();
val = parseFloat( val.replace( '.', '.' ) * 1 );
$( '#price_month_' + id ).val( number_format( val, 2 , '.', '' ) );
if ( isNaN( val ) )
val = 0;
val = number_format( val / 30 , 2 , '.', '' );
$( '#price_' + id ).val( val );
}
function checkPrice( id )
{
var val = $( '#price_' + id ).val();
val = parseFloat( val.replace( '.', '.' ) * 1 );
if ( isNaN( val ) )
val = 0;
val = number_format( val , 2 , '.', '' );
$( '#price_' + id ).val( val );
}
</script>

View File

@@ -0,0 +1,112 @@
<!DOCTYPE html>
<html>
<head>
<title>rank24.pl</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="author" content="www.project-pro.pl - internetowe rozwiązania dla biznesu" />
<link rel="stylesheet" href="/libraries/framework/skin/default_skin/css/theme.css" />
<link rel="stylesheet" href="/libraries/framework/admin-tools/admin-forms/css/admin-forms.css" />
<link rel='stylesheet' type='text/css' href='http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700'>
<link rel="stylesheet" href="/libraries/framework/vendor/plugins/magnific/magnific-popup.css">
<link rel="stylesheet" href="/libraries/framework/vendor/plugins/datepicker/css/bootstrap-datetimepicker.css">
<link rel="stylesheet" href="/libraries/framework/vendor/plugins/colorpicker/css/bootstrap-colorpicker.min.css">
<script src="/libraries/framework/vendor/jquery/jquery-1.11.1.min.js"></script>
<script src="/libraries/framework/vendor/jquery/jquery_ui/jquery-ui.min.js"></script>
<script src="/libraries/framework/vendor/plugins/magnific/jquery.magnific-popup.js"></script>
<script src="/libraries/framework/vendor/plugins/moment/moment.js"></script>
<script src="/libraries/framework/vendor/plugins/moment/pl.js"></script>
<script src="/libraries/framework/vendor/plugins/datepicker/js/bootstrap-datetimepicker.js"></script>
<script src="/libraries/framework/vendor/plugins/colorpicker/js/bootstrap-colorpicker.min.js"></script>
<script src="/libraries/functions.js"></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" href="/layout/style-css/custom.css" />
</head>
<body class="sb-top sb-top-sm">
<div id="main">
<header class="navbar navbar-fixed-top navbar-shadow">
<div class="navbar-branding">
<a class="navbar-brand" href="./?p=dashboard">
<b>rank</b>24
</a>
</div>
<div class="nav navbar-nav navbar-right">
<li class="dropdown menu-merge">
<a href="#" class="dropdown-toggle fw600 p15" data-toggle="dropdown" aria-expanded="false">
<img src="/layout/user-icon.png" alt="avatar" class="mw30 br64 mr15"> <?= $this -> _user['login'];?>
<span class="caret caret-tp hidden-xs"></span>
</a>
<ul class="dropdown-menu list-group dropdown-persist w250" role="menu">
<li class="list-group-item">
<a href="./?rw=user_logout" class="animated animated-short fadeInUp">
<span class="fa fa-power-off"></span>Wyloguj się
</a>
</li>
</ul>
</li>
<li id="toggle_sidemenu_t">
<span class="fa fa-bars"></span>
</li>
</div>
</header>
<aside id="sidebar_left">
<div class="sidebar-left-content nano-content">
<ul class="nav sidebar-menu">
<li>
<a class="accordion-toggle" href="#">
<span class="sidebar-title">Monitoring</span>
<span class="caret"></span>
</a>
<ul class="nav sub-nav">
<li>
<a href="/?p=reseller_sites">Lista stron</a>
</li>
<li>
<a href="/?p=reseller_clients">Lista klientów</a>
</li>
<li>
<a href="/?p=reseller_summary">Podsumowanie</a>
</li>
<li>
<a href="/?p=reseller_reports">Raporty</a>
</li>
</ul>
</li>
</ul>
</div>
</aside>
<section id="content_wrapper">
<section id="content">
<? if ( $alert = \S::get_session( 'alert' ) ):
\S::alert( false );
?>
<div class="container-fluid">
<div class="row mb10">
<div class="alert alert-danger col col-xs-12 alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?= $alert;?>
</div>
</div>
</div>
<?
endif; ?>
<?= $this -> _content;?>
</section>
</section>
</div>
<div id="overlay"></div>
<script src="/libraries/framework/js/utility/utility.js"></script>
<script src="/libraries/framework/js/main.js"></script>
<script type="text/javascript">
jQuery( document ).ready( function()
{
"use strict";
Core.init();
});
</script>
</body>
</html>

View File

@@ -0,0 +1,54 @@
<div class="panel panel-info panel-border top">
<div class="panel-heading">
<span class="panel-title">Edycja frazy: <u><?= $this -> _phrase['phrase'];?></u></span>
</div>
<div class="panel-heading p5" style="height: auto;">
<div class="row mb10 pl5">
<div class="col col-xs-12">
<?= \Html::button(
array(
'class' => 'btn btn-sm btn-success',
'text' => 'Zatwierdź',
'js' => 'checkForm( "formularz" );',
'icon' => 'fa-check-circle mr5'
)
);?>
<?= \Html::button(
array(
'class' => 'btn btn-sm btn-danger',
'text' => 'Anuluj',
'url' => '/?p=reseller_sites',
'icon' => 'fa-times mr5'
)
);?>
</div>
</div>
</div>
<div class="panel-body">
<form method="POST" action="/?p=client_sites&id=<?= $this -> _site_id;?>" id="formularz" class="form-horizontal">
<input type="hidden" name="site_id" value="<?= $this -> _site_id;?>" />
<input type='hidden' name='phrase_id' value='<?= $this -> _phrase['id'];?>' />
<input type='hidden' name='check' value='<?= mktime();?>' />
<input type='hidden' name='rw' value='save_phrase' />
<input type="hidden" name="reseller_id" value="<?= $this -> _reseller_id;?>" />
<div class="row">
<div class="col col-md-6">
<?= \Html::input(
array(
'name' => 'discount',
'value' => $this -> _phrase['discount'],
'label' => 'Rabat w %',
'class' => 'number-format'
)
);?>
</div>
</div>
</form>
</div>
</div>
<script type='text/javascript'>
$( function()
{
disable_menu();
});
</script>

View File

@@ -0,0 +1,177 @@
<? global $config;?>
<div class="panel panel-info panel-border top">
<div class="panel-heading" style="height: auto; padding-bottom: 4px;">
<div class="row" style="color: #666666;">
<div class="col-xs-12">
<select name="month_global" class="form-control ranker-select" id="month_global" onChange="document.location.href='./?p=reseller_summary&id=<?= $this -> _site['id'];?>&year=' + $( '#year_global' ).val() + '&month=' + $( this ).val();">
<option value="01" <? if ( $this -> _month == '01' ) echo 'selected="selected"'; ?>>Styczeń</option>
<option value="02" <? if ( $this -> _month == '02' ) echo 'selected="selected"'; ?>>Luty</option>
<option value="03" <? if ( $this -> _month == '03' ) echo 'selected="selected"'; ?>>Marzec</option>
<option value="04" <? if ( $this -> _month == '04' ) echo 'selected="selected"'; ?>>Kwiecień</option>
<option value="05" <? if ( $this -> _month == '05' ) echo 'selected="selected"'; ?>>Maj</option>
<option value="06" <? if ( $this -> _month == '06' ) echo 'selected="selected"'; ?>>Czerwiec</option>
<option value="07" <? if ( $this -> _month == '07' ) echo 'selected="selected"'; ?>>Lipiec</option>
<option value="08" <? if ( $this -> _month == '08' ) echo 'selected="selected"'; ?>>Sierpień</option>
<option value="09" <? if ( $this -> _month == '09' ) echo 'selected="selected"'; ?>>Wrzesień</option>
<option value="10" <? if ( $this -> _month == '10' ) echo 'selected="selected"'; ?>>Październik</option>
<option value="11" <? if ( $this -> _month == '11' ) echo 'selected="selected"'; ?>>Listopad</option>
<option value="12" <? if ( $this -> _month == '12' ) echo 'selected="selected"'; ?>>Grudzień</option>
</select>
<select name="year_global" id="year_global" class="form-control ranker-select" onChange="document.location.href='./?p=reseller_summary&id=<?= $this -> _site['id'];?>&year=' + $( this ).val() + '&month=' + $( '#month_global' ).val();">
<? for ( $i = date( 'Y') - 2; $i <= date( 'Y') + 2; $i++ ):?>
<option value="<?= $i;?>" <? if ( $i == $this -> _year ) echo 'selected="selected"'; ?>><?=$i;?></option>
<? endfor;?>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-5 col-lg-4">
<div class="alert alert-dark light p5">
<small>Stawki podstawowe</small>
</div>
<div class="row">
<div class="col-xs-12">
<div class="panel panel-info panel-border top">
<div class="panel-body p0">
<table class="table table-bordered table-condensed table-striped table-hover">
<thead>
<tr>
<th>Strona</th>
<th class="text-right">Netto</th>
<th class="text-right">Brutto</th>
</tr>
</thead>
<tbody>
<? $client_sum = 0;?>
<? if ( is_array( $this -> _sites ) ): foreach ( $this -> _sites as $site ):?>
<tr>
<td><?= $site['name'];?></td>
<td class="text-right">
<?
$site_sum = 0;
if ( is_array( $site['phrases'] ) ) foreach ( $site['phrases'] as $phrase )
{
$discount = '';
if ( $site['discount'] )
$discount = $site['discount'];
if ( $phrase['discount'] )
$discount = $phrase['discount'];
if ( is_array( $phrase['prices'] ) ) foreach ( $phrase['prices'] as $price )
{
$price_c = \S::number( $price['price'] - \S::number( $price['price'] * $discount / 100 ) );
$site_sum = $site_sum + $price_c * $price['count'];
}
}
$client_sum = $client_sum + $site_sum;
echo \S::number_display( $site_sum );
?>
</td>
<td class="text-right">
<?= \S::number_display( $site_sum * $config['profit']['vat'] );?>
</td>
</tr>
<? endforeach; endif;?>
<tr>
<td class="text-right">Razem:</td>
<td class="alert-dark dark text-right"><?= \S::number_display( $client_sum );?></td>
<td class="alert-dark dark text-right"><?= \S::number_display( $client_sum * $config['profit']['vat'] );?></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-5 col-lg-4">
<div class="alert alert-dark light p5">
<small>Stawki resellera</small>
</div>
<div class="row">
<div class="col-xs-12">
<div class="panel panel-info panel-border top">
<div class="panel-body p0">
<table class="table table-bordered table-condensed table-striped table-hover">
<thead>
<tr>
<th>Strona</th>
<th class="text-right">Netto</th>
<th class="text-right">Brutto</th>
</tr>
</thead>
<tbody>
<?
$client_sum = 0;
if ( is_array( $this -> _sites_res ) ) foreach ( $this -> _sites_res as $site )
{
?>
<tr>
<td><?= $site['name'];?></td>
<td class="text-right">
<?
$site_sum = 0;
if ( is_array( $site['phrases'] ) ) foreach ( $site['phrases'] as $phrase )
{
$discount = '';
if ( $phrase['discount'] )
$discount = $phrase['discount'];
if ( is_array( $phrase['prices'] ) ) foreach ( $phrase['prices'] as $price )
{
$price_c = \S::number( $price['price'] - \S::number( $price['price'] * $discount / 100 ) );
$site_sum = $site_sum + $price_c * $price['count'];
}
}
$client_sum = $client_sum + $site_sum;
echo \S::number_display( $site_sum );
?>
</td>
<td class="text-right">
<?= \S::number_display( $site_sum * $config['profit']['vat'] );?>
</td>
</tr>
<?
}
?>
<tr>
<td class="text-right">Razem:</td>
<td class="alert-dark dark text-right"><?= \S::number_display( $client_sum );?></td>
<td class="alert-dark dark text-right"><?= \S::number_display( $client_sum * $config['profit']['vat'] );?></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$( document ).ready( function() {
$( 'td.position' ).dblclick( function() {
var id = $( this ).attr( 'id' );
$( 'td#' + id ).children( 'span' ).addClass( 'hide' );
$( 'td#' + id ).children( 'input' ).removeClass( 'hide' ).focus();
})
$( '.new-pos' ).blur( function() {
var date = $( this ).parent( 'td' ).attr( 'date' );
var position = $( this ).val();
var phrase_id = $( this ).parent( 'td' ).attr( 'phrase' );
xajax_changePhrasePosition( phrase_id, date, position );
$( this ).addClass( 'hide' );
$( this ).parent( 'td' ).children( 'span' ).html( position ).removeClass( 'hide' );
})
})
</script>

View File

@@ -0,0 +1,60 @@
<div class="panel panel-info panel-border top">
<div class="panel-heading">
<span class="panel-title">Raporty</span>
</div>
<div class="panel-heading p5" style="height: auto;">
<div class="row mb10 pl5">
<div class="col col-xs-12">
<?= \Html::button(
array(
'class' => 'btn btn-sm btn-success',
'text' => 'Generuj raport',
'js' => '$( "#formularz" ).submit(); return false;',
'icon' => 'fa-check-circle mr5'
)
);?>
</div>
</div>
</div>
<div class="panel-body">
<form method="POST" action="/?p=reseller_reports" id="formularz" class="form-horizontal">
<input type="hidden" name="rw" value="create-report" />
<div class="row">
<div class="col col-md-6">
<?= \Html::select(
array(
'name' => 'report-form',
'values' => [
'1' => 'Tylko pozycje',
'2' => 'Pozycje i koszty'
],
'label' => 'Rodzaj raportu'
)
);?>
<div class="form-group">
<label class="col-lg-4 control-label">Przedział czasowy:</label>
<div class="col-lg-8">
od <input type="text" name="date-from" class="form-control date" value="<?= date( 'Y-m' );?>-01" style="width: 170px; text-align: right; display: inline-block;" />
do <input type="text" name="date-to" class="form-control date" value="<?= date( 'Y-m' );?>-<?= date( 't' );?>" style="width: 170px; text-align: right; display: inline-block;" />
</div>
</div>
<div class="form-group">
<label class="col-lg-4 control-label">Strony:</label>
<div class="col-lg-8">
<div class="row">
<? if ( is_array( $this -> _sites ) ): foreach ( $this -> _sites as $site ):?>
<div class="col-xs-6">
<div class="checkbox-custom fill checkbox-primary mt10">
<input id="site_<?= $site['id'];?>" type="checkbox" value="<?= $site['id'];?>" name="sites[]" <? if ( in_array( $site['id'], $this -> _client['sites'] ) ):?>checked="checked"<? endif;?> />
<label for="site_<?= $site['id'];?>"><?= $site['name'];?></label>
</div>
</div>
<? endforeach; endif;?>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>

View File

@@ -0,0 +1,587 @@
<? global $config;?>
<div class="panel panel-info panel-border top">
<div class="panel-heading" style="height: auto; padding-bottom: 4px;">
<div class="row" style="color: #666666;">
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 text-centred-xs text-centred-sm">
<div class="btn-group">
<?= \Html::button(
array(
'class' => 'btn-sm btn-default btn-gradient',
'title' => 'Poprzednia strona',
'url' => '/?p=client_sites&id=' . $this -> _prev_site_id,
'icon' => 'fa-backward'
)
);?>
<?= \Html::button(
array(
'class' => 'btn-sm btn-default btn-gradient',
'title' => 'Następna strona',
'url' => '/?p=client_sites&id=' . $this -> _next_site_id,
'icon' => 'fa-forward'
)
);?>
</div>
<select name="page" class="form-control ranker-select" id="page" onChange="var id = $(this).val(); document.location.href='./?id=' + id;" style='max-width: 250px;'>
<?
if ( is_array ( $this -> _sites ) ) foreach ( $this -> _sites as $site )
{
if ( $this -> _site['id'] == $site['id'] )
$name = $site['name'];
?>
<option value="<?= $site['id'];?>" <? if ( $this -> _site['id'] == $site['id'] ) echo 'selected="selected"';?>>
<?= $site['name'];?>
</option>
<?
}
?>
</select>
</div>
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-2 text-centred-xs hidden-md hidden-xs hidden-sm">
<a href="http://<?= $this -> _site['url'];?>" target="_blank"><?= $this -> _site['url'];?></a>
</div>
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-4 text-centred-xs text-centred-sm text-right">
<select name="month_global" class="form-control ranker-select" id="month_global" onChange="document.location.href='./?p=client_sites&id=<?= $this -> _site['id'];?>&year=' + $( '#year_global' ).val() + '&month=' + $( this ).val();">
<option value="01" <? if ( $this -> _month == '01' ) echo 'selected="selected"'; ?>>Styczeń</option>
<option value="02" <? if ( $this -> _month == '02' ) echo 'selected="selected"'; ?>>Luty</option>
<option value="03" <? if ( $this -> _month == '03' ) echo 'selected="selected"'; ?>>Marzec</option>
<option value="04" <? if ( $this -> _month == '04' ) echo 'selected="selected"'; ?>>Kwiecień</option>
<option value="05" <? if ( $this -> _month == '05' ) echo 'selected="selected"'; ?>>Maj</option>
<option value="06" <? if ( $this -> _month == '06' ) echo 'selected="selected"'; ?>>Czerwiec</option>
<option value="07" <? if ( $this -> _month == '07' ) echo 'selected="selected"'; ?>>Lipiec</option>
<option value="08" <? if ( $this -> _month == '08' ) echo 'selected="selected"'; ?>>Sierpień</option>
<option value="09" <? if ( $this -> _month == '09' ) echo 'selected="selected"'; ?>>Wrzesień</option>
<option value="10" <? if ( $this -> _month == '10' ) echo 'selected="selected"'; ?>>Październik</option>
<option value="11" <? if ( $this -> _month == '11' ) echo 'selected="selected"'; ?>>Listopad</option>
<option value="12" <? if ( $this -> _month == '12' ) echo 'selected="selected"'; ?>>Grudzień</option>
</select>
<select name="year_global" id="year_global" class="form-control ranker-select" onChange="document.location.href='./?p=client_sites&id=<?= $this -> _site['id'];?>&year=' + $( this ).val() + '&month=' + $( '#month_global' ).val();">
<? for ( $i = date( 'Y') - 2; $i <= date( 'Y') + 2; $i++ ):?>
<option value="<?= $i;?>" <? if ( $i == $this -> _year ) echo 'selected="selected"'; ?>><?=$i;?></option>
<? endfor;?>
</select>
</div>
</div>
</div>
</div>
<div class="panel hidden-sm hidden-md hidden-lg">
<div class="panel-body p0">
<div class="row">
<?
if ( is_array( $this -> _phrases ) ) foreach ( $this -> _phrases as $phrase )
{
$phrase_class = '';
if ( new DateTime( $phrase['date_end'] ) < new DateTime( date( 'Y-m-d' ) ) )
$phrase_class = 'text-danger';
if ( $phrase['date_start'] and new DateTime( $phrase['date_start'] ) > new DateTime( date( 'Y-m-d' ) ) )
$phrase_class = 'text-danger';
$pos = $phrase['positions'][ date( 'Y-m-d' ) ]['position'];
if ( $pos <= 10 )
$start = 0;
else
{
$start = 10 * floor( $pos / 10 );
if ( $pos%10 == 0 )
$start = $start - 10;
}
?>
<div class="col-xs-12">
<div style="<? if ( $phrase['color'] ) echo 'border-top: 5px solid ' . $phrase['color'];?>">
<div class="text-left p5" >
<a href="http://www.google.pl/search?q=<?= urlencode( $phrase['phrase'] );?>&num=10&ie=utf8&hl=pl&start=<?= $start;?><? if ( $phrase['localization'] ) echo '&uule=' . \factory\Ranker::uule( $phrase['localization'] );?>" target="_blank" title="<?= $phrase['phrase'];?>" class="<?= $phrase_class;?>">
<?= $phrase['phrase'];?>
</a>
<div class="page-options fr">
<a href="./?rw=edit_phrase&phrase_id=<?= $phrase['id'];?>&id=<?= $this -> _site['id'];?>" class="tip a-icon" title="Edytuj wybraną frazę">
<i class="fa fa-file-text text-dark" style="font-size: 14px; margin: 0 5px;"></i>
</a>
<a href="./?rw=edit_costs_reseller&phrase_id=<?= $phrase['id'];?>&id=<?= $this -> _site['id'];?>" class="tip a-icon" title="Definiuj własne zakresy">
<i class="fa fa-list text-dark" style="font-size: 14px; margin: 0 5px; position: relative; top: 1px;"></i>
</a>
</div>
<a href="<?= $phrase['last_url'];?>" class="text-muted small clearfix" target="_blank" title="<?= $phrase['last_url'];?>">
<?= $phrase['last_url'];?>
</a>
</div>
</div>
</div>
<div class="col-xs-12">
<div class="table-responsive" <? if ( $z++ < 1 ):?>id="positions-xs"<? endif;?>>
<?
$start = date( 'Y-m-d', mktime( 0, 0, 0, $this -> _month, 1, $this -> _year ) );
$days = date( 't', strtotime( $start ) );
?>
<table class="table table-bordered table-striped table-condensed table-hover table-positions">
<thead>
<tr>
<th class="text-center" <? if ( $z < 2 ):?>id="date-xs-<?= date( 'Y-m-d', strtotime( '-1 month', strtotime( $this -> _year . '-' . $this -> _month ) ) );?>"<? endif;?>><?= date( 't', strtotime( '-1 month', strtotime( $this -> _year . '-' . $this -> _month ) ) );?></th>
<? for ( $i = 1; $i <= $days; $i++ ):?>
<th class="text-center" <? if ( $z < 2 ):?>id="date-xs-<?= date( 'Y-m-d', strtotime( $this -> _year . '-' . $this -> _month . '-' . $i ) );?>"<? endif;?>><?= $i;?></th>
<? endfor;?>
</tr>
</thead>
<tbody>
<tr style="height: 45px;">
<?
$date_tmp = date( 'Y-m-t', strtotime( '-1 month', strtotime( $this -> _year . '-' . $this -> _month ) ) );
$pos = $phrase['positions'][ $date_tmp ]['position'];
$map = $phrase['positions'][ $date_tmp ]['map'];
$url = $phrase['positions'][ $date_tmp ]['url'];
$class = 'position';
$text = '';
$end = '';
if ( $pos == 1 )
$class = 'pos_1';
if ( $pos == 2 || $pos == 3 )
$class = 'pos_2';
if ( $pos >= 4 && $pos <= 6 )
$class = 'pos_4';
if ( $pos >= 7 && $pos <= 10 )
$class = 'pos_7';
if ( $pos >= 11 && $pos <= 20 )
$class = 'pos_11';
if ( $pos == 0 || $pos >= 21 )
$class = 'pos_21';
if ( new DateTime( $phrase['date_end'] ) < new DateTime( date( 'Y-m-d' ) ) )
$class = 'end position';
if ( $phrase['date_start'] and new DateTime( $phrase['date_start'] ) > new DateTime( date( 'Y-m-d' ) ) )
$class = 'end position';
if ( $pos != '' )
$pos = $pos;
else
$pos = '-';
?>
<td class="position text-center small <?= $class;?>" id="<?= $phrase['id'] . '-' . $date_tmp;?>" phrase="<?= $phrase['id'];?>" date="<?= $date_tmp;?>" <? if ( $map ):?> style="box-shadow: inset 0 0 10px rgba( 0, 0, 0, 0.4 );"<? endif;?> title="<?= $url;?>">
<span><?= $pos;?></span>
</td>
<? for ( $i = 1; $i <= $days; $i++ ):
$i < 10 ? $d = '0' . $i : $d = $i;
$pos = $phrase['positions'][ $this -> _year . '-' . $this -> _month . '-' . $d ]['position'];
$map = $phrase['positions'][ $this -> _year . '-' . $this -> _month . '-' . $d ]['map'];
$url = $phrase['positions'][ $this -> _year . '-' . $this -> _month . '-' . $d ]['url'];
$class = 'position';
$text = '';
$end = '';
if ( $pos == 1 )
$class = 'pos_1';
if ( $pos == 2 || $pos == 3 )
$class = 'pos_2';
if ( $pos >= 4 && $pos <= 6 )
$class = 'pos_4';
if ( $pos >= 7 && $pos <= 10 )
$class = 'pos_7';
if ( $pos >= 11 && $pos <= 20 )
$class = 'pos_11';
if ( $pos == 0 || $pos >= 21 )
$class = 'pos_21';
if ( new DateTime( $phrase['date_end'] ) < new DateTime( date( 'Y-m-d' ) ) )
$class = 'end position';
if ( $phrase['date_start'] and new DateTime( $phrase['date_start'] ) > new DateTime( date( 'Y-m-d' ) ) )
$class = 'end position';
if ( $pos != '' )
$pos = $pos;
else
$pos = '-';
?>
<td class="position text-center small <?= $class;?>" id="<?= $phrase['id'] . '-' . $this -> _year . '-' . $this -> _month . '-' . $d;?>" phrase="<?= $phrase['id'];?>" date="<?= $this -> _year . '-' . $this -> _month . '-' . $d;?>" <? if ( $map ):?> style="box-shadow: inset 2px 2px 10px rgba( 0, 0, 0, 0.5 );"<? endif;?> title="<?= $url;?>">
<span><?= $pos;?></span>
</td>
<? endfor;?>
</tr>
</tbody>
</table>
</div>
</div>
<?
}
?>
</div>
</div>
</div>
<div class="panel hidden-xs">
<div class="panel-body" style="padding: 0px;">
<div class="row">
<div class="col-sm-5 col-md-4 col-lg-3">
<table class="table table-bordered table-striped table-condensed" id="table-phrases">
<thead>
<tr>
<th class="title">Fraza</th>
</tr>
</thead>
<tbody>
<?
if ( is_array( $this -> _phrases ) ) foreach ( $this -> _phrases as $phrase )
{
$phrase_class = '';
if ( new DateTime( $phrase['date_end'] ) < new DateTime( date( 'Y-m-d' ) ) )
$phrase_class = 'text-danger';
if ( $phrase['date_start'] and new DateTime( $phrase['date_start'] ) > new DateTime( date( 'Y-m-d' ) ) )
$phrase_class = 'text-danger';
$pos = $phrase['positions'][ date( 'Y-m-d' ) ]['position'];
if ( $pos <= 10 )
$start = 0;
else
{
$start = 10 * floor( $pos / 10 );
if ( $pos%10 == 0 )
$start = $start - 10;
}
?>
<tr style="height: 45px;">
<td>
<div class="text-right" >
<a href="http://www.google.pl/search?q=<?= urlencode( $phrase['phrase'] );?>&num=10&ie=utf8&hl=pl&start=<?= $start;?><? if ( $phrase['localization'] ) echo '&uule=' . \factory\Ranker::uule( $phrase['localization'] );?>" target="_blank" title="<?= $phrase['phrase'];?>" class="a-icon <?= $phrase_class;?>">
<?= $phrase['phrase'];?>
</a>
<div class="page-options">
<a href="./?rw=edit_phrase&phrase_id=<?= $phrase['id'];?>&id=<?= $this -> _site['id'];?>" class="tip a-icon" title="Edytuj wybraną frazę">
<i class="fa fa-file-text text-dark" style="font-size: 14px; margin: 0 5px;"></i>
</a>
<a href="./?rw=edit_costs_reseller&phrase_id=<?= $phrase['id'];?>&id=<?= $this -> _site['id'];?>" class="tip a-icon" title="Definiuj własne zakresy">
<i class="fa fa-list text-dark" style="font-size: 14px; margin: 0 5px; position: relative; top: 1px;"></i>
</a>
</div>
<a href="<?= $phrase['last_url'];?>" class="text-muted small clearfix phrase_url" target="_blank" title="<?= $phrase['last_url'];?>">
<?= $phrase['last_url'];?>
</a>
</div>
</td>
</tr>
<?
}
?>
</tbody>
</table>
</div>
<div class="col-sm-7 col-md-8 col-lg-9">
<div class="table-responsive" id="positions-not-xs">
<?
$start = date( 'Y-m-d', mktime( 0, 0, 0, $this -> _month, 1, $this -> _year ) );
$days = date( 't', strtotime( $start ) );
?>
<table class="table table-bordered table-striped table-condensed table-hover table-positions">
<thead>
<tr>
<th class="text-center" id="date-<?= date( 'Y-m-t', strtotime( '-1 month', strtotime( $this -> _year . '-' . $this -> _month ) ) );?>"><?= date( 't', strtotime( '-1 month', strtotime( $this -> _year . '-' . $this -> _month ) ) );?></th>
<? for ( $i = 1; $i <= $days; $i++ ):?>
<th class="text-center" id="date-<?= date( 'Y-m-d', strtotime( $this -> _year . '-' . $this -> _month . '-' . $i ) );?>"><?= $i;?></th>
<? endfor;?>
</tr>
</thead>
<tbody>
<? if ( is_array( $this -> _phrases ) ):?>
<? foreach ( $this -> _phrases as $phrase ):?>
<tr style="height: 45px;">
<?
$date_tmp = date( 'Y-m-t', strtotime( '-1 month', strtotime( $this -> _year . '-' . $this -> _month ) ) );
$pos = $phrase['positions'][ $date_tmp ]['position'];
$map = $phrase['positions'][ $date_tmp ]['map'];
$url = $phrase['positions'][ $date_tmp ]['url'];
$class = 'position';
$text = '';
$end = '';
if ( $pos == 1 )
$class = 'pos_1';
if ( $pos == 2 || $pos == 3 )
$class = 'pos_2';
if ( $pos >= 4 && $pos <= 6 )
$class = 'pos_4';
if ( $pos >= 7 && $pos <= 10 )
$class = 'pos_7';
if ( $pos >= 11 && $pos <= 20 )
$class = 'pos_11';
if ( $pos == 0 || $pos >= 21 )
$class = 'pos_21';
if ( new DateTime( $phrase['date_end'] ) < new DateTime( date( 'Y-m-d' ) ) )
$class = 'end position';
if ( $pos != '' )
$pos = $pos;
else
$pos = '-';
?>
<td class="position text-center small <?= $class;?>" id="<?= $phrase['id'] . '-' . $date_tmp;?>" phrase="<?= $phrase['id'];?>" date="<?= $date_tmp;?>" <? if ( $map ):?> style="box-shadow: inset 0 0 10px rgba( 0, 0, 0, 0.4 );"<? endif;?> title="<?= $url;?>">
<span><?= $pos;?></span>
</td>
<? for ( $i = 1; $i <= $days; $i++ ):
$i < 10 ? $d = '0' . $i : $d = $i;
$pos = $phrase['positions'][ $this -> _year . '-' . $this -> _month . '-' . $d ]['position'];
$map = $phrase['positions'][ $this -> _year . '-' . $this -> _month . '-' . $d ]['map'];
$url = $phrase['positions'][ $this -> _year . '-' . $this -> _month . '-' . $d ]['url'];
$class = 'position';
$text = '';
$end = '';
if ( $pos == 1 )
$class = 'pos_1';
if ( $pos == 2 || $pos == 3 )
$class = 'pos_2';
if ( $pos >= 4 && $pos <= 6 )
$class = 'pos_4';
if ( $pos >= 7 && $pos <= 10 )
$class = 'pos_7';
if ( $pos >= 11 && $pos <= 20 )
$class = 'pos_11';
if ( $pos == 0 || $pos >= 21 )
$class = 'pos_21';
if ( new DateTime( $phrase['date_end'] ) < new DateTime( date( 'Y-m-d' ) ) )
$class = 'end position';
if ( $pos != '' )
$pos = $pos;
else
$pos = '-';
?>
<td class="position text-center small <?= $class;?>" id="<?= $phrase['id'] . '-' . $this -> _year . '-' . $this -> _month . '-' . $d;?>" phrase="<?= $phrase['id'];?>" date="<?= $this -> _year . '-' . $this -> _month . '-' . $d;?>" <? if ( $map ):?> style="box-shadow: inset 2px 2px 10px rgba( 0, 0, 0, 0.5 );"<? endif;?> title="<?= $url;?>">
<span><?= $pos;?></span>
</td>
<? endfor;?>
</tr>
<? endforeach;?>
<? endif;?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<? if ( is_array( $this -> _phrases ) ):?>
<div class="alert alert-dark light p5">
<small>Stawki podstawowe</small>
</div>
<div class="row">
<?
$suma = 0;
foreach ( $this -> _phrases as $phrase )
{
$discount = '';
if ( $this -> _site['discount'] > 0 )
$discount = $this -> _site['discount'];
if ( $phrase['discount'] > 0 )
$discount = $phrase['discount'];
if ( is_array( $phrase['prices'] ) )
{
?>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
<div class="panel panel-primary">
<div class="panel-heading small">
<small><?= $phrase['phrase'];?> <? if ( $discount > 0 ):?><span class="fr">rabat <?= $discount;?>%</span><? endif;?></small>
</div>
<div class="panel-body p0">
<?
if ( is_array( $phrase['prices'] ) )
{
$sum = 0;
?>
<table class="table table-condensed table-bordered table-striped">
<thead>
<tr>
<td class="text-right">Przedział</td>
<td class="text-right">Stawka</td>
<td class="text-right">Ilość dni</td>
<td class="text-right">Należność</td>
</tr>
</thead>
<tbody>
<?
foreach ( $phrase['prices'] as $price )
{
$price_c = \S::number( $price['price'] - \S::number( $price['price'] * $discount / 100 ) );
?>
<tr <? if ( !$price['count'] ):?> style="background: #efefef;"<? endif;?>>
<td class="text-right">
<?= $price['start'];?> - <?= $price['end'];?>
</td>
<td class="text-right">
<?= \S::number_display( $price_c );?>
</td>
<td class="text-right">
<?= $price['count'];?>
</td>
<td class="text-right">
<?= \S::number_display( $price_c * $price['count'] );?>
</td>
</tr>
<?
$sum = $sum + $price_c * $price['count'];
$suma = $suma + $price_c * $price['count'];
}
?>
<tr>
<td colspan="3" class="text-right">Suma:</td>
<td class="alert-dark dark text-right"><?= \S::number_display( $sum );?></td>
</tr>
</tbody>
</table>
<?
}
?>
</div>
</div>
</div>
<?
}
}
?>
</div>
<div class="row">
<? if ( $suma ):?>
<div class="col-md-3">
<div class="panel panel-dark">
<div class="panel-heading small">
<small>Razem netto: <?= \S::number_display( $suma );?></small>
</div>
</div>
</div>
<div class="col-md-3">
<div class="panel panel-dark">
<div class="panel-heading small">
<small>Razem brutto: <?= \S::number_display( $suma * $config['profit']['vat'] );?></small>
</div>
</div>
</div>
<? endif;?>
</div>
<div class="alert alert-dark light p5">
<small>Stawki resellera</small>
</div>
<div class="row">
<?
$suma = 0;
if ( is_array( $this -> _phrases_reseller ) ) foreach ( $this -> _phrases_reseller as $phrase )
{
$discount = '';
if ( $phrase['discount'] )
$discount = $phrase['discount'];
if ( is_array( $phrase['prices'] ) )
{
?>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
<div class="panel panel-primary">
<div class="panel-heading small">
<small><?= $phrase['phrase'];?> <? if ( $discount > 0 ):?><span class="text-dark">(rabat <?= $discount;?>%)</span><? endif;?></small>
</div>
<div class="panel-body p0">
<?
if ( is_array( $phrase['prices'] ) )
{
$sum = 0;
?>
<table class="table table-condensed table-bordered table-striped">
<thead>
<tr>
<td class="text-right">Przedział</td>
<td class="text-right">Stawka</td>
<td class="text-right">Ilość dni</td>
<td class="text-right">Należność</td>
</tr>
</thead>
<tbody>
<?
foreach ( $phrase['prices'] as $price )
{
$price_c = \S::number( $price['price'] - \S::number( $price['price'] * $discount / 100 ) );
?>
<tr <? if ( !$price['count'] ):?> style="background: #efefef;"<? endif;?>>
<td class="text-right">
<?= $price['start'];?> - <?= $price['end'];?>
</td>
<td class="text-right">
<?= \S::number_display( $price_c );?>
</td>
<td class="text-right">
<?= $price['count'];?>
</td>
<td class="text-right">
<?= \S::number_display( $price_c * $price['count'] );?>
</td>
</tr>
<?
$sum = $sum + $price_c * $price['count'];
$suma = $suma + $price_c * $price['count'];
}
?>
<tr>
<td colspan="3" class="text-right">Suma:</td>
<td class="alert-dark dark text-right"><?= \S::number_display( $sum );?></td>
</tr>
</tbody>
</table>
<?
}
?>
</div>
</div>
</div>
<?
}
}
?>
</div>
<div class="row">
<? if ( $suma ):?>
<div class="col-md-3">
<div class="panel panel-dark">
<div class="panel-heading small">
<small>Razem netto: <?= \S::number_display( $suma );?></small>
</div>
</div>
</div>
<div class="col-md-3">
<div class="panel panel-dark">
<div class="panel-heading small">
<small>Razem brutto: <?= \S::number_display( $suma * $config['profit']['vat'] );?></small>
</div>
</div>
</div>
<? endif;?>
</div>
<? endif;?>
<script type="text/javascript">
$( document ).ready( function()
{
if ( $( '#positions-not-xs' ).hasScrollBar() === true )
{
$( '#positions-not-xs' ).animate( { scrollLeft: $( '#date-<?= date( 'Y-m-d' );?>' ).position().left - 50 }, 500);
}
if ( $( '#positions-xs' ).hasScrollBar() === true )
{
$( '.hidden-sm .table-responsive' ).animate( { scrollLeft: $( '#date-xs-<?= date( 'Y-m-d' );?>' ).position().left - 50 }, 500);
}
$( '.phrase_url' ).css( 'width', $( '#table-phrases tr:first-child td:first-child' ).width() + 'px' ).css( 'display', 'block' );
});
</script>