182 lines
7.4 KiB
PHP
182 lines
7.4 KiB
PHP
@php
|
|
# Get Current USER
|
|
$loggedUser = strtoUpper(m3_user());
|
|
|
|
$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
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
|
<meta name="description" content="" />
|
|
<meta name="author" content="" />
|
|
<meta name="csrf-token" content="{{ csrf_token() }}" />
|
|
<title>@yield('title') - {{ config('app.name', 'WMS') }}</title>
|
|
|
|
{{-- Use Core's favicon set so M3 keeps the same browser identity as WMS. --}}
|
|
<link rel="icon" href="{{ asset('favicons/favicon.ico') }}" sizes="any">
|
|
<link rel="icon" href="{{ asset('favicons/favicon.svg') }}" type="image/svg+xml">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="{{ asset('favicons/favicon-32x32.png') }}">
|
|
<link rel="icon" type="image/png" sizes="192x192" href="{{ asset('favicons/favicon-192x192.png') }}">
|
|
<link rel="apple-touch-icon" sizes="180x180" href="{{ asset('favicons/apple-touch-icon.png') }}">
|
|
<link rel="manifest" href="{{ asset('favicons/site.webmanifest') }}">
|
|
<meta name="application-name" content="{{ config('app.name') }}">
|
|
<meta name="apple-mobile-web-app-title" content="{{ config('app.name') }}">
|
|
<meta name="msapplication-config" content="{{ asset('favicons/browserconfig.xml') }}">
|
|
|
|
{{-- Load the same locally managed font family used by Core. --}}
|
|
@fonts
|
|
@include('m3::liberty-theme.partials.styles')
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/js/all.min.js" crossorigin="anonymous"></script>
|
|
</head>
|
|
<body class="sb-nav-fixed">
|
|
@include('m3::liberty-theme.partials.top-navigation')
|
|
<div id="layoutSidenav">
|
|
@if ( !($pdfURL && $callingProgramPacking))
|
|
@include('m3::liberty-theme.partials.left-navigation')
|
|
@endif
|
|
|
|
<div id="layoutSidenav_content">
|
|
<main>
|
|
<div id="page-wrapper">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
@yield('breadcrumb')
|
|
</div>
|
|
<div class="page-btn">
|
|
@yield('btn')
|
|
</div>
|
|
<!-- /.col-lg-12 -->
|
|
</div>
|
|
<!-- /.row -->
|
|
@if( $csr=='')
|
|
@yield('content')
|
|
@elseif( $csr=='Y' && $pdfURL)
|
|
@yield('content')
|
|
@else
|
|
{!! '<h1 class="text-center">403 - Unauthorized</h1>' !!}
|
|
@endif
|
|
<!-- /.container-fluid -->
|
|
</div>
|
|
</div>
|
|
<!-- /#page-wrapper -->
|
|
</main>
|
|
<footer class="py-4 bg-light mt-auto">
|
|
@include('m3::liberty-theme.partials.footer')
|
|
</footer>
|
|
</div>
|
|
</div>
|
|
@include('m3::liberty-theme.partials.scripts')
|
|
@yield('scripts')
|
|
</body>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
$("#R428DPWSel").on('change', function() {
|
|
var R428DPW = $(this).val();
|
|
var R428US = '{{ $loggedUser }}';
|
|
var currentWHS = $(this).find('option:selected').text();
|
|
// console.log(R428DPW);
|
|
// console.log(R428US);
|
|
|
|
var form_post2 = {
|
|
R428DPW : R428DPW,
|
|
R428US : R428US,
|
|
_token : '{{ csrf_token() }}'
|
|
};
|
|
// console.log(form_post2);
|
|
|
|
$.ajax({
|
|
url: "{{ route('m3.userprofileupdateajax') }}",
|
|
type: "POST",
|
|
data: form_post2,
|
|
success: function(response) {
|
|
if(response.success==true){
|
|
Swal.fire({
|
|
title: "Warehouse changed successfully",
|
|
text: "",
|
|
icon: "success",
|
|
confirmButtonColor: "#3085d6"
|
|
}).then((result) => {
|
|
if (result.isConfirmed) {
|
|
window.location.reload();
|
|
}
|
|
});
|
|
|
|
// Swal.fire('Warehouse changed successfully');
|
|
// $("#currentWHSPAN").html(currentWHS);
|
|
}
|
|
else{
|
|
Swal.fire('Warehouse change Failed');
|
|
}
|
|
},
|
|
error: function(error) {
|
|
// console.log(error);
|
|
// alert(error);
|
|
}
|
|
});
|
|
|
|
});
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
</html> |