Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/#10-regulations-for-escooters' i…
Browse files Browse the repository at this point in the history
…nto #10-regulations-for-escooters

# Conflicts:
#	routes/web.php
  • Loading branch information
JakubKermes committed Jan 13, 2024
2 parents b47758e + e7af739 commit ab0f5fc
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,6 @@
"Please, rate that city": "Oceń miasto",

"You can also login by:": "Możesz również zalogować się przez:",

"Regulations": "Zasady"
"Rules import started.": "Import zasad uruchomiony.",
"Run rules import": "Uruchom import zasad"
}
4 changes: 3 additions & 1 deletion resources/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
}
div.regulations>div:nth-child(2) {
max-height: 0vh;
margin-top: 12px;
margin-bottom: 0px;
transition: all 0.5s ease-in-out;
}

div.regulations>div:nth-child(2).show {
max-height: 50vh;
margin-bottom: 12px;
}

div.regulations>div>svg {
Expand Down
23 changes: 17 additions & 6 deletions resources/js/Pages/City/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,20 @@ import { useFilterStore } from '@/Shared/Stores/FilterStore'
import FavoriteButton from '@/Shared/Components/FavoriteButton.vue'
import ProviderIcons from '@/Shared/Components/ProviderIcons.vue'
import { __ } from '@/translate'
import { useForm, usePage } from '@inertiajs/vue3'
import { router, useForm, usePage } from '@inertiajs/vue3'
import ErrorMessage from '@/Shared/Components/ErrorMessage.vue'
import { useToast } from 'vue-toastification'
import Pagination from '@/Shared/Components/Pagination.vue'
import InfoPopup from '@/Shared/Components/InfoPopup.vue'
import Opinion from '@/Shared/Components/Opinion.vue'
import axios from 'axios'
const toast = useToast()
const page = usePage()
const isAuth = computed(() => page.props.auth.isAuth)
const regulationsOpen = ref(false)
let rules = ref({})
fetchRegulations()
const props = defineProps({
city: Object,
providers: Object,
Expand Down Expand Up @@ -60,7 +62,16 @@ function setRating(starIndex) {
function toggleRegulations() {
regulationsOpen.value = !regulationsOpen.value
console.log(regulationsOpen)
}
function fetchRegulations() {
axios.get(`/api/rules/`+props.city.country.name+`/`+props.city.name)
.then(response => {
rules = response.data
})
.catch(error => {
console.log(error)
})
}
const emptyRatingError = ref('')
Expand Down Expand Up @@ -111,9 +122,9 @@ function createOpinion() {
{{ city.latitude }}, {{ city.longitude }}
</h2>
<ProviderIcons class="pt-4" :item="city" :providers="props.providers" />
<div class="regulations relative rounded overflow-hidden">
<div class="mt-3 text-2xl font-bold flex items-center text-gray-700 cursor-pointer" @click="toggleRegulations()">{{ __('Regulations') }} <ArrowDownIcon :class="regulationsOpen ? 'rotated' : ''" class="absolute right-0 inline-block transition-all h-6 w-6"></ArrowDownIcon></div>
<div :class="regulationsOpen?'show':''" class="transition overflow-hidden">Content</div>
<div class="px-3 regulations relative rounded border-gray-200 border-solid border-[1px] overflow-hidden">
<div class="my-3 text-2xl font-bold flex items-center text-gray-700 cursor-pointer" @click="toggleRegulations()">{{ __('Rules') }} <ArrowDownIcon :class="regulationsOpen ? 'rotated' : ''" class="absolute right-3 inline-block transition-all h-6 w-6"></ArrowDownIcon></div>
<div :class="regulationsOpen?'show':''" class="overflow-scroll transition">{{ rules.rulesENG }}</div>
</div>
<form v-if="isAuth" class="mt-8 flex flex-col" @submit.prevent="createOpinion">
<p class="mb-2 text-xs font-medium text-gray-700">
Expand Down
12 changes: 11 additions & 1 deletion resources/js/Pages/Importers/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,26 @@ function runImporters() {
router.post('/run-importers', [])
toast.success(__('Importers started.'))
}
function runRules() {
router.post('/import-rules/false', [])
toast.success(__('Rules import started.'))
}
</script>

<template>
<AdminNavigation :url="page.url" />
<div class="flex w-full md:justify-end">
<div class="mt-16 flex h-full w-full flex-col justify-between md:mt-0 md:w-2/3 lg:w-3/4 xl:w-5/6">
<div class="m-4 flex flex-col lg:mx-8">
<button class="my-5 w-fit rounded bg-blumilk-500 px-5 py-3 text-sm font-medium text-white shadow-md hover:bg-blumilk-400 md:py-2" @click="runImporters">
<div class="m-4">
<button class="my-5 mr-10 w-fit rounded bg-blumilk-500 px-5 py-3 text-sm font-medium text-white shadow-md hover:bg-blumilk-400 md:py-2" @click="runImporters">
{{ __('Run importers') }}
</button>
<button class="my-5 w-fit rounded bg-blumilk-500 px-5 py-3 text-sm font-medium text-white shadow-md hover:bg-blumilk-400 md:py-2" @click="runRules">
{{ __('Run rules import') }}
</button>
</div>

<PaginationInfo v-if="importInfo.data.length" :meta="importInfo.meta" />
<div v-if="importInfo.data.length" class="rounded-lg ring-gray-300 sm:ring-1">
Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
Route::delete("/delete-city-without-assigned-country/{city}", [CityWithoutAssignedCountryController::class, "destroy"]);
Route::post("/delete-all-cities-without-assigned-country", [CityWithoutAssignedCountryController::class, "destroyAll"]);

Route::get("/import-rules/{force}", [\App\Services\OpenAIService::class, "importRulesForAllCities"]);
Route::get("/import-rules/{force}", [\App\Services\OpenAIService::class, "importRules"]);
});
});

Expand Down

0 comments on commit ab0f5fc

Please sign in to comment.