Skip to content

Commit

Permalink
added translation for type page
Browse files Browse the repository at this point in the history
  • Loading branch information
shivendra-webkul committed Jul 22, 2024
1 parent b8d657f commit e9a8048
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function store(): JsonResponse

return new JsonResponse([
'data' => $type,
'message' => trans('Lead Type Created successfully'),
'message' => trans('admin::app.settings.types.index.create-success'),
]);
}

Expand All @@ -74,13 +74,13 @@ public function update(int $id): JsonResponse

Event::dispatch('settings.type.update.before', $id);

$type = $this->typeRepository->update(request()->only(['name'] ), $id);
$type = $this->typeRepository->update(request()->only(['name']), $id);

Event::dispatch('settings.type.update.after', $type);

return new JsonResponse([
'data' => $type,
'message' => trans('Lead Type updated successfully'),
'message' => trans('admin::app.settings.types.index.update-success'),
]);
}

Expand All @@ -99,11 +99,11 @@ public function destroy(int $id): JsonResponse
Event::dispatch('settings.type.delete.after', $id);

return new JsonResponse([
'message' => trans('admin::app.settings.types.delete-success'),
'message' => trans('admin::app.settings.types.index.delete-success'),
], 200);
} catch (\Exception $exception) {
return new JsonResponse([
'message' => trans('admin::app.settings.types.delete-failed'),
'message' => trans('admin::app.settings.types.index.delete-failed'),
], 400);
}
}
Expand Down
29 changes: 29 additions & 0 deletions packages/Webkul/Admin/src/Resources/lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,35 @@
'title' => 'Edit Role',
],
],

'types' => [
'index' => [
'create-btn' => 'Create Type',
'title' => 'Types',
'create-success' => 'Type created successfully.',
'update-success' => 'Type updated successfully.',
'delete-success' => 'Type deleted successfully.',
'delete-failed' => 'Type can not be deleted.',

'datagrid' => [
'delete' => 'Delete',
'description' => 'Description',
'edit' => 'Edit',
'id' => 'ID',
'name' => 'Name',
],

'create' => [
'name' => 'Name',
'save-btn' => 'Save Type',
'title' => 'Create Type',
],

'edit' => [
'title' => 'Edit Type',
],
],
],
],

// ----------------------------------------------------------------Old version locale ----------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,29 @@
<x-admin::layouts>
<x-slot:title>
@lang('Types')
@lang('admin::app.settings.types.index.title')
</x-slot>

<v-types-settings>
<div class="flex items-center justify-between rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300">
<div class="flex flex-col gap-2">
<div class="flex cursor-pointer items-center">
<a
href="{{ route('admin.settings.types.index') }}"
class="flex items-center text-xs text-gray-600 dark:text-gray-300"
>
<i class="icon-left-arrow text-2xl"></i>

@lang('admin::app.settings.roles.index.settings')
</a>
<!-- Breadcrumbs -->
<x-admin::breadcrumbs name="settings.types" />
</div>

<div class="px-4 text-xl font-bold dark:text-gray-300">
@lang('Types')
<div class="text-xl font-bold dark:text-gray-300">
@lang('admin::app.settings.types.index.title')
</div>
</div>

