diff --git a/viz-dev-backend/app/Http/Controllers/SeriesController.php b/viz-dev-backend/app/Http/Controllers/SeriesController.php index a234a9b72448d8c5a69398f331e80638211ebc4d..517480b782a16823e171b1ef42f587ad406d66f7 100644 --- a/viz-dev-backend/app/Http/Controllers/SeriesController.php +++ b/viz-dev-backend/app/Http/Controllers/SeriesController.php @@ -44,6 +44,7 @@ class SeriesController extends Controller if ($series) { $series->name = $request->input('name') ? : $series->name; $series->description = $request->input('description') ? : $series->description; + $series->unit = $request->input('unit') ? : $series->unit; $series->save(); return $series; diff --git a/viz-dev-backend/tests/Feature/SeriesControllerTest.php b/viz-dev-backend/tests/Feature/SeriesControllerTest.php index c9d43bda491d504f9cbe64fec7d8fdb1ab108566..1274143a134fc6df2adabc3741271b1a7ebdc0de 100644 --- a/viz-dev-backend/tests/Feature/SeriesControllerTest.php +++ b/viz-dev-backend/tests/Feature/SeriesControllerTest.php @@ -131,6 +131,7 @@ class SeriesControllerTest extends TestCase $new_series = [ 'name' => 'Series 1 baru', 'description' => 'Deskripsi Series 1 baru', + 'unit' => 'satuan', ]; $response = $this->actingAs($this->pemprov_user)->json('PATCH', $this->api . $updated_series->id . '/', $new_series); @@ -139,10 +140,12 @@ class SeriesControllerTest extends TestCase $series = $response->json(); $this->assertEquals($series['name'], $new_series['name'], 'Series returned should have equal name to the patched name'); $this->assertEquals($series['description'], $new_series['description'], 'Series returned should have equal desc to the patched desc'); + $this->assertEquals($series['unit'], $new_series['unit'], 'Series returned should have equal unit to the patched unit'); $updated_series->refresh(); $this->assertEquals($updated_series['name'], $new_series['name'], 'The series should have equal name to the patched name'); $this->assertEquals($updated_series['description'], $new_series['description'], 'The series should have equal desc to the patched desc'); + $this->assertEquals($updated_series['unit'], $new_series['unit'], 'The series should have equal unit to the patched unit'); } public function testUpdateSeriesSuccessPartial() diff --git a/viz-dev-frontend/src/components/Card.vue b/viz-dev-frontend/src/components/Card.vue index ada6c8e2f21c315df20852d1403a71a6cb388691..1e7afc0a79c326e132f40d8cea3628547733c38b 100644 --- a/viz-dev-frontend/src/components/Card.vue +++ b/viz-dev-frontend/src/components/Card.vue @@ -3,7 +3,9 @@ <img v-if="link" v-bind:src="require(`@/assets/${link}`)" class="logo"/> <div class="container"> <h4><b>{{ name }}</b></h4> - <p>{{ desc }}</p> + <br/> + <p class="text-small">{{ sub }}</p> + <p class="text-small">{{ desc }}</p> </div> </div> </template> @@ -11,7 +13,7 @@ <script> export default { name: 'Card', - props: ['link', 'name', 'desc'], + props: ['link', 'name', 'sub', 'desc'], }; </script> @@ -37,4 +39,8 @@ export default { transform: scale(1.1); z-index: 100; } + +.text-small { + font-size: .8em; +} </style> diff --git a/viz-dev-frontend/src/components/SeriesDescription.vue b/viz-dev-frontend/src/components/SeriesDescription.vue index 74c1418f99b4ec1983f9c166a57881c4f99375e0..a410cf9c08d51e7a27b406c9edbd954c0ffdaa9c 100644 --- a/viz-dev-frontend/src/components/SeriesDescription.vue +++ b/viz-dev-frontend/src/components/SeriesDescription.vue @@ -26,6 +26,7 @@ export default { for (let i = 0; i < series.length; i += 1) { this.propsCards.push({ name: series[i].name, + sub: `Satuan: ${series[i].unit}`, desc: series[i].description, }); } diff --git a/viz-dev-frontend/src/views/SeriesEdit.vue b/viz-dev-frontend/src/views/SeriesEdit.vue index f29f0029bce7971979f961856b1ace2eda5087e7..8dfad892ba4ed1ef788bc510b9797959601f84da 100644 --- a/viz-dev-frontend/src/views/SeriesEdit.vue +++ b/viz-dev-frontend/src/views/SeriesEdit.vue @@ -15,6 +15,7 @@ <div>Nama: <input type="text" v-model="series.name"></div> <div>Deskripsi: </div> <div><textarea type="text" v-model="series.description"></textarea></div> + <div>Satuan: <input type="text" v-model="series.unit"></div> <Loader class="loader" v-if="isSavingSeries" /> <button class="btn save-series"