| 1 |
<template> |
| 2 |
<div class="find-problem"> |
| 3 |
<screen-field v-model="iframeUrl" @load="siteLoaded"></screen-field> |
| 4 |
<div class="interrogation-status" v-if="!loading"> |
| 5 |
<counter-box |
| 6 |
:title="translations.interrogation.interrogatingTitle" |
| 7 |
:loading="loading" |
| 8 |
:count="interrogatingCount" |
| 9 |
:avatars="activeCase.suspects_under_interrogation" |
| 10 |
></counter-box> |
| 11 |
<counter-box |
| 12 |
:title="translations.interrogation.remainingTitle" |
| 13 |
:loading="loading" |
| 14 |
:count="remainingCount" |
| 15 |
:avatars="holdingCell" |
| 16 |
></counter-box> |
| 17 |
<counter-box |
| 18 |
:title="translations.interrogation.clearedTitle" |
| 19 |
:loading="loading" |
| 20 |
:count="clearedCount" |
| 21 |
:avatars="activeCase.cleared_suspects" |
| 22 |
></counter-box> |
| 23 |
</div> |
| 24 |
<div class="corner-otto" v-if="!loading"> |
| 25 |
<bubble> |
| 26 |
<p>{{translations.case.testProblem}}</p> |
| 27 |
<md-button class="md-raised md-accent" @click.native="sendFixedClue">{{translations.case.yesButton}}</md-button> |
| 28 |
<md-button class="md-raised md-primary" @click.native="sendBrokenClue">{{translations.case.noButton}}</md-button> |
| 29 |
</bubble> |
| 30 |
<img :src="updatedApi.static_url + '/robot-corner.svg'" alt="Otto the Robot"> |
| 31 |
</div> |
| 32 |
</div> |
| 33 |
</template> |
| 34 |
|
| 35 |
<script> |
| 36 |
import store from '@/store' |
| 37 |
import Bubble from './Bubble' |
| 38 |
import ScreenField from './ScreenField' |
| 39 |
import CounterBox from './CounterBox' |
| 40 |
import { mapState, mapMutations, mapActions, mapGetters } from 'vuex' |
| 41 |
|
| 42 |
export default { |
| 43 |
name: 'test', |
| 44 |
components: { Bubble, ScreenField, CounterBox }, |
| 45 |
store, |
| 46 |
data () { |
| 47 |
return { |
| 48 |
loading: true |
| 49 |
} |
| 50 |
}, |
| 51 |
computed: { |
| 52 |
iframeUrl: { |
| 53 |
get () { |
| 54 |
return this.updatedActiveCase.url |
| 55 |
}, |
| 56 |
set (value) { |
| 57 |
this.defineCaseUrl(value) |
| 58 |
} |
| 59 |
}, |
| 60 |
...mapState([ |
| 61 |
'api', |
| 62 |
'activeCase', |
| 63 |
'router', |
| 64 |
'translations' |
| 65 |
]), |
| 66 |
...mapGetters([ |
| 67 |
'clearedCount', |
| 68 |
'remainingCount', |
| 69 |
'holdingCell', |
| 70 |
'interrogatingCount', |
| 71 |
'updatedApi', |
| 72 |
'updatedActiveCase' |
| 73 |
]) |
| 74 |
}, |
| 75 |
methods: { |
| 76 |
siteLoaded () { |
| 77 |
this.loading = false |
| 78 |
}, |
| 79 |
sendFixedClue () { |
| 80 |
this.loading = true |
| 81 |
this.saveClue('fixed') |
| 82 |
.then(() => { |
| 83 |
this.checkCaseStage() |
| 84 |
}) |
| 85 |
}, |
| 86 |
sendBrokenClue () { |
| 87 |
this.loading = true |
| 88 |
this.saveClue('broken') |
| 89 |
.then(() => { |
| 90 |
this.checkCaseStage() |
| 91 |
}) |
| 92 |
}, |
| 93 |
checkCaseStage () { |
| 94 |
if (this.activeCase.stage === 'investigating') { |
| 95 |
this.router.push('/interrogating') |
| 96 |
} else { |
| 97 |
this.router.push('/investigation-complete') |
| 98 |
} |
| 99 |
}, |
| 100 |
...mapActions([ |
| 101 |
'saveClue' |
| 102 |
]), |
| 103 |
...mapMutations([ |
| 104 |
'defineCaseUrl' |
| 105 |
]) |
| 106 |
} |
| 107 |
} |
| 108 |
</script> |