Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse calculator fixed #11

Merged
merged 5 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions frontend.code-workspace
dyakovri marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"folders": [
{
"path": "."
}
],
"extensions": {
"recommendations": [
"Vue.volar",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"formulahendry.auto-close-tag",
"formulahendry.auto-rename-tag",
"steoates.autoimport",
"vunguyentuan.vscode-css-variables",
"mohd-akram.vscode-html-format",
],
},
"tasks": {
"version": "2.0.0",
"tasks": [
{
"label": "Configure",
"type": "shell",
"command": "npm install",
},
{
"label": "Run local",
"type": "shell",
"command": "npm run dev",
},
{
"label": "Build",
"type": "shell",
"command": "npm run build",
"group": {
"kind": "build",
"isDefault": true,
},
},
{
"label": "Test",
"type": "shell",
"command": "npm run test",
"group": {
"kind": "test",
"isDefault": true,
},
},
],
},
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "Launch dev",
"request": "launch",
"runtimeArgs": ["dev"],
"runtimeExecutable": "pnpm",
"skipFiles": ["<node_internals>/**"],
"type": "node",
"serverReadyAction": {
"pattern": "Local: http://localhost:([0-9]+)/",
"uriFormat": "http://localhost:%s",
"action": "openExternally",
},
},
],
},
"settings": {
"typescript.tsdk": "node_modules/typescript/lib",
"css.validate": false,
"git.openRepositoryInParentFolders": "always",
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
},
}
22 changes: 17 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
<script setup lang="ts"></script>
<script setup lang="ts">
import { ref } from 'vue';
import { router } from './router/index';

const currentTab = ref<'calc' | 'reverse-calc'>('calc');

const onChangeTab = () => {
router.push(`/${currentTab.value}`);
};
</script>

<template>
<v-app>
<main class="main">
<v-tabs bg-color="rgb(0, 1, 76)" grow="true">
<v-tab value="one"> <RouterLink to="/calc">Рассчитать выплату</RouterLink> </v-tab>
<v-tab value="two"> <RouterLink to="/reverse-calc">Узнать составляющие выплаты</RouterLink> </v-tab>
<v-tabs v-model="currentTab" bg-color="rgb(0, 1, 76)" color="white" @update:model-value="onChangeTab">
<v-tab value="calc"> Рассчитать выплату </v-tab>
<v-tab value="reverse-calc"> Узнать составляющие выплаты </v-tab>
</v-tabs>
<RouterView />
</main>
Expand All @@ -15,6 +24,9 @@
<style scoped>
.main {
width: min(900px, 100%);
margin: 0 auto;
min-height: 200vh;
margin: auto;
position: fixed;
align-self: center;
}
</style>
2 changes: 1 addition & 1 deletion src/components/IrdomSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defineProps<{
font-size: 20px;
}

