@@ -158,9 +158,9 @@ |
||
158 | 158 | foreach ($fields as $f) { |
159 | 159 | if ($this->fieldHelper->isIdField($f)) { |
160 | 160 | $display = $this->crudApi->getRelatedDisplay($f); |
161 | - $output .= '<td>' . $display . '</td>'; |
|
161 | + $output .= '<td>'.$display.'</td>'; |
|
162 | 162 | } else { |
163 | - $output .= '<td>' . $instance->$f . '</td>'; |
|
163 | + $output .= '<td>'.$instance->$f.'</td>'; |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | return $output; |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | private function modalUrl($type) |
128 | 128 | { |
129 | 129 | switch ($type) { |
130 | - case 'edit': |
|
131 | - $action = 'update'; |
|
132 | - break; |
|
133 | - default: |
|
134 | - $action = $type; |
|
135 | - break; |
|
130 | + case 'edit': |
|
131 | + $action = 'update'; |
|
132 | + break; |
|
133 | + default: |
|
134 | + $action = $type; |
|
135 | + break; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | return route('crudapi.'.$action.'.item', $this->model); |
@@ -154,69 +154,69 @@ discard block |
||
154 | 154 | $output = ''; |
155 | 155 | |
156 | 156 | switch ($type) { |
157 | - case 'form-create': |
|
158 | - $output .= $this->fieldHelper->formCreate($fields); |
|
159 | - break; |
|
160 | - case 'form-edit': |
|
161 | - foreach ($fields as $f) { |
|
162 | - $ucF = ucfirst($f); |
|
157 | + case 'form-create': |
|
158 | + $output .= $this->fieldHelper->formCreate($fields); |
|
159 | + break; |
|
160 | + case 'form-edit': |
|
161 | + foreach ($fields as $f) { |
|
162 | + $ucF = ucfirst($f); |
|
163 | 163 | |
164 | - $input_attr = [ |
|
165 | - 'class' => 'form-control', |
|
166 | - 'id' => 'editItem'.$ucF, |
|
167 | - 'name' => $f, |
|
168 | - ]; |
|
164 | + $input_attr = [ |
|
165 | + 'class' => 'form-control', |
|
166 | + 'id' => 'editItem'.$ucF, |
|
167 | + 'name' => $f, |
|
168 | + ]; |
|
169 | 169 | |
170 | - $output .= '<fieldset class="form-group">'; |
|
170 | + $output .= '<fieldset class="form-group">'; |
|
171 | 171 | |
172 | - $output .= '<label for="'.$input_attr['id'].'">'.$ucF.'</label>'; |
|
172 | + $output .= '<label for="'.$input_attr['id'].'">'.$ucF.'</label>'; |
|
173 | 173 | |
174 | - if ($this->fieldHelper->isIdField($f)) { |
|
175 | - $input_attr['type'] = 'select'; |
|
174 | + if ($this->fieldHelper->isIdField($f)) { |
|
175 | + $input_attr['type'] = 'select'; |
|
176 | 176 | |
177 | - $output .= '<select '; |
|
178 | - foreach ($input_attr as $attr => $value) { |
|
179 | - $output .= "{$attr}='{$value}'"; |
|
180 | - } |
|
177 | + $output .= '<select '; |
|
178 | + foreach ($input_attr as $attr => $value) { |
|
179 | + $output .= "{$attr}='{$value}'"; |
|
180 | + } |
|
181 | 181 | |
182 | - $relation = $this->getRelatedModel($f); |
|
183 | - $output .= '>'; |
|
182 | + $relation = $this->getRelatedModel($f); |
|
183 | + $output .= '>'; |
|
184 | 184 | |
185 | - $output .= $this->getRelatedOptions($relation); |
|
186 | - $output .= '</select>'; |
|
187 | - } else { |
|
188 | - $input_attr['type'] = 'text'; |
|
185 | + $output .= $this->getRelatedOptions($relation); |
|
186 | + $output .= '</select>'; |
|
187 | + } else { |
|
188 | + $input_attr['type'] = 'text'; |
|
189 | 189 | |
190 | - $output .= '<input '; |
|
191 | - foreach ($input_attr as $attr => $value) { |
|
192 | - $output .= "{$attr}='{$value}'"; |
|
190 | + $output .= '<input '; |
|
191 | + foreach ($input_attr as $attr => $value) { |
|
192 | + $output .= "{$attr}='{$value}'"; |
|
193 | + } |
|
194 | + $output .= '>'; |
|
193 | 195 | } |
194 | - $output .= '>'; |
|
195 | - } |
|
196 | 196 | |
197 | - $output .= '</fieldset>'; |
|
198 | - } |
|
199 | - break; |
|
200 | - case 'table-headings': |
|
201 | - $output .= $this->fieldHelper->tableHeadings($fields); |
|
202 | - break; |
|
203 | - case 'table-content': |
|
204 | - $output .= $this->fieldHelper->tableContent($fields, $this->instance); |
|
205 | - break; |
|
206 | - // JavaScript Variables |
|
207 | - case 'js-var': |
|
208 | - foreach ($fields as $f) { |
|
209 | - $output .= 'var '.$f.' = '.$this->instance->$f.'; '; |
|
210 | - } |
|
211 | - break; |
|
212 | - case 'js-modal-create': |
|
213 | - foreach ($fields as $f) { |
|
214 | - $output .= '"'.$f.'": $(\'#createItem'.$f.'\').val(), '; |
|
215 | - } |
|
216 | - break; |
|
217 | - default: |
|
218 | - return; |
|
197 | + $output .= '</fieldset>'; |
|
198 | + } |
|
199 | + break; |
|
200 | + case 'table-headings': |
|
201 | + $output .= $this->fieldHelper->tableHeadings($fields); |
|
219 | 202 | break; |
203 | + case 'table-content': |
|
204 | + $output .= $this->fieldHelper->tableContent($fields, $this->instance); |
|
205 | + break; |
|
206 | + // JavaScript Variables |
|
207 | + case 'js-var': |
|
208 | + foreach ($fields as $f) { |
|
209 | + $output .= 'var '.$f.' = '.$this->instance->$f.'; '; |
|
210 | + } |
|
211 | + break; |
|
212 | + case 'js-modal-create': |
|
213 | + foreach ($fields as $f) { |
|
214 | + $output .= '"'.$f.'": $(\'#createItem'.$f.'\').val(), '; |
|
215 | + } |
|
216 | + break; |
|
217 | + default: |
|
218 | + return; |
|
219 | + break; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | echo $output; |
@@ -277,17 +277,17 @@ discard block |
||
277 | 277 | $class = get_class($field); |
278 | 278 | |
279 | 279 | switch ($class) { |
280 | - case 'App\\Helpers\\CrudApi': |
|
281 | - break; |
|
282 | - case 'App\\Indicator': |
|
283 | - return $field->indicator; |
|
284 | - break; |
|
285 | - case 'Taskforcedev\\CrudApi\\Helpers\\CrudApi': |
|
286 | - return false; |
|
287 | - break; |
|
288 | - default: |
|
289 | - return $field->name; |
|
280 | + case 'App\\Helpers\\CrudApi': |
|
290 | 281 | break; |
282 | + case 'App\\Indicator': |
|
283 | + return $field->indicator; |
|
284 | + break; |
|
285 | + case 'Taskforcedev\\CrudApi\\Helpers\\CrudApi': |
|
286 | + return false; |
|
287 | + break; |
|
288 | + default: |
|
289 | + return $field->name; |
|
290 | + break; |
|
291 | 291 | } |
292 | 292 | } |
293 | 293 |