Added project colors
This commit is contained in:
parent
37701a0484
commit
0dedd964de
8 changed files with 87 additions and 11 deletions
|
@ -49,7 +49,9 @@ class JsonBuilder
|
||||||
"user_id" => "",
|
"user_id" => "",
|
||||||
"start_date" => "",
|
"start_date" => "",
|
||||||
"duration" => "",
|
"duration" => "",
|
||||||
"record_count" => ""
|
"record_count" => "",
|
||||||
|
"color" => "",
|
||||||
|
"visible" => ""
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->jsonData['projects'] = array();
|
$this->jsonData['projects'] = array();
|
||||||
|
@ -83,7 +85,8 @@ class JsonBuilder
|
||||||
$columns = array(
|
$columns = array(
|
||||||
"record_tag_id" => "",
|
"record_tag_id" => "",
|
||||||
"name" => "",
|
"name" => "",
|
||||||
"user_id" => ""
|
"user_id" => "",
|
||||||
|
"visible" => ""
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->jsonData['record_tags'] = array();
|
$this->jsonData['record_tags'] = array();
|
||||||
|
|
|
@ -228,7 +228,7 @@ function updateProject($user_id, $project)
|
||||||
|
|
||||||
// Update given parameters
|
// Update given parameters
|
||||||
$data = [];
|
$data = [];
|
||||||
$props = ["name", "start_date"];
|
$props = ["name", "start_date", "color", "visible"];
|
||||||
foreach ($props as $p) {
|
foreach ($props as $p) {
|
||||||
if (array_key_exists ($p, $project)) {
|
if (array_key_exists ($p, $project)) {
|
||||||
$data[$p] = $project[$p];
|
$data[$p] = $project[$p];
|
||||||
|
@ -248,7 +248,7 @@ function updateRecordTag($user_id, $tag)
|
||||||
|
|
||||||
// Update given parameters
|
// Update given parameters
|
||||||
$data = [];
|
$data = [];
|
||||||
$props = ["name"];
|
$props = ["name", "visible"];
|
||||||
foreach ($props as $p) {
|
foreach ($props as $p) {
|
||||||
if (array_key_exists ($p, $tag)) {
|
if (array_key_exists ($p, $tag)) {
|
||||||
$data[$p] = $tag[$p];
|
$data[$p] = $tag[$p];
|
||||||
|
|
32
src/components/base/BaseColorText.vue
Normal file
32
src/components/base/BaseColorText.vue
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<template>
|
||||||
|
<span class="box" :style="customStyle">{{ text }}</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "BaseColorText",
|
||||||
|
props: {
|
||||||
|
text: {
|
||||||
|
required: true,
|
||||||
|
type: String
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
required: false,
|
||||||
|
type: String,
|
||||||
|
default: "transparent"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
customStyle: function() {
|
||||||
|
return "background-color: " + this.color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="sass" scoped>
|
||||||
|
.box
|
||||||
|
border-radius: 5px
|
||||||
|
padding: 3px 10px
|
||||||
|
text-align: left
|
||||||
|
</style>
|
|
@ -17,6 +17,9 @@
|
||||||
>
|
>
|
||||||
</b-form-datepicker>
|
</b-form-datepicker>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
|
<b-form-group id="color-group" label-for="color" label="Color">
|
||||||
|
<b-form-input id="color" v-model="form.color" trim> </b-form-input>
|
||||||
|
</b-form-group>
|
||||||
<b-form-invalid-feedback :state="!failed">
|
<b-form-invalid-feedback :state="!failed">
|
||||||
Something went wrong.
|
Something went wrong.
|
||||||
</b-form-invalid-feedback>
|
</b-form-invalid-feedback>
|
||||||
|
@ -59,7 +62,8 @@ export default {
|
||||||
form: {
|
form: {
|
||||||
project_id: undefined,
|
project_id: undefined,
|
||||||
start_date: undefined,
|
start_date: undefined,
|
||||||
name: undefined
|
name: undefined,
|
||||||
|
color: undefined
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -72,6 +76,10 @@ export default {
|
||||||
this.failed = false;
|
this.failed = false;
|
||||||
this.working = true;
|
this.working = true;
|
||||||
|
|
||||||
|
if (this.form.color == "") {
|
||||||
|
this.form.color = null;
|
||||||
|
}
|
||||||
|
|
||||||
store
|
store
|
||||||
.dispatch("updateProject", this.form)
|
.dispatch("updateProject", this.form)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -96,6 +104,7 @@ export default {
|
||||||
this.form.project_id = this.project.project_id;
|
this.form.project_id = this.project.project_id;
|
||||||
this.form.name = this.project.name;
|
this.form.name = this.project.name;
|
||||||
this.form.start_date = this.project.start_date;
|
this.form.start_date = this.project.start_date;
|
||||||
|
this.form.color = this.project.color;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
22
src/components/juggl/JugglProjectName.vue
Normal file
22
src/components/juggl/JugglProjectName.vue
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<template>
|
||||||
|
<BaseColorText :text="project.name" :color="project.color" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import BaseColorText from "@/components/base/BaseColorText.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "JugglProjectName",
|
||||||
|
components: {
|
||||||
|
BaseColorText
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
project: {
|
||||||
|
required: true,
|
||||||
|
type: Object
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
|
@ -5,7 +5,7 @@
|
||||||
:key="project.project_id"
|
:key="project.project_id"
|
||||||
@click="() => startProject(project.project_id)"
|
@click="() => startProject(project.project_id)"
|
||||||
>
|
>
|
||||||
<h1>{{ project.name }}</h1>
|
<JugglProjectName :project="project" class="project-title" />
|
||||||
<p>{{ getDurationTimestamp(project.duration) }}</p>
|
<p>{{ getDurationTimestamp(project.duration) }}</p>
|
||||||
<p>{{ project.record_count }} records</p>
|
<p>{{ project.record_count }} records</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,11 +13,15 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import store from "@/store";
|
import JugglProjectName from "@/components/juggl/JugglProjectName";
|
||||||
import { helperService } from "@/services/helper.service.js";
|
import { helperService } from "@/services/helper.service.js";
|
||||||
|
import store from "@/store";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "JugglProjectPanel",
|
name: "JugglProjectPanel",
|
||||||
|
components: {
|
||||||
|
JugglProjectName
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
projects: {
|
projects: {
|
||||||
required: true
|
required: true
|
||||||
|
@ -54,11 +58,9 @@ export default {
|
||||||
border-color: $primary !important
|
border-color: $primary !important
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
|
|
||||||
h1
|
.project-title
|
||||||
font-weight: bold
|
font-weight: bold
|
||||||
font-size: 24pt
|
font-size: 24pt
|
||||||
margin: 0px
|
|
||||||
padding: 0px
|
|
||||||
|
|
||||||
p
|
p
|
||||||
font-size: 10pt
|
font-size: 10pt
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
<!-- Custom data -->
|
<!-- Custom data -->
|
||||||
<template #cell(project)="data">
|
<template #cell(project)="data">
|
||||||
{{ getProject(data.item.project_id).name }}
|
<JugglProjectName :project="getProject(data.item.project_id)" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #cell(start)="data">
|
<template #cell(start)="data">
|
||||||
|
@ -64,6 +64,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import FormRecordDetails from "@/components/forms/FormRecordDetails";
|
import FormRecordDetails from "@/components/forms/FormRecordDetails";
|
||||||
|
import JugglProjectName from "@/components/juggl/JugglProjectName";
|
||||||
import JugglTagField from "@/components/juggl/JugglTagField";
|
import JugglTagField from "@/components/juggl/JugglTagField";
|
||||||
import { helperService } from "@/services/helper.service.js";
|
import { helperService } from "@/services/helper.service.js";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
@ -72,6 +73,7 @@ export default {
|
||||||
name: "JugglRecordsList",
|
name: "JugglRecordsList",
|
||||||
components: {
|
components: {
|
||||||
FormRecordDetails,
|
FormRecordDetails,
|
||||||
|
JugglProjectName,
|
||||||
JugglTagField
|
JugglTagField
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
|
|
@ -17,6 +17,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Custom data -->
|
<!-- Custom data -->
|
||||||
|
<template #cell(name)="data">
|
||||||
|
<JugglProjectName :project="data.item" />
|
||||||
|
</template>
|
||||||
|
|
||||||
<template #cell(duration)="data">
|
<template #cell(duration)="data">
|
||||||
{{ getDurationTimestamp(data.item.duration) }}
|
{{ getDurationTimestamp(data.item.duration) }}
|
||||||
</template>
|
</template>
|
||||||
|
@ -86,6 +90,7 @@
|
||||||
<script>
|
<script>
|
||||||
import LayoutNavbarPrivate from "@/components/layout/LayoutNavbarPrivate";
|
import LayoutNavbarPrivate from "@/components/layout/LayoutNavbarPrivate";
|
||||||
import FormProjectDetails from "@/components/forms/FormProjectDetails";
|
import FormProjectDetails from "@/components/forms/FormProjectDetails";
|
||||||
|
import JugglProjectName from "@/components/juggl/JugglProjectName";
|
||||||
import FormProjectAdd from "@/components/forms/FormProjectAdd";
|
import FormProjectAdd from "@/components/forms/FormProjectAdd";
|
||||||
import FormTagDetails from "@/components/forms/FormTagDetails";
|
import FormTagDetails from "@/components/forms/FormTagDetails";
|
||||||
import { helperService } from "@/services/helper.service.js";
|
import { helperService } from "@/services/helper.service.js";
|
||||||
|
@ -97,6 +102,7 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
LayoutNavbarPrivate,
|
LayoutNavbarPrivate,
|
||||||
FormProjectDetails,
|
FormProjectDetails,
|
||||||
|
JugglProjectName,
|
||||||
FormProjectAdd,
|
FormProjectAdd,
|
||||||
FormTagDetails,
|
FormTagDetails,
|
||||||
FormTagAdd
|
FormTagAdd
|
||||||
|
|
Loading…
Reference in a new issue