Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
devansh-webkul committed Dec 17, 2024
2 parents 1980a68 + a06d976 commit 2fb6f8c
Show file tree
Hide file tree
Showing 32 changed files with 224 additions and 147 deletions.
9 changes: 5 additions & 4 deletions packages/Webkul/Admin/src/Config/system.php
Original file line number Diff line number Diff line change
Expand Up @@ -2424,10 +2424,11 @@
'type' => 'boolean',
'default' => 1,
], [
'name' => 'offer_info',
'title' => 'admin::app.configuration.index.sales.checkout.mini-cart.mini-cart-offer-info',
'type' => 'text',
'default' => 'Get Up To 30% OFF on your 1st order',
'name' => 'offer_info',
'title' => 'admin::app.configuration.index.sales.checkout.mini-cart.mini-cart-offer-info',
'type' => 'text',
'default' => 'Get Up To 30% OFF on your 1st order',
'validation' => 'max:200',
],
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Support\Facades\Event;
use Webkul\Admin\DataGrids\Settings\TaxRateDataGrid;
use Webkul\Admin\Http\Controllers\Controller;
use Webkul\Admin\Http\Requests\TaxRateRequest;
use Webkul\Tax\Repositories\TaxRateRepository;

class TaxRateController extends Controller
Expand Down Expand Up @@ -50,21 +51,11 @@ public function create()
*
* @return \Illuminate\Http\Response
*/
public function store()
public function store(TaxRateRequest $request)
{
$this->validate(request(), [
'identifier' => 'required|string|unique:tax_rates,identifier',
'is_zip' => 'sometimes',
'zip_code' => 'nullable',
'zip_from' => 'nullable|required_with:is_zip',
'zip_to' => 'nullable|required_with:is_zip,zip_from',
'country' => 'required|string',
'tax_rate' => 'required|numeric|min:0.0001',
]);

Event::dispatch('tax.rate.create.before');

$taxRate = $this->taxRateRepository->create(request()->only([
$taxRate = $this->taxRateRepository->create($request->only([
'identifier',
'country',
'state',
Expand Down Expand Up @@ -99,21 +90,11 @@ public function edit(int $id)
*
* @return \Illuminate\Http\Response
*/
public function update(int $id)
public function update(TaxRateRequest $request, int $id)
{
$this->validate(request(), [
'identifier' => 'required|string|unique:tax_rates,identifier,'.$id,
'is_zip' => 'sometimes',
'zip_code' => 'nullable',
'zip_from' => 'nullable|required_with:is_zip',
'zip_to' => 'nullable|required_with:is_zip,zip_from',
'country' => 'required|string',
'tax_rate' => 'required|numeric|min:0.0001',
]);

Event::dispatch('tax.rate.update.before', $id);

$taxRate = $this->taxRateRepository->update(request()->only([
$taxRate = $this->taxRateRepository->update($request->only([
'identifier',
'country',
'state',
Expand Down
43 changes: 43 additions & 0 deletions packages/Webkul/Admin/src/Http/Requests/TaxRateRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace Webkul\Admin\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class TaxRateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [
'is_zip' => 'sometimes',
'zip_code' => 'nullable',
'zip_from' => 'nullable|required_with:is_zip',
'zip_to' => 'nullable|required_with:is_zip,zip_from',
'country' => 'required|string',
'tax_rate' => 'required|numeric|min:0|max:100',
];

if ($this->id) {
$rules['identifier'] = 'required|string|unique:tax_rates,identifier,'.$this->id;
} else {
$rules['identifier'] = 'required|string|unique:tax_rates,identifier';
}

return $rules;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import mitt from "mitt";

const emitter = mitt();

window.emitter = emitter;

export default {
install: (app, options) => {
app.config.globalProperties.$emitter = mitt();
app.config.globalProperties.$emitter = emitter;
},
};
};
68 changes: 61 additions & 7 deletions packages/Webkul/Admin/src/Resources/assets/js/plugins/flatpickr.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,79 @@
import Flatpickr from "flatpickr";
import "flatpickr/dist/flatpickr.css";
import { Spanish } from "flatpickr/dist/l10n/es.js";
import { Arabic } from "flatpickr/dist/l10n/ar.js";
import { Persian } from "flatpickr/dist/l10n/fa.js";
import { Turkish } from "flatpickr/dist/l10n/tr.js";
import { Bengali } from "flatpickr/dist/l10n/bn.js";
import { German } from "flatpickr/dist/l10n/de.js";
import { English } from "flatpickr/dist/l10n/default.js";
import { French } from "flatpickr/dist/l10n/fr.js";
import { Hebrew } from "flatpickr/dist/l10n/he.js";
import { Hindi } from "flatpickr/dist/l10n/hi.js";
import { Italian } from "flatpickr/dist/l10n/it.js";
import { Japanese } from "flatpickr/dist/l10n/ja.js";
import { Dutch } from "flatpickr/dist/l10n/nl.js";
import { Polish } from "flatpickr/dist/l10n/pl.js";
import { Portuguese } from "flatpickr/dist/l10n/pt.js";
import { Russian } from "flatpickr/dist/l10n/ru.js";
import { Sinhala } from "flatpickr/dist/l10n/si.js";
import { Ukrainian } from "flatpickr/dist/l10n/uk.js";
import { Chinese } from "flatpickr/dist/l10n/zh.js";

export default {
install: (app) => {
window.Flatpickr = Flatpickr;

const setLocaleFromLang = () => {
const lang = document.documentElement.lang || "en";

const localeMap = {
es: Spanish,
ar: Arabic,
fa: Persian,
tr: Turkish,
bn: Bengali,
de: German,
en: English,
fr: French,
he: Hebrew,
hi: Hindi,
it: Italian,
ja: Japanese,
nl: Dutch,
pl: Polish,
pt: Portuguese,
ru: Russian,
sin: Sinhala,
uk: Ukrainian,
zh: Chinese,
};

const locale = localeMap[lang] || null;

if (locale) {
window.Flatpickr.localize(locale);
}
};

setLocaleFromLang();

const changeTheme = (theme) => {
document.getElementById('flatpickr')?.remove();
const existingTheme = document.getElementById("flatpickr");

if (existingTheme) {
existingTheme.remove();
}

if (theme === 'light') {
if (theme === "light") {
return;
}

const linkElement = document.createElement("link");

linkElement.rel = "stylesheet";
linkElement.type = "text/css";
linkElement.href = `https://npmcdn.com/flatpickr/dist/themes/${theme}.css`;
linkElement.id = 'flatpickr';
linkElement.id = "flatpickr";

document.head.appendChild(linkElement);
};
Expand All @@ -28,8 +84,6 @@ export default {

changeTheme(currentTheme);

app.config.globalProperties.$emitter.on("change-theme", (theme) => {
changeTheme(theme);
});
window.emitter.on("change-theme", (theme) => changeTheme(theme));
},
};
2 changes: 1 addition & 1 deletion packages/Webkul/Admin/src/Resources/lang/bn/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

'notifications' => [
'description-text' => 'সমস্ত বিজ্ঞপ্তি তালিকা',
'marked-success' => 'সমস্ত বিজ্ঞপ্তি পড়া হিসেবে চিহ্নিত করা হয়েছে',
'marked-success' => 'সমস্ত বিজ্ঞপ্তি পড়া হয়েছে হিসাবে চিহ্নিত করা হয়েছে',
'no-record' => 'কোনও রেকর্ড পাওয়া যায়নি',
'of' => 'এর',
'per-page' => 'প্রতি পৃষ্ঠা',
Expand Down
2 changes: 1 addition & 1 deletion packages/Webkul/Admin/src/Resources/lang/en/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

'notifications' => [
'description-text' => 'List all the Notifications',
'marked-success' => 'All notifications has been marked as read',
'marked-success' => 'All notifications have been marked as read',
'no-record' => 'No Record Found',
'of' => 'of',
'per-page' => 'Per Page',
Expand Down
2 changes: 1 addition & 1 deletion packages/Webkul/Admin/src/Resources/lang/fa/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

'notifications' => [
'description-text' => 'لیست کل اعلان‌ها',
'marked-success' => 'همه اعلان‌ها به عنوان خوانده شده علامت‌گذاری شدند',
'marked-success' => 'تمام اعلان‌ها به عنوان خوانده شده علامت‌گذاری شدند',
'no-record' => 'هیچ رکوردی یافت نشد',
'of' => 'از',
'per-page' => 'در هر صفحه',
Expand Down
2 changes: 1 addition & 1 deletion packages/Webkul/Admin/src/Resources/lang/hi_IN/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

'notifications' => [
'description-text' => 'सभी सूचनाएँ सूचीबद्ध करें',
'marked-success' => 'सभी सूचनाओं को पढ़ा हुआ चिह्नित कर दिया गया है',
'marked-success' => 'सभी सूचनाओं को पढ़ा गया के रूप में चिह्नित किया गया है',
'no-record' => 'कोई रिकॉर्ड नहीं मिला',
'of' => 'का',
'per-page' => 'प्रति पृष्ठ',
Expand Down
2 changes: 1 addition & 1 deletion packages/Webkul/Admin/src/Resources/lang/it/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

'notifications' => [
'description-text' => 'Elenca tutte le notifiche',
'marked-success' => 'Tutte le notifiche sono state contrassegnate come lette',
'marked-success' => 'Tutte le notifiche sono state segnate come lette',
'no-record' => 'Nessun Record Trovato',
'of' => 'di',
'per-page' => 'Per pagina',
Expand Down
2 changes: 1 addition & 1 deletion packages/Webkul/Admin/src/Resources/lang/nl/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

'notifications' => [
'description-text' => 'Alle meldingen weergeven',
'marked-success' => 'Alle meldingen zijn als gelezen gemarkeerd',
'marked-success' => 'Alle meldingen zijn gemarkeerd als gelezen',
'no-record' => 'Geen Records Gevonden',
'of' => 'van',
'per-page' => 'Per pagina',
Expand Down
2 changes: 1 addition & 1 deletion packages/Webkul/Admin/src/Resources/lang/sin/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

'notifications' => [
'description-text' => 'සිසුන් සියලු දැක්කාක් ලැයිස්තුවෙන් සලකා',
'marked-success' => 'සියලුම දැනුම්දීම් කියවූ බවට සලකුණු කර ඇත',
'marked-success' => 'සියලු දැනුම්දීම් කියවූ ලෙස සලකුණු කර ඇත',
'no-record' => 'නිළියන්ට වාර්තා නොමැත',
'of' => 'සිට',
'per-page' => 'පිටුවට',
Expand Down
2 changes: 1 addition & 1 deletion packages/Webkul/Admin/src/Resources/lang/uk/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

'notifications' => [
'description-text' => 'Список всіх повідомлень',
'marked-success' => 'Усі сповіщення позначено як прочитані',
'marked-success' => 'Усі повідомлення позначено як прочитані',
'no-record' => 'Записів не знайдено',
'of' => 'з',
'per-page' => 'на сторінці',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class="text-sm text-gray-400 dark:text-gray-400"
</button>
</x-slot>

<x-slot:menu>
<x-slot:menu class="max-h-[200px] overflow-auto">
<x-admin::dropdown.menu.item
v-for="option in column.filterable_options"
v-text="option.label"
Expand Down Expand Up @@ -566,7 +566,7 @@ class="text-sm text-gray-400 dark:text-gray-400"
</button>
</x-slot>

<x-slot:menu>
<x-slot:menu class="max-h-[200px] overflow-auto">
<x-admin::dropdown.menu.item
v-for="option in column.filterable_options"
v-text="option.label"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class="relative h-[60px] max-h-[60px] w-full max-w-[60px] rounded"
@endif

<div class="grid place-content-start gap-1.5">
<p class="text-base font-semibold text-gray-800 dark:text-white">
<p class="break-all text-base font-semibold text-gray-800 dark:text-white">
{{ $item->name }}
</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class="relative h-[60px] max-h-[60px] w-full max-w-[60px] rounded"

<div class="grid place-content-start gap-1.5">
<!-- Item Name -->
<p class="text-base font-semibold text-gray-800 dark:text-white">
<p class="break-all text-base font-semibold text-gray-800 dark:text-white">
{{ $item->name }}
</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class="relative h-[60px] max-h-[60px] w-full max-w-[60px] overflow-hidden rounde
<!-- Item Information -->
<div class="grid gap-1.5">
<!-- Item Name -->
<p class="text-base font-semibold text-gray-800 dark:text-white">
<p class="break-all text-base font-semibold text-gray-800 dark:text-white">
@{{ item.name }}
</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class="relative h-[60px] max-h-[60px] w-full max-w-[60px] rounded"

<!-- Details -->
<div class="grid place-content-start gap-1.5">
<p class="text-base font-semibold text-gray-800 dark:text-white">
<p class="break-all text-base font-semibold text-gray-800 dark:text-white">
@{{ product.name }}
</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class="relative h-[60px] max-h-[60px] w-full max-w-[60px] overflow-hidden rounde
<!-- Item Information -->
<div class="grid gap-1.5">
<!-- Item Name -->
<p class="text-base font-semibold text-gray-800 dark:text-white">
<p class="break-all text-base font-semibold text-gray-800 dark:text-white">
@{{ item.product.name }}
</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ class="row grid grid-cols-4 border-b px-4 py-2.5 transition-all hover:bg-gray-50
<div class="">
<div class="flex gap-2.5">
<div class="flex flex-col gap-1.5">
<p
class="text-base font-semibold text-gray-800 dark:text-white"
>
<p class="text-base font-semibold text-gray-800 dark:text-white">
@{{ "@lang('admin::app.sales.orders.index.datagrid.id')".replace(':id', record.increment_id) }}
</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class="relative h-[60px] max-h-[60px] w-full max-w-[60px] rounded"
@endif

<div class="grid place-content-start gap-1.5">
<p class="text-base font-semibold text-gray-800 dark:text-white">
<p class="break-all text-base font-semibold text-gray-800 dark:text-white">
{{ $item->name }}
</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class="relative h-[60px] max-h-[60px] w-full max-w-[60px] rounded"

<div class="grid place-content-start gap-1.5">
<!-- Item Additional Attributes -->
<p class="text-base font-semibold text-gray-800 dark:text-white">
<p class="break-all text-base font-semibold text-gray-800 dark:text-white">
{{ $item->name }}
</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class="relative h-[60px] max-h-[60px] w-full max-w-[60px] rounded"

<!-- Product Name -->
<div class="grid place-content-start gap-1.5">
<p class="text-base font-semibold text-gray-800 dark:text-white">
<p class="break-all text-base font-semibold text-gray-800 dark:text-white">
{{ $item->name }}
</p>

Expand Down
Loading

0 comments on commit 2fb6f8c

Please sign in to comment.