Issues (323)

src/views/components/action.blade.php (3 issues)

1
@foreach($addaction as $a)
2
    <?php
3
    foreach ($row as $key => $val) {
4
        $a['url'] = str_replace("[".$key."]", $val, $a['url']);
5
    }
6
7
    $confirm_box = '';
8
    if (isset($a['confirmation']) && ! empty($a['confirmation']) && $a['confirmation']) {
9
10
        $a['confirmation_title'] = ! empty($a['confirmation_title']) ? $a['confirmation_title'] : trans('crudbooster.confirmation_title');
11
        $a['confirmation_text'] = ! empty($a['confirmation_text']) ? $a['confirmation_text'] : trans('crudbooster.confirmation_text');
12
        $a['confirmation_type'] = ! empty($a['confirmation_type']) ? $a['confirmation_type'] : 'warning';
13
        $a['confirmation_showCancelButton'] = empty($a['confirmation_showCancelButton']) ? 'true' : 'false';
14
        $a['confirmation_confirmButtonColor'] = ! empty($a['confirmation_confirmButtonColor']) ? $a['confirmation_confirmButtonColor'] : '#DD6B55';
15
        $a['confirmation_confirmButtonText'] = ! empty($a['confirmation_confirmButtonText']) ? $a['confirmation_confirmButtonText'] : trans('crudbooster.confirmation_yes');;
16
        $a['confirmation_cancelButtonText'] = ! empty($a['confirmation_cancelButtonText']) ? $a['confirmation_cancelButtonText'] : trans('crudbooster.confirmation_no');;
17
        $a['confirmation_closeOnConfirm'] = empty($a['confirmation_closeOnConfirm']) ? 'true' : 'false';
18
19
        $confirm_box = '
20
        swal({   
21
            title: "'.$a['confirmation_title'].'",
22
            text: "'.$a['confirmation_text'].'",
23
            type: "'.$a['confirmation_type'].'",
24
            showCancelButton: '.$a['confirmation_showCancelButton'].',
25
            confirmButtonColor: "'.$a['confirmation_confirmButtonColor'].'",
26
            confirmButtonText: "'.$a['confirmation_confirmButtonText'].'",
27
            cancelButtonText: "'.$a['confirmation_cancelButtonText'].'",
28
            closeOnConfirm: '.$a['confirmation_closeOnConfirm'].', }, 
29
            function(){  location.href="'.$a['url'].'"});        
30
31
        ';
32
    }
33
34
    $label = $a['label'];
35
    $title = ($a['title']) ?: $a['label'];
36
    $icon = $a['icon'];
37
    $color = $a['color'] ?: 'primary';
38
    $confirmation = $a['confirmation'];
39
    $target = $a['target'] ?: '_self';
40
41
    $url = $a['url'];
42
    if (isset($confirmation) && ! empty($confirmation)) {
43
        $url = "javascript:;";
44
    }
45
46
    if (isset($a['showIf'])) {
47
48
        $query = $a['showIf'];
49
50
        foreach ($row as $key => $val) {
51
            $query = str_replace("[".$key."]", '"'.$val.'"', $query);
52
        }
53
54
        @eval("if($query) {
0 ignored issues
show
The use of eval() is discouraged.
Loading history...
55
          echo \"<a class='btn btn-xs btn-\$color' title='\$title' onclick='\$confirm_box' href='\$url' target='\$target'><i class='\$icon'></i> $label</a>&nbsp;\";
56
      }");
57
    } else {
58
        echo "<a class='btn btn-xs btn-$color' title='$title' onclick='$confirm_box' href='$url' target='$target'><i class='$icon'></i> $label</a>&nbsp;";
59
    }
60
    ?>
61
@endforeach
62
63
@if($button_action_style == 'button_text')
64
65
    @if(CRUDBooster::isRead() && $button_detail)
66
        <a class='btn btn-xs btn-primary btn-detail' title='{{trans("crudbooster.action_detail_data")}}'
67
           href='{{CRUDBooster::mainpath("detail/".$row->$pk)."?return_url=".urlencode(Request::fullUrl())}}'>{{trans("crudbooster.action_detail_data")}}</a>
68
    @endif
69
70
    @if(CRUDBooster::isUpdate() && $button_edit)
71
        <a class='btn btn-xs btn-success btn-edit' title='{{trans("crudbooster.action_edit_data")}}'
72
           href='{{CRUDBooster::mainpath("edit/".$row->$pk)."?return_url=".urlencode(Request::fullUrl())."&parent_id=".g("parent_id")."&parent_field=".$parent_field }}'>{{trans("crudbooster.action_edit_data")}}</a>
73
    @endif
74
75
    @if(CRUDBooster::isDelete() && $button_delete)
76
        <?php $url = CRUDBooster::mainpath("delete/".$row->$pk);?>
0 ignored issues
show
The type CRUDBooster was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
77
        <a class='btn btn-xs btn-warning btn-delete' title='{{trans("crudbooster.action_delete_data")}}' href='javascript:;'
78
           onclick='{{CRUDBooster::deleteConfirm($url)}}'>{{trans("crudbooster.action_delete_data")}}</a>
79
    @endif
80
@elseif($button_action_style == 'button_icon_text')
81
82
83
    @if(CRUDBooster::isRead() && $button_detail)
84
        <a class='btn btn-xs btn-primary btn-detail' title='{{trans("crudbooster.action_detail_data")}}'
85
           href='{{CRUDBooster::mainpath("detail/".$row->$pk)."?return_url=".urlencode(Request::fullUrl())}}'><i
