Skip to content

Commit

Permalink
Merge pull request #7 from abdelmjid-saber/master
Browse files Browse the repository at this point in the history
update translations fields & fix issue
  • Loading branch information
3x1io authored Feb 22, 2024
2 parents 7b8a184 + bf93a19 commit a432695
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 27 deletions.
6 changes: 2 additions & 4 deletions resources/views/plan_features/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

<x-splade-form class="flex flex-col space-y-4" action="{{route('admin.plan-features.store')}}" method="post">

<x-splade-input name="name.ar" type="text" label="{{trans('tomato-subscription::global.features.name')}} {{trans('tomato-subscription::global.lang.ar')}}" placeholder="{{trans('tomato-subscription::global.features.name')}} {{trans('tomato-subscription::global.lang.ar')}}" />
<x-splade-input name="name.en" type="text" label="{{trans('tomato-subscription::global.features.name')}} {{trans('tomato-subscription::global.lang.en')}}" placeholder="{{trans('tomato-subscription::global.features.name')}} {{trans('tomato-subscription::global.lang.en')}}" />
<x-splade-textarea name="description.ar" label="{{trans('tomato-subscription::global.features.description')}} {{trans('tomato-subscription::global.lang.ar')}}" placeholder="{{trans('tomato-subscription::global.features.description')}} {{trans('tomato-subscription::global.lang.ar')}}" autosize />
<x-splade-textarea name="description.en" label="{{trans('tomato-subscription::global.features.description')}} {{trans('tomato-subscription::global.lang.en')}}" placeholder="{{trans('tomato-subscription::global.features.description')}} {{trans('tomato-subscription::global.lang.en')}}" autosize />
<x-tomato-translation name="name" type="text" label="{{trans('tomato-subscription::global.features.name')}}" placeholder="{{trans('tomato-subscription::global.features.name')}}" />
<x-tomato-translation textarea name="description" type="text" label="{{trans('tomato-subscription::global.features.description')}}" placeholder="{{trans('tomato-subscription::global.features.description')}}"/>

<x-splade-select name="key" label="{{trans('tomato-subscription::global.features.key')}}" placeholder="{{trans('tomato-subscription::global.features.key')}}" choices>
@foreach($routes as $route)
Expand Down
6 changes: 2 additions & 4 deletions resources/views/plan_features/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@

<x-splade-form class="flex flex-col space-y-4" action="{{route('admin.plan-features.update', $model->id)}}" method="post" :default="$model">

<x-splade-input name="name.ar" type="text" label="{{trans('tomato-subscription::global.features.name')}} [{{trans('tomato-subscription::global.lang.ar')}}]" placeholder="{{trans('tomato-subscription::global.features.name')}} [{{trans('tomato-subscription::global.lang.ar')}}]" />
<x-splade-input name="name.en" type="text" label="{{trans('tomato-subscription::global.features.name')}} [{{trans('tomato-subscription::global.lang.en')}}]" placeholder="{{trans('tomato-subscription::global.features.name')}} [{{trans('tomato-subscription::global.lang.en')}}]" />
<x-splade-textarea name="description.ar" label="{{trans('tomato-subscription::global.features.description')}} [{{trans('tomato-subscription::global.lang.ar')}}]" placeholder="{{trans('tomato-subscription::global.features.description')}} [{{trans('tomato-subscription::global.lang.ar')}}]" autosize />
<x-splade-textarea name="description.en" label="{{trans('tomato-subscription::global.features.description')}} [{{trans('tomato-subscription::global.lang.en')}}]" placeholder="{{trans('tomato-subscription::global.features.description')}} [{{trans('tomato-subscription::global.lang.en')}}]" autosize />
<x-tomato-translation name="name" type="text" label="{{trans('tomato-subscription::global.features.name')}}" placeholder="{{trans('tomato-subscription::global.features.name')}}" />
<x-tomato-translation textarea name="description" type="text" label="{{trans('tomato-subscription::global.features.description')}}" placeholder="{{trans('tomato-subscription::global.features.description')}}" />

