|
@@ -6,8 +6,37 @@ inputs:
|
|
|
--}}
|
|
|
<?php
|
|
|
$template = json_decode(file_get_contents(resource_path('views/app/dq-templates/' . $template)));
|
|
|
+$loadedData = $data;
|
|
|
+if(!$loadedData || !@$loadedData->lines || !@$loadedData->dataMap) {
|
|
|
+ $loadedData = $template;
|
|
|
+}
|
|
|
?>
|
|
|
-@foreach ($template->lines as $line)
|
|
|
- @include('app.dq-engine.line', compact('line'))
|
|
|
-@endforeach
|
|
|
+<div class="dq-edit-container">
|
|
|
+ <div class="dq-definition"><?= json_encode($loadedData->lines) ?></div>
|
|
|
+ <div class="dq-data-map"><?= json_encode($loadedData->dataMap) ?></div>
|
|
|
+ @foreach ($template->lines as $line)
|
|
|
+ @include('app.dq-engine.line', compact('line'))
|
|
|
+ @endforeach
|
|
|
+</div>
|
|
|
+<script>
|
|
|
+ (function() {
|
|
|
+ function init() {
|
|
|
+ $('.dq-edit-container')
|
|
|
+ .off('change input paste', 'input, textarea, select')
|
|
|
+ .on('change input paste', 'input, textarea, select', function() {
|
|
|
+ let key = $(this).closest('.dq-line').attr('dq-key'),
|
|
|
+ dataElem = $(this).closest('.dq-edit-container').find('>.dq-data-map').first(),
|
|
|
+ current = JSON.parse(dataElem.text());
|
|
|
+ current[key] = $(this).val();
|
|
|
+ dataElem.text(JSON.stringify(current));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ function populate() {
|
|
|
+
|
|
|
+ }
|
|
|
+ addMCInitializer('dq-edit', init, '.dq-edit-container');
|
|
|
+ }).call(window);
|
|
|
+</script>
|
|
|
+
|
|
|
+
|
|
|
|