fix: durasi in keluhan response and recovery time
This commit is contained in:
@ -1,4 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
interface SlaOption {
|
||||
id: number
|
||||
name: string
|
||||
min: string
|
||||
max: string
|
||||
}
|
||||
|
||||
import { onMounted, ref } from 'vue'
|
||||
import {
|
||||
selectedUid,
|
||||
@ -12,10 +19,36 @@ import {
|
||||
import Select from '@/components/Select.vue'
|
||||
import DatePicker from '@/components/DatePicker.vue'
|
||||
import InputWithSuffix from '@/components/Form/InputWithSuffix.vue'
|
||||
const totalMin = ref("1 Menit")
|
||||
const totalMax = ref("5 Menit")
|
||||
const setDataMin = (value: any) => totalMin.value = value
|
||||
const setDataMax = (value: any) => totalMax.value = value
|
||||
|
||||
const props = defineProps({
|
||||
slaOptions: {
|
||||
type: Array as () => SlaOption[],
|
||||
default: [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Dibawah / Sesuai SLA (<= 45 menit)',
|
||||
min: '1',
|
||||
max: '45'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Melebihi SLA (> 45 menit)',
|
||||
min: '46',
|
||||
max: `${99999 * 60 * 24}`
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
const sla = props.slaOptions.map((item: any) => {
|
||||
return {
|
||||
id: item.id,
|
||||
name: item.name
|
||||
}
|
||||
})
|
||||
|
||||
const totalMin = ref('1 Menit')
|
||||
const totalMax = ref('5 Menit')
|
||||
const uidPlaceholder = 'Semua Unit Induk Distribusi/Wilayah'
|
||||
const up3Placeholder = 'Semua Unit Pelaksanaan Pelayanan Pelanggan'
|
||||
const ulpPlaceholder = 'Semua Unit Layanan Pelanggan'
|
||||
@ -23,25 +56,20 @@ const up3 = ref({ id: 0, name: up3Placeholder })
|
||||
const uid = ref({ id: 0, name: uidPlaceholder })
|
||||
const ulp = ref({ id: 0, name: ulpPlaceholder })
|
||||
const emit = defineEmits(['update:filters'])
|
||||
const isHidden = ref(false)
|
||||
|
||||
const sla = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'Dibawah / Sesuai SLA (<= 45 menit)'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Melebihi SLA (> 45 menit)'
|
||||
}
|
||||
]
|
||||
const setDataMin = (value: any) => (totalMin.value = value)
|
||||
const getDataMin = () => totalMin.value
|
||||
const setDataMax = (value: any) => (totalMax.value = value)
|
||||
const getDataMax = () => totalMax.value
|
||||
|
||||
const data = ref({
|
||||
uid: uid.value,
|
||||
up3: up3.value,
|
||||
ulp: ulp.value,
|
||||
periode: '',
|
||||
minTime: 1,
|
||||
maxTime: 1
|
||||
minTime: getDataMin().split(' ')[0],
|
||||
maxTime: getDataMax().split(' ')[0]
|
||||
})
|
||||
|
||||
const setUid = (value: any) => {
|
||||
@ -69,7 +97,6 @@ const setMin = (value: any) => {
|
||||
data.value.minTime = value
|
||||
setDataMin(value)
|
||||
}
|
||||
|
||||
const setMax = (value: any) => {
|
||||
data.value.maxTime = value
|
||||
setDataMax(value)
|
||||
@ -80,18 +107,21 @@ const changeDuration = (value: any) => {
|
||||
if (value.id === 0) {
|
||||
setMin('1')
|
||||
setMax('5')
|
||||
console.log('Durasi Menit')
|
||||
|
||||
triggerInput.value = false
|
||||
isHidden.value = false
|
||||
} else if (value.id === 1) {
|
||||
setMin('1')
|
||||
setMax('45')
|
||||
console.log('Dibawah / Sesuai SLA (<= 45 menit)')
|
||||
setMin(props.slaOptions[0].min)
|
||||
setMax(props.slaOptions[0].max)
|
||||
|
||||
triggerInput.value = true
|
||||
isHidden.value = true
|
||||
} else {
|
||||
setMin('45')
|
||||
setMax(99999 * 60 * 24)
|
||||
setMin(props.slaOptions[1].min)
|
||||
setMax(props.slaOptions[1].max)
|
||||
|
||||
triggerInput.value = true
|
||||
console.log('Melebihi SLA (> 45 menit)')
|
||||
isHidden.value = true
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,13 +142,23 @@ onMounted(() => {
|
||||
<div class="flex flex-col flex-1 space-y-2">
|
||||
<label class="filter-input-label">Unit Pelaksanaan Pelayanan Pelanggan:</label>
|
||||
|
||||
<Select @update:selected="setUp3($event)" :data="itemsUp3" :selected="up3" :placeholder="up3Placeholder" />
|
||||
<Select
|
||||
@update:selected="setUp3($event)"
|
||||
:data="itemsUp3"
|
||||
:selected="up3"
|
||||
:placeholder="up3Placeholder"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col flex-1 space-y-2">
|
||||
<label class="filter-input-label">Unit Layanan Pelanggan:</label>
|
||||
|
||||
<Select @update:selected="setUlp($event)" :data="itemsUlp" :placeholder="ulpPlaceholder" :selected="ulp" />
|
||||
<Select
|
||||
@update:selected="setUlp($event)"
|
||||
:data="itemsUlp"
|
||||
:placeholder="ulpPlaceholder"
|
||||
:selected="ulp"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col flex-1 space-y-2">
|
||||
@ -132,13 +172,21 @@ onMounted(() => {
|
||||
|
||||
<div class="flex flex-col gap-y-2">
|
||||
<Select @update:selected="changeDuration($event)" :data="sla" placeholder="Durasi Menit" />
|
||||
<div class="flex flex-1 flex-row justify-between gap-x-1.5">
|
||||
<InputWithSuffix :value="`${data.minTime} Menit`" class="flex flex-1" />
|
||||
|
||||
<div class="flex flex-1 justify-between gap-x-1.5" :class="[isHidden ? 'hidden' : '']">
|
||||
<InputWithSuffix
|
||||
:value="`${data.minTime} Menit`"
|
||||
@update:text="setMin($event)"
|
||||
class="flex flex-1"
|
||||
/>
|
||||
<small class="flex items-center">s/d</small>
|
||||
<InputWithSuffix :value="`${data.maxTime} Menit`" class="flex flex-1" />
|
||||
<InputWithSuffix
|
||||
:value="`${data.maxTime} Menit`"
|
||||
@update:text="setMax($event)"
|
||||
class="flex flex-1"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user