Gabriel Santiago Plaza пре 3 година
родитељ
комит
bbf3cceb08

+ 13
- 14
app/controllers/CriteriaController.php Прегледај датотеку

@@ -205,13 +205,13 @@ class CriteriaController extends \BaseController
205 205
 
206 206
         $clean_input['copyright'] = trim(preg_replace('/\t+/', '', Input::get('copyright')));
207 207
         $clean_input['notes'] = trim(preg_replace('/\t+/', '', Input::get('notes')));
208
-        // $clean_input['maximum_score'] =  (int) Input::get('maximum_score');
208
+        $clean_input['maximum_score'] =  (int) Input::get('maximum_score');
209 209
         // $clean_input['scale_title'] = Input::get('title');
210
-        //$clean_input['scale_description'] = Input::get('Scales');
210
+        $clean_input['scale_description'] = Input::get('Scales');
211 211
         // $clean_input['min_score'] = Input::get('min');
212 212
         //$clean_input['max_score'] = Input::get('max');
213 213
 
214
-        // $clean_input['number_of_scales'] = sizeof($clean_input['scale_title']);
214
+        $clean_input['number_of_scales'] = sizeof($clean_input['scale_description']);
215 215
 
216 216
 
217 217
         return $clean_input;
@@ -226,8 +226,8 @@ class CriteriaController extends \BaseController
226 226
                 'subcriteria' => $clean_input['subcriteria'],
227 227
                 'outcome_id' => $clean_input['outcome_id'],
228 228
                 'notes' => $clean_input['notes'],
229
-                'copyright' => $clean_input['copyright']
230
-                //'maximum_score' => $clean_input['maximum_score']
229
+                'copyright' => $clean_input['copyright'],
230
+                'maximum_score' => $clean_input['maximum_score']
231 231
             ),
232 232
             array(
233 233
                 'name' => 'required|string',
@@ -235,8 +235,8 @@ class CriteriaController extends \BaseController
235 235
                 'outcome_id' => 'required|array',
236 236
 
237 237
                 'notes' => 'string',
238
-                'copyright' => 'string'
239
-                //'maximum_score' => 'required|integer'
238
+                'copyright' => 'string',
239
+                'maximum_score' => 'required|integer'
240 240
             )
241 241
 
242 242
         );
@@ -318,16 +318,15 @@ class CriteriaController extends \BaseController
318 318
                     }
319 319
                 }
320 320
 
321
-                /*for ($i = 0; $i < sizeof($clean_input['scale_title']); $i++) {
321
+                for ($i = 0; $i < sizeof($clean_input['scale_description']); $i++) {
322 322
                     $scale = new Scale;
323
-                    $scale->title = $clean_input['scale_title'][$i];
324
-                    $scale->position = $i + 1;
323
+
324
+                    $position = $i;
325 325
                     $scale->description = $clean_input['scale_description'][$i];
326
-                    $scale->min_score = $clean_input['min_score'][$i];
327
-                    $scale->max_score = $clean_input['max_score'][$i];
326
+
328 327
 
329 328
                     if ($scale->save()) {
330
-                        DB::insert("insert into `criterion_scale` (`criterion_id`, `scale_id`) values({$criterionId},{$scale->id})");
329
+                        DB::insert("insert into `criterion_scale` (`criterion_id`, `scale_id`, `position`) values({$criterionId},{$scale->id}, {$position})");
331 330
                     } else {
332 331
                         Session::flash('status', 'danger');
333 332
                         Session::flash('message', '<p>Error creating the Scales</p>');
@@ -343,7 +342,7 @@ class CriteriaController extends \BaseController
343 342
                                 return Redirect::to('program-criteria')->withInput();
344 343
                         }
345 344
                     }
346
-                }*/
345
+                }
347 346
 
