mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-25 06:00:28 +01:00
MatrixProdukt: Translations
This commit is contained in:
parent
0583406650
commit
a0cf65fc45
34
classes/Modules/MatrixProduct/Data/Translation.php
Normal file
34
classes/Modules/MatrixProduct/Data/Translation.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2023 Andreas Palm
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Xentral\Modules\MatrixProduct\Data;
|
||||||
|
|
||||||
|
use JsonSerializable;
|
||||||
|
|
||||||
|
final class Translation implements JsonSerializable
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public string $nameFrom,
|
||||||
|
public string $languageTo,
|
||||||
|
public string $nameTo,
|
||||||
|
public ?int $id = null,
|
||||||
|
public string $nameExternalFrom = '',
|
||||||
|
public string $nameExternalTo = '',
|
||||||
|
public string $languageFrom = 'DE'
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fromDbArray(array $data): Translation {
|
||||||
|
return new self($data['name_from'], $data['language_to'], $data['name_to'], $data['id'],
|
||||||
|
$data['name_external_from'], $data['name_external_to'], $data['language_from']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jsonSerialize(): array
|
||||||
|
{
|
||||||
|
return (array) $this;
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ namespace Xentral\Modules\MatrixProduct;
|
|||||||
use Xentral\Components\Database\Database;
|
use Xentral\Components\Database\Database;
|
||||||
use Xentral\Modules\MatrixProduct\Data\Group;
|
use Xentral\Modules\MatrixProduct\Data\Group;
|
||||||
use Xentral\Modules\MatrixProduct\Data\Option;
|
use Xentral\Modules\MatrixProduct\Data\Option;
|
||||||
|
use Xentral\Modules\MatrixProduct\Data\Translation;
|
||||||
|
|
||||||
final class MatrixProductGateway
|
final class MatrixProductGateway
|
||||||
{
|
{
|
||||||
@ -275,4 +276,62 @@ final class MatrixProductGateway
|
|||||||
$this->db->perform($sql, ['id' => $variantId]);
|
$this->db->perform($sql, ['id' => $variantId]);
|
||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
//region Translations
|
||||||
|
public function GetGroupTranslationById(int $id) : Translation {
|
||||||
|
$sql = "SELECT * FROM matrix_article_translation WHERE id = :id";
|
||||||
|
$row = $this->db->fetchRow($sql, ['id' => $id]);
|
||||||
|
return Translation::fromDbArray($row);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function GetOptionTranslationById(int $id) : Translation {
|
||||||
|
$sql = "SELECT * FROM matrix_article_options_translation WHERE id = :id";
|
||||||
|
$row = $this->db->fetchRow($sql, ['id' => $id]);
|
||||||
|
return Translation::fromDbArray($row);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function InsertGroupTranslation(Translation $obj) : Translation {
|
||||||
|
$sql = "INSERT INTO matrix_article_translation
|
||||||
|
(language_from, language_to, name_from, name_to, name_external_from, name_external_to)
|
||||||
|
VALUES (:languageFrom, :languageTo, :nameFrom, :nameTo, :nameExternalFrom, :nameExternalTo)";
|
||||||
|
$this->db->perform($sql, (array)$obj);
|
||||||
|
$obj->id = $this->db->lastInsertId();
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function InsertOptionTranslation(Translation $obj) : Translation {
|
||||||
|
$sql = "INSERT INTO matrix_article_options_translation
|
||||||
|
(language_from, language_to, name_from, name_to, name_external_from, name_external_to)
|
||||||
|
VALUES (:languageFrom, :languageTo, :nameFrom, :nameTo, :nameExternalFrom, :nameExternalTo)";
|
||||||
|
$this->db->perform($sql, (array)$obj);
|
||||||
|
$obj->id = $this->db->lastInsertId();
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function UpdateGroupTranslation(Translation $obj) : Translation {
|
||||||
|
$sql = "UPDATE matrix_article_translation SET language_from = :languageFrom, language_to = :languageTo,
|
||||||
|
name_from = :nameFrom, name_to = :nameTo, name_external_from = :nameExternalFrom,
|
||||||
|
name_external_to = :nameExternalTo WHERE id = :id";
|
||||||
|
$this->db->perform($sql, (array)$obj);
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function UpdateOptionTranslation(Translation $obj) : Translation {
|
||||||
|
$sql = "UPDATE matrix_article_options_translation SET language_from = :languageFrom, language_to = :languageTo,
|
||||||
|
name_from = :nameFrom, name_to = :nameTo, name_external_from = :nameExternalFrom,
|
||||||
|
name_external_to = :nameExternalTo WHERE id = :id";
|
||||||
|
$this->db->perform($sql, (array)$obj);
|
||||||
|
return $obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function DeleteGroupTranslation(int $id) : void {
|
||||||
|
$sql = "DELETE FROM matrix_article_translation WHERE id = :id";
|
||||||
|
$this->db->perform($sql, ['id' => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function DeleteOptionTranslation(int $id) : void {
|
||||||
|
$sql = "DELETE FROM matrix_article_options_translation WHERE id = :id";
|
||||||
|
$this->db->perform($sql, ['id' => $id]);
|
||||||
|
}
|
||||||
|
//endregion
|
||||||
}
|
}
|
@ -10,6 +10,7 @@ use Xentral\Components\Database\Database;
|
|||||||
use Xentral\Modules\Article\Gateway\ArticleGateway;
|
use Xentral\Modules\Article\Gateway\ArticleGateway;
|
||||||
use Xentral\Modules\MatrixProduct\Data\Option;
|
use Xentral\Modules\MatrixProduct\Data\Option;
|
||||||
use Xentral\Modules\MatrixProduct\Data\Group;
|
use Xentral\Modules\MatrixProduct\Data\Group;
|
||||||
|
use Xentral\Modules\MatrixProduct\Data\Translation;
|
||||||
|
|
||||||
final class MatrixProductService
|
final class MatrixProductService
|
||||||
{
|
{
|
||||||
@ -167,4 +168,34 @@ final class MatrixProductService
|
|||||||
$this->gateway->DeleteVariantById($variantId);
|
$this->gateway->DeleteVariantById($variantId);
|
||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
//region Translations
|
||||||
|
public function GetGroupTranslation(int $id) : Translation {
|
||||||
|
return $this->gateway->GetGroupTranslationById($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function GetOptionTranslation(int $id) : Translation {
|
||||||
|
return $this->gateway->GetOptionTranslationById($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function SaveGroupTranslation(Translation $obj) : Translation {
|
||||||
|
if ($obj->id > 0)
|
||||||
|
return $this->gateway->UpdateGroupTranslation($obj);
|
||||||
|
return $this->gateway->InsertGroupTranslation($obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function SaveOptionTranslation(Translation $obj) : Translation {
|
||||||
|
if ($obj->id > 0)
|
||||||
|
return $this->gateway->UpdateOptionTranslation($obj);
|
||||||
|
return $this->gateway->InsertOptionTranslation($obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function DeleteGroupTranslation(int $id) : void {
|
||||||
|
$this->gateway->DeleteGroupTranslation($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function DeleteOptionTranslation(int $id) : void {
|
||||||
|
$this->gateway->DeleteOptionTranslation($id);
|
||||||
|
}
|
||||||
|
//endregion
|
||||||
}
|
}
|
@ -12,6 +12,7 @@ import AddGlobalToArticle from "./AddGlobalToArticle.vue";
|
|||||||
import GroupEdit from "./GroupEdit.vue";
|
import GroupEdit from "./GroupEdit.vue";
|
||||||
import OptionEdit from "./OptionEdit.vue";
|
import OptionEdit from "./OptionEdit.vue";
|
||||||
import Variant from "./Variant.vue";
|
import Variant from "./Variant.vue";
|
||||||
|
import Translation from "./Translation.vue";
|
||||||
|
|
||||||
const model = ref(null);
|
const model = ref(null);
|
||||||
|
|
||||||
@ -42,6 +43,10 @@ document.getElementById('main').addEventListener('click', async (ev) => {
|
|||||||
url = 'index.php?module=matrixprodukt&action=artikel&cmd=variantdelete';
|
url = 'index.php?module=matrixprodukt&action=artikel&cmd=variantdelete';
|
||||||
await axios.post(url, {variantId: ds.variantId});
|
await axios.post(url, {variantId: ds.variantId});
|
||||||
break;
|
break;
|
||||||
|
case 'translationDelete':
|
||||||
|
url = 'index.php?module=matrixprodukt&action=translation&cmd=delete';
|
||||||
|
await axios.post(url, {id: ds.id, type: ds.type});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
onSave();
|
onSave();
|
||||||
return;
|
return;
|
||||||
@ -66,5 +71,6 @@ function onClose() {
|
|||||||
<GroupEdit v-else-if="model.action === 'groupEdit'" v-bind="model" @close="onClose" @save="onSave" />
|
<GroupEdit v-else-if="model.action === 'groupEdit'" v-bind="model" @close="onClose" @save="onSave" />
|
||||||
<OptionEdit v-else-if="model.action === 'optionEdit'" v-bind="model" @close="onClose" @save="onSave" />
|
<OptionEdit v-else-if="model.action === 'optionEdit'" v-bind="model" @close="onClose" @save="onSave" />
|
||||||
<Variant v-else-if="model.action === 'variantEdit'" v-bind="model" @close="onClose" @save="onSave" />
|
<Variant v-else-if="model.action === 'variantEdit'" v-bind="model" @close="onClose" @save="onSave" />
|
||||||
|
<Translation v-else-if="model.action === 'translationEdit'" v-bind="model" @close="onClose" @save="onSave" />
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
85
classes/Modules/MatrixProduct/www/js/Translation.vue
Normal file
85
classes/Modules/MatrixProduct/www/js/Translation.vue
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<!--
|
||||||
|
SPDX-FileCopyrightText: 2023 Andreas Palm
|
||||||
|
|
||||||
|
SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||||
|
-->
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {ref, onMounted} from "vue";
|
||||||
|
import axios from "axios";
|
||||||
|
import Dialog from "primevue/dialog";
|
||||||
|
import Button from "primevue/button";
|
||||||
|
import Dropdown from "primevue/dropdown";
|
||||||
|
import {AlertErrorHandler} from "@res/js/ajaxErrorHandler";
|
||||||
|
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
type: String,
|
||||||
|
id: String,
|
||||||
|
});
|
||||||
|
const emit = defineEmits(['save', 'close']);
|
||||||
|
|
||||||
|
const model = ref({});
|
||||||
|
const languages = ref([]);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
if (props.id > 0) {
|
||||||
|
const url = 'index.php?module=matrixprodukt&action=translation&cmd=edit';
|
||||||
|
model.value = await axios.get(url, {
|
||||||
|
params: props
|
||||||
|
}).then(response => response.data)
|
||||||
|
}
|
||||||
|
axios.get('index.php',
|
||||||
|
{
|
||||||
|
params: {
|
||||||
|
module: 'ajax',
|
||||||
|
action: 'filter',
|
||||||
|
filtername: 'activelanguages',
|
||||||
|
object: true
|
||||||
|
}
|
||||||
|
}).then(response => {
|
||||||
|
languages.value = response.data;
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
if (!parseInt(props.id) > 0)
|
||||||
|
model.value.id = 0;
|
||||||
|
const url = 'index.php?module=matrixprodukt&action=translation&cmd=save';
|
||||||
|
await axios.post(url, {...props, ...model.value})
|
||||||
|
.catch(AlertErrorHandler)
|
||||||
|
.then(() => {emit('save')});
|
||||||
|
}
|
||||||
|
|
||||||
|
function ready() {
|
||||||
|
if (model.value.nameExternalFrom && !model.value.nameExternalTo)
|
||||||
|
return false;
|
||||||
|
return model.value.languageTo && model.value.nameFrom && model.value.nameTo;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Dialog visible modal header="Übersetzung anlegen/bearbeiten" style="width: 500px" @update:visible="emit('close')" class="p-fluid">
|
||||||
|
<div class="grid gap-1" style="grid-template-columns: 25% 75%">
|
||||||
|
<label for="matrixProduct_nameFrom">DE Name:</label>
|
||||||
|
<input type="text" v-model="model.nameFrom" required />
|
||||||
|
<label for="matrixProduct_nameExternalFrom">DE Name Extern:</label>
|
||||||
|
<input type="text" v-model="model.nameExternalFrom" />
|
||||||
|
<label for="matrixProduct_languageTo">Sprache:</label>
|
||||||
|
<Dropdown
|
||||||
|
v-model="model.languageTo"
|
||||||
|
:options="languages"
|
||||||
|
option-label="bezeichnung_de"
|
||||||
|
option-value="iso"
|
||||||
|
/>
|
||||||
|
<label for="matrixProduct_nameTo">Übersetzung Name:</label>
|
||||||
|
<input type="text" v-model="model.nameTo" required>
|
||||||
|
<label for="matrixProduct_nameTo">Übersetzung Name Extern:</label>
|
||||||
|
<input type="text" v-model="model.nameExternalTo" :required="model.nameExternalFrom">
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<Button label="ABBRECHEN" @click="emit('close')" />
|
||||||
|
<Button label="SPEICHERN" @click="save" :disabled="!ready()"/>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
@ -330,6 +330,9 @@ class Player {
|
|||||||
$this->app->Tpl->Add('MODULEJAVASCRIPTHEAD', $this->app->ModuleScriptCache->GetJavascriptHtmlTags('head'));
|
$this->app->Tpl->Add('MODULEJAVASCRIPTHEAD', $this->app->ModuleScriptCache->GetJavascriptHtmlTags('head'));
|
||||||
$this->app->Tpl->Add('MODULEJAVASCRIPTBODY', $this->app->ModuleScriptCache->GetJavascriptHtmlTags('body'));
|
$this->app->Tpl->Add('MODULEJAVASCRIPTBODY', $this->app->ModuleScriptCache->GetJavascriptHtmlTags('body'));
|
||||||
$this->app->Tpl->Set('JAVASCRIPTMODULES', $this->app->ModuleScriptCache->GetJavascriptModulesHtmlTags());
|
$this->app->Tpl->Set('JAVASCRIPTMODULES', $this->app->ModuleScriptCache->GetJavascriptModulesHtmlTags());
|
||||||
|
if (defined('VITE_DEV_SERVER')) {
|
||||||
|
$this->app->Tpl->Add('ADDITIONALCSPHEADER', VITE_DEV_SERVER.' ');
|
||||||
|
}
|
||||||
|
|
||||||
$permission = true;
|
$permission = true;
|
||||||
if(isset($myApp) && method_exists($myApp,'CheckRights'))$permission = $myApp->CheckRights();
|
if(isset($myApp) && method_exists($myApp,'CheckRights'))$permission = $myApp->CheckRights();
|
||||||
|
@ -303,7 +303,7 @@ class ModuleScriptCache
|
|||||||
foreach ($this->javascriptModules as $module) {
|
foreach ($this->javascriptModules as $module) {
|
||||||
if (is_object($module)) {
|
if (is_object($module)) {
|
||||||
if (defined('VITE_DEV_SERVER')) {
|
if (defined('VITE_DEV_SERVER')) {
|
||||||
$url = VITE_DEV_SERVER . $module->src;
|
$url = 'http://' . VITE_DEV_SERVER . '/' . $module->src;
|
||||||
} else {
|
} else {
|
||||||
$url = $this->assetDir . '/' . $module->file;
|
$url = $this->assetDir . '/' . $module->file;
|
||||||
if (isset($module->css)) {
|
if (isset($module->css)) {
|
||||||
|
File diff suppressed because one or more lines are too long
2
www/dist/manifest.json
vendored
2
www/dist/manifest.json
vendored
@ -7,7 +7,7 @@
|
|||||||
"css": [
|
"css": [
|
||||||
"assets/entry-597722a1.css"
|
"assets/entry-597722a1.css"
|
||||||
],
|
],
|
||||||
"file": "assets/modules/MatrixProduct-1c46dcc9.js",
|
"file": "assets/modules/MatrixProduct-b2690ae0.js",
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"src": "classes/Modules/MatrixProduct/www/js/entry.jsx"
|
"src": "classes/Modules/MatrixProduct/www/js/entry.jsx"
|
||||||
}
|
}
|
||||||
|
@ -1626,6 +1626,9 @@ select a.kundennummer, (SELECT name FROM adresse a2 WHERE a2.kundennummer = a.ku
|
|||||||
$newarr[] = $arr[$i]['iso'];
|
$newarr[] = $arr[$i]['iso'];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "activelanguages":
|
||||||
|
$newarr = $this->app->DB->SelectArr('SELECT * FROM sprachen WHERE aktiv=1');
|
||||||
|
break;
|
||||||
case "geschaeftsbrief_vorlagen":
|
case "geschaeftsbrief_vorlagen":
|
||||||
$arr = $this->app->DB->SelectArr("SELECT CONCAT(id,' ',subjekt,' (',sprache,')') as name FROM geschaeftsbrief_vorlagen");
|
$arr = $this->app->DB->SelectArr("SELECT CONCAT(id,' ',subjekt,' (',sprache,')') as name FROM geschaeftsbrief_vorlagen");
|
||||||
$carr = !empty($arr)?count($arr):0;
|
$carr = !empty($arr)?count($arr):0;
|
||||||
|
@ -11,20 +11,12 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
|||||||
<div id="tabs-1">
|
<div id="tabs-1">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="row-height">
|
<div class="row-height">
|
||||||
<div class="col-xs-12 col-md-10 col-md-height">
|
<div class="col-xs-12 col-md-height">
|
||||||
<div class="inside-white inside-full-height">
|
<div class="inside-white inside-full-height">
|
||||||
[MESSAGE]
|
[MESSAGE]
|
||||||
[TAB1]
|
[TAB1]
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-2 col-md-height">
|
|
||||||
<div class="inside inside-full-height">
|
|
||||||
<fieldset>
|
|
||||||
<legend>{|Aktionen|}</legend>
|
|
||||||
<input type="button" class="btnGreenNew" name="neueuebersetzung" value="✚ Neue Übersetzung" onclick="MatrixproduktUebersetzungEdit(0);">
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -34,175 +26,3 @@ SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
|||||||
|
|
||||||
<div id="vueapp"></div>
|
<div id="vueapp"></div>
|
||||||
|
|
||||||
<div id="editMatrixproduktUebersetzung" style="display:none;" title="Bearbeiten">
|
|
||||||
<form action="" method="post" name="eprooform">
|
|
||||||
<input type="hidden" id="matrixprodukt_uebersetzung_id">
|
|
||||||
<fieldset>
|
|
||||||
<legend>{|Von|}</legend>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td width="100">{|Sprache|}:</td>
|
|
||||||
<td><select name="matrixprodukt_sprache_von" id="matrixprodukt_sprache_von">
|
|
||||||
[SPRACHEN]
|
|
||||||
</select></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>{|Name|}:</td>
|
|
||||||
<td><input type="text" size="40" name="matrixprodukt_name_von" id="matrixprodukt_name_von"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>{|Name Extern|}:</td>
|
|
||||||
<td><input type="text" size="40" name="matrixprodukt_name_ext_von" id="matrixprodukt_name_ext_von"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</fieldset>
|
|
||||||
<fieldset>
|
|
||||||
<legend>{|Nach|}</legend>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td width="100">{|Sprache|}:</td>
|
|
||||||
<td><select name="matrixprodukt_sprache_nach" id="matrixprodukt_sprache_nach">
|
|
||||||
[SPRACHEN]
|
|
||||||
</select></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>{|Name|}:</td>
|
|
||||||
<td><input type="text" size="40" name="matrixprodukt_name_nach" id="matrixprodukt_name_nach"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>{|Name Extern|}:</td>
|
|
||||||
<td><input type="text" size="40" name="matrixprodukt_name_ext_nach" id="matrixprodukt_name_ext_nach"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</fieldset>
|
|
||||||
<fieldset>
|
|
||||||
<legend>{|Einstellungen|}</legend>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td width="100">{|Projekt|}:</td>
|
|
||||||
<td><input type="text" size="40" name="matrixprodukt_uebersetzung_projekt" id="matrixprodukt_uebersetzung_projekt"></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>{|Aktiv|}:</td>
|
|
||||||
<td><input type="checkbox" name="matrixprodukt_uebersetzung_aktiv" id="matrixprodukt_uebersetzung_aktiv" value="1"></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
function MatrixproduktUebersetzungReset(){
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_uebersetzung_id').val('');
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_sprache_von').val('');
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_name_von').val('');
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_name_ext_von').val('');
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_sprache_nach').val('');
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_name_nach').val('');
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_name_ext_nach').val('');
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_uebersetzung_projekt').val('');
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_uebersetzung_aktiv').prop("checked", true);
|
|
||||||
|
|
||||||
var languageFrom = document.getElementById('matrixprodukt_sprache_von');
|
|
||||||
languageFrom.selectedIndex = 0;
|
|
||||||
|
|
||||||
var languageTo = document.getElementById('matrixprodukt_sprache_nach');
|
|
||||||
languageTo.selectedIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function MatrixproduktUebersetzungEditSave(){
|
|
||||||
$.ajax({
|
|
||||||
url: 'index.php?module=matrixprodukt&action=list&cmd=uebersetzungsave',
|
|
||||||
data: {
|
|
||||||
//Alle Felder die fürs editieren vorhanden sind
|
|
||||||
id: $('#matrixprodukt_uebersetzung_id').val(),
|
|
||||||
sprache_von: $('#matrixprodukt_sprache_von').val(),
|
|
||||||
name_von: $('#matrixprodukt_name_von').val(),
|
|
||||||
name_ext_von: $('#matrixprodukt_name_ext_von').val(),
|
|
||||||
sprache_nach: $('#matrixprodukt_sprache_nach').val(),
|
|
||||||
name_nach: $('#matrixprodukt_name_nach').val(),
|
|
||||||
name_ext_nach: $('#matrixprodukt_name_ext_nach').val(),
|
|
||||||
uebersetzung_projekt: $('#matrixprodukt_uebersetzung_projekt').val(),
|
|
||||||
aktiv: $('#matrixprodukt_uebersetzung_aktiv').prop("checked")?1:0
|
|
||||||
|
|
||||||
},
|
|
||||||
method: 'post',
|
|
||||||
dataType: 'json',
|
|
||||||
beforeSend: function() {
|
|
||||||
App.loading.open();
|
|
||||||
},
|
|
||||||
success: function(data) {
|
|
||||||
App.loading.close();
|
|
||||||
if (data.status == 1) {
|
|
||||||
MatrixproduktUebersetzungReset();
|
|
||||||
updateLiveTable();
|
|
||||||
$("#editMatrixproduktUebersetzung").dialog('close');
|
|
||||||
} else {
|
|
||||||
alert(data.statusText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function MatrixproduktUebersetzungEdit(id) {
|
|
||||||
if(id > 0)
|
|
||||||
{
|
|
||||||
$.ajax({
|
|
||||||
url: 'index.php?module=matrixprodukt&action=list&cmd=uebersetzungedit',
|
|
||||||
data: {
|
|
||||||
id: id
|
|
||||||
},
|
|
||||||
method: 'post',
|
|
||||||
dataType: 'json',
|
|
||||||
beforeSend: function() {
|
|
||||||
App.loading.open();
|
|
||||||
},
|
|
||||||
success: function(data) {
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_uebersetzung_id').val(data.id);
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_sprache_von').val(data.language_from);
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_name_von').val(data.name_from);
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_name_ext_von').val(data.name_external_from);
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_sprache_nach').val(data.language_to);
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_name_nach').val(data.name_to);
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_name_ext_nach').val(data.name_external_to);
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_uebersetzung_projekt').val(data.project);
|
|
||||||
$('#editMatrixproduktUebersetzung').find('#matrixprodukt_uebersetzung_aktiv').prop("checked",data.active==1?true:false);
|
|
||||||
|
|
||||||
App.loading.close();
|
|
||||||
$("#editMatrixproduktUebersetzung").dialog('open');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
MatrixproduktUebersetzungReset();
|
|
||||||
$("#editMatrixproduktUebersetzung").dialog('open');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function MatrixproduktUebersetzungDelete(id) {
|
|
||||||
var conf = confirm('Wirklich löschen?');
|
|
||||||
if (conf) {
|
|
||||||
$.ajax({
|
|
||||||
url: 'index.php?module=matrixprodukt&action=list&cmd=uebersetzungdelete',
|
|
||||||
data: {
|
|
||||||
id: id
|
|
||||||
},
|
|
||||||
method: 'post',
|
|
||||||
dataType: 'json',
|
|
||||||
beforeSend: function() {
|
|
||||||
App.loading.open();
|
|
||||||
},
|
|
||||||
success: function(data) {
|
|
||||||
if(data.status == 1){
|
|
||||||
updateLiveTable();
|
|
||||||
}else{
|
|
||||||
alert(data.statusText);
|
|
||||||
}
|
|
||||||
App.loading.close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
55
www/pages/content/matrixprodukt_translation.tpl
Normal file
55
www/pages/content/matrixprodukt_translation.tpl
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<!--
|
||||||
|
SPDX-FileCopyrightText: 2023 Andreas Palm
|
||||||
|
SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
|
||||||
|
SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||||
|
-->
|
||||||
|
<div id="tabs">
|
||||||
|
<ul>
|
||||||
|
<li><a href="#tabs-1">Gruppen</a></li>
|
||||||
|
<li><a href="#tabs-2">Optionen</a></li>
|
||||||
|
</ul>
|
||||||
|
<!-- erstes tab -->
|
||||||
|
<div id="tabs-1">
|
||||||
|
<div class="row">
|
||||||
|
<div class="row-height">
|
||||||
|
<div class="col-xs-12 col-md-10 col-md-height">
|
||||||
|
<div class="inside-white inside-full-height">
|
||||||
|
[TABGRP]
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12 col-md-2 col-md-height">
|
||||||
|
<div class="inside inside-full-height">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{|Aktionen|}</legend>
|
||||||
|
<input type="button" class="btnGreenNew vueAction" value="✚ Neue Übersetzung" data-action="translationEdit" data-type="group">
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- erstes tab -->
|
||||||
|
<div id="tabs-2">
|
||||||
|
<div class="row">
|
||||||
|
<div class="row-height">
|
||||||
|
<div class="col-xs-12 col-md-10 col-md-height">
|
||||||
|
<div class="inside-white inside-full-height">
|
||||||
|
[TABOPT]
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12 col-md-2 col-md-height">
|
||||||
|
<div class="inside inside-full-height">
|
||||||
|
<fieldset>
|
||||||
|
<legend>{|Aktionen|}</legend>
|
||||||
|
<input type="button" class="btnGreenNew vueAction" value="✚ Neue Übersetzung" data-action="translationEdit" data-type="option">
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- tab view schließen -->
|
||||||
|
</div>
|
||||||
|
<!-- ende tab view schließen -->
|
||||||
|
|
||||||
|
<div id="vueapp"></div>
|
@ -9,6 +9,7 @@ use Xentral\Components\Http\Request;
|
|||||||
use Xentral\Components\Http\Response;
|
use Xentral\Components\Http\Response;
|
||||||
use Xentral\Modules\MatrixProduct\Data\Group;
|
use Xentral\Modules\MatrixProduct\Data\Group;
|
||||||
use Xentral\Modules\MatrixProduct\Data\Option;
|
use Xentral\Modules\MatrixProduct\Data\Option;
|
||||||
|
use Xentral\Modules\MatrixProduct\Data\Translation;
|
||||||
use Xentral\Modules\MatrixProduct\MatrixProductService;
|
use Xentral\Modules\MatrixProduct\MatrixProductService;
|
||||||
|
|
||||||
class Matrixprodukt
|
class Matrixprodukt
|
||||||
@ -34,12 +35,14 @@ class Matrixprodukt
|
|||||||
$this->app->ActionHandler("list", "ActionList");
|
$this->app->ActionHandler("list", "ActionList");
|
||||||
$this->app->ActionHandler("optionenlist", "ActionOptionList");
|
$this->app->ActionHandler("optionenlist", "ActionOptionList");
|
||||||
$this->app->ActionHandler("artikel", "ActionArticle");
|
$this->app->ActionHandler("artikel", "ActionArticle");
|
||||||
|
$this->app->ActionHandler("translation", "ActionTranslation");
|
||||||
$this->app->ActionHandlerListen($app);
|
$this->app->ActionHandlerListen($app);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createMenu(): void
|
private function createMenu(): void
|
||||||
{
|
{
|
||||||
$this->app->erp->MenuEintrag("index.php?module=matrixprodukt&action=list", "Übersicht");
|
$this->app->erp->MenuEintrag("index.php?module=matrixprodukt&action=list", "Übersicht");
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=matrixprodukt&action=translation", "Übersetzungen");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Install()
|
public function Install()
|
||||||
@ -156,6 +159,32 @@ class Matrixprodukt
|
|||||||
// FROM matrixprodukt_eigenschaftengruppen_artikel mga
|
// FROM matrixprodukt_eigenschaftengruppen_artikel mga
|
||||||
// LEFT OUTER JOIN matrixprodukt_eigenschaftenoptionen_artikel moa on moa.gruppe = mga.id WHERE $where";
|
// LEFT OUTER JOIN matrixprodukt_eigenschaftenoptionen_artikel moa on moa.gruppe = mga.id WHERE $where";
|
||||||
break;
|
break;
|
||||||
|
case "matrixproduct_group_translations":
|
||||||
|
$heading = array('Name', 'Name (extern)', 'Sprache', 'Übersetzung Name', 'Übersetzung Name (extern)', 'Menü');
|
||||||
|
$width = array('20%', '20%', '5%', '20%', '20%', '1%');
|
||||||
|
$findcols = array('mat.name_from', 'mat.name_external_from', 'mat.name_to', 'mat.name_external_to');
|
||||||
|
$searchsql = array('mat.name_from', 'mat.name_external_from');
|
||||||
|
$menu = "<table><tr><td nowrap>"
|
||||||
|
. "<img class=\"vueAction\" data-action=\"translationEdit\" data-type=\"group\" data-id=\"%value%\" src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\"> "
|
||||||
|
. "<img class=\"vueAction\" data-action=\"translationDelete\" data-type=\"group\" data-id=\"%value%\" src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\">"
|
||||||
|
. "</td></tr></table>";
|
||||||
|
$sql = "SELECT SQL_CALC_FOUND_ROWS mat.id, mat.name_from, mat.name_external_from, mat.language_to, mat.name_to, mat.name_external_to, mat.id FROM matrix_article_translation mat";
|
||||||
|
$where = "1";
|
||||||
|
$count = "SELECT count(DISTINCT mat.id) FROM matrix_article_translation mat WHERE $where";
|
||||||
|
break;
|
||||||
|
case "matrixproduct_option_translations":
|
||||||
|
$heading = array('Name', 'Name (extern)', 'Sprache', 'Übersetzung Name', 'Übersetzung Name (extern)', 'Menü');
|
||||||
|
$width = array('20%', '20%', '5%', '20%', '20%', '1%');
|
||||||
|
$findcols = array('mat.name_from', 'mat.name_external_from', 'mat.name_to', 'mat.name_external_to');
|
||||||
|
$searchsql = array('mat.name_from', 'mat.name_external_from');
|
||||||
|
$menu = "<table><tr><td nowrap>"
|
||||||
|
. "<img class=\"vueAction\" data-action=\"translationEdit\" data-type=\"option\" data-id=\"%value%\" src=\"./themes/{$app->Conf->WFconf['defaulttheme']}/images/edit.svg\"> "
|
||||||
|
. "<img class=\"vueAction\" data-action=\"translationDelete\" data-type=\"option\" data-id=\"%value%\" src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/delete.svg\">"
|
||||||
|
. "</td></tr></table>";
|
||||||
|
$sql = "SELECT SQL_CALC_FOUND_ROWS mat.id, mat.name_from, mat.name_external_from, mat.language_to, mat.name_to, mat.name_external_to, mat.id FROM matrix_article_options_translation mat";
|
||||||
|
$where = "1";
|
||||||
|
$count = "SELECT count(DISTINCT mat.id) FROM matrix_article_options_translation mat WHERE $where";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$erg = false;
|
$erg = false;
|
||||||
@ -209,6 +238,8 @@ class Matrixprodukt
|
|||||||
|
|
||||||
public function ActionOptionList()
|
public function ActionOptionList()
|
||||||
{
|
{
|
||||||
|
$this->app->erp->MenuEintrag("index.php?module=matrixprodukt&action=optionenlist", "Optionen");
|
||||||
|
|
||||||
$id = $this->request->get->getInt('id');
|
$id = $this->request->get->getInt('id');
|
||||||
$cmd = $this->app->Secure->GetGET('cmd');
|
$cmd = $this->app->Secure->GetGET('cmd');
|
||||||
switch ($cmd) {
|
switch ($cmd) {
|
||||||
@ -231,6 +262,8 @@ class Matrixprodukt
|
|||||||
return JsonResponse::NoContent();
|
return JsonResponse::NoContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$group = $this->service->GetGlobalGroupById($id);
|
||||||
|
$this->app->Tpl->Set('KURZUEBERSCHRIFT1', $group->name);
|
||||||
$this->app->Tpl->Set('TABSADD', '<input type="button" class="neubutton vueAction" value="NEU" data-action="optionEdit" data-group-id="' . $id . '">');
|
$this->app->Tpl->Set('TABSADD', '<input type="button" class="neubutton vueAction" value="NEU" data-action="optionEdit" data-group-id="' . $id . '">');
|
||||||
$this->app->YUI->TableSearch('TAB1', 'matrixprodukt_options', "show", "", "", basename(__FILE__), __CLASS__);
|
$this->app->YUI->TableSearch('TAB1', 'matrixprodukt_options', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
$this->app->Tpl->Parse('PAGE', "matrixprodukt_optionen_list.tpl");
|
$this->app->Tpl->Parse('PAGE', "matrixprodukt_optionen_list.tpl");
|
||||||
@ -343,4 +376,37 @@ class Matrixprodukt
|
|||||||
$this->app->YUI->TableSearch('TAB2', 'matrixprodukt_variants', "show", "", "", basename(__FILE__), __CLASS__);
|
$this->app->YUI->TableSearch('TAB2', 'matrixprodukt_variants', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
$this->app->Tpl->Parse('PAGE', "matrixprodukt_article.tpl");
|
$this->app->Tpl->Parse('PAGE', "matrixprodukt_article.tpl");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function ActionTranslation() {
|
||||||
|
$cmd = $this->app->Secure->GetGET('cmd');
|
||||||
|
switch ($cmd) {
|
||||||
|
case "edit":
|
||||||
|
$id = $this->app->Secure->GetGET('id');
|
||||||
|
$isOption = $this->app->Secure->GetGET('type') === 'option';
|
||||||
|
$translation = $isOption ? $this->service->GetOptionTranslation($id) : $this->service->GetGroupTranslation($id);
|
||||||
|
return new JsonResponse($translation);
|
||||||
|
case "save":
|
||||||
|
$json = $this->request->getJson();
|
||||||
|
$isOption = $json->type === 'option';
|
||||||
|
$translation = new Translation($json->nameFrom, $json->languageTo, $json->nameTo, $json->id,
|
||||||
|
$json->nameExternalFrom ?? '', $json->nameExternalTo ?? '');
|
||||||
|
if ($isOption)
|
||||||
|
$this->service->SaveOptionTranslation($translation);
|
||||||
|
else
|
||||||
|
$this->service->SaveGroupTranslation($translation);
|
||||||
|
return JsonResponse::NoContent();
|
||||||
|
case "delete":
|
||||||
|
$json = $this->request->getJson();
|
||||||
|
$isOption = $json->type === 'option';
|
||||||
|
if ($isOption)
|
||||||
|
$this->service->DeleteOptionTranslation($json->id);
|
||||||
|
else
|
||||||
|
$this->service->DeleteGroupTranslation($json->id);
|
||||||
|
return JsonResponse::NoContent();
|
||||||
|
}
|
||||||
|
$this->createMenu();
|
||||||
|
$this->app->YUI->TableSearch('TABGRP', 'matrixproduct_group_translations', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
|
$this->app->YUI->TableSearch('TABOPT', 'matrixproduct_option_translations', "show", "", "", basename(__FILE__), __CLASS__);
|
||||||
|
$this->app->Tpl->Parse('PAGE', "matrixprodukt_translation.tpl");
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user