Added andom-tec Layout package
This commit is contained in:
72
Layout/andom-tec/Workflow/form.php
Normal file
72
Layout/andom-tec/Workflow/form.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
$wfLabelClass = "";
|
||||
$m = [];
|
||||
if(preg_match('/<!--class:\s*([^>]+)-->/',$item->label, $m)) {
|
||||
if($m[1]) {
|
||||
$wfLabelClass = $m[1];
|
||||
}
|
||||
}
|
||||
?>
|
||||
<td id="workflow-item-<?=$item->name?>-<?=$$wftype->id?>" class="workflow-item wfitem-<?=$item->type?> wfitem-width-<?=$item->width?>" <?=($item->width > 1) ? "colspan='".$item->width."'" : ""?> style="width: <?=$this->commaToDot(round(100 / $wfColspan, 2) * $item->width)?>%">
|
||||
<div class="wf-content">
|
||||
<?php if($item->type != "gps"): ?>
|
||||
<label class="form-label <?=$wfLabelClass?>" for="wfitem_<?=$item->name?>_<?=$$wftype->id?>">
|
||||
<?=($item->label) ? $item->label : " "?>
|
||||
<?=($item->label && $item->required == 1) ? "*" : ""?>
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
|
||||
switch($item->type) {
|
||||
case "string":
|
||||
include(realpath(dirname(__FILE__)."/items/")."/string.php");
|
||||
break;
|
||||
case "int":
|
||||
include(realpath(dirname(__FILE__)."/items/")."/int.php");
|
||||
break;
|
||||
case "bool":
|
||||
include(realpath(dirname(__FILE__)."/items/")."/bool.php");
|
||||
break;
|
||||
case "enum":
|
||||
include(realpath(dirname(__FILE__)."/items/")."/enum.php");
|
||||
break;
|
||||
case "text":
|
||||
include(realpath(dirname(__FILE__)."/items/")."/text.php");
|
||||
break;
|
||||
case "file":
|
||||
include(realpath(dirname(__FILE__)."/items/")."/file.php");
|
||||
break;
|
||||
case "gps":
|
||||
include(realpath(dirname(__FILE__)."/items/")."/gps.php");
|
||||
break;
|
||||
case "color":
|
||||
include(realpath(dirname(__FILE__)."/items/")."/color.php");
|
||||
break;
|
||||
case "delimiter":
|
||||
include(realpath(dirname(__FILE__)."/items/")."/delimiter.php");
|
||||
break;
|
||||
case "date":
|
||||
include(realpath(dirname(__FILE__)."/items/")."/date.php");
|
||||
break;
|
||||
case "empty":
|
||||
include(realpath(dirname(__FILE__)."/items/")."/empty.php");
|
||||
break;
|
||||
default:
|
||||
include(realpath(dirname(__FILE__)."/items/")."/string.php");
|
||||
}
|
||||
?>
|
||||
<div style="overflow-x: hidden">
|
||||
<small
|
||||
class="text-info text-mono"
|
||||
<?php if($item->value->changed): ?>
|
||||
title="Geändert: <?=date("d.m.Y H:i",$item->value->changed)?> von <?=$item->value->changer->name?> (<?=$item->value->changer->address->getCompanyOrName(true)?>)"
|
||||
<?php endif; ?>
|
||||
>
|
||||
<?php if($item->value->changed): ?>
|
||||
<?=$item->value->changer->getAbbrName()?>
|
||||
<?php endif; ?>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
10
Layout/andom-tec/Workflow/items/bool.php
Normal file
10
Layout/andom-tec/Workflow/items/bool.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<input type="hidden" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$$wftype->id?>" value="<?=($item->value->value_int == 1) ? "1" : "0"?>" />
|
||||
<input
|
||||
type="checkbox"
|
||||
class="form-control"
|
||||
name="wfitemplaceholder_<?=$item->name?>"
|
||||
id="wfitemplaceholder_<?=$item->name?>_<?=$$wftype->id?>"
|
||||
value="1"
|
||||
<?=($item->value->value_int == 1) ? "checked='checked'" : ""?>
|
||||
onchange="$('#wfitem_<?=$item->name?>_<?=$$wftype->id?>').val((this.checked) ? 1 : 0)"
|
||||
>
|
||||
48
Layout/andom-tec/Workflow/items/color.php
Normal file
48
Layout/andom-tec/Workflow/items/color.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
$color_name = $item->value->value_string;
|
||||
$cmatch = [];
|
||||
if(preg_match('/^(.+)-1R$/', $color_name, $cmatch)) {
|
||||
$color_name = $cmatch[1];
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<select class="form-control selectpicker show-tick" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$$wftype->id?>" title="Farbe wählen" data-style="btn-outline-<?=$color_name?>">
|
||||
<option></option>
|
||||
<?php foreach(TT_CABLE_COLORS as $name => $color): ?>
|
||||
<option
|
||||
style="background-color: rgba(<?=$color["r"]?>,<?=$color["g"]?>,<?=$color["b"]?>, .5); color: #<?=$color["hexfg"]?>"
|
||||
value="<?=$name?>"
|
||||
data-bg-color="#<?=$color["hex"]?>" <?=($color['mark']) ? "data-icon='fa-ellipsis-h'" : ""?>
|
||||
<?=($name == $item->value->value_string) ? "selected='selected'" : ""?>
|
||||
>
|
||||
<?=ucfirst($name)?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#wfitem_<?=$item->name?>_<?=$$wftype->id?>').change(function() {
|
||||
var color = $('#wfitem_<?=$item->name?>_<?=$$wftype->id?> option:selected').data("bg-color");
|
||||
var name = $('#wfitem_<?=$item->name?>_<?=$$wftype->id?> option:selected').val();
|
||||
$("wfitem_<?=$item->name?>_<?=$$wftype->id?>").data("style", "btn-danger");
|
||||
console.log("button [data-id='wfitem_<?=$item->name?>_<?=$$wftype->id?>']");
|
||||
console.log($("button [data-id='wfitem_<?=$item->name?>_<?=$$wftype->id?>']"));
|
||||
|
||||
var matches;
|
||||
if(matches = name.match(/^(.+)-1R$/)) {
|
||||
name = matches[1];
|
||||
}
|
||||
|
||||
$("[data-id='wfitem_<?=$item->name?>_<?=$$wftype->id?>']").removeClass(function (index, className) {
|
||||
console.log(className);
|
||||
return (className.match (/(^|\s)btn-outline-\S+/g) || []).join(' ');
|
||||
});
|
||||
|
||||
$("[data-id='wfitem_<?=$item->name?>_<?=$$wftype->id?>']").addClass("btn-outline-" + name)
|
||||
|
||||
console.log(color);
|
||||
console.log(name);
|
||||
});
|
||||
</script>
|
||||
11
Layout/andom-tec/Workflow/items/date.php
Normal file
11
Layout/andom-tec/Workflow/items/date.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$$wftype->id?>" value="<?=$item->value->value_string?>" placeholder="<?=$item->placeholder?>" />
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#wfitem_<?=$item->name?>_<?=$$wftype->id?>').datepicker({
|
||||
language: 'de',
|
||||
format: "dd.mm.yyyy",
|
||||
showWeekDays: true,
|
||||
todayBtn: 'linked',
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
1
Layout/andom-tec/Workflow/items/delimiter.php
Normal file
1
Layout/andom-tec/Workflow/items/delimiter.php
Normal file
@@ -0,0 +1 @@
|
||||
<hr />
|
||||
1
Layout/andom-tec/Workflow/items/empty.php
Normal file
1
Layout/andom-tec/Workflow/items/empty.php
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
58
Layout/andom-tec/Workflow/items/enum.php
Normal file
58
Layout/andom-tec/Workflow/items/enum.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
$options = [];
|
||||
if(strpos($item->typedata, "=Model=") !== false) {
|
||||
// get options from Model
|
||||
$m = [];
|
||||
if(preg_match('/^=Model=(\w+)(?::([^:]+):)?$/', $item->typedata, $m)) {
|
||||
// dynamic enum
|
||||
$model = $m[1];
|
||||
$modelClass = $model."Model";
|
||||
|
||||
if($m[2]) {
|
||||
$filter_parts = explode("=", $m[2]);
|
||||
$filter_name = $filter_parts[0];
|
||||
$filter_value = $filter_parts[1];
|
||||
|
||||
if(substr($filter_value, 0, 1) == '`') {
|
||||
$filter_value = substr($filter_value, 1, strlen($filter_value) - 2);
|
||||
$objPath = explode("->", $filter_value);
|
||||
|
||||
if(count($objPath) > 1) {
|
||||
$obj = array_shift($objPath);
|
||||
$curr = $$obj;
|
||||
foreach($objPath as $part) {
|
||||
$curr = $curr->$part;
|
||||
}
|
||||
$filter_value = $curr;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($modelClass::search([$filter_name => $filter_value]) as $modelObject) {
|
||||
$options[] = $modelObject->id . "=" . $modelObject->name;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
$options = explode(";", $item->typedata);
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<select class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$$wftype->id?>">
|
||||
<option></option>
|
||||
<?php foreach($options as $opt): ?>
|
||||
<?php
|
||||
$key = $opt;
|
||||
$label = $opt;
|
||||
if(strpos($opt, "=") !== false) {
|
||||
$opt_parts = explode('=', $opt);
|
||||
$key = $opt_parts[0];
|
||||
$label = $opt_parts[1];
|
||||
}
|
||||
?>
|
||||
|
||||
<option value="<?=$key?>" <?=($key == $item->value->value_string) ? "selected='selected'" : ""?>><?=$label?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
1
Layout/andom-tec/Workflow/items/file.php
Normal file
1
Layout/andom-tec/Workflow/items/file.php
Normal file
@@ -0,0 +1 @@
|
||||
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$$wftype->id?>" value="<?=$item->value->value_string?>">
|
||||
23
Layout/andom-tec/Workflow/items/gps.php
Normal file
23
Layout/andom-tec/Workflow/items/gps.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
$lat = "";
|
||||
$long = "";
|
||||
if($item->value->value_string) {
|
||||
$gps_parts = explode(";", $item->value->value_string);
|
||||
$lat = $gps_parts[0];
|
||||
$long = $gps_parts[1];
|
||||
}
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-md-5 padding-right-2">
|
||||
<label class="form-label" for="wfitem_<?=$item->name?>_lat_<?=$$wftype->id?>">GPS Breite <?=($item->required == 1) ? "*" : ""?></label>
|
||||
<input type="text" class="form-control" name="wfitem_<?=$item->name?>[lat]" id="wfitem_<?=$item->name?>_lat_<?=$$wftype->id?>" value="<?=$lat?>" placeholder="<?=str_replace(",", ".", TT_PLACEHOLDER_GPS_LAT)?>">
|
||||
</div>
|
||||
<div class="col-md-5 padding-left-2">
|
||||
<label class="form-label" for="wfitem_<?=$item->name?>_long_<?=$$wftype->id?>">GPS Länge <?=($item->required == 1) ? "*" : ""?></label>
|
||||
<input type="text" class="form-control" name="wfitem_<?=$item->name?>[long]" id="wfitem_<?=$item->name?>_long_<?=$$wftype->id?>" value="<?=$long?>" placeholder="<?=str_replace(",", ".", TT_PLACEHOLDER_GPS_LONG)?>">
|
||||
</div>
|
||||
<div class="col-md-2 padding-left-2">
|
||||
<label class="form-label"> </label>
|
||||
<div><?php if($lat && $long): ?><a href="https://www.google.com/maps/search/?api=1&query=<?=$lat?>,<?=$long?>" target="_blank">Maps</a><?php endif; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
1
Layout/andom-tec/Workflow/items/int.php
Normal file
1
Layout/andom-tec/Workflow/items/int.php
Normal file
@@ -0,0 +1 @@
|
||||
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$$wftype->id?>" value="<?=$item->value->value_string?>">
|
||||
1
Layout/andom-tec/Workflow/items/string.php
Normal file
1
Layout/andom-tec/Workflow/items/string.php
Normal file
@@ -0,0 +1 @@
|
||||
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$$wftype->id?>" value="<?=$item->value->value_string?>" placeholder="<?=$item->placeholder?>">
|
||||
1
Layout/andom-tec/Workflow/items/text.php
Normal file
1
Layout/andom-tec/Workflow/items/text.php
Normal file
@@ -0,0 +1 @@
|
||||
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$$wftype->id?>" value="<?=$item->value->value_string?>">
|
||||
Reference in New Issue
Block a user