348 347
                 foreach ($clean_input['program_id'] as $program_id) {
349 348
                     DB::insert("insert into `program_criterion` (`criterion_id`, `program_id`) values({$criterionId},{$program_id})");

+ 9
- 1
app/database/migrations/2021_07_06_075249_fix_activities.php Прегледај датотеку

@@ -30,6 +30,14 @@ class FixActivities extends Migration
30 30
 	 */
31 31
 	public function down()
32 32
 	{
33
-		//
33
+		Schema::table('activities', function (Blueprint $table) {
34
+			$table->text('criteria_achieved')->nullable();
35
+			$table->text('criteria_weights')->nullable();
36
+			$table->text('outcomes_achieved')->nullable();
37
+			$table->text('outcomes_attempted')->nullable();
38
+			$table->text('criteria_achieved_percentage')->nullable();
39
+			$table->text('criteria_participant_count')->nullable();
40
+			$table->text('criteria_achiever_count')->nullable();
41
+		});
34 42
 	}
35 43
 }

+ 1
- 0
app/database/migrations/2021_07_06_075356_criterion_scale.php Прегледај датотеку

@@ -27,6 +27,7 @@ class CriterionScale extends Migration
27 27
 				->on('scales')
28 28
 				->onUpdate('cascade')
29 29
 				->onDelete('cascade');
30
+			$table->integer('position')->unsigned();
30 31
 		});
31 32
 	}
32 33
 

+ 48
- 0
app/database/migrations/2021_07_06_130407_create_transformative_objective_activity.php Прегледај датотеку

@@ -0,0 +1,48 @@
1
+<?php
2
+
3
+use Illuminate\Database\Schema\Blueprint;
4
+use Illuminate\Database\Migrations\Migration;
5
+
6
+class CreateTransformativeObjectiveActivity extends Migration
7
+{
8
+
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		Schema::create('transformative_objective_activity', function (Blueprint $table) {
17
+			$table->increments('id');
18
+			$table->integer('trans_action_id')->unsigned();
19
+			$table->integer('activity_id')->unsigned();
20
+			$table->integer('objective_id')->unsigned();
21
+			$table->foreign('objective_id')
22
+				->references('id')
23
+				->on('objectives')
24
+				->onDelete('cascade')
25
+				->onUpdate('cascade');
26
+			$table->foreign('trans_action_id')
27
+				->references('id')
28
+				->on('transformative_actions')
29
+				->onDelete('cascade')
30
+				->onUpdate('cascade');
31
+			$table->foreign('activity_id')
32
+				->references('id')
33
+				->on('activities')
34
+				->onDelete('cascade')
35
+				->onUpdate('cascade');
36
+		});
37
+	}
38
+
39
+	/**
40
+	 * Reverse the migrations.
41
+	 *
42
+	 * @return void
43
+	 */
44
+	public function down()
45
+	{
46
+		Schema::drop('transformative_objective_activity');
47
+	}
48
+}

+ 1
- 1
app/views/local/managers/admins/new_criteria.blade.php Прегледај датотеку

@@ -18,7 +18,7 @@
18 18
                     <div class="form-group col-md-11">
19 19
                         <label>Associated Outcomes</label>
20 20
 
21
-                        {{ Form::select('outcome[]', $outcomes, reset($outcomes),  ['class'=>'form-control selectpicker', 'id' =>'outcome0', 'onchange'=>'fetchObjectiveForSelect('outcomeGroup', 'objectiveGroup')']) }}
21
+                        {{ Form::select('outcome[]', $outcomes, reset($outcomes),  ['class'=>'form-control selectpicker', 'id' =>'outcome0', 'onchange'=>'fetchObjectiveForSelect("outcomeGroup", "objectiveGroup")']) }}
22 22
 
23 23
                     </div>
24 24
                 </div>

+ 128
- 1
app/views/local/managers/pCoords/criteria.blade.php Прегледај датотеку

@@ -67,7 +67,19 @@
67 67
                     <p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
68 68
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'aria-labelledby'=>'subcriteria')) }}
69 69
                 </div>