<x-splade-select name="key" label="{{trans('tomato-subscription::global.features.key')}}" placeholder="{{trans('tomato-subscription::global.features.key')}}" choices>
@foreach($routes as $route)
Expand Down
2 changes: 1 addition & 1 deletion resources/views/plan_subscription/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@endforeach
</x-splade-select>
<x-splade-select v-if="form.model_type" label="{{trans('tomato-subscription::global.subscription.subscriber')}}" placeholder="{{trans('tomato-subscription::global.subscription.subscriber')}}" name="model_id" remote-url="`/admin/plans/${form.model_type}/api`" remote-root="model" option-label="name" option-value="id" choices/>
<x-splade-select label="{{trans('tomato-subscription::global.subscription.plan_id')}}" placeholder="{{trans('tomato-subscription::global.subscription.plan_id')}}" name="plan_id" remote-url="/admin/plans/api" remote-root="model.data" option-label="name.{{app()->getLocale()}}" option-value="id" choices/>
<x-splade-select label="{{trans('tomato-subscription::global.subscription.plan_id')}}" placeholder="{{trans('tomato-subscription::global.subscription.plan_id')}}" name="plan_id" remote-url="/admin/plans/api" remote-root="data" option-label="name.{{app()->getLocale()}}" option-value="id" choices/>
<x-splade-select name="status" label="{{trans('tomato-subscription::global.subscription.status')}}" placeholder="{{trans('tomato-subscription::global.subscription.status')}}" choices>
<option value="pending">{{trans('tomato-subscription::global.subscription.statues.pending')}}</option>
<option value="active">{{trans('tomato-subscription::global.subscription.statues.active')}}</option>
Expand Down
6 changes: 2 additions & 4 deletions resources/views/plans/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
'order' => \Modules\Plan\Entities\Plan::count() + 1,
]" class="my-4 flex flex-col space-y-4" action="{{route('admin.plans.store')}}" method="post" :default="['features'=>[]]">

<x-splade-input name="name.ar" type="text" label="{{trans('tomato-subscription::global.plans.name')}} {{trans('tomato-subscription::global.lang.ar')}}" placeholder="{{trans('tomato-subscription::global.plans.name')}} {{trans('tomato-subscription::global.lang.ar')}}" />
<x-splade-input name="name.en" type="text" label="{{trans('tomato-subscription::global.plans.name')}} {{trans('tomato-subscription::global.lang.en')}}" placeholder="{{trans('tomato-subscription::global.plans.name')}} {{trans('tomato-subscription::global.lang.en')}}" />
<x-splade-textarea name="description.ar" label="{{trans('tomato-subscription::global.plans.description')}} {{trans('tomato-subscription::global.lang.ar')}}" placeholder="{{trans('tomato-subscription::global.plans.description')}} {{trans('tomato-subscription::global.lang.ar')}}" autosize />
<x-splade-textarea name="description.en" label="{{trans('tomato-subscription::global.plans.description')}} {{trans('tomato-subscription::global.lang.en')}}" placeholder="{{trans('tomato-subscription::global.plans.description')}} {{trans('tomato-subscription::global.lang.en')}}" autosize />
<x-tomato-translation name="name" type="text" label="{{trans('tomato-subscription::global.plans.name')}}" placeholder="{{trans('tomato-subscription::global.plans.name')}}" />
<x-tomato-translation textarea name="description" type="text" label="{{trans('tomato-subscription::global.plans.description')}}" placeholder="{{trans('tomato-subscription::global.plans.description')}}"/>
<x-splade-select name="invoice_interval" label="{{trans('tomato-subscription::global.plans.invoice_interval')}}" placeholder="{{trans('tomato-subscription::global.plans.invoice_interval')}}" choices>
<option value="day">{{trans('tomato-subscription::global.plans.invoice_intervals.day')}}</option>
<option value="week">{{trans('tomato-subscription::global.plans.invoice_intervals.week')}}</option>
Expand Down
12 changes: 5 additions & 7 deletions resources/views/plans/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
<x-tomato-admin-container container label="{{ __('Edit Plan') . ' # ' . $model->id }}">

