Skip to content

Commit

Permalink
Merge branch '2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
devansh-webkul committed Jan 16, 2025
2 parents 28dec4b + f728945 commit 748a3eb
Show file tree
Hide file tree
Showing 27 changed files with 255 additions and 125 deletions.
1 change: 1 addition & 0 deletions packages/Webkul/Admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@vee-validate/rules": "^4.9.1",
"@vitejs/plugin-vue": "^4.2.3",
"chartjs-chart-funnel": "^4.2.1",
"dompurify": "^3.1.7",
"flatpickr": "^4.6.13",
"mitt": "^3.0.1",
"vee-validate": "^4.9.1",
Expand Down
5 changes: 0 additions & 5 deletions packages/Webkul/Admin/src/Config/acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@
'name' => 'admin::app.acl.delete',
'route' => ['admin.contacts.persons.delete', 'admin.contacts.persons.mass_delete'],
'sort' => 4,
], [
'key' => 'contacts.persons.export',
'name' => 'admin::app.acl.export',
'route' => 'ui.datagrid.export',
'sort' => 4,
], [
'key' => 'contacts.persons.view',
'name' => 'admin::app.acl.view',
Expand Down
12 changes: 2 additions & 10 deletions packages/Webkul/Admin/src/DataGrids/Mail/EmailDataGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,8 @@ public function prepareColumns(): void
'type' => 'string',
'searchable' => false,
'filterable' => false,
'sortable' => true,
'closure' => function ($row) {
$email = app(EmailRepository::class)->find($row->id);

$hasAttachments = collect($email->emails)->contains(function ($email) {
return $email->attachments()->exists();
});

return $hasAttachments ? '<i class="icon-attachment text-2xl"></i>' : '';
},
'sortable' => false,
'closure' => fn ($row) => $row->attachments ? '<i class="icon-attachment text-2xl"></i>' : '',
]);

$this->addColumn([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(protected PersonRepository $personRepository)
/**
* Display a listing of the resource.
*/
public function index(): View|JsonResponse
public function index()
{
if (request()->ajax()) {
return datagrid(PersonDataGrid::class)->process();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(
/**
* Display a listing of the resource.
*/
public function index(): View|JsonResponse
public function index()
{
if (request()->ajax()) {
return datagrid(LeadDataGrid::class)->process();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function update(int $id): RedirectResponse
'name' => 'required',
'permission_type' => 'required|in:all,custom',
'description' => 'required',
'permissions' => 'required',
'permissions' => 'required_if:permission_type,custom',
]);

Event::dispatch('settings.role.update.before', $id);
Expand Down
6 changes: 4 additions & 2 deletions packages/Webkul/Admin/src/Resources/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,14 @@ import VueCal from "./plugins/vue-cal";
VueCal,
].forEach((plugin) => app.use(plugin));


/**
* Global directives.
*/
import Debounce from "./directives/debounce";
import DOMPurify from "./directives/dompurify";

app.directive("debounce", Debounce);
app.directive("safe-html", DOMPurify);

export default app;

export default app;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import DOMPurify from 'dompurify';

export default {
beforeMount(el, binding) {
el.innerHTML = DOMPurify.sanitize(binding.value);
},
updated(el, binding) {
el.innerHTML = DOMPurify.sanitize(binding.value);
}
};
9 changes: 9 additions & 0 deletions packages/Webkul/Admin/src/Resources/lang/ar/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -2083,4 +2083,13 @@
'title' => '503 الخدمة غير متوفرة',
],
],

'export' => [
'csv' => 'CSV',
'download' => 'تحميل',
'export' => 'تصدير',
'no-records' => 'لا توجد سجلات للتصدير',
'xls' => 'XLS',
'xlsx' => 'XLSX',
],
];
9 changes: 9 additions & 0 deletions packages/Webkul/Admin/src/Resources/lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -2087,4 +2087,13 @@
'title' => '503 Service Unavailable',
],
],

