DragonSkills99 5 lat temu
rodzic
commit
9a3e445888
33 zmienionych plików z 108 dodań i 5 usunięć
  1. 33
    5
      Plugin.php
  2. 2
    0
      mithril/components/Account.component.d.ts
  3. 2
    0
      mithril/components/Account.component.js
  4. 3
    0
      mithril/components/Account.component.ts
  5. 4
    0
      mithril/components/Account.template.html
  6. 2
    0
      mithril/components/AccountList.component.d.ts
  7. 2
    0
      mithril/components/AccountList.component.js
  8. 3
    0
      mithril/components/AccountList.component.ts
  9. 17
    0
      mithril/components/AccountList.template.html
  10. 0
    0
      mithril/components/AlterAccount.component.d.ts
  11. 0
    0
      mithril/components/AlterAccount.component.js
  12. 0
    0
      mithril/components/AlterAccount.component.ts
  13. 40
    0
      mithril/components/AlterAccount.template.html
  14. 0
    0
      mithril/components/GrantUser.component.d.ts
  15. 0
    0
      mithril/components/GrantUser.component.js
  16. 0
    0
      mithril/components/GrantUser.component.ts
  17. 0
    0
      mithril/components/GrantUser.template.html
  18. 0
    0
      mithril/components/Settings.component.d.ts
  19. 0
    0
      mithril/components/Settings.component.js
  20. 0
    0
      mithril/components/Settings.component.ts
  21. 0
    0
      mithril/components/Settings.template.html
  22. 0
    0
      mithril/components/SettingsList.component.d.ts
  23. 0
    0
      mithril/components/SettingsList.component.js
  24. 0
    0
      mithril/components/SettingsList.component.ts
  25. 0
    0
      mithril/components/SettingsList.template.html
  26. 0
    0
      mithril/components/Users.component.d.ts
  27. 0
    0
      mithril/components/Users.component.js
  28. 0
    0
      mithril/components/Users.component.ts
  29. 0
    0
      mithril/components/Users.template.html
  30. 0
    0
      mithril/components/UsersList.component.d.ts
  31. 0
    0
      mithril/components/UsersList.component.js
  32. 0
    0
      mithril/components/UsersList.component.ts
  33. 0
    0
      mithril/components/UsersList.template.html

+ 33
- 5
Plugin.php Wyświetl plik

@@ -54,11 +54,7 @@ class MinecraftPaymentPlugin extends Plugin {
$this->show_template( 'GrantUser', $params );
}

