Skip to content
Snippets Groups Projects
Commit fab77f79 authored by Yonas Adiel's avatar Yonas Adiel
Browse files

add satuan to frontend

parent dabc8f26
1 merge request!16Add unit column
Pipeline #15386 passed with stage
in 3 minutes and 22 seconds
......@@ -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;
......
......@@ -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()
......
......@@ -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>
......@@ -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,
});
}
......
......@@ -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"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment