diff --git a/plugins/rainlab/user/Plugin.php b/plugins/rainlab/user/Plugin.php index b781a6274..cbce1a461 100644 --- a/plugins/rainlab/user/Plugin.php +++ b/plugins/rainlab/user/Plugin.php @@ -2,6 +2,7 @@ use App; use Auth; +use Carbon\Carbon; use Event; use Backend; use System\Classes\PluginBase; diff --git a/plugins/tps/birzha/Plugin.php b/plugins/tps/birzha/Plugin.php index f7ab94cfd..ffb580a6f 100644 --- a/plugins/tps/birzha/Plugin.php +++ b/plugins/tps/birzha/Plugin.php @@ -37,6 +37,40 @@ class Plugin extends PluginBase { $this->registerConsoleCommand('birzha:databasebackup', DatabaseBackUp::class); } + public function registerListColumnTypes() + { + return [ + // A local method, i.e $this->evalUppercaseListColumn() + 'status' => [$this, 'statusListColumn'], + 'vendor' => [$this, 'vendorLinkListColumn'], + 'user' => [$this, 'userLinkListColumn'], + + ]; + } + + public function userLinkListColumn($value, $column, $record){ + return ''.$value.''; + } + + public function vendorLinkListColumn($value, $column, $record){ + return ''.$value.''; + } + + public function statusListColumn($value, $column, $record) + { + switch ($value){ + case 'draft' : return ''.$value.''; + case 'bank' : return ''.$value.''; + case 'online' : return ''.$value.''; + case 'approved' : return ''.$value.''; + case 'payed' : return ''.$value.''; + case 'new' : return ''.$value.''; + case 'denied' : return ''.$value.''; + case 'disabled' : return ''.$value.''; + default : return $value; + } + + } public function registerSchedule($schedule) { @@ -88,9 +122,9 @@ class Plugin extends PluginBase $controller = \Cms\Classes\Controller::getController() ?? new \Cms\Classes\Controller(); // Search your plugin's contents - + $locale = Session::get('rainlab.translate.locale'); - + if($locale == 'tm') { // user enters product name $items = Models\Product @@ -100,7 +134,7 @@ class Plugin extends PluginBase ->get(); } else { $queryString = $query; - + // user enters product name $items = Models\Product::whereHas('translations', function ($query) use ($locale,$queryString) { $query->where('locale', $locale)->where('attribute_data', 'like', "%${queryString}%"); @@ -109,8 +143,8 @@ class Plugin extends PluginBase ->where('ends_at','>=',\DB::raw('curdate()'))->orderBy('updated_at', 'desc') ->get(); } - - + + // show all offers that have that product // $items = collect(new Offer); // foreach($products as $p) { diff --git a/plugins/tps/birzha/controllers/Payments.php b/plugins/tps/birzha/controllers/Payments.php index 84ca53503..e3f33f56c 100644 --- a/plugins/tps/birzha/controllers/Payments.php +++ b/plugins/tps/birzha/controllers/Payments.php @@ -3,6 +3,7 @@ use Backend\Classes\Controller; use BackendMenu; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Log; use TPS\Birzha\Models\Payment; class Payments extends Controller @@ -47,5 +48,12 @@ class Payments extends Controller ?? 0; } + public function onApprove(){ + Log::info('test approve'); + } + + public function onDecline(){ + Log::info('test approve'); + } //todo amount funksia yazmaly } diff --git a/plugins/tps/birzha/controllers/payments/update.htm b/plugins/tps/birzha/controllers/payments/update.htm index ac8bb7496..29cf24e84 100644 --- a/plugins/tps/birzha/controllers/payments/update.htm +++ b/plugins/tps/birzha/controllers/payments/update.htm @@ -2,9 +2,62 @@