70
-                
70
+                <div class="form-group">
71
+                    {{ Form::label('maximum_score', 'Maximum Score') }}
72
+                    {{ Form::text('maximum_score', '1', array('class' => 'form-control', 'id'=>'maximum_score', 'oninput'=>'addOptions("Num_scale", "maximum_score", "Scales")')) }}
73
+                </div>
74
+                <div class="form-group">
75
+                    {{ Form::label('scales', 'Number of Scales') }}
76
+                    <select id="Num_scale" name="scales" class="form-control selectpicker" onchange='numberOfScales("Num_scale", "Scales")'>
77
+
78
+                    </select>
79
+                </div>
80
+                <div id='Scales' data-value="0">
81
+
82
+                </div>
71 83
 
72 84
 
73 85
                 <div class="form-group">
@@ -200,6 +212,21 @@
200 212
                     <p class="help-block"><strong>Manually add</strong> bullets or numbering.</p>
201 213
                     {{ Form::textarea('subcriteria', '', array('class' => 'form-control', 'rows'=>3, 'id' => 'criterion_subcriteria')) }}
202 214
                 </div>
215
+                <div class="form-group">
216
+                    {{ Form::label('assoc_maximum_score', 'Maximum Score') }}
217
+                    {{ Form::text('assoc_maximum_score', '', array('class' => 'form-control', 'id'=>'assoc_maximum_score', 'oninput'=>'addOptions("Num_assoc_scale", "assoc_maximum_score", "Assoc_Scales")')) }}
218
+                </div>
219
+
220
+
221
+                <div class="form-group">
222
+                    {{ Form::label('scales', 'Number of Scales') }}
223
+                    <select id="Num_assoc_scale" class="form-control selectpicker" onchange='numberOfAssoc("Num_assoc_scale", "Assoc_Scales")'>
224
+
225
+                    </select>
226
+                </div>
227
+                <div id='Assoc_Scales' data-value="0">
228
+
229
+                </div>
203 230
 
204 231
 
205 232
 
@@ -232,9 +259,109 @@
232 259
     var counter = 1;
233 260
     var counterObj = 1;
234 261
     var outcomeString = 'OutcomeGroup_';
262
+
263
+    $(document).ready(function() {
264
+        addOptions('Num_scale', 'maximum_score', 'Scales');
265
+        numberOfScales('Num_scale', 'Scales');
266
+    });
267
+
268
+    function addOptions(select, max, scaleDiv) {
269
+
270
+        
271
+        var maxscore = parseInt($('#' + max).val())
272
+        options = '<option value = "1"> 1</option>';
273
+        selectedValue = 1;
274
+    valueBefore = 0;
275
+        for (var i = 2; i <= 20; i++) {
276
+            if(maxscore%i==0){
277
+                options += '<option value="' + i.toString() + '">' + i.toString() + '</option>';
278
+                
279
+            }
280
+            
281
+        }
282
+
283
+        var previousvalue = parseInt($('#' + select).val());
284
+        $('#' + select).html(options);
285
+        $('#' + select).val(previousvalue);
286
+        $('#' + select).selectpicker('refresh');
287
+    }
288
+
289
+    function numberOfAssoc(string, Scales) {
290
+        var maximum = $('#assoc_maximum_score').val();
291
+        var amountOfScale = parseInt($('#' + string).val());
292
+        var dataValue = parseInt($('#' + Scales).attr('data-value'));
293
+        //add
294
+        if (dataValue < amountOfScale) {
295
+
296
+            fullDiv = '';
297
+
298
+            for (var i = dataValue; i < amountOfScale; i++) {
299
+                div = '<div id="assoc_eval' + i.toString() + Scales + '">' +
300
+                    '<div class ="form-group">' +
301
+                    '<label for ="descripcion' + i.toString() + '">Descripción de evaluación</label>' +
302
+                    '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="assoc_scales[]" cols="50" ></textarea></div></div>';
303
+                fullDiv += div;
304
+
305
+
306
+            }
307
+
308
+            $('#' + Scales).append(fullDiv);
309
+            $('#' + Scales).attr('data-value', amountOfScale);
310
+        } else {
311
+            for (var i = dataValue; i > amountOfScale; i--) {
312
+                $('#assoc_eval' + (i - 1).toString()).remove();
313
+            }
314
+        }
315
+        $('#' + Scales).attr('data-value', amountOfScale);
316
+
317
+    }
235 318
    
