Skip to content

Commit

Permalink
blade conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
muhtasimhafiz committed Aug 8, 2024
1 parent 290b4da commit 9422468
Show file tree
Hide file tree
Showing 18 changed files with 1,203 additions and 1,585 deletions.
12 changes: 12 additions & 0 deletions app/Domain/Goalcanvas/Controllers/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,18 @@ public function run()
}
}

// request
// $filter['status'] = request('filter_status', session('filter_status', 'all'));
// session(['filter_status' => $filter['status']]);
// $filter['relates'] = request('filter_relates', session('filter_relates', 'all'));
// session(['filter_relates' => $filter['relates']]);

$filter['status'] = $_GET['filter_status'] ?? (session("filter_status") ?? 'all');
session(["filter_status" => $filter['status']]);
$filter['relates'] = $_GET['filter_relates'] ?? (session("filter_relates") ?? 'all');
session(["filter_relates" => $filter['relates']]);

$this->tpl->assign('filter', $filter);
$this->tpl->assign('currentCanvas', $currentCanvasId);
$this->tpl->assign('goalStats', $goalAnalytics);
$this->tpl->assign('canvasIcon', $this->canvasRepo->getIcon());
Expand Down
1 change: 1 addition & 0 deletions app/Domain/Goalcanvas/Controllers/DelCanvasItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
class DelCanvasItem extends \Leantime\Domain\Canvas\Controllers\DelCanvasItem
{
protected const CANVAS_NAME = 'goal';

}

}
7 changes: 4 additions & 3 deletions app/Domain/Goalcanvas/Templates/bigRockDialog.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
<script>
jQuery(document).ready(function(){
@if (isset($_GET['closeModal']))
<?php if (isset($_GET['closeModal'])): ?>
jQuery.nmTop().close();
@endif
<?php endif ?>
if(jQuery("#wikiTitle").val().length >= 2) {
jQuery("#saveBtn").removeAttr("disabled");
}else{
Expand Down
74 changes: 74 additions & 0 deletions app/Domain/Goalcanvas/Templates/canvasComment.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
@extends($layout)
@section('content')

@php
/**
* canvasComment.inc template - Generic template for comments
*
* Required variables:
* - $canvasName Name of current canvas
*/
$canvasName = "goal";
$id = "";
if (isset($canvasItem['id']) && $canvasItem['id'] != '') {
$id = $canvasItem['id'];
}
@endphp

<script type="text/javascript">
window.onload = function() {
if (!window.jQuery) {
//It's not a modal
location.href = "<?= BASE_URL ?>/<?= $canvasName ?>canvas/showCanvas?showModal=<?php echo $canvasItem['id']; ?>";
}
}
</script>

<div class="showDialogOnLoad" style="display:none;">

<h4 class="widgettitle title-light" style="padding-bottom: 0">
<i class="fas {{ $canvasTypes[$canvasItem['box']]['icon'] }}"></i>
{{ $canvasTypes[$canvasItem['box']]['title'] }}
</h4>
<hr style="margin-top: 5px; margin-bottom: 15px;">

{!! $tpl->displayNotification() !!}

<h5 style="padding-left: 40px"><strong>{{ $tpl->e($canvasItem['description']) }}</strong></h5>

@if ($id !== '')
<br />
<input type="hidden" name="comment" value="1" />
<h4 class="widgettitle title-light">
<span class="fa fa-comments"></span>{{ $tpl->__('subtitles.discussion') }}
</h4>
@php
$tpl->assign("formUrl", "/{{ $canvasName }}canvas/editCanvasComment/" . $id . "");
$tpl->displaySubmodule('comments-generalComment');
@endphp
@endif
</div>


<script type="text/javascript">
jQuery(document).ready(function() {
leantime.editorController.initSimpleEditor();
<?php if (!$login::userIsAtLeast($roles::$editor)) { ?>
leantime.authController.makeInputReadonly(".nyroModalCont");
<?php } ?>
<?php if ($login::userHasRole([$roles::$commenter])) { ?>
leantime.commentsController.enableCommenterForms();
<?php } ?>
})
</script>

@endsection
13 changes: 0 additions & 13 deletions app/Domain/Goalcanvas/Templates/canvasComment.tpl.php

This file was deleted.

182 changes: 182 additions & 0 deletions app/Domain/Goalcanvas/Templates/canvasDialog.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
@extends($layout)
@section('content')

@php
$canvasName = 'goal';
$canvasItem = $tpl->get('canvasItem');
$canvasTypes = $tpl->get('canvasTypes');
$hiddenStatusLabels = $tpl->get('statusLabels');
$statusLabels = $statusLabels ?? $hiddenStatusLabels;
$hiddenRelatesLabels = $tpl->get('relatesLabels');
$relatesLabels = $relatesLabels ?? $hiddenRelatesLabels;
$dataLabels = $tpl->get('dataLabels');
$id = "";
if (isset($canvasItem['id']) && $canvasItem['id'] != '') {
$id = $canvasItem['id'];
}
$currentCanvas = $tpl->get('currentCanvas');
if (isset($_GET['canvasId'])) {
$currentCanvas = (int)$_GET['canvasId'];
}
@endphp

<script type="text/javascript">
window.onload = function() {
if (!window.jQuery) {
//It's not a modal
location.href = "<?= BASE_URL ?>/<?= $canvasName ?>canvas/showCanvas?showModal=<?php echo $canvasItem['id']; ?>";
}
}
</script>

<div style="width:1000px">

<h1><i class="fas <?= $canvasTypes[$canvasItem['box']]['icon']; ?>"></i> <?= $canvasTypes[$canvasItem['box']]['title']; ?></h1>

{{ $tpl->displayNotification() }}

<form class="formModal" method="post" action="{{ BASE_URL."/$canvasName/canvas/editCanvasItem/$id" }}">

<input type="hidden" value="{{ $currentCanvas }}" name="canvasId">
<input type="hidden" value="{{ $canvasItem['box'] }}" name="box" id="box">
<input type="hidden" value="{{ $id }}" name="itemId" id="itemId">
<input type="hidden" name="milestoneId" value="{{ $canvasItem['milestoneId'] ?? '' }}">
<input type="hidden" name="changeItem" value="1">

<div class="col-md-8">
<label>{{ __("label.what_is_your_goal") }}</label>
<input type="text" name="title" value="{{ $canvasItem['title'] }}" style="width:100%"><br>

@if (!empty($relatesLabels))
<label>{{ __("label.relates") }}</label>
<select name="relates" style="width: 50%" id="relatesCanvas">
</select><br>
@else
<input type="hidden" name="relates" value="{{ $canvasItem['relates'] ?? array_key_first($hiddenRelatesLabels) }}">
@endif
<br>
<h4 class="widgettitle title-light" style="margin-bottom:0px;"><i class="fa-solid fa-ranking-star"></i> {{ __("Metrics") }}</h4>

@php
$tpl->dispatchTplEvent('beforeMeasureGoalContainer', $canvasItem); @endphp
<div id="measureGoalContainer">
<label>How will you measure this objective. What metric will you be using.</label>
<input type="text" name="description" value="{{ $canvasItem['description'] }}" style="width:100%"><br>
</div>

<div class="row">
<div class="col-md-3">
<label>Starting Value</label>
<input type="number" step="0.01" name="startValue" value="{{ $canvasItem['startValue'] }}" style="width:105px">
</div>
<div class="col-md-3">
<label>Current Value</label>
<input type="number" step="0.01" name="currentValue" id="currentValueField" value="{{ $canvasItem['currentValue'] }}" @if ($canvasItem['setting']=='linkAndReport' ) readonly data-tippy-content="Current value calculated from child goals" @endif style="width:105px">
</div>
<div class="col-md-3">
<label>Goal Value</label>
<input type="number" step="0.01" name="endValue" value="{{ $canvasItem['endValue'] }}" style="width:105px">
</div>
<div class="col-md-3">
<label>Type</label>
<select name="metricType">
<option value="number" @if ($canvasItem['metricType']=='number' ) selected @endif>Number</option>
<option value="percent" @if ($canvasItem['metricType']=='percent' ) selected @endif>% Percent</option>
<option value="currency" @if ($canvasItem['metricType']=='currency' ) selected @endif>{{ __('language.currency') }}</option>
</select>
</div>
</div>

<br>
@if ($login::userIsAtLeast($roles::$editor))
<input type="submit" value="{{ __("buttons.save") }}" id="primaryCanvasSubmitButton">
<button type="submit" class="btn btn-primary" id="saveAndClose" value="closeModal" onclick="leantime.goalCanvasController.setCloseModal();">{{ __("buttons.save_and_close") }}</button>
@endif

@if ($id !== '')
<br><br><br>
<input type="hidden" name="comment" value="1">
<h4 class="widgettitle title-light"><span class="fa fa-comments"></span>{{ __('subtitles.discussion') }}</h4>
@php
$formUrl = "/strategyPro/editCanvasItem/" . $id;
@endphp
@include('comments.generalComment', ['formUrl' => $formUrl])
@endif
</div>

@if ($id != '')
<a href="{{ url("/$canvasName/canvas/delCanvasItem/$id") }}" class="formModal delete right">
<i class='fa fa-trash-can'></i> {{ __("links.delete") }}
</a>
@endif

</form>


</div>

<script type="text/javascript">
jQuery(document).ready(function() {
leantime.dateController.initDateRangePicker(".startDate", ".endDate");
<?php if (!empty($statusLabels)) { ?>
new SlimSelect({
select: '#statusCanvas',
showSearch: false,
valuesUseText: false,
data: [
<?php foreach ($statusLabels as $key => $data) { ?>
<?php if ($data['active']) { ?> {
innerHTML: '<?php echo "<i class=\"fas fa-fw " . $data["icon"] . "\"></i>&nbsp;" . $data['title']; ?>',
text: "<?= $data['title'] ?>",
value: "<?= $key ?>",
selected: <?php echo $canvasItem['status'] == $key ? 'true' : 'false'; ?>
},
<?php } ?>
<?php } ?>
]
});
<?php } ?>
<?php if (!empty($relatesLabels)) { ?>
new SlimSelect({
select: '#relatesCanvas',
showSearch: false,
valuesUseText: false,
data: [
<?php foreach ($relatesLabels as $key => $data) { ?>
<?php if ($data['active']) { ?> {
innerHTML: '<?php echo "<i class=\"fas fa-fw " . $data["icon"] . "\"></i>&nbsp;" . $data['title']; ?>',
text: "<?= $data['title'] ?>",
value: "<?= $key ?>",
selected: <?php echo $canvasItem['relates'] == $key ? 'true' : 'false'; ?>
},
<?php } ?>
<?php } ?>
]
});
<?php } ?>
leantime.editorController.initSimpleEditor();
<?php if (!$login::userIsAtLeast($roles::$editor)) { ?>
leantime.authController.makeInputReadonly(".nyroModalCont");
<?php } ?>
<?php if ($login::userHasRole([$roles::$commenter])) { ?>
leantime.commentsController.enableCommenterForms();
<?php } ?>
})
</script>

@endsection
Loading

0 comments on commit 9422468

Please sign in to comment.