<x-splade-form class="my-4 flex flex-col space-y-4" action="{{route('admin.plans.update', $model->id)}}" method="post" :default="$model">
<x-splade-input name="name.ar" type="text" label="{{trans('tomato-subscription::global.plans.name')}} {{trans('tomato-subscription::global.lang.ar')}}" placeholder="{{trans('tomato-subscription::global.plans.name')}} {{trans('tomato-subscription::global.lang.ar')}}" />
<x-splade-input name="name.en" type="text" label="{{trans('tomato-subscription::global.plans.name')}} {{trans('tomato-subscription::global.lang.en')}}" placeholder="{{trans('tomato-subscription::global.plans.name')}} {{trans('tomato-subscription::global.lang.en')}}" />
<x-splade-textarea name="description.ar" label="{{trans('tomato-subscription::global.plans.description')}} {{trans('tomato-subscription::global.lang.ar')}}" placeholder="{{trans('tomato-subscription::global.plans.description')}} {{trans('tomato-subscription::global.lang.ar')}}" autosize />
<x-splade-textarea name="description.en" label="{{trans('tomato-subscription::global.plans.description')}} {{trans('tomato-subscription::global.lang.en')}}" placeholder="{{trans('tomato-subscription::global.plans.description')}} {{trans('tomato-subscription::global.lang.en')}}" autosize />
<x-tomato-translation name="name" type="text" label="{{trans('tomato-subscription::global.plans.name')}}" placeholder="{{trans('tomato-subscription::global.plans.name')}}" />
<x-tomato-translation textarea name="description" type="text" label="{{trans('tomato-subscription::global.plans.description')}}" placeholder="{{trans('tomato-subscription::global.plans.description')}}"/>
<x-splade-select name="invoice_interval" label="{{trans('tomato-subscription::global.plans.invoice_interval')}}" placeholder="{{trans('tomato-subscription::global.plans.invoice_interval')}}" choices>
<option value="day">{{trans('tomato-subscription::global.plans.invoice_intervals.day')}}</option>
<option value="week">{{trans('tomato-subscription::global.plans.invoice_intervals.week')}}</option>
Expand All @@ -18,20 +16,20 @@
</div>
<x-splade-input type="text" name="order" label="{{trans('tomato-subscription::global.plans.order')}}" placeholder="{{trans('tomato-subscription::global.plans.order')}}" />

<x-tomato-color name="color" label="{{trans('tomato-subscription::global.plans.color')}}" />
<x-tomato-admin-color name="color" label="{{trans('tomato-subscription::global.plans.color')}}" />

<div class="grid grid-cols-2 gap-2">
<x-splade-checkbox name="is_recurring" label="{{trans('tomato-subscription::global.plans.is_recurring')}}"/>
<x-splade-checkbox name="is_active" label="{{trans('tomato-subscription::global.plans.is_active')}}"/>
<x-splade-checkbox name="is_free" label="{{trans('tomato-subscription::global.plans.is_free')}}"/>
<x-splade-checkbox name="is_default" label="{{trans('tomato-subscription::global.plans.is_default')}}" />
</div>
<x-tomato-repeater :options="['feature', 'value']" type="repeater" id="features" name="features" label="{{trans('tomato-subscription::global.plans.features')}}">
<x-tomato-admin-repeater :options="['feature', 'value']" type="repeater" id="features" name="features" label="{{trans('tomato-subscription::global.plans.features')}}">
<div class="flex flex-col justify-center space-y-4">
<x-splade-select option-label="name.{{app()->getLocale()}}" option-value="id" remote-root="model.data" remote-url="{{route('admin.plan-features.api')}}" v-model="repeater.main[key].feature" label="{{trans('tomato-subscription::global.plans.feature')}}" placeholder="{{trans('tomato-subscription::global.plans.feature')}}" />
<x-splade-input v-model="repeater.main[key].value" name="value" type="text" label="{{trans('tomato-subscription::global.plans.value')}}" placeholder="{{trans('tomato-subscription::global.plans.value')}}" />
</div>
</x-tomato-repeater>
</x-tomato-admin-repeater>

<x-splade-submit label="{{ __('Update Plan') }}" :spinner="true" />
</x-splade-form>
Expand Down
14 changes: 7 additions & 7 deletions src/Http/Controllers/PlanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ public function index(Request $request): View|JsonResponse
* @param Request $request
* @return JsonResponse
*/
// public function api(Request $request): JsonResponse
// {
// return Tomato::json(
// request: $request,
// model: Plan::class,
// );
// }
public function api(Request $request): JsonResponse
{
return Tomato::json(
request: $request,
model: Plan::class,
);
}


/**
Expand Down

0 comments on commit a432695

Please sign in to comment.