Merge branch 'ASTRA-114' into 'master'
WIP Сделала расчет лет See merge request andrusyakka/urban-couscous!434
This commit is contained in:
@@ -5,9 +5,12 @@
|
|||||||
v-model:internal-date="internalDate",
|
v-model:internal-date="internalDate",
|
||||||
v-model:external-date="externalDate",
|
v-model:external-date="externalDate",
|
||||||
:range="range",
|
:range="range",
|
||||||
|
:start-year="startYear",
|
||||||
|
:end-year="endYear",
|
||||||
:range-count="rangeCount",
|
:range-count="rangeCount",
|
||||||
:next-form="nextForm",
|
:next-form="nextForm",
|
||||||
:previous-form="previousForm"
|
:previous-form="previousForm",
|
||||||
|
:internal-month="internalMonth",
|
||||||
)
|
)
|
||||||
.footer.flex.justify-end.items-center.px-5.py-3
|
.footer.flex.justify-end.items-center.px-5.py-3
|
||||||
q-btn(
|
q-btn(
|
||||||
@@ -33,14 +36,23 @@
|
|||||||
<script>
|
<script>
|
||||||
import * as moment from "moment/moment";
|
import * as moment from "moment/moment";
|
||||||
import CalendarDates from "@/components/base/Calendar/CalendarDates.vue";
|
import CalendarDates from "@/components/base/Calendar/CalendarDates.vue";
|
||||||
|
import CalendarYears from "@/components/base/Calendar/CalendarYears.vue";
|
||||||
import CalendarMonths from "@/components/base/Calendar/CalendarMonths.vue";
|
import CalendarMonths from "@/components/base/Calendar/CalendarMonths.vue";
|
||||||
export default {
|
export default {
|
||||||
name: "BaseCalendar",
|
name: "BaseCalendar",
|
||||||
components: { CalendarDates, CalendarMonths },
|
components: { CalendarDates, CalendarMonths, CalendarYears },
|
||||||
props: {
|
props: {
|
||||||
modelValue: Object,
|
modelValue: Object,
|
||||||
range: Boolean,
|
range: Boolean,
|
||||||
rangeCount: Number,
|
rangeCount: Number,
|
||||||
|
startYear: {
|
||||||
|
type: Number,
|
||||||
|
default: 1970,
|
||||||
|
},
|
||||||
|
endYear: {
|
||||||
|
type: Number,
|
||||||
|
default: parseInt(moment().clone().add(1, "year").format("YYYY"), 10),
|
||||||
|
},
|
||||||
save: {
|
save: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: () => {},
|
default: () => {},
|
||||||
@@ -55,7 +67,7 @@ export default {
|
|||||||
internalDate: moment(),
|
internalDate: moment(),
|
||||||
externalDate: null,
|
externalDate: null,
|
||||||
currentFormIndex: 0,
|
currentFormIndex: 0,
|
||||||
forms: ["CalendarDates", "CalendarMonths"],
|
forms: ["CalendarDates", "CalendarYears", "CalendarMonths"],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -70,6 +82,12 @@ export default {
|
|||||||
currentForm() {
|
currentForm() {
|
||||||
return this.forms[this.currentFormIndex];
|
return this.forms[this.currentFormIndex];
|
||||||
},
|
},
|
||||||
|
internalMonth() {
|
||||||
|
let formattedMonth = this.internalDate.format("MMMM");
|
||||||
|
return `${
|
||||||
|
formattedMonth[0].toUpperCase() + formattedMonth.slice(1)
|
||||||
|
} ${this.internalDate.format("YYYY")}`;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
nextForm() {
|
nextForm() {
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ export default {
|
|||||||
externalDate: Object,
|
externalDate: Object,
|
||||||
range: Boolean,
|
range: Boolean,
|
||||||
rangeCount: Number,
|
rangeCount: Number,
|
||||||
|
internalMonth: String,
|
||||||
nextForm: {
|
nextForm: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: () => {},
|
default: () => {},
|
||||||
@@ -82,12 +83,6 @@ export default {
|
|||||||
this.$emit("update:externalDate", value);
|
this.$emit("update:externalDate", value);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
internalMonth() {
|
|
||||||
let formattedMonth = this.internalValue.format("MMMM");
|
|
||||||
return `${
|
|
||||||
formattedMonth[0].toUpperCase() + formattedMonth.slice(1)
|
|
||||||
} ${this.internalValue.format("YYYY")}`;
|
|
||||||
},
|
|
||||||
internalStartDate() {
|
internalStartDate() {
|
||||||
return this.internalValue
|
return this.internalValue
|
||||||
.clone()
|
.clone()
|
||||||
|
|||||||
@@ -1,16 +1,5 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
.w-full
|
|
||||||
.header.pl-3.pr-6.pt-14px.pb-10px.flex.items-center.justify-center
|
|
||||||
q-btn(
|
|
||||||
size="14px"
|
|
||||||
color="dark"
|
|
||||||
flat,
|
|
||||||
label="Июнь 2023"
|
|
||||||
no-caps,
|
|
||||||
padding="10px 12px"
|
|
||||||
)
|
|
||||||
.body.py-5.px-6
|
|
||||||
.item.flex.items-center.justify-center.cursor-pointer.py-3.rounded(v-for="num in 31") {{ num }}
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -25,20 +14,4 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="sass">
|
<style scoped lang="sass"></style>
|
||||||
.header
|
|
||||||
border-bottom: 1px solid var(--border-light-grey-color)
|
|
||||||
.body
|
|
||||||
height: 298px
|
|
||||||
display: grid
|
|
||||||
grid-template-columns: repeat(3, 1fr)
|
|
||||||
row-gap: 4px
|
|
||||||
column-gap: 4px
|
|
||||||
overflow-y: auto
|
|
||||||
&::-webkit-scrollbar
|
|
||||||
width: 0
|
|
||||||
.item
|
|
||||||
background-color: var(--bg-light-grey)
|
|
||||||
&:hover
|
|
||||||
background-color: var(--border-light-grey-color)
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -1,17 +1,107 @@
|
|||||||
<template lang="pug">
|
<template lang="pug">
|
||||||
|
.w-full
|
||||||
|
.header.pl-3.pr-6.pt-14px.pb-10px.flex.items-center.justify-center
|
||||||
|
q-btn(
|
||||||
|
size="14px"
|
||||||
|
color="dark"
|
||||||
|
flat,
|
||||||
|
:label="internalMonth",
|
||||||
|
no-caps,
|
||||||
|
padding="10px 12px"
|
||||||
|
)
|
||||||
|
.body.py-5.px-6
|
||||||
|
.cell.flex.items-center.justify-center.cursor-pointer.py-3.rounded(
|
||||||
|
v-for="year in internalYearsList",
|
||||||
|
:key="year",
|
||||||
|
:id="year",
|
||||||
|
:class="activeCellClass(year), cellsClass",
|
||||||
|
@click="selectYear(year)",
|
||||||
|
) {{ year }}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "CalendarYears",
|
name: "CalendarYears",
|
||||||
props: {},
|
props: {
|
||||||
data() {
|
internalDate: Object,
|
||||||
return {};
|
startYear: Number,
|
||||||
|
endYear: Number,
|
||||||
|
internalMonth: String,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
previousDate: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
internalValue: {
|
||||||
|
get() {
|
||||||
|
return this.internalDate;
|
||||||
|
},
|
||||||
|
set(value) {
|
||||||
|
this.$emit("update:internalDate", value);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cellsClass() {
|
||||||
|
let remains = this.internalYearsList.length % 3;
|
||||||
|
if (remains === 2)
|
||||||
|
return {
|
||||||
|
"cell-col-2": true,
|
||||||
|
};
|
||||||
|
if (remains === 1)
|
||||||
|
return {
|
||||||
|
"cell-col-3": true,
|
||||||
|
};
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
internalYearsList() {
|
||||||
|
let diff = this.endYear - this.startYear,
|
||||||
|
start = this.startYear;
|
||||||
|
return [...Array(diff + 1)].map(() => start++);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
activeCellClass(year) {
|
||||||
|
return {
|
||||||
|
"active-cell": parseInt(this.internalValue.format("YYYY"), 10) === year,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
selectYear(year) {
|
||||||
|
this.internalValue = this.internalValue.clone().year(year);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.previousDate = this.internalValue.clone();
|
||||||
},
|
},
|
||||||
computed: {},
|
|
||||||
methods: {},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="sass"></style>
|
<style scoped lang="sass">
|
||||||
|
.header
|
||||||
|
border-bottom: 1px solid var(--border-light-grey-color)
|
||||||
|
.body
|
||||||
|
height: 298px
|
||||||
|
display: grid
|
||||||
|
grid-template-columns: repeat(3, 1fr)
|
||||||
|
row-gap: 4px
|
||||||
|
column-gap: 4px
|
||||||
|
overflow-y: auto
|
||||||
|
&::-webkit-scrollbar
|
||||||
|
width: 0
|
||||||
|
.cell
|
||||||
|
background-color: var(--bg-light-grey)
|
||||||
|
color: var(--font-dark-blue-color)
|
||||||
|
&:hover
|
||||||
|
background-color: var(--border-light-grey-color)
|
||||||
|
.cell-col-2:first-child
|
||||||
|
grid-column: 2
|
||||||
|
.cell-col-2:nth-child(2)
|
||||||
|
grid-column: 3
|
||||||
|
.cell-col-3:first-child
|
||||||
|
grid-column: 3
|
||||||
|
.active-cell
|
||||||
|
background-color: var(--btn-blue-color)
|
||||||
|
color: var(--default-white)
|
||||||
|
&:hover
|
||||||
|
background-color: var(--btn-blue-color)
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
range,
|
range,
|
||||||
:range-count="7",
|
:range-count="7",
|
||||||
:save="saveNewDate",
|
:save="saveNewDate",
|
||||||
:cancel="cancelDateChanges"
|
:cancel="cancelDateChanges",
|
||||||
)
|
)
|
||||||
q-btn(
|
q-btn(
|
||||||
color="secondary",
|
color="secondary",
|
||||||
|
|||||||
Reference in New Issue
Block a user