86
                    class='fa fa-eye'></i> {{trans("crudbooster.action_detail_data")}}</a>
87
    @endif
88
89
    @if(CRUDBooster::isUpdate() && $button_edit)
90
        <a class='btn btn-xs btn-success btn-edit' title='{{trans("crudbooster.action_edit_data")}}'
91
           href='{{CRUDBooster::mainpath("edit/".$row->$pk)."?return_url=".urlencode(Request::fullUrl())."&parent_id=".g("parent_id")."&parent_field=".$parent_field }}'><i
92
                    class='fa fa-pencil'></i> {{trans("crudbooster.action_edit_data")}}</a>
93
    @endif
94
95
    @if(CRUDBooster::isDelete() && $button_delete)
96
        <?php $url = CRUDBooster::mainpath("delete/".$row->$pk);?>
97
        <a class='btn btn-xs btn-warning btn-delete' title='{{trans("crudbooster.action_delete_data")}}' href='javascript:;'
98
           onclick='{{CRUDBooster::deleteConfirm($url)}}'><i class='fa fa-trash'></i> {{trans("crudbooster.action_delete_data")}}</a>
99
    @endif
100
101
@elseif($button_action_style == 'dropdown')
102
103
    <div class='btn-group btn-group-action'>
104
        <button type='button' class='btn btn-xs btn-primary btn-action'>{{trans("crudbooster.action_label")}}</button>
105
        <button type='button' class='btn btn-xs btn-primary dropdown-toggle' data-toggle='dropdown'>
106
            <span class='caret'></span>
107
            <span class='sr-only'>Toggle Dropdown</span>
108
        </button>
109
        <ul class='dropdown-menu dropdown-menu-action' role='menu'>
110
            @foreach($addaction as $a)
111
                <?php
112
                foreach ($row as $key => $val) {
113
                    $a['url'] = str_replace("[".$key."]", $val, $a['url']);
114
                }
115
116
                $label = $a['label'];
117
                $url = $a['url']."?return_url=".urlencode(Request::fullUrl());
118
                $icon = $a['icon'];
119
                $color = $a['color'] ?: 'primary';
120
121
                if (isset($a['showIf'])) {
122
123
                    $query = $a['showIf'];
124
125
                    foreach ($row as $key => $val) {
126
                        $query = str_replace("[".$key."]", '"'.$val.'"', $query);
127
                    }
128
129
                    @eval("if($query) {
0 ignored issues
show
The use of eval() is discouraged.
Loading history...
130
                        echo \"<li><a title='\$label' href='\$url'><i class='\$icon'></i> \$label</a></li>\";
131
                    }");
132
                } else {
133
                    echo "<li><a title='$label' href='$url'><i class='$icon'></i> $label</a></li>";
134
                }
135
                ?>
136
            @endforeach
137
138
            @if(CRUDBooster::isRead() && $button_detail)
139
                <li><a class='btn-detail' title='{{trans("crudbooster.action_detail_data")}}'
140
                       href='{{CRUDBooster::mainpath("detail/".$row->$pk)."?return_url=".urlencode(Request::fullUrl())}}'><i
141
                                class='fa fa-eye'></i> {{trans("crudbooster.action_detail_data")}}</a></li>
142
            @endif
143
144
            @if(CRUDBooster::isUpdate() && $button_edit)
145
                <li><a class='btn-edit' title='{{trans("crudbooster.action_edit_data")}}'
146
                       href='{{CRUDBooster::mainpath("edit/".$row->$pk)."?return_url=".urlencode(Request::fullUrl())."&parent_id=".g("parent_id")."&parent_field=".$parent_field}}'><i
147
                                class='fa fa-pencil'></i> {{trans("crudbooster.action_edit_data")}}</a></li>
148
            @endif
149
150
            @if(CRUDBooster::isDelete() && $button_delete)
151
                <?php $url = CRUDBooster::mainpath("delete/".$row->$pk);?>
152
                <li><a class='btn-delete' title='{{trans("crudbooster.action_delete_data")}}' href='javascript:;'
153
                       onclick='{{CRUDBooster::deleteConfirm($url)}}'><i class='fa fa-trash'></i> {{trans("crudbooster.action_delete_data")}}</a></li>
154
            @endif
155
        </ul>
156
    </div>
157
158
@else
159
160
    @if(CRUDBooster::isRead() && $button_detail)
161
        <a class='btn btn-xs btn-primary btn-detail' title='{{trans("crudbooster.action_detail_data")}}'
162
           href='{{CRUDBooster::mainpath("detail/".$row->$pk)."?return_url=".urlencode(Request::fullUrl())}}'><i class='fa fa-eye'></i></a>
163
    @endif
164
165
    @if(CRUDBooster::isUpdate() && $button_edit)
166
        <a class='btn btn-xs btn-success btn-edit' title='{{trans("crudbooster.action_edit_data")}}'
167
           href='{{CRUDBooster::mainpath("edit/".$row->$pk)."?return_url=".urlencode(Request::fullUrl())."&parent_id=".g("parent_id")."&parent_field=".$parent_field}}'><i
168
                    class='fa fa-pencil'></i></a>
169
    @endif
170
171
    @if(CRUDBooster::isDelete() && $button_delete)
172
        <?php $url = CRUDBooster::mainpath("delete/".$row->$pk);?>
173
        <a class='btn btn-xs btn-warning btn-delete' title='{{trans("crudbooster.action_delete_data")}}' href='javascript:;'
174
           onclick='{{CRUDBooster::deleteConfirm($url)}}'><i class='fa fa-trash'></i></a>
175
    @endif
176
177
@endif
178