Browse Source

arreglos en rubric builder

parent
commit
2ac41cf107

+ 10
- 3
app/controllers/TemplatesController.php View File

@@ -200,12 +200,15 @@ class TemplatesController extends \BaseController
200 200
 			$templates = Template::orderBy('name', 'ASC')->get();
201 201
 			$programs = Program::orderBy('name', 'ASC')->get();
202 202
 			$criteria = Criterion::orderBy('name', 'ASC')->get();
203
+			$school_id_user=NULL;
203 204
 		} else {
204 205
 			if ($role == 2) {
205 206
 				$programs = Auth::user()->school->programs;
207
+				$school_id_user=Auth::user()->school_id;
206 208
 			}
207 209
 			if ($role == 3) {
208 210
 				$programs = Auth::user()->programs()->get();
211
+				$school_id_user=Auth::user()->programs[0]->school->id;
209 212
 			}
210 213
 			$program_ids = array();
211 214
 			foreach ($programs as $program) {
@@ -217,7 +220,8 @@ class TemplatesController extends \BaseController
217 220
 					$q->whereIn('program_id', $program_ids);
218 221
 				}
219 222
 			)->orderBy('name', 'ASC')->get();
220
-			$templates = Template::where('school_id', '=', Auth::user()->programs[0]->school->id)->orWhere('school_id', '=', NULL)
223
+			}
224
+			$templates = Template::where('school_id', '=', $school_id_user)->orWhere('school_id', '=', NULL)
221 225
 				->orderBy('name', 'ASC')->get();
222 226
 			$criteria_ids = array();
223 227
 			foreach ($criteria as $criterion) {
@@ -231,12 +235,15 @@ class TemplatesController extends \BaseController
231 235
 			foreach ($templates_fuera as $tf) {
232 236
 				$templates_fuera_ids[] = $tf->id;
233 237
 			}
238
+// 			Log::info(json_encode($templates_fuera_ids));
239
+// exit();
234 240
 			$templates_dentro = Template::whereNotIn('id', $templates_fuera_ids)
235 241
 				->orderBy('name', 'ASC')->get();
236 242
 
237
-			// 			var_dump(json_encode($templates_dentro));
238
-		}
243
+// 			if(!isset($templates_dentro))$templates_dentro=
239 244
 
245
+			// 			var_dump(json_encode($templates_dentro));
246
+// 		}
240 247
 
241 248
 
242 249
 		return View::make('local.managers.shared.rubrics_new', compact('title', 'templates_dentro', 'templates_fuera', 'outcomes', 'criteria', 'schools', 'programs', 'criteria_ids'));

+ 3
- 1
app/views/local/managers/shared/rubrics_new.blade.php View File

@@ -1073,12 +1073,14 @@ console.log($('#select-school'));
1073 1073
             var programs = {{ json_encode(Auth::user()->programs->lists('id')) }};
1074 1074
         
1075 1075
             var template_program = selected.data('template-program-id');
1076
+         //   console.log(selected.data('template-program-id'));
1077
+          //  console.log(programs.includes(selected.data('template-program-id').toString()));
1076 1078
         
1077 1079
         if(
1078 1080
             {{ Auth::user()->role }}==1
1079 1081
             || ({{ Auth::user()->role }}==2 && selected.data('admin')!=1)
1080 1082
             || ({{ Auth::user()->role }}==3
1081
-                && programs.includes(selected.data('template-program-id'))
1083
+                && programs.includes(selected.data('template-program-id').toString())
1082 1084
 
1083 1085
                 && selected.data('admin')!=1
1084 1086
             )