'export' => [
'csv' => 'CSV',
'download' => 'Download',
'export' => 'Export',
'no-records' => 'Nothing to export',
'xls' => 'XLS',
'xlsx' => 'XLSX',
],
];
9 changes: 9 additions & 0 deletions packages/Webkul/Admin/src/Resources/lang/es/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -2086,4 +2086,13 @@
'title' => '503 Servicio No Disponible',
],
],

'export' => [
'csv' => 'CSV',
'download' => 'Descargar',
'export' => 'Exportar',
'no-records' => 'No se encontraron registros.',
'xls' => 'XLS',
'xlsx' => 'XLSX',
],
];
9 changes: 9 additions & 0 deletions packages/Webkul/Admin/src/Resources/lang/fa/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -2087,4 +2087,13 @@
'title' => '503 سرویس در دسترس نیست',
],
],

'export' => [
'csv' => 'CSV',
'download' => 'دانلود',
'export' => 'صادر کردن',
'no-records' => 'هیچ سوابقی برای صادر کردن وجود ندارد.',
'xls' => 'XLS',
'xlsx' => 'XLSX',
],
];
9 changes: 9 additions & 0 deletions packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -2051,4 +2051,13 @@
'errors' => [
'401' => 'Você não tem autorização para acessar esta página',
],

'export' => [
'csv' => 'CSV',
'download' => 'Download',
'export' => 'Exportar',
'no-records' => 'Nenhum registro encontrado.',
'xls' => 'XLS',
'xlsx' => 'XLSX',
],
];
9 changes: 9 additions & 0 deletions packages/Webkul/Admin/src/Resources/lang/tr/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -2087,4 +2087,13 @@
'title' => '503 Hizmet Kullanılamıyor',
],
],

'export' => [
'csv' => 'CSV',
'download' => 'İndir',
'export' => 'Dışa Aktar',
'no-records' => 'Dışa aktarılacak kayıt bulunamadı.',
'xls' => 'XLS',
'xlsx' => 'XLSX',
],
];
9 changes: 9 additions & 0 deletions packages/Webkul/Admin/src/Resources/lang/vi/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -2086,4 +2086,13 @@
'title' => '503 Dịch Vụ Không Khả Dụng',
],
],

