Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f504c50c9b |
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Dto;
|
||||||
|
|
||||||
|
class ApiResponseDto
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public readonly ?string $message = null,
|
||||||
|
// public readonly ?int $statusCode = 200,
|
||||||
|
public readonly mixed $data = null,
|
||||||
|
public readonly mixed $meta = null,
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// return new self($this->message, $this->statusCode, $this->data, $this->meta);
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static function success()
|
||||||
|
// {
|
||||||
|
// return new self($message, $data, $statusCode = 200);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public static function error()
|
||||||
|
// {
|
||||||
|
// return new self($message, $data, $statusCode = 400);
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use App\Services\ApiResponder;
|
||||||
|
|
||||||
|
class ApiResponderProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register services.
|
||||||
|
*/
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
$this->app->bind(ApiResponder::class, function($app){
|
||||||
|
return new ApiResponder();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap services.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Services;
|
||||||
|
|
||||||
|
use App\Dto\ApiResponseDto;
|
||||||
|
use Illuminate\Http\JsonResponse;
|
||||||
|
|
||||||
|
class ApiResponder{
|
||||||
|
public $dto;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
public function success(): JsonResponse
|
||||||
|
{
|
||||||
|
return $this->buildResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function error()
|
||||||
|
{
|
||||||
|
return $this->buildResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDto(ApiResponseDto $dto)
|
||||||
|
{
|
||||||
|
$this->dto = $dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function fromDTO(ApiResponseDto $dto)
|
||||||
|
// {
|
||||||
|
// return $dto;
|
||||||
|
// }
|
||||||
|
|
||||||
|
#Гаврилов
|
||||||
|
//СБОР СТАТИСТИКИ ПО ВЫЗЫВАЕМЫМ API ЕНДПОИНТАМ. ВНЕСТИ В TODO ПРОЕКТА
|
||||||
|
private function setStatistics()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#Гаврилов
|
||||||
|
//ДОБАВЬ ЛОГИРОВАНИЕ ОШИБОК В TRY CATCH В .LOG ФАЙЛ
|
||||||
|
|
||||||
|
private function buildResponse(): JsonResponse
|
||||||
|
{
|
||||||
|
//echo '<pre>'; var_dump((array)$this->dto); echo'</pre>';
|
||||||
|
//return (array) $this->dto;
|
||||||
|
return response()->json((array) $this->dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/* ГАВРИЛОВ. ВЫЯСНИТЬ, ГДЕ ИСПОЛЬЗУЮТСЯ */
|
|
||||||
|
|
||||||
#root{
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-container{
|
|
||||||
|
|
||||||
&.form-container--small-size{
|
|
||||||
width: 30%;
|
|
||||||
}
|
|
||||||
&.form-container--medium-size{
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.form-container--left-pos{
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
&.form-container--mid-pos{
|
|
||||||
margin: 25px auto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.form__field-block{
|
|
||||||
margin: 15px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-block{
|
|
||||||
margin: 15px 0;
|
|
||||||
padding: 15px 0;
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-start;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* OVERWRITE */
|
|
||||||
.renButton{
|
|
||||||
|
|
||||||
&.renButton--tertiary{
|
|
||||||
background: #dfdfdf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
#page__content-block{
|
|
||||||
padding: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#page__header-block{
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 99;
|
|
||||||
box-shadow: 0px 2px 9px 3px #8f8d8d;
|
|
||||||
|
|
||||||
& .header-block__header-container{
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 10px;
|
|
||||||
background: var(--color_graphite_main);
|
|
||||||
|
|
||||||
& .header-container__block{
|
|
||||||
display: flex;
|
|
||||||
gap: 10px;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
& .header-container__block__app-name{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
:root{
|
|
||||||
--color_graphite_main: #323e48;
|
|
||||||
--color_emerald_main: #77cb10;
|
|
||||||
--color_emerald_light: #95fa77;
|
|
||||||
--color_ruby_main: #ff0078;
|
|
||||||
--color_purple_main: #7864eb;
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import { createRoot } from 'react-dom/client';
|
|
||||||
import { UIKitThemeProvider } from '@SharePoint/rencredit_uikit';
|
|
||||||
import Header from "./components/header/Header.tsx";
|
|
||||||
|
|
||||||
const headerBlock:HTMLElement = document.getElementById('page__header-block')!;
|
|
||||||
const headerRoot = createRoot(headerBlock);
|
|
||||||
|
|
||||||
console.log('da')
|
|
||||||
|
|
||||||
headerRoot.render(
|
|
||||||
<UIKitThemeProvider>
|
|
||||||
<Header />
|
|
||||||
</UIKitThemeProvider>
|
|
||||||
);
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import React, { ReactNode } from "react";
|
|
||||||
import { UIKitThemeProvider } from '@SharePoint/rencredit_uikit';
|
|
||||||
import { PopupProvider } from "../contexts/PopupContext.tsx";
|
|
||||||
import { PreloaderProvider } from "../contexts/PreloaderContext.tsx";
|
|
||||||
|
|
||||||
interface AppProviderProps{
|
|
||||||
children: ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AppProvider({children}: AppProviderProps){
|
|
||||||
|
|
||||||
return (
|
|
||||||
<UIKitThemeProvider>
|
|
||||||
<PopupProvider>
|
|
||||||
<PreloaderProvider>
|
|
||||||
{children}
|
|
||||||
</PreloaderProvider>
|
|
||||||
</PopupProvider>
|
|
||||||
</UIKitThemeProvider>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/**
|
|
||||||
* Сервис для полуения csrt токена для размещения в формах
|
|
||||||
* @date 24.07.2025
|
|
||||||
* @author dgavrilov
|
|
||||||
*/
|
|
||||||
|
|
||||||
export const getCsrfToken = ():string => {
|
|
||||||
const METATAG:HTMLElement|null = document.querySelector('meta[name="csrf-token"]');
|
|
||||||
|
|
||||||
if (!METATAG) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
const CSRFTOKEN:string|null = METATAG.getAttribute('content');
|
|
||||||
if (!CSRFTOKEN) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return CSRFTOKEN;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user