Update Active Status and Fix Mode 3
This commit is contained in:
@@ -285,7 +285,10 @@ class MemberEnrollmentService
|
|||||||
]), 0, null, $row);
|
]), 0, null, $row);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $memberPolicy->delete();
|
$member = $memberPolicy->member;
|
||||||
|
$member->active = false;
|
||||||
|
|
||||||
|
return $member->save();
|
||||||
break;
|
break;
|
||||||
case "4": // Member Update Start and End Date
|
case "4": // Member Update Start and End Date
|
||||||
$memberPolicy = MemberPolicy::query()
|
$memberPolicy = MemberPolicy::query()
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Traits\Blameable;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class Benefit extends Model
|
class Benefit extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory, SoftDeletes, Blameable;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'corporate_id',
|
'corporate_id',
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Traits\Blameable;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class CorporateBenefit extends Model
|
class CorporateBenefit extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory, SoftDeletes, Blameable;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'corporate_id',
|
'corporate_id',
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Traits\Blameable;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class CorporateDivision extends Model
|
class CorporateDivision extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory, SoftDeletes, Blameable;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'corporate_id',
|
'corporate_id',
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Traits\Blameable;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class CorporateEmployee extends Model
|
class CorporateEmployee extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory, SoftDeletes, Blameable;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'corporate_id',
|
'corporate_id',
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Traits\Blameable;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class CorporatePlan extends Model
|
class CorporatePlan extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory, SoftDeletes, Blameable;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'corporate_id',
|
'corporate_id',
|
||||||
|
|||||||
@@ -2,14 +2,16 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Traits\Blameable;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class CorporatePolicy extends Model
|
class CorporatePolicy extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory, SoftDeletes, Blameable;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'corporate_id',
|
'corporate_id',
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Traits\Blameable;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class Member extends Model
|
class Member extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory, SoftDeletes, Blameable;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
"id",
|
"id",
|
||||||
|
|||||||
34
app/Models/MemberPlan.php
Normal file
34
app/Models/MemberPlan.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Traits\Blameable;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class MemberPlan extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, SoftDeletes, Blameable;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'member_id',
|
||||||
|
'plan_id',
|
||||||
|
'status',
|
||||||
|
'start',
|
||||||
|
'end',
|
||||||
|
'created_by',
|
||||||
|
'updated_by',
|
||||||
|
'deleted_by',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function member()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Member::class, 'member_id', 'member_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function corporatePlan()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(CorporatePlan::class, 'plan_id', 'code');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,10 @@ class MemberPolicy extends Model
|
|||||||
'member_id',
|
'member_id',
|
||||||
'status',
|
'status',
|
||||||
'start',
|
'start',
|
||||||
'end'
|
'end',
|
||||||
|
'created_by',
|
||||||
|
'updated_by',
|
||||||
|
'deleted_by',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function corporatePolicy()
|
public function corporatePolicy()
|
||||||
|
|||||||
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Traits\Blameable;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class Plan extends Model
|
class Plan extends Model
|
||||||
{
|
{
|
||||||
use HasFactory;
|
use HasFactory, SoftDeletes, Blameable;
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
"service_code",
|
"service_code",
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?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::create('member_plans', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('member_id');
|
||||||
|
$table->string('plan_id');
|
||||||
|
$table->string('status')->default('active');
|
||||||
|
$table->dateTime('start')->nullable();
|
||||||
|
$table->dateTime('end')->nullalbe();
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
|
||||||
|
$table->unsignedBigInteger('created_by')->nullable();
|
||||||
|
$table->unsignedBigInteger('updated_by')->nullable();
|
||||||
|
$table->unsignedBigInteger('deleted_by')->nullable();
|
||||||
|
|
||||||
|
$table->index(['policy_id', 'member_id']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('member_plans');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -76,7 +76,9 @@ export default function PlanList() {
|
|||||||
<TableCell align="left">{row.code}</TableCell>
|
<TableCell align="left">{row.code}</TableCell>
|
||||||
<TableCell align="left">{row.name}</TableCell>
|
<TableCell align="left">{row.name}</TableCell>
|
||||||
<TableCell align="left">{ makeExcerpt(row.description) }</TableCell>
|
<TableCell align="left">{ makeExcerpt(row.description) }</TableCell>
|
||||||
<TableCell align="right"><Button variant="outlined" color="success" size="small">Active</Button></TableCell>
|
{( row.active ? (<TableCell align="right"><Button variant="outlined" color="success" size="small">Active</Button></TableCell>)
|
||||||
|
: (<TableCell align="right"><Button variant="outlined" color="error" size="small">Inactive</Button></TableCell>)
|
||||||
|
)}
|
||||||
<TableCell align="right"><Link to={`/corporates/${row.corporate_id}/corporate-plans/${row.id}/edit`}><Button variant="outlined" color="success" size="small">Edit</Button></Link></TableCell>
|
<TableCell align="right"><Link to={`/corporates/${row.corporate_id}/corporate-plans/${row.id}/edit`}><Button variant="outlined" color="success" size="small">Edit</Button></Link></TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
{/* COLLAPSIBLE ROW */}
|
{/* COLLAPSIBLE ROW */}
|
||||||
|
|||||||
@@ -263,7 +263,9 @@ export default function CorporatePlanList() {
|
|||||||
<TableCell align="left">{row.plan_id}</TableCell>
|
<TableCell align="left">{row.plan_id}</TableCell>
|
||||||
<TableCell align="left">{row.current_policy.start}</TableCell>
|
<TableCell align="left">{row.current_policy.start}</TableCell>
|
||||||
<TableCell align="left">{row.current_policy.end}</TableCell>
|
<TableCell align="left">{row.current_policy.end}</TableCell>
|
||||||
<TableCell align="right"><Button variant="outlined" color="success" size="small">Active</Button></TableCell>
|
{( row.active ? (<TableCell align="right"><Button variant="outlined" color="success" size="small">Active</Button></TableCell>)
|
||||||
|
: (<TableCell align="right"><Button variant="outlined" color="error" size="small">Inactive</Button></TableCell>)
|
||||||
|
)}
|
||||||
{/* <TableCell align="right"><Button variant="outlined" color="success" size="small">Edit</Button></TableCell> */}
|
{/* <TableCell align="right"><Button variant="outlined" color="success" size="small">Edit</Button></TableCell> */}
|
||||||
</TableRow>
|
</TableRow>
|
||||||
{/* COLLAPSIBLE ROW */}
|
{/* COLLAPSIBLE ROW */}
|
||||||
|
|||||||
Reference in New Issue
Block a user