Merge remote-tracking branch 'refs/remotes/origin/staging' into staging
This commit is contained in:
@@ -70,6 +70,7 @@ class ApotekController extends Controller
|
||||
WHEN tx_prescription_orders.sStatus = "waiting_pharmacy" THEN "Diterima"
|
||||
WHEN tx_prescription_orders.sStatus = "order_prepared" THEN "Siap Diambil"
|
||||
WHEN tx_prescription_orders.sStatus = "ready" THEN "Cari Kurir"
|
||||
WHEN tx_prescription_orders.sStatus = "failed" THEN "Cari Kurir"
|
||||
WHEN tx_prescription_orders.sStatus = "waiting_for_courir" THEN "Kurir Sudah Ambil Pesanan"
|
||||
WHEN tx_prescription_orders.sStatus = "package_picked_up" THEN "Sedang diantar ke Alamat Tujuan"
|
||||
WHEN tx_prescription_orders.sStatus = "package_on_delivery" THEN "Selesai"
|
||||
|
||||
@@ -48,6 +48,8 @@ class OrganizationController extends Controller
|
||||
public function store(Request $request)
|
||||
{
|
||||
$organization = [
|
||||
'phone' => $request->no_hp,
|
||||
'email' => $request->email,
|
||||
'code' => $request->code,
|
||||
'name' => $request->name,
|
||||
'type' => 'hospital',
|
||||
@@ -119,6 +121,8 @@ class OrganizationController extends Controller
|
||||
$update_organization = Organization::find($id);
|
||||
|
||||
$update_organization->update([
|
||||
'phone' => $request->no_hp,
|
||||
'email' => $request->email,
|
||||
'code' => $request->code,
|
||||
'name' => $request->name,
|
||||
'type' => 'hospital',
|
||||
@@ -152,7 +156,7 @@ class OrganizationController extends Controller
|
||||
'lat' => $request->lat,
|
||||
'lng' => $request->lng,
|
||||
]);
|
||||
|
||||
|
||||
$update_organization->main_address_id = $newAddres->id;
|
||||
$update_organization->save();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace Modules\Internal\Http\Controllers\Api;
|
||||
|
||||
use App\Helpers\Helper;
|
||||
use App\Models\Organization;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
@@ -110,11 +111,21 @@ class UserManagementController extends Controller
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function list_organization(Request $request)
|
||||
{
|
||||
$query = Organization::where('type', 'hospital')->get();
|
||||
$data = [
|
||||
'data' => $query
|
||||
];
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function store_access(Request $request){
|
||||
$user = User::create([
|
||||
'email' => $request->email,
|
||||
'username' => $request->username,
|
||||
'role_id' => $request->roles,
|
||||
'organization_id' => $request->organizations,
|
||||
'password' => Hash::make($request->password),
|
||||
]);
|
||||
|
||||
@@ -164,6 +175,7 @@ class UserManagementController extends Controller
|
||||
$userAccess->email = $request->email;
|
||||
$userAccess->username = $request->username;
|
||||
$userAccess->role_id = $request->roles;
|
||||
$userAccess->organization_id = $request->organizations;
|
||||
|
||||
if ($request->password){
|
||||
$userAccess->password = Hash::make($request->password);
|
||||
|
||||
@@ -398,6 +398,7 @@ Route::prefix('internal')->group(function () {
|
||||
Route::get('user/access/{id}', [UserManagementController::class, 'edit_access']);
|
||||
Route::put('user/access/{id}', [UserManagementController::class, 'update_access']);
|
||||
Route::get('role-list', [UserManagementController::class, 'list_role']);
|
||||
Route::get('organization-list', [UserManagementController::class, 'list_organization']);
|
||||
|
||||
// Navigation
|
||||
Route::get('navigations', [NavigationController::class, 'index']);
|
||||
|
||||
@@ -27,12 +27,14 @@ class OrganizationResource extends JsonResource
|
||||
}
|
||||
$corporatePartner = implode(', ', $corporateName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$organization = [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'type' => $this->type,
|
||||
'no_hp' => $this->phone,
|
||||
'email' => $this->email,
|
||||
'code' => $this->code,
|
||||
'description' => $this->description,
|
||||
'kodeRs' => $this->meta->KodeRS ?? null,
|
||||
|
||||
@@ -25,6 +25,7 @@ class User extends Authenticatable
|
||||
|
||||
protected $connection = 'mysql';
|
||||
protected $fillable = [
|
||||
'organization_id',
|
||||
'person_id',
|
||||
'name',
|
||||
'email',
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
export type Organizations = {
|
||||
id: number;
|
||||
code: string;
|
||||
no_hp: number;
|
||||
email: string;
|
||||
name: string;
|
||||
address: string;
|
||||
type: string;
|
||||
|
||||
@@ -134,6 +134,11 @@ export type Role = {
|
||||
permissions: number[]
|
||||
};
|
||||
|
||||
export type Organization = {
|
||||
id: number;
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type Permisions = {
|
||||
name: string;
|
||||
guard_name: string;
|
||||
@@ -146,6 +151,7 @@ export type UserAccess = {
|
||||
email: string;
|
||||
person: Person;
|
||||
role: Role;
|
||||
organization_id: Organization;
|
||||
}
|
||||
|
||||
export type Person = {
|
||||
|
||||
@@ -116,6 +116,8 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
|
||||
name: currentOrganizations?.name || '',
|
||||
code: currentOrganizations?.code || '',
|
||||
phone: currentOrganizations?.phone || '',
|
||||
no_hp: currentOrganizations?.no_hp || '',
|
||||
email: currentOrganizations?.email || '',
|
||||
lat: currentOrganizations?.lat || '',
|
||||
lng: currentOrganizations?.lng || '',
|
||||
address: currentOrganizations?.address || '',
|
||||
@@ -185,6 +187,8 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
|
||||
formData.append('name', data.name);
|
||||
formData.append('code', data.code);
|
||||
formData.append('phone', data.phone);
|
||||
formData.append('no_hp', data.no_hp);
|
||||
formData.append('email', data.email);
|
||||
formData.append('lat', data.lat);
|
||||
formData.append('lng', data.lng);
|
||||
formData.append('address', data.address);
|
||||
@@ -361,7 +365,7 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
|
||||
const findValueCorporate = selectedCorporatID.find(
|
||||
(item: any) => item.value === currentOrganizations?.corporate_id_partner
|
||||
);
|
||||
|
||||
|
||||
return (
|
||||
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
|
||||
<Stack spacing={3}>
|
||||
@@ -391,6 +395,14 @@ export default function OrganizationsForm({ isEdit, currentOrganizations }: Prop
|
||||
<LabelStyle>Nomor IGD</LabelStyle>
|
||||
<RHFTextField name="phone" placeholder="Tuliskan No IGD" />
|
||||
</Grid>
|
||||
<Grid item xs={12} md={6}>
|
||||
<LabelStyle>No. HP</LabelStyle>
|
||||
<RHFTextField name="no_hp" placeholder="Tuliskan No. HP" />
|
||||
</Grid>
|
||||
<Grid item xs={12} md={6}>
|
||||
<LabelStyle>Email</LabelStyle>
|
||||
<RHFTextField name="email" placeholder="Tuliskan Email" />
|
||||
</Grid>
|
||||
<Grid item xs={12}>
|
||||
<LabelStyle>Alamat</LabelStyle>
|
||||
<RHFTextField name="address" placeholder="Tuliskan Alamat" />
|
||||
|
||||
@@ -301,9 +301,21 @@ export default function List() {
|
||||
<Grid item xs={10}>
|
||||
: {row.code ? row.code : '-'}
|
||||
</Grid>
|
||||
<Grid item xs={2}>
|
||||
No. HP
|
||||
</Grid>
|
||||
<Grid item xs={10}>
|
||||
: {row.no_hp ? row.no_hp : '-'}
|
||||
</Grid>
|
||||
<Grid item xs={2}>
|
||||
Email
|
||||
</Grid>
|
||||
<Grid item xs={10}>
|
||||
: {row.email ? row.email : '-'}
|
||||
</Grid>
|
||||
|
||||
<Grid item xs={2}>
|
||||
Rekanan
|
||||
Rekanan
|
||||
</Grid>
|
||||
<Grid item xs={10}>
|
||||
: {row.corporate_name ? row.corporate_name : '-'}
|
||||
|
||||
@@ -6,6 +6,7 @@ import {useContext, useEffect, useMemo, useState } from 'react';
|
||||
import axios from '../../../utils/axios';
|
||||
import UserAccessForm from './Form';
|
||||
import { Role, UserAccess } from '../../../@types/user';
|
||||
import Organizations from "@/pages/Master/Hospitals/Index";
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +14,7 @@ export default function UserAccessCreate() {
|
||||
const { id } = useParams();
|
||||
const [ currentUserAccess, setCurrentUserAccess ] = useState<UserAccess>();
|
||||
const [ roles, setRole ] = useState<any>();
|
||||
const [ organizations, setOrganization ] = useState<any>();
|
||||
|
||||
|
||||
const navigate = useNavigate();
|
||||
@@ -41,6 +43,16 @@ export default function UserAccessCreate() {
|
||||
}
|
||||
})
|
||||
|
||||
axios.get('/organization-list')
|
||||
.then((res)=> {
|
||||
setOrganization(res.data)
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err.response.status === 404) {
|
||||
navigate('/404');
|
||||
}
|
||||
})
|
||||
|
||||
}, [id]);
|
||||
|
||||
|
||||
@@ -57,7 +69,7 @@ export default function UserAccessCreate() {
|
||||
]}
|
||||
/>
|
||||
|
||||
<UserAccessForm isEdit={isEdit} currentUserAccess={currentUserAccess} roles={roles}/>
|
||||
<UserAccessForm isEdit={isEdit} currentUserAccess={currentUserAccess} roles={roles} organizations={organizations}/>
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as Yup from 'yup';
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import { Box, Card, Grid, Stack, Typography } from "@mui/material";
|
||||
import { Role, UserAccess } from "../../../@types/user";
|
||||
import { Role, UserAccess, Organization } from "../../../@types/user";
|
||||
import { FormProvider, RHFSelect, RHFSwitch, RHFTextField } from "../../../components/hook-form";
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
@@ -14,10 +14,11 @@ import palette from '@/theme/palette';
|
||||
type Props = {
|
||||
isEdit: boolean;
|
||||
currentUserAccess?: UserAccess;
|
||||
roles: Role
|
||||
roles: Role;
|
||||
organizations: Organization;
|
||||
};
|
||||
|
||||
export default function AccsessForm({ isEdit, currentUserAccess, roles }: Props) {
|
||||
export default function AccsessForm({ isEdit, currentUserAccess, roles, organizations }: Props) {
|
||||
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
const navigate = useNavigate();
|
||||
@@ -34,6 +35,7 @@ export default function AccsessForm({ isEdit, currentUserAccess, roles }: Props)
|
||||
username: currentUserAccess?.username || '',
|
||||
email: currentUserAccess?.email || '',
|
||||
roles: currentUserAccess?.role?.id || [],
|
||||
organizations: currentUserAccess?.organization_id || [],
|
||||
password: '',
|
||||
}),
|
||||
[currentUserAccess]
|
||||
@@ -107,11 +109,20 @@ export default function AccsessForm({ isEdit, currentUserAccess, roles }: Props)
|
||||
value: item.id,
|
||||
label: item.name
|
||||
})) ?? [];
|
||||
|
||||
|
||||
if (optionsRoles.length > 0) {
|
||||
optionsRoles.unshift({ value: '', label: '' });
|
||||
}
|
||||
|
||||
const optionsOrganization = organizations?.data?.map(item => ({
|
||||
value: item.id,
|
||||
label: item.name
|
||||
})) ?? [];
|
||||
|
||||
if (optionsOrganization.length > 0) {
|
||||
optionsOrganization.unshift({ value: '', label: '' });
|
||||
}
|
||||
|
||||
return (
|
||||
<FormProvider methods={methods} onSubmit={handleSubmit(onSubmit)}>
|
||||
<Box sx={{ px: 2 }}>
|
||||
@@ -131,6 +142,13 @@ export default function AccsessForm({ isEdit, currentUserAccess, roles }: Props)
|
||||
</option>
|
||||
))}
|
||||
</RHFSelect>
|
||||
<RHFSelect name="organizations" label="organizations">
|
||||
{optionsOrganization.map((option, index) => (
|
||||
<option key={index} value={option.value}>
|
||||
{option.label}
|
||||
</option>
|
||||
))}
|
||||
</RHFSelect>
|
||||
|
||||
|
||||
<LoadingButton type="submit" variant="contained" size="large" fullWidth={true} loading={isSubmitting}>
|
||||
|
||||
@@ -230,7 +230,7 @@ export default function Table<T>({
|
||||
const formattedRoleName = user?.role.name;
|
||||
// List of statuses for 'apotek'
|
||||
const allowedStatusesForApotek = ['waiting_pharmacy', 'order_prepared'];
|
||||
const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready', 'waiting_for_courir', 'package_picked_up', 'package_on_delivery'];
|
||||
const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready', 'waiting_for_courir', 'package_picked_up', 'package_on_delivery', 'failed'];
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -269,7 +269,7 @@ const allowedStatusesForCSLMS = ['waiting_pharmacy', 'order_prepared', 'ready',
|
||||
const handleClickKonfirmasi = (row: any) => {
|
||||
setTxtStatusDriver('');
|
||||
setTxtIDDriver('');
|
||||
if(row.sStatus === 'ready')
|
||||
if(row.sStatus === 'ready' || row.sStatus === 'failed')
|
||||
{
|
||||
//close
|
||||
setDialogIDRow(row.id === dialogIDRow ? null : row.id);
|
||||
|
||||
@@ -133,6 +133,7 @@
|
||||
"txtOK": "Yes",
|
||||
"txtFindingDriver": "Finding a driver...",
|
||||
"txtDriverFound": "The driver’s been grabbed with the ID",
|
||||
"txtButtonClose": "Close"
|
||||
"txtButtonClose": "Close",
|
||||
"txtLabelFailed": "Failed"
|
||||
|
||||
}
|
||||
|
||||
@@ -133,5 +133,6 @@
|
||||
"txtOK": "Ya",
|
||||
"txtFindingDriver" : "Sedang mencari driver...",
|
||||
"txtDriverFound" : "Driver sudah didapat dengan ID",
|
||||
"txtButtonClose": "Tutup"
|
||||
"txtButtonClose": "Tutup",
|
||||
"txtLabelFailed": "Gagal Pengiriman"
|
||||
}
|
||||
|
||||
@@ -353,6 +353,10 @@ export default function TableList() {
|
||||
<Label color='primary'>
|
||||
{localeData.txtLabelWaitingForPayment}
|
||||
</Label>
|
||||
): obj.status === 'failed' ? (
|
||||
<Label color='error'>
|
||||
{localeData.txtLabelFailed}
|
||||
</Label>
|
||||
) : (
|
||||
<Label color='primary'>
|
||||
Pending
|
||||
@@ -404,6 +408,7 @@ export default function TableList() {
|
||||
{"id": "package_picked_up", "name": localeData.txtLabelPackagePickedUp },
|
||||
{"id": "package_on_delivery", "name": localeData.txtLabelPackageOnDelivery },
|
||||
{"id": "package_delivered", "name": localeData.txtLabelPackageDelivered },
|
||||
{"id": "failed", "name": localeData.txtLabelFailed },
|
||||
];
|
||||
setStatusData(status)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user