public function settle_view( string $url ) {
$m = array_key_exists( 'month', $_GET ) ? $_GET[ 'month' ] : date( 'm' ) - 1;
$y = array_key_exists( 'month', $_GET ) ? $_GET[ 'month' ] : date( 'Y' );
if ( $m == '0' ) { $m = '12'; $y--; }

private function settle( $m, $y ) {
$mp = MinecraftMonthPaid::GetByUnique( 0, $m ,$y );
if ( $mp ) {
echo __( [ 'de' => 'Bereits abgerechnet', 'en' => 'Already settled' ] );
@@ -123,6 +119,38 @@ class MinecraftPaymentPlugin extends Plugin {
}
}

public function settle_view( string $url ) {
// ORDER BY Year DESC, Month DESC LIMIT 1

$nwst = MinecraftMonthPaid::GetAll( "1 ORDER BY Year DESC, Month DESC LIMIT 1" )[ 0 ];
if ( !$nwst ) {
$nwst = new MinecraftMonthPaid();
$nwst->SetMonth( date( 'm' ) );
$nwst->SetYear( date( 'Y' ) );
}

$m = array_key_exists( 'month', $_GET ) ? $_GET[ 'month' ] + 1 : date( 'm' );
$y = array_key_exists( 'year', $_GET ) ? $_GET[ 'year' ] : date( 'Y' );
if ( $m == '0' ) { $m = '12'; $y--; }

$start = ( new DateTime( $nwst->GetYear() . '-' . $nwst->GetMonth() . '-' . '01' ) )->modify( 'first day of next month' );
$end = ( new DateTime( date( "$y-$m-01" ) ) )->modify( 'first day of this month' );
$interval = DateInterval::createFromDateString( '1 month' );
$period = new DatePeriod( $start, $interval, $end );

$settled = false;
foreach ($period as $dt) {
$settled = true;
echo 'Settling ' . $dt->format("Y-m") . ': ';
$this->settle( $dt->format( 'm' ), $dt->format( 'Y' ) );
echo "<br>\n";
}

if( !$settled ) {
echo 'Nothing to settle';
}
}

public function acredit_view( string $url ) {
if ( !Permission::PERMITTED( 'Minecraft-Pay-Settings', 1 ) ) return;
$params = null;

+ 2
- 0
mithril/components/Account.component.d.ts Wyświetl plik

@@ -0,0 +1,2 @@
declare class Account {
}

+ 2
- 0
mithril/components/Account.component.js Wyświetl plik

@@ -0,0 +1,2 @@
class Account {
}

+ 3
- 0
mithril/components/Account.component.ts Wyświetl plik

@@ -0,0 +1,3 @@
class Account {
}

+ 4
- 0
mithril/components/Account.template.html Wyświetl plik

@@ -0,0 +1,4 @@
<meta log-in />
<div style="width: 100%; text-align: right; border: 1px solid white; border-radius: 1rem; padding: 1rem; margin: 1rem 0; box-sizing: border-box;">
<span>Account: <a dval-innerText="MinecraftUserAccount::ACCOUNT() + ' &euro;'"></a></span>
</div>

+ 2
- 0
mithril/components/AccountList.component.d.ts Wyświetl plik

@@ -0,0 +1,2 @@
declare class AccountList {
}

+ 2
- 0
mithril/components/AccountList.component.js Wyświetl plik

@@ -0,0 +1,2 @@
class AccountList {
}

+ 3
- 0
mithril/components/AccountList.component.ts Wyświetl plik

@@ -0,0 +1,3 @@
class AccountList {
}

+ 17
- 0
mithril/components/AccountList.template.html Wyświetl plik

@@ -0,0 +1,17 @@
<meta log-in permission="Minecraft-Possess-User" />
<table class="table">
<thead>
<tr>
<th dval-innerText="__( [ 'Date' )"></th>
<th style="width: 100%;" dval-innerText="__( 'Comment' )"></th>
<th dval-innerText="__( 'Amount' )"></th>
</tr>
</thead>
<tbody>
<tr dyn-for="[ 'credit', 'MinecraftUserAccount::GetAll( [ \'DebtorID\' => User::CURRENT()->ID ] )' ]">
<td dval-innerText="credit.GetOccurence()"></td>
<td dval-innerText="credit.GetComment()"></td>
<td style="text-align: right;" dval-innerText="credit.GetMod() + '&nbsp;&euro;'"></td>
</tr>
</tbody>
</table>

+ 0
- 0
mithril/components/AlterAccount.component.d.ts Wyświetl plik


+ 0
- 0
mithril/components/AlterAccount.component.js Wyświetl plik


+ 0
- 0
mithril/components/AlterAccount.component.ts Wyświetl plik


+ 40
- 0
mithril/components/AlterAccount.template.html Wyświetl plik

@@ -0,0 +1,40 @@
<meta log-in permission="Minecraft-Pay-Settings" />
<div dyn-if="isset( $save_message )">
<div dyn-type="alert" eval-value="$save_message" eval-type="$save_success ? ALERT_SUCCESS : ALERT_DANGER"></div>
</div>
<form method="POST">
<table>
<thead>
<tr>
<th innerText="Minecraft Payment" colspan="2"></th>
</tr>
</thead>
<tbody>
<tr>
<th eval-innerText="__([ 'de' => 'Benutzer', 'en' => 'User' ])"></th>
<td>
<select name="DebtorID">
<div dyn-for="[ 'user', 'User::GetAll()' ]"><option eval-value="$user->GetID()" eval-innerText="$user->GetUsername()"></option></div>
</select>
</td>
</tr>
<tr>
<th eval-innerText="__([ 'de' => 'Menge', 'en' => 'Amount' ])"></th>
<td>
<input type="number" step="0.01" name="Mod" value="0.00" />
</td>
</tr>
<tr>
<th eval-innerText="__([ 'de' => 'Kommentar', 'en' => 'Comment' ])"></th>
<td>
<input type="string" name="Comment" />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="AddAccountChange" eval-value="__([ 'de' => 'Gutschreiben', 'en' => 'Credit' ])" />
</td>
</tr>
</tbody>
</table>
</form>

+ 0
- 0
mithril/components/GrantUser.component.d.ts Wyświetl plik


+ 0
- 0
mithril/components/GrantUser.component.js Wyświetl plik


+ 0
- 0
mithril/components/GrantUser.component.ts Wyświetl plik


+ 0
- 0
mithril/components/GrantUser.template.html Wyświetl plik


+ 0
- 0
mithril/components/Settings.component.d.ts Wyświetl plik


+ 0
- 0
mithril/components/Settings.component.js Wyświetl plik


+ 0
- 0
mithril/components/Settings.component.ts Wyświetl plik


+ 0
- 0
mithril/components/Settings.template.html Wyświetl plik


+ 0
- 0
mithril/components/SettingsList.component.d.ts Wyświetl plik


+ 0
- 0
mithril/components/SettingsList.component.js Wyświetl plik


+ 0
- 0
mithril/components/SettingsList.component.ts Wyświetl plik


+ 0
- 0
mithril/components/SettingsList.template.html Wyświetl plik


+ 0
- 0
mithril/components/Users.component.d.ts Wyświetl plik


+ 0
- 0
mithril/components/Users.component.js Wyświetl plik


+ 0
- 0
mithril/components/Users.component.ts Wyświetl plik


+ 0
- 0
mithril/components/Users.template.html Wyświetl plik


+ 0
- 0
mithril/components/UsersList.component.d.ts Wyświetl plik


+ 0
- 0
mithril/components/UsersList.component.js Wyświetl plik


+ 0
- 0
mithril/components/UsersList.component.ts Wyświetl plik


+ 0
- 0
mithril/components/UsersList.template.html Wyświetl plik


Ładowanie…
Anuluj
Zapisz