319
+    function numberOfScales(string, Scales) {
320
+        var maximum = parseInt($('#maximum_score').val());
321
+        var amountOfScale = parseInt($('#' + string).val());
322
+        var dataValue = parseInt($('#' + Scales).attr('data-value'));
323
+        var division = maximum/amountOfScale;
324
+        //add
325
+    
326
+
236 327
 
237 328
 
329
+            fullDiv = '';
330
+            if(division ==1){
331
+                for (var i = 0; i < amountOfScale; i++) {
332
+                div = '<div id="eval' + i.toString() + Scales + '">' +
333
+                    '<div class ="form-group">' +
334
+                    '<label id = "label_for_des'+i.toString()+'" for ="descripcion' + i.toString() + '">Scale Description ('+(i+1)+')</label>' +
335
+                    '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="' + Scales + '[]" cols="50" ></textarea></div></div>';
336
+                fullDiv += div;
337
+            }
338
+            }
339
+            else if(division==maximum){
340
+
341
+                div = '<div id="eval' + 0 + Scales + '">' +
342
+                    '<div class ="form-group">' +
343
+                    '<label id = "label_for_des'+0+'" for ="descripcion' + 0 + '">Scale Description ('+1+' - '+maximum+')</label>' +
344
+                    '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + 0 + '" name="' + Scales + '[]" cols="50" ></textarea></div></div>';
345
+                fullDiv += div;
346
+            }
347
+
348
+            else{
349
+                for (var i = 0; i < amountOfScale; i++) {
350
+                div = '<div id="eval' + i.toString() + Scales + '">' +
351
+                    '<div class ="form-group">' +
352
+                    '<label id = "label_for_des'+i.toString()+'" for ="descripcion' + i.toString() + '">Scale Description ('+(1+(i*division))+' - '+((1+i)*division)+')</label>' +
353
+                    '<textarea class="form-control" rows="2" aria-labelledby="descripcion' + i.toString() + '" name="' + Scales + '[]" cols="50" ></textarea></div></div>';
354
+                fullDiv += div;
355
+            }
356
+            }
357
+
358
+            $('#' + Scales).html(fullDiv);
359
+
360
+        
361
+        $('#' + Scales).attr('data-value', amountOfScale);
362
+
363
+    }
364
+
238 365
 $('.filterSection').hide();
239 366
     $('.filterButton').on('click', function()
240 367
 {

+ 2
- 2
app/views/local/managers/shared/rubrics.blade.php Прегледај датотеку

@@ -1015,14 +1015,14 @@ function changeTable(){
1015 1015
             counter = 0;
1016 1016
             division = maximum/amount_of_scales;
1017 1017
             if(amount_of_scales==1){
1018
-                newScaleHeaders+= "<th>Score (1 - "+maximum+")</th>";
1018
+                newScaleHeaders+= "<th class = 'editable' data-type = 'textarea'>Score (1 - "+maximum+")</th>";
1019 1019
             }
1020 1020
             else if(maximum!= amount_of_scales){
1021 1021
             while(counter <amount_of_scales){
1022 1022
                 
1023 1023
                 minimumScore = 1+(counter*division);
1024 1024
                 maximumScore = (1+counter)*division;
1025
-                newScaleHeaders+= "<th>Scale "+ (counter +1) + " ("+minimumScore+" - "+maximumScore+")</th>";
1025
+                newScaleHeaders+= "<th class = 'editable' data-type = 'textarea'>Scale "+ (counter +1) + " ("+minimumScore+" - "+maximumScore+")</th>";
1026 1026
                 counter++;
1027 1027
             }
1028 1028
             }else{