This commit is contained in:
j3d1 2024-06-18 16:13:46 +02:00
parent 4738651b66
commit 5af3e72218

View file

@ -3,20 +3,23 @@
<i class="avatar | small"> <i class="avatar | small">
<font-awesome-icon icon="user"/> <font-awesome-icon icon="user"/>
</i> </i>
<!--span><a href="#">$USER</a> has changed state to <span <span><a href="#">$USER</a> has claimed sipping code
class="badge badge-pill badge-primary" :class="'bg-' + colorLookup">{{ lookupState.text }}</span> at <time <ClipboardButton class="btn btn-primary badge badge-pill" title="Copy shipping code to clipboard" :payload="item.code">{{ item.code }}
:datetime="timestamp">{{ timestamp }}</time> <font-awesome-icon icon="clipboard"/>
</span--> </ClipboardButton> of type <span class="badge badge-pill badge-secondary">{{ item.code_type }}</span> for this ticket at <time
{{item}} :datetime="timestamp">{{ timestamp }}</time>
</span>
</div> </div>
</template> </template>
<script> <script>
import {mapState} from "vuex"; import {mapState} from "vuex";
import ClipboardButton from "@/components/inputs/ClipboardButton.vue";
export default { export default {
name: 'TimelineShippingCode', name: 'TimelineShippingCode',
components: {ClipboardButton},
props: { props: {
'item': { 'item': {
type: Object, type: Object,
@ -25,28 +28,6 @@ export default {
}, },
computed: { computed: {
...mapState(['state_options']), ...mapState(['state_options']),
lookupState: function () {
try {
if (this.item.state)
return this.state_options.find(state => state.value === this.item.state);
} catch (e) {
}
return {
text: 'Unknown',
value: 'unknown'
};
},
colorLookup: function () {
if (this.item.state.startsWith('closed_')) {
return 'secondary';
} else if (this.item.state.startsWith('pending_')) {
return 'warning';
} else if (this.item.state.startsWith('waiting_')) {
return 'primary';
} else {
return 'danger';
}
},
'timestamp': function () { 'timestamp': function () {
return new Date(this.item.timestamp).toLocaleString(); return new Date(this.item.timestamp).toLocaleString();
}, },