Merge branch 'fix-kemaskini-harga-emas' into 'main'
Fix kemaskini harga emas See merge request online-sistem1/lelong!405
This commit is contained in:
@@ -50,6 +50,7 @@ use App\Models\Tetapan;
|
||||
use App\Models\TransaksiKeuntungan;
|
||||
use DateTime;
|
||||
// use Nexmo\Laravel\Facade\Nexmo;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class LelongController extends Controller
|
||||
{
|
||||
@@ -944,6 +945,141 @@ class LelongController extends Controller
|
||||
->with('success','Kemaskini Berjaya');
|
||||
}
|
||||
|
||||
public function kemaskini2(Request $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
$currentNow = Carbon::now();
|
||||
|
||||
$lel_karats = LelKarat::where('lelong_id', $request->idlelong)->get();
|
||||
|
||||
$insert_harga2 = $request->harga2;
|
||||
|
||||
$lelkarat_temp_arr = [];
|
||||
$cases = '';
|
||||
|
||||
foreach ($lel_karats as $index => $lel_karat) {
|
||||
if ($insert_harga2[$index]) {
|
||||
$lel_karats[$index]['harga_baru'] = $insert_harga2[$index];
|
||||
}
|
||||
$lel_karat_temp_to_be_inserted = [
|
||||
'lelong_id' => $request->idlelong,
|
||||
'karat' => $lel_karat->karat,
|
||||
'keterangan' => $lel_karat->keterangan,
|
||||
'harga' => $lel_karat->harga,
|
||||
'harga2' => $lel_karat->harga2,
|
||||
'created_at' => $currentNow,
|
||||
'updated_at' => $currentNow,
|
||||
];
|
||||
|
||||
array_push($lelkarat_temp_arr, $lel_karat_temp_to_be_inserted);
|
||||
|
||||
$cases .= sprintf(' WHEN id = %d THEN %s ', $lel_karat->id, $lel_karat->harga_baru);
|
||||
}
|
||||
|
||||
$build_query = sprintf("CASE %s END", $cases);
|
||||
|
||||
LelKarat_temp::insert($lelkarat_temp_arr);
|
||||
|
||||
LelKarat::query()->where('lelong_id', $request->idlelong)->update(['harga2' => DB::raw($build_query)]);
|
||||
|
||||
Lelong::find($request->idlelong)->update(['harga_emas_asas' => $request->harga2[3]]);
|
||||
|
||||
$new_lel_karat = LelKarat::where('lelong_id', $request->idlelong)->select('lelong_id', 'karat', 'harga2')->get()->keyBy('karat');
|
||||
|
||||
$lelong_bid = LelongBid::with('lelongBidMarhun')->where('lelong_id', $request->idlelong)->select('id', 'kodcaw', 'norujukan')->get();
|
||||
|
||||
/** -------------UPDATE LELONG BID MARHUN------------- */
|
||||
$list_lelong_bid_marhun = collect();
|
||||
foreach($lelong_bid->keyBy('norujukan') as $index90 => $item)
|
||||
{
|
||||
foreach($item->lelongBidMarhun as $index55 => $lel_bid_marhun_collect)
|
||||
{
|
||||
$item->lelongBidMarhun[$index55]['norujukan'] = $index90;
|
||||
}
|
||||
$list_lelong_bid_marhun = $list_lelong_bid_marhun->concat($item->lelongBidMarhun);
|
||||
}
|
||||
|
||||
$cases_update_harga = '';
|
||||
$cases_update_n_marhun = '';
|
||||
$cases_update_hargaasas = '';
|
||||
|
||||
foreach($list_lelong_bid_marhun as $index => $marhun)
|
||||
{
|
||||
if ($new_lel_karat[$marhun->karat])
|
||||
{
|
||||
|
||||
$harga_to_be_inserted = $new_lel_karat[$marhun->karat]->harga2;
|
||||
$n_marhun_to_be_inserted = $marhun->berat * $new_lel_karat[$marhun->karat]->harga2;
|
||||
$harga_asas_to_be_inserted = round($marhun->berat * $new_lel_karat[$marhun->karat]->harga2);
|
||||
|
||||
$list_lelong_bid_marhun[$index]['new_n_marhun'] = $n_marhun_to_be_inserted;
|
||||
$list_lelong_bid_marhun[$index]['new_hargaasas'] = $harga_asas_to_be_inserted;
|
||||
|
||||
$cases_update_harga .= sprintf(' WHEN id = %d THEN %s ', $marhun->id, $harga_to_be_inserted);
|
||||
$cases_update_n_marhun .= sprintf(' WHEN id = %d THEN %s ', $marhun->id, $n_marhun_to_be_inserted);
|
||||
$cases_update_hargaasas .= sprintf(' WHEN id = %d THEN %s ', $marhun->id, $harga_asas_to_be_inserted);
|
||||
}
|
||||
|
||||
}
|
||||
$build_query_update_harga = sprintf("CASE %s END", $cases_update_harga);
|
||||
$build_query_update_n_marhun = sprintf("CASE %s END", $cases_update_n_marhun);
|
||||
$build_query_update_hargaasas = sprintf("CASE %s END", $cases_update_hargaasas);
|
||||
|
||||
LelongBidMarhun::query()
|
||||
->update([
|
||||
'harga' => DB::raw($build_query_update_harga),
|
||||
'n_marhun' => DB::raw($build_query_update_n_marhun),
|
||||
'hargaasas' => DB::raw($build_query_update_hargaasas)
|
||||
]);
|
||||
|
||||
/** -------------UPDATE LELONG BID------------- */
|
||||
$list_lelong_bid_marhun_updated = $list_lelong_bid_marhun->groupBy('lelongbid_id');
|
||||
$collection_lelong_bid_marhun_updated = collect();
|
||||
|
||||
foreach($list_lelong_bid_marhun_updated as $index2 => $lelong_bid_updated)
|
||||
{
|
||||
$array_to_be_inserted = [];
|
||||
$array_to_be_inserted['id'] = $index2;
|
||||
$array_to_be_inserted['norujukan'] = $lelong_bid_updated[0]->norujukan;
|
||||
$array_to_be_inserted['total_n_marhun'] = $lelong_bid_updated->sum('new_n_marhun');
|
||||
$array_to_be_inserted['total_hargaasas'] = $lelong_bid_updated->sum('new_hargaasas');
|
||||
$collection_lelong_bid_marhun_updated = $collection_lelong_bid_marhun_updated->push($array_to_be_inserted);
|
||||
}
|
||||
|
||||
$cases_update_n_marhuns_lelong_bid = '';
|
||||
$cases_update_hargaasas_lelong_bid = '';
|
||||
$log_user_array = [];
|
||||
|
||||
foreach($collection_lelong_bid_marhun_updated as $collection_lelong_bid)
|
||||
{
|
||||
$log_user_array_to_be_inserted = [
|
||||
"user_id" => $user->id,
|
||||
"date" => $currentNow->toDateTimeString(),
|
||||
"username" => $user->username,
|
||||
"nama_user" => $user->name,
|
||||
"norujukan" => $collection_lelong_bid['norujukan'],
|
||||
"nota" => "Kemaskini Harga Asas RM" . $collection_lelong_bid['total_hargaasas'],
|
||||
];
|
||||
array_push($log_user_array, $log_user_array_to_be_inserted);
|
||||
$cases_update_n_marhuns_lelong_bid .= sprintf(' WHEN id = %d THEN %s ', $collection_lelong_bid['id'], $collection_lelong_bid['total_n_marhun']);
|
||||
$cases_update_hargaasas_lelong_bid .= sprintf(' WHEN id = %d THEN %s ', $collection_lelong_bid['id'], $collection_lelong_bid['total_hargaasas']);
|
||||
}
|
||||
|
||||
$build_query_update_nmarhuns_lelong_bid = sprintf("CASE %s END", $cases_update_n_marhuns_lelong_bid);
|
||||
$build_query_update_hargaasas_lelong_bid = sprintf("CASE %s END", $cases_update_hargaasas_lelong_bid);
|
||||
|
||||
LelongBid::query()
|
||||
->update([
|
||||
'nmarhuns' => DB::raw($build_query_update_nmarhuns_lelong_bid),
|
||||
'hargaasas' => DB::raw($build_query_update_hargaasas_lelong_bid),
|
||||
]);
|
||||
|
||||
LogUser::insert($log_user_array);
|
||||
|
||||
return redirect()->route('lelong.show',$request->idlelong)->with('success','Kemaskini Berjaya');
|
||||
}
|
||||
|
||||
public function janapemenang($id){
|
||||
|
||||
$current = Carbon::now();
|
||||
|
||||
@@ -16,7 +16,9 @@ class LelKarat_temp extends Model
|
||||
'karat',
|
||||
'keterangan',
|
||||
'harga',
|
||||
'harga2'
|
||||
'harga2',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Laravel\Telescope\IncomingEntry;
|
||||
use Laravel\Telescope\Telescope;
|
||||
use Laravel\Telescope\TelescopeApplicationServiceProvider;
|
||||
|
||||
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
// Telescope::night();
|
||||
|
||||
$this->hideSensitiveRequestDetails();
|
||||
|
||||
Telescope::filter(function (IncomingEntry $entry) {
|
||||
if ($this->app->environment('local')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $entry->isReportableException() ||
|
||||
$entry->isFailedRequest() ||
|
||||
$entry->isFailedJob() ||
|
||||
$entry->isScheduledTask() ||
|
||||
$entry->hasMonitoredTag();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent sensitive request details from being logged by Telescope.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function hideSensitiveRequestDetails()
|
||||
{
|
||||
if ($this->app->environment('local')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Telescope::hideRequestParameters(['_token']);
|
||||
|
||||
Telescope::hideRequestHeaders([
|
||||
'cookie',
|
||||
'x-csrf-token',
|
||||
'x-xsrf-token',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the Telescope gate.
|
||||
*
|
||||
* This gate determines who can access Telescope in non-local environments.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function gate()
|
||||
{
|
||||
Gate::define('viewTelescope', function ($user) {
|
||||
return in_array($user->email, [
|
||||
//
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@
|
||||
"facade/ignition": "^2.5",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/sail": "^1.0.1",
|
||||
"laravel/telescope": "^4.10",
|
||||
"laravel/ui": "^3.3",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^5.10",
|
||||
|
||||
Generated
+69
-1
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "cdaeb0282dbe00ec1825a271df5c0da8",
|
||||
"content-hash": "4481b3d80b4b9d2176d486f089a4174b",
|
||||
"packages": [
|
||||
{
|
||||
"name": "asm89/stack-cors",
|
||||
@@ -9260,6 +9260,74 @@
|
||||
],
|
||||
"time": "2022-09-28T13:13:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/telescope",
|
||||
"version": "v4.10.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/telescope.git",
|
||||
"reference": "3b1220b71ee08ac7be6be074635df50c2b83ab51"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/telescope/zipball/3b1220b71ee08ac7be6be074635df50c2b83ab51",
|
||||
"reference": "3b1220b71ee08ac7be6be074635df50c2b83ab51",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"laravel/framework": "^8.37|^9.0",
|
||||
"php": "^7.3|^8.0",
|
||||
"symfony/var-dumper": "^5.0|^6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-gd": "*",
|
||||
"guzzlehttp/guzzle": "^6.0|^7.0",
|
||||
"orchestra/testbench": "^6.0|^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.x-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Laravel\\Telescope\\TelescopeServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Laravel\\Telescope\\": "src/",
|
||||
"Laravel\\Telescope\\Database\\Factories\\": "database/factories/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylor@laravel.com"
|
||||
},
|
||||
{
|
||||
"name": "Mohamed Said",
|
||||
"email": "mohamed@laravel.com"
|
||||
}
|
||||
],
|
||||
"description": "An elegant debug assistant for the Laravel framework.",
|
||||
"keywords": [
|
||||
"debugging",
|
||||
"laravel",
|
||||
"monitoring"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/laravel/telescope/issues",
|
||||
"source": "https://github.com/laravel/telescope/tree/v4.10.2"
|
||||
},
|
||||
"time": "2022-12-19T11:20:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/ui",
|
||||
"version": "v3.4.6",
|
||||
|
||||
@@ -174,6 +174,7 @@ return [
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
App\Providers\TelescopeServiceProvider::class,
|
||||
Barryvdh\DomPDF\ServiceProvider::class,
|
||||
Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class,
|
||||
//form
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
use Laravel\Telescope\Http\Middleware\Authorize;
|
||||
use Laravel\Telescope\Watchers;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Telescope Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the subdomain where Telescope will be accessible from. If the
|
||||
| setting is null, Telescope will reside under the same domain as the
|
||||
| application. Otherwise, this value will be used as the subdomain.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('TELESCOPE_DOMAIN', null),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Telescope Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the URI path where Telescope will be accessible from. Feel free
|
||||
| to change this path to anything you like. Note that the URI will not
|
||||
| affect the paths of its internal API that aren't exposed to users.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => env('TELESCOPE_PATH', 'telescope'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Telescope Storage Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This configuration options determines the storage driver that will
|
||||
| be used to store Telescope's data. In addition, you may set any
|
||||
| custom options as needed by the particular driver you choose.
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('TELESCOPE_DRIVER', 'database'),
|
||||
|
||||
'storage' => [
|
||||
'database' => [
|
||||
'connection' => env('DB_CONNECTION', 'mysql'),
|
||||
'chunk' => 1000,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Telescope Master Switch
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option may be used to disable all Telescope watchers regardless
|
||||
| of their individual configuration, which simply provides a single
|
||||
| and convenient way to enable or disable Telescope data storage.
|
||||
|
|
||||
*/
|
||||
|
||||
'enabled' => env('TELESCOPE_ENABLED', true),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Telescope Route Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These middleware will be assigned to every Telescope route, giving you
|
||||
| the chance to add your own middleware to this list or change any of
|
||||
| the existing middleware. Or, you can simply stick with this list.
|
||||
|
|
||||
*/
|
||||
|
||||
'middleware' => [
|
||||
'web',
|
||||
Authorize::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Allowed / Ignored Paths & Commands
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following array lists the URI paths and Artisan commands that will
|
||||
| not be watched by Telescope. In addition to this list, some Laravel
|
||||
| commands, like migrations and queue commands, are always ignored.
|
||||
|
|
||||
*/
|
||||
|
||||
'only_paths' => [
|
||||
// 'api/*'
|
||||
],
|
||||
|
||||
'ignore_paths' => [
|
||||
'nova-api*',
|
||||
],
|
||||
|
||||
'ignore_commands' => [
|
||||
//
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Telescope Watchers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following array lists the "watchers" that will be registered with
|
||||
| Telescope. The watchers gather the application's profile data when
|
||||
| a request or task is executed. Feel free to customize this list.
|
||||
|
|
||||
*/
|
||||
|
||||
'watchers' => [
|
||||
Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true),
|
||||
|
||||
Watchers\CacheWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_CACHE_WATCHER', true),
|
||||
'hidden' => [],
|
||||
],
|
||||
|
||||
Watchers\ClientRequestWatcher::class => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true),
|
||||
|
||||
Watchers\CommandWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_COMMAND_WATCHER', true),
|
||||
'ignore' => [],
|
||||
],
|
||||
|
||||
Watchers\DumpWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_DUMP_WATCHER', true),
|
||||
'always' => env('TELESCOPE_DUMP_WATCHER_ALWAYS', false),
|
||||
],
|
||||
|
||||
Watchers\EventWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_EVENT_WATCHER', true),
|
||||
'ignore' => [],
|
||||
],
|
||||
|
||||
Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true),
|
||||
|
||||
Watchers\GateWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_GATE_WATCHER', true),
|
||||
'ignore_abilities' => [],
|
||||
'ignore_packages' => true,
|
||||
'ignore_paths' => [],
|
||||
],
|
||||
|
||||
Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true),
|
||||
Watchers\LogWatcher::class => env('TELESCOPE_LOG_WATCHER', true),
|
||||
Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true),
|
||||
|
||||
Watchers\ModelWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_MODEL_WATCHER', true),
|
||||
'events' => ['eloquent.*'],
|
||||
'hydrations' => true,
|
||||
],
|
||||
|
||||
Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true),
|
||||
|
||||
Watchers\QueryWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_QUERY_WATCHER', true),
|
||||
'ignore_packages' => true,
|
||||
'ignore_paths' => [],
|
||||
'slow' => 100,
|
||||
],
|
||||
|
||||
Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true),
|
||||
|
||||
Watchers\RequestWatcher::class => [
|
||||
'enabled' => env('TELESCOPE_REQUEST_WATCHER', true),
|
||||
'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64),
|
||||
'ignore_http_methods' => [],
|
||||
'ignore_status_codes' => [],
|
||||
],
|
||||
|
||||
Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true),
|
||||
Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true),
|
||||
],
|
||||
];
|
||||
Vendored
+7
File diff suppressed because one or more lines are too long
Vendored
+7
File diff suppressed because one or more lines are too long
Vendored
+2
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"/app.js": "/app.js?id=08317cb3c83c7035246fe3d474db3454",
|
||||
"/app-dark.css": "/app-dark.css?id=3ae28ef5f7b987d68dc611118c646308",
|
||||
"/app.css": "/app.css?id=7c970f699ed9cf60d80b273b4ad2ad61"
|
||||
}
|
||||
+1
-1
@@ -220,7 +220,7 @@ Route::group(['prefix'=>'lelong'], function () {
|
||||
});
|
||||
|
||||
Route::group(['middleware' => ['permission:kemaskinihargaasas']], function () {
|
||||
Route::post('/kemaskini',['as'=>'lelong.kemaskinihargaasas','uses'=>'LelongController@kemaskini']);
|
||||
Route::post('/kemaskini',['as'=>'lelong.kemaskinihargaasas','uses'=>'LelongController@kemaskini2']);
|
||||
});
|
||||
|
||||
Route::group(['middleware' => ['permission:lelongan']], function () {
|
||||
|
||||
Reference in New Issue
Block a user