<div class="flex items-center gap-x-2.5">
<!-- Create button for Types -->
<!-- Create button for Leads Type -->
<div class="flex items-center gap-x-2.5">
<a
href="{{ route('admin.settings.groups.create') }}"
class="primary-button"
>
@lang('Create Types')
@lang('admin::app.settings.types.index.create-btn')
</a>
</div>
</div>
Expand All @@ -47,40 +41,36 @@ class="primary-button"
<div class="flex items-center justify-between rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300">
<div class="flex flex-col gap-2">
<div class="flex cursor-pointer items-center">
<a
href="{{ route('admin.products.index') }}"
class="flex items-center text-xs text-gray-600 dark:text-gray-300"
>
<i class="icon-left-arrow text-2xl"></i>
@lang('admin::app.settings.roles.index.settings')
</a>
<!-- Breadcrumbs -->
<x-admin::breadcrumbs name="settings.types" />
</div>
<div class="px-4 text-xl font-bold dark:text-gray-300">
@lang('Types')
<div class="text-xl font-bold dark:text-gray-300">
@lang('admin::app.settings.types.index.title')
</div>
</div>
<div class="flex items-center gap-x-2.5">
<!-- Create button for person -->
<!-- Create button for Leads Type -->
<div class="flex items-center gap-x-2.5">
{!! view_render_event('krayin.admin.settings.groups.index.create-button.before') !!}
{!! view_render_event('krayin.admin.settings.types.index.create-button.before') !!}
<!-- Create button for Leads Type -->
<x-admin::button
button-type="button"
class="primary-button justify-center"
:title="trans('Create Types')"
:title="trans('admin::app.settings.types.index.create-btn')"
@click="selectedType=false; $refs.typeUpdateAndCreateModal.toggle()"
/>
{!! view_render_event('krayin.admin.settings.groups.index.create-button.after') !!}
{!! view_render_event('krayin.admin.settings.types.index.create-button.after') !!}
</div>
</div>
</div>
{!! view_render_event('krayin.admin.settings.types.index.datagrid.before') !!}
{!! view_render_event('krayin.admin.settings.groups.index.datagrid.before') !!}
<!-- Datagrid -->
<x-admin::datagrid
src="{{ route('admin.settings.types.index') }}"
ref="datagrid"
Expand Down Expand Up @@ -132,6 +122,8 @@ class="cursor-pointer rounded-md p-1.5 text-2xl transition-all hover:bg-gray-200
</template>
</x-admin::datagrid>
{!! view_render_event('krayin.admin.settings.groups.index.datagrid.after') !!}
<x-admin::form
v-slot="{ meta, errors, handleSubmit }"
as="div"
Expand All @@ -146,15 +138,15 @@ class="cursor-pointer rounded-md p-1.5 text-2xl transition-all hover:bg-gray-200
<p class="text-lg font-bold text-gray-800 dark:text-white">
@{{
selectedType
? "@lang('Edit Type')"
: "@lang('Create Type')"
? "@lang('admin::app.settings.types.index.edit.title')"
: "@lang('admin::app.settings.types.index.create.title')"
}}
</p>
</x-slot>
<!-- Modal Content -->
<x-slot:content>
{!! view_render_event('krayin.admin.settings.groups.create.before') !!}
{!! view_render_event('krayin.admin.settings.types.content.before') !!}
<x-admin::form.control-group.control
type="hidden"
Expand All @@ -163,30 +155,30 @@ class="cursor-pointer rounded-md p-1.5 text-2xl transition-all hover:bg-gray-200
<x-admin::form.control-group>
<x-admin::form.control-group.label class="required">
@lang('admin::app.settings.groups.index.create.name')
@lang('admin::app.settings.types.index.create.name')
</x-admin::form.control-group.label>
<x-admin::form.control-group.control
type="text"
id="name"
name="name"
rules="required"
:label="trans('admin::app.settings.groups.index.create.name')"
:placeholder="trans('admin::app.settings.groups.index.create.name')"
:label="trans('admin::app.settings.types.index.create.name')"
:placeholder="trans('admin::app.settings.types.index.create.name')"
/>
<x-admin::form.control-group.error control-name="name" />
</x-admin::form.control-group>
{!! view_render_event('krayin.admin.settings.groups.create.after') !!}
{!! view_render_event('krayin.admin.settings.types.content.after') !!}
</x-slot>
<!-- Modal Footer -->
<x-slot:footer>
<x-admin::button
button-type="submit"
class="primary-button justify-center"
:title="trans('Save')"
:title="trans('admin::app.settings.types.index.create.save-btn')"
::loading="isProcessing"
::disabled="isProcessing"
/>
Expand All @@ -196,8 +188,6 @@ class="primary-button justify-center"
{!! view_render_event('krayin.admin.settings.groups.create_form_controls.after') !!}
</form>
</x-admin::form>
{!! view_render_event('krayin.admin.settings.groups.index.datagrid.after') !!}
</script>

<script type="module">
Expand Down

0 comments on commit e9a8048

Please sign in to comment.