Merge remote-tracking branch 'refs/remotes/origin/staging' into staging

This commit is contained in:
Linksehat Staging Server
2023-08-30 17:43:19 +07:00
15 changed files with 6685 additions and 2276 deletions

View File

@@ -404,10 +404,11 @@ class CorporateController extends Controller
$file_name = now()->getPreciseTimestamp(3) . '-' . $request->file('file')->getClientOriginalName();
$file = $request->file('file')->storeAs('temp', $file_name);
$corporate = Corporate::with(['plans'])->findOrFail($corporate_id);
$fileWrite = Storage::disk('public')->path('temp/result-' . $file_name);
$fileRead = Storage::path('temp/' . $file_name);
$import = new ImportService();
$import->read(Storage::path('temp/' . $file_name));
$import->write(Storage::disk('public')->path('temp/result-' . $file_name), 'xsls');
$import->read($fileRead);
$import->write($fileWrite, 'xsls');
foreach ($import->sheetsIterator() as $sheetIndex => $sheet) {
if (!in_array($sheet->getName(), ['Plan', 'Benefit'])) {
@@ -430,9 +431,11 @@ class CorporateController extends Controller
// Write Header to File
$result_headers = array_keys($headers_map_to_table_fields);
$result_headers = array_merge($result_headers, ['Ingest Code', 'Ingest Note']);
$import->read($fileRead);
$import->write($fileWrite, 'xsls');
$import->addArrayToRow($result_headers);
}
$doc_headers_indexes = [];
foreach ($sheet->getRowIterator() as $index => $row) {
if ($index == 1) { // First Row Must be Header
@@ -447,12 +450,10 @@ class CorporateController extends Controller
// TODO Validate if First Row not Header
} else { // Next Row Should be Data
$row_data = [];
foreach ($row->getCells() as $header_index => $cell) {
if (isset($headers_map_to_table_fields[$doc_headers_indexes[$header_index]]))
$row_data[$headers_map_to_table_fields[$doc_headers_indexes[$header_index]]] = $cell->getValue();
}
try { // Process the Row Data
$corporateService = new CorporateService();
if ($sheet->getName() == 'Plan') {
@@ -461,12 +462,16 @@ class CorporateController extends Controller
$corporateService->handleBenefitRow($corporate, $row_data);
}
// Write Success Result to File
$import->addArrayToRow(array_merge($row_data, [
'Ingest Code' => 200,
'Ingest Note' => 'Success',
]), $sheet->getName());
$import->read($fileRead);
$import->write($fileWrite, 'xsls');
$result_headers = array_merge($row_data, ['Ingest Code' =>200, 'Ingest Note' => 'Success']);
$import->addArrayToRow($result_headers, $sheet->getName());
} catch (ImportRowException $e) {
// Write Data Validation Error to File
$import->read($fileRead);
$import->write($fileWrite, 'xsls');
$import->addArrayToRow(array_merge($row_data, [
'Ingest Code' => $e->getCode(),
'Ingest Note' => $e->getMessage(),
@@ -474,6 +479,8 @@ class CorporateController extends Controller
} catch (\Exception $e) {
// throw new \Exception($e);
// Write Server Error to File
$import->read($fileRead);
$import->write($fileWrite, 'xsls');
$import->addArrayToRow(array_merge($row_data, [
'Ingest Code' => 500,
'Ingest Note' => env('APP_DEBUG') ? $e->getMessage() : 'Server Error',

View File

@@ -17,10 +17,20 @@ class LivechatController extends Controller
*/
public function index()
{
$startDate = '2023-01-01';
$endDate = '2023-08-01';
$livechat = Livechat::with('doctor.user', 'doctor.speciality', 'appointment.appointmentDetail', 'healthCare')
->where('nIDAppointment', '!=', null)->where('nIDAppointment', '!=', '')
->latest()
->paginate(15);
->where('nIDAppointment', '!=', null)->where('nIDAppointment', '!=', '');
// dd($livechat);
if ($startDate){
$livechat->where('dStartTime', '>=', $startDate);
}
if ($endDate){
$livechat->where('dStartTime', '<=', $endDate);
}
$livechat->latest()->paginate(15);
return response()->json(Helper::paginateResources(LivechatResource::collection($livechat)));
}

View File

@@ -120,7 +120,6 @@ class PlanController extends Controller
$result_headers = array_keys($headers_map_to_table_fields);
array_push($result_headers, ['Ingest Code', 'Ingest Note']);
$import->addArrayToRow($result_headers);
die('fuck');
$imported_plan_data = 0;
$failed_plan_data = [];

View File

@@ -335,7 +335,7 @@ class MemberEnrollmentService
public function validateDate($dateString, $dateFormat = 'Ymd'){
$date = DateTime::createFromFormat($dateFormat, $dateString);
if ($date && $date->format($dateFormat) == $dateString) {
if ($date && ($date->format($dateFormat) == $dateString)) {
return true;
} else {
return false;
@@ -437,32 +437,32 @@ class MemberEnrollmentService
if (empty($row['member_effective_date'])) {
throw new ImportRowException(__('enrollment.MEMBER_EFFECTIVE_REQUIRED'), 0, null, $row);
}
if(!$this->validateDate($row['member_effective_date'])){
throw new ImportRowException(__('enrollment.INVALID_DATE', [
'title' => $title['member_effective_date']
]), 0, null, $row);
}
// if(!$this->validateDate($row['member_effective_date'])){
// throw new ImportRowException(__('enrollment.INVALID_DATE', [
// 'title' => $title['member_effective_date']
// ]), 0, null, $row);
// }
if (empty($row['member_expiry_date'])) {
throw new ImportRowException(__('enrollment.MEMBER_EXPIRY_REQUIRED'), 0, null, $row);
}
if(!$this->validateDate($row['member_expiry_date'])){
throw new ImportRowException(__('enrollment.INVALID_DATE', [
'title' => $title['member_expiry_date']
]), 0, null, $row);
}
// if(!$this->validateDate($row['member_expiry_date'])){
// throw new ImportRowException(__('enrollment.INVALID_DATE', [
// 'title' => $title['member_expiry_date']
// ]), 0, null, $row);
// }
// TODO EFFECTIVE DATE VALIDATION
// if (empty($row['activation_date'])) {
// throw new ImportRowException(__('enrollment.ACTIVATION_DATE_REQUIRED'), 0, null, $row);
// }
if(!empty($row['activation_date'])){
if(!$this->validateDate($row['activation_date'])){
throw new ImportRowException(__('enrollment.INVALID_DATE', [
'title' => $title['activation_date']
]), 0, null, $row);
}
}
// if(!empty($row['activation_date'])){
// if(!$this->validateDate($row['activation_date'])){
// throw new ImportRowException(__('enrollment.INVALID_DATE', [
// 'title' => $title['activation_date']
// ]), 0, null, $row);
// }
// }
// TODO FKTP VALIDATION
// TODO FKRTL VALIDATION
@@ -495,22 +495,22 @@ class MemberEnrollmentService
if (empty($row['date_of_birth'])) {
throw new ImportRowException(__('enrollment.DATE_OF_BIRTH_REQUIRED'), 0, null, $row);
}
if(!$this->validateDate($row['date_of_birth'])){
throw new ImportRowException(__('enrollment.INVALID_DATE', [
'title' => $title['date_of_birth']
]), 0, null, $row);
}
// if(!$this->validateDate($row['date_of_birth'])){
// throw new ImportRowException(__('enrollment.INVALID_DATE', [
// 'title' => $title['date_of_birth']
// ]), 0, null, $row);
// }
// if (empty($row['date_terminated'])) {
// throw new ImportRowException(__('enrollment.DATE_OF_TERMINATED'), 0, null, $row);
// }
if (!empty($row['date_terminated'])) {
if(!$this->validateDate($row['date_terminated'])){
throw new ImportRowException(__('enrollment.INVALID_DATE', [
'title' => $title['date_terminated']
]), 0, null, $row);
}
}
// if (!empty($row['date_terminated'])) {
// if(!$this->validateDate($row['date_terminated'])){
// throw new ImportRowException(__('enrollment.INVALID_DATE', [
// 'title' => $title['date_terminated']
// ]), 0, null, $row);
// }
// }
// TODO DOB FORMAT VALIDATION
if (empty($row['sex'])) {
@@ -705,6 +705,7 @@ class MemberEnrollmentService
'gender' => Helper::genderPerson($row['sex']),
'language' => $row['language'] ?? null,
'race' => $row['race'] ?? null,
'phone' => $row['telephone_mobile'] ?? null
]
);
$member->person_id = $person->id;
@@ -749,6 +750,7 @@ class MemberEnrollmentService
'gender' => Helper::genderPerson($row['sex']),
'language' => $row['language'] ?? null,
'race' => $row['race'] ?? null,
'phone' => $row['telephone_mobile'],
]);
$member->person_id = $person->id;
$member->save();
@@ -799,7 +801,7 @@ class MemberEnrollmentService
}
break;
case "2": // Member Information Update (Without Replacement Card)
// $this->validateRow($row);
$member = Member::query()
->where('member_id', $row['member_id'])
@@ -812,7 +814,27 @@ class MemberEnrollmentService
'policy_id' => $row['policy_number']
]), 0, null, $row);
}
$person = Person::updateOrCreate(
[
'id' => $member->person_id
],
[
'name' => $row['name'] ?? null,
// 'birth_date' => $this->dateParser($row['date_of_birth']),
'birth_date' => $row['date_of_birth'],
'gender' => Helper::genderPerson($row['sex']),
'language' => $row['language'] ?? null,
'race' => $row['race'] ?? null,
'phone' => $row['telephone_mobile']
]
);
$member->person_id = $person->id;
$member->save();
try {
$memberPolicy = MemberPolicy::query()
->where('policy_id', $row['policy_number'])
->where('member_id', $row['member_id'])

View File

@@ -14,8 +14,8 @@ class Livechat extends Model
public $sStatusNames = [
0 => 'Menunggu Konfirmasi',
1 => 'Diterima',
2 => 'Ditolak',
3 => 'Selesai',
3 => 'Ditolak',
2 => 'Selesai',
4 => 'Expired',
];

View File

@@ -64,22 +64,22 @@ class ImportService{
public function addArrayToRow($array, $sheetName = null)
{
// Switch to the correct Sheet Before Write
if ($sheetName) {
if ($sheetName != $this->writer->getCurrentSheet()->getName()) {
foreach ($this->writer->getSheetIterator() as $sheet) {
if ($sheet->getName() == $sheet) {
$this->writer->setCurrentSheet($sheet);
break;
// Switch to the correct Sheet Before Write
if ($sheetName) {
$currentSheet = $this->writer->getCurrentSheet();
if ($sheetName != $currentSheet->getName()) {
$sheets = $this->writer->getSheets();
foreach ($sheets as $sheet) {
if ($sheet->getName() == $sheetName) {
$this->writer->setCurrentSheet($sheet); // Set the correct sheet
break;
}
}
}
}
}
}
$newRow = $this->makeRow($array);
$this->writer->addRow($newRow);
return $this;
$newRow = $this->makeRow($array);
// $this->writer->addRow($newRow);
return $this;
}
}

View File

@@ -2,6 +2,6 @@ GENERATE_SOURCEMAP=false
PORT=8083
REACT_APP_HOST_API_URL="http://127.0.0.1:8000"
REACT_APP_HOST_API_URL="http://lms.test"
VITE_API_URL="http://127.0.0.1:8000/api/internal"

File diff suppressed because it is too large Load Diff

View File

@@ -39,27 +39,27 @@
},
"dependencies": {
"@ajoelp/json-to-formdata": "^1.5.0",
"@date-io/date-fns": "^2.16.0",
"@emotion/cache": "^11.10.5",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@hookform/resolvers": "^2.9.10",
"@date-io/date-fns": "^2.17.0",
"@emotion/cache": "^11.11.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@hookform/resolvers": "^2.9.11",
"@iconify/react": "^3.2.2",
"@mui/icons-material": "^5.11.0",
"@mui/icons-material": "^5.14.6",
"@mui/lab": "5.0.0-alpha.80",
"@mui/material": "^5.11.5",
"@mui/system": "^5.11.5",
"@mui/x-data-grid": "^5.17.19",
"@mui/material": "^5.14.6",
"@mui/system": "^5.14.6",
"@mui/x-data-grid": "^5.17.26",
"@mui/x-date-pickers": "5.0.0-beta.2",
"@vitejs/plugin-react": "^1.3.2",
"apexcharts": "^3.36.3",
"apexcharts": "^3.42.0",
"axios": "^0.27.2",
"change-case": "^4.1.2",
"csstype": "^3.1.1",
"date-fns": "^2.29.3",
"esbuild": "^0.17.18",
"csstype": "^3.1.2",
"date-fns": "^2.30.0",
"esbuild": "^0.17.19",
"framer-motion": "^6.5.1",
"highlight.js": "^11.7.0",
"highlight.js": "^11.8.0",
"history": "^5.3.0",
"jsx-runtime": "^1.2.0",
"lodash": "^4.17.21",
@@ -68,51 +68,51 @@
"numeral": "^2.0.6",
"pnpm": "^8.6.12",
"react": "^17.0.2",
"react-apexcharts": "^1.4.0",
"react-apexcharts": "^1.4.1",
"react-dom": "^17.0.2",
"react-dropzone": "^14.2.3",
"react-helmet-async": "^1.3.0",
"react-hook-form": "^7.42.1",
"react-hook-form": "^7.45.4",
"react-intersection-observer": "^8.34.0",
"react-lazy-load-image-component": "^1.5.6",
"react-lazy-load-image-component": "^1.6.0",
"react-quill": "2.0.0-beta.4",
"react-router": "^6.7.0",
"react-router-dom": "^6.7.0",
"react-router": "^6.15.0",
"react-router-dom": "^6.15.0",
"simplebar": "^5.3.9",
"simplebar-react": "^2.4.3",
"stylis": "^4.1.3",
"stylis": "^4.3.0",
"stylis-plugin-rtl": "^2.1.1",
"vite": "^3.2.5",
"vite": "^3.2.7",
"vite-plugin-svgr": "^2.4.0",
"yup": "^0.32.11"
},
"devDependencies": {
"@babel/core": "^7.20.12",
"@babel/eslint-parser": "^7.19.1",
"@babel/plugin-syntax-flow": "^7.18.6",
"@babel/plugin-transform-react-jsx": "^7.20.7",
"@types/lodash": "^4.14.191",
"@babel/core": "^7.22.11",
"@babel/eslint-parser": "^7.22.11",
"@babel/plugin-syntax-flow": "^7.22.5",
"@babel/plugin-transform-react-jsx": "^7.22.5",
"@types/lodash": "^4.14.197",
"@types/nprogress": "^0.2.0",
"@types/react": "^17.0.53",
"@types/react-dom": "^17.0.18",
"@types/react-lazy-load-image-component": "^1.5.2",
"@types/stylis": "^4.0.2",
"@typescript-eslint/eslint-plugin": "^5.48.2",
"@typescript-eslint/parser": "^5.48.2",
"eslint": "^8.32.0",
"@types/react": "^17.0.65",
"@types/react-dom": "^17.0.20",
"@types/react-lazy-load-image-component": "^1.5.3",
"@types/stylis": "^4.2.0",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.48.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-airbnb-typescript": "^16.2.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-prettier": "^8.10.0",
"eslint-config-react-app": "7.0.0",
"eslint-import-resolver-typescript": "^2.7.1",
"eslint-plugin-flowtype": "^8.0.3",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.32.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "4.3.0",
"prettier": "^2.8.3",
"typescript": "^4.9.4",
"prettier": "^2.8.8",
"typescript": "^4.9.5",
"vite-plugin-pwa": "^0.12.8"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -560,6 +560,12 @@ export default function CorporatePlanList({handleSubmitSuccess}) {
<Grid item xs={6}>
: {row.email ?? '-'}
</Grid>
<Grid item xs={6}>
Phone
</Grid>
<Grid item xs={6}>
: {row.person?.phone ?? '-'}
</Grid>
</Grid>
</Grid>
<Grid item xs={6}>

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,11 @@
content="The starting point for your next project with Minimal UI Kit, built on the newest version of Material-UI ©, ready to be customized to your style" />
<meta name="keywords" content="react,material,kit,application,dashboard,admin,template" />
<meta name="author" content="Minimal UI Kit" />
<<<<<<< HEAD
<script type="module" crossorigin src="/assets/index.9b396686.js"></script>
=======
<script type="module" crossorigin src="/assets/index.da589e84.js"></script>
>>>>>>> a54708abb5d46d7d7319730306a528d33d910895
<link rel="stylesheet" href="/assets/index.c91e36b5.css">
<link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long