.section:not(:last-child) {
.section {
margin-bottom: 35px;
}
</style>
8 changes: 6 additions & 2 deletions src/pages/PageMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ watch(gasCondition, val => {
</v-btn-toggle>
</IrdomSection>

<IrdomSection title="Членство в Профсоюзе">
<IrdomSection class="union-membership" title="Членство в Профсоюзе">
dyakovri marked this conversation as resolved.
Show resolved Hide resolved
<v-btn-toggle v-model="data.member" mandatory divided>
<v-btn :value="true">Состою</v-btn>
<v-btn :value="false">Не состою</v-btn>
Expand Down Expand Up @@ -191,7 +191,7 @@ watch(gasCondition, val => {
background: white;
position: absolute;
left: 16px;
bottom: 16px;
bottom: 64px;
right: 16px;
z-index: 1;
align-items: center;
Expand Down Expand Up @@ -233,4 +233,8 @@ watch(gasCondition, val => {
.course > button {
border-radius: 0 !important;
}

.union-membership {
margin: 100;
}
</style>
34 changes: 27 additions & 7 deletions src/pages/ReverseCalc.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,15 @@ const getSumAndTax = (options: Result[]): Result[] => {
};

const combinations: Array<Result> = getSumAndTax(getCombinations(flattenStipend(Stipend)));
const inputSum = ref(0);
const inputSum = ref<string>('');
BatuevIO marked this conversation as resolved.
Show resolved Hide resolved

function formatInput(input: string) {
if (!/[^0-9.]/.test(input)) {
dyakovri marked this conversation as resolved.
Show resolved Hide resolved
return true;
} else {
return 'Недопустимые символы';
}
}

let result: Result = emptyResult;
const recount = computed(() => {
Expand All @@ -119,10 +127,18 @@ const found = computed(() => {
const lz = (number: number, digits: number) => `${'0'.repeat(digits)}${number}`.slice(-digits);

const formattedStipend = (stipend: number): string => {
const thousands = Math.floor(stipend / 1000);
const rest = Math.floor(stipend % 1000);
const float = Math.round((stipend % 1) * 100);

let thousands: number;
let rest: number;
let float: number;
if (stipend > 0) {
thousands = Math.floor(stipend / 1000);
float = Math.round((stipend % 1) * 100);
rest = Math.floor(stipend % 1000);
} else {
thousands = Math.ceil(stipend / 1000);
rest = Math.ceil(stipend % 1000);
float = Math.round((stipend % 1) * 100);
}
if (thousands) return `${thousands} ${lz(rest, 3)},${lz(float, 2)} ₽`;
return `${rest},${lz(float, 2)} ₽`;
};
Expand All @@ -132,8 +148,12 @@ const formattedStipend = (stipend: number): string => {
<div class="container">
<div class="rounded calc">
<IrdomSection title="Введите полученную сумму">
<v-text-field v-model="inputSum" label="Полученная сумма" @update:model-value="recount"></v-text-field>
<!-- <p id="some">f</p> -->
<v-text-field
v-model="inputSum"
label="Полученная сумма"
:rules="[formatInput]"
@update:model-value="recount"
></v-text-field>
<v-divider />
</IrdomSection>
<div>
Expand Down
23 changes: 23 additions & 0 deletions vite.config.ts.timestamp-1722883381837-489e7ed531982.mjs
dyakovri marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// vite.config.ts
import { defineConfig } from "file:///home/batuevio/calculator-ui/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/index.js";
import vue from "file:///home/batuevio/calculator-ui/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]_/node_modules/@vitejs/plugin-vue/dist/index.mjs";
import postcssPresetEnv from "file:///home/batuevio/calculator-ui/node_modules/.pnpm/[email protected][email protected]/node_modules/postcss-preset-env/dist/index.mjs";
import vuetify from "file:///home/batuevio/calculator-ui/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]/node_modules/vite-plugin-vuetify/dist/index.js";
var vite_config_default = defineConfig({
plugins: [vue(), vuetify()],
css: {
postcss: {
plugins: [
postcssPresetEnv({
features: {
"nesting-rules": true
}
})
]
}
}
});
export {
vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCIvaG9tZS9iYXR1ZXZpby9jYWxjdWxhdG9yLXVpXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCIvaG9tZS9iYXR1ZXZpby9jYWxjdWxhdG9yLXVpL3ZpdGUuY29uZmlnLnRzXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ltcG9ydF9tZXRhX3VybCA9IFwiZmlsZTovLy9ob21lL2JhdHVldmlvL2NhbGN1bGF0b3ItdWkvdml0ZS5jb25maWcudHNcIjtpbXBvcnQgeyBkZWZpbmVDb25maWcgfSBmcm9tICd2aXRlJztcbmltcG9ydCB2dWUgZnJvbSAnQHZpdGVqcy9wbHVnaW4tdnVlJztcbmltcG9ydCBwb3N0Y3NzUHJlc2V0RW52IGZyb20gJ3Bvc3Rjc3MtcHJlc2V0LWVudic7XG5pbXBvcnQgdnVldGlmeSBmcm9tICd2aXRlLXBsdWdpbi12dWV0aWZ5JztcblxuZXhwb3J0IGRlZmF1bHQgZGVmaW5lQ29uZmlnKHtcblx0cGx1Z2luczogW3Z1ZSgpLCB2dWV0aWZ5KCldLFxuXHRjc3M6IHtcblx0XHRwb3N0Y3NzOiB7XG5cdFx0XHRwbHVnaW5zOiBbXG5cdFx0XHRcdHBvc3Rjc3NQcmVzZXRFbnYoe1xuXHRcdFx0XHRcdGZlYXR1cmVzOiB7XG5cdFx0XHRcdFx0XHQnbmVzdGluZy1ydWxlcyc6IHRydWUsXG5cdFx0XHRcdFx0fSxcblx0XHRcdFx0fSksXG5cdFx0XHRdLFxuXHRcdH0sXG5cdH0sXG59KTtcbiJdLAogICJtYXBwaW5ncyI6ICI7QUFBc1EsU0FBUyxvQkFBb0I7QUFDblMsT0FBTyxTQUFTO0FBQ2hCLE9BQU8sc0JBQXNCO0FBQzdCLE9BQU8sYUFBYTtBQUVwQixJQUFPLHNCQUFRLGFBQWE7QUFBQSxFQUMzQixTQUFTLENBQUMsSUFBSSxHQUFHLFFBQVEsQ0FBQztBQUFBLEVBQzFCLEtBQUs7QUFBQSxJQUNKLFNBQVM7QUFBQSxNQUNSLFNBQVM7QUFBQSxRQUNSLGlCQUFpQjtBQUFBLFVBQ2hCLFVBQVU7QUFBQSxZQUNULGlCQUFpQjtBQUFBLFVBQ2xCO0FBQUEsUUFDRCxDQUFDO0FBQUEsTUFDRjtBQUFBLElBQ0Q7QUFBQSxFQUNEO0FBQ0QsQ0FBQzsiLAogICJuYW1lcyI6IFtdCn0K
23 changes: 23 additions & 0 deletions vite.config.ts.timestamp-1723483646169-001a5be2d0f82.mjs
dyakovri marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// vite.config.ts
import { defineConfig } from "file:///home/batuevio/calculator-ui/node_modules/.pnpm/[email protected]/node_modules/vite/dist/node/index.js";
import vue from "file:///home/batuevio/calculator-ui/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]_/node_modules/@vitejs/plugin-vue/dist/index.mjs";
import postcssPresetEnv from "file:///home/batuevio/calculator-ui/node_modules/.pnpm/[email protected][email protected]/node_modules/postcss-preset-env/dist/index.mjs";
import vuetify from "file:///home/batuevio/calculator-ui/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]/node_modules/vite-plugin-vuetify/dist/index.js";
var vite_config_default = defineConfig({
plugins: [vue(), vuetify()],
css: {
postcss: {
plugins: [
postcssPresetEnv({
features: {
"nesting-rules": true
}
})
]
}
}
});
export {
vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCIvaG9tZS9iYXR1ZXZpby9jYWxjdWxhdG9yLXVpXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ZpbGVuYW1lID0gXCIvaG9tZS9iYXR1ZXZpby9jYWxjdWxhdG9yLXVpL3ZpdGUuY29uZmlnLnRzXCI7Y29uc3QgX192aXRlX2luamVjdGVkX29yaWdpbmFsX2ltcG9ydF9tZXRhX3VybCA9IFwiZmlsZTovLy9ob21lL2JhdHVldmlvL2NhbGN1bGF0b3ItdWkvdml0ZS5jb25maWcudHNcIjtpbXBvcnQgeyBkZWZpbmVDb25maWcgfSBmcm9tICd2aXRlJztcbmltcG9ydCB2dWUgZnJvbSAnQHZpdGVqcy9wbHVnaW4tdnVlJztcbmltcG9ydCBwb3N0Y3NzUHJlc2V0RW52IGZyb20gJ3Bvc3Rjc3MtcHJlc2V0LWVudic7XG5pbXBvcnQgdnVldGlmeSBmcm9tICd2aXRlLXBsdWdpbi12dWV0aWZ5JztcblxuZXhwb3J0IGRlZmF1bHQgZGVmaW5lQ29uZmlnKHtcblx0cGx1Z2luczogW3Z1ZSgpLCB2dWV0aWZ5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