feat: implement global settings management with database defaults and admin UI configuration

This commit is contained in:
Ümit Tunç
2026-04-28 22:16:10 +03:00
parent 6c0987b90e
commit d57e83cb76
6 changed files with 74 additions and 31 deletions
@@ -31,8 +31,6 @@ if (getisset("update")) {
@csrf
{{e2("Project Name")}}:
<input type="text" name="project_name" value="{{setting('project_name')}}" class="form-control" id="">
{{e2("Project Russian Name ")}}:
<input type="text" name="project_name_ru" value="{{setting('project_name_ru')}}" class="form-control" id="">
{{e2("Project Number")}}:
<input type="text" name="project_number" value="{{setting('project_number')}}" class="form-control" id="">
{{e2("Company Code")}}:
@@ -1,48 +1,44 @@
<?php
if(getisset("update")) {
foreach($_POST AS $key => $value) {
if (getisset("update")) {
foreach ($_POST as $key => $value) {
if (is_array($value)) {
$value = json_encode($value, JSON_UNESCAPED_UNICODE);
}
firstOrUpdate([
'title' => $key,
'html' => $value
],"settings",[
], "settings", [
'title' => $key
]);
}
}
$variables = [
'Document Procedure Type' => 'document_procedure_type',
'Publisher' => 'publisher',
'RFI Status' => 'rfi-status',
'Erection Type' => 'erection_type',
'Erection Materials Name' => 'erection_materials_name',
'NCR Current Types' => 'ncr_types',
'NCR Current Status' => 'ncr_current_status',
'Unit (KG-MM)' => 'unit_kgmetc',
'Languages' => 'languages',
];
?>
<form action="?t={{get("t")}}&update" method="post">
@csrf
@foreach($variables AS $name => $key)
{{e2($name)}}:
<?php $selectedValues = j(setting($key)); ?>
@foreach($variables as $name => $key)
{{e2($name)}}:
<?php $selectedValues = j(setting($key)); ?>
<select name="{{$key}}[]" multiple id="" class="form-control select2">
<?php
if(is_array($selectedValues)) {
foreach($selectedValues AS $d) {
?>
<option value="{{$d}}" selected>{{$d}}</option>
<?php
}
}
?>
if (is_array($selectedValues)) {
foreach ($selectedValues as $d) {
?>
<option value="{{$d}}" selected>{{$d}}</option>
<?php
}
}
?>
</select>
@endforeach
<button class="btn btn-primary mt-5">{{e2("Update")}}</button>
</form>