93 lines
3.4 KiB
PHP
Executable File
93 lines
3.4 KiB
PHP
Executable File
@php
|
|
# Get Current USER
|
|
$loggedUser = strtoUpper(m3User());
|
|
|
|
$admin_users = $power_users = $csr = $execUser = "";
|
|
$UserCO = $UserWHS = $UserPL = '';
|
|
$WDWNAM = '';
|
|
$IC670MAllWHS = collect();
|
|
$m3Connection = config('m3.connection', 'pgsql');
|
|
$getUsers = [];
|
|
if (\Illuminate\Support\Facades\Schema::connection($m3Connection)->hasTable('icm428m')) {
|
|
$getUsers = DB::connection($m3Connection)
|
|
->table('icm428m')
|
|
->select('R428US', 'R428ADMUSR', 'R428PWRUSR', 'R428CO', 'R428PL', 'R428WH', 'R42811A', 'R42821A')
|
|
->where('R428US', $loggedUser)
|
|
->get();
|
|
}
|
|
|
|
foreach ($getUsers as $key=>$user) {
|
|
if(trim($user->R428ADMUSR)=="Y") {
|
|
# Different logic from Qinclude version : this not an Array
|
|
$admin_users=trim($user->R428ADMUSR);
|
|
}
|
|
if(trim($user->R428PWRUSR)=="Y") {
|
|
# Different logic from Qinclude version : this not an Array
|
|
$power_users=trim($user->R428PWRUSR);
|
|
}
|
|
if(trim($user->R42811A)=="C") {
|
|
$csr="Y";
|
|
}
|
|
if(trim($user->R42821A)=="Y") {
|
|
$execUser="Y";
|
|
}
|
|
$UserCO = $user->R428CO;
|
|
$UserWHS = $user->R428WH;
|
|
$UserPL = $user->R428PL;
|
|
}
|
|
|
|
# Get current WHS
|
|
if ($UserCO !== '' && $UserPL !== '' && $UserWHS !== '' && \Illuminate\Support\Facades\Schema::connection($m3Connection)->hasTable('ic670m')) {
|
|
$IC670M = DB::connection(config('m3.connection', 'pgsql'))->table('ic670m')
|
|
->select('WDWNAM')
|
|
->where('WDCO', $UserCO)
|
|
->where('WDPL', $UserPL)
|
|
->where('WDWHS', $UserWHS)
|
|
->first();
|
|
$WDWNAM = isset($IC670M->WDWNAM) ? trim($IC670M->WDWNAM) : '';
|
|
$IC670MAllWHS = DB::connection(config('m3.connection', 'pgsql'))->table('ic670m')->get();
|
|
}
|
|
|
|
# Get the current route information
|
|
$route = app('request')->route();
|
|
// dump($route);
|
|
$pdfURL = str_ends_with($route?->uri() ?? '', 'M3GetPDFFromCache');
|
|
// dump("CSR:".$csr .' SDA:'.$pdfURL);
|
|
|
|
$callingProgramPacking = app('request')->request->get('callingProgram')=='Packing' ? true : false;
|
|
// dump($callingProgramPacking);
|
|
@endphp
|
|
|
|
<x-layouts.app :title="trim($__env->yieldContent('title', 'M3'))">
|
|
<div class="m3-core-page" data-m3-module>
|
|
@include('m3::liberty-theme.partials.styles')
|
|
<link href="{{ route('m3.assets', ['path' => 'liberty-theme/css/m3-core-shell.css']) }}" rel="stylesheet" />
|
|
|
|
<div class="m3-core-header">
|
|
<div>
|
|
<p class="m3-core-eyebrow">M3 INTEGRATION</p>
|
|
<h1 class="m3-core-title">@yield('title', 'M3')</h1>
|
|
@if($WDWNAM !== '')
|
|
<p class="m3-core-context">{{ $WDWNAM }}</p>
|
|
@endif
|
|
</div>
|
|
<div class="m3-core-actions">@yield('btn')</div>
|
|
</div>
|
|
|
|
@hasSection('breadcrumb')
|
|
<div class="m3-core-breadcrumb">@yield('breadcrumb')</div>
|
|
@endif
|
|
|
|
<section class="m3-core-content">
|
|
@if($csr === '' || ($csr === 'Y' && $pdfURL))
|
|
@yield('content')
|
|
@else
|
|
<div class="m3-core-alert">403 - Unauthorized</div>
|
|
@endif
|
|
</section>
|
|
|
|
@include('m3::liberty-theme.partials.scripts')
|
|
@yield('scripts')
|
|
</div>
|
|
</x-layouts.app>
|