Commit f60a7639 by Vladislav

#19462 Добавление в настройки городов переменных. (перенес редактирование)

1 parent 58d7c673
...@@ -20,11 +20,11 @@ class CampaignVarsController extends Controller ...@@ -20,11 +20,11 @@ class CampaignVarsController extends Controller
function __invoke(Tokens $token, $campaign_id) function __invoke(Tokens $token, $campaign_id)
{ {
if (!$token->isMain()) { if ($token->isMain()) {
return Redirect::back(); return Redirect::back();
} }
$campaign = $token->campaigns()->with('vars')->find($campaign_id); $campaign = Tokens::where('type', Tokens::MAIN)->get()->first()->campaigns()->with('vars')->find($campaign_id);
if (!$campaign) { if (!$campaign) {
return Redirect::back(); return Redirect::back();
......
...@@ -26,16 +26,12 @@ ...@@ -26,16 +26,12 @@
<table class="w-full whitespace-nowrap"> <table class="w-full whitespace-nowrap">
<tr class="text-left font-bold"> <tr class="text-left font-bold">
<th class="px-6 pt-6 pb-4">Name</th> <th class="px-6 pt-6 pb-4">Name</th>
<th class="px-6 pt-6 pb-4" colspan="2">Action</th> <th class="px-6 pt-6 pb-4">Action</th>
</tr> </tr>
<tr v-for="campaign in token.campaigns" :key="campaign.id" <tr v-for="campaign in token.campaigns" :key="campaign.id"
class="hover:bg-gray-100 focus-within:bg-gray-100"> class="hover:bg-gray-100 focus-within:bg-gray-100">
<td class="border-t px-6 py-3"> <td class="border-t px-6 py-3">
<inertia-link class="hover:text-indigo-500 focus:text-indigo-500" {{ campaign.name }}
:href="route('token.campaign.vars', [token.id, campaign.id])"
>
{{ campaign.name }}
</inertia-link>
</td> </td>
<td class="border-t px-6 py-3"> <td class="border-t px-6 py-3">
<input :id="'campaign-enabled-' + campaign.id" :checked="campaign.enabled" <input :id="'campaign-enabled-' + campaign.id" :checked="campaign.enabled"
...@@ -51,14 +47,6 @@ ...@@ -51,14 +47,6 @@
Delete Campaign Delete Campaign
</button> </button>
</td> </td>
<td class="border-t w-px">
<inertia-link class="px-4 flex items-center"
:href="route('token.campaign.vars', [token.id, campaign.id])"
tabindex="-1"
>
<icon name="cheveron-right" class="block w-6 h-6 fill-gray-400" />
</inertia-link>
</td>
</tr> </tr>
<tr v-if="token.campaigns.length === 0"> <tr v-if="token.campaigns.length === 0">
<td class="border-t px-6 py-4" colspan="5">No campaigns found.</td> <td class="border-t px-6 py-4" colspan="5">No campaigns found.</td>
......
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
<th class="px-6 pt-6 pb-4">Обновлять?</th> <th class="px-6 pt-6 pb-4">Обновлять?</th>
<th class="px-6 pt-6 pb-4"></th> <th class="px-6 pt-6 pb-4"></th>
</tr> </tr>
<template v-for="city in token_cities" > <template v-for="city in token.cities" >
<tr :key="city.id" class="hover:bg-gray-100 focus-within:bg-gray-100"> <tr :key="city.id" class="hover:bg-gray-100 focus-within:bg-gray-100">
<td colspan="2" class="border-t"> <td colspan="2" class="border-t">
<span class="px-6 py-4 flex items-center focus:text-indigo-500"> {{ city.name }} </span> {{ city.name }}
</td> </td>
<td class="border-t"> <td class="border-t">
<input :checked="city.update" <input :checked="city.update"
...@@ -49,14 +49,18 @@ ...@@ -49,14 +49,18 @@
<tr> <tr>
<th class="px-6 pt-6 pb-4"></th> <th class="px-6 pt-6 pb-4"></th>
<th class="px-6 pt-6 pb-4">Кампания</th> <th class="px-6 pt-6 pb-4">Кампания</th>
<th class="px-6 pt-6 pb-4">Синхронизировать?</th> <th class="px-6 pt-6 pb-4" colspan="2">Синхронизировать?</th>
<th></th> <th></th>
</tr> </tr>
<tr v-for="campaign in main_token_campaigns"> <tr v-for="campaign in main_token_campaigns">
<td class="border-t"></td> <td class="border-t"></td>
<td class="border-t"> <td class="border-t">
<span class="px-6 py-4 flex items-center focus:text-indigo-500"> <span class="px-6 py-4 flex items-center focus:text-indigo-500">
{{ campaign.name }} <inertia-link class="hover:text-indigo-500 focus:text-indigo-500"
:href="route('token.campaign.vars', [token.id, campaign.id])"
>
{{ campaign.name }}
</inertia-link>
</span> </span>
</td> </td>
<td class="border-t"> <td class="border-t">
...@@ -65,10 +69,17 @@ ...@@ -65,10 +69,17 @@
type="checkbox" type="checkbox"
> >
</td> </td>
<td></td> <td>
<inertia-link class="px-4 flex items-center"
tabindex="-1"
:href="route('token.campaign.vars', [token.id, campaign.id])"
>
<icon name="book" class="block w-6 h-6 fill-gray-400" />
</inertia-link>
</td>
</tr> </tr>
</template> </template>
<tr v-if="token_cities.length === 0"> <tr v-if="token.cities.length === 0">
<td class="border-t px-6 py-4" colspan="4">No City found.</td> <td class="border-t px-6 py-4" colspan="4">No City found.</td>
</tr> </tr>
</table> </table>
...@@ -84,7 +95,7 @@ export default { ...@@ -84,7 +95,7 @@ export default {
components: {Icon, SelectInput}, components: {Icon, SelectInput},
props: { props: {
cities: Array, cities: Array,
token_cities: Array, token: Object,
main_token_campaigns: Array, main_token_campaigns: Array,
}, },
data() { data() {
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
<city-settings v-if="token.type !== 'main'" <city-settings v-if="token.type !== 'main'"
:cities="cities" :cities="cities"
:token_cities="token.cities" :token="token"
:main_token_campaigns="main_token_campaigns" :main_token_campaigns="main_token_campaigns"
v-on:add="cityAdd" v-on:add="cityAdd"
v-on:updated="cityUpdated" v-on:updated="cityUpdated"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!