Add Corporate Specialities

This commit is contained in:
2022-08-26 10:31:10 +07:00
parent 6561c98f19
commit be31b6f764
33 changed files with 2078 additions and 320 deletions

View File

@@ -509,42 +509,6 @@ class MemberEnrollmentService
$member->active = false;
$member->save();
break;
case "4": // Member Update Start and End Date
$memberPolicy = MemberPolicy::query()
->where('policy_id', $row['policy_number'])
->where('member_id', $row['member_id'])
->first();
if (!$memberPolicy) {
throw new ImportRowException(__('enrollment.MEMBER_NOT_EXISTS', [
'member_id' => $row['member_id'],
'policy_id' => $row['policy_number']
]), 0, null, $row);
}
if ($memberPolicy->status != 'active') {
throw new ImportRowException(__('enrollment.MEMBER_INACTIVE', [
'member_id' => $row['member_id'],
'policy_id' => $row['policy_number']
]), 0, null, $row);
}
$memberPolicy->fill([
'start' => $row['start_date'],
'end' => $row['end_date']
]);
if (!$memberPolicy->isDirty()) {
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_NO_CHANGE'), 0, null, $row);
}
if (Carbon::parse(strtotime($row['member_effective_date'])) > Carbon::parse(strtotime($row['member_expiry_date']))) {
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_INVALID'), 0, null, $row);
}
$memberPolicy->save();
break;
case "5": // Member Renewal Policy (without card)
$memberPolicy = MemberPolicy::query()
@@ -684,9 +648,6 @@ class MemberEnrollmentService
}
throw new ImportRowException(__('MODE 7 NOT HANDLED PROPERLY'), 0, null, $row);
break;
case "8": // Member Information Update (With Replacement Card)
break;
case "9": // Member Reactivation and Personal information update (Without replacement Card)
$memberPolicy = MemberPolicy::query()
@@ -716,29 +677,77 @@ class MemberEnrollmentService
$memberPolicy->save();
break;
case "13": // Advance Renewal with OLD Card No. (NO PRINT)
// ASDASDASD
throw new ImportRowException(__('MODE 13 NOT HANDLED PROPERLY'), 0, null, $row);
break;
// THESE MODES BELOW ARE DISABLED
case "4": // Member Update Start and End Date
throw new ImportRowException(__('MODE 4 NOT HANDLED PROPERLY, TRY TO USE MODE 2'), 0, null, $row);
break;
$memberPolicy = MemberPolicy::query()
->where('policy_id', $row['policy_number'])
->where('member_id', $row['member_id'])
->first();
if (!$memberPolicy) {
throw new ImportRowException(__('enrollment.MEMBER_NOT_EXISTS', [
'member_id' => $row['member_id'],
'policy_id' => $row['policy_number']
]), 0, null, $row);
}
if ($memberPolicy->status != 'active') {
throw new ImportRowException(__('enrollment.MEMBER_INACTIVE', [
'member_id' => $row['member_id'],
'policy_id' => $row['policy_number']
]), 0, null, $row);
}
$memberPolicy->fill([
'start' => $row['start_date'],
'end' => $row['end_date']
]);
if (!$memberPolicy->isDirty()) {
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_NO_CHANGE'), 0, null, $row);
}
if (Carbon::parse(strtotime($row['member_effective_date'])) > Carbon::parse(strtotime($row['member_expiry_date']))) {
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_DATE_INVALID'), 0, null, $row);
}
$memberPolicy->save();
break;
case "8": // Member Information Update (With Replacement Card)
throw new ImportRowException(__('MODE 8 NOT HANDLED PROPERLY, TRY TO USE MODE 2'), 0, null, $row);
break;
// case "10": // No Information Available
// break;
case "11": // Advance Renewal with OLD Card No. (PRINT)
throw new ImportRowException(__('MODE 11 NOT HANDLED PROPERLY'), 0, null, $row);
throw new ImportRowException(__('MODE 11 NOT HANDLED PROPERLY, TRY TO USE MODE 13'), 0, null, $row);
break;
case "12": // Advance Renewal iwh NEW Card No. (PRINT)
throw new ImportRowException(__('MODE 12 NOT HANDLED PROPERLY'), 0, null, $row);
break;
case "13": // Advance Renewal with OLD Card No. (NO PRINT)
throw new ImportRowException(__('MODE 13 NOT HANDLED PROPERLY'), 0, null, $row);
throw new ImportRowException(__('MODE 12 NOT HANDLED PROPERLY, TRY TO USE MODE 13'), 0, null, $row);
break;
// case "14": // No Information Available
// break;
case "15": // Lost Card / Change Card with new card number (Print) (Rarely Used)
throw new ImportRowException(__('MODE 15 NOT HANDLED PROPERLY'), 0, null, $row);
throw new ImportRowException(__('MODE 15 NOT HANDLED PROPERLY, TRY TO USE MODE 2'), 0, null, $row);
break;
case "16": // Endorsement Plan OLD Card No. (NO PRINT)
throw new ImportRowException(__('MODE 16 NOT HANDLED PROPERLY, TRY TO USE MODE 2'), 0, null, $row);
break;
$plan = CorporatePlan::query()
->where('corporate_id', $corporate->id)
->where('code', $row['plan_id'])
@@ -767,11 +776,9 @@ class MemberEnrollmentService
]), 0, null, $row);
}
throw new ImportRowException(__('MODE 16 NOT HANDLED PROPERLY'), 0, null, $row);
break;
case "17": // Endorsement Plan OLD Card No. (PRINT)
throw new ImportRowException(__('MODE 17 NOT HANDLED PROPERLY'), 0, null, $row);
throw new ImportRowException(__('MODE 17 NOT HANDLED PROPERLY, TRY TO USE MODE 2'), 0, null, $row);
break;
default:
throw new ImportRowException(__("enrollment.MODE_UNAVAILABLE"), 0, null, $row);