Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sarun Mungthanya
SpnPatch-Laravel
Commits
6dc508e0
Commit
6dc508e0
authored
Dec 03, 2024
by
Sarun Mungthanya
Browse files
add new file master file patch , download manual response
parent
5f039424
Changes
43
Show whitespace changes
Inline
Side-by-side
app/Http/Controllers/MasterFileController.php
View file @
6dc508e0
...
@@ -2,108 +2,265 @@
...
@@ -2,108 +2,265 @@
namespace
App\Http\Controllers
;
namespace
App\Http\Controllers
;
use
App\Models\ConfFormatFile
;
use
Carbon\Carbon
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Storage
;
use
Illuminate\Support\Facades\Storage
;
use
Illuminate\Support\Facades\Http
;
use
Illuminate\Support\Facades\Http
;
use
Illuminate\Support\Facades\Log
;
class
MasterFileController
extends
Controller
class
MasterFileController
extends
Controller
{
{
public
function
index
()
public
function
index
()
{
{
$menu
=
'MasterFile'
;
$menu
=
'MasterFile'
;
$currentContent
=
'MasterFile'
;
$currentContent
=
'MasterFile'
;
return
view
(
'home'
,
compact
(
'menu'
,
'currentContent'
));
return
view
(
'home'
,
compact
(
'menu'
,
'currentContent'
));
}
}
public
function
processFile
(
Request
$request
)
public
function
createPatch
(
Request
$request
)
{
{
// Ensure the file is uploaded
// $request->validate([
if
(
!
$request
->
hasFile
(
'data'
)
||
!
$request
->
file
(
'data'
)
->
isValid
())
{
// 'format_file_id' => 'required|exists:conf_format_file,formatservice_ID',
return
redirect
()
->
back
()
->
with
(
'error'
,
'Invalid file upload.'
);
// 'file' => 'required|file|max:12209752',
}
// 'limit' => 'nullable|integer',
// Get file details
// 'noLimit' => 'nullable|boolean',
// Get file details
// 'genWithSmartUpdate' => 'nullable|boolean',
$file
=
$request
->
file
(
'data'
);
// 'createPatch' => 'nullable|boolean',
// 'sendToEec' => 'nullable|boolean',
// ]);
$file
=
$request
->
file
(
'file'
);
$filePath
=
$file
->
getRealPath
();
$filePath
=
$file
->
getRealPath
();
$filename
=
$file
->
getClientOriginalName
();
$fileFormat
=
ConfFormatFile
::
where
(
'formatservice_ID'
,
$request
->
format_file_id
)
->
first
();
// Get file details
$jsonFilePath
=
storage_path
(
str_replace
(
".inc"
,
".json"
,
$fileFormat
->
file
));
$timestampEEC
=
now
()
->
format
(
'Y-m-d'
);
$actDateTime
=
now
()
->
format
(
'Y-m-d H:i:s'
);
if
(
!
file_exists
(
$jsonFilePath
))
{
return
redirect
()
->
back
()
->
withErrors
([
'error'
=>
'Format JSON file not found.'
]);
// Fetch format name
}
$format
=
$request
->
input
(
'format'
);
$config
=
DB
::
table
(
'conf_format_file'
)
$formatData
=
json_decode
(
file_get_contents
(
$jsonFilePath
),
true
);
->
where
(
'file'
,
$format
)
$message
=
''
;
->
whereNotNull
(
'ac'
)
->
first
();
if
(
$request
->
createPatch
)
{
$sqlPackAll
=
$this
->
readTxt
(
$filePath
,
$formatData
,
$fileFormat
,
$request
->
limit
,
$request
->
noLimit
);
if
(
!
$config
)
{
return
redirect
()
->
back
()
->
with
(
'error'
,
'MasterFile Not config to EEC'
);
$this
->
processPatches
(
$sqlPackAll
,
$fileFormat
,
$request
->
genWithSmartUpdate
);
}
$message
.
=
'Patch master file created successfully. '
;
// Get file details
}
$typeEEC
=
$config
->
ac
;
// eval('asdasd');
if
(
$request
->
sendToEec
&&
!
empty
(
$fileFormat
->
ac
))
{
// Send file to EEC if applicable
$timestamp
=
Carbon
::
now
()
->
toDateString
();
if
(
$request
->
input
(
'sendtoeec'
)
===
'on'
&&
!
empty
(
$typeEEC
))
{
$response
=
$this
->
sendMasterFileToEcc
(
config
(
'services.eec.url'
),
[
$response
=
Http
::
attach
(
'file'
,
fopen
(
$filePath
,
'r'
),
$filename
)
'type'
=>
$fileFormat
->
ac
,
->
post
(
env
(
'URL_MASTERFILE_EEC'
),
[
'file'
=>
fopen
(
$filePath
,
'r'
),
'type'
=>
$typeEEC
,
'timestamp'
=>
$timestamp
,
'timestamp'
=>
$timestampEEC
,
]);
]);
$respStatus
=
$response
->
status
();
$responseStatus
=
$response
->
status
();
$respData
=
$response
->
body
();
$responseData
=
$response
->
json
();
DB
::
table
(
'ecc_transactions'
)
->
insert
([
$this
->
keepTransactionToEcc
(
auth
()
->
id
(),
$fileFormat
->
ac
,
$file
->
getClientOriginalName
(),
json_encode
([
'uid'
=>
$request
->
input
(
'UID'
),
'type'
=>
$fileFormat
->
ac
,
'type_eec'
=>
$typeEEC
,
'timestamp'
=>
$timestamp
,
'filename'
=>
$filename
,
]),
Carbon
::
now
(),
$responseStatus
,
json_encode
(
$responseData
));
'request_data'
=>
json_encode
([
'type'
=>
$typeEEC
,
$message
.
=
'Send to EEC successfully.'
;
'file'
=>
$filename
,
}
'timestamp'
=>
$timestampEEC
,
]),
return
redirect
()
->
route
(
'patch.index'
)
->
with
(
'message'
,
$message
);
'act_datetime'
=>
$actDateTime
,
}
'response_status'
=>
$respStatus
,
'response_data'
=>
$respData
,
private
function
sendMasterFileToEcc
(
$url
,
$postData
)
{
return
Http
::
attach
(
'file'
,
$postData
[
'file'
])
->
asMultipart
()
->
post
(
$url
,
[
'type'
=>
$postData
[
'type'
],
'timestamp'
=>
$postData
[
'timestamp'
],
]);
]);
}
if
(
$respStatus
===
200
)
{
private
function
keepTransactionToEcc
(
$uid
,
$type
,
$filename
,
$requestData
,
$datetime
,
$responseStatus
,
$responseData
)
return
redirect
()
->
back
()
->
with
(
'success'
,
'Send MasterFile To EEC'
);
{
}
else
{
DB
::
table
(
'log_send_master2eec'
)
->
insert
([
return
redirect
()
->
back
()
->
with
(
'error'
,
'Cannot Send MasterFile To EEC'
);
'UID'
=>
$uid
,
'TYPE'
=>
$type
,
'FILENAME'
=>
$filename
,
'REQDATA'
=>
$requestData
,
'ACTDATETIME'
=>
$datetime
,
'RESPSTATUS'
=>
$responseStatus
,
'RESPDATA'
=>
$responseData
,
]);
}
private
function
processPatches
(
$sqlPackAll
,
$fileFormat
,
$genWithSmartUpdate
)
{
$uid
=
auth
()
->
id
();
$nameFormat
=
$fileFormat
->
name
??
'Unknown Format'
;
$level
=
"Critical"
;
$date
=
Carbon
::
now
();
foreach
(
$sqlPackAll
as
$index
=>
$sqlPack
)
{
$patchCode
=
$this
->
generatePatchCode
(
$sqlPack
,
$genWithSmartUpdate
);
$this
->
savePatch
(
$patchCode
,
$nameFormat
,
$level
,
$uid
,
$date
);
}
}
}
}
// Process file and create patches
private
function
generatePatchCode
(
$sqlPack
,
$genWithSmartUpdate
)
if
(
$request
->
input
(
'createpatch'
)
===
'on'
)
{
{
$data
=
$this
->
readTxt
(
$filePath
,
$format
,
$request
->
input
(
'ac'
),
$request
->
input
(
'sizerow'
),
$request
->
input
(
'notsplit'
));
$all64
=
base64_encode
(
gzcompress
(
iconv
(
'UTF-8'
,
'TIS-620'
,
var_export
(
$sqlPack
,
true
))));
$patchCode
=
"
\$
ALL64=
\"
{
$all64
}
\"
;
\n
"
;
if
(
$genWithSmartUpdate
)
{
$patchCode
.
=
"
\$
ALLVAR=gzuncompress(spnsmartupdatedecode(
\$
ALL64));
\n
"
;
}
else
{
$patchCode
.
=
"
\$
ALLVAR=gzuncompress(base64_decode(
\$
ALL64));
\n
"
;
}
foreach
(
$data
as
$key
=>
$sqlPack
)
{
return
$patchCode
;
$patchCode
=
$this
->
generatePatchCode
(
$sqlPack
);
}
private
function
savePatch
(
$patchCode
,
$nameFormat
,
$level
,
$uid
,
$date
)
{
DB
::
table
(
'conf_smartupdate'
)
->
insert
([
DB
::
table
(
'conf_smartupdate'
)
->
insert
([
'patchname'
=>
"Update Master File
{
$config
->
name
}
วันที่ "
.
now
()
->
format
(
'j'
)
.
' เดือน '
.
now
()
->
format
(
'n'
)
.
' ปี '
.
now
()
->
format
(
'Y'
)
.
' Part '
.
(
$key
+
1
),
'PATCHNAME'
=>
"Update Master File
{
$nameFormat
}
"
.
$date
->
toFormattedDateString
(),
'pdate'
=>
now
(),
'PDATE'
=>
$date
,
'plevel'
=>
'Critical'
,
'PLEVEL'
=>
$level
,
'pcode'
=>
'SHIPPINGNET'
,
'PCODE'
=>
'SHIPPINGNET'
,
'major_version'
=>
'ALL'
,
'PDESC'
=>
$nameFormat
,
'pdesc'
=>
$config
->
name
,
'POWNER'
=>
$uid
,
'powner'
=>
$request
->
input
(
'UID'
),
'PTYPE'
=>
'UPDATE MASTER'
,
'ptype'
=>
'UPDATE MASTER'
,
'PATCHCODE'
=>
iconv
(
"UTF-8"
,
"TIS-620"
,
$patchCode
),
'papprovedate'
=>
now
(),
'patchcode'
=>
$patchCode
,
'uninstall'
=>
'DONE=1;'
,
'patchcode_server'
=>
'DONE=1;'
,
]);
]);
}
}
return
redirect
()
->
back
()
->
with
(
'success'
,
'Successful Created Patch.'
);
private
function
readTxt
(
$filePath
,
$formatData
,
$ac
,
$limit
=
10000
,
$noLimit
=
false
)
{
ini_set
(
'memory_limit'
,
'-1'
);
$sqlPackAll
=
[];
$count
=
0
;
$fileHandle
=
fopen
(
$filePath
,
"r"
);
while
(
!
feof
(
$fileHandle
))
{
$sqlPack
=
[];
$text
=
fgets
(
$fileHandle
);
try
{
$text
=
iconv
(
'TIS-620'
,
'UTF-8'
,
$text
);
}
catch
(
\
Throwable
$th
)
{
$encoding
=
mb_detect_encoding
(
$text
,
[
'UTF-8'
,
'ISO-8859-1'
,
'ASCII'
],
true
);
$text
=
iconv
(
$encoding
,
'UTF-8'
,
$text
);
}
$X
=
$Y
=
$Z
=
0
;
$primaryKeyConditions
=
[];
foreach
(
$formatData
[
'primary_key'
]
as
$keyIndex
=>
$primaryKey
)
{
$fieldFormat
=
$formatData
[
'format'
][
$keyIndex
];
$type
=
$fieldFormat
[
'TYPE'
];
if
(
strpos
(
$type
,
'DE'
)
!==
false
)
{
$type
=
str_replace
(
'DE'
,
''
,
$type
);
$type
=
(
int
)
$type
+
1
;
}
$type
=
(
int
)
filter_var
(
$type
,
FILTER_SANITIZE_NUMBER_INT
);
$fieldValue
=
mb_substr
(
$text
,
$Y
,
$type
,
'UTF-8'
);
$Y
+=
$type
;
if
(
$fieldFormat
[
'FORMAT'
]
===
'date'
)
{
$fieldValue
=
$this
->
convertDate
(
$fieldValue
);
}
$primaryKeyConditions
[]
=
$primaryKey
[
'FILD'
]
.
" = '"
.
trim
(
$fieldValue
)
.
"'"
;
}
$select2
[]
=
" WHERE "
.
implode
(
' AND '
,
$primaryKeyConditions
);
$select
[]
=
"SELECT * FROM "
.
$formatData
[
'database'
]
.
" "
.
" WHERE "
.
implode
(
' AND '
,
$primaryKeyConditions
);
$insertFields
=
[];
$insertValues
=
[];
foreach
(
$formatData
[
'format'
]
as
$fieldFormat
)
{
$type
=
$fieldFormat
[
'TYPE'
];
if
(
strpos
(
$type
,
'DE'
)
!==
false
)
{
$type
=
str_replace
(
'DE'
,
''
,
$type
);
$type
=
(
int
)
$type
+
1
;
}
$type
=
(
int
)
filter_var
(
$type
,
FILTER_SANITIZE_NUMBER_INT
);
$fieldValue
=
mb_substr
(
$text
,
$X
,
$type
,
'UTF-8'
);
$X
+=
$type
;
if
(
$fieldFormat
[
'FORMAT'
]
===
'date'
)
{
$fieldValue
=
$this
->
convertDate
(
$fieldValue
);
}
$insertFields
[]
=
"`"
.
$fieldFormat
[
'FILD'
]
.
"`"
;
$insertValues
[]
=
"'"
.
str_replace
(
"'"
,
"''"
,
trim
(
$fieldValue
))
.
"'"
;
}
$insert
[]
=
"INSERT INTO "
.
$formatData
[
'database'
]
.
" ("
.
implode
(
','
,
$insertFields
)
.
") VALUES ("
.
implode
(
','
,
$insertValues
)
.
")"
;
$update
[]
=
$this
->
generateUpdateQuery
(
$formatData
[
'format'
],
$text
,
$Z
,
$formatData
[
'primary_key'
]);
$sqlPack
=
[
'insert'
=>
$insert
,
'update'
=>
$update
,
'select'
=>
$select
,
'select2'
=>
$select2
,
'DATABASE'
=>
$formatData
[
'database'
],
'counter'
=>
$count
+=
1
];
if
(
$count
>
$limit
)
{
$sqlPackAll
[]
=
$sqlPack
;
$count
=
0
;
unset
(
$sqlPack
);
}
}
fclose
(
$fileHandle
);
return
$sqlPackAll
;
}
private
function
generateUpdateQuery
(
$formatData
,
$text
,
&
$Z
,
$primaryKeys
)
{
$update
=
""
;
foreach
(
$formatData
as
$index
=>
$fieldFormat
)
{
$type
=
$fieldFormat
[
'TYPE'
];
if
(
strpos
(
$type
,
'DE'
)
!==
false
)
{
$type
=
str_replace
(
'DE'
,
''
,
$type
);
$type
=
(
int
)
$type
+
1
;
}
$type
=
(
int
)
filter_var
(
$type
,
FILTER_SANITIZE_NUMBER_INT
);
$fieldValue
=
mb_substr
(
$text
,
$Z
,
$type
,
'UTF-8'
);
$Z
+=
$type
;
if
(
$fieldFormat
[
'FORMAT'
]
===
'date'
)
{
$fieldValue
=
$this
->
convertDate
(
$fieldValue
);
}
if
(
!
in_array
(
$fieldFormat
[
'FILD'
],
array_column
(
$primaryKeys
,
'FILD'
)))
{
if
(
$update
!=
""
)
{
$update
.
=
", "
;
}
$update
.
=
"`"
.
$fieldFormat
[
'FILD'
]
.
"` = '"
.
str_replace
(
"'"
,
"''"
,
trim
(
$fieldValue
))
.
"'"
;
}
}
}
return
redirect
()
->
back
()
->
with
(
'error'
,
'File processing failed.'
)
;
return
$update
;
}
}
}
}
app/Http/Livewire/Pages/ManualResponse/ManualResponse.php
View file @
6dc508e0
...
@@ -13,13 +13,14 @@ use App\Models\ManualResponse\MasterResponseTemplates;
...
@@ -13,13 +13,14 @@ use App\Models\ManualResponse\MasterResponseTemplates;
use
App\Models\ManualResponse\MasterDocTypes
;
use
App\Models\ManualResponse\MasterDocTypes
;
use
App\Models\ManualResponse\TabManualResponseLog
;
use
App\Models\ManualResponse\TabManualResponseLog
;
use
App\Models\ManualResponse\UsersConnectSpn
;
use
App\Models\ManualResponse\UsersConnectSpn
;
use
App\Models\MasterResponseMessageType
;
use
Carbon\Carbon
;
use
Carbon\Carbon
;
use
CURLFile
;
use
CURLFile
;
class
ManualResponse
extends
Component
class
ManualResponse
extends
Component
{
{
public
$displayCustomizeDiv
=
false
;
public
$displayCustomizeDiv
=
false
;
public
$masterMsg
,
$showSearch
;
public
$messageTypes
=
[];
public
$messageTypes
=
[];
public
$messageId
;
public
$messageId
;
public
$responseTemplates
=
[];
public
$responseTemplates
=
[];
...
@@ -307,4 +308,40 @@ class ManualResponse extends Component
...
@@ -307,4 +308,40 @@ class ManualResponse extends Component
}
}
return
true
;
return
true
;
}
}
public
function
downloadXML
(){
$tempCode
=
MasterResponseTemplates
::
find
(
$this
->
templateId
);
$fileName
=
$this
->
xmlData
[
'DeclarationNumber'
]
??
''
.
'-'
.
$tempCode
->
code
.
'-'
.
str_replace
(
"/"
,
"-"
,
$this
->
xmlData
[
'Message'
])
.
'.xml'
;
$xmlContent
=
$this
->
xmlContent
;
\
Storage
::
disk
(
'public'
)
->
put
(
$fileName
,
$xmlContent
);
$this
->
emit
(
'fileManualDownload'
,
asset
(
'storage/'
.
$fileName
));
}
public
function
selectMessage
(
$masterMsgId
)
{
$message
=
MasterResponseMessageType
::
where
(
'id'
,
$masterMsgId
)
->
first
();
$this
->
xmlData
[
"Message"
]
=
$message
->
message
;
$this
->
reGenerateXML
();
$this
->
showSearch
=
false
;
}
public
function
updatedXmlData
(
$value
,
$key
)
{
if
(
$key
===
'Message'
)
{
$this
->
showSearch
=
true
;
$tempCode
=
MasterResponseTemplates
::
find
(
$this
->
templateId
);
$tempDoc
=
MasterMessages
::
find
(
$this
->
messageId
);
if
(
$tempCode
&&
$tempDoc
)
{
$message
=
MasterResponseMessageType
::
where
(
'doctype'
,
strtoupper
(
$tempDoc
->
name
))
->
where
(
'codestatus'
,
$tempCode
->
code
)
->
where
(
'message'
,
'like'
,
'%'
.
$value
.
'%'
)
->
get
();
}
else
{
$message
=
collect
();
// Return an empty collection if no data is found
}
$this
->
masterMsg
=
$message
;
}
}
}
}
app/Http/Livewire/Pages/Patch/PatchMasterFile.php
View file @
6dc508e0
...
@@ -9,21 +9,26 @@ use Illuminate\Support\Facades\DB;
...
@@ -9,21 +9,26 @@ use Illuminate\Support\Facades\DB;
use
Illuminate\Support\Facades\Http
;
use
Illuminate\Support\Facades\Http
;
use
Livewire\WithFileUploads
;
use
Livewire\WithFileUploads
;
use
Illuminate\Http\UploadedFile
;
use
Facades\Livewire\GenerateSignedUploadUrl
;
use
Illuminate\Validation\ValidationException
;
use
Livewire\Exceptions\S3DoesntSupportMultipleFileUploads
;
use
Livewire\FileUploadConfiguration
;
use
Illuminate\Support\Facades\Storage
;
use
Livewire\TemporaryUploadedFile
;
use
App\Traits\CustomTemporaryFileUpload
;
class
PatchMasterFile
extends
Component
class
PatchMasterFile
extends
Component
{
{
use
WithFileUploads
;
use
WithFileUploads
;
use
CustomTemporaryFileUpload
;
public
$file
,
$format_file_id
,
$messages
,
$formatFile
,
$limit
,
$noLimit
,
$genPatch
,
$createPatch
=
false
,
$sendToEec
=
false
,
$genWithSmartUpdate
=
false
;
public
$file
,
$format_file_id
,
$messages
,
$formatFile
,
$limit
,
$noLimit
,
$genPatch
,
$createPatch
=
false
,
$sendToEec
=
false
,
$genWithSmartUpdate
=
false
;
protected
$formatFiles
;
protected
$formatFiles
;
protected
$rules
=
[
protected
$rules
=
[
'name'
=>
'required|string|max:255'
,
'name'
=>
'required|string|max:255'
,
//
'files.*' => 'required|file|max:1
00000
',
'files.*'
=>
'required|file|max:1
2209752
'
,
];
];
public
function
mount
()
{
}
public
function
createPatch
()
public
function
createPatch
()
{
{
...
...
app/Models/MasterResponseMessageType.php
0 → 100644
View file @
6dc508e0
<?php
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Factories\HasFactory
;
use
Illuminate\Database\Eloquent\Model
;
class
MasterResponseMessageType
extends
Model
{
use
HasFactory
;
protected
$connection
=
'localhost'
;
protected
$table
=
'master_responsemessagetype'
;
}
config/database.php
View file @
6dc508e0
...
@@ -64,6 +64,27 @@ return [
...
@@ -64,6 +64,27 @@ return [
])
:
[],
])
:
[],
],
],
'localhost'
=>
[
'driver'
=>
'mysql'
,
'url'
=>
env
(
'DATABASE_URL_LOCAL'
),
'host'
=>
env
(
'DB_HOST_LOCAL'
,
'127.0.0.1'
),
'port'
=>
env
(
'DB_PORT_LOCAL'
,
'3306'
),
'database'
=>
env
(
'DB_DATABASE_LOCAL'
,
'forge'
),
'username'
=>
env
(
'DB_USERNAME_LOCAL'
,
'forge'
),
'password'
=>
env
(
'DB_PASSWORD_LOCAL'
,
''
),
'unix_socket'
=>
env
(
'DB_SOCKET'
,
''
),
'charset'
=>
'utf8'
,
'collation'
=>
'utf8_general_ci'
,
'prefix'
=>
''
,
'prefix_indexes'
=>
true
,
'strict'
=>
false
,
'engine'
=>
null
,
'options'
=>
extension_loaded
(
'pdo_mysql'
)
?
array_filter
([
PDO
::
MYSQL_ATTR_SSL_CA
=>
env
(
'MYSQL_ATTR_SSL_CA'
),
PDO
::
ATTR_PERSISTENT
=>
true
,
])
:
[],
],
'pgsql'
=>
[
'pgsql'
=>
[
'driver'
=>
'pgsql'
,
'driver'
=>
'pgsql'
,
'url'
=>
env
(
'DATABASE_URL'
),
'url'
=>
env
(
'DATABASE_URL'
),
...
...
resources/views/components/app-layout.blade.php
View file @
6dc508e0
...
@@ -62,6 +62,12 @@
...
@@ -62,6 +62,12 @@
{{ $script }}
{{ $script }}
@endisset
@endisset
@yield('script')
@yield('script')
<script>
console
.
log
(
"
ddd
"
)
Livewire
.
on
(
'
fileDownloaded
'
,
(
url
)
=>
{
window
.
location
.
href
=
url
;
});
</script>
</body>
</body>
</html>
</html>
resources/views/home.blade.php
View file @
6dc508e0
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
x-transition:enter-start=
"opacity-0 -translate-x-full"
x-transition:enter-end=
"opacity-100 translate-x-0"
x-transition:enter-start=
"opacity-0 -translate-x-full"
x-transition:enter-end=
"opacity-100 translate-x-0"
x-transition:leave=
"transition ease-in duration-300 transform"
x-transition:leave=
"transition ease-in duration-300 transform"
x-transition:leave-start=
"opacity-100 translate-x-0"
x-transition:leave-end=
"opacity-0 -translate-x-full"
>
x-transition:leave-start=
"opacity-100 translate-x-0"
x-transition:leave-end=
"opacity-0 -translate-x-full"
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
class=
"h-6 w-6"
fill=
"black"
viewBox=
"0 0 24 24"
stroke=
"black"
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
x-show=
"!sidebarOpen"
class=
"h-6 w-6"
fill=
"black"
viewBox=
"0 0 24 24"
stroke=
"black"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M4 6h16M4 12h16m-7 6h7"
/>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M4 6h16M4 12h16m-7 6h7"
/>
</svg>
</svg>
</button>
</button>
...
...
resources/views/livewire/main-container.blade.php
View file @
6dc508e0
<div
class=
"bg-main-container mt-1 z-0 w-full"
>
<div
class=
"bg-main-container mt-1 z-0 "
:class=
"sidebarOpen
?
(window.innerWidth < 1500 ? (window.innerWidth < 1300 ? 'w-[90%] justify-self-end' :
'w-[95%] justify-self-end') : 'w-full') :
'w-full'"
>
<link
href=
"{{ asset('css/pages/patch.css') }}"
rel=
"stylesheet"
>
<link
href=
"{{ asset('css/pages/patch.css') }}"
rel=
"stylesheet"
>
<div
wire:loading.delay
wire:loading.class.remove=
"hidden"
<div
wire:loading.delay
wire:loading.class.remove=
"hidden"
...
@@ -10,7 +15,6 @@
...
@@ -10,7 +15,6 @@
</div>
</div>
</div>
</div>
{{-- end loading --}}
{{-- end loading --}}
<div
wire:loading.remove
class=
"bg-main-container"
>
<div
wire:loading.remove
class=
"bg-main-container"
>
@switch($currentContent)
@switch($currentContent)
...
@@ -71,7 +75,8 @@
...
@@ -71,7 +75,8 @@
@break
@break
@case('MasterFile')
@case('MasterFile')
<livewire:pages.patch.patch-master-file
wire:init
/>
@include('patch.patch-master-file')
{{--
<livewire:pages.patch.patch-master-file
wire:init
/>
--}}
@break
@break
@case('FormatFileMaster')
@case('FormatFileMaster')
...
@@ -83,17 +88,14 @@
...
@@ -83,17 +88,14 @@
@break
@break
@case('ManualResponse')
@case('ManualResponse')
<livewire:pages.manual-response.manual-response/>
<livewire:pages.manual-response.manual-response
/>
@break
@break
@default
@default
@livewire('code-comparer')
@livewire('code-comparer')
@endswitch
@endswitch
<x-modals.alert-modal
name=
"alert-modal"
></x-modals.alert-modal>
<x-modals.alert-modal
name=
"alert-modal"
></x-modals.alert-modal>
</div>
</div>
<script>
// document.addEventListener('livewire:load', function () {
// $(".card").html("dddd")
// });
</script>
</div>
</div>
resources/views/livewire/pages/manual-response/manual-response-index.blade.php
View file @
6dc508e0
...
@@ -96,16 +96,41 @@
...
@@ -96,16 +96,41 @@
<div
class=
"w-4/12"
>
<div
class=
"w-4/12"
>
<div
class=
"w-12/12 py-1"
>
<div
class=
"w-12/12 py-1"
>
@foreach ($xmlData as $key => $value)
@foreach ($xmlData as $key => $value)
@if ($key == 'Message')
<label
class=
"block"
>
<label
class=
"block"
>
<span
class=
"text-sm font-medium text-slate-700"
>
{{ $key }}
</span>
<span
class=
"text-sm font-medium text-slate-700"
>
{{ $key }}
</span>
<span
class=
"relative mt-1.5 mb-1.5 flex"
>
<span
class=
"relative mt-1.5 mb-1.5 flex"
>
<input
<input
class=
"form-input peer w-full rounded-lg border border-slate-300 px-3 py-2 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
class=
"form-input peer w-full rounded-lg border border-slate-300 px-3 py-2 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
type=
"text"
id=
"{{ $key }}"
type=
"text"
id=
"{{ $key }}"
wire:model=
"xmlData.{{ $key }}"
value=
"{{ $value }}"
wire:model=
"xmlData.{{ $key }}"
value=
"{{ $value }}"
autocomplete=
"off"
/>
@if (!empty($masterMsg)
&&
$showSearch)
<ul
class=
"z-50 border border-gray-200 top-8 rounded-md max-h-64 w-full overflow-auto absolute bg-white mt-1"
>
@forelse ($masterMsg as $m)
<li
class=
"p-2 hover:bg-gray-100 cursor-pointer"
wire:click=
"selectMessage('{{ $m->id }}')"
>
{{ $m->message }}
</li>
@empty
<li
class=
"p-2 text-gray-500"
>
No results found
</li>
@endforelse
</ul>
@endif
</span>
</label>
@else
<label
class=
"block"
>
<span
class=
"text-sm font-medium text-slate-700"
>
{{ $key }}
</span>
<span
class=
"relative mt-1.5 mb-1.5 flex"
>
<input
class=
"form-input peer w-full rounded-lg border border-slate-300 px-3 py-2 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent"
type=
"text"
id=
"{{ $key }}"
wire:model=
"xmlData.{{ $key }}"
value=
"{{ $value }}"
autocomplete=
"off"
/>
autocomplete=
"off"
/>
</span>
</span>
</label>
</label>
@endif
@endforeach
@endforeach
</div>
</div>
</div>
</div>
...
@@ -115,13 +140,14 @@
...
@@ -115,13 +140,14 @@
</div>
</div>
<div
class=
"bg-gray-100 p-4 rounded-lg"
>
<div
class=
"bg-gray-100 p-4 rounded-lg"
>
<!-- Highlight.js Code Block -->
<!-- Highlight.js Code Block -->
<pre
class=
"is-scrollbar-hidden max-h-96 overflow-auto rounded-lg"
x-data
x-init=
"hljs.highlightElement($el);"
><code
class=
"xml"
>
{{ $xmlContent }}
</code></pre>
<pre
class=
"is-scrollbar-hidden max-h-96 overflow-auto rounded-lg
p-4
"
x-data
x-init=
"hljs.highlightElement($el);"
><code
class=
"xml"
>
{{ $xmlContent }}
</code></pre>
</div>
</div>
<div
class=
"flex justify-center items-center pt-1"
>
<div
class=
"flex justify-center items-center pt-1"
>
<button
<button
class=
"bg-slate-150 font-medium text-slate-800 hover:bg-slate-200 focus:bg-slate-200 active:bg-slate-200/80 rounded-md border border-[#e5e7eb] py-2 px-4 mr-1"
class=
"bg-slate-150 font-medium text-slate-800 hover:bg-slate-200 focus:bg-slate-200 active:bg-slate-200/80 rounded-md border border-[#e5e7eb] py-2 px-4 mr-1"
wire:click=
"reGenerateXML"
>
wire:click=
"reGenerateXML"
>
<i
class=
"fa-solid fa-rotate mr-1"
></i>
Reload XML
</button>
<i
class=
"fa-solid fa-rotate mr-1"
></i>
Reload XML
</button>
<button
class=
"bg-slate-150 font-medium text-slate-800 hover:bg-slate-200 focus:bg-slate-200 active:bg-slate-200/80 rounded-md border border-[#e5e7eb] py-2 px-4 mr-1"
wire:click=
"downloadXML"
><i
class=
"fa fa-download mr-1"
aria-hidden=
"true"
></i>
Download File
</button>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -133,4 +159,16 @@
...
@@ -133,4 +159,16 @@
@endif
@endif
@include('livewire.loading-component', ['action' => 'generateAndUploadXml, messageId'])
@include('livewire.loading-component', ['action' => 'generateAndUploadXml, messageId'])
</div>
</div>
<script>
document
.
addEventListener
(
'
livewire:load
'
,
()
=>
{
Livewire
.
on
(
'
fileManualDownload
'
,
(
url
)
=>
{
const
link
=
document
.
createElement
(
'
a
'
);
link
.
href
=
url
;
link
.
setAttribute
(
'
download
'
,
''
);
document
.
body
.
appendChild
(
link
);
link
.
click
();
document
.
body
.
removeChild
(
link
);
});
});
</script>
</div>
</div>
resources/views/livewire/pages/patch/patch-index.blade.php
View file @
6dc508e0
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
<div
class=
"mx-3 mt-3"
>
<div
class=
"mx-3 mt-3"
>
<div
class=
"is-scrollbar-hidden min-w-full table-responsive"
x-data=
"pages.tables.initExample1"
>
<div
class=
"is-scrollbar-hidden min-w-full table-responsive"
x-data=
"pages.tables.initExample1"
>
<table
aria-describedby=
"mydesc"
class=
"is-hoverable table w-full text-left border-b"
>
<table
aria-describedby=
"mydesc"
class=
"is-hoverable table w-full text-left border-b
text-black
"
>
<thead>
<thead>
<tr>
<tr>
<th
scope=
"col"
<th
scope=
"col"
...
...
resources/views/livewire/pages/server-license/server-license-edit.blade.php
View file @
6dc508e0
<div
class=
"bg-main-container"
>
<div
class=
"bg-main-container"
>
<div
class=
"max-w-full mx-auto p-5 "
>
<div
class=
"max-w-full mx-auto p-5 "
>
{{--
<div
class=
"flex flex-wrap items-center"
>
--}}
<h2
class=
"text-2xl text-black "
>
Server License Management
</h2>
<a
type=
"button"
href=
"/server-license"
<a
type=
"button"
href=
"/server-license"
class=
"btn m-3 text-white bg-primary px-3 py-2 hover:bg-primary-focus"
>
Back
</a>
class=
"btn m-3 text-white bg-primary px-3 py-2 hover:bg-primary-focus"
>
Back
</a>
...
...
resources/views/patch/patch-master-file.blade.php
0 → 100644
View file @
6dc508e0
@
php
$formatFiles
=
App\Models\ConfFormatFile
::
all
();
@
endphp
<
div
class
=
"bg-main-container"
x
-
data
=
"{ notLimit: false }"
>
<
div
class
=
"max-w-full mx-auto p-6"
>
<
div
class
=
"flex justify-between items-center mb-6"
>
<
h2
class
=
"text-3xl font-semibold text-gray-800"
>
Patch
Master
File
</
h2
>
<
a
href
=
"/patch"
class
=
"btn text-white bg-primary px-4 py-2 rounded hover:bg-primary-focus"
>
Back
</
a
>
</
div
>
<
form
action
=
"{{ route('patch.master-file.create') }}"
method
=
"POST"
enctype
=
"multipart/form-data"
>
@
csrf
<
div
class
=
"bg-white p-6 rounded-lg shadow-md"
>
<
div
class
=
"mb-4"
>
<
label
for
=
"format_file_id"
class
=
"block text-gray-700 font-medium"
>
Choose
Format
File
</
label
>
<
select
id
=
"format_file_id"
name
=
"format_file_id"
class
=
"w-full mt-2 p-3 border border-gray-300 rounded-lg focus:ring-primary focus:border-primary"
>
@
foreach
(
$formatFiles
as
$format
)
<
option
value
=
"{{
$format->formatservice_ID
}}"
>
{{
$format
->
name
}}
</
option
>
@
endforeach
</
select
>
</
div
>
<
div
class
=
"mb-4"
>
<
label
for
=
"upload_file"
class
=
"block text-gray-700 font-medium"
>
Upload
File
Data
</
label
>
<
div
class
=
"flex items-center mt-2"
>
<!--
Loading
Spinner
-->
<
span
id
=
"loading-spinner"
class
=
"hidden"
>
<
svg
class
=
"animate-spin h-5 w-5 text-primary m-3"
xmlns
=
"http://www.w3.org/2000/svg"
fill
=
"none"
viewBox
=
"0 0 24 24"
>
<
circle
class
=
"opacity-25"
cx
=
"12"
cy
=
"12"
r
=
"10"
stroke
=
"currentColor"
stroke
-
width
=
"4"
></
circle
>
<
path
class
=
"opacity-75"
fill
=
"currentColor"
d
=
"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.964 7.964 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
>
</
path
>
</
svg
>
</
span
>
<
label
for
=
"file-upload"
class
=
"btn bg-gray-200 text-gray-800 hover:bg-gray-300 focus:bg-gray-300 active:bg-gray-300 dark:bg-gray-500 dark:text-gray-50 dark:hover:bg-gray-450 dark:focus:bg-gray-450 dark:active:bg-gray-450/90 relative"
>
<
input
tabindex
=
"-1"
id
=
"file-upload"
type
=
"file"
name
=
"file"
class
=
"absolute inset-0 h-full w-full opacity-0 cursor-pointer"
onchange
=
"handleFileUpload(event)"
/>
<
div
class
=
"flex items-center space-x-2"
>
<
svg
xmlns
=
"http://www.w3.org/2000/svg"
class
=
"w-5 h-5"
fill
=
"none"
viewBox
=
"0 0 24 24"
stroke
=
"currentColor"
>
<
path
stroke
-
linecap
=
"round"
stroke
-
linejoin
=
"round"
stroke
-
width
=
"2"
d
=
"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"
/>
</
svg
>
<
span
>
Choose
File
</
span
>
</
div
>
</
label
>
<
span
id
=
"file-name"
class
=
"ml-4 text-gray-600"
></
span
>
<
button
id
=
"remove-file"
type
=
"button"
class
=
"ml-4 text-red-500 hover:text-red-700 hidden"
onclick
=
"removeFile()"
>
<
i
class
=
"fa fa-remove"
></
i
>
Remove
File
</
button
>
</
div
>
@
error
(
'file'
)
<
span
class
=
"text-red-600 text-sm mt-2"
>
{{
$message
}}
</
span
>
@
enderror
</
div
>
<
div
class
=
"mb-4"
>
<
label
for
=
"limit_data"
class
=
"block text-gray-700 font-medium"
>
Limit
Data
per
Patch
</
label
>
<
select
id
=
"limit_data"
class
=
"w-full mt-2 p-3 border border-gray-300 rounded-lg focus:ring-primary focus:border-primary"
:
disabled
=
"notLimit"
name
=
"limit"
>
<
option
value
=
"10000"
>
10
,
000
</
option
>
<
option
value
=
"5000"
>
5
,
000
</
option
>
<
option
value
=
"3000"
>
3
,
000
</
option
>
<
option
value
=
"1000"
>
1
,
000
</
option
>
</
select
>
<
div
class
=
"mt-3"
>
<
label
class
=
"inline-flex items-center"
>
<
input
class
=
"form-checkbox is-basic h-4 w-4 rounded border-slate-400/70 checked:bg-primary checked:border-primary focus:bordark:bg-navy-900 dark:border-navy-500 dark:checked:bg-accent dark:checked:border-accent dark:hover:border-accent dark:focus:border-accent"
type
=
"checkbox"
name
=
"noLimit"
/>
<
span
class
=
"ml-2"
>
Not
Limit
</
span
>
</
label
>
</
div
>
</
div
>
<
div
class
=
"mb-4"
>
<
label
class
=
"inline-flex items-center"
>
<
input
name
=
"genWithSmartUpdate"
class
=
"form-checkbox is-basic h-4 w-4 rounded border-slate-400/70 checked:bg-primary checked:border-primary focus:border-primary dark:bg-navy-900 dark:border-navy-500 dark:checked:bg-accent dark:checked:border-accent dark:hover:border-accent dark:focus:border-accent"
type
=
"checkbox"
value
=
"checked"
>
<
span
class
=
"ml-2"
>
Gen
patch
ด
้
วย
function
spnsmartupdatedecode
</
span
>
</
label
>
</
div
>
<
div
class
=
"mb-4 flex items-center space-x-4"
>
<
label
class
=
"inline-flex items-center"
>
<
input
name
=
"createPatch"
class
=
"form-checkbox is-basic h-4 w-4 rounded border-slate-400/70 checked:bg-primary checked:border-primary focus:border-primary dark:bg-navy-900 dark:border-navy-500 dark:checked:bg-accent dark:checked:border-accent dark:hover:border-accent dark:focus:border-accent"
type
=
"checkbox"
value
=
"checked"
>
<
span
class
=
"ml-2"
>
Create
Patch
</
span
>
</
label
>
<
label
class
=
"inline-flex items-center"
>
<
input
name
=
"sendToEec"
class
=
"form-checkbox is-basic h-4 w-4 rounded border-slate-400/70 checked:bg-primary checked:border-primary focus:border-primary dark:bg-navy-900 dark:border-navy-500 dark:checked:bg-accent dark:checked:border-accent dark:hover:border-accent dark:focus:border-accent"
type
=
"checkbox"
value
=
"checked"
>
<
span
class
=
"ml-2"
>
Send
To
EEC
</
span
>
</
label
>
</
div
>
<
div
class
=
"text-right"
>
<
button
class
=
"bg-primary text-white px-4 py-2 rounded-md hover:bg-primary-focus focus:outline-none focus:ring-2 focus:ring-primary focus:ring-opacity-50"
type
=
"submit"
>
Create
Patch
</
button
>
</
div
>
</
div
>
</
form
>
</
div
>
</
div
>
<
script
>
function
handleFileUpload
(
event
)
{
const
fileInput
=
event
.
target
;
const
fileNameDisplay
=
document
.
getElementById
(
'file-name'
);
const
removeButton
=
document
.
getElementById
(
'remove-file'
);
const
loadingSpinner
=
document
.
getElementById
(
'loading-spinner'
);
loadingSpinner
.
classList
.
remove
(
'hidden'
);
if
(
fileInput
.
files
.
length
>
0
)
{
const
fileName
=
fileInput
.
files
[
0
]
.
name
;
fileNameDisplay
.
textContent
=
`Selected File: ${fileName}`
;
removeButton
.
classList
.
remove
(
'hidden'
);
}
else
{
fileNameDisplay
.
textContent
=
''
;
removeButton
.
classList
.
add
(
'hidden'
);
}
setTimeout
(()
=>
{
loadingSpinner
.
classList
.
add
(
'hidden'
);
},
1000
);
}
function
removeFile
()
{
const
fileInput
=
document
.
getElementById
(
'file-upload'
);
const
fileNameDisplay
=
document
.
getElementById
(
'file-name'
);
const
removeButton
=
document
.
getElementById
(
'remove-file'
);
fileInput
.
value
=
''
;
fileNameDisplay
.
textContent
=
''
;
removeButton
.
classList
.
add
(
'hidden'
);
}
</
script
>
routes/web.php
View file @
6dc508e0
...
@@ -63,6 +63,9 @@ Route::middleware(['auth' ])->group(function () {
...
@@ -63,6 +63,9 @@ Route::middleware(['auth' ])->group(function () {
Route
::
get
(
'/master-file'
,
[
MasterFileController
::
class
,
'index'
])
->
name
(
'master-file.index'
);
Route
::
get
(
'/master-file'
,
[
MasterFileController
::
class
,
'index'
])
->
name
(
'master-file.index'
);
Route
::
post
(
'/masterfile/create'
,
[
MasterFileController
::
class
,
'createPatch'
])
->
name
(
'patch.master-file.create'
);
Route
::
get
(
'/format-file-master'
,
[
FormatFileMasterContrller
::
class
,
'index'
])
->
name
(
'format-file-master.index'
);
Route
::
get
(
'/format-file-master'
,
[
FormatFileMasterContrller
::
class
,
'index'
])
->
name
(
'format-file-master.index'
);
Route
::
get
(
'/send-patch'
,
[
SendPatchController
::
class
,
'index'
]);
Route
::
get
(
'/send-patch'
,
[
SendPatchController
::
class
,
'index'
]);
Route
::
get
(
'/send-multi-patch'
,
[
SendPatchController
::
class
,
'indexMulti'
]);
Route
::
get
(
'/send-multi-patch'
,
[
SendPatchController
::
class
,
'indexMulti'
]);
...
...
storage/runtime/
json
/20100304111306rfpmg.json
→
storage/runtime/
format
/20100304111306rfpmg.json
View file @
6dc508e0
File moved
storage/runtime/
json
/20100304111306rfpmg_new.json
→
storage/runtime/
format
/20100304111306rfpmg_new.json
View file @
6dc508e0
File moved
storage/runtime/
json
/20100318161323reftrc.json
→
storage/runtime/
format
/20100318161323reftrc.json
View file @
6dc508e0
File moved
storage/runtime/
json
/20100318161400reftrs.json
→
storage/runtime/
format
/20100318161400reftrs.json
View file @
6dc508e0
File moved
storage/runtime/
json
/20100318161422refedr.json
→
storage/runtime/
format
/20100318161422refedr.json
View file @
6dc508e0
File moved
storage/runtime/
json
/20100318161441refidr.json
→
storage/runtime/
format
/20100318161441refidr.json
View file @
6dc508e0
File moved
storage/runtime/
json
/20101215190653201003181refdrt.json
→
storage/runtime/
format
/20101215190653201003181refdrt.json
View file @
6dc508e0
File moved
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment