| @@ 13-49 (lines=37) @@ | ||
| 10 | ||
| 11 | namespace Money; |
|
| 12 | ||
| 13 | class CancelTransfer extends \Ui\DataManager\Action |
|
| 14 | { |
|
| 15 | public static $name = 'Отменить'; |
|
| 16 | public static $groupAction = true; |
|
| 17 | public static $rowAction = true; |
|
| 18 | ||
| 19 | public static function rowButton($dataManager, $item, $params) |
|
| 20 | { |
|
| 21 | if ($item->canceled || $item->complete) { |
|
| 22 | return ''; |
|
| 23 | } |
|
| 24 | ob_start(); |
|
| 25 | ?> |
|
| 26 | <a onclick="inji.Server.request({ |
|
| 27 | url: '/admin/money/cancelTransfer/<?= $item->id; ?>', |
|
| 28 | success: function () { |
|
| 29 | inji.Ui.dataManagers.reloadAll(); |
|
| 30 | }}); |
|
| 31 | return false; |
|
| 32 | " href ='#' class="btn btn-xs btn-primary">Отменить</a> |
|
| 33 | <?php |
|
| 34 | $btn = ob_get_contents(); |
|
| 35 | ob_end_clean(); |
|
| 36 | return $btn; |
|
| 37 | } |
|
| 38 | ||
| 39 | public static function groupAction($dataManager, $ids, $actionParams) |
|
| 40 | { |
|
| 41 | $transfers = \Money\Transfer::getList(['where' => [['id', $ids, 'IN'], ['canceled', 0], ['complete', 0]]]); |
|
| 42 | foreach ($transfers as $transfer) { |
|
| 43 | $transfer->cancel(); |
|
| 44 | } |
|
| 45 | $count = count($transfers); |
|
| 46 | return 'Отменено <b>' . $count . '</b> ' . \Tools::getNumEnding($count, ['перевод', 'перевода', 'переводов']); |
|
| 47 | } |
|
| 48 | ||
| 49 | } |
|
| 50 | ||
| @@ 13-49 (lines=37) @@ | ||
| 10 | ||
| 11 | namespace Money; |
|
| 12 | ||
| 13 | class CompleteTransfer extends \Ui\DataManager\Action |
|
| 14 | { |
|
| 15 | public static $name = 'Завершить'; |
|
| 16 | public static $groupAction = true; |
|
| 17 | public static $rowAction = true; |
|
| 18 | ||
| 19 | public static function rowButton($dataManager, $item, $params) |
|
| 20 | { |
|
| 21 | if ($item->canceled || $item->complete) { |
|
| 22 | return ''; |
|
| 23 | } |
|
| 24 | ob_start(); |
|
| 25 | ?> |
|
| 26 | <a onclick="inji.Server.request({ |
|
| 27 | url: '/admin/money/completeTransfer/<?= $item->id; ?>', |
|
| 28 | success: function () { |
|
| 29 | inji.Ui.dataManagers.reloadAll(); |
|
| 30 | }}); |
|
| 31 | return false; |
|
| 32 | " href ='#' class="btn btn-xs btn-primary">Завершить</a> |
|
| 33 | <?php |
|
| 34 | $btn = ob_get_contents(); |
|
| 35 | ob_end_clean(); |
|
| 36 | return $btn; |
|
| 37 | } |
|
| 38 | ||
| 39 | public static function groupAction($dataManager, $ids, $actionParams) |
|
| 40 | { |
|
| 41 | $transfers = \Money\Transfer::getList(['where' => [['id', $ids, 'IN'], ['canceled', 0], ['complete', 0]]]); |
|
| 42 | foreach ($transfers as $transfer) { |
|
| 43 | $transfer->confirm(); |
|
| 44 | } |
|
| 45 | $count = count($transfers); |
|
| 46 | return 'Завершено <b>' . $count . '</b> ' . \Tools::getNumEnding($count, ['перевод', 'перевода', 'переводов']); |
|
| 47 | } |
|
| 48 | ||
| 49 | } |
|
| 50 | ||