2020-11-02 11:36:53 +00:00
|
|
|
<template>
|
2020-12-07 14:45:00 +00:00
|
|
|
<Page>
|
|
|
|
<StackLayout class="dialogContainer" :class="appTheme">
|
2021-01-23 17:20:15 +00:00
|
|
|
<Label class="er dialogIcon" backgroundColor="#858585" :color="iconColor" :text="icon.time" />
|
2020-12-07 14:45:00 +00:00
|
|
|
<Label class="dialogTitle orkm" :text="`${title}` | L" />
|
|
|
|
<StackLayout class="dialogListPicker" orientation="horizontal" horizontalAlignment="center">
|
|
|
|
<ListPicker ref="hrPicker" :items="hrsList" :selectedIndex="hrIndex" @selectedIndexChange="setHrs"></ListPicker>
|
|
|
|
<ListPicker ref="minPicker" :items="minsList" :selectedIndex="minIndex" @selectedIndexChange="setMins"></ListPicker>
|
2020-11-02 11:36:53 +00:00
|
|
|
</StackLayout>
|
2020-12-07 14:45:00 +00:00
|
|
|
<GridLayout rows="auto" columns="*, auto, auto" class="actionsContainer">
|
2021-01-13 05:02:48 +00:00
|
|
|
<MDButton :rippleColor="rippleColor" variant="text" col="1" class="action orkm" :text="'cBtn' | L" @tap="$modal.close(false)" />
|
2020-12-07 14:45:00 +00:00
|
|
|
<MDButton :rippleColor="rippleColor" variant="text" col="2" class="action orkm" :text="`${action}` | L" @tap="$modal.close(selectedTime)" />
|
|
|
|
</GridLayout>
|
|
|
|
</StackLayout>
|
|
|
|
</Page>
|
2020-11-02 11:36:53 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-12-07 14:45:00 +00:00
|
|
|
import {
|
|
|
|
Application
|
|
|
|
}
|
|
|
|
from "@nativescript/core"
|
2021-01-13 05:02:48 +00:00
|
|
|
import {
|
|
|
|
mapState
|
|
|
|
}
|
|
|
|
from "vuex"
|
2020-12-07 14:45:00 +00:00
|
|
|
import {
|
|
|
|
localize
|
|
|
|
}
|
|
|
|
from "@nativescript/localize"
|
2020-11-02 11:36:53 +00:00
|
|
|
export default {
|
2020-12-07 14:45:00 +00:00
|
|
|
props: [ "title", "selectedHr", "selectedMin", "action" ],
|
2020-11-02 11:36:53 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2020-12-07 14:45:00 +00:00
|
|
|
hrs: [],
|
|
|
|
mins: [],
|
2020-11-02 11:36:53 +00:00
|
|
|
selectedHrs: "00",
|
|
|
|
selectedMins: "00",
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2021-01-13 05:02:48 +00:00
|
|
|
...mapState( [ "icon" ] ),
|
2020-12-07 14:45:00 +00:00
|
|
|
hrsList() {
|
|
|
|
let h = [ ...Array( 24 ).keys() ]
|
|
|
|
this.hrs = h
|
|
|
|
return h.map( e => `${e} ${localize( 'hr' )}` )
|
|
|
|
},
|
|
|
|
minsList() {
|
|
|
|
let m = [ ...new Set( [ ...Array( 11 ).keys(), ...Array.from( Array( 12 ), ( _, x ) => x * 5 ) ] ) ]
|
|
|
|
this.mins = m
|
|
|
|
return m.map( e => `${e} ${localize( 'min' )}` )
|
|
|
|
},
|
2020-11-02 11:36:53 +00:00
|
|
|
hrIndex() {
|
2020-12-07 14:45:00 +00:00
|
|
|
return this.hrs.indexOf( parseInt( this.selectedHr ) )
|
2020-11-02 11:36:53 +00:00
|
|
|
},
|
|
|
|
minIndex() {
|
2020-12-07 14:45:00 +00:00
|
|
|
return this.mins.indexOf( parseInt( this.selectedMin ) )
|
2020-11-02 11:36:53 +00:00
|
|
|
},
|
2020-11-10 18:28:48 +00:00
|
|
|
appTheme() {
|
2020-11-02 11:36:53 +00:00
|
|
|
return Application.systemAppearance()
|
|
|
|
},
|
2021-01-13 05:02:48 +00:00
|
|
|
isLightMode() {
|
|
|
|
return this.appTheme == "light"
|
|
|
|
},
|
2020-11-10 18:28:48 +00:00
|
|
|
rippleColor() {
|
2021-01-23 17:20:15 +00:00
|
|
|
return "rgba(133,133,133,0.2)"
|
2021-01-13 05:02:48 +00:00
|
|
|
},
|
|
|
|
iconColor() {
|
2021-01-23 17:20:15 +00:00
|
|
|
return this.isLightMode ? "#f0f0f0" : "#1A1A1A"
|
2020-11-10 18:28:48 +00:00
|
|
|
},
|
2020-11-02 11:36:53 +00:00
|
|
|
selectedTime() {
|
|
|
|
return this.selectedHrs + ":" + this.selectedMins
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
2020-12-07 14:45:00 +00:00
|
|
|
setHrs( args ) {
|
|
|
|
let hr = "0" + this.hrs[ args.object.selectedIndex ]
|
|
|
|
this.selectedHrs = hr.slice( -2 )
|
2020-11-02 11:36:53 +00:00
|
|
|
},
|
2020-12-07 14:45:00 +00:00
|
|
|
setMins( args ) {
|
|
|
|
let min = "0" + this.mins[ args.object.selectedIndex ]
|
|
|
|
this.selectedMins = min.slice( -2 )
|
2020-11-02 11:36:53 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|