'export' => [
'csv' => 'CSV',
'download' => 'Tải Xuống',
'export' => 'Xuất',
'no-records' => 'Không có bản ghi nào được tìm thấy.',
'xls' => 'XLS',
'xlsx' => 'XLSX',
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class="dark:text-white"
<p
class="dark:text-white"
v-if="activity.comment"
v-html="activity.comment"
v-safe-html="activity.comment"
></p>

{!! view_render_event('admin.components.activities.content.activity.item.description.after') !!}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
</div>

<div class="flex items-center gap-x-2.5">
<!-- Export Modal -->
<x-admin::datagrid.export :src="route('admin.contacts.persons.index')" />

<!-- Create button for person -->
<div class="flex items-center gap-x-2.5">
{!! view_render_event('admin.persons.index.create_button.before') !!}
Expand Down Expand Up @@ -44,8 +47,8 @@ class="primary-button"
{!! view_render_event('admin.persons.index.datagrid.after') !!}
</div>

@pushOnce('scripts')
<script
@pushOnce('scripts')
<script
type="text/x-template"
id="v-persons-template"
>
Expand Down Expand Up @@ -167,7 +170,7 @@ class="icon-checkbox-outline peer-checked:icon-checkbox-select cursor-pointer ro
<!-- Name -->
<div class="flex items-center gap-1.5 dark:text-gray-300">
<x-admin::avatar ::name="record.person_name" />
@{{ record.person_name }}
</div>
Expand All @@ -185,7 +188,7 @@ class="icon-checkbox-outline peer-checked:icon-checkbox-select cursor-pointer ro
<p class="flex items-center dark:text-gray-300">
@{{ record.organization }}
</p>
<!-- Actions -->
<div class="flex items-center justify-end gap-x-4">
<div class="flex items-center gap-1.5">
Expand All @@ -202,7 +205,7 @@ class="cursor-pointer rounded-md p-1.5 text-2xl transition-all hover:bg-gray-200
></span>
</p>
</div>
</div>
</div>
</div>
</template>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
{!! view_render_event('admin.leads.index.header.right.before') !!}

<div class="flex items-center gap-x-2.5">
@if ((request()->view_type ?? "kanban") == "table")
<!-- Export Modal -->
<x-admin::datagrid.export :src="route('admin.leads.index')" />
@endif

<!-- Create button for Leads -->
<div class="flex items-center gap-x-2.5">
@if (bouncer()->hasPermission('leads.create'))
Expand Down Expand Up @@ -55,4 +60,4 @@ class="primary-button"
</div>

{!! view_render_event('admin.leads.index.content.after') !!}
</x-admin::layouts>
</x-admin::layouts>
28 changes: 8 additions & 20 deletions packages/Webkul/Admin/src/Resources/views/mail/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,9 @@ class="icon-checkbox-outline peer-checked:icon-checkbox-select cursor-pointer ro
<div class="flex w-full items-center justify-between gap-4">
<!-- Content -->
<div class="flex items-center gap-2">
<!-- Attachments (retains space even if empty) -->
<p
v-if="record.attachments"
v-html="record.attachments"
></p>
<div class="flex-frow flex items-center gap-2">
<!-- Attachments -->
<p v-html="record.attachments"></p>
<!-- Tags -->
<span
Expand All @@ -222,9 +218,11 @@ class="flex items-center gap-1 rounded-2xl bg-rose-100 px-2 py-1"
<!-- Subject -->
<p class="line-clamp-1 text-sm text-gray-900 dark:text-gray-100" v-text="record.subject"></p>
<!-- Reply (Content) -->
<p class="line-clamp-1 text-sm text-gray-500 dark:text-gray-400" v-html="truncatedReply(record.reply)"></p>
</div>
<!-- Reply(Content) -->
<p
class="!font-normal"
v-html="truncatedReply(record.reply)"
></p>
</div>
<!-- Time -->
Expand Down Expand Up @@ -491,16 +489,6 @@ class="primary-button"
},
methods: {
truncatedReply(reply) {
const maxLength = 100;
if (reply.length > maxLength) {
return `${reply.substring(0, maxLength)}...`;
}
return reply;
},
toggleModal() {
this.draft.reply_to = [];
Expand Down
6 changes: 3 additions & 3 deletions packages/Webkul/Admin/src/Resources/views/mail/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@lang('admin::app.mail.view.title')
</div>

<span class="label-active">{{ request('route') }}</span>
<span class="label-active">{{ ucfirst(request('route')) }}</span>

{!! view_render_event('admin.mail.view.tags.before', ['email' => $email]) !!}

Expand Down Expand Up @@ -243,9 +243,9 @@ class="flex cursor-pointer items-center gap-2"
{!! view_render_event('admin.mail.view.mail_body.before', ['email' => $email]) !!}
<!-- Mail Body -->
<div
v-html="email.reply"
<div
class="dark:text-gray-300"
v-safe-html="email.reply"
></div>
{!! view_render_event('admin.mail.view.mail_body.after', ['email' => $email]) !!}
Expand Down
21 changes: 21 additions & 0 deletions packages/Webkul/DataGrid/src/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class Column
*/
protected bool $sortable = false;

/**
* Column's exportability.
*/
protected bool $exportable = true;

/**
* Column's visibility.
*/
Expand Down Expand Up @@ -253,6 +258,22 @@ public function getSortable(): bool
return $this->sortable;
}

/**
* Set exportable.
*/
public function setExportable(bool $exportable): void
{
$this->exportable = $exportable;
}

/**
* Get exportable.
*/
public function getExportable(): bool
{
return $this->exportable;
}

/**
* Set visibility.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/Webkul/DataGrid/src/DataGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Str;
use Maatwebsite\Excel\Facades\Excel;
use Webkul\Admin\Exports\DataGridExport;
use Webkul\DataGrid\Enums\ColumnTypeEnum;
use Webkul\DataGrid\Exports\DataGridExport;

abstract class DataGrid
{
Expand Down
Loading

0 comments on commit 748a3eb

Please sign in to comment.