fix: 🐛 replace 'back.' by the config route name
This commit is contained in:
parent
f210826880
commit
bfff0ce6f1
71 changed files with 484 additions and 298 deletions
|
|
@ -31,6 +31,7 @@ class BrandController extends BackendController
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->authorizeResource(Brand::class);
|
||||
$this->modelName = Brand::modelName();
|
||||
$this->modelPage = Brand::modelPage();
|
||||
|
|
@ -48,7 +49,7 @@ class BrandController extends BackendController
|
|||
/** @var \Illuminate\Database\Eloquent\Builder<\App\Models\Brand> $query */
|
||||
$query = Brand::query();
|
||||
|
||||
if ($request->routeIs("back.$this->modelName.trash")) {
|
||||
if ($request->routeIs("{$this->routeName}{$this->modelName}.trash")) {
|
||||
$query = $query->onlyTrashed();
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +124,7 @@ class BrandController extends BackendController
|
|||
|
||||
if ($brand->saveOrFail()) {
|
||||
$brand->sites()->syncWithoutDetaching(Arr::get($validatedData, 'sites'));
|
||||
return redirect()->route("back.$this->modelName.edit", $brand)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $brand)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_created', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -166,12 +167,12 @@ class BrandController extends BackendController
|
|||
|
||||
if ($brand->saveOrFail()) {
|
||||
$brand->sites()->sync(Arr::get($validatedData, 'sites'));
|
||||
return redirect()->route("back.$this->modelName.edit", $brand)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $brand)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_updated', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
}
|
||||
return redirect()->route("back.$this->modelName.edit", $brand)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $brand)
|
||||
->with('error', trans('uwil-backend::crud.messages.cannot_be_updated', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -205,7 +206,7 @@ class BrandController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($brand->restore()) {
|
||||
return redirect()->route("back.$this->modelName.trash", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.trash", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_restored', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -228,7 +229,7 @@ class BrandController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($brand->delete()) {
|
||||
return redirect()->route("back.$this->modelName.index", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.index", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -254,7 +255,7 @@ class BrandController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($brand->forceDelete()) {
|
||||
return redirect()->route("back.$this->modelName.trash", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.trash", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class GitlabProjectController extends BackendController
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->authorizeResource(GitlabProject::class);
|
||||
$this->modelName = GitlabProject::modelName();
|
||||
$this->modelPage = GitlabProject::modelPage();
|
||||
|
|
@ -37,7 +38,7 @@ class GitlabProjectController extends BackendController
|
|||
/** @var \Illuminate\Database\Eloquent\Builder<\App\Models\GitlabProject> $query */
|
||||
$query = GitlabProject::query();
|
||||
|
||||
if ($request->routeIs("back.$this->modelName.trash")) {
|
||||
if ($request->routeIs("{$this->routeName}{$this->modelName}.trash")) {
|
||||
$query = $query->onlyTrashed();
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +108,7 @@ class GitlabProjectController extends BackendController
|
|||
$gitlab_project->fill($request->validated());
|
||||
|
||||
if ($gitlab_project->saveOrFail()) {
|
||||
return redirect()->route("back.$this->modelName.edit", $gitlab_project)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $gitlab_project)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_created', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -147,12 +148,12 @@ class GitlabProjectController extends BackendController
|
|||
$gitlab_project->fill($request->validated());
|
||||
|
||||
if ($gitlab_project->saveOrFail()) {
|
||||
return redirect()->route("back.$this->modelName.edit", $gitlab_project)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $gitlab_project)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_updated', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
}
|
||||
return redirect()->route("back.$this->modelName.edit", $gitlab_project)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $gitlab_project)
|
||||
->with('error', trans('uwil-backend::crud.messages.cannot_be_updated', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -186,7 +187,7 @@ class GitlabProjectController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($gitlab_project->restore()) {
|
||||
return redirect()->route("back.$this->modelName.trash", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.trash", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_restored', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -209,7 +210,7 @@ class GitlabProjectController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($gitlab_project->delete()) {
|
||||
return redirect()->route("back.$this->modelName.index", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.index", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -235,7 +236,7 @@ class GitlabProjectController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($gitlab_project->forceDelete()) {
|
||||
return redirect()->route("back.$this->modelName.trash", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.trash", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class InvoiceCompanyController extends BackendController
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->authorizeResource(InvoiceCompany::class);
|
||||
$this->modelName = InvoiceCompany::modelName();
|
||||
$this->modelPage = InvoiceCompany::modelPage();
|
||||
|
|
@ -37,7 +38,7 @@ class InvoiceCompanyController extends BackendController
|
|||
/** @var \Illuminate\Database\Eloquent\Builder<\App\Models\InvoiceCompany> $query */
|
||||
$query = InvoiceCompany::query();
|
||||
|
||||
if ($request->routeIs("back.$this->modelName.trash")) {
|
||||
if ($request->routeIs("{$this->routeName}{$this->modelName}.trash")) {
|
||||
$query = $query->onlyTrashed();
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +108,7 @@ class InvoiceCompanyController extends BackendController
|
|||
$invoice_company->fill($request->validated());
|
||||
|
||||
if ($invoice_company->saveOrFail()) {
|
||||
return redirect()->route("back.$this->modelName.edit", $invoice_company)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $invoice_company)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_created', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -147,12 +148,12 @@ class InvoiceCompanyController extends BackendController
|
|||
$invoice_company->fill($request->validated());
|
||||
|
||||
if ($invoice_company->saveOrFail()) {
|
||||
return redirect()->route("back.$this->modelName.edit", $invoice_company)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $invoice_company)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_updated', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
}
|
||||
return redirect()->route("back.$this->modelName.edit", $invoice_company)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $invoice_company)
|
||||
->with('error', trans('uwil-backend::crud.messages.cannot_be_updated', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -186,7 +187,7 @@ class InvoiceCompanyController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($invoice_company->restore()) {
|
||||
return redirect()->route("back.$this->modelName.trash", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.trash", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_restored', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -209,7 +210,7 @@ class InvoiceCompanyController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($invoice_company->delete()) {
|
||||
return redirect()->route("back.$this->modelName.index", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.index", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -235,7 +236,7 @@ class InvoiceCompanyController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($invoice_company->forceDelete()) {
|
||||
return redirect()->route("back.$this->modelName.trash", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.trash", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class InvoicePackageController extends BackendController
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->authorizeResource(InvoicePackage::class);
|
||||
$this->modelName = InvoicePackage::modelName();
|
||||
$this->modelPage = InvoicePackage::modelPage();
|
||||
|
|
@ -37,7 +38,7 @@ class InvoicePackageController extends BackendController
|
|||
/** @var \Illuminate\Database\Eloquent\Builder<\App\Models\InvoicePackage> $query */
|
||||
$query = InvoicePackage::query();
|
||||
|
||||
if ($request->routeIs("back.$this->modelName.trash")) {
|
||||
if ($request->routeIs("{$this->routeName}{$this->modelName}.trash")) {
|
||||
$query = $query->onlyTrashed();
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +108,7 @@ class InvoicePackageController extends BackendController
|
|||
$invoice_package->fill($request->validated());
|
||||
|
||||
if ($invoice_package->saveOrFail()) {
|
||||
return redirect()->route("back.$this->modelName.edit", $invoice_package)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $invoice_package)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_created', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -147,12 +148,12 @@ class InvoicePackageController extends BackendController
|
|||
$invoice_package->fill($request->validated());
|
||||
|
||||
if ($invoice_package->saveOrFail()) {
|
||||
return redirect()->route("back.$this->modelName.edit", $invoice_package)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $invoice_package)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_updated', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
}
|
||||
return redirect()->route("back.$this->modelName.edit", $invoice_package)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $invoice_package)
|
||||
->with('error', trans('uwil-backend::crud.messages.cannot_be_updated', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -186,7 +187,7 @@ class InvoicePackageController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($invoice_package->restore()) {
|
||||
return redirect()->route("back.$this->modelName.trash", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.trash", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_restored', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -209,7 +210,7 @@ class InvoicePackageController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($invoice_package->delete()) {
|
||||
return redirect()->route("back.$this->modelName.index", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.index", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -235,7 +236,7 @@ class InvoicePackageController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($invoice_package->forceDelete()) {
|
||||
return redirect()->route("back.$this->modelName.trash", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.trash", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class NoticeController extends BackendController
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->authorizeResource(Notice::class);
|
||||
$this->modelName = Notice::modelName();
|
||||
$this->modelPage = Notice::modelPage();
|
||||
|
|
@ -37,7 +38,7 @@ class NoticeController extends BackendController
|
|||
/** @var \Illuminate\Database\Eloquent\Builder<\App\Models\Notice> $query */
|
||||
$query = Notice::query();
|
||||
|
||||
if ($request->routeIs("back.$this->modelName.trash")) {
|
||||
if ($request->routeIs("{$this->routeName}{$this->modelName}.trash")) {
|
||||
$query = $query->onlyTrashed();
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +108,7 @@ class NoticeController extends BackendController
|
|||
$notice->fill($request->validated());
|
||||
|
||||
if ($notice->saveOrFail()) {
|
||||
return redirect()->route("back.$this->modelName.edit", $notice)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $notice)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_created', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -147,12 +148,12 @@ class NoticeController extends BackendController
|
|||
$notice->fill($request->validated());
|
||||
|
||||
if ($notice->saveOrFail()) {
|
||||
return redirect()->route("back.$this->modelName.edit", $notice)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $notice)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_updated', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
}
|
||||
return redirect()->route("back.$this->modelName.edit", $notice)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $notice)
|
||||
->with('error', trans('uwil-backend::crud.messages.cannot_be_updated', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -186,7 +187,7 @@ class NoticeController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($notice->restore()) {
|
||||
return redirect()->route("back.$this->modelName.trash", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.trash", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_restored', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -209,7 +210,7 @@ class NoticeController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($notice->delete()) {
|
||||
return redirect()->route("back.$this->modelName.index", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.index", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -235,7 +236,7 @@ class NoticeController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($notice->forceDelete()) {
|
||||
return redirect()->route("back.$this->modelName.trash", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.trash", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class SiteController extends BackendController
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->authorizeResource(Site::class);
|
||||
$this->modelName = Site::modelName();
|
||||
$this->modelPage = Site::modelPage();
|
||||
|
|
@ -73,7 +74,7 @@ class SiteController extends BackendController
|
|||
)
|
||||
->with(['projectManager', 'gitlabProject']);
|
||||
|
||||
if ($request->routeIs("back.$this->modelName.trash")) {
|
||||
if ($request->routeIs("{$this->routeName}{$this->modelName}.trash")) {
|
||||
$query = $query->onlyTrashed();
|
||||
}
|
||||
|
||||
|
|
@ -153,7 +154,7 @@ class SiteController extends BackendController
|
|||
|
||||
if ($site->saveOrFail()) {
|
||||
$site->users()->syncWithoutDetaching(Arr::get($validatedData, 'users'));
|
||||
return redirect()->route("back.$this->modelName.edit", $site)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $site)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_created', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -201,12 +202,12 @@ class SiteController extends BackendController
|
|||
|
||||
if ($site->saveOrFail()) {
|
||||
$site->users()->sync(Arr::get($validatedData, 'users'));
|
||||
return redirect()->route("back.$this->modelName.edit", $site)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $site)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_updated', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
}
|
||||
return redirect()->route("back.$this->modelName.edit", $site)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.edit", $site)
|
||||
->with('error', trans('uwil-backend::crud.messages.cannot_be_updated', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -240,7 +241,7 @@ class SiteController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($site->restore()) {
|
||||
return redirect()->route("back.$this->modelName.trash", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.trash", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_restored', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -263,7 +264,7 @@ class SiteController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($site->delete()) {
|
||||
return redirect()->route("back.$this->modelName.index", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.index", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
@ -289,7 +290,7 @@ class SiteController extends BackendController
|
|||
$previousQueries = [];
|
||||
\parse_str(\parse_url(url()->previous(), \PHP_URL_QUERY), $previousQueries);
|
||||
if ($site->forceDelete()) {
|
||||
return redirect()->route("back.$this->modelName.trash", $previousQueries)
|
||||
return redirect()->route("{$this->routeName}{$this->modelName}.trash", $previousQueries)
|
||||
->with('success', trans('uwil-backend::crud.messages.has_been_deleted', [
|
||||
'model' => Str::ucfirst(trans_choice("models.classes.$this->modelName", 1)),
|
||||
]));
|
||||
|
|
|
|||
|
|
@ -52,8 +52,9 @@ class ResetPassword extends Mailable
|
|||
return new Content(
|
||||
markdown: 'back.mails.reset-password',
|
||||
with: [
|
||||
'first_name' => $this->user->first_name,
|
||||
'last_name' => $this->user->last_name,
|
||||
'firstName' => $this->user->first_name,
|
||||
'lastName' => $this->user->last_name,
|
||||
'routeLogin' => route(config('uwil-backend.routes.name') . 'login');
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class User extends BackendUser
|
|||
{
|
||||
$url = sprintf(
|
||||
"%s?email=%s",
|
||||
url(route('back.reset-password', ['token' => $token], false)),
|
||||
url(route(config('uwil-backend.routes.name') . 'reset-password', ['token' => $token], false)),
|
||||
urlencode($this->getEmailForPasswordReset())
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ return [
|
|||
"reset_sent" => "Réinitialisation du mot de passe effectué !",
|
||||
"reset_sent_desc" => "Mot de passe mis à jour avec succès. Vous pouvez dès à présent vous connecter
|
||||
avec vos nouveaux identifiants.",
|
||||
'email_hello' => 'Bonjour !',
|
||||
'email_hello' => 'Bonjour :firstName lastName: !',
|
||||
'email_get_reset_password' => 'Vous recevez cet e-mail parce que nous avons reçu une demande de réinitialisation
|
||||
du mot de passe de votre compte.',
|
||||
'email_reset_link_expire' => 'Ce lien expirera dans :count minutes.',
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
// * Packages
|
||||
import { Link } from "@inertiajs/react";
|
||||
import { Link, usePage } from "@inertiajs/react";
|
||||
import { route } from "ziggy-js";
|
||||
// * Other
|
||||
import { useTheme } from "@/back/providers/ThemeProvider";
|
||||
import logoUwilSupportLight from "&/images/logos/uwil-support-light.svg";
|
||||
import logoUwilSupportDark from "&/images/logos/uwil-support-dark.svg";
|
||||
import logoTinyUwilSupport from "&/images/logos/uwil-support-light-icon.svg";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
type ApplicationLogoProps = {
|
||||
forceLight?: boolean;
|
||||
|
|
@ -30,13 +31,14 @@ export default function ApplicationLogo({
|
|||
forceLight = false,
|
||||
isCollapsed = false,
|
||||
}: ApplicationLogoProps) {
|
||||
const { routes } = usePage().props.appEnv as AppEnv;
|
||||
const { theme } = useTheme();
|
||||
const wrapperClasses = isCollapsed ? "h-8" : "w-full max-w-[10rem] mx-auto";
|
||||
const logo = getLogo(isCollapsed, forceLight, theme);
|
||||
|
||||
return (
|
||||
<Link
|
||||
href={route("back.dashboard.index")}
|
||||
href={route(`${routes.name}dashboard.index`)}
|
||||
className={`${wrapperClasses} rounded-md ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`}
|
||||
>
|
||||
<img
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// * Packages
|
||||
import { router } from "@inertiajs/react";
|
||||
import { router, usePage } from "@inertiajs/react";
|
||||
import { route } from "ziggy-js";
|
||||
import { LoaderCircleIcon, SendIcon } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
|
|
@ -8,8 +8,10 @@ import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithT
|
|||
import useTrans from "@/hooks/use-translations";
|
||||
import { useToast } from "@/hooks/use-toast";
|
||||
import { UserModel } from "@/back/types/global";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function BtnResetPassword({ model }: { model: UserModel }) {
|
||||
const { routes } = usePage().props.appEnv as AppEnv;
|
||||
const { toast } = useToast();
|
||||
const [isSending, setIsSending] = useState(false);
|
||||
|
||||
|
|
@ -23,7 +25,7 @@ export default function BtnResetPassword({ model }: { model: UserModel }) {
|
|||
const handleSendResetLink = () => {
|
||||
setIsSending(true);
|
||||
router.post(
|
||||
route("back.users.send-reset-password-link", model),
|
||||
route(`${routes.name}users.send-reset-password-link`, model),
|
||||
{},
|
||||
{
|
||||
onSuccess: () => {
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ import useTrans from "@/hooks/use-translations";
|
|||
import str from "@/hooks/use-string";
|
||||
import useDeviceType from "@/hooks/use-device-type";
|
||||
import { cn, GetTranslation } from "@/lib/utils";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
interface CropValidationRules {
|
||||
width: number;
|
||||
|
|
@ -94,13 +95,14 @@ export default function ImageCropper({
|
|||
url,
|
||||
finalFileName,
|
||||
}: ImageCropperProps) {
|
||||
const { routes } = usePage().props.appEnv as AppEnv;
|
||||
const { errors } = usePage().props;
|
||||
|
||||
const aspect = 1;
|
||||
const { isDesktop } = useDeviceType();
|
||||
const imgRef = useRef<HTMLImageElement | null>(null);
|
||||
|
||||
const isDuplicating = route().current("uwil-backend::back.*.duplicate");
|
||||
const isDuplicating = route().current(`${routes.name}*.duplicate`);
|
||||
|
||||
// Zone of the crop in %.
|
||||
const [cropZone, setCropZone] = useState<Crop>();
|
||||
|
|
|
|||
|
|
@ -459,7 +459,7 @@ export const ModelSelect = forwardRef<ModelSelectRef, ModelSelectProps>(
|
|||
field ?? null,
|
||||
);
|
||||
|
||||
const { locale } = usePage().props.appEnv as AppEnv;
|
||||
const { locale, routes } = usePage().props.appEnv as AppEnv;
|
||||
|
||||
/**
|
||||
* Set call ajax.
|
||||
|
|
@ -473,7 +473,7 @@ export const ModelSelect = forwardRef<ModelSelectRef, ModelSelectProps>(
|
|||
?.getAttribute("content") || "";
|
||||
|
||||
const response = await axios.post(
|
||||
route("back.model.list"),
|
||||
route(`${routes.name}model.list`),
|
||||
{
|
||||
model: targetModel,
|
||||
selectedIds: selectedValues,
|
||||
|
|
@ -1618,7 +1618,8 @@ export const ModelSelect = forwardRef<ModelSelectRef, ModelSelectProps>(
|
|||
</div>
|
||||
)}
|
||||
|
||||
{(closeButtonVisible || (emptyButtonVisible && selectedValues.length > 0)) && (
|
||||
{(closeButtonVisible ||
|
||||
(emptyButtonVisible && selectedValues.length > 0)) && (
|
||||
<CommandGroup className="border-t p-1">
|
||||
<div className="flex items-center justify-between gap-1">
|
||||
{emptyButtonVisible && selectedValues.length > 0 && (
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ type LinkProps = {
|
|||
|
||||
export default function LinkButton({ editor, disabled }: LinkProps) {
|
||||
// Current domain of the projet.
|
||||
const { url } = usePage().props.appEnv as AppEnv;
|
||||
const { url, routes } = usePage().props.appEnv as AppEnv;
|
||||
// All models from global enum.
|
||||
const enumModelsList = usePage().props.enumModelsList as LaravelEnumWithField;
|
||||
|
||||
|
|
@ -359,7 +359,7 @@ export default function LinkButton({ editor, disabled }: LinkProps) {
|
|||
setErrors((prev) => ({ ...prev, selectedEntry: "" }));
|
||||
try {
|
||||
// Get the url to access a specific model.
|
||||
const data = (await fetchOptions("back.wysiwyg.model-access", {
|
||||
const data = (await fetchOptions(`${routes.name}wysiwyg.model-access`, {
|
||||
selectedEntry: value,
|
||||
modelName: selectedEnum?.name,
|
||||
})) as ModelAccessResponse;
|
||||
|
|
@ -447,7 +447,7 @@ export default function LinkButton({ editor, disabled }: LinkProps) {
|
|||
try {
|
||||
// Retrieve data from decrypted token.
|
||||
const data = (await fetchOptions(
|
||||
"back.wysiwyg.retrieve-data-from-token",
|
||||
`${routes.name}wysiwyg.retrieve-data-from-token`,
|
||||
{
|
||||
token: modelToken,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -17,10 +17,11 @@ import CustomSidebarTrigger from "@/back/Components/CustomSidebarTrigger";
|
|||
import { Button } from "@/components/ui/button";
|
||||
import { AuthProp } from "@/back/types/global";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function AppHeader() {
|
||||
const auth = usePage().props.auth as AuthProp;
|
||||
const { user } = auth;
|
||||
const { user } = usePage().props.auth as AuthProp;
|
||||
const { routes } = usePage().props.appEnv as AppEnv;
|
||||
return (
|
||||
<header className="sticky top-0 flex flex-col justify-between items-center bg-background border-b z-20">
|
||||
<div className="sticky top-0 flex flex-row justify-between items-center w-full py-4">
|
||||
|
|
@ -43,7 +44,7 @@ export default function AppHeader() {
|
|||
<DropdownMenuItem className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link
|
||||
href={route("back.users.show", user.id)}
|
||||
href={route(`${routes.name}users.show`, user.id)}
|
||||
className="w-full"
|
||||
>
|
||||
<UserIcon />
|
||||
|
|
@ -54,7 +55,7 @@ export default function AppHeader() {
|
|||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<a href={route("back.logout")} className="w-full">
|
||||
<a href={route(`${routes.name}logout`)} className="w-full">
|
||||
<LogOutIcon />
|
||||
{useTrans("uwil-backend::back.disconnect")}
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@ import useTrans from "@/hooks/use-translations";
|
|||
import { cn } from "@/lib/utils";
|
||||
|
||||
export default function Languages(appEnv: AppEnv) {
|
||||
const { locales, locale } = appEnv;
|
||||
const { locales, locale, routes } = appEnv;
|
||||
const { post, setData } = useForm({
|
||||
lang: "system",
|
||||
});
|
||||
const transLanguage = useTrans("uwil-i18n::trans.languages");
|
||||
const submit = (e: FormEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
post(route("back.lang.set"));
|
||||
post(route(`${routes.name}lang.set`));
|
||||
};
|
||||
const languages = [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -85,10 +85,12 @@ export type NavListProps = Array<{
|
|||
*/
|
||||
export const filterActions = ({
|
||||
auth,
|
||||
appEnv,
|
||||
items,
|
||||
model,
|
||||
}: {
|
||||
auth: AuthProp;
|
||||
appEnv: AppEnv;
|
||||
items?: ReactNode[];
|
||||
model?: string;
|
||||
}): ReactNode => {
|
||||
|
|
@ -105,7 +107,10 @@ export const filterActions = ({
|
|||
auth.policies[modelCamelCase].create && (
|
||||
<DropdownMenuItem key="create" className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link href={route(`back.${model}.create`)} className="w-full">
|
||||
<Link
|
||||
href={route(`${appEnv.routes.name}${model}.create`)}
|
||||
className="w-full"
|
||||
>
|
||||
{/* eslint-disable-next-line react/jsx-pascal-case */}
|
||||
<Views.CREATION.icon />
|
||||
{transDefaultSideAction}
|
||||
|
|
@ -148,19 +153,19 @@ export default function AppSidebar() {
|
|||
show: true,
|
||||
icon: HomeIcon,
|
||||
},
|
||||
...SidebarRegistry.getAll(auth, "pages"),
|
||||
...SidebarRegistry.getAll(auth, appEnv, "pages"),
|
||||
],
|
||||
},
|
||||
{
|
||||
title: transModules,
|
||||
show: SidebarRegistry.getAll(auth, "modules").length > 0,
|
||||
links: SidebarRegistry.getAll(auth, "modules"),
|
||||
show: SidebarRegistry.getAll(auth, appEnv, "modules").length > 0,
|
||||
links: SidebarRegistry.getAll(auth, appEnv, "modules"),
|
||||
},
|
||||
{
|
||||
title: str(transAdmin).plural().value(),
|
||||
show: auth.user.role.value === isConceptor!.value,
|
||||
links: [
|
||||
...SidebarRegistry.getAll(auth, "admin"),
|
||||
...SidebarRegistry.getAll(auth, appEnv, "admin"),
|
||||
{
|
||||
title: transTelescope,
|
||||
link: route().has("telescope") ? route("telescope") : undefined,
|
||||
|
|
@ -216,8 +221,9 @@ export default function AppSidebar() {
|
|||
.filter((navLink) => navLink.show)
|
||||
.map((navLink) => {
|
||||
const isActive =
|
||||
route().current(`back.${navLink.model}.*`) ||
|
||||
navLink.activeCondition?.some(Boolean);
|
||||
route().current(
|
||||
`${appEnv.routes.name}${navLink.model}.*`,
|
||||
) || navLink.activeCondition?.some(Boolean);
|
||||
const sidebarButton = (
|
||||
<SidebarMenuButton
|
||||
className={
|
||||
|
|
@ -238,7 +244,9 @@ export default function AppSidebar() {
|
|||
</a>
|
||||
) : (
|
||||
<Link
|
||||
href={route(`back.${navLink.model}.index`)}
|
||||
href={route(
|
||||
`${appEnv.routes.name}${navLink.model}.index`,
|
||||
)}
|
||||
className="bg-transparent"
|
||||
>
|
||||
<navLink.icon />
|
||||
|
|
|
|||
|
|
@ -16,9 +16,14 @@ import str from "@/hooks/use-string";
|
|||
import { GetTranslation } from "@/lib/utils";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import Views from "@/back/lib/actions";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function SidebarLinkBrands(auth: AuthProp): SidebarGroupLink {
|
||||
export default function SidebarLinkBrands(
|
||||
auth: AuthProp,
|
||||
appEnv: AppEnv,
|
||||
): SidebarGroupLink {
|
||||
const modelName = "brands";
|
||||
const routeName = appEnv.routes.name;
|
||||
|
||||
// Translations.
|
||||
const transModel = GetTranslation(`models.classes.${modelName}`, {
|
||||
|
|
@ -41,12 +46,13 @@ export default function SidebarLinkBrands(auth: AuthProp): SidebarGroupLink {
|
|||
actions: (model: string) =>
|
||||
filterActions({
|
||||
auth,
|
||||
appEnv,
|
||||
model,
|
||||
items: [
|
||||
auth.policies.brands.create && (
|
||||
<DropdownMenuItem key="create" className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link href={route(`back.${model}.create`)} className="w-full">
|
||||
<Link href={route(`${routeName}${model}.create`)} className="w-full">
|
||||
{/* eslint-disable-next-line react/jsx-pascal-case */}
|
||||
<Views.CREATION.icon />
|
||||
{transCreate}
|
||||
|
|
@ -57,7 +63,7 @@ export default function SidebarLinkBrands(auth: AuthProp): SidebarGroupLink {
|
|||
auth.policies.brands.viewTrash && (
|
||||
<DropdownMenuItem className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link href={route(`back.${model}.trash`)} className="w-full">
|
||||
<Link href={route(`${routeName}${model}.trash`)} className="w-full">
|
||||
{/* eslint-disable-next-line react/jsx-pascal-case */}
|
||||
<Views.ARCHIVATION.icon />
|
||||
{transArchives}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,14 @@ import str from "@/hooks/use-string";
|
|||
import { GetTranslation } from "@/lib/utils";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import Views from "@/back/lib/actions";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function SidebarLinkGitlabProjects(
|
||||
auth: AuthProp,
|
||||
appEnv: AppEnv,
|
||||
): SidebarGroupLink {
|
||||
const modelName = "gitlab-projects";
|
||||
const routeName = appEnv.routes.name;
|
||||
|
||||
// Translations.
|
||||
const transModel = GetTranslation(`models.classes.${modelName}`, {
|
||||
|
|
@ -43,12 +46,13 @@ export default function SidebarLinkGitlabProjects(
|
|||
actions: (model: string) =>
|
||||
filterActions({
|
||||
auth,
|
||||
appEnv,
|
||||
model,
|
||||
items: [
|
||||
auth.policies.gitlabProjects.create && (
|
||||
<DropdownMenuItem key="create" className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link href={route(`back.${model}.create`)} className="w-full">
|
||||
<Link href={route(`${routeName}${model}.create`)} className="w-full">
|
||||
{/* eslint-disable-next-line react/jsx-pascal-case */}
|
||||
<Views.CREATION.icon />
|
||||
{transCreate}
|
||||
|
|
@ -59,7 +63,7 @@ export default function SidebarLinkGitlabProjects(
|
|||
auth.policies.gitlabProjects.viewTrash && (
|
||||
<DropdownMenuItem className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link href={route(`back.${model}.trash`)} className="w-full">
|
||||
<Link href={route(`${routeName}${model}.trash`)} className="w-full">
|
||||
{/* eslint-disable-next-line react/jsx-pascal-case */}
|
||||
<Views.ARCHIVATION.icon />
|
||||
{transArchives}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,14 @@ import str from "@/hooks/use-string";
|
|||
import { GetTranslation } from "@/lib/utils";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import Views from "@/back/lib/actions";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function SidebarLinkInvoiceCompanies(
|
||||
auth: AuthProp,
|
||||
appEnv: AppEnv,
|
||||
): SidebarGroupLink {
|
||||
const modelName = "invoice-companies";
|
||||
const routeName = appEnv.routes.name;
|
||||
|
||||
// Translations.
|
||||
const transModel = GetTranslation(`models.classes.${modelName}`, {
|
||||
|
|
@ -43,12 +46,13 @@ export default function SidebarLinkInvoiceCompanies(
|
|||
actions: (model: string) =>
|
||||
filterActions({
|
||||
auth,
|
||||
appEnv,
|
||||
model,
|
||||
items: [
|
||||
auth.policies.invoiceCompanies.create && (
|
||||
<DropdownMenuItem key="create" className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link href={route(`back.${model}.create`)} className="w-full">
|
||||
<Link href={route(`${routeName}${model}.create`)} className="w-full">
|
||||
{/* eslint-disable-next-line react/jsx-pascal-case */}
|
||||
<Views.CREATION.icon />
|
||||
{transCreate}
|
||||
|
|
@ -59,7 +63,7 @@ export default function SidebarLinkInvoiceCompanies(
|
|||
auth.policies.invoiceCompanies.viewTrash && (
|
||||
<DropdownMenuItem className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link href={route(`back.${model}.trash`)} className="w-full">
|
||||
<Link href={route(`${routeName}${model}.trash`)} className="w-full">
|
||||
{/* eslint-disable-next-line react/jsx-pascal-case */}
|
||||
<Views.ARCHIVATION.icon />
|
||||
{transArchives}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,14 @@ import str from "@/hooks/use-string";
|
|||
import { GetTranslation } from "@/lib/utils";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import Views from "@/back/lib/actions";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function SidebarLinkInvoicePackages(
|
||||
auth: AuthProp,
|
||||
appEnv: AppEnv,
|
||||
): SidebarGroupLink {
|
||||
const modelName = "invoice-packages";
|
||||
const routeName = appEnv.routes.name;
|
||||
|
||||
// Translations.
|
||||
const transModel = GetTranslation(`models.classes.${modelName}`, {
|
||||
|
|
@ -43,12 +46,13 @@ export default function SidebarLinkInvoicePackages(
|
|||
actions: (model: string) =>
|
||||
filterActions({
|
||||
auth,
|
||||
appEnv,
|
||||
model,
|
||||
items: [
|
||||
auth.policies.invoicePackages.create && (
|
||||
<DropdownMenuItem key="create" className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link href={route(`back.${model}.create`)} className="w-full">
|
||||
<Link href={route(`${routeName}${model}.create`)} className="w-full">
|
||||
{/* eslint-disable-next-line react/jsx-pascal-case */}
|
||||
<Views.CREATION.icon />
|
||||
{transCreate}
|
||||
|
|
@ -59,7 +63,7 @@ export default function SidebarLinkInvoicePackages(
|
|||
auth.policies.invoicePackages.viewTrash && (
|
||||
<DropdownMenuItem className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link href={route(`back.${model}.trash`)} className="w-full">
|
||||
<Link href={route(`${routeName}${model}.trash`)} className="w-full">
|
||||
{/* eslint-disable-next-line react/jsx-pascal-case */}
|
||||
<Views.ARCHIVATION.icon />
|
||||
{transArchives}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,14 @@ import str from "@/hooks/use-string";
|
|||
import { GetTranslation } from "@/lib/utils";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import Views from "@/back/lib/actions";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function SidebarLinkNotices(auth: AuthProp): SidebarGroupLink {
|
||||
export default function SidebarLinkNotices(
|
||||
auth: AuthProp,
|
||||
appEnv: AppEnv,
|
||||
): SidebarGroupLink {
|
||||
const modelName = "notices";
|
||||
const routeName = appEnv.routes.name;
|
||||
|
||||
// Translations.
|
||||
const transModel = GetTranslation(`models.classes.${modelName}`, {
|
||||
|
|
@ -41,12 +46,13 @@ export default function SidebarLinkNotices(auth: AuthProp): SidebarGroupLink {
|
|||
actions: (model: string) =>
|
||||
filterActions({
|
||||
auth,
|
||||
appEnv,
|
||||
model,
|
||||
items: [
|
||||
auth.policies.notices.create && (
|
||||
<DropdownMenuItem key="create" className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link href={route(`back.${model}.create`)} className="w-full">
|
||||
<Link href={route(`${routeName}${model}.create`)} className="w-full">
|
||||
{/* eslint-disable-next-line react/jsx-pascal-case */}
|
||||
<Views.CREATION.icon />
|
||||
{transCreate}
|
||||
|
|
@ -57,7 +63,7 @@ export default function SidebarLinkNotices(auth: AuthProp): SidebarGroupLink {
|
|||
auth.policies.notices.viewTrash && (
|
||||
<DropdownMenuItem className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link href={route(`back.${model}.trash`)} className="w-full">
|
||||
<Link href={route(`${routeName}${model}.trash`)} className="w-full">
|
||||
{/* eslint-disable-next-line react/jsx-pascal-case */}
|
||||
<Views.ARCHIVATION.icon />
|
||||
{transArchives}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,14 @@ import str from "@/hooks/use-string";
|
|||
import { GetTranslation } from "@/lib/utils";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import Views from "@/back/lib/actions";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function SidebarLinkSites(auth: AuthProp): SidebarGroupLink {
|
||||
export default function SidebarLinkSites(
|
||||
auth: AuthProp,
|
||||
appEnv: AppEnv,
|
||||
): SidebarGroupLink {
|
||||
const modelName = "sites";
|
||||
const routeName = appEnv.routes.name;
|
||||
|
||||
// Translations.
|
||||
const transModel = GetTranslation(`models.classes.${modelName}`, {
|
||||
|
|
@ -41,12 +46,13 @@ export default function SidebarLinkSites(auth: AuthProp): SidebarGroupLink {
|
|||
actions: (model: string) =>
|
||||
filterActions({
|
||||
auth,
|
||||
appEnv,
|
||||
model,
|
||||
items: [
|
||||
auth.policies.sites.create && (
|
||||
<DropdownMenuItem key="create" className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link href={route(`back.${model}.create`)} className="w-full">
|
||||
<Link href={route(`${routeName}${model}.create`)} className="w-full">
|
||||
{/* eslint-disable-next-line react/jsx-pascal-case */}
|
||||
<Views.CREATION.icon />
|
||||
{transCreate}
|
||||
|
|
@ -57,7 +63,7 @@ export default function SidebarLinkSites(auth: AuthProp): SidebarGroupLink {
|
|||
auth.policies.sites.viewTrash && (
|
||||
<DropdownMenuItem className="p-0">
|
||||
<Button variant="ghost" asChild>
|
||||
<Link href={route(`back.${model}.trash`)} className="w-full">
|
||||
<Link href={route(`${routeName}${model}.trash`)} className="w-full">
|
||||
{/* eslint-disable-next-line react/jsx-pascal-case */}
|
||||
<Views.ARCHIVATION.icon />
|
||||
{transArchives}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,12 @@ import { SidebarGroupLink } from "@/back/Components/Layout/Sidebar/SidebarRegist
|
|||
import { AuthProp } from "@/back/types/global";
|
||||
import str from "@/hooks/use-string";
|
||||
import { GetTranslation } from "@/lib/utils";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Users(auth: AuthProp): SidebarGroupLink {
|
||||
export default function Users(
|
||||
auth: AuthProp,
|
||||
appEnv: AppEnv,
|
||||
): SidebarGroupLink {
|
||||
const modelName = "users";
|
||||
const transUsers = GetTranslation(
|
||||
`uwil-backend::models.classes.${modelName}`,
|
||||
|
|
@ -24,7 +28,7 @@ export default function Users(auth: AuthProp): SidebarGroupLink {
|
|||
model: modelName,
|
||||
icon: UsersIcon,
|
||||
show: auth.policies.users.viewAny,
|
||||
actions: (model: string) => filterActions({ auth, model }),
|
||||
actions: (model: string) => filterActions({ auth, appEnv, model }),
|
||||
};
|
||||
|
||||
return { link, group: "admin" };
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { NavListLinksProps } from "@/back/Components/Layout/Sidebar/AppSidebar";
|
||||
import { AuthProp } from "@/back/types/global";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export type SidebarGroupType = "pages" | "admin" | "modules";
|
||||
|
||||
|
|
@ -9,7 +10,7 @@ export type SidebarGroupLink = {
|
|||
};
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
type LinkResolver = (auth: AuthProp) => SidebarGroupLink;
|
||||
export type LinkResolver = (auth: AuthProp, appEnv: AppEnv) => SidebarGroupLink;
|
||||
|
||||
export class SidebarRegistry {
|
||||
private static resolvers: LinkResolver[] = [];
|
||||
|
|
@ -18,9 +19,13 @@ export class SidebarRegistry {
|
|||
this.resolvers.push(resolver);
|
||||
}
|
||||
|
||||
static getAll(auth: AuthProp, group: SidebarGroupType): NavListLinksProps[] {
|
||||
static getAll(
|
||||
auth: AuthProp,
|
||||
appEnv: AppEnv,
|
||||
group: SidebarGroupType,
|
||||
): NavListLinksProps[] {
|
||||
return this.resolvers
|
||||
.map((resolver) => resolver(auth))
|
||||
.map((resolver) => resolver(auth, appEnv))
|
||||
.filter((sidebarGroupLink) => sidebarGroupLink.group === group)
|
||||
.sort((a, b) =>
|
||||
a.link.title.localeCompare(b.link.title, undefined, {
|
||||
|
|
@ -39,7 +44,7 @@ const modules = import.meta.glob("./Links/*.tsx", {
|
|||
string,
|
||||
{
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
default: (auth: AuthProp) => SidebarGroupLink;
|
||||
default: (auth: AuthProp, appEnv: AppEnv) => SidebarGroupLink;
|
||||
}
|
||||
>;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// * Packages
|
||||
import { Link, useForm } from "@inertiajs/react";
|
||||
import { Link, useForm, usePage } from "@inertiajs/react";
|
||||
import { route } from "ziggy-js";
|
||||
import { FormEvent, ReactNode, useState } from "react";
|
||||
import { MoreHorizontalIcon } from "lucide-react";
|
||||
|
|
@ -31,6 +31,7 @@ import str from "@/hooks/use-string";
|
|||
import { DefaultModel, Views as ViewsType } from "@/back/types/global";
|
||||
import Views from "@/back/lib/actions";
|
||||
import { ToastActionElement, ToastProps } from "@/components/ui/toast";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
interface Translations {
|
||||
successfulArchivation: string;
|
||||
|
|
@ -65,15 +66,17 @@ function GetAction({
|
|||
action,
|
||||
modelRoute,
|
||||
model,
|
||||
routes,
|
||||
}: {
|
||||
action: ViewsType[number];
|
||||
modelRoute: string;
|
||||
model: DefaultModel;
|
||||
routes: AppEnv["routes"];
|
||||
}) {
|
||||
return (
|
||||
<Button asChild variant="ghost" className="w-full">
|
||||
<Link
|
||||
href={route(`back.${modelRoute}.${action.value}`, model.id)}
|
||||
href={route(`${routes.name}${modelRoute}.${action.value}`, model.id)}
|
||||
className="w-full"
|
||||
>
|
||||
<action.icon />
|
||||
|
|
@ -99,6 +102,7 @@ const actionOnModel = (
|
|||
/* eslint-disable no-unused-vars */
|
||||
event: FormEvent<HTMLFormElement>,
|
||||
action: ViewsType[number],
|
||||
nameRoute: string,
|
||||
modelRoute: string,
|
||||
model: DefaultModel,
|
||||
setOpen: (value: boolean) => void,
|
||||
|
|
@ -114,7 +118,10 @@ const actionOnModel = (
|
|||
) => {
|
||||
event.preventDefault();
|
||||
|
||||
const routeAction = route(`back.${modelRoute}.${action.value}`, model.id);
|
||||
const routeAction = route(
|
||||
`${nameRoute}${modelRoute}.${action.value}`,
|
||||
model.id,
|
||||
);
|
||||
|
||||
// All post actions mapping.
|
||||
const actionMap: Record<
|
||||
|
|
@ -198,6 +205,7 @@ function PostAction({
|
|||
setOpen: (value: boolean) => void;
|
||||
}) {
|
||||
const { delete: destroy, patch } = useForm();
|
||||
const { name: nameRoute } = (usePage().props.appEnv as AppEnv).routes;
|
||||
|
||||
const isRestoreAction = action.label === Views.RESTORATION.label;
|
||||
const isArchiveAction = action.label === Views.ARCHIVATION.label;
|
||||
|
|
@ -290,6 +298,7 @@ function PostAction({
|
|||
actionOnModel(
|
||||
event,
|
||||
action,
|
||||
nameRoute,
|
||||
modelRoute,
|
||||
model,
|
||||
setOpen,
|
||||
|
|
@ -328,6 +337,7 @@ export default function ModelActions({
|
|||
inDialog = false,
|
||||
message = "uwil-backend::back.model_action_updated_at",
|
||||
}: ModelActionsProps) {
|
||||
const { routes } = usePage().props.appEnv as AppEnv;
|
||||
const [open, setOpen] = useState(false);
|
||||
const messageTrans = useTrans(message);
|
||||
const formattedDate = useFormatedDate(modelUpdatedAt);
|
||||
|
|
@ -363,7 +373,12 @@ export default function ModelActions({
|
|||
/>
|
||||
</>
|
||||
) : (
|
||||
<GetAction action={action} model={model} modelRoute={modelRoute} />
|
||||
<GetAction
|
||||
action={action}
|
||||
model={model}
|
||||
modelRoute={modelRoute}
|
||||
routes={routes}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import str from "@/hooks/use-string";
|
|||
import useTrans from "@/hooks/use-translations";
|
||||
import { Row } from "@tanstack/react-table";
|
||||
import { usePage } from "@inertiajs/react";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
type ActivityLogsEventEnumProps = Record<
|
||||
string,
|
||||
|
|
@ -29,7 +30,7 @@ type ActivityLogsIndexProps = {
|
|||
activityLogsEventEnum: ActivityLogsEventEnumProps;
|
||||
};
|
||||
|
||||
const getColumns = (activityLogsEventEnum: ActivityLogsEventEnumProps) => {
|
||||
const getColumns = (routeName: string, activityLogsEventEnum: ActivityLogsEventEnumProps) => {
|
||||
return [
|
||||
{
|
||||
accessorKey: "event",
|
||||
|
|
@ -88,7 +89,7 @@ const getColumns = (activityLogsEventEnum: ActivityLogsEventEnumProps) => {
|
|||
if (user) {
|
||||
return (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route("back.users.show", {
|
||||
link={route(`${routeName}users.show`, {
|
||||
user: userId,
|
||||
})}
|
||||
content={
|
||||
|
|
@ -149,7 +150,7 @@ const getColumns = (activityLogsEventEnum: ActivityLogsEventEnumProps) => {
|
|||
if (event !== activityLogsEventEnum.deleted.value) {
|
||||
return (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${str(model).plural().value()}.show`, modelId)}
|
||||
link={route(`${routeName}${str(model).plural().value()}.show`, modelId)}
|
||||
content={
|
||||
<>
|
||||
<FileTextIcon />
|
||||
|
|
@ -202,9 +203,11 @@ export default function Index({
|
|||
searchFields,
|
||||
activityLogsEventEnum,
|
||||
}: ActivityLogsIndexProps) {
|
||||
const actionModels = [Views.VISUALIZATION];
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const modelName = usePage().props.modelName as string;
|
||||
const columns = getColumns(activityLogsEventEnum);
|
||||
const columns = getColumns(routeName, activityLogsEventEnum);
|
||||
const actionModels = [Views.VISUALIZATION];
|
||||
|
||||
return (
|
||||
<AuthenticatedLayout
|
||||
title={str(
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import { ActivityLogModel } from "@/back/types/activity-logs";
|
|||
import str from "@/hooks/use-string";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import { GetFormatedDate, GetTranslation } from "@/lib/utils";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
type ActivityLogsEventEnumProps = Record<
|
||||
string,
|
||||
|
|
@ -26,6 +27,7 @@ type ActivityLogsShowProps = {
|
|||
};
|
||||
|
||||
const getColumns = (
|
||||
routeName: string,
|
||||
activityLogModel: ActivityLogModel,
|
||||
activityLogsEventEnum: ActivityLogsEventEnumProps,
|
||||
) => {
|
||||
|
|
@ -69,7 +71,7 @@ const getColumns = (
|
|||
if (value && activityLogModel.user)
|
||||
return (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route("back.users.show", { user: value })}
|
||||
link={route(`${routeName}users.show`, { user: value })}
|
||||
content={
|
||||
<>
|
||||
<UserIcon />
|
||||
|
|
@ -113,7 +115,7 @@ const getColumns = (
|
|||
return activityLogModel.event !==
|
||||
activityLogsEventEnum.deleted.value ? (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${model}.show`, activityLogModel.model_id)}
|
||||
link={route(`${routeName}${model}.show`, activityLogModel.model_id)}
|
||||
content={
|
||||
<>
|
||||
<UserIcon />
|
||||
|
|
@ -182,20 +184,21 @@ export default function Show({
|
|||
data,
|
||||
activityLogsEventEnum,
|
||||
}: ActivityLogsShowProps) {
|
||||
const { auth } = usePage().props as unknown as {
|
||||
const { auth, appEnv } = usePage().props as unknown as {
|
||||
auth: AuthProp;
|
||||
appEnv: AppEnv;
|
||||
};
|
||||
const { viewAny } = auth.policies.activityLogs;
|
||||
const modelName = usePage().props.modelName as string;
|
||||
const activityLogModel = data.data as ActivityLogModel;
|
||||
const columns = getColumns(activityLogModel, activityLogsEventEnum);
|
||||
const columns = getColumns(appEnv.routes.name, activityLogModel, activityLogsEventEnum);
|
||||
const transBackToList = useTrans("uwil-backend::back.crud_back_to_list");
|
||||
const beforeNode = () => {
|
||||
return (
|
||||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${appEnv.routes.name}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// * Packages.
|
||||
import { Head, Link, useForm } from "@inertiajs/react";
|
||||
import { Head, Link, useForm, usePage } from "@inertiajs/react";
|
||||
import { route } from "ziggy-js";
|
||||
import { LoaderCircleIcon, MoveLeftIcon, SendIcon } from "lucide-react";
|
||||
import { SubmitEvent } from "react";
|
||||
|
|
@ -16,8 +16,11 @@ import GuestLayout from "@/back/Layouts/GuestLayout";
|
|||
import SimpleString from "@/back/Components/Inputs/SimpleString";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import { toast } from "@/hooks/use-toast";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function ForgotPassword() {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
|
||||
const { post, setData, data, processing } = useForm({
|
||||
email: "",
|
||||
});
|
||||
|
|
@ -29,7 +32,7 @@ export default function ForgotPassword() {
|
|||
|
||||
const submit = (event: SubmitEvent) => {
|
||||
event.preventDefault();
|
||||
post(route("back.forgot-password.post"), {
|
||||
post(route(`${routeName}forgot-password.post`), {
|
||||
onSuccess: () => {
|
||||
toast({
|
||||
title: mailSent,
|
||||
|
|
@ -65,7 +68,7 @@ export default function ForgotPassword() {
|
|||
/>
|
||||
<div className="flex flex-row items-center justify-between gap-y-3">
|
||||
<Link
|
||||
href={route("back.login")}
|
||||
href={route(`${routeName}login`)}
|
||||
className="flex justify-center items-center gap-1 rounded-md text-sm text-gray-600 underline hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2"
|
||||
>
|
||||
<MoveLeftIcon size={15} />
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import { toast } from "@/hooks/use-toast";
|
|||
import SimpleSwitch from "@/back/Components/Inputs/SimpleSwitch";
|
||||
|
||||
export default function Login() {
|
||||
const appName = (usePage().props.appEnv as AppEnv).name;
|
||||
const appEnv = (usePage().props.appEnv as AppEnv);
|
||||
|
||||
/** Translations. */
|
||||
const transConnected = useTrans("auth.connected");
|
||||
|
|
@ -35,7 +35,7 @@ export default function Login() {
|
|||
|
||||
const submit = (event: SubmitEvent) => {
|
||||
event.preventDefault();
|
||||
post(route("back.login.post"), {
|
||||
post(route(`${appEnv.routes.name}login.post`), {
|
||||
onSuccess: () => {
|
||||
toast({
|
||||
title: transConnected,
|
||||
|
|
@ -57,7 +57,7 @@ export default function Login() {
|
|||
<CardDescription
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: useTrans("auth.description", {
|
||||
params: { appName: String(appName) },
|
||||
params: { appName: String(appEnv.name) },
|
||||
}),
|
||||
}}
|
||||
/>
|
||||
|
|
@ -104,7 +104,7 @@ export default function Login() {
|
|||
</div>
|
||||
<div className="flex flex-row items-center justify-between gap-y-3">
|
||||
<Link
|
||||
href={route("back.forgot-password")}
|
||||
href={route(`${appEnv.routes.name}forgot-password`)}
|
||||
className="flex justify-center items-center gap-1 rounded-md text-sm text-gray-600 underline hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2"
|
||||
>
|
||||
{useTrans("auth.forgot_password")}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// * Packages.
|
||||
import { SubmitEvent } from "react";
|
||||
import { Head, useForm } from "@inertiajs/react";
|
||||
import { Head, useForm, usePage } from "@inertiajs/react";
|
||||
import { route } from "ziggy-js";
|
||||
import { LoaderCircleIcon, ShieldCheckIcon } from "lucide-react";
|
||||
// * Components shadcn.
|
||||
|
|
@ -16,6 +16,7 @@ import GuestLayout from "@/back/Layouts/GuestLayout";
|
|||
import SimpleString from "@/back/Components/Inputs/SimpleString";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import { toast } from "@/hooks/use-toast";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
type ResetPasswordProps = {
|
||||
token: string;
|
||||
|
|
@ -23,6 +24,8 @@ type ResetPasswordProps = {
|
|||
};
|
||||
|
||||
export default function ResetPassword({ token, email }: ResetPasswordProps) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
|
||||
const resetSent = useTrans("auth.reset_sent");
|
||||
const resetSentDesc = useTrans("auth.reset_sent_desc");
|
||||
const errorTitle = useTrans("auth.reset_failed");
|
||||
|
|
@ -36,7 +39,7 @@ export default function ResetPassword({ token, email }: ResetPasswordProps) {
|
|||
|
||||
const submit = (event: SubmitEvent) => {
|
||||
event.preventDefault();
|
||||
post(route("back.reset-password.post"), {
|
||||
post(route(`${routeName}reset-password.post`), {
|
||||
onSuccess: () => {
|
||||
toast({
|
||||
title: resetSent,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import useTrans from "@/hooks/use-translations";
|
|||
import { Actions, Methods } from "@/back/lib/enums";
|
||||
import { AuthProp, SingleResource } from "@/back/types/global";
|
||||
import { BrandModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Create({
|
||||
data,
|
||||
|
|
@ -18,13 +19,14 @@ export default function Create({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies.brands;
|
||||
const model = data.data as BrandModel;
|
||||
|
||||
// Translations.
|
||||
const transBackToList = useTrans("uwil-backend::back.crud_back_to_list");
|
||||
const transTitle = useTrans(
|
||||
route().current(`back.${modelName}.duplicate`)
|
||||
route().current(`${routeName}${modelName}.duplicate`)
|
||||
? "uwil-backend::crud.helpers.duplication_model"
|
||||
: "uwil-backend::crud.helpers.creation_model",
|
||||
{
|
||||
|
|
@ -41,7 +43,7 @@ export default function Create({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { Actions, Methods } from "@/back/lib/enums";
|
|||
import { Views } from "@/back/lib/actions";
|
||||
import { AuthProp, SingleResource } from "@/back/types/global";
|
||||
import { BrandModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Edit({
|
||||
data,
|
||||
|
|
@ -20,6 +21,7 @@ export default function Edit({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies.brands;
|
||||
const model = data.data as BrandModel;
|
||||
const actionModels = [
|
||||
|
|
@ -43,7 +45,7 @@ export default function Edit({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import str from "@/hooks/use-string";
|
|||
import useTrans from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { BrandModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
const getColumns = () => {
|
||||
return [
|
||||
|
|
@ -66,11 +67,13 @@ export default function Index({
|
|||
searchFields: string;
|
||||
modelName: string;
|
||||
}) {
|
||||
const { auth } = usePage().props as unknown as {
|
||||
const { auth, appEnv } = usePage().props as unknown as {
|
||||
auth: AuthProp;
|
||||
appEnv: AppEnv;
|
||||
};
|
||||
const { viewAny, viewTrash, create } = auth.policies.brands;
|
||||
const isArchiveRoute = route().current(`back.${modelName}.trash`);
|
||||
const routeName = appEnv.routes.name;
|
||||
const isArchiveRoute = route().current(`${routeName}${modelName}.trash`);
|
||||
const actionModels = isArchiveRoute
|
||||
? [Views.RESTORATION, Views.FORCEDELETION]
|
||||
: [
|
||||
|
|
@ -100,7 +103,7 @@ export default function Index({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackList}</p>}
|
||||
/>
|
||||
|
|
@ -120,7 +123,7 @@ export default function Index({
|
|||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
{viewTrash && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.trash`)}
|
||||
link={route(`${routeName}${modelName}.trash`)}
|
||||
content={<ArchiveIcon />}
|
||||
tooltipContent={<p>{transAccessTo}</p>}
|
||||
variant="outline"
|
||||
|
|
@ -128,7 +131,7 @@ export default function Index({
|
|||
)}
|
||||
{create && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.create`)}
|
||||
link={route(`${routeName}${modelName}.create`)}
|
||||
content={<PlusIcon />}
|
||||
tooltipContent={<p>{transCrudAddEntry}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ const getColumns = (appEnv: AppEnv, viewAnySites: boolean) => {
|
|||
if (viewAnySites && siteModel.deleted_at === null) {
|
||||
content = (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route("back.sites.show", siteModel)}
|
||||
link={route(`${appEnv.routes.name}sites.show`, siteModel)}
|
||||
content={
|
||||
<>
|
||||
<GlobeIcon />
|
||||
|
|
@ -92,12 +92,9 @@ const getColumns = (appEnv: AppEnv, viewAnySites: boolean) => {
|
|||
<p>
|
||||
{GetTranslation("uwil-backend::back.access_model", {
|
||||
params: {
|
||||
model: GetTranslation(
|
||||
"models.classes.sites",
|
||||
{
|
||||
choice: 1,
|
||||
},
|
||||
),
|
||||
model: GetTranslation("models.classes.sites", {
|
||||
choice: 1,
|
||||
}),
|
||||
},
|
||||
})}
|
||||
</p>
|
||||
|
|
@ -195,7 +192,7 @@ export default function Show({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${appEnv.routes.name}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// * Packages
|
||||
import { route } from "ziggy-js";
|
||||
import { Head, Link } from "@inertiajs/react";
|
||||
import { Head, Link, usePage } from "@inertiajs/react";
|
||||
// * Components shadcn
|
||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
|
@ -9,8 +9,11 @@ import { ThemeProvider } from "@/back/providers/ThemeProvider";
|
|||
import AppFooter from "@/back/Components/Layout/AppFooter";
|
||||
import ApplicationLogo from "@/back/Components/ApplicationLogo";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import { AppEnv } from "@/types/global";
|
||||
import { GetTranslation } from "@/lib/utils";
|
||||
|
||||
export default function Default({ status }: { status: number }) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
return (
|
||||
<ThemeProvider defaultTheme="light" storageKey="vite-ui-theme">
|
||||
<TooltipProvider>
|
||||
|
|
@ -26,10 +29,17 @@ export default function Default({ status }: { status: number }) {
|
|||
</p>
|
||||
<div className="flex flex-col sm:flex-row items-center justify-center gap-4">
|
||||
<Button asChild>
|
||||
<Link href={route("back.dashboard.index")}>
|
||||
<Link href={route(`${routeName}dashboard.index`)}>
|
||||
{useTrans("uwil-backend::back.dashboard")}
|
||||
</Link>
|
||||
</Button>
|
||||
{route(`${routeName}dashboard.index`) !== "/" && (
|
||||
<Button variant="outline" asChild>
|
||||
<a href="/">
|
||||
{GetTranslation("uwil-backend::back.your_website")}
|
||||
</a>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<AppFooter />
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import useTrans from "@/hooks/use-translations";
|
|||
import { Actions, Methods } from "@/back/lib/enums";
|
||||
import { AuthProp, SingleResource } from "@/back/types/global";
|
||||
import { GitlabProjectModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Create({
|
||||
data,
|
||||
|
|
@ -18,6 +19,7 @@ export default function Create({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies
|
||||
.gitlabProjects;
|
||||
const model = data.data as GitlabProjectModel;
|
||||
|
|
@ -25,7 +27,7 @@ export default function Create({
|
|||
// Translations.
|
||||
const transBackToList = useTrans("uwil-backend::back.crud_back_to_list");
|
||||
const transTitle = useTrans(
|
||||
route().current(`back.${modelName}.duplicate`)
|
||||
route().current(`${routeName}${modelName}.duplicate`)
|
||||
? "uwil-backend::crud.helpers.duplication_model"
|
||||
: "uwil-backend::crud.helpers.creation_model",
|
||||
{
|
||||
|
|
@ -42,7 +44,7 @@ export default function Create({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { Actions, Methods } from "@/back/lib/enums";
|
|||
import { Views } from "@/back/lib/actions";
|
||||
import { AuthProp, SingleResource } from "@/back/types/global";
|
||||
import { GitlabProjectModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Edit({
|
||||
data,
|
||||
|
|
@ -20,6 +21,7 @@ export default function Edit({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies
|
||||
.gitlabProjects;
|
||||
const model = data.data as GitlabProjectModel;
|
||||
|
|
@ -44,7 +46,7 @@ export default function Edit({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import str from "@/hooks/use-string";
|
|||
import useTrans from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { GitlabProjectModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
const getColumns = () => {
|
||||
return [
|
||||
|
|
@ -97,11 +98,13 @@ export default function Index({
|
|||
searchFields: string;
|
||||
modelName: string;
|
||||
}) {
|
||||
const { auth } = usePage().props as unknown as {
|
||||
const { auth, appEnv } = usePage().props as unknown as {
|
||||
auth: AuthProp;
|
||||
appEnv: AppEnv;
|
||||
};
|
||||
const { viewAny, viewTrash, create } = auth.policies.gitlabProjects;
|
||||
const isArchiveRoute = route().current(`back.${modelName}.trash`);
|
||||
const routeName = appEnv.routes.name;
|
||||
const isArchiveRoute = route().current(`${routeName}${modelName}.trash`);
|
||||
const actionModels = isArchiveRoute
|
||||
? [Views.RESTORATION, Views.FORCEDELETION]
|
||||
: [
|
||||
|
|
@ -131,7 +134,7 @@ export default function Index({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackList}</p>}
|
||||
/>
|
||||
|
|
@ -151,7 +154,7 @@ export default function Index({
|
|||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
{viewTrash && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.trash`)}
|
||||
link={route(`${routeName}${modelName}.trash`)}
|
||||
content={<ArchiveIcon />}
|
||||
tooltipContent={<p>{transAccessTo}</p>}
|
||||
variant="outline"
|
||||
|
|
@ -159,7 +162,7 @@ export default function Index({
|
|||
)}
|
||||
{create && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.create`)}
|
||||
link={route(`${routeName}${modelName}.create`)}
|
||||
content={<PlusIcon />}
|
||||
tooltipContent={<p>{transCrudAddEntry}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import useTrans from "@/hooks/use-translations";
|
|||
import { TranslationField } from "@/back/types/i18n";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { GitlabProjectModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
const getColumns = () => {
|
||||
return [
|
||||
|
|
@ -101,8 +102,9 @@ export default function Show({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const { auth } = usePage().props as unknown as {
|
||||
const { auth, appEnv } = usePage().props as unknown as {
|
||||
auth: AuthProp;
|
||||
appEnv: AppEnv;
|
||||
};
|
||||
const { viewAny } = auth.policies.gitlabProjects;
|
||||
const model = data.data as GitlabProjectModel;
|
||||
|
|
@ -127,7 +129,7 @@ export default function Show({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${appEnv.routes.name}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import useTrans from "@/hooks/use-translations";
|
|||
import { Actions, Methods } from "@/back/lib/enums";
|
||||
import { AuthProp, SingleResource } from "@/back/types/global";
|
||||
import { InvoiceCompanyModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Create({
|
||||
data,
|
||||
|
|
@ -18,6 +19,7 @@ export default function Create({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies
|
||||
.invoiceCompanies;
|
||||
const model = data.data as InvoiceCompanyModel;
|
||||
|
|
@ -25,7 +27,7 @@ export default function Create({
|
|||
// Translations.
|
||||
const transBackToList = useTrans("uwil-backend::back.crud_back_to_list");
|
||||
const transTitle = useTrans(
|
||||
route().current(`back.${modelName}.duplicate`)
|
||||
route().current(`${routeName}${modelName}.duplicate`)
|
||||
? "uwil-backend::crud.helpers.duplication_model"
|
||||
: "uwil-backend::crud.helpers.creation_model",
|
||||
{
|
||||
|
|
@ -42,7 +44,7 @@ export default function Create({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { Actions, Methods } from "@/back/lib/enums";
|
|||
import { Views } from "@/back/lib/actions";
|
||||
import { AuthProp, SingleResource } from "@/back/types/global";
|
||||
import { InvoiceCompanyModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Edit({
|
||||
data,
|
||||
|
|
@ -20,6 +21,7 @@ export default function Edit({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies
|
||||
.invoiceCompanies;
|
||||
const model = data.data as InvoiceCompanyModel;
|
||||
|
|
@ -44,7 +46,7 @@ export default function Edit({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import str from "@/hooks/use-string";
|
|||
import useTrans from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { InvoicePackageModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
const getColumns = () => {
|
||||
return [
|
||||
|
|
@ -66,11 +67,13 @@ export default function Index({
|
|||
searchFields: string;
|
||||
modelName: string;
|
||||
}) {
|
||||
const { auth } = usePage().props as unknown as {
|
||||
const { auth, appEnv } = usePage().props as unknown as {
|
||||
auth: AuthProp;
|
||||
appEnv: AppEnv;
|
||||
};
|
||||
const { viewAny, viewTrash, create } = auth.policies.invoiceCompanies;
|
||||
const isArchiveRoute = route().current(`back.${modelName}.trash`);
|
||||
const routeName = appEnv.routes.name;
|
||||
const isArchiveRoute = route().current(`${routeName}${modelName}.trash`);
|
||||
const actionModels = isArchiveRoute
|
||||
? [Views.RESTORATION, Views.FORCEDELETION]
|
||||
: [
|
||||
|
|
@ -100,7 +103,7 @@ export default function Index({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackList}</p>}
|
||||
/>
|
||||
|
|
@ -120,7 +123,7 @@ export default function Index({
|
|||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
{viewTrash && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.trash`)}
|
||||
link={route(`${routeName}${modelName}.trash`)}
|
||||
content={<ArchiveIcon />}
|
||||
tooltipContent={<p>{transAccessTo}</p>}
|
||||
variant="outline"
|
||||
|
|
@ -128,7 +131,7 @@ export default function Index({
|
|||
)}
|
||||
{create && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.create`)}
|
||||
link={route(`${routeName}${modelName}.create`)}
|
||||
content={<PlusIcon />}
|
||||
tooltipContent={<p>{transCrudAddEntry}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import str from "@/hooks/use-string";
|
|||
import useTrans from "@/hooks/use-translations";
|
||||
import { TranslationField } from "@/back/types/i18n";
|
||||
import { InvoiceCompanyModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
const getColumns = () => {
|
||||
return [
|
||||
|
|
@ -70,8 +71,9 @@ export default function Show({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const { auth } = usePage().props as unknown as {
|
||||
const { auth, appEnv } = usePage().props as unknown as {
|
||||
auth: AuthProp;
|
||||
appEnv: AppEnv;
|
||||
};
|
||||
const { viewAny } = auth.policies.invoiceCompanies;
|
||||
const model = data.data as InvoiceCompanyModel;
|
||||
|
|
@ -96,7 +98,7 @@ export default function Show({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${appEnv.routes.name}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import useTrans from "@/hooks/use-translations";
|
|||
import { Actions, Methods } from "@/back/lib/enums";
|
||||
import { AuthProp, SingleResource } from "@/back/types/global";
|
||||
import { InvoicePackageModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Create({
|
||||
data,
|
||||
|
|
@ -18,6 +19,7 @@ export default function Create({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies
|
||||
.invoicePackages;
|
||||
const model = data.data as InvoicePackageModel;
|
||||
|
|
@ -25,7 +27,7 @@ export default function Create({
|
|||
// Translations.
|
||||
const transBackToList = useTrans("uwil-backend::back.crud_back_to_list");
|
||||
const transTitle = useTrans(
|
||||
route().current(`back.${modelName}.duplicate`)
|
||||
route().current(`${routeName}${modelName}.duplicate`)
|
||||
? "uwil-backend::crud.helpers.duplication_model"
|
||||
: "uwil-backend::crud.helpers.creation_model",
|
||||
{
|
||||
|
|
@ -42,7 +44,7 @@ export default function Create({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { Actions, Methods } from "@/back/lib/enums";
|
|||
import { Views } from "@/back/lib/actions";
|
||||
import { AuthProp, SingleResource } from "@/back/types/global";
|
||||
import { InvoicePackageModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Edit({
|
||||
data,
|
||||
|
|
@ -20,6 +21,7 @@ export default function Edit({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies
|
||||
.invoicePackages;
|
||||
const model = data.data as InvoicePackageModel;
|
||||
|
|
@ -44,7 +46,7 @@ export default function Edit({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import { AuthProp, Resource } from "@/back/types/global";
|
|||
import str from "@/hooks/use-string";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import { InvoicePackageModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
const getColumns = () => {
|
||||
return [
|
||||
|
|
@ -123,11 +124,13 @@ export default function Index({
|
|||
searchFields: string;
|
||||
modelName: string;
|
||||
}) {
|
||||
const { auth } = usePage().props as unknown as {
|
||||
const { auth, appEnv } = usePage().props as unknown as {
|
||||
auth: AuthProp;
|
||||
appEnv: AppEnv;
|
||||
};
|
||||
const { viewAny, viewTrash, create } = auth.policies.invoicePackages;
|
||||
const isArchiveRoute = route().current(`back.${modelName}.trash`);
|
||||
const routeName = appEnv.routes.name;
|
||||
const isArchiveRoute = route().current(`${routeName}${modelName}.trash`);
|
||||
const actionModels = isArchiveRoute
|
||||
? [Views.RESTORATION, Views.FORCEDELETION]
|
||||
: [
|
||||
|
|
@ -157,7 +160,7 @@ export default function Index({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackList}</p>}
|
||||
/>
|
||||
|
|
@ -177,7 +180,7 @@ export default function Index({
|
|||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
{viewTrash && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.trash`)}
|
||||
link={route(`${routeName}${modelName}.trash`)}
|
||||
content={<ArchiveIcon />}
|
||||
tooltipContent={<p>{transAccessTo}</p>}
|
||||
variant="outline"
|
||||
|
|
@ -185,7 +188,7 @@ export default function Index({
|
|||
)}
|
||||
{create && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.create`)}
|
||||
link={route(`${routeName}${modelName}.create`)}
|
||||
content={<PlusIcon />}
|
||||
tooltipContent={<p>{transCrudAddEntry}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import str from "@/hooks/use-string";
|
|||
import useTrans from "@/hooks/use-translations";
|
||||
import { TranslationField } from "@/back/types/i18n";
|
||||
import { InvoicePackageModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
const getColumns = () => {
|
||||
return [
|
||||
|
|
@ -104,8 +105,9 @@ export default function Show({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const { auth } = usePage().props as unknown as {
|
||||
const { auth, appEnv } = usePage().props as unknown as {
|
||||
auth: AuthProp;
|
||||
appEnv: AppEnv;
|
||||
};
|
||||
const { viewAny } = auth.policies.invoicePackages;
|
||||
const model = data.data as InvoicePackageModel;
|
||||
|
|
@ -130,7 +132,7 @@ export default function Show({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${appEnv.routes.name}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import useTrans from "@/hooks/use-translations";
|
|||
import { Actions, Methods } from "@/back/lib/enums";
|
||||
import { AuthProp, SingleResource } from "@/back/types/global";
|
||||
import { NoticeModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Create({
|
||||
data,
|
||||
|
|
@ -18,13 +19,14 @@ export default function Create({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies.notices;
|
||||
const model = data.data as NoticeModel;
|
||||
|
||||
// Translations.
|
||||
const transBackToList = useTrans("uwil-backend::back.crud_back_to_list");
|
||||
const transTitle = useTrans(
|
||||
route().current(`back.${modelName}.duplicate`)
|
||||
route().current(`${routeName}${modelName}.duplicate`)
|
||||
? "uwil-backend::crud.helpers.duplication_model"
|
||||
: "uwil-backend::crud.helpers.creation_model",
|
||||
{
|
||||
|
|
@ -41,7 +43,7 @@ export default function Create({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { Actions, Methods } from "@/back/lib/enums";
|
|||
import { Views } from "@/back/lib/actions";
|
||||
import { AuthProp, SingleResource } from "@/back/types/global";
|
||||
import { NoticeModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Edit({
|
||||
data,
|
||||
|
|
@ -20,6 +21,7 @@ export default function Edit({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies.notices;
|
||||
const model = data.data as NoticeModel;
|
||||
const actionModels = [
|
||||
|
|
@ -43,7 +45,7 @@ export default function Edit({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import str from "@/hooks/use-string";
|
|||
import useTrans from "@/hooks/use-translations";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { NoticeModel } from "@/back/types/project";
|
||||
import { LaravelEnum } from "@/types/global";
|
||||
import { AppEnv, LaravelEnum } from "@/types/global";
|
||||
|
||||
const getColumns = (noticeTypeEnum: LaravelEnum) => {
|
||||
return [
|
||||
|
|
@ -105,12 +105,14 @@ export default function Index({
|
|||
searchFields: string;
|
||||
modelName: string;
|
||||
}) {
|
||||
const { auth, noticeTypeEnum } = usePage().props as unknown as {
|
||||
const { auth, appEnv, noticeTypeEnum } = usePage().props as unknown as {
|
||||
auth: AuthProp;
|
||||
appEnv: AppEnv;
|
||||
noticeTypeEnum: LaravelEnum;
|
||||
};
|
||||
const { viewAny, viewTrash, create } = auth.policies.notices;
|
||||
const isArchiveRoute = route().current(`back.${modelName}.trash`);
|
||||
const routeName = appEnv.routes.name;
|
||||
const isArchiveRoute = route().current(`${routeName}${modelName}.trash`);
|
||||
const actionModels = isArchiveRoute
|
||||
? [Views.RESTORATION, Views.FORCEDELETION]
|
||||
: [
|
||||
|
|
@ -140,7 +142,7 @@ export default function Index({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackList}</p>}
|
||||
/>
|
||||
|
|
@ -160,7 +162,7 @@ export default function Index({
|
|||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
{viewTrash && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.trash`)}
|
||||
link={route(`${routeName}${modelName}.trash`)}
|
||||
content={<ArchiveIcon />}
|
||||
tooltipContent={<p>{transAccessTo}</p>}
|
||||
variant="outline"
|
||||
|
|
@ -168,7 +170,7 @@ export default function Index({
|
|||
)}
|
||||
{create && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.create`)}
|
||||
link={route(`${routeName}${modelName}.create`)}
|
||||
content={<PlusIcon />}
|
||||
tooltipContent={<p>{transCrudAddEntry}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import { Views } from "@/back/lib/actions";
|
|||
import { AuthProp, SingleResource } from "@/back/types/global";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import { LaravelEnum } from "@/types/global";
|
||||
import { AppEnv, LaravelEnum } from "@/types/global";
|
||||
import { TranslationField } from "@/back/types/i18n";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { NoticeModel } from "@/back/types/project";
|
||||
|
|
@ -96,8 +96,9 @@ export default function Show({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const { auth, noticeTypeEnum } = usePage().props as unknown as {
|
||||
const { auth, appEnv, noticeTypeEnum } = usePage().props as unknown as {
|
||||
auth: AuthProp;
|
||||
appEnv: AppEnv;
|
||||
noticeTypeEnum: LaravelEnum;
|
||||
};
|
||||
const { viewAny } = auth.policies.notices;
|
||||
|
|
@ -123,7 +124,7 @@ export default function Show({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${appEnv.routes.name}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import useTrans from "@/hooks/use-translations";
|
|||
import { Actions, Methods } from "@/back/lib/enums";
|
||||
import { AuthProp, SingleResource } from "@/back/types/global";
|
||||
import { SiteModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Create({
|
||||
data,
|
||||
|
|
@ -18,13 +19,14 @@ export default function Create({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies.sites;
|
||||
const model = data.data as SiteModel;
|
||||
|
||||
// Translations.
|
||||
const transBackToList = useTrans("uwil-backend::back.crud_back_to_list");
|
||||
const transTitle = useTrans(
|
||||
route().current(`back.${modelName}.duplicate`)
|
||||
route().current(`${routeName}${modelName}.duplicate`)
|
||||
? "uwil-backend::crud.helpers.duplication_model"
|
||||
: "uwil-backend::crud.helpers.creation_model",
|
||||
{
|
||||
|
|
@ -41,7 +43,7 @@ export default function Create({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { Actions, Methods } from "@/back/lib/enums";
|
|||
import Views from "@/back/lib/actions";
|
||||
import { AuthProp, SingleResource } from "@/back/types/global";
|
||||
import { SiteModel } from "@/back/types/project";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Edit({
|
||||
data,
|
||||
|
|
@ -20,6 +21,7 @@ export default function Edit({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies.sites;
|
||||
const model = data.data as SiteModel;
|
||||
const actionModels = [
|
||||
|
|
@ -43,7 +45,7 @@ export default function Edit({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@ import str from "@/hooks/use-string";
|
|||
import useTrans from "@/hooks/use-translations";
|
||||
import { SiteModel } from "@/back/types/project";
|
||||
import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
const getColumns = (viewAnyUsers: boolean) => {
|
||||
const getColumns = (routeName: string, viewAnyUsers: boolean) => {
|
||||
return [
|
||||
{
|
||||
accessorKey: "name",
|
||||
|
|
@ -154,7 +155,7 @@ const getColumns = (viewAnyUsers: boolean) => {
|
|||
if (viewAnyUsers && userModel.deleted_at === null) {
|
||||
value = (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route("back.users.show", userModel)}
|
||||
link={route(`${routeName}users.show`, userModel)}
|
||||
content={
|
||||
<>
|
||||
<UserIcon />
|
||||
|
|
@ -220,12 +221,14 @@ export default function Index({
|
|||
searchFields: string;
|
||||
modelName: string;
|
||||
}) {
|
||||
const { auth } = usePage().props as unknown as {
|
||||
const { auth, appEnv } = usePage().props as unknown as {
|
||||
auth: AuthProp;
|
||||
appEnv: AppEnv;
|
||||
};
|
||||
const { viewAny, viewTrash, create } = auth.policies.sites;
|
||||
const { viewAny: viewAnyUsers } = auth.policies.users;
|
||||
const isArchiveRoute = route().current(`back.${modelName}.trash`);
|
||||
const routeName = appEnv.routes.name;
|
||||
const isArchiveRoute = route().current(`${routeName}${modelName}.trash`);
|
||||
const actionModels = isArchiveRoute
|
||||
? [Views.RESTORATION, Views.FORCEDELETION]
|
||||
: [
|
||||
|
|
@ -234,7 +237,7 @@ export default function Index({
|
|||
Views.DUPLICATION,
|
||||
Views.ARCHIVATION,
|
||||
];
|
||||
const columns = getColumns(viewAnyUsers);
|
||||
const columns = getColumns(routeName, viewAnyUsers);
|
||||
|
||||
// Translations.
|
||||
const transModel = useTrans(`models.classes.${modelName}`, { choice: 2 });
|
||||
|
|
@ -255,7 +258,7 @@ export default function Index({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackList}</p>}
|
||||
/>
|
||||
|
|
@ -275,7 +278,7 @@ export default function Index({
|
|||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
{viewTrash && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.trash`)}
|
||||
link={route(`${routeName}${modelName}.trash`)}
|
||||
content={<ArchiveIcon />}
|
||||
tooltipContent={<p>{transAccessTo}</p>}
|
||||
variant="outline"
|
||||
|
|
@ -283,7 +286,7 @@ export default function Index({
|
|||
)}
|
||||
{create && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.create`)}
|
||||
link={route(`${routeName}${modelName}.create`)}
|
||||
content={<PlusIcon />}
|
||||
tooltipContent={<p>{transCrudAddEntry}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ const getColumns = (
|
|||
if (viewAnyUsers && value.deleted_at === null) {
|
||||
content = (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route("back.users.show", value)}
|
||||
link={route(`${appEnv.routes.name}users.show`, value)}
|
||||
content={
|
||||
<>
|
||||
<UserIcon />
|
||||
|
|
@ -219,7 +219,7 @@ const getColumns = (
|
|||
if (viewAnyUsers && value.deleted_at === null) {
|
||||
content = (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route("back.gitlab-projects.show", value)}
|
||||
link={route(`${appEnv.routes.name}gitlab-projects.show`, value)}
|
||||
content={
|
||||
<>
|
||||
<FolderGitIcon />
|
||||
|
|
@ -307,7 +307,7 @@ const getColumns = (
|
|||
if (viewAnyUsers && userModel.deleted_at === null) {
|
||||
content = (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route("back.users.show", userModel)}
|
||||
link={route(`${appEnv.routes.name}users.show`, userModel)}
|
||||
content={
|
||||
<>
|
||||
<UserIcon />
|
||||
|
|
@ -432,7 +432,7 @@ export default function Show({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${appEnv.routes.name}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import Form from "@/back/Pages/Users/Form";
|
|||
import useTrans from "@/hooks/use-translations";
|
||||
import { Actions, Methods } from "@/back/lib/enums";
|
||||
import { AuthProp, SingleResource, UserModel } from "@/back/types/global";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Create({
|
||||
data,
|
||||
|
|
@ -17,13 +18,14 @@ export default function Create({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies.users;
|
||||
const model = data.data as UserModel;
|
||||
|
||||
// Translations.
|
||||
const transBackToList = useTrans("uwil-backend::back.crud_back_to_list");
|
||||
const transTitle = useTrans(
|
||||
route().current(`back.${modelName}.duplicate`)
|
||||
route().current(`${routeName}${modelName}.duplicate`)
|
||||
? "uwil-backend::crud.helpers.duplication_model"
|
||||
: "uwil-backend::crud.helpers.creation_model",
|
||||
{
|
||||
|
|
@ -40,7 +42,7 @@ export default function Create({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import useTrans from "@/hooks/use-translations";
|
|||
import { Actions, Methods } from "@/back/lib/enums";
|
||||
import Views from "@/back/lib/actions";
|
||||
import { AuthProp, SingleResource, UserModel } from "@/back/types/global";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
export default function Edit({
|
||||
data,
|
||||
|
|
@ -20,6 +21,7 @@ export default function Edit({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies.users;
|
||||
const model = data.data as UserModel;
|
||||
const actionModels = [
|
||||
|
|
@ -43,7 +45,7 @@ export default function Edit({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import { GetFormatedDate, GetTranslation } from "@/lib/utils";
|
|||
import { AuthProp, Resource, UserModel } from "@/back/types/global";
|
||||
import str from "@/hooks/use-string";
|
||||
import useTrans from "@/hooks/use-translations";
|
||||
import { AppEnv } from "@/types/global";
|
||||
|
||||
const getColumns = () => {
|
||||
return [
|
||||
|
|
@ -166,11 +167,15 @@ export default function Index({
|
|||
searchFields: string;
|
||||
modelName: string;
|
||||
}) {
|
||||
const { auth } = usePage().props as unknown as {
|
||||
const { auth, appEnv } = usePage().props as unknown as {
|
||||
auth: AuthProp;
|
||||
appEnv: AppEnv;
|
||||
};
|
||||
const { viewAny, viewTrash, create } = auth.policies.users;
|
||||
const isArchiveRoute = route().current(`back.${modelName}.trash`);
|
||||
const routeName = appEnv.routes.name;
|
||||
const isArchiveRoute = route().current(
|
||||
`${routeName}${modelName}.trash`,
|
||||
);
|
||||
const actionModels = isArchiveRoute
|
||||
? [Views.RESTORATION, Views.FORCEDELETION]
|
||||
: [
|
||||
|
|
@ -208,7 +213,7 @@ export default function Index({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.index`)}
|
||||
link={route(`${routeName}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackList}</p>}
|
||||
/>
|
||||
|
|
@ -223,7 +228,7 @@ export default function Index({
|
|||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
{viewTrash && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.trash`)}
|
||||
link={route(`${routeName}${modelName}.trash`)}
|
||||
content={<ArchiveIcon />}
|
||||
tooltipContent={<p>{transAccessTo}</p>}
|
||||
variant="outline"
|
||||
|
|
@ -231,7 +236,7 @@ export default function Index({
|
|||
)}
|
||||
{create && (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route(`back.${modelName}.create`)}
|
||||
link={route(`${routeName}${modelName}.create`)}
|
||||
content={<PlusIcon />}
|
||||
tooltipContent={<p>{transCrudAddEntry}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ const getColumns = (
|
|||
if (viewAnySites && siteModel.deleted_at === null) {
|
||||
content = (
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route("back.sites.show", siteModel)}
|
||||
link={route(`${appEnv.routes.name}sites.show`, siteModel)}
|
||||
content={
|
||||
<>
|
||||
<GlobeIcon />
|
||||
|
|
@ -291,7 +291,7 @@ export default function Show({
|
|||
viewAny && (
|
||||
<div className="flex justify-end items-center gap-x-1.5">
|
||||
<BtnOptionnalLinkWithTooltip
|
||||
link={route("back.users.index")}
|
||||
link={route(`${appEnv.routes.name}${modelName}.index`)}
|
||||
content={<ArrowLeftIcon />}
|
||||
tooltipContent={<p>{transCrudBackToList}</p>}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ export default function useCrudSubmit<TFormData>({
|
|||
data,
|
||||
modelNameTrans,
|
||||
}: UseCrudSubmitParams<TFormData>) {
|
||||
const { locale } = usePage().props.appEnv as AppEnv;
|
||||
const { locale, routes } = usePage().props.appEnv as AppEnv;
|
||||
/** Set messages success/errors */
|
||||
const messages = useCrudMessages({ method, modelNameTrans });
|
||||
const { toast } = useToast();
|
||||
|
|
@ -51,7 +51,7 @@ export default function useCrudSubmit<TFormData>({
|
|||
// eslint-disable-next-line no-param-reassign
|
||||
data.locale = locale;
|
||||
|
||||
const routeUrl = route(`back.${modelRoute}.${action}`, model?.id);
|
||||
const routeUrl = route(`${routes.name}${modelRoute}.${action}`, model?.id);
|
||||
post(routeUrl, {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// * Packages
|
||||
import { router } from "@inertiajs/react";
|
||||
import { AppEnv } from "@/types/global";
|
||||
import { router, usePage } from "@inertiajs/react";
|
||||
import { route } from "ziggy-js";
|
||||
|
||||
type RouterFiltersProps = {
|
||||
|
|
@ -11,8 +12,9 @@ type RouterFiltersProps = {
|
|||
};
|
||||
export default function addFilterToUrl(props: RouterFiltersProps) {
|
||||
const { modelName, params, isArchiveRoute = false } = props;
|
||||
const routeName = (usePage().props.appEnv as AppEnv).routes.name;
|
||||
|
||||
const targetRoute = `back.${modelName}.${isArchiveRoute ? "trash" : "index"}`;
|
||||
const targetRoute = `${routeName}${modelName}.${isArchiveRoute ? "trash" : "index"}`;
|
||||
|
||||
return router.visit(route(targetRoute), {
|
||||
method: "get",
|
||||
|
|
|
|||
4
resources/ts/types/global.d.ts
vendored
4
resources/ts/types/global.d.ts
vendored
|
|
@ -5,6 +5,10 @@ export type AppEnv = {
|
|||
locale: string;
|
||||
locales: string;
|
||||
fallbackLocale: string;
|
||||
routes: {
|
||||
prefix: string;
|
||||
name: string;
|
||||
};
|
||||
};
|
||||
|
||||
export type LaravelEnum = Record<
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
{{-- blade-formatter-disable --}}
|
||||
@component('mail::message')
|
||||
|
||||
# {{ __('auth.email_hello') }}
|
||||
# {{ __('auth.email_hello', ['firstName' => $firstName, 'lastName' => $lastName]) }}
|
||||
|
||||
{{ __('auth.email_reset_complete') }}
|
||||
|
||||
{{ __('auth.email_new_connection') }}
|
||||
<div style="text-align: center; margin: 24px 0;">
|
||||
<a href="{{ route('back.login') }}"
|
||||
<a href="{{ $routeLogin }}"
|
||||
target="_blank"
|
||||
style="
|
||||
background-color: hsl(10, 75%, 29%);
|
||||
|
|
@ -27,6 +27,9 @@
|
|||
<hr>
|
||||
|
||||
<small>{{ __('auth.email_cant_visualise', ['actionText' => __('auth.login')]) }}
|
||||
<a href="{{ route('back.login') }}" target="_blank">{{ route('back.login') }}</a></small>
|
||||
<a href="{{ $routeLogin }}" target="_blank">
|
||||
{{ $routeLogin }}
|
||||
</a>
|
||||
</small>
|
||||
|
||||
@endcomponent
|
||||
|
|
@ -4,42 +4,46 @@ use Diglactic\Breadcrumbs\Breadcrumbs;
|
|||
use Diglactic\Breadcrumbs\Generator;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
Breadcrumbs::for('back.brands.index', function (Generator $trail) {
|
||||
/** @var string $routeName */
|
||||
$routeName = config('uwil-backend.routes.name');
|
||||
|
||||
Breadcrumbs::for("{$routeName}brands.index", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}dashboard.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans_choice('models.classes.brands', \INF)),
|
||||
route('back.brands.index')
|
||||
route("{$routeName}brands.index")
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.brands.create', function (Generator $trail) {
|
||||
$trail->parent('back.brands.index');
|
||||
Breadcrumbs::for("{$routeName}brands.create", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}brands.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.create')),
|
||||
route('back.brands.create'),
|
||||
route("{$routeName}brands.create"),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.brands.edit', function (Generator $trail) {
|
||||
$trail->parent('back.brands.index');
|
||||
Breadcrumbs::for("{$routeName}brands.edit", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}brands.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.edit')),
|
||||
route('back.brands.edit', [
|
||||
route("{$routeName}brands.edit", [
|
||||
'brand' => request()->brand,
|
||||
])
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.brands.duplicate', function (Generator $trail) {
|
||||
$trail->parent('back.brands.index');
|
||||
Breadcrumbs::for("{$routeName}brands.duplicate", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}brands.index");
|
||||
$trail->push(Str::ucfirst(trans('uwil-backend::crud.actions.duplicate')));
|
||||
});
|
||||
Breadcrumbs::for('back.brands.show', function (Generator $trail) {
|
||||
$trail->parent('back.brands.index');
|
||||
Breadcrumbs::for("{$routeName}brands.show", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}brands.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.visualize')),
|
||||
route('back.brands.show', [
|
||||
route("{$routeName}brands.show", [
|
||||
'brand' => request()->brand,
|
||||
]),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.brands.trash', function (Generator $trail) {
|
||||
$trail->parent('back.brands.index');
|
||||
Breadcrumbs::for("{$routeName}brands.trash", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}brands.index");
|
||||
$trail->push(Str::ucfirst(trans('uwil-backend::back.archives')));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,42 +4,46 @@ use Diglactic\Breadcrumbs\Breadcrumbs;
|
|||
use Diglactic\Breadcrumbs\Generator;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
Breadcrumbs::for('back.gitlab-projects.index', function (Generator $trail) {
|
||||
/** @var string $routeName */
|
||||
$routeName = config('uwil-backend.routes.name');
|
||||
|
||||
Breadcrumbs::for("{$routeName}gitlab-projects.index", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}dashboard.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans_choice('models.classes.gitlab-projects', \INF)),
|
||||
route('back.gitlab-projects.index')
|
||||
route("{$routeName}gitlab-projects.index")
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.gitlab-projects.create', function (Generator $trail) {
|
||||
$trail->parent('back.gitlab-projects.index');
|
||||
Breadcrumbs::for("{$routeName}gitlab-projects.create", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}gitlab-projects.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.create')),
|
||||
route('back.gitlab-projects.create'),
|
||||
route("{$routeName}gitlab-projects.create"),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.gitlab-projects.edit', function (Generator $trail) {
|
||||
$trail->parent('back.gitlab-projects.index');
|
||||
Breadcrumbs::for("{$routeName}gitlab-projects.edit", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}gitlab-projects.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.edit')),
|
||||
route('back.gitlab-projects.edit', [
|
||||
route("{$routeName}gitlab-projects.edit", [
|
||||
'gitlab_project' => request()->gitlab_project,
|
||||
])
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.gitlab-projects.duplicate', function (Generator $trail) {
|
||||
$trail->parent('back.gitlab-projects.index');
|
||||
Breadcrumbs::for("{$routeName}gitlab-projects.duplicate", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}gitlab-projects.index");
|
||||
$trail->push(Str::ucfirst(trans('uwil-backend::crud.actions.duplicate')));
|
||||
});
|
||||
Breadcrumbs::for('back.gitlab-projects.show', function (Generator $trail) {
|
||||
$trail->parent('back.gitlab-projects.index');
|
||||
Breadcrumbs::for("{$routeName}gitlab-projects.show", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}gitlab-projects.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.visualize')),
|
||||
route('back.gitlab-projects.show', [
|
||||
route("{$routeName}gitlab-projects.show", [
|
||||
'gitlab_project' => request()->gitlab_project,
|
||||
]),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.gitlab-projects.trash', function (Generator $trail) {
|
||||
$trail->parent('back.gitlab-projects.index');
|
||||
Breadcrumbs::for("{$routeName}gitlab-projects.trash", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}gitlab-projects.index");
|
||||
$trail->push(Str::ucfirst(trans('uwil-backend::back.archives')));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,42 +4,46 @@ use Diglactic\Breadcrumbs\Breadcrumbs;
|
|||
use Diglactic\Breadcrumbs\Generator;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
Breadcrumbs::for('back.invoice-companies.index', function (Generator $trail) {
|
||||
/** @var string $routeName */
|
||||
$routeName = config('uwil-backend.routes.name');
|
||||
|
||||
Breadcrumbs::for("{$routeName}invoice-companies.index", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}dashboard.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans_choice('models.classes.invoice-companies', \INF)),
|
||||
route('back.invoice-companies.index')
|
||||
route("{$routeName}invoice-companies.index")
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.invoice-companies.create', function (Generator $trail) {
|
||||
$trail->parent('back.invoice-companies.index');
|
||||
Breadcrumbs::for("{$routeName}invoice-companies.create", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}invoice-companies.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.create')),
|
||||
route('back.invoice-companies.create'),
|
||||
route("{$routeName}invoice-companies.create"),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.invoice-companies.edit', function (Generator $trail) {
|
||||
$trail->parent('back.invoice-companies.index');
|
||||
Breadcrumbs::for("{$routeName}invoice-companies.edit", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}invoice-companies.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.edit')),
|
||||
route('back.invoice-companies.edit', [
|
||||
route("{$routeName}invoice-companies.edit", [
|
||||
'invoice_company' => request()->invoice_company,
|
||||
]),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.invoice-companies.duplicate', function (Generator $trail) {
|
||||
$trail->parent('back.invoice-companies.index');
|
||||
Breadcrumbs::for("{$routeName}invoice-companies.duplicate", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}invoice-companies.index");
|
||||
$trail->push(Str::ucfirst(trans('uwil-backend::crud.actions.duplicate')));
|
||||
});
|
||||
Breadcrumbs::for('back.invoice-companies.show', function (Generator $trail) {
|
||||
$trail->parent('back.invoice-companies.index');
|
||||
Breadcrumbs::for("{$routeName}invoice-companies.show", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}invoice-companies.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.visualize')),
|
||||
route('back.invoice-companies.show', [
|
||||
route("{$routeName}invoice-companies.show", [
|
||||
'invoice_company' => request()->invoice_company,
|
||||
]),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.invoice-companies.trash', function (Generator $trail) {
|
||||
$trail->parent('back.invoice-companies.index');
|
||||
Breadcrumbs::for("{$routeName}invoice-companies.trash", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}invoice-companies.index");
|
||||
$trail->push(Str::ucfirst(trans('uwil-backend::back.archives')));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,42 +4,46 @@ use Diglactic\Breadcrumbs\Breadcrumbs;
|
|||
use Diglactic\Breadcrumbs\Generator;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
Breadcrumbs::for('back.invoice-packages.index', function (Generator $trail) {
|
||||
/** @var string $routeName */
|
||||
$routeName = config('uwil-backend.routes.name');
|
||||
|
||||
Breadcrumbs::for("{$routeName}invoice-packages.index", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}dashboard.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans_choice('models.classes.invoice-packages', \INF)),
|
||||
route('back.invoice-packages.index')
|
||||
route("{$routeName}invoice-packages.index")
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.invoice-packages.create', function (Generator $trail) {
|
||||
$trail->parent('back.invoice-packages.index');
|
||||
Breadcrumbs::for("{$routeName}invoice-packages.create", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}invoice-packages.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.create')),
|
||||
route('back.invoice-packages.create'),
|
||||
route("{$routeName}invoice-packages.create"),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.invoice-packages.edit', function (Generator $trail) {
|
||||
$trail->parent('back.invoice-packages.index');
|
||||
Breadcrumbs::for("{$routeName}invoice-packages.edit", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}invoice-packages.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.edit')),
|
||||
route('back.invoice-packages.edit', [
|
||||
route("{$routeName}invoice-packages.edit", [
|
||||
'invoice_package' => request()->invoice_package,
|
||||
]),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.invoice-packages.duplicate', function (Generator $trail) {
|
||||
$trail->parent('back.invoice-packages.index');
|
||||
Breadcrumbs::for("{$routeName}invoice-packages.duplicate", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}invoice-packages.index");
|
||||
$trail->push(Str::ucfirst(trans('uwil-backend::crud.actions.duplicate')));
|
||||
});
|
||||
Breadcrumbs::for('back.invoice-packages.show', function (Generator $trail) {
|
||||
$trail->parent('back.invoice-packages.index');
|
||||
Breadcrumbs::for("{$routeName}invoice-packages.show", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}invoice-packages.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.visualize')),
|
||||
route('back.invoice-packages.show', [
|
||||
route("{$routeName}invoice-packages.show", [
|
||||
'invoice_package' => request()->invoice_package,
|
||||
])
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.invoice-packages.trash', function (Generator $trail) {
|
||||
$trail->parent('back.invoice-packages.index');
|
||||
Breadcrumbs::for("{$routeName}invoice-packages.trash", function (Generator $trail) use ($routeName){
|
||||
$trail->parent("{$routeName}invoice-packages.index");
|
||||
$trail->push(Str::ucfirst(trans('uwil-backend::back.archives')));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,42 +4,46 @@ use Diglactic\Breadcrumbs\Breadcrumbs;
|
|||
use Diglactic\Breadcrumbs\Generator;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
Breadcrumbs::for('back.notices.index', function (Generator $trail) {
|
||||
/** @var string $routeName */
|
||||
$routeName = config('uwil-backend.routes.name');
|
||||
|
||||
Breadcrumbs::for("{$routeName}notices.index", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}dashboard.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans_choice('models.classes.notices', \INF)),
|
||||
route('back.notices.index')
|
||||
route("{$routeName}notices.index")
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.notices.create', function (Generator $trail) {
|
||||
$trail->parent('back.notices.index');
|
||||
Breadcrumbs::for("{$routeName}notices.create", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}notices.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.create')),
|
||||
route('back.notices.create'),
|
||||
route("{$routeName}notices.create"),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.notices.edit', function (Generator $trail) {
|
||||
$trail->parent('back.notices.index');
|
||||
Breadcrumbs::for("{$routeName}notices.edit", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}notices.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.edit')),
|
||||
route('back.notices.edit', [
|
||||
route("{$routeName}notices.edit", [
|
||||
'notice' => request()->notice,
|
||||
]),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.notices.duplicate', function (Generator $trail) {
|
||||
$trail->parent('back.notices.index');
|
||||
Breadcrumbs::for("{$routeName}notices.duplicate", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}notices.index");
|
||||
$trail->push(Str::ucfirst(trans('uwil-backend::crud.actions.duplicate')));
|
||||
});
|
||||
Breadcrumbs::for('back.notices.show', function (Generator $trail) {
|
||||
$trail->parent('back.notices.index');
|
||||
Breadcrumbs::for("{$routeName}notices.show", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}notices.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.visualize')),
|
||||
route('back.notices.show', [
|
||||
route("{$routeName}notices.show", [
|
||||
'notice' => request()->notice,
|
||||
]),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.notices.trash', function (Generator $trail) {
|
||||
$trail->parent('back.notices.index');
|
||||
Breadcrumbs::for("{$routeName}notices.trash", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}notices.index");
|
||||
$trail->push(Str::ucfirst(trans('uwil-backend::back.archives')));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,42 +4,46 @@ use Diglactic\Breadcrumbs\Breadcrumbs;
|
|||
use Diglactic\Breadcrumbs\Generator;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
Breadcrumbs::for('back.sites.index', function (Generator $trail) {
|
||||
/** @var string $routeName */
|
||||
$routeName = config('uwil-backend.routes.name');
|
||||
|
||||
Breadcrumbs::for("{$routeName}sites.index", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}dashboard.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans_choice('models.classes.sites', \INF)),
|
||||
route('back.sites.index')
|
||||
route("{$routeName}sites.index")
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.sites.create', function (Generator $trail) {
|
||||
$trail->parent('back.sites.index');
|
||||
Breadcrumbs::for("{$routeName}sites.create", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}sites.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.create')),
|
||||
route('back.sites.create'),
|
||||
route("{$routeName}sites.create"),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.sites.edit', function (Generator $trail) {
|
||||
$trail->parent('back.sites.index');
|
||||
Breadcrumbs::for("{$routeName}sites.edit", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}sites.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.edit')),
|
||||
route('back.sites.edit', [
|
||||
route("{$routeName}sites.edit", [
|
||||
'site' => request()->site,
|
||||
]),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.sites.duplicate', function (Generator $trail) {
|
||||
$trail->parent('back.sites.index');
|
||||
Breadcrumbs::for("{$routeName}sites.duplicate", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}sites.index");
|
||||
$trail->push(Str::ucfirst(trans('uwil-backend::crud.actions.duplicate')));
|
||||
});
|
||||
Breadcrumbs::for('back.sites.show', function (Generator $trail) {
|
||||
$trail->parent('back.sites.index');
|
||||
Breadcrumbs::for("{$routeName}sites.show", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}sites.index");
|
||||
$trail->push(
|
||||
Str::ucfirst(trans('uwil-backend::crud.actions.visualize')),
|
||||
route('back.sites.show', [
|
||||
route("{$routeName}sites.show", [
|
||||
'site' => request()->site,
|
||||
]),
|
||||
);
|
||||
});
|
||||
Breadcrumbs::for('back.sites.trash', function (Generator $trail) {
|
||||
$trail->parent('back.sites.index');
|
||||
Breadcrumbs::for("{$routeName}sites.trash", function (Generator $trail) use ($routeName) {
|
||||
$trail->parent("{$routeName}sites.index");
|
||||
$trail->push(Str::ucfirst(trans('uwil-backend::back.archives')));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -24,6 +24,6 @@
|
|||
"include": [
|
||||
"resources/ts/**/*.ts",
|
||||
"resources/ts/**/*.tsx",
|
||||
"resources/ts/**/*.d.ts"
|
||||
"resources/ts/**/*.d.ts",
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue