Commit f60a7639 by Vladislav

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

1 parent 58d7c673
......@@ -20,11 +20,11 @@ class CampaignVarsController extends Controller
function __invoke(Tokens $token, $campaign_id)
{
if (!$token->isMain()) {
if ($token->isMain()) {
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) {
return Redirect::back();
......
......@@ -26,16 +26,12 @@
<table class="w-full whitespace-nowrap">
<tr class="text-left font-bold">
<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 v-for="campaign in token.campaigns" :key="campaign.id"
class="hover:bg-gray-100 focus-within:bg-gray-100">
<td class="border-t px-6 py-3">
<inertia-link class="hover:text-indigo-500 focus:text-indigo-500"
:href="route('token.campaign.vars', [token.id, campaign.id])"
>
{{ campaign.name }}
</inertia-link>
{{ campaign.name }}
</td>
<td class="border-t px-6 py-3">
<input :id="'campaign-enabled-' + campaign.id" :checked="campaign.enabled"
......@@ -51,14 +47,6 @@
Delete Campaign
</button>
</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 v-if="token.campaigns.length === 0">
<td class="border-t px-6 py-4" colspan="5">No campaigns found.</td>
......
......@@ -26,10 +26,10 @@
<th class="px-6 pt-6 pb-4">Обновлять?</th>
<th class="px-6 pt-6 pb-4"></th>
</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">
<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 class="border-t">
<input :checked="city.update"
......@@ -49,14 +49,18 @@
<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" colspan="2">Синхронизировать?</th>
<th></th>
</tr>
<tr v-for="campaign in main_token_campaigns">
<td class="border-t"></td>
<td class="border-t">
<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>
</td>
<td class="border-t">
......@@ -65,10 +69,17 @@
type="checkbox"
>
</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>
</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>
</tr>
</table>
......@@ -84,7 +95,7 @@ export default {
components: {Icon, SelectInput},
props: {
cities: Array,
token_cities: Array,
token: Object,
main_token_campaigns: Array,
},
data() {
......
......@@ -47,7 +47,7 @@
<city-settings v-if="token.type !== 'main'"
:cities="cities"
:token_cities="token.cities"
:token="token"
:main_token_campaigns="main_token_campaigns"
v-on:add="cityAdd"
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!