This commit is contained in:
2024-01-11 12:01:02 +07:00
parent ec6b6679bb
commit 2318a9d844
7 changed files with 66 additions and 17 deletions

View File

@@ -160,7 +160,7 @@ class CorporateMemberController extends Controller
public function import(Request $request, $corporate_id)
{
// setting tambahan php
ini_set('max_execution_time', 300);
Helper::setCustomPHPIniSettings();
$request->validate([
'file' => 'required|file|mimes:xls,xlsx,csv,txt',

View File

@@ -872,7 +872,7 @@ class MemberEnrollmentService
}
break;
case "2": // Member Information Update (Without Replacement Card)
$this->validateRow($row);
$member = Member::query()
->where('member_id', $row['member_id'])
@@ -912,22 +912,24 @@ class MemberEnrollmentService
$member->save();
try {
DB::beginTransaction();
$memberPolicy = MemberPolicy::query()
->where('policy_id', $row['policy_number'])
->where('member_id', $row['member_id'])
->with('member')
->first();
// Pengecekan jika ada perubahan di plan
$plan = Plan::query()
->where('code', $row['plan_id'])
->first();
if ($plan){
$memberPlan = MemberPlan::query()
->where('member_id', $member->id)
->first();
$memberPlan->plan_id = $plan->id;
$memberPlan->save();
}
// $plan = Plan::query()
// ->where('code', $row['plan_id'])
// ->first();
// if ($plan){
// $memberPlan = MemberPlan::query()
// ->where('member_id', $member->id)
// ->first();
// $memberPlan->plan_id = $plan->id;
// $memberPlan->save();
// }
// // Pengecekan jika ada perubahan di plan
// $plan = Plan::query()
@@ -942,9 +944,7 @@ class MemberEnrollmentService
// }
// Hapus Member plan terkait
$member->memberPlans()->delete();
$delete = MemberPlan::where('member_id', $member->id)->delete();
//Update plan
$plans = explode(",",$row['plan_id']);
if (count($plans) > 0) {
@@ -1074,6 +1074,7 @@ class MemberEnrollmentService
);
}
if (!$memberPolicy) {
throw new ImportRowException(__('enrollment.MEMBER_NOT_EXISTS', [
'member_id' => $row['member_id'],

View File

@@ -384,4 +384,12 @@ class Helper
}
}
public static function setCustomPHPIniSettings()
{
ini_set('max_execution_time', 300); // Waktu untuk execution suatu function atau script
ini_set('post_max_size', '32M'); // Batas post Yang di Upload
ini_set('upload_max_filesize', '10M'); // Batas File yang di Upload
ini_set('max_input_time ', '120'); // Batas max time menunggu input max 5 menit
}
}

View File

@@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Altek\Accountant\Contracts\Recordable;
class Member extends Model
{
@@ -21,6 +22,7 @@ class Member extends Model
"record_type",
"record_mode",
"payor_id",
"plan_id",
"user_id",
"name_prefix",
"name",

View File

@@ -3,13 +3,14 @@
namespace App\Models;
use App\Traits\Blameable;
use Altek\Accountant\Contracts\Recordable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
// use Illuminate\Database\Eloquent\SoftDeletes;
class MemberPlan extends Model
{
use HasFactory, SoftDeletes, Blameable;
use HasFactory, Blameable;
protected $fillable = [
'member_id',

View File

@@ -80,6 +80,11 @@ class AppServiceProvider extends ServiceProvider
$this->logAuditTrail($model, 'deleted');
});
MemberPlan::deleted(function ($model) {
$this->logAuditTrail($model, 'deleted');
});
//Hospital
CorporateHospital::updated(function ($model) {

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('members', function (Blueprint $table) {
$table->string('plan_id')->after('payor_id')->default(null);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('members', function (Blueprint $table) {
$table->dropColumn('plan_id');
});
}
};