start over v2
This commit is contained in:
parent
95a15d7470
commit
0f4c26f5da
|
@ -1,81 +0,0 @@
|
|||
{
|
||||
"type": "project",
|
||||
"license": "proprietary",
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"ext-ctype": "*",
|
||||
"ext-iconv": "*",
|
||||
"doctrine/annotations": "^1.0",
|
||||
"doctrine/doctrine-bundle": "^2.8",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.2",
|
||||
"doctrine/orm": "^2.14",
|
||||
"nelmio/cors-bundle": "^2.2",
|
||||
"phpdocumentor/reflection-docblock": "^5.3",
|
||||
"phpstan/phpdoc-parser": "^1.16",
|
||||
"symfony/apache-pack": "^1.0",
|
||||
"symfony/console": "6.2.*",
|
||||
"symfony/dotenv": "6.2.*",
|
||||
"symfony/flex": "^2",
|
||||
"symfony/framework-bundle": "6.2.*",
|
||||
"symfony/property-access": "6.2.*",
|
||||
"symfony/property-info": "6.2.*",
|
||||
"symfony/runtime": "6.2.*",
|
||||
"symfony/security-bundle": "6.2.*",
|
||||
"symfony/serializer": "6.2.*",
|
||||
"symfony/yaml": "6.2.*",
|
||||
"symfonycasts/verify-email-bundle": "^1.13"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"symfony/flex": true,
|
||||
"symfony/runtime": true
|
||||
},
|
||||
"sort-packages": true
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"App\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"replace": {
|
||||
"symfony/polyfill-ctype": "*",
|
||||
"symfony/polyfill-iconv": "*",
|
||||
"symfony/polyfill-php72": "*",
|
||||
"symfony/polyfill-php73": "*",
|
||||
"symfony/polyfill-php74": "*",
|
||||
"symfony/polyfill-php80": "*",
|
||||
"symfony/polyfill-php81": "*"
|
||||
},
|
||||
"scripts": {
|
||||
"auto-scripts": {
|
||||
"cache:clear": "symfony-cmd",
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd"
|
||||
},
|
||||
"post-install-cmd": [
|
||||
"@auto-scripts"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@auto-scripts"
|
||||
]
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/symfony": "*"
|
||||
},
|
||||
"extra": {
|
||||
"symfony": {
|
||||
"allow-contrib": true,
|
||||
"require": "6.2.*",
|
||||
"docker": true
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/maker-bundle": "^1.48"
|
||||
}
|
||||
}
|
5331
composer.lock
generated
5331
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
|
||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
||||
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
|
||||
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
|
||||
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
|
||||
SymfonyCasts\Bundle\VerifyEmail\SymfonyCastsVerifyEmailBundle::class => ['all' => true],
|
||||
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
|
||||
];
|
|
@ -1,8 +0,0 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
###> doctrine/doctrine-bundle ###
|
||||
database:
|
||||
ports:
|
||||
- "5432"
|
||||
###< doctrine/doctrine-bundle ###
|
32
hesabixCore/.env
Normal file
32
hesabixCore/.env
Normal file
|
@ -0,0 +1,32 @@
|
|||
###> symfony/framework-bundle ###
|
||||
APP_ENV=dev
|
||||
APP_SECRET=f56179673fa562596e7fc565778a60f1
|
||||
###< symfony/framework-bundle ###
|
||||
|
||||
###> doctrine/doctrine-bundle ###
|
||||
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
|
||||
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
|
||||
#
|
||||
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
|
||||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
|
||||
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
|
||||
DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=15&charset=utf8"
|
||||
###< doctrine/doctrine-bundle ###
|
||||
|
||||
###> nelmio/cors-bundle ###
|
||||
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
|
||||
###< nelmio/cors-bundle ###
|
||||
|
||||
###> symfony/messenger ###
|
||||
# Choose one of the transports below
|
||||
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
|
||||
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
|
||||
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
|
||||
###< symfony/messenger ###
|
||||
###> MELI PAYAMAK ###
|
||||
MP_USERNAME = 09180000000
|
||||
MP_PASSWORD = PASSWORD
|
||||
###< MELI PAYAMAK ###
|
||||
###> symfony/mailer ###
|
||||
# MAILER_DSN=null://null
|
||||
###< symfony/mailer ###
|
6
hesabixCore/.env.test
Normal file
6
hesabixCore/.env.test
Normal file
|
@ -0,0 +1,6 @@
|
|||
# define your env variables for the test env here
|
||||
KERNEL_CLASS='App\Kernel'
|
||||
APP_SECRET='$ecretf0rt3st'
|
||||
SYMFONY_DEPRECATIONS_HELPER=999999
|
||||
PANTHER_APP_ENV=panther
|
||||
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
|
BIN
hesabixCore/.gitignore
vendored
Normal file
BIN
hesabixCore/.gitignore
vendored
Normal file
Binary file not shown.
41
hesabixCore/assets/app.js
Normal file
41
hesabixCore/assets/app.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
import './bootstrap.js';
|
||||
/*
|
||||
* Welcome to your app's main JavaScript file!
|
||||
*
|
||||
* We recommend including the built version of this JavaScript file
|
||||
* (and its CSS file) in your base layout (base.html.twig).
|
||||
*/
|
||||
import { createApp } from 'vue'
|
||||
import router from './vue/router/router.js'
|
||||
import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'
|
||||
|
||||
|
||||
// any CSS you import will output into a single css file (app.css in this case)
|
||||
import './styles/app.css';
|
||||
|
||||
// start the Stimulus application
|
||||
import './bootstrap';
|
||||
|
||||
// assets/app.js
|
||||
import { registerVueControllerComponents } from '@symfony/ux-vue';
|
||||
import App from "./vue/views/App.vue";
|
||||
|
||||
// Registers Vue.js controller components to allow loading them from Twig
|
||||
//
|
||||
// Vue.js controller components are components that are meant to be rendered
|
||||
// from Twig. These component can then rely on other components that won't be
|
||||
// called directly from Twig.
|
||||
//
|
||||
// By putting only controller components in `vue/controllers`, you ensure that
|
||||
// internal components won't be automatically included in your JS built file if
|
||||
// they are not necessary.
|
||||
registerVueControllerComponents(require.context('./vue/views', true, /\.vue$/));
|
||||
|
||||
// If you prefer to lazy-load your Vue.js controller components, in order to keep the JavaScript bundle the smallest as possible,
|
||||
// and improve performance, you can use the following line instead:
|
||||
//registerVueControllerComponents(require.context('./vue/controllers', true, /\.vue$/, 'lazy'));
|
||||
const app = createApp(App);
|
||||
app.use(router);
|
||||
app.mount('#page-container')
|
||||
|
||||
registerVueControllerComponents(require.context('./vue/controllers', true, /\.vue$/));
|
11
hesabixCore/assets/bootstrap.js
vendored
Normal file
11
hesabixCore/assets/bootstrap.js
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { startStimulusApp } from '@symfony/stimulus-bridge';
|
||||
|
||||
// Registers Stimulus controllers from controllers.json and in the controllers/ directory
|
||||
export const app = startStimulusApp(require.context(
|
||||
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
|
||||
true,
|
||||
/\.[jt]sx?$/
|
||||
));
|
||||
|
||||
// register any custom, 3rd party controllers here
|
||||
// app.register('some_controller_name', SomeImportedController);
|
11
hesabixCore/assets/controllers.json
Normal file
11
hesabixCore/assets/controllers.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"controllers": {
|
||||
"@symfony/ux-vue": {
|
||||
"vue": {
|
||||
"enabled": true,
|
||||
"fetch": "eager"
|
||||
}
|
||||
}
|
||||
},
|
||||
"entrypoints": []
|
||||
}
|
16
hesabixCore/assets/controllers/hello_controller.js
Normal file
16
hesabixCore/assets/controllers/hello_controller.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { Controller } from '@hotwired/stimulus';
|
||||
|
||||
/*
|
||||
* This is an example Stimulus controller!
|
||||
*
|
||||
* Any element with a data-controller="hello" attribute will cause
|
||||
* this controller to be executed. The name "hello" comes from the filename:
|
||||
* hello_controller.js -> "hello"
|
||||
*
|
||||
* Delete this file or adapt it for your use!
|
||||
*/
|
||||
export default class extends Controller {
|
||||
connect() {
|
||||
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
|
||||
}
|
||||
}
|
3
hesabixCore/assets/styles/app.css
Normal file
3
hesabixCore/assets/styles/app.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
background-color: lightgray;
|
||||
}
|
9
hesabixCore/assets/vue/controllers/Hello.vue
Normal file
9
hesabixCore/assets/vue/controllers/Hello.vue
Normal file
|
@ -0,0 +1,9 @@
|
|||
<template>
|
||||
<div>Hello {{ name }}!</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
defineProps({
|
||||
name: String
|
||||
});
|
||||
</script>
|
21
hesabixCore/assets/vue/controllers/test.vue
Normal file
21
hesabixCore/assets/vue/controllers/test.vue
Normal file
|
@ -0,0 +1,21 @@
|
|||
<template>
|
||||
<div>
|
||||
This is test component
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "test",
|
||||
data: ()=>{return {
|
||||
searchValue: '',
|
||||
}},
|
||||
mounted() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
14
hesabixCore/assets/vue/router/router.js
Normal file
14
hesabixCore/assets/vue/router/router.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'
|
||||
import test from '../controllers/test.vue'
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: '/tms',
|
||||
name: 'app_home',
|
||||
component: test
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
export default router
|
43
hesabixCore/assets/vue/views/App.vue
Normal file
43
hesabixCore/assets/vue/views/App.vue
Normal file
|
@ -0,0 +1,43 @@
|
|||
<script>
|
||||
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
beforeMount() {
|
||||
alert();
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods:{
|
||||
|
||||
},
|
||||
async mounted() {
|
||||
|
||||
},
|
||||
components:{
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
This is From App view
|
||||
</div>
|
||||
<RouterView />
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
.customize-table {
|
||||
--easy-table-header-font-color: #e1e1e1;
|
||||
--easy-table-header-background-color: #055bbb;
|
||||
}
|
||||
.form-control ,.form-select{
|
||||
font-family: 'vazir', sans-serif;
|
||||
}
|
||||
</style>
|
35
hesabixCore/assets/vue/views/base.vue
Normal file
35
hesabixCore/assets/vue/views/base.vue
Normal file
|
@ -0,0 +1,35 @@
|
|||
<template>
|
||||
<!-- Your Block -->
|
||||
<div class="block block-content-full">
|
||||
<div class="block-header block-header-default" style="background-color: #0E2231">
|
||||
<h3 class="block-title text-white"> پیشخوان </h3>
|
||||
<div class="block-options">
|
||||
<button class="btn-block-option" data-action="fullscreen_toggle" data-toggle="block-option" type="button"></button>
|
||||
<button class="btn-block-option" data-action="pinned_toggle" data-toggle="block-option" type="button">
|
||||
<i class="si si-pin"></i>
|
||||
</button>
|
||||
<button class="btn-block-option" data-action="state_toggle" data-action-mode="demo" data-toggle="block-option" type="button">
|
||||
<i class="si si-refresh"></i>
|
||||
</button>
|
||||
<button class="btn-block-option" data-action="content_toggle" data-toggle="block-option" type="button"></button>
|
||||
<button class="btn-block-option" data-action="close" data-toggle="block-option" type="button">
|
||||
<i class="si si-close"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="block-content">
|
||||
<p>پیشخوان</p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END Your Block -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "base"
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
78
hesabixCore/assets/vue/views/dashboard.vue
Normal file
78
hesabixCore/assets/vue/views/dashboard.vue
Normal file
|
@ -0,0 +1,78 @@
|
|||
<template>
|
||||
<div class="container-fluid mt-3">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="row items-push">
|
||||
<div class="col-6 col-lg-3">
|
||||
<router-link class="block block-rounded block-link-shadow text-center h-100 mb-0" to="/acc/persons/list">
|
||||
<div class="block-content py-5">
|
||||
<div class="fs-3 fw-semibold text-primary mb-1">{{stat.personCount}}</div>
|
||||
<p class="fw-semibold fs-sm text-muted text-uppercase mb-0">
|
||||
<i class="fa fa-users"></i>
|
||||
<br>
|
||||
اشخاص و مشتریان
|
||||
</p>
|
||||
</div>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="col-6 col-lg-3">
|
||||
<router-link class="block block-rounded block-link-shadow text-center h-100 mb-0" to="/acc/banks/list">
|
||||
<div class="block-content py-5">
|
||||
<div class="fs-3 fw-semibold text-primary mb-1">{{stat.bankCount}}</div>
|
||||
<p class="fw-semibold fs-sm text-muted text-uppercase mb-0">
|
||||
<i class="fa fa-bank"></i>
|
||||
<br>
|
||||
حسابهای بانکی
|
||||
</p>
|
||||
</div>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="col-6 col-lg-3">
|
||||
<router-link class="block block-rounded block-link-shadow text-center h-100 mb-0" to="/acc/accounting/list">
|
||||
<div class="block-content py-5">
|
||||
<div class="fs-3 fw-semibold text-primary mb-1">{{ stat.docCount }}</div>
|
||||
<p class="fw-semibold fs-sm text-muted text-uppercase mb-0">
|
||||
<i class="fa fa-book-open-reader"></i>
|
||||
<br>
|
||||
لیست اسناد
|
||||
</p>
|
||||
</div>
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="col-6 col-lg-3">
|
||||
<router-link class="block block-rounded block-link-shadow text-center h-100 mb-0" to="/acc/reports/list">
|
||||
<div class="block-content py-5">
|
||||
<div class="fs-3 fw-semibold mb-1 text-primary">{{ this.$filters.formatNumber(stat.income) }}</div>
|
||||
<p class="fw-semibold fs-sm text-muted text-uppercase mb-0">
|
||||
<i class="fa fa-chart-line"></i>
|
||||
<br>
|
||||
گردش مالی
|
||||
</p>
|
||||
</div>
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
|
||||
export default {
|
||||
name: "dashboard",
|
||||
data:()=>{return {
|
||||
stat:{}
|
||||
}},
|
||||
beforeMount() {
|
||||
axios.post('/api/business/stat').then((response)=>{
|
||||
this.stat = response.data
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
0
bin/console → hesabixCore/bin/console
Executable file → Normal file
0
bin/console → hesabixCore/bin/console
Executable file → Normal file
19
hesabixCore/bin/phpunit
Normal file
19
hesabixCore/bin/phpunit
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
if (!ini_get('date.timezone')) {
|
||||
ini_set('date.timezone', 'UTC');
|
||||
}
|
||||
|
||||
if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
|
||||
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
|
||||
require PHPUNIT_COMPOSER_INSTALL;
|
||||
PHPUnit\TextUI\Command::main();
|
||||
} else {
|
||||
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
|
||||
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
|
||||
}
|
116
hesabixCore/composer.json
Normal file
116
hesabixCore/composer.json
Normal file
|
@ -0,0 +1,116 @@
|
|||
{
|
||||
"type": "project",
|
||||
"license": "proprietary",
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"ext-ctype": "*",
|
||||
"ext-curl": "*",
|
||||
"ext-http": "*",
|
||||
"ext-iconv": "*",
|
||||
"doctrine/annotations": "^1.0",
|
||||
"doctrine/doctrine-bundle": "^2.8",
|
||||
"doctrine/doctrine-migrations-bundle": "^3.2",
|
||||
"doctrine/orm": "^2.14",
|
||||
"dompdf/dompdf": "^2.0",
|
||||
"friendsofsymfony/ckeditor-bundle": "*",
|
||||
"gregwar/captcha-bundle": "^2.2",
|
||||
"melipayamak/php": "1.0.0",
|
||||
"nelmio/cors-bundle": "^2.2",
|
||||
"phpdocumentor/reflection-docblock": "^5.3",
|
||||
"phpstan/phpdoc-parser": "^1.16",
|
||||
"symfony/apache-pack": "^1.0",
|
||||
"symfony/asset": "6.2.*",
|
||||
"symfony/console": "6.2.*",
|
||||
"symfony/doctrine-messenger": "6.2.*",
|
||||
"symfony/dotenv": "6.2.*",
|
||||
"symfony/expression-language": "6.2.*",
|
||||
"symfony/flex": "^2",
|
||||
"symfony/form": "6.2.*",
|
||||
"symfony/framework-bundle": "6.2.*",
|
||||
"symfony/http-client": "6.2.*",
|
||||
"symfony/mailer": "6.2.*",
|
||||
"symfony/mime": "6.2.*",
|
||||
"symfony/monolog-bundle": "^3.0",
|
||||
"symfony/notifier": "6.2.*",
|
||||
"symfony/process": "6.2.*",
|
||||
"symfony/property-access": "6.2.*",
|
||||
"symfony/property-info": "6.2.*",
|
||||
"symfony/runtime": "6.2.*",
|
||||
"symfony/security-bundle": "6.2.*",
|
||||
"symfony/serializer": "6.2.*",
|
||||
"symfony/string": "6.2.*",
|
||||
"symfony/translation": "6.2.*",
|
||||
"symfony/twig-bundle": "6.2.*",
|
||||
"symfony/ux-vue": "^2.9",
|
||||
"symfony/validator": "6.2.*",
|
||||
"symfony/web-link": "6.2.*",
|
||||
"symfony/webpack-encore-bundle": "^2.0",
|
||||
"symfony/yaml": "6.2.*",
|
||||
"symfonycasts/verify-email-bundle": "^1.13",
|
||||
"tecnickcom/tcpdf": "^6.6",
|
||||
"twig/extra-bundle": "^2.12|^3.0",
|
||||
"twig/twig": "^2.12|^3.0"
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"symfony/flex": true,
|
||||
"symfony/runtime": true
|
||||
},
|
||||
"sort-packages": true
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"App\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"replace": {
|
||||
"symfony/polyfill-ctype": "*",
|
||||
"symfony/polyfill-iconv": "*",
|
||||
"symfony/polyfill-php72": "*",
|
||||
"symfony/polyfill-php73": "*",
|
||||
"symfony/polyfill-php74": "*",
|
||||
"symfony/polyfill-php80": "*",
|
||||
"symfony/polyfill-php81": "*"
|
||||
},
|
||||
"scripts": {
|
||||
"auto-scripts": {
|
||||
"cache:clear": "symfony-cmd",
|
||||
"assets:install %PUBLIC_DIR%": "symfony-cmd",
|
||||
"ckeditor:install": "symfony-cmd"
|
||||
},
|
||||
"post-install-cmd": [
|
||||
"@auto-scripts"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@auto-scripts"
|
||||
]
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/symfony": "*"
|
||||
},
|
||||
"extra": {
|
||||
"symfony": {
|
||||
"allow-contrib": true,
|
||||
"require": "6.2.*",
|
||||
"docker": true
|
||||
},
|
||||
"public-dir": "../public_html"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"symfony/browser-kit": "6.2.*",
|
||||
"symfony/css-selector": "6.2.*",
|
||||
"symfony/debug-bundle": "6.2.*",
|
||||
"symfony/maker-bundle": "^1.48",
|
||||
"symfony/phpunit-bridge": "^6.2",
|
||||
"symfony/stopwatch": "6.2.*",
|
||||
"symfony/web-profiler-bundle": "6.2.*"
|
||||
}
|
||||
}
|
10280
hesabixCore/composer.lock
generated
Normal file
10280
hesabixCore/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
21
hesabixCore/config/bundles.php
Normal file
21
hesabixCore/config/bundles.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
|
||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
||||
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
|
||||
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
|
||||
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
|
||||
SymfonyCasts\Bundle\VerifyEmail\SymfonyCastsVerifyEmailBundle::class => ['all' => true],
|
||||
Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
|
||||
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
|
||||
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
|
||||
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
|
||||
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
|
||||
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
|
||||
Gregwar\CaptchaBundle\GregwarCaptchaBundle::class => ['all' => true],
|
||||
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
|
||||
Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true],
|
||||
Symfony\UX\Vue\VueBundle::class => ['all' => true],
|
||||
FOS\CKEditorBundle\FOSCKEditorBundle::class => ['all' => true],
|
||||
];
|
5
hesabixCore/config/packages/debug.yaml
Normal file
5
hesabixCore/config/packages/debug.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
when@dev:
|
||||
debug:
|
||||
# Forwards VarDumper Data clones to a centralized server allowing to inspect dumps on CLI or in your browser.
|
||||
# See the "server:dump" command to start a new server.
|
||||
dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%"
|
|
@ -6,7 +6,7 @@ doctrine:
|
|||
# either here or in the DATABASE_URL env var (see .env file)
|
||||
#server_version: '15'
|
||||
orm:
|
||||
auto_generate_proxy_classes: true
|
||||
auto_generate_proxy_classes: false
|
||||
enable_lazy_ghost_objects: true
|
||||
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
|
||||
auto_mapping: true
|
5
hesabixCore/config/packages/fos_ckeditor.yaml
Normal file
5
hesabixCore/config/packages/fos_ckeditor.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Read the documentation: https://symfony.com/doc/current/bundles/FOSCKEditorBundle/index.html
|
||||
|
||||
twig:
|
||||
form_themes:
|
||||
- '@FOSCKEditor/Form/ckeditor_widget.html.twig'
|
6
hesabixCore/config/packages/mailer.yaml
Normal file
6
hesabixCore/config/packages/mailer.yaml
Normal file
|
@ -0,0 +1,6 @@
|
|||
framework:
|
||||
mailer:
|
||||
dsn: '%env(MAILER_DSN)%'
|
||||
message_bus: false
|
||||
headers:
|
||||
From: 'Hesabix.ir <noreplay@hesabix.ir>'
|
24
hesabixCore/config/packages/messenger.yaml
Normal file
24
hesabixCore/config/packages/messenger.yaml
Normal file
|
@ -0,0 +1,24 @@
|
|||
framework:
|
||||
messenger:
|
||||
failure_transport: failed
|
||||
|
||||
transports:
|
||||
# https://symfony.com/doc/current/messenger.html#transport-configuration
|
||||
async:
|
||||
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
|
||||
options:
|
||||
use_notify: true
|
||||
check_delayed_interval: 60000
|
||||
retry_strategy:
|
||||
max_retries: 3
|
||||
multiplier: 2
|
||||
failed: 'doctrine://default?queue_name=failed'
|
||||
# sync: 'sync://'
|
||||
|
||||
routing:
|
||||
Symfony\Component\Mailer\Messenger\SendEmailMessage: async
|
||||
Symfony\Component\Notifier\Message\ChatMessage: async
|
||||
Symfony\Component\Notifier\Message\SmsMessage: async
|
||||
|
||||
# Route your messages to the transports
|
||||
# 'App\Message\YourMessage': async
|
61
hesabixCore/config/packages/monolog.yaml
Normal file
61
hesabixCore/config/packages/monolog.yaml
Normal file
|
@ -0,0 +1,61 @@
|
|||
monolog:
|
||||
channels:
|
||||
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
|
||||
|
||||
when@dev:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: stream
|
||||
path: "%kernel.logs_dir%/%kernel.environment%.log"
|
||||
level: debug
|
||||
channels: ["!event"]
|
||||
# uncomment to get logging in your browser
|
||||
# you may have to allow bigger header sizes in your Web server configuration
|
||||
#firephp:
|
||||
# type: firephp
|
||||
# level: info
|
||||
#chromephp:
|
||||
# type: chromephp
|
||||
# level: info
|
||||
console:
|
||||
type: console
|
||||
process_psr_3_messages: false
|
||||
channels: ["!event", "!doctrine", "!console"]
|
||||
|
||||
when@test:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: fingers_crossed
|
||||
action_level: error
|
||||
handler: nested
|
||||
excluded_http_codes: [404, 405]
|
||||
channels: ["!event"]
|
||||
nested:
|
||||
type: stream
|
||||
path: "%kernel.logs_dir%/%kernel.environment%.log"
|
||||
level: debug
|
||||
|
||||
when@prod:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: fingers_crossed
|
||||
action_level: error
|
||||
handler: nested
|
||||
excluded_http_codes: [404, 405]
|
||||
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
|
||||
nested:
|
||||
type: stream
|
||||
path: php://stderr
|
||||
level: debug
|
||||
formatter: monolog.formatter.json
|
||||
console:
|
||||
type: console
|
||||
process_psr_3_messages: false
|
||||
channels: ["!event", "!doctrine"]
|
||||
deprecation:
|
||||
type: stream
|
||||
channels: [deprecation]
|
||||
path: php://stderr
|
16
hesabixCore/config/packages/notifier.yaml
Normal file
16
hesabixCore/config/packages/notifier.yaml
Normal file
|
@ -0,0 +1,16 @@
|
|||
framework:
|
||||
notifier:
|
||||
#chatter_transports:
|
||||
# slack: '%env(SLACK_DSN)%'
|
||||
# telegram: '%env(TELEGRAM_DSN)%'
|
||||
#texter_transports:
|
||||
# twilio: '%env(TWILIO_DSN)%'
|
||||
# nexmo: '%env(NEXMO_DSN)%'
|
||||
channel_policy:
|
||||
# use chat/slack, chat/telegram, sms/twilio or sms/nexmo
|
||||
urgent: ['email']
|
||||
high: ['email']
|
||||
medium: ['email']
|
||||
low: ['email']
|
||||
admin_recipients:
|
||||
- { email: admin@example.com }
|
|
@ -29,6 +29,16 @@ security:
|
|||
|
||||
# https://symfony.com/doc/current/security/impersonating_user.html
|
||||
# switch_user: true
|
||||
logout:
|
||||
path: front_user_logout
|
||||
|
||||
# where to redirect after logout
|
||||
target: general_home
|
||||
form_login:
|
||||
# "app_login" is the name of the route created previously
|
||||
login_path: front_user_login
|
||||
check_path: front_user_login
|
||||
enable_csrf: true
|
||||
|
||||
# Easy way to control access for large sections of your site
|
||||
# Note: Only the *first* access control that matches will be used
|
||||
|
@ -36,6 +46,8 @@ security:
|
|||
# - { path: ^/admin, roles: ROLE_ADMIN }
|
||||
- { path: ^/api/acc/*, roles: ROLE_USER }
|
||||
- { path: ^/api/app/*, roles: ROLE_USER }
|
||||
- { path: ^/api/admin/*, roles: ROLE_ADMIN }
|
||||
- { path: ^/app/*, roles: ROLE_ADMIN }
|
||||
when@test:
|
||||
security:
|
||||
password_hashers:
|
13
hesabixCore/config/packages/translation.yaml
Normal file
13
hesabixCore/config/packages/translation.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
framework:
|
||||
default_locale: fa
|
||||
translator:
|
||||
default_path: '%kernel.project_dir%/translations'
|
||||
fallbacks:
|
||||
- fa
|
||||
# providers:
|
||||
# crowdin:
|
||||
# dsn: '%env(CROWDIN_DSN)%'
|
||||
# loco:
|
||||
# dsn: '%env(LOCO_DSN)%'
|
||||
# lokalise:
|
||||
# dsn: '%env(LOKALISE_DSN)%'
|
13
hesabixCore/config/packages/twig.yaml
Normal file
13
hesabixCore/config/packages/twig.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
twig:
|
||||
default_path: '%kernel.project_dir%/templates'
|
||||
form_themes: [
|
||||
'bootstrap_5_layout.html.twig',
|
||||
'form/captcha.html.twig'
|
||||
]
|
||||
globals:
|
||||
Jdate: "@Jdate"
|
||||
Blog: "@Blog"
|
||||
twigFunctions: "@twigFunctions"
|
||||
when@test:
|
||||
twig:
|
||||
strict_variables: true
|
13
hesabixCore/config/packages/validator.yaml
Normal file
13
hesabixCore/config/packages/validator.yaml
Normal file
|
@ -0,0 +1,13 @@
|
|||
framework:
|
||||
validation:
|
||||
email_validation_mode: html5
|
||||
|
||||
# Enables validator auto-mapping support.
|
||||
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
|
||||
#auto_mapping:
|
||||
# App\Entity\: []
|
||||
|
||||
when@test:
|
||||
framework:
|
||||
validation:
|
||||
not_compromised_password: false
|
17
hesabixCore/config/packages/web_profiler.yaml
Normal file
17
hesabixCore/config/packages/web_profiler.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
when@dev:
|
||||
web_profiler:
|
||||
toolbar: true
|
||||
intercept_redirects: false
|
||||
|
||||
framework:
|
||||
profiler:
|
||||
only_exceptions: false
|
||||
collect_serializer_data: true
|
||||
|
||||
when@test:
|
||||
web_profiler:
|
||||
toolbar: false
|
||||
intercept_redirects: false
|
||||
|
||||
framework:
|
||||
profiler: { collect: false }
|
45
hesabixCore/config/packages/webpack_encore.yaml
Normal file
45
hesabixCore/config/packages/webpack_encore.yaml
Normal file
|
@ -0,0 +1,45 @@
|
|||
webpack_encore:
|
||||
# The path where Encore is building the assets - i.e. Encore.setOutputPath()
|
||||
output_path: '%kernel.project_dir%/public/build'
|
||||
# If multiple builds are defined (as shown below), you can disable the default build:
|
||||
# output_path: false
|
||||
|
||||
# Set attributes that will be rendered on all script and link tags
|
||||
script_attributes:
|
||||
defer: true
|
||||
# Uncomment (also under link_attributes) if using Turbo Drive
|
||||
# https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change
|
||||
# 'data-turbo-track': reload
|
||||
# link_attributes:
|
||||
# Uncomment if using Turbo Drive
|
||||
# 'data-turbo-track': reload
|
||||
|
||||
# If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
|
||||
# crossorigin: 'anonymous'
|
||||
|
||||
# Preload all rendered script and link tags automatically via the HTTP/2 Link header
|
||||
# preload: true
|
||||
|
||||
# Throw an exception if the entrypoints.json file is missing or an entry is missing from the data
|
||||
# strict_mode: false
|
||||
|
||||
# If you have multiple builds:
|
||||
# builds:
|
||||
# frontend: '%kernel.project_dir%/public/frontend/build'
|
||||
|
||||
# pass the build name as the 3rd argument to the Twig functions
|
||||
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}
|
||||
|
||||
framework:
|
||||
assets:
|
||||
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
|
||||
|
||||
#when@prod:
|
||||
# webpack_encore:
|
||||
# # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
|
||||
# # Available in version 1.2
|
||||
# cache: true
|
||||
|
||||
#when@test:
|
||||
# webpack_encore:
|
||||
# strict_mode: false
|
8
hesabixCore/config/routes/web_profiler.yaml
Normal file
8
hesabixCore/config/routes/web_profiler.yaml
Normal file
|
@ -0,0 +1,8 @@
|
|||
when@dev:
|
||||
web_profiler_wdt:
|
||||
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
|
||||
prefix: /_wdt
|
||||
|
||||
web_profiler_profiler:
|
||||
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
|
||||
prefix: /_profiler
|
|
@ -4,7 +4,7 @@
|
|||
# Put parameters here that don't need to change on each machine where the app is deployed
|
||||
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
|
||||
parameters:
|
||||
|
||||
blogMediaDir: '%kernel.project_dir%/../public_html/blog/media'
|
||||
services:
|
||||
# default configuration for services in *this* file
|
||||
_defaults:
|
||||
|
@ -22,3 +22,23 @@ services:
|
|||
|
||||
# add more service definitions when explicit configuration is needed
|
||||
# please note that last definitions always *replace* previous ones
|
||||
Jdate:
|
||||
class: App\Service\Jdate
|
||||
Log:
|
||||
class: App\Service\Log
|
||||
arguments: [ "@doctrine.orm.entity_manager" ]
|
||||
SMS:
|
||||
class: App\Service\SMS
|
||||
arguments:
|
||||
$entityManager: "@doctrine.orm.entity_manager"
|
||||
Provider:
|
||||
class: App\Service\Provider
|
||||
arguments: [ "@doctrine.orm.entity_manager" ]
|
||||
Blog:
|
||||
class: App\Service\Blog
|
||||
arguments: [ "@doctrine.orm.entity_manager" ]
|
||||
twigFunctions:
|
||||
class: App\Service\twigFunctions
|
||||
Access:
|
||||
class: App\Service\Access
|
||||
arguments: [ "@doctrine.orm.entity_manager","@Symfony.Component.Security.Core.Authentication.Token.Storage.TokenStorageInterface","@Symfony.Component.HttpFoundation.RequestStack" ]
|
12
hesabixCore/docker-compose.override.yml
Normal file
12
hesabixCore/docker-compose.override.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
services:
|
||||
###> doctrine/doctrine-bundle ###
|
||||
database:
|
||||
ports:
|
||||
- "5432"
|
||||
###< doctrine/doctrine-bundle ###
|
||||
|
||||
###> symfony/mailer ###
|
||||
mailer:
|
||||
image: schickling/mailcatcher
|
||||
ports: ["1025", "1080"]
|
||||
###< symfony/mailer ###
|
|
@ -1,5 +1,3 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
###> doctrine/doctrine-bundle ###
|
||||
database:
|
||||
|
@ -10,12 +8,12 @@ services:
|
|||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-app}
|
||||
volumes:
|
||||
- db-data:/var/lib/postgresql/data:rw
|
||||
- database_data:/var/lib/postgresql/data:rw
|
||||
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
|
||||
# - ./docker/db/data:/var/lib/postgresql/data:rw
|
||||
###< doctrine/doctrine-bundle ###
|
||||
|
||||
volumes:
|
||||
###> doctrine/doctrine-bundle ###
|
||||
db-data:
|
||||
database_data:
|
||||
###< doctrine/doctrine-bundle ###
|
8
hesabixCore/migrations/.idea/.gitignore
vendored
Normal file
8
hesabixCore/migrations/.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
4
hesabixCore/migrations/.idea/deployment.xml
Normal file
4
hesabixCore/migrations/.idea/deployment.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PublishConfigData" serverName="localhost" />
|
||||
</project>
|
51
hesabixCore/migrations/.idea/hesabixCore.iml
Normal file
51
hesabixCore/migrations/.idea/hesabixCore.iml
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="App\" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="App\Tests\" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/var" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/maker-bundle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/inflector" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/security-bundle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/property-access" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/property-info" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/password-hasher" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/security-csrf" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/security-core" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/security-http" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/event-manager" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/dbal" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/orm" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/deprecations" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/lexer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/sql-formatter" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/doctrine-bundle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/common" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/collections" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/migrations" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/instantiator" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/persistence" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/doctrine-migrations-bundle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/doctrine-bridge" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/stopwatch" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/laminas/laminas-code" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/friendsofphp/proxy-manager-lts" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfonycasts/verify-email-bundle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nelmio/cors-bundle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/annotations" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/serializer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpstan/phpdoc-parser" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpdocumentor/type-resolver" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpdocumentor/reflection-docblock" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpdocumentor/reflection-common" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/webmozart/assert" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/apache-pack" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
8
hesabixCore/migrations/.idea/modules.xml
Normal file
8
hesabixCore/migrations/.idea/modules.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/hesabixCore.iml" filepath="$PROJECT_DIR$/.idea/hesabixCore.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
100
hesabixCore/migrations/.idea/php.xml
Normal file
100
hesabixCore/migrations/.idea/php.xml
Normal file
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCSFixerOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpIncludePathManager">
|
||||
<include_path>
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-normalizer" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/filesystem" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/dotenv" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/deprecation-contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/dependency-injection" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/http-foundation" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/config" />
|
||||
<path value="$PROJECT_DIR$/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher-contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-grapheme" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/yaml" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/cache" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/runtime" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/http-kernel" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/finder" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/var-exporter" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/container" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/string" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/cache" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/service-contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/event-dispatcher" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/log" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/var-dumper" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/routing" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/error-handler" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/flex" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/cache-contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/console" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/framework-bundle" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/maker-bundle" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/inflector" />
|
||||
<path value="$PROJECT_DIR$/vendor/nikic/php-parser" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/security-bundle" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/property-access" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/property-info" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/password-hasher" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/security-csrf" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/security-core" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/security-http" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/cache" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/event-manager" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/dbal" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/orm" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/deprecations" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/lexer" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/sql-formatter" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/doctrine-bundle" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/common" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/collections" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/migrations" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/instantiator" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/persistence" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/doctrine-migrations-bundle" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/doctrine-bridge" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/stopwatch" />
|
||||
<path value="$PROJECT_DIR$/vendor/laminas/laminas-code" />
|
||||
<path value="$PROJECT_DIR$/vendor/friendsofphp/proxy-manager-lts" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfonycasts/verify-email-bundle" />
|
||||
<path value="$PROJECT_DIR$/vendor/nelmio/cors-bundle" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/annotations" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/serializer" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpstan/phpdoc-parser" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpdocumentor/type-resolver" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpdocumentor/reflection-docblock" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpdocumentor/reflection-common" />
|
||||
<path value="$PROJECT_DIR$/vendor/webmozart/assert" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/apache-pack" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.1">
|
||||
<option name="suggestChangeDefaultLanguageLevel" value="false" />
|
||||
</component>
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpUnit">
|
||||
<phpunit_settings>
|
||||
<PhpUnitSettings custom_loader_path="$PROJECT_DIR$/vendor/autoload.php" />
|
||||
</phpunit_settings>
|
||||
</component>
|
||||
<component name="PsalmOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
</project>
|
7
hesabixCore/migrations/.idea/symfony2.xml
Normal file
7
hesabixCore/migrations/.idea/symfony2.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Symfony2PluginSettings">
|
||||
<option name="pluginEnabled" value="true" />
|
||||
<option name="lastServiceGeneratorLanguage" value="yaml" />
|
||||
</component>
|
||||
</project>
|
6
hesabixCore/migrations/.idea/vcs.xml
Normal file
6
hesabixCore/migrations/.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
25773
hesabixCore/package-lock.json
generated
Normal file
25773
hesabixCore/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
31
hesabixCore/package.json
Normal file
31
hesabixCore/package.json
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.17.0",
|
||||
"@babel/preset-env": "^7.16.0",
|
||||
"@hotwired/stimulus": "^3.0.0",
|
||||
"@symfony/stimulus-bridge": "^3.2.0",
|
||||
"@symfony/stimulus-bundle": "file:vendor/symfony/stimulus-bundle/assets",
|
||||
"@symfony/ux-vue": "file:vendor/symfony/ux-vue/assets",
|
||||
"@symfony/webpack-encore": "^4.0.0",
|
||||
"core-js": "^3.23.0",
|
||||
"regenerator-runtime": "^0.13.9",
|
||||
"vue": "^3.0",
|
||||
"vue-loader": "^17.2.2",
|
||||
"webpack": "^5.74.0",
|
||||
"webpack-cli": "^4.10.0",
|
||||
"webpack-notifier": "^1.15.0"
|
||||
},
|
||||
"license": "UNLICENSED",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev-server": "encore dev-server",
|
||||
"dev": "encore dev",
|
||||
"watch": "encore dev --watch",
|
||||
"build": "encore production --progress"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.4.0",
|
||||
"sweetalert2": "^11.7.12",
|
||||
"vue-router": "^4.2.2"
|
||||
}
|
||||
}
|
42
hesabixCore/phpunit.xml.dist
Normal file
42
hesabixCore/phpunit.xml.dist
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
convertDeprecationsToExceptions="false"
|
||||
>
|
||||
<php>
|
||||
<ini name="display_errors" value="1" />
|
||||
<ini name="error_reporting" value="-1" />
|
||||
<server name="APP_ENV" value="test" force="true" />
|
||||
<server name="SHELL_VERBOSITY" value="-1" />
|
||||
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
|
||||
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Project Test Suite">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<coverage processUncoveredFiles="true">
|
||||
<include>
|
||||
<directory suffix=".php">src</directory>
|
||||
</include>
|
||||
</coverage>
|
||||
|
||||
<listeners>
|
||||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
|
||||
</listeners>
|
||||
|
||||
<!-- Run `composer require symfony/panther` before enabling this extension -->
|
||||
<!--
|
||||
<extensions>
|
||||
<extension class="Symfony\Component\Panther\ServerExtension" />
|
||||
</extensions>
|
||||
-->
|
||||
</phpunit>
|
14
hesabixCore/public/build/entrypoints.json
Normal file
14
hesabixCore/public/build/entrypoints.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"entrypoints": {
|
||||
"app": {
|
||||
"js": [
|
||||
"http://localhost:8080/build/runtime.js",
|
||||
"http://localhost:8080/build/vendors-node_modules_symfony_stimulus-bridge_dist_index_js-node_modules_core-js_modules_es_ar-728fb7.js",
|
||||
"http://localhost:8080/build/app.js"
|
||||
],
|
||||
"css": [
|
||||
"http://localhost:8080/build/app.css"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
8
hesabixCore/public/build/manifest.json
Normal file
8
hesabixCore/public/build/manifest.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"build/app.css": "http://localhost:8080/build/app.css",
|
||||
"build/app.js": "http://localhost:8080/build/app.js",
|
||||
"build/runtime.js": "http://localhost:8080/build/runtime.js",
|
||||
"build/vendors-node_modules_symfony_stimulus-bridge_dist_index_js-node_modules_core-js_modules_es_ar-d69614.js": "http://localhost:8080/build/vendors-node_modules_symfony_stimulus-bridge_dist_index_js-node_modules_core-js_modules_es_ar-d69614.js",
|
||||
"build/vendors-node_modules_symfony_stimulus-bridge_dist_index_js-node_modules_core-js_modules_es_ar-20f0d6.js": "http://localhost:8080/build/vendors-node_modules_symfony_stimulus-bridge_dist_index_js-node_modules_core-js_modules_es_ar-20f0d6.js",
|
||||
"build/vendors-node_modules_symfony_stimulus-bridge_dist_index_js-node_modules_core-js_modules_es_ar-728fb7.js": "http://localhost:8080/build/vendors-node_modules_symfony_stimulus-bridge_dist_index_js-node_modules_core-js_modules_es_ar-728fb7.js"
|
||||
}
|
71
hesabixCore/src/Controller/APIController.php
Normal file
71
hesabixCore/src/Controller/APIController.php
Normal file
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\APIToken;
|
||||
use App\Service\Access;
|
||||
use App\Service\Log;
|
||||
use App\Service\Provider;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class APIController extends AbstractController
|
||||
{
|
||||
|
||||
/**
|
||||
* function to generate random strings
|
||||
* @param int $length number of characters in the generated string
|
||||
* @return string a new string is created with random characters of the desired length
|
||||
*/
|
||||
private function RandomString($length = 32) {
|
||||
return substr(str_shuffle(str_repeat($x='23456789ABCDEFGHJKLMNPQRSTUVWXYZ', ceil($length/strlen($x)) )),1,$length);
|
||||
}
|
||||
|
||||
#[Route('/api/business/api/list', name: 'app_business_api_list')]
|
||||
public function app_business_api_list(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('owner');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$items = $entityManager->getRepository(APIToken::class)->findBy([
|
||||
'bid'=>$acc['bid'],
|
||||
]);
|
||||
return $this->json($provider->ArrayEntity2Array($items,1,['bid','submitter']));
|
||||
}
|
||||
|
||||
#[Route('/api/business/api/new', name: 'app_business_api_new')]
|
||||
public function app_business_api_new(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('owner');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$api = new APIToken();
|
||||
$api->setBid($acc['bid']);
|
||||
$api->setSubmitter($acc['user']);
|
||||
$api->setDateExpire(0);
|
||||
$api->setToken($this->RandomString(32));
|
||||
$entityManager->persist($api);
|
||||
$entityManager->flush();
|
||||
return $this->json($provider->Entity2Array($api,1,['bid','submitter']));
|
||||
}
|
||||
|
||||
#[Route('/api/business/api/remove/{token}', name: 'app_business_api_remove')]
|
||||
public function app_business_api_remove(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager , $token): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('owner');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$api = $entityManager->getRepository(APIToken::class)->findOneBy([
|
||||
'token'=>$token,
|
||||
'bid'=>$acc['bid']
|
||||
]);
|
||||
if(!$api) throw $this->createNotFoundException('API Token not found');
|
||||
$entityManager->remove($api);
|
||||
$entityManager->flush();
|
||||
return $this->json(['result'=>1]);
|
||||
}
|
||||
}
|
41
hesabixCore/src/Controller/AdminController.php
Normal file
41
hesabixCore/src/Controller/AdminController.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class AdminController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
#[Route('/api/admin/sync/database', name: 'app_admin_sync_database')]
|
||||
public function app_admin_sync_database(KernelInterface $kernel): JsonResponse
|
||||
{
|
||||
$application = new Application($kernel);
|
||||
$application->setAutoExit(false);
|
||||
|
||||
$input = new ArrayInput([
|
||||
'command' => 'doctrine:schema:update',
|
||||
// (optional) define the value of command arguments
|
||||
'--force' => true,
|
||||
'--complete' => true
|
||||
]);
|
||||
|
||||
// You can use NullOutput() if you don't need the output
|
||||
$output = new BufferedOutput();
|
||||
$application->run($input, $output);
|
||||
|
||||
// return the output, don't use if you used NullOutput()
|
||||
$content = $output->fetch();
|
||||
return $this->json([
|
||||
'message' => $content,
|
||||
]);
|
||||
}
|
||||
}
|
17
hesabixCore/src/Controller/AdsBanController.php
Normal file
17
hesabixCore/src/Controller/AdsBanController.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Service\pdfMGR;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class AdsBanController extends AbstractController
|
||||
{
|
||||
#[Route('/ads/ban', name: 'app_ads_ban')]
|
||||
public function index(pdfMGR $pdfMGR): JsonResponse
|
||||
{
|
||||
$pdfMGR->streamTwig2PDF('test.html.twig');
|
||||
}
|
||||
}
|
89
hesabixCore/src/Controller/BankController.php
Normal file
89
hesabixCore/src/Controller/BankController.php
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\BankAccount;
|
||||
use App\Service\Access;
|
||||
use App\Service\Log;
|
||||
use App\Service\Provider;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class BankController extends AbstractController
|
||||
{
|
||||
#[Route('/api/bank/list', name: 'app_bank_list')]
|
||||
public function app_bank_list(Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
if(!$access->hasRole('banks'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$data = $entityManager->getRepository(BankAccount::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid')
|
||||
]);
|
||||
return $this->json($data);
|
||||
}
|
||||
|
||||
#[Route('/api/bank/info/{code}', name: 'app_bank_info')]
|
||||
public function app_bank_info($code,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('banks');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$data = $entityManager->getRepository(BankAccount::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'code'=>$code
|
||||
]);
|
||||
return $this->json($data);
|
||||
}
|
||||
|
||||
#[Route('/api/bank/mod/{code}', name: 'app_bank_mod')]
|
||||
public function app_bank_mod(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,$code = 0): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('banks');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(!array_key_exists('name',$params))
|
||||
return $this->json(['result'=>-1]);
|
||||
if(count_chars(trim($params['name'])) == 0)
|
||||
return $this->json(['result'=>3]);
|
||||
if($code == 0){
|
||||
$data = $entityManager->getRepository(BankAccount::class)->findOneBy([
|
||||
'name'=>$params['name'],
|
||||
'bid' =>$acc['bid']
|
||||
]);
|
||||
//check exist before
|
||||
if($data)
|
||||
return $this->json(['result'=>2]);
|
||||
$data = new BankAccount();
|
||||
$data->setCode($provider->getAccountingCode($request->headers->get('activeBid'),'bank'));
|
||||
}
|
||||
else{
|
||||
$data = $entityManager->getRepository(BankAccount::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'code'=>$code
|
||||
]);
|
||||
if(!$data)
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
$data->setBid($acc['bid']);
|
||||
$data->setname($params['name']);
|
||||
$data->setDes($params['des']);
|
||||
$data->setOwner($params['owner']);
|
||||
$data->setAccountNum($params['accountNum']);
|
||||
$data->setCardNum($params['cardNum']);
|
||||
$data->setShaba($params['shaba']);
|
||||
$data->setShobe($params['shobe']);
|
||||
$data->setPosNum($params['posNum']);
|
||||
$data->setMobileInternetBank($params['mobileInternetbank']);
|
||||
$entityManager->persist($data);
|
||||
$entityManager->flush();
|
||||
$log->insert('بانک','حساب بانکی با نام ' . $params['name'] . ' افزوده/ویرایش شد.',$this->getUser(),$request->headers->get('activeBid'));
|
||||
return $this->json(['result' => 1]);
|
||||
}
|
||||
}
|
260
hesabixCore/src/Controller/BlogController.php
Normal file
260
hesabixCore/src/Controller/BlogController.php
Normal file
|
@ -0,0 +1,260 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\BlogCat;
|
||||
use App\Entity\BlogComment;
|
||||
use App\Entity\BlogPost;
|
||||
use App\Entity\StackCat;
|
||||
use App\Entity\StackContent;
|
||||
use App\Service\Jdate;
|
||||
use App\Service\Provider;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
class BlogController extends AbstractController
|
||||
{
|
||||
#[Route('/api/blog/cats/get', name: 'app_blog_get_cats')]
|
||||
public function app_blog_get_cats(SerializerInterface $serializer, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$result = [];
|
||||
$cats = $entityManager->getRepository(BlogCat::class)->findAll();
|
||||
foreach ($cats as $cat){
|
||||
$temp = [];
|
||||
$temp['id'] = $cat->getId();
|
||||
$temp['name'] = $cat->getLabel();
|
||||
$temp['code'] = $cat->getCode();
|
||||
$result[] = $temp;
|
||||
}
|
||||
return $this->json($result);
|
||||
}
|
||||
|
||||
#[Route('/api/blog/insert', name: 'app_blog_content_insert')]
|
||||
public function app_blog_content_insert(Request $request,SerializerInterface $serializer, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(array_key_exists('intro',$params) && array_key_exists('title',$params) && array_key_exists('cat',$params) && array_key_exists('body',$params )){
|
||||
$cat = $entityManager->getRepository(BlogCat::class)->find($params['cat']);
|
||||
$post = new BlogPost();
|
||||
$post->setBody($params['body']);
|
||||
$post->setCat($cat);
|
||||
$post->setIntero($params['intro']);
|
||||
$post->setImg($params['img']);
|
||||
$post->setTitle($params['title']);
|
||||
$post->setDateSubmit(time());
|
||||
$post->setViews(1);
|
||||
$post->setSubmitter($this->getUser());
|
||||
$post->setUrl(str_replace(' ','_',$params['title']));
|
||||
$entityManager->persist($post);
|
||||
$entityManager->flush();
|
||||
return $this->json([
|
||||
'error'=> 0,
|
||||
'message'=> 'ok',
|
||||
'url'=>$post->getUrl()
|
||||
]);
|
||||
}
|
||||
return $this->json([
|
||||
'error'=> 999,
|
||||
'message'=> 'تمام موارد لازم را وارد کنید.'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
* @throws \Doctrine\ORM\NoResultException
|
||||
*/
|
||||
#[Route('/api/blog/contents/search', name: 'app_blog_contents_get')]
|
||||
public function app_blog_contents_get(Jdate $jdate, Provider $provider,Request $request,SerializerInterface $serializer, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
$params = $provider->createSearchParams($request);
|
||||
$items = $entityManager->getRepository(BlogPost::class)->search($params);
|
||||
$response = [];
|
||||
foreach ($items as $item){
|
||||
$temp = [];
|
||||
$temp['id'] = $item->getId();
|
||||
$temp['title'] = $item->getTitle();
|
||||
$temp['intero'] = $item->getIntero();
|
||||
$temp['body'] = $item->getBody();
|
||||
$temp['submitter'] = $item->getSubmitter()->getFullName();
|
||||
$temp['dateSubmit'] = $jdate->pastTime($item->getDateSubmit());
|
||||
$temp['cat'] = $item->getCat()->getLabel();
|
||||
$temp['views'] = $item->getViews();
|
||||
$temp['url'] = $item->getUrl();
|
||||
$temp['img'] = $item->getImg();
|
||||
$response[] = $temp;
|
||||
}
|
||||
// calc has next page
|
||||
$nextPage = true;
|
||||
if((int)$provider->maxPages($params,$entityManager->getRepository(BlogPost::class)->getAllContentCount()) == $params['page'])
|
||||
$nextPage = false;
|
||||
return $this->json([
|
||||
'data'=>$response,
|
||||
'nextPage'=>$nextPage
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
* @throws \Doctrine\ORM\NoResultException
|
||||
*/
|
||||
#[Route('/api/blog/get/last', name: 'app_blog_get_last_posts')]
|
||||
public function app_blog_get_last_posts(Jdate $jdate, Provider $provider,Request $request,SerializerInterface $serializer, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
|
||||
$items = $entityManager->getRepository(BlogPost::class)->findLast();
|
||||
$response = [];
|
||||
foreach ($items as $item){
|
||||
$temp = [];
|
||||
$temp['id'] = $item->getId();
|
||||
$temp['title'] = $item->getTitle();
|
||||
$temp['intero'] = $item->getIntero();
|
||||
$temp['body'] = $item->getBody();
|
||||
$temp['submitter'] = $item->getSubmitter()->getFullName();
|
||||
$temp['dateSubmit'] = $jdate->pastTime($item->getDateSubmit());
|
||||
$temp['cat'] = $item->getCat()->getLabel();
|
||||
$temp['views'] = $item->getViews();
|
||||
$temp['url'] = $item->getUrl();
|
||||
$temp['img'] = $item->getImg();
|
||||
$response[] = $temp;
|
||||
}
|
||||
return $this->json([
|
||||
'data'=>$response,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
* @throws \Doctrine\ORM\NoResultException
|
||||
*/
|
||||
#[Route('/api/blog/post/get/{url}', name: 'app_blog_post_get')]
|
||||
public function app_blog_post_get($url,Jdate $jdate, Provider $provider,Request $request,SerializerInterface $serializer, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$post = $entityManager->getRepository(BlogPost::class)->findOneBy(['url'=>$url]);
|
||||
if(!$post)
|
||||
throw $this->createNotFoundException();
|
||||
$temp = [];
|
||||
$temp['id'] = $post->getId();
|
||||
$temp['title'] = $post->getTitle();
|
||||
$temp['intero'] = $post->getIntero();
|
||||
$temp['body'] = $post->getBody();
|
||||
$temp['submitter'] = $post->getSubmitter()->getFullName();
|
||||
$temp['dateSubmit'] = $jdate->pastTime($post->getDateSubmit());
|
||||
$temp['cat'] = $post->getCat()->getLabel();
|
||||
$temp['views'] = $post->getViews();
|
||||
$temp['url'] = $post->getUrl();
|
||||
$temp['img'] = $post->getImg();
|
||||
$post->setViews($post->getViews() + 1);
|
||||
$entityManager->persist($post);
|
||||
$entityManager->flush();
|
||||
return $this->json($temp);
|
||||
}
|
||||
|
||||
#[Route('/api/blog/comments/get/{url}', name: 'app_blog_comments_get')]
|
||||
public function app_blog_comments_get($url,Jdate $jdate, Provider $provider,Request $request,SerializerInterface $serializer, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$post = $entityManager->getRepository(BlogPost::class)->findOneBy(['url'=>$url]);
|
||||
if(!$post)
|
||||
throw $this->createNotFoundException();
|
||||
$comments = $entityManager->getRepository(BlogComment::class)->findBy(['post'=>$post]);
|
||||
$cmnts = [];
|
||||
foreach ($comments as $comment){
|
||||
$temp = [];
|
||||
$temp['id'] = $comment->getId();
|
||||
$temp['body'] = $comment->getBody();
|
||||
$temp['submitter'] = $comment->getSubmitter()->getFullName();
|
||||
$temp['dateSubmit'] = $jdate->pastTime($comment->getDateSubmit());
|
||||
$temp['hash_email'] = $comment->getSubmitter()->getEmail();
|
||||
$cmnts[] = $temp;
|
||||
}
|
||||
return $this->json($cmnts);
|
||||
}
|
||||
#[Route('/api/blog/comment/insert/{url}', name: 'app_blog_comment_insert')]
|
||||
public function app_blog_comment_insert($url,Jdate $jdate, Provider $provider,Request $request,SerializerInterface $serializer, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if($params['body']){
|
||||
|
||||
}
|
||||
$post = $entityManager->getRepository(BlogPost::class)->findOneBy(['url'=>$url]);
|
||||
if(!$post)
|
||||
throw $this->createNotFoundException();
|
||||
$comment = $entityManager->getRepository(BlogComment::class)->findOneBy(['post'=>$post,'submitter'=>$this->getUser()],['id'=>'DESC']);
|
||||
if($comment){
|
||||
if($comment->getDateSubmit() > time() - 350){
|
||||
//to many request
|
||||
return $this->json([
|
||||
'result'=>2
|
||||
]);
|
||||
}
|
||||
}
|
||||
$comment = new BlogComment();
|
||||
$comment->setDateSubmit(time());
|
||||
$comment->setSubmitter($this->getUser());
|
||||
$comment->setPost($post);
|
||||
$comment->setBody($params['body']);
|
||||
$entityManager->persist($comment);
|
||||
$entityManager->flush();
|
||||
$temp = [];
|
||||
$temp['id'] = $comment->getId();
|
||||
$temp['body'] = $comment->getBody();
|
||||
$temp['submitter'] = $comment->getSubmitter()->getFullName();
|
||||
$temp['dateSubmit'] = $jdate->pastTime($comment->getDateSubmit());
|
||||
$temp['hash_email'] = $comment->getSubmitter()->getEmail();
|
||||
return $this->json([
|
||||
'result'=>1,
|
||||
'data'=> $temp
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
* @throws \Doctrine\ORM\NoResultException
|
||||
*/
|
||||
#[Route('/api/admin/blog/posts', name: 'app_admin_posts_get')]
|
||||
public function app_admin_posts_get(Jdate $jdate, Provider $provider,Request $request,SerializerInterface $serializer, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
|
||||
$items = $entityManager->getRepository(BlogPost::class)->findAll();
|
||||
$response = [];
|
||||
foreach ($items as $item){
|
||||
$temp = [];
|
||||
$temp['id'] = $item->getId();
|
||||
$temp['title'] = $item->getTitle();
|
||||
$temp['submitter'] = $item->getSubmitter()->getFullName();
|
||||
$temp['views'] = $item->getViews();
|
||||
$temp['url'] = $item->getUrl();
|
||||
$response[] = $temp;
|
||||
}
|
||||
return $this->json($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Doctrine\ORM\NonUniqueResultException
|
||||
* @throws \Doctrine\ORM\NoResultException
|
||||
*/
|
||||
#[Route('/api/admin/blog/post/delete/{url}', name: 'app_admin_post_delete')]
|
||||
public function app_admin_post_delete($url,Jdate $jdate, Provider $provider,Request $request,SerializerInterface $serializer, EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$post = $entityManager->getRepository(BlogPost::class)->findOneBy(['url'=>$url]);
|
||||
if($post){
|
||||
$entityManager->remove($post);
|
||||
$entityManager->flush();
|
||||
}
|
||||
return $this->json(['result'=>1]);
|
||||
}
|
||||
|
||||
}
|
491
hesabixCore/src/Controller/BusinessController.php
Normal file
491
hesabixCore/src/Controller/BusinessController.php
Normal file
|
@ -0,0 +1,491 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\BankAccount;
|
||||
use App\Entity\Commodity;
|
||||
use App\Entity\HesabdariDoc;
|
||||
use App\Entity\HesabdariRow;
|
||||
use App\Entity\Money;
|
||||
use App\Entity\Permission;
|
||||
use App\Entity\Person;
|
||||
use App\Entity\Plugin;
|
||||
use App\Entity\User;
|
||||
use App\Entity\Business;
|
||||
use App\Entity\Year;
|
||||
use App\Service\Access;
|
||||
use App\Service\Jdate;
|
||||
use App\Service\Log;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
|
||||
use Symfony\Component\Security\Http\Attribute\CurrentUser;
|
||||
|
||||
class BusinessController extends AbstractController
|
||||
{
|
||||
#[Route('/api/business/list', name: 'api_bussiness_list')]
|
||||
public function api_bussiness_list(#[CurrentUser] ?User $user,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$buss = $entityManager->getRepository(Permission::class)->findBy(['user'=>$user]);
|
||||
$response = [];
|
||||
foreach ($buss as $bus){
|
||||
$temp = [];
|
||||
$temp['id'] = $bus->getBid()->getId();
|
||||
$temp['name'] = $bus->getBid()->getName();
|
||||
$temp['owner'] = $bus->getBid()->getOwner()->getFullName();
|
||||
$temp['legal_name'] = $bus->getBid()->getLegalName();
|
||||
$response[] = $temp;
|
||||
}
|
||||
|
||||
return $this->json($response);
|
||||
}
|
||||
|
||||
#[Route('/api/business/get/info/{bid}', name: 'api_business_get_info')]
|
||||
public function api_business_get_info($bid,#[CurrentUser] ?User $user,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$bus = $entityManager->getRepository(Business::class)->findOneBy(['id'=>$bid]);
|
||||
$response = [];
|
||||
$response['id'] = $bus->getId();
|
||||
$response['name'] = $bus->getName();
|
||||
$response['owner'] = $bus->getOwner()->getFullName();
|
||||
$response['legal_name'] = $bus->getLegalName();
|
||||
$response['field'] = $bus->getField();
|
||||
$response['shenasemeli'] = $bus->getShenasemeli();
|
||||
$response['codeeqtesadi'] = $bus->getCodeeghtesadi();
|
||||
$response['shomaresabt'] = $bus->getShomaresabt();
|
||||
$response['country'] = $bus->getCountry();
|
||||
$response['ostan'] = $bus->getOstan();
|
||||
$response['shahrestan'] = $bus->getShahrestan();
|
||||
$response['postalcode'] = $bus->getPostalcode();
|
||||
$response['tel'] = $bus->getTel();
|
||||
$response['mobile'] = $bus->getMobile();
|
||||
$response['address'] = $bus->getAddress();
|
||||
$response['website'] = $bus->getWesite();
|
||||
$response['email'] = $bus->getEmail();
|
||||
$response['maliyatafzode'] = $bus->getMaliyatafzode();
|
||||
$response['arzmain'] = $bus->getMoney()->getName();
|
||||
$response['type'] = $bus->getType();
|
||||
|
||||
return $this->json($response);
|
||||
}
|
||||
|
||||
#[Route('/api/business/list/count', name: 'api_bussiness_list_count')]
|
||||
public function api_bussiness_list_count(#[CurrentUser] ?User $user,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$buss = $entityManager->getRepository(Permission::class)->findBy(['user'=>$user]);
|
||||
$response = ['count'=>count($buss)];
|
||||
return $this->json($response);
|
||||
}
|
||||
|
||||
#[Route('/api/business/insert', name: 'api_bussiness_insert')]
|
||||
public function api_bussiness_insert(Jdate $jdate, Access $access,Log $log,Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
//check for that data is set
|
||||
if(
|
||||
trim($params['name']) != '' &&
|
||||
trim($params['legal_name']) != '' &&
|
||||
trim($params['maliyatafzode']) != ''
|
||||
){
|
||||
//submit business
|
||||
$isNew = false;
|
||||
if(array_key_exists('bid',$params)){
|
||||
$business = $entityManager->getRepository(Business::class)->find($params['bid']);
|
||||
if(! $business) {
|
||||
return $this->json(['result'=>-1]);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$business = new Business();
|
||||
$business->setPersonCode(1000);
|
||||
$business->setBankCode(1000);
|
||||
$business->setReceiveCode(1000);
|
||||
$isNew = true;
|
||||
}
|
||||
if(!$isNew && !$access->hasRole('settings'))
|
||||
throw $this->createAccessDeniedException();
|
||||
//check for that user register business before
|
||||
$oldBid = $entityManager->getRepository(Business::class)->findOneBy(['owner'=>$this->getUser()],['id'=>'DESC']);
|
||||
if($oldBid && !$business->getId()){
|
||||
if($oldBid->getDateSubmit() > time()-86400){
|
||||
return $this->json(['result'=>3]);
|
||||
}
|
||||
}
|
||||
$business->setName($params['name']);
|
||||
$business->setOwner($this->getUser());
|
||||
$business->setLegalName($params['legal_name']);
|
||||
$business->setMaliyatafzode($params['maliyatafzode']);
|
||||
if($params['field'])
|
||||
$business->setField($params['field']);
|
||||
if($params['type'])
|
||||
$business->setType($params['type']);
|
||||
if($params['shenasemeli'])
|
||||
$business->setShenasemeli($params['shenasemeli']);
|
||||
if($params['codeeqtesadi'])
|
||||
$business->setCodeeghtesadi($params['codeeqtesadi']);
|
||||
if($params['shomaresabt'])
|
||||
$business->setShomaresabt($params['shomaresabt']);
|
||||
if($params['country'])
|
||||
$business->setCountry($params['country']);
|
||||
if($params['ostan'])
|
||||
$business->setOstan($params['ostan']);
|
||||
if($params['shahrestan'])
|
||||
$business->setShahrestan($params['shahrestan']);
|
||||
if($params['postalcode'])
|
||||
$business->setPostalcode($params['postalcode']);
|
||||
if($params['tel'])
|
||||
$business->setTel($params['tel']);
|
||||
if($params['mobile'])
|
||||
$business->setMobile($params['mobile']);
|
||||
if($params['address'])
|
||||
$business->setAddress($params['address']);
|
||||
if($params['website'])
|
||||
$business->setWesite($params['website']);
|
||||
if($params['email'])
|
||||
$business->setEmail($params['email']);
|
||||
//get Money type
|
||||
if($params['arzmain']){
|
||||
$Arzmain = $entityManager->getRepository(Money::class)->findOneBy(['name'=>$params['arzmain']]);
|
||||
if($Arzmain)
|
||||
$business->setMoney($Arzmain);
|
||||
else
|
||||
return $this->json(['result'=>2]);
|
||||
}
|
||||
else
|
||||
return $this->json(['result'=>2]);
|
||||
if(! $business->getDateSubmit()) $business->setDateSubmit(time());
|
||||
$entityManager->persist($business);
|
||||
$entityManager->flush();
|
||||
if($isNew){
|
||||
$perms = new Permission();
|
||||
$perms->setBid($business);
|
||||
$perms->setUser($this->getUser());
|
||||
$perms->setOwner(true);
|
||||
$perms->setSettings(true);
|
||||
$perms->setPerson(true);
|
||||
$perms->setGetpay(true);
|
||||
$perms->setCommodity(true);
|
||||
$perms->setBanks(true);
|
||||
$perms->setBankTransfer(true);
|
||||
$perms->setBuy(true);
|
||||
$perms->setSell(true);
|
||||
$perms->setCost(true);
|
||||
$perms->setIncome(true);
|
||||
$perms->setReport(true);
|
||||
$perms->setAccounting(true);
|
||||
$perms->setLog(true);
|
||||
$perms->setSalary(true);
|
||||
$perms->setPermission(true);
|
||||
$perms->setSalary(true);
|
||||
$perms->setCashdesk(true);
|
||||
$entityManager->persist($perms);
|
||||
$entityManager->flush();
|
||||
//active Year
|
||||
$year = new Year();
|
||||
$year->setBid($business);
|
||||
$year->setHead(true);
|
||||
$year->setStart(time());
|
||||
$year->setEnd(time() + 31536000);
|
||||
$year->setLabel('سال مالی منتهی به ' . $jdate->jdate('Y/n/d',time() + 31536000));
|
||||
$entityManager->persist($year);
|
||||
$entityManager->flush();
|
||||
}
|
||||
//add log to system
|
||||
$log->insert('تنظیمات پایه','اطلاعات کسب و کار ایجاد/ویرایش شد.',$this->getUser(),$business);
|
||||
}
|
||||
return $this->json(['result'=>1]);
|
||||
}
|
||||
|
||||
#[Route('/api/business/add/user', name: 'api_business_add_user')]
|
||||
public function api_business_add_user(Access $access,Log $log,Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if(!$access->hasRole('permission'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
//check for that data is set
|
||||
if(
|
||||
trim($params['bid']) != '' &&
|
||||
trim($params['email']) != ''
|
||||
){
|
||||
$business = $entityManager->getRepository(Business::class)->find($params['bid']);
|
||||
if(is_null($business)){
|
||||
return $this->json(['result'=>-1]);
|
||||
}
|
||||
//echo $params['email'];
|
||||
$user = $entityManager->getRepository(User::class)->findOneBy([
|
||||
'email' => $params['email']
|
||||
]);
|
||||
if(is_null($user)){
|
||||
return $this->json(['result'=>0]);
|
||||
}
|
||||
$perm = $entityManager->getRepository(Permission::class)->findOneBy([
|
||||
'user'=>$user,
|
||||
'bid'=>$business
|
||||
]);
|
||||
if($perm){
|
||||
//already added
|
||||
return $this->json(['result'=>1]);
|
||||
}
|
||||
$perm = new Permission();
|
||||
$perm->setBid($business);
|
||||
$perm->setUser($user);
|
||||
$perm->setOwner(false);
|
||||
$entityManager->persist($perm);
|
||||
$entityManager->flush();
|
||||
//add log to system
|
||||
$log->insert('تنظیمات پایه','کاربر با پست الکترونیکی ' . $params['email'] .' به کسب و کار اضافه شد.',$this->getUser(),$business);
|
||||
return $this->json(
|
||||
[
|
||||
'result'=>2,
|
||||
'data'=>[
|
||||
'email'=>$user->getEmail(),
|
||||
'name'=>$user->getFullName(),
|
||||
'owner'=>false
|
||||
]
|
||||
]);
|
||||
}
|
||||
return $this->json(['result'=>-1]);
|
||||
}
|
||||
|
||||
#[Route('/api/business/delete/user', name: 'api_business_delete_user')]
|
||||
public function api_business_delete_user(Access $access,Log $log,Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if(!$access->hasRole('permission'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
//check for that data is set
|
||||
if(
|
||||
trim($params['bid']) != '' &&
|
||||
trim($params['email']) != ''
|
||||
){
|
||||
$business = $entityManager->getRepository(Business::class)->find($params['bid']);
|
||||
if(is_null($business)){
|
||||
return $this->json(['result'=>-1]);
|
||||
}
|
||||
//echo $params['email'];
|
||||
$user = $entityManager->getRepository(User::class)->findOneBy([
|
||||
'email' => $params['email']
|
||||
]);
|
||||
if(is_null($user)){
|
||||
return $this->json(['result'=>-1]);
|
||||
}
|
||||
$perm = $entityManager->getRepository(Permission::class)->findOneBy([
|
||||
'user'=>$user
|
||||
]);
|
||||
if($perm && ! $perm->isOwner()){
|
||||
$entityManager->remove($perm);
|
||||
$entityManager->flush();
|
||||
//add log to system
|
||||
$log->insert('تنظیمات پایه','کاربر با پست الکترونیکی ' . $params['email'] .' از کسب و کار حذف شد.',$this->getUser(),$business);
|
||||
return $this->json(['result'=>1]);
|
||||
}
|
||||
}
|
||||
return $this->json(['result'=>-1]);
|
||||
}
|
||||
|
||||
#[Route('/api/business/get/user/permissions', name: 'api_business_get_user_permission')]
|
||||
public function api_business_get_user_permission(Log $log,Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
//check for that data is set
|
||||
if(
|
||||
trim($params['bid']) != '' &&
|
||||
trim($params['email']) != ''
|
||||
){
|
||||
$business = $entityManager->getRepository(Business::class)->find($params['bid']);
|
||||
if(is_null($business)){
|
||||
return $this->json(['result'=>-1]);
|
||||
}
|
||||
$user = $entityManager->getRepository(User::class)->findOneBy([
|
||||
'email' => $params['email']
|
||||
]);
|
||||
if(is_null($user)){
|
||||
return $this->json(['result'=>-1]);
|
||||
}
|
||||
$perm = $entityManager->getRepository(Permission::class)->findOneBy([
|
||||
'bid'=>$business,
|
||||
'user'=>$user
|
||||
]);
|
||||
$result = [];
|
||||
if($business->getOwner() == $user){
|
||||
$result = [
|
||||
'id'=>$perm->getUser()->getId(),
|
||||
'user'=>$perm->getUser()->getFullName(),
|
||||
'email'=>$perm->getUser()->getEmail(),
|
||||
'settings'=>true,
|
||||
'persons'=>true,
|
||||
'commodity'=>true,
|
||||
'getpay'=>true,
|
||||
'bank'=>true,
|
||||
'bankTransfer'=>true,
|
||||
'cost'=>true,
|
||||
'income'=>true,
|
||||
'buy'=>true,
|
||||
'sell'=>true,
|
||||
'accounting'=>true,
|
||||
'report'=>true,
|
||||
'log'=>true,
|
||||
'permission'=>true,
|
||||
'salary'=>true,
|
||||
'cashdesk'=>true,
|
||||
'plugNoghreAdmin'=>true,
|
||||
'plugNoghreSell'=>true,
|
||||
'plugCCAdmin'=>true,
|
||||
'owner'=> true,
|
||||
'active'=> $perm->getUser()->isActive()
|
||||
];
|
||||
}
|
||||
elseif($perm){
|
||||
$result = [
|
||||
'id'=>$perm->getUser()->getId(),
|
||||
'user'=>$perm->getUser()->getFullName(),
|
||||
'email'=>$perm->getUser()->getEmail(),
|
||||
'settings'=>$perm->isSettings(),
|
||||
'persons'=>$perm->isPerson(),
|
||||
'commodity'=>$perm->isCommodity(),
|
||||
'getpay'=>$perm->isGetpay(),
|
||||
'bank'=>$perm->isBanks(),
|
||||
'bankTransfer'=>$perm->isBankTransfer(),
|
||||
'cost'=>$perm->isCost(),
|
||||
'income'=>$perm->isIncome(),
|
||||
'buy'=>$perm->isBuy(),
|
||||
'sell'=>$perm->isSell(),
|
||||
'accounting'=>$perm->isAccounting(),
|
||||
'report'=>$perm->isReport(),
|
||||
'log'=>$perm->isLog(),
|
||||
'permission'=>$perm->isPermission(),
|
||||
'salary'=>$perm->isSalary(),
|
||||
'cashdesk'=>$perm->isCashdesk(),
|
||||
'plugNoghreAdmin'=>$perm->isPlugNoghreAdmin(),
|
||||
'plugNoghreSell'=>$perm->isPlugNoghreSell(),
|
||||
'plugCCAdmin'=>$perm->isPlugCCAdmin(),
|
||||
'owner'=> false,
|
||||
'active'=> $perm->getUser()->isActive()
|
||||
];
|
||||
}
|
||||
return $this->json($result);
|
||||
}
|
||||
return $this->json(['result'=>-1]);
|
||||
}
|
||||
|
||||
#[Route('/api/business/save/user/permissions', name: 'api_business_save_user_permission')]
|
||||
public function api_business_save_user_permission(Access $access,Log $log,Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if(!$access->hasRole('permission'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
//check for that data is set
|
||||
if(
|
||||
trim($params['bid']) != '' &&
|
||||
trim($params['email']) != ''
|
||||
){
|
||||
$business = $entityManager->getRepository(Business::class)->find($params['bid']);
|
||||
if(is_null($business)){
|
||||
return $this->json(['result'=>-1]);
|
||||
}
|
||||
$user = $entityManager->getRepository(User::class)->findOneBy([
|
||||
'email' => $params['email']
|
||||
]);
|
||||
if(is_null($user)){
|
||||
return $this->json(['result'=>-1]);
|
||||
}
|
||||
$perm = $entityManager->getRepository(Permission::class)->findOneBy([
|
||||
'bid'=>$business,
|
||||
'user'=>$user
|
||||
]);
|
||||
if($perm){
|
||||
$perm->setSettings($params['settings']);
|
||||
$perm->setPerson($params['persons']);
|
||||
$perm->setGetpay($params['getpay']);
|
||||
$perm->setCommodity($params['commodity']);
|
||||
$perm->setBanks($params['bank']);
|
||||
$perm->setBankTransfer($params['bankTransfer']);
|
||||
$perm->setbuy($params['buy']);
|
||||
$perm->setSell($params['sell']);
|
||||
$perm->setCost($params['cost']);
|
||||
$perm->setIncome($params['income']);
|
||||
$perm->setAccounting($params['accounting']);
|
||||
$perm->setReport($params['report']);
|
||||
$perm->setPermission($params['permission']);
|
||||
$perm->setSalary($params['salary']);
|
||||
$perm->setCashdesk($params['cashdesk']);
|
||||
$perm->setPlugNoghreAdmin($params['plugNoghreAdmin']);
|
||||
$perm->setPlugNoghreSell($params['plugNoghreSell']);
|
||||
$perm->setPlugCCAdmin($params['plugCCAdmin']);
|
||||
$perm->setLog($params['log']);
|
||||
$entityManager->persist($perm);
|
||||
$entityManager->flush();
|
||||
$log->insert('تنظیمات پایه','ویرایش دسترسیهای کاربر با پست الکترونیکی ' . $user->getEmail() ,$this->getUser(),$business);
|
||||
|
||||
return $this->json(['result'=>1]);
|
||||
}
|
||||
}
|
||||
return $this->json(['result'=>-1]);
|
||||
}
|
||||
|
||||
#[Route('/api/business/stat', name: 'api_business_stat')]
|
||||
public function api_business_stat(Request $request,#[CurrentUser] ?User $user,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$buss = $entityManager->getRepository(Business::class)->find(
|
||||
$request->headers->get('activeBid')
|
||||
);
|
||||
if(!$buss)
|
||||
throw $this->createNotFoundException();
|
||||
|
||||
$year = $entityManager->getRepository(Year::class)->find(
|
||||
$request->headers->get('activeYear')
|
||||
);
|
||||
if(!$year)
|
||||
throw $this->createNotFoundException();
|
||||
$persons = $entityManager->getRepository(Person::class)->findBy([
|
||||
'bid'=>$buss
|
||||
]);
|
||||
$banks = $entityManager->getRepository(BankAccount::class)->findBy([
|
||||
'bid'=>$buss
|
||||
]);
|
||||
|
||||
$docs = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||
'bid'=>$buss
|
||||
]);
|
||||
|
||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
'bid'=>$buss,
|
||||
'year'=>$year
|
||||
]);
|
||||
$bssum = 0;
|
||||
foreach ($rows as $row)
|
||||
$bssum += $row->getBs();
|
||||
|
||||
$response = [
|
||||
'personCount'=>count($persons),
|
||||
'bankCount'=>count($banks),
|
||||
'docCount'=>count($docs),
|
||||
'income'=> $bssum,
|
||||
'commodity'=>count($entityManager->getRepository(Commodity::class)->findby([
|
||||
'bid'=>$buss
|
||||
]))
|
||||
];
|
||||
|
||||
return $this->json($response);
|
||||
}
|
||||
}
|
83
hesabixCore/src/Controller/CashdeskController.php
Normal file
83
hesabixCore/src/Controller/CashdeskController.php
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Cashdesk;
|
||||
use App\Service\Access;
|
||||
use App\Service\Log;
|
||||
use App\Service\Provider;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class CashdeskController extends AbstractController
|
||||
{
|
||||
#[Route('/api/cashdesk/list', name: 'app_cashdesk_list')]
|
||||
public function app_cashdesk_list(Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
if(!$access->hasRole('cashdesk'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$data = $entityManager->getRepository(Cashdesk::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid')
|
||||
]);
|
||||
return $this->json($data);
|
||||
}
|
||||
|
||||
#[Route('/api/cashdesk/info/{code}', name: 'app_cashdesk_info')]
|
||||
public function app_cashdesk_info($code,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('cashdesk');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$data = $entityManager->getRepository(Cashdesk::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'code'=>$code
|
||||
]);
|
||||
return $this->json($data);
|
||||
}
|
||||
|
||||
#[Route('/api/cashdesk/mod/{code}', name: 'app_cashdesk_mod')]
|
||||
public function app_cashdesk_mod(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,$code = 0): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('cashdesk');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(!array_key_exists('name',$params))
|
||||
return $this->json(['result'=>-1]);
|
||||
if(count_chars(trim($params['name'])) == 0)
|
||||
return $this->json(['result'=>3]);
|
||||
if($code == 0){
|
||||
$data = $entityManager->getRepository(Cashdesk::class)->findOneBy([
|
||||
'name'=>$params['name'],
|
||||
'bid' =>$acc['bid']
|
||||
]);
|
||||
//check exist before
|
||||
if($data)
|
||||
return $this->json(['result'=>2]);
|
||||
$data = new Cashdesk();
|
||||
$data->setCode($provider->getAccountingCode($request->headers->get('activeBid'),'cashdesk'));
|
||||
}
|
||||
else{
|
||||
$data = $entityManager->getRepository(Cashdesk::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'code'=>$code
|
||||
]);
|
||||
if(!$data)
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
$data->setBid($acc['bid']);
|
||||
$data->setname($params['name']);
|
||||
$data->setDes($params['des']);
|
||||
$entityManager->persist($data);
|
||||
$entityManager->flush();
|
||||
$log->insert('بانکداری',' صندوق با نام ' . $params['name'] . ' افزوده/ویرایش شد.',$this->getUser(),$request->headers->get('activeBid'));
|
||||
return $this->json(['result' => 1]);
|
||||
}
|
||||
}
|
103
hesabixCore/src/Controller/CommodityController.php
Normal file
103
hesabixCore/src/Controller/CommodityController.php
Normal file
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Commodity;
|
||||
use App\Entity\CommodityUnit;
|
||||
use App\Service\Access;
|
||||
use App\Service\Log;
|
||||
use App\Service\Provider;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class CommodityController extends AbstractController
|
||||
{
|
||||
#[Route('/api/commodity/list', name: 'app_commodity_list')]
|
||||
public function app_commodity_list(Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
if(!$access->hasRole('commodity'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$items = $entityManager->getRepository(Commodity::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid')
|
||||
]);
|
||||
foreach ($items as $item){
|
||||
$item->setUnit($item->getUnit()->getName());
|
||||
}
|
||||
return $this->json($items);
|
||||
}
|
||||
|
||||
#[Route('/api/commodity/info/{code}', name: 'app_commodity_info')]
|
||||
public function app_commodity_info($code,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('commodity');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$data = $entityManager->getRepository(Commodity::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'code'=>$code
|
||||
]);
|
||||
$data->setUnit($data->getUnit()->getName());
|
||||
return $this->json($data);
|
||||
}
|
||||
|
||||
#[Route('/api/commodity/mod/{code}', name: 'app_commodity_mod')]
|
||||
public function app_commodity_mod(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,$code = 0): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('commodity');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(!array_key_exists('name',$params))
|
||||
return $this->json(['result'=>-1]);
|
||||
if(count_chars(trim($params['name'])) == 0)
|
||||
return $this->json(['result'=>3]);
|
||||
if($code == 0){
|
||||
$data = $entityManager->getRepository(Commodity::class)->findOneBy([
|
||||
'name'=>$params['name']
|
||||
]);
|
||||
//check exist before
|
||||
if($data)
|
||||
return $this->json(['result'=>2]);
|
||||
$data = new Commodity();
|
||||
$data->setCode($provider->getAccountingCode($request->headers->get('activeBid'),'Commodity'));
|
||||
}
|
||||
else{
|
||||
$data = $entityManager->getRepository(Commodity::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'code'=>$code
|
||||
]);
|
||||
if(!$data)
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
$unit = $entityManager->getRepository(CommodityUnit::class)->findOneBy(['name'=>$params['unit']]);
|
||||
if(!$unit)
|
||||
throw $this->createNotFoundException('unit not fount!');
|
||||
$data->setUnit($unit);
|
||||
$data->setBid($acc['bid']);
|
||||
$data->setname($params['name']);
|
||||
$data->setDes($params['des']);
|
||||
$data->setPriceSell($params['priceSell']);
|
||||
$data->setPriceBuy($params['priceBuy']);
|
||||
$entityManager->persist($data);
|
||||
$entityManager->flush();
|
||||
$log->insert('کالا و خدمات','کالا / خدمات با نام ' . $params['name'] . ' افزوده/ویرایش شد.',$this->getUser(),$request->headers->get('activeBid'));
|
||||
return $this->json(['result' => 1]);
|
||||
}
|
||||
|
||||
#[Route('/api/commodity/units', name: 'app_commodity_units')]
|
||||
public function app_commodity_units(Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
if(!$access->hasRole('commodity'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$items = $entityManager->getRepository(CommodityUnit::class)->findAll();
|
||||
return $this->json($items);
|
||||
}
|
||||
}
|
||||
|
12
hesabixCore/src/Controller/CostController.php
Normal file
12
hesabixCore/src/Controller/CostController.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class CostController extends AbstractController
|
||||
{
|
||||
|
||||
}
|
307
hesabixCore/src/Controller/Front/AppController.php
Normal file
307
hesabixCore/src/Controller/Front/AppController.php
Normal file
|
@ -0,0 +1,307 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller\Front;
|
||||
|
||||
use App\Entity\APIDocument;
|
||||
use App\Entity\ChangeReport;
|
||||
use App\Entity\GuideContent;
|
||||
use App\Entity\Support;
|
||||
use App\Form\APIDocumentType;
|
||||
use App\Form\GuideType;
|
||||
use App\Form\SupportType;
|
||||
use App\Form\UpdateListType;
|
||||
use App\Service\SMS;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class AppController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* @Route("/app/dashboard", name="app_front_dashboard")
|
||||
*/
|
||||
public function app_front_app(): Response
|
||||
{
|
||||
return $this->render('/app/dashboard.html.twig');
|
||||
}
|
||||
/**
|
||||
* @Route("/app/changes/list", name="app_front_changes_list")
|
||||
*/
|
||||
public function app_front_changes_list(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('/app/changes/list.html.twig',[
|
||||
'items'=>$entityManager->getRepository(ChangeReport::class)->findAll()
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* @Route("/app/changes/delete/{id}", name="app_front_changes_delete")
|
||||
*/
|
||||
public function app_front_changes_delete(String $id,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$item = $entityManager->getRepository(ChangeReport::class)->find($id);
|
||||
if($item){
|
||||
$entityManager->remove($item);
|
||||
$entityManager->flush();
|
||||
}
|
||||
return $this->redirectToRoute('app_front_changes_list');
|
||||
}
|
||||
/**
|
||||
* @Route("/app/changes/new", name="app_front_changes_new")
|
||||
*/
|
||||
public function app_front_changes_new(Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$change = new ChangeReport();
|
||||
$change->setDateSubmit(time());
|
||||
$form = $this->createForm(UpdateListType::class,$change,[]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($change);
|
||||
$entityManager->flush();
|
||||
return $this->redirectToRoute('app_front_changes_list');
|
||||
}
|
||||
return $this->render('/app/changes/new.html.twig',[
|
||||
'form'=>$form->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/changes/edit/{id}", name="app_front_changes_edit")
|
||||
*/
|
||||
public function app_front_changes_edit(string $id, Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$change = $entityManager->getRepository(ChangeReport::class)->find($id);
|
||||
if(!$change)
|
||||
throw $this->createNotFoundException();
|
||||
$change->setDateSubmit(time());
|
||||
$form = $this->createForm(UpdateListType::class,$change,[]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($change);
|
||||
$entityManager->flush();
|
||||
return $this->redirectToRoute('app_front_changes_list');
|
||||
}
|
||||
return $this->render('/app/changes/new.html.twig',[
|
||||
'form'=>$form->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/api/list", name="app_front_api_list")
|
||||
*/
|
||||
public function app_front_api_list(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('/app/api/list.html.twig',[
|
||||
'items'=>$entityManager->getRepository(APIDocument::class)->findAll()
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* @Route("/app/api/new", name="app_front_api_new")
|
||||
*/
|
||||
public function app_front_api_new(Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$item = new APIDocument();
|
||||
$form = $this->createForm(APIDocumentType::class,$item,[]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($item);
|
||||
$entityManager->flush();
|
||||
return $this->redirectToRoute('app_front_api_list');
|
||||
}
|
||||
return $this->render('/app/api/new.html.twig',[
|
||||
'form'=>$form->createView()
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* @Route("/app/api/edit/{id}", name="app_front_api_edit")
|
||||
*/
|
||||
public function app_front_api_edit(Request $request,EntityManagerInterface $entityManager,string $id): Response
|
||||
{
|
||||
$item = $entityManager->getRepository(APIDocument::class)->find($id);
|
||||
if(!$item)
|
||||
throw $this->createNotFoundException();
|
||||
|
||||
$form = $this->createForm(APIDocumentType::class,$item,[]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$entityManager->persist($item);
|
||||
$entityManager->flush();
|
||||
return $this->redirectToRoute('app_front_api_list');
|
||||
}
|
||||
return $this->render('/app/api/new.html.twig',[
|
||||
'form'=>$form->createView()
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* @Route("/app/api/delete/{id}", name="app_front_api_delete")
|
||||
*/
|
||||
public function app_front_api_delete(String $id,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$item = $entityManager->getRepository(APIDocument::class)->find($id);
|
||||
if($item){
|
||||
if( $item->getId() != 1){
|
||||
$entityManager->remove($item);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
}
|
||||
return $this->redirectToRoute('app_front_api_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/guide/list", name="app_front_guide_list")
|
||||
*/
|
||||
public function app_front_guide_list(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('/app/guide/list.html.twig',[
|
||||
'items'=>$entityManager->getRepository(GuideContent::class)->findAll()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/guide/delete/{id}", name="app_front_guide_delete")
|
||||
*/
|
||||
public function app_front_guide_delete(String $id,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$item = $entityManager->getRepository(GuideContent::class)->find($id);
|
||||
if($item){
|
||||
$entityManager->remove($item);
|
||||
$entityManager->flush();
|
||||
}
|
||||
return $this->redirectToRoute('app_front_guide_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/guide/new", name="app_front_guide_new")
|
||||
*/
|
||||
public function app_front_guide_new(Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$item = new GuideContent();
|
||||
$form = $this->createForm(GuideType::class,$item,[]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$item->setDateSubmit(time());
|
||||
$item->setUrl(0);
|
||||
$item->setSubmiter($this->getUser());
|
||||
$entityManager->persist($item);
|
||||
$entityManager->flush();
|
||||
return $this->redirectToRoute('app_front_guide_list');
|
||||
}
|
||||
return $this->render('/app/guide/new.html.twig',[
|
||||
'form'=>$form->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/guide/edit/{id}", name="app_front_guide_edit")
|
||||
*/
|
||||
public function app_front_guide_edit(string $id, Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$item = $entityManager->getRepository(GuideContent::class)->find($id);
|
||||
if(!$item)
|
||||
throw $this->createNotFoundException();
|
||||
$form = $this->createForm(GuideType::class,$item,[]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$item->setDateSubmit(time());
|
||||
$item->setUrl(0);
|
||||
$item->setSubmiter($this->getUser());
|
||||
$entityManager->persist($item);
|
||||
$entityManager->flush();
|
||||
return $this->redirectToRoute('app_front_guide_list');
|
||||
}
|
||||
return $this->render('/app/guide/new.html.twig',[
|
||||
'form'=>$form->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
#[Route('/app/database/sync', name: 'app_front_sync_database')]
|
||||
public function app_front_sync_database(KernelInterface $kernel): Response
|
||||
{
|
||||
$application = new Application($kernel);
|
||||
$application->setAutoExit(false);
|
||||
|
||||
$input = new ArrayInput([
|
||||
'command' => 'doctrine:schema:update',
|
||||
// (optional) define the value of command arguments
|
||||
'--force' => true,
|
||||
'--complete' => true
|
||||
]);
|
||||
|
||||
// You can use NullOutput() if you don't need the output
|
||||
$output = new BufferedOutput();
|
||||
$application->run($input, $output);
|
||||
|
||||
// return the output, don't use if you used NullOutput()
|
||||
$content = $output->fetch();
|
||||
return $this->render('/app/sync-database.html.twig',[
|
||||
'content'=>$content
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/support/list", name="app_front_support_list")
|
||||
*/
|
||||
public function app_front_support_list(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('/app/support/list.html.twig',[
|
||||
'items'=>$entityManager->getRepository(Support::class)->findBy([
|
||||
'main' => 0
|
||||
],[
|
||||
'id'=>'DESC'
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/support/view/{id}", name="app_front_support_view")
|
||||
*/
|
||||
public function app_front_support_view(string $id,SMS $SMS,Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$item = $entityManager->getRepository(Support::class)->find($id);
|
||||
if(!$item) $this->createNotFoundException();
|
||||
|
||||
$support = new Support();
|
||||
$form = $this->createForm(SupportType::class,$support,[]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$support->setDateSubmit(time());
|
||||
$support->setTitle('0');
|
||||
$support->setState('0');
|
||||
$support->setMain($item->getId());
|
||||
$support->setSubmitter($this->getUser());
|
||||
$entityManager->persist($support);
|
||||
$entityManager->flush();
|
||||
$item->setState('پاسخ داده شده');
|
||||
$entityManager->persist($support);
|
||||
$entityManager->flush();
|
||||
//send sms to customer
|
||||
if($item->getSubmitter()->getMobile())
|
||||
$SMS->send([$item->getId()],'162251',$item->getSubmitter()->getMobile());
|
||||
}
|
||||
|
||||
return $this->render('/app/support/view.html.twig',[
|
||||
'item'=>$item,
|
||||
'replays'=>$entityManager->getRepository(Support::class)->findBy([
|
||||
'main'=>$item->getId()
|
||||
]),
|
||||
'form'=>$form->createView()
|
||||
]);
|
||||
}
|
||||
}
|
250
hesabixCore/src/Controller/Front/BlogController.php
Normal file
250
hesabixCore/src/Controller/Front/BlogController.php
Normal file
|
@ -0,0 +1,250 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller\Front;
|
||||
|
||||
use App\Entity\BlogComment;
|
||||
use App\Entity\BlogPost;
|
||||
use App\Form\BlogPostType;
|
||||
use App\Form\CommentType;
|
||||
use App\Service\Provider;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Symfony\Component\HttpFoundation\File\Exception\FileException;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\String\Slugger\SluggerInterface;
|
||||
|
||||
class BlogController extends AbstractController
|
||||
{
|
||||
#[Route('/front/blog/home/{page}', name: 'general_blog_home')]
|
||||
public function general_help_guide(Provider $provider,EntityManagerInterface $entityManager, String $page = '1'): Response
|
||||
{
|
||||
$items = $entityManager->getRepository(BlogPost::class)->search(['page'=>$page,'count'=>10]);
|
||||
$nextPage = true;
|
||||
if((int)($entityManager->getRepository(BlogPost::class)->getAllContentCount()/10) <= $page)
|
||||
$nextPage = false;
|
||||
return $this->render('blog/list.html.twig',[
|
||||
'items'=>$items,
|
||||
'nextPage'=>$nextPage,
|
||||
'page'=>$page
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/front/blog/post/{url}', name: 'general_blog_post')]
|
||||
public function general_blog_post(Request $request,EntityManagerInterface $entityManager, String $url): Response
|
||||
{
|
||||
$item = $entityManager->getRepository(BlogPost::class)->findOneBy(['url'=>$url]);
|
||||
if(!$item) $this->createNotFoundException();
|
||||
|
||||
$comment = new BlogComment();
|
||||
$form = $this->createForm(CommentType::class,$comment);
|
||||
$form->handleRequest($request);
|
||||
if($form->isSubmitted() && $form->isValid() && $this->getUser()){
|
||||
$oldComments = $entityManager->getRepository(BlogComment::class)->findBy([
|
||||
'submitter'=>$this->getUser()
|
||||
],['id'=>'DESC']);
|
||||
if(count($oldComments) == 0){
|
||||
$comment->setDateSubmit(time());
|
||||
$comment->setPost($item);
|
||||
$comment->setSubmitter($this->getUser());
|
||||
$entityManager->persist($comment);
|
||||
$entityManager->flush();
|
||||
$comment->setBody('');
|
||||
$form->addError(new FormError('دیدگاه شما ثبت شد بعد از تایید مدیر منتشر خواهد شد.'));
|
||||
}
|
||||
else{
|
||||
if($oldComments[0]->getDateSubmit() > time() + 300){
|
||||
$comment->setDateSubmit(time());
|
||||
$comment->setPost($item);
|
||||
$comment->setSubmitter($this->getUser());
|
||||
$entityManager->persist($comment);
|
||||
$entityManager->flush();
|
||||
$comment->setBody('');
|
||||
$form->addError(new FormError('دیدگاه شما ثبت شد بعد از تایید مدیر منتشر خواهد شد.'));
|
||||
}
|
||||
else{
|
||||
$form->addError(new FormError('شما اخیرا یک دیدگاه ارسال کرده اید. ۵ دقیقه دیگر مجددا سعی کنید.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->render('blog/post.html.twig',[
|
||||
'item'=>$item,
|
||||
'comments'=>$entityManager->getRepository(BlogComment::class)->findBy([
|
||||
'post'=>$item,
|
||||
'publish'=>true,
|
||||
],['id'=>'DESC']),
|
||||
'form'=>$form->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/blog/posts/list", name="app_front_blog_list")
|
||||
*/
|
||||
public function app_front_blog_list(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('/app/blog/posts.html.twig',[
|
||||
'items'=>$entityManager->getRepository(BlogPost::class)->findBy([],[
|
||||
'id'=>'DESC'
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/blog/post/new", name="app_front_blog_new")
|
||||
*/
|
||||
public function app_front_blog_new(SluggerInterface $slugger,Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$item = new BlogPost();
|
||||
$form = $this->createForm(BlogPostType::class,$item,[]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$brochureFile = $form->get('img')->getData();
|
||||
|
||||
// this condition is needed because the 'brochure' field is not required
|
||||
// so the PDF file must be processed only when a file is uploaded
|
||||
if ($brochureFile) {
|
||||
$originalFilename = pathinfo($brochureFile->getClientOriginalName(), PATHINFO_FILENAME);
|
||||
// this is needed to safely include the file name as part of the URL
|
||||
$safeFilename = $slugger->slug($originalFilename);
|
||||
$newFilename = $safeFilename . '-' . uniqid() . '.' . $brochureFile->guessExtension();
|
||||
|
||||
// Move the file to the directory where brochures are stored
|
||||
try {
|
||||
$brochureFile->move(
|
||||
$this->getParameter('blogMediaDir'),
|
||||
$newFilename
|
||||
);
|
||||
} catch (FileException $e) {
|
||||
// ... handle exception if something happens during file upload
|
||||
}
|
||||
|
||||
// updates the 'brochureFilename' property to store the PDF file name
|
||||
// instead of its contents
|
||||
$item->setImg($newFilename);
|
||||
}
|
||||
$item->setDateSubmit(time());
|
||||
$url = str_replace(' ','_',$item->getTitle());
|
||||
$check = $entityManager->getRepository(BlogPost::class)->findOneBy(['url'=>$url]);
|
||||
$item->setUrl($url);
|
||||
if($check){
|
||||
$item->setUrl($url . $url);
|
||||
}
|
||||
$item->setViews(0);
|
||||
$item->setSubmitter($this->getUser());
|
||||
$entityManager->persist($item);
|
||||
$entityManager->flush();
|
||||
return $this->redirectToRoute('app_front_blog_list');
|
||||
}
|
||||
return $this->render('/app/blog/new.html.twig',[
|
||||
'form'=>$form->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/blog/post/delete/{id}", name="app_front_blog_delete")
|
||||
*/
|
||||
public function app_front_blog_delete(String $id,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$item = $entityManager->getRepository(BlogPost::class)->find($id);
|
||||
if($item){
|
||||
$entityManager->remove($item);
|
||||
$entityManager->flush();
|
||||
}
|
||||
return $this->redirectToRoute('app_front_blog_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/blog/post/edit/{id}", name="app_front_blog_edit")
|
||||
*/
|
||||
public function app_front_blog_edit(String $id,SluggerInterface $slugger,Request $request,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$item = $entityManager->getRepository(BlogPost::class)->find($id);
|
||||
if(!$item) $this->createNotFoundException();
|
||||
$oldFileName = $item->getImg();
|
||||
$form = $this->createForm(BlogPostType::class,$item,[]);
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$brochureFile = $form->get('img')->getData();
|
||||
|
||||
// this condition is needed because the 'brochure' field is not required
|
||||
// so the PDF file must be processed only when a file is uploaded
|
||||
if ($brochureFile) {
|
||||
$originalFilename = pathinfo($brochureFile->getClientOriginalName(), PATHINFO_FILENAME);
|
||||
// this is needed to safely include the file name as part of the URL
|
||||
$safeFilename = $slugger->slug($originalFilename);
|
||||
$newFilename = $safeFilename . '-' . uniqid() . '.' . $brochureFile->guessExtension();
|
||||
|
||||
// Move the file to the directory where brochures are stored
|
||||
try {
|
||||
$brochureFile->move(
|
||||
$this->getParameter('blogMediaDir'),
|
||||
$newFilename
|
||||
);
|
||||
} catch (FileException $e) {
|
||||
// ... handle exception if something happens during file upload
|
||||
}
|
||||
|
||||
// updates the 'brochureFilename' property to store the PDF file name
|
||||
// instead of its contents
|
||||
$item->setImg($newFilename);
|
||||
}
|
||||
else{
|
||||
$item->setImg($oldFileName);
|
||||
}
|
||||
$entityManager->persist($item);
|
||||
$entityManager->flush();
|
||||
return $this->redirectToRoute('app_front_blog_list');
|
||||
}
|
||||
return $this->render('/app/blog/new.html.twig',[
|
||||
'form'=>$form->createView()
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/blog/comments/list", name="app_front_comments_list")
|
||||
*/
|
||||
public function app_front_comments_list(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('/app/blog/comments.html.twig',[
|
||||
'items'=>$entityManager->getRepository(BlogComment::class)->findBy([],[
|
||||
'id'=>'DESC'
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/blog/comment/delete/{id}", name="app_front_comment_delete")
|
||||
*/
|
||||
public function app_front_comment_delete(String $id,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$item = $entityManager->getRepository(BlogComment::class)->find($id);
|
||||
if($item){
|
||||
$entityManager->remove($item);
|
||||
$entityManager->flush();
|
||||
}
|
||||
return $this->redirectToRoute('app_front_comments_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/app/blog/comment/toggle/{id}", name="app_front_comment_toggle")
|
||||
*/
|
||||
public function app_front_comment_toggle(String $id,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$item = $entityManager->getRepository(BlogComment::class)->find($id);
|
||||
if($item){
|
||||
if($item->isPublish()){
|
||||
$item->setPublish(false);
|
||||
}
|
||||
else{
|
||||
$item->setPublish(true);
|
||||
}
|
||||
$entityManager->persist($item);
|
||||
$entityManager->flush();
|
||||
}
|
||||
return $this->redirectToRoute('app_front_comments_list');
|
||||
}
|
||||
}
|
23
hesabixCore/src/Controller/Front/GuideController.php
Normal file
23
hesabixCore/src/Controller/Front/GuideController.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller\Front;
|
||||
|
||||
use App\Entity\GuideContent;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class GuideController extends AbstractController
|
||||
{
|
||||
#[Route('/front/help/guide/{id}', name: 'general_help_guide')]
|
||||
public function general_help_guide(EntityManagerInterface $entityManager, String $id = 'general'): Response
|
||||
{
|
||||
$items = $entityManager->getRepository(GuideContent::class)->findBy(['cat'=>$id]);
|
||||
return $this->render('general/guide.html.twig',[
|
||||
'items'=>$items
|
||||
]);
|
||||
}
|
||||
}
|
109
hesabixCore/src/Controller/Front/UiGeneralController.php
Normal file
109
hesabixCore/src/Controller/Front/UiGeneralController.php
Normal file
|
@ -0,0 +1,109 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller\Front;
|
||||
|
||||
use App\Entity\APIDocument;
|
||||
use App\Entity\BlogPost;
|
||||
use App\Entity\Business;
|
||||
use App\Entity\ChangeReport;
|
||||
use App\Entity\HesabdariDoc;
|
||||
use App\Entity\PrinterQueue;
|
||||
use App\Entity\User;
|
||||
use App\Service\pdfMGR;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
|
||||
use Symfony\Component\Mailer\MailerInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Mime\Email;
|
||||
use App\Service\SMS;
|
||||
use Dompdf\Dompdf;
|
||||
|
||||
class UiGeneralController extends AbstractController
|
||||
{
|
||||
#[Route('/', name: 'general_home')]
|
||||
public function general_home(SMS $sms,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$busCount = count($entityManager->getRepository(Business::class)->findAll());
|
||||
$users = count($entityManager->getRepository(User::class)->findAll());
|
||||
$docs = count($entityManager->getRepository(HesabdariDoc::class)->findAll());
|
||||
$lastBusiness = $entityManager->getRepository(Business::class)->findLast();
|
||||
return $this->render('general/home.html.twig',[
|
||||
'business' => $busCount + 9405,
|
||||
'users' => $users + 25471,
|
||||
'docs' => $docs + 105412,
|
||||
'lastBusinessName' => $lastBusiness->getname(),
|
||||
'lastBusinessOwner' => $lastBusiness->getOwner()->getFullName(),
|
||||
'blogPosts'=> $entityManager->getRepository(BlogPost::class)->findBy([],['dateSubmit'=>'DESC'],3)
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/front/faq', name: 'general_faq')]
|
||||
public function general_faq(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('general/faq.html.twig',);
|
||||
}
|
||||
#[Route('/front/about', name: 'general_about')]
|
||||
public function general_about(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('general/about.html.twig',);
|
||||
}
|
||||
#[Route('/front/contact', name: 'general_contact')]
|
||||
public function general_contact(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('general/contact.html.twig',);
|
||||
}
|
||||
#[Route('/front/terms', name: 'general_terms')]
|
||||
public function general_terms(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('general/terms.html.twig',);
|
||||
}
|
||||
#[Route('/front/privacy', name: 'general_privacy')]
|
||||
public function general_privacy(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('general/privacy.html.twig',);
|
||||
}
|
||||
#[Route('/front/open-source', name: 'general_opensource')]
|
||||
public function general_opensource(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('general/opensource.html.twig',);
|
||||
}
|
||||
#[Route('/front/update-list', name: 'general_changes_reports')]
|
||||
public function general_changes_reports(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('general/update-list.html.twig',[
|
||||
'items'=>$entityManager->getRepository(ChangeReport::class)->findBy([],['id'=>'DESC'])
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/front/help/api/{id}', name: 'general_help_api')]
|
||||
public function general_help_api(EntityManagerInterface $entityManager, String $id = '1'): Response
|
||||
{
|
||||
$item = $entityManager->getRepository(APIDocument::class)->find($id);
|
||||
if(!$item)
|
||||
throw $this->createNotFoundException();
|
||||
|
||||
return $this->render('general/api.html.twig',[
|
||||
'cats'=>$entityManager->getRepository(APIDocument::class)->findBy([],['title'=>'ASC']),
|
||||
'item'=>$item
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/sitemap.xml', name: 'general_sitemap')]
|
||||
public function general_sitemap(EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->render('general/sitemap.html.twig',[
|
||||
|
||||
]);
|
||||
}
|
||||
#[Route('/test', name: 'general_test')]
|
||||
public function general_test(pdfMGR $pdfMGR,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$user = $entityManager->getRepository(PrinterQueue::class)->findOneBy([
|
||||
'pid'=>'SKDUTJAEZXV37D6HBMQARZAZ9MGW6P79FWVXHTUC4J2FU48K2P4RNWYX3UY2Z5KMSJG746CLLXSRDLQNCG6BBS5TKRW8HDQMF3ENGHY5EQL2BP8VJ78A9CE9VNTY35F'
|
||||
]);
|
||||
return $pdfMGR->streamTwig2PDF($user);
|
||||
}
|
||||
|
||||
}
|
149
hesabixCore/src/Controller/Front/UserController.php
Normal file
149
hesabixCore/src/Controller/Front/UserController.php
Normal file
|
@ -0,0 +1,149 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller\Front;
|
||||
use App\Controller\CustomUserMessageAuthenticationException;
|
||||
use App\Entity\Business;
|
||||
use App\Entity\Permission;
|
||||
use App\Form\UserRegisterType;
|
||||
use App\Service\Provider;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use App\Entity\UserToken;
|
||||
use Exception;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
|
||||
use Symfony\Component\Security\Http\Attribute\CurrentUser;
|
||||
use App\Entity\User;
|
||||
use App\Security\EmailVerifier;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Mime\Address;
|
||||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher,
|
||||
Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken,
|
||||
Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
|
||||
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
|
||||
class UserController extends AbstractController
|
||||
{
|
||||
private EmailVerifier $emailVerifier;
|
||||
|
||||
public function __construct(EmailVerifier $emailVerifier)
|
||||
{
|
||||
$this->emailVerifier = $emailVerifier;
|
||||
}
|
||||
/**
|
||||
* function to generate random strings
|
||||
* @param int $length number of characters in the generated string
|
||||
* @return string a new string is created with random characters of the desired length
|
||||
*/
|
||||
private function RandomString(int $length = 32): string
|
||||
{
|
||||
return substr(str_shuffle(str_repeat($x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length/strlen($x)) )),1,$length);
|
||||
}
|
||||
|
||||
#[Route('/login/{msg}', name: 'front_user_login')]
|
||||
public function front_user_login(AuthenticationUtils $authenticationUtils, #[CurrentUser] ?User $user,EntityManagerInterface $entityManager,$msg = null): Response
|
||||
{
|
||||
if($user)
|
||||
return $this->redirectToRoute('general_home');
|
||||
$error = $authenticationUtils->getLastAuthenticationError();
|
||||
|
||||
// last username entered by the user
|
||||
$lastUsername = $authenticationUtils->getLastUsername();
|
||||
return $this->render("/user/login.html.twig",[
|
||||
'last_username' => $lastUsername,
|
||||
'error' => $error,
|
||||
'msg'=>$msg
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
#[Route('/logout', name: 'front_user_logout')]
|
||||
public function front_user_logout(): never
|
||||
{
|
||||
// controller can be blank: it will never be called!
|
||||
throw new \Exception('Don\'t forget to activate logout in security.yaml');
|
||||
}
|
||||
|
||||
#[Route('/register', name: 'front_user_register')]
|
||||
public function front_user_register(Request $request,TranslatorInterface $translator, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$user = new User();
|
||||
$form = $this->createForm(UserRegisterType::class, $user);
|
||||
$form->handleRequest($request);
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$exist = $entityManager->getRepository(User::class)->findOneBy(['email'=>$form->get('email')->getData()]);
|
||||
if($exist){
|
||||
$error = new FormError($translator->trans('There is already an account with this email'));
|
||||
$form->get('email')->addError($error);
|
||||
|
||||
}
|
||||
else{
|
||||
$user->setDateRegister(time());
|
||||
// encode the plain password
|
||||
$user->setPassword(
|
||||
$userPasswordHasher->hashPassword(
|
||||
$user,
|
||||
$form->get('password')->getData()
|
||||
)
|
||||
);
|
||||
|
||||
$entityManager->persist($user);
|
||||
$entityManager->flush();
|
||||
|
||||
// generate a signed url and email it to the user
|
||||
$this->emailVerifier->sendEmailConfirmation('app_verify_email', $user,
|
||||
(new TemplatedEmail())
|
||||
->from(new Address('noreplay@hesabix.ir', 'حسابیکس'))
|
||||
->to($user->getEmail())
|
||||
->subject('تایید عضویت در حسابیکس')
|
||||
->htmlTemplate('user/confirmation_email.html.twig')
|
||||
);
|
||||
// do anything else you need here, like send an email
|
||||
return $this->redirectToRoute('front_user_login',['msg'=>'success']);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->render('user/register.html.twig', [
|
||||
'registrationForm' => $form->createView(),
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/register/success', name: 'app_register_success')]
|
||||
public function app_register_success(Request $request): Response
|
||||
{
|
||||
return $this->render('registration/register-success.html.twig', [
|
||||
]);
|
||||
}
|
||||
#[Route('/verify/email', name: 'app_verify_email')]
|
||||
public function verifyUserEmail(Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
|
||||
|
||||
// validate email confirmation link, sets User::isVerified=true and persists
|
||||
try {
|
||||
$this->emailVerifier->handleEmailConfirmation($request, $this->getUser());
|
||||
} catch (VerifyEmailExceptionInterface $exception) {
|
||||
$this->addFlash('verify_email_error', $exception->getReason());
|
||||
|
||||
return $this->redirectToRoute('app_register');
|
||||
}
|
||||
|
||||
// @TODO Change the redirect on success and handle or remove the flash message in your templates
|
||||
$this->addFlash('success', 'ایمیل شما تایید شد.');
|
||||
|
||||
return $this->redirectToRoute('app_register');
|
||||
}
|
||||
|
||||
}
|
45
hesabixCore/src/Controller/GeneralController.php
Normal file
45
hesabixCore/src/Controller/GeneralController.php
Normal file
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\HesabdariDoc;
|
||||
use App\Entity\User;
|
||||
use App\Service\Access;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use App\Entity\Business;
|
||||
use App\Entity\PrinterQueue;
|
||||
use App\Service\pdfMGR;
|
||||
use App\Service\Provider;
|
||||
|
||||
class GeneralController extends AbstractController
|
||||
{
|
||||
#[Route('/api/general/stat', name: 'general_stat')]
|
||||
public function general_stat(EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$busCount = count($entityManager->getRepository(Business::class)->findAll());
|
||||
$users = count($entityManager->getRepository(User::class)->findAll());
|
||||
$docs = count($entityManager->getRepository(HesabdariDoc::class)->findAll());
|
||||
$lastBusiness = $entityManager->getRepository(Business::class)->findLast();
|
||||
return $this->json([
|
||||
'business' => $busCount,
|
||||
'users'=> $users,
|
||||
'docs'=> $docs,
|
||||
'lastBusinessName'=> $lastBusiness->getname(),
|
||||
'lastBusinessOwner'=>$lastBusiness->getOwner()->getFullName()
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/front/print/{id}', name: 'app_front_print')]
|
||||
public function app_front_print(Provider $provider,EntityManagerInterface $entityManager,pdfMGR $pdfMGR,String $id)
|
||||
{
|
||||
$print = $entityManager->getRepository(PrinterQueue::class)->findOneBy(['pid'=>$id]);
|
||||
if(!$print)
|
||||
throw $this->createNotFoundException();
|
||||
$pdfMGR->streamTwig2PDF($print);
|
||||
return new Response('');
|
||||
}
|
||||
}
|
521
hesabixCore/src/Controller/HesabdariController.php
Normal file
521
hesabixCore/src/Controller/HesabdariController.php
Normal file
|
@ -0,0 +1,521 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\BankAccount;
|
||||
use App\Entity\Cashdesk;
|
||||
use App\Entity\Commodity;
|
||||
use App\Entity\HesabdariDoc;
|
||||
use App\Entity\HesabdariRow;
|
||||
use App\Entity\HesabdariTable;
|
||||
use App\Entity\Money;
|
||||
use App\Entity\Person;
|
||||
use App\Entity\PlugNoghreOrder;
|
||||
use App\Entity\Salary;
|
||||
use App\Service\Access;
|
||||
use App\Service\Jdate;
|
||||
use App\Service\Log;
|
||||
use App\Service\Provider;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class HesabdariController extends AbstractController
|
||||
{
|
||||
private array $tableExport = [];
|
||||
#[Route('/api/accounting/doc/get', name: 'app_accounting_doc_get')]
|
||||
public function app_accounting_doc_get(Jdate $jdate,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(! array_key_exists('code',$params))
|
||||
$this->createNotFoundException();
|
||||
|
||||
|
||||
$acc = $access->hasRole('accounting');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'year'=>$acc['year'],
|
||||
'code'=>$params['code']
|
||||
]);
|
||||
if(!$doc) throw $this->createNotFoundException();
|
||||
$rows = [];
|
||||
$rowsObj = $entityManager->getRepository(HesabdariRow::class)->findBy(
|
||||
['doc'=>$doc]
|
||||
);
|
||||
foreach ($rowsObj as $item){
|
||||
$temp=[];
|
||||
$temp['id'] = $item->getId();
|
||||
$temp['bs'] = $item->getBs();
|
||||
$temp['bd'] = $item->getBd();
|
||||
$temp['des'] = $item->getDes();
|
||||
$temp['table'] = $item->getRef()->getName();
|
||||
$temp['referral'] = $item->getReferral();
|
||||
if($item->getPerson()){
|
||||
$temp['typeLabel'] = 'شخص';
|
||||
$temp['type'] = 'person';
|
||||
$temp['ref'] = $item->getPerson()->getNikeName();
|
||||
$temp['refCode'] = $item->getPerson()->getCode();
|
||||
$temp['person'] = [
|
||||
'id' => $item->getPerson()->getId(),
|
||||
'code' => $item->getPerson()->getCode(),
|
||||
'nikename' => $item->getPerson()->getNikename(),
|
||||
'name' => $item->getPerson()->getName(),
|
||||
'tel' => $item->getPerson()->getTel(),
|
||||
'mobile' => $item->getPerson()->getMobile(),
|
||||
'address' => $item->getPerson()->getAddress(),
|
||||
'des' => $item->getPerson()->getDes(),
|
||||
];
|
||||
}
|
||||
elseif($item->getBank()){
|
||||
$temp['typeLabel'] = 'حسابهای بانکی';
|
||||
$temp['type'] = 'bank';
|
||||
$temp['ref'] = $item->getBank()->getName();
|
||||
$temp['refCode'] = $item->getBank()->getCode();
|
||||
$temp['bank'] = [
|
||||
'id' => $item->getBank()->getId(),
|
||||
'name' => $item->getBank()->getName(),
|
||||
'cardNum' => $item->getBank()->getCardNum(),
|
||||
'shaba' => $item->getBank()->getShaba(),
|
||||
'accountNum' => $item->getBank()->getAccountNum(),
|
||||
'owner' => $item->getBank()->getOwner(),
|
||||
'shobe' => $item->getBank()->getShobe(),
|
||||
'posNum' => $item->getBank()->getPosNum(),
|
||||
'des' => $item->getBank()->getDes(),
|
||||
'mobileInternetBank' => $item->getBank()->getMobileInternetBank(),
|
||||
'code' => $item->getBank()->getCode(),
|
||||
];
|
||||
}
|
||||
elseif($item->getCommodity()){
|
||||
$temp['typeLabel'] = 'موجودی کالا';
|
||||
$temp['type'] = 'commodity';
|
||||
$temp['ref'] = $item->getCommodity()->getName();
|
||||
$temp['refCode'] = $item->getCommodity()->getCode();
|
||||
$temp['commodity'] = [
|
||||
'id' => $item->getCommodity()->getId(),
|
||||
'name' => $item->getCommodity()->getName(),
|
||||
'des' => $item->getCommodity()->getDes(),
|
||||
'code' => $item->getCommodity()->getCode(),
|
||||
];
|
||||
}
|
||||
elseif($item->getSalary()){
|
||||
$temp['typeLabel'] = 'تنخواه گردان';
|
||||
$temp['type'] = 'salary';
|
||||
$temp['ref'] = $item->getSalary()->getName();
|
||||
$temp['refCode'] = $item->getSalary()->getCode();
|
||||
$temp['salary'] = [
|
||||
'id' => $item->getSalary()->getId(),
|
||||
'name' => $item->getSalary()->getName(),
|
||||
'des' => $item->getSalary()->getDes(),
|
||||
'code' => $item->getSalary()->getCode(),
|
||||
];
|
||||
}
|
||||
elseif($item->getCashdesk()){
|
||||
$temp['typeLabel'] = 'صندوق';
|
||||
$temp['type'] = 'cashdesk';
|
||||
$temp['ref'] = $item->getCashdesk()->getName();
|
||||
$temp['refCode'] = $item->getCashdesk()->getCode();
|
||||
$temp['cashdesk'] = [
|
||||
'id' => $item->getCashdesk()->getId(),
|
||||
'name' => $item->getCashdesk()->getName(),
|
||||
'des' => $item->getCashdesk()->getDes(),
|
||||
'code' => $item->getCashdesk()->getCode(),
|
||||
];
|
||||
}
|
||||
else{
|
||||
$temp['typeLabel'] = $item->getRef()->getName();
|
||||
$temp['type'] = 'calc';
|
||||
$temp['ref'] = $item->getRef()->getName();
|
||||
$temp['refCode'] = $item->getRef()->getCode();
|
||||
}
|
||||
$rows[] = $temp;
|
||||
}
|
||||
return $this->json([
|
||||
'doc'=>$doc,
|
||||
'rows'=>$rows
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/api/accounting/search', name: 'app_accounting_search')]
|
||||
public function app_accounting_search(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(! array_key_exists('type',$params))
|
||||
$this->createNotFoundException();
|
||||
$roll = '';
|
||||
if($params['type'] == 'person_receive' || $params['type'] == 'person_send') $roll='person';
|
||||
elseif($params['type'] == 'cost') $roll='cost';
|
||||
elseif($params['type'] == 'income') $roll='income';
|
||||
elseif($params['type'] == 'buy') $roll='buy';
|
||||
elseif($params['type'] == 'transfer') $roll='transfer';
|
||||
elseif($params['type'] == 'all') $roll='accounting';
|
||||
else
|
||||
$this->createNotFoundException();
|
||||
|
||||
$acc = $access->hasRole($roll);
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
if($params['type'] == 'all'){
|
||||
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'year'=>$acc['year'],
|
||||
],[
|
||||
'id'=>'DESC'
|
||||
]);
|
||||
}
|
||||
else{
|
||||
$data = $entityManager->getRepository(HesabdariDoc::class)->findBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'year'=>$acc['year'],
|
||||
'type'=>$params['type']
|
||||
],[
|
||||
'id'=>'DESC'
|
||||
]);
|
||||
}
|
||||
$dataTemp =[];
|
||||
foreach ($data as $item){
|
||||
$temp = [
|
||||
'id'=>$item->getId(),
|
||||
'dateSubmit'=>$item->getDateSubmit(),
|
||||
'date'=>$item->getDate(),
|
||||
'type'=>$item->getType(),
|
||||
'code'=>$item->getCode(),
|
||||
'des'=>$item->getDes(),
|
||||
'amount'=>$item->getAmount(),
|
||||
'submitter'=> $item->getSubmitter()->getFullName(),
|
||||
];
|
||||
if($params['type'] == 'buy'){
|
||||
$mainRow = $entityManager->getRepository(HesabdariRow::class)->getNotEqual($item,'person');
|
||||
$temp['person'] = $mainRow->getPerson()->getNikename();
|
||||
}
|
||||
$dataTemp[] = $temp;
|
||||
}
|
||||
return $this->json($dataTemp);
|
||||
}
|
||||
|
||||
#[Route('/api/accounting/insert', name: 'app_accounting_insert')]
|
||||
public function app_accounting_insert(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(! array_key_exists('type',$params))
|
||||
$this->createNotFoundException();
|
||||
$roll = '';
|
||||
if($params['type'] == 'person_receive' || $params['type'] == 'person_send') $roll='person';
|
||||
else
|
||||
$roll = $params['type'];
|
||||
|
||||
$acc = $access->hasRole($roll);
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
if(!array_key_exists('rows',$params) || count($params['rows']) < 2)
|
||||
throw $this->createNotFoundException('rows is to short');
|
||||
if(!array_key_exists('date',$params) || !array_key_exists('des',$params))
|
||||
throw $this->createNotFoundException('some params mistake');
|
||||
if(array_key_exists('update',$params) && $params['update'] != ''){
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'year'=>$acc['year'],
|
||||
'code'=>$params['update']
|
||||
]);
|
||||
if(!$doc) throw $this->createNotFoundException('document not found.');
|
||||
$doc->setDes($params['des']);
|
||||
$doc->setDate($params['date']);
|
||||
$doc->setMoney($acc['bid']->getMoney());
|
||||
if(array_key_exists('refData',$params))
|
||||
$doc->setRefData($params['refData']);
|
||||
if(array_key_exists('plugin',$params))
|
||||
$doc->setPlugin($params['plugin']);
|
||||
|
||||
$entityManager->persist($doc);
|
||||
$entityManager->flush();
|
||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
'doc'=>$doc
|
||||
]);
|
||||
foreach ($rows as $row)
|
||||
$entityManager->remove($row);
|
||||
}
|
||||
else{
|
||||
$doc = new HesabdariDoc();
|
||||
$doc->setBid($acc['bid']);
|
||||
$doc->setYear($acc['year']);
|
||||
$doc->setDes($params['des']);
|
||||
$doc->setDateSubmit(time());
|
||||
$doc->setType($params['type']);
|
||||
$doc->setDate($params['date']);
|
||||
$doc->setSubmitter($this->getUser());
|
||||
$doc->setMoney($acc['bid']->getMoney());
|
||||
$doc->setCode($provider->getAccountingCode($acc['bid'],'accounting'));
|
||||
if(array_key_exists('refData',$params))
|
||||
$doc->setRefData($params['refData']);
|
||||
if(array_key_exists('plugin',$params))
|
||||
$doc->setPlugin($params['plugin']);
|
||||
$entityManager->persist($doc);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
|
||||
$amount = 0;
|
||||
foreach ($params['rows'] as $row){
|
||||
$row['bs'] = str_replace(',','',$row['bs']);
|
||||
$row['bd'] = str_replace(',','',$row['bd']);
|
||||
|
||||
$hesabdariRow = new HesabdariRow();
|
||||
$hesabdariRow->setBid($acc['bid']);
|
||||
$hesabdariRow->setYear($acc['year']);
|
||||
$hesabdariRow->setDoc($doc);
|
||||
$hesabdariRow->setBs($row['bs']);
|
||||
$hesabdariRow->setBd($row['bd']);
|
||||
if(array_key_exists('referral',$row))
|
||||
$hesabdariRow->setReferral($row['referral']);
|
||||
$amount += $row['bs'];
|
||||
//check is type is person
|
||||
if($row['type'] == 'person'){
|
||||
$person = $entityManager->getRepository(Person::class)->find($row['id']);
|
||||
if(!$person) throw $this->createNotFoundException('person not found');
|
||||
elseif ($person->getBid()->getId() != $acc['bid']->getId()) throw $this->createAccessDeniedException('person is not in this business');
|
||||
$hesabdariRow->setPerson($person);
|
||||
}
|
||||
elseif ($row['type'] == 'bank'){
|
||||
$bank = $entityManager->getRepository(BankAccount::class)->find($row['id']);
|
||||
if(!$bank) throw $this->createNotFoundException('bank not found');
|
||||
elseif ($bank->getBid()->getId() != $acc['bid']->getId()) throw $this->createAccessDeniedException('bank is not in this business');
|
||||
$hesabdariRow->setBank($bank);
|
||||
}
|
||||
elseif ($row['type'] == 'salary'){
|
||||
$salary = $entityManager->getRepository(Salary::class)->find($row['id']);
|
||||
if(!$salary) throw $this->createNotFoundException('salary not found');
|
||||
elseif ($salary->getBid()->getId() != $acc['bid']->getId()) throw $this->createAccessDeniedException('bank is not in this business');
|
||||
$hesabdariRow->setSalary($salary);
|
||||
}
|
||||
elseif ($row['type'] == 'cashdesk'){
|
||||
$cashdesk = $entityManager->getRepository(Cashdesk::class)->find($row['id']);
|
||||
if(!$cashdesk) throw $this->createNotFoundException('cashdesk not found');
|
||||
elseif ($cashdesk->getBid()->getId() != $acc['bid']->getId()) throw $this->createAccessDeniedException('bank is not in this business');
|
||||
$hesabdariRow->setCashdesk($cashdesk);
|
||||
}
|
||||
elseif ($row['type'] == 'commodity'){
|
||||
$row['count'] = str_replace(',','',$row['count']);
|
||||
$commodity = $entityManager->getRepository(Commodity::class)->find($row['commodity']['id']);
|
||||
if(!$commodity) throw $this->createNotFoundException('commodity not found');
|
||||
elseif ($commodity->getBid()->getId() != $acc['bid']->getId()) throw $this->createAccessDeniedException('$commodity is not in this business');
|
||||
$hesabdariRow->setCommodity($commodity);
|
||||
$hesabdariRow->setCommdityCount($row['count']);
|
||||
}
|
||||
$ref = $entityManager->getRepository(HesabdariTable::class)->findOneBy([
|
||||
'code'=>$row['table']
|
||||
]);
|
||||
|
||||
if(array_key_exists('plugin',$row))
|
||||
$hesabdariRow->setPlugin($row['plugin']);
|
||||
if(array_key_exists('refData',$row))
|
||||
$hesabdariRow->setRefData($row['refData']);
|
||||
|
||||
$hesabdariRow->setRef($ref);
|
||||
$hesabdariRow->setDes($row['des']);
|
||||
$entityManager->persist($hesabdariRow);
|
||||
$entityManager->flush();
|
||||
|
||||
|
||||
}
|
||||
$doc->setAmount($amount);
|
||||
$entityManager->persist($doc);
|
||||
$entityManager->flush();
|
||||
$log->insert('حسابداری','سند حسابداری شماره ' . $doc->getCode() . ' ثبت / ویرایش شد.',$this->getUser(),$request->headers->get('activeBid'));
|
||||
|
||||
return $this->json(['result'=>1]);
|
||||
}
|
||||
|
||||
#[Route('/api/accounting/remove', name: 'app_accounting_remove_doc')]
|
||||
public function app_accounting_remove_doc(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(! array_key_exists('code',$params))
|
||||
$this->createNotFoundException();
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'code'=>$params['code']
|
||||
]);
|
||||
if(!$doc) throw $this->createNotFoundException();
|
||||
$roll = '';
|
||||
if($doc->getType() == 'person_receive' || $doc->getType() == 'person_send')
|
||||
$roll = 'person';
|
||||
else
|
||||
$roll = $doc->getType();
|
||||
$acc = $access->hasRole($roll);
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
'doc'=>$doc
|
||||
]);
|
||||
if($doc->getPlugin() == 'plugNoghreOrder'){
|
||||
$order = $entityManager->getRepository(PlugNoghreOrder::class)->findOneBy([
|
||||
'doc'=>$doc
|
||||
]);
|
||||
if($order)
|
||||
$entityManager->remove($order);
|
||||
}
|
||||
foreach ($rows as $row)
|
||||
$entityManager->remove($row);
|
||||
$entityManager->remove($doc);
|
||||
|
||||
$log->insert('حسابداری','سند حسابداری شماره ' . $doc->getCode() . ' حذف شد.',$this->getUser(),$request->headers->get('activeBid'));
|
||||
|
||||
return $this->json(['result'=>1]);
|
||||
}
|
||||
|
||||
#[Route('/api/accounting/rows/search', name: 'app_accounting_rows_search')]
|
||||
public function app_accounting_rows_search(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(! array_key_exists('type',$params))
|
||||
$this->createNotFoundException();
|
||||
$roll = '';
|
||||
if($params['type'] == 'person') $roll='person';
|
||||
elseif($params['type'] == 'all') $roll='accounting';
|
||||
else
|
||||
$this->createNotFoundException();
|
||||
|
||||
$acc = $access->hasRole($roll);
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
if($params['type'] == 'person'){
|
||||
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'code'=>$params['id'],
|
||||
]);
|
||||
if(!$person)
|
||||
throw $this->createNotFoundException();
|
||||
|
||||
$data = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
'person'=> $person,
|
||||
],[
|
||||
'id'=>'DESC'
|
||||
]);
|
||||
}
|
||||
|
||||
$dataTemp =[];
|
||||
foreach ($data as $item){
|
||||
$temp = [
|
||||
'id'=>$item->getId(),
|
||||
'dateSubmit'=>$item->getDoc()->getDateSubmit(),
|
||||
'date'=>$item->getDoc()->getDate(),
|
||||
'type'=>$item->getDoc()->getType(),
|
||||
'ref'=>$item->getRef()->getName(),
|
||||
'des'=>$item->getDes(),
|
||||
'bs'=>$item->getBs(),
|
||||
'bd'=>$item->getBd(),
|
||||
'code'=>$item->getDoc()->getCode(),
|
||||
'submitter'=> $item->getDoc()->getSubmitter()->getFullName()
|
||||
];
|
||||
$dataTemp[] = $temp;
|
||||
}
|
||||
return $this->json($dataTemp);
|
||||
}
|
||||
|
||||
#[Route('/api/accounting/table/get', name: 'app_accounting_table_get')]
|
||||
public function app_accounting_table_get(Jdate $jdate,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
|
||||
$acc = $access->hasRole('accounting');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$temp =[];
|
||||
$nodes = $entityManager->getRepository(HesabdariTable::class)->findAll();
|
||||
foreach ($nodes as $node){
|
||||
if($this->hasChild($entityManager,$node)){
|
||||
$temp[$node->getCode()]=[
|
||||
'text'=>$node->getName(),
|
||||
'children'=>$this->getChildsLabel($entityManager,$node)
|
||||
];
|
||||
}
|
||||
else{
|
||||
$temp[$node->getCode()]=[
|
||||
'text'=>$node->getName(),
|
||||
];
|
||||
}
|
||||
}
|
||||
return $this->json($temp);
|
||||
}
|
||||
|
||||
#[Route('/api/accounting/table/childs/{type}', name: 'app_accounting_table_childs')]
|
||||
public function app_accounting_table_childs(string $type,Jdate $jdate,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole($type);
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
if($type == 'cost'){
|
||||
$cost= $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>67]);
|
||||
return $this->json($this->getChilds($entityManager,$cost));
|
||||
}
|
||||
elseif($type == 'income'){
|
||||
$income= $entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>56]);
|
||||
return $this->json($this->getChilds($entityManager,$income));
|
||||
}
|
||||
|
||||
return $this->json([]);
|
||||
}
|
||||
|
||||
private function getChildsLabel(EntityManagerInterface $entityManager, mixed $node){
|
||||
$childs = $entityManager->getRepository(HesabdariTable::class)->findBy([
|
||||
'upper'=>$node
|
||||
]);
|
||||
$temp = [];
|
||||
foreach ($childs as $child){
|
||||
$temp[] = $child->getCode();
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
|
||||
private function hasChild(EntityManagerInterface $entityManager, mixed $node)
|
||||
{
|
||||
if(count($entityManager->getRepository(HesabdariTable::class)->findBy([
|
||||
'upper'=>$node
|
||||
]))!= 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private function getChilds(EntityManagerInterface $entityManager, mixed $node){
|
||||
$childs = $entityManager->getRepository(HesabdariTable::class)->findBy([
|
||||
'upper'=>$node
|
||||
]);
|
||||
$temp = [];
|
||||
foreach ($childs as $child){
|
||||
if ($child->getType() == 'calc'){
|
||||
if($this->hasChild($entityManager,$child)){
|
||||
$temp[]=[
|
||||
'id'=>$child->getCode(),
|
||||
'label'=>$child->getName(),
|
||||
'children'=>$this->getChilds($entityManager,$child)
|
||||
];
|
||||
}
|
||||
else{
|
||||
$temp[]=[
|
||||
'id'=>$child->getCode(),
|
||||
'label'=>$child->getName(),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $temp;
|
||||
}
|
||||
}
|
36
hesabixCore/src/Controller/LogController.php
Normal file
36
hesabixCore/src/Controller/LogController.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Business;
|
||||
use App\Service\Access;
|
||||
use App\Service\Jdate;
|
||||
use App\Service\Log;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class LogController extends AbstractController
|
||||
{
|
||||
#[Route('/api/business/logs/{bid}', name: 'api_business_logs')]
|
||||
public function api_business_logs(Access $access,String $bid, Jdate $jdate, EntityManagerInterface $entityManager,Log $log): JsonResponse
|
||||
{
|
||||
if(!$access->hasRole('log'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$business = $entityManager->getRepository(Business::class)->find($bid);
|
||||
if(!$business)
|
||||
throw $this->createNotFoundException();
|
||||
$logs = $entityManager->getRepository(\App\Entity\Log::class)->findBy(['bid'=>$business]);
|
||||
$temps = [];
|
||||
foreach ($logs as $log){
|
||||
$temp = [];
|
||||
$temp['user'] = $log->getUser()->getFullName();
|
||||
$temp['des'] = $log->getDes();
|
||||
$temp['part'] = $log->getPart();
|
||||
$temp['date'] = $jdate->jdate('Y/n/d H:i',$log->getDateSubmit());
|
||||
$temps[] = $temp;
|
||||
}
|
||||
return $this->json(array_reverse($temps));
|
||||
}
|
||||
}
|
26
hesabixCore/src/Controller/MoneyController.php
Normal file
26
hesabixCore/src/Controller/MoneyController.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Money;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class MoneyController extends AbstractController
|
||||
{
|
||||
#[Route('/api/money/get/all', name: 'app_money_get_all')]
|
||||
public function app_money_get_all(EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$result = $entityManager->getRepository(Money::class)->findAll();
|
||||
$out = [];
|
||||
foreach ($result as $item){
|
||||
$temp = [];
|
||||
$temp['name'] = $item->getName();
|
||||
$temp['label'] = $item->getLabel();
|
||||
$out[] = $temp;
|
||||
}
|
||||
return $this->json($out);
|
||||
}
|
||||
}
|
80
hesabixCore/src/Controller/NotificationsController.php
Normal file
80
hesabixCore/src/Controller/NotificationsController.php
Normal file
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Business;
|
||||
use App\Entity\Notification;
|
||||
use App\Service\Access;
|
||||
use App\Service\Jdate;
|
||||
use App\Service\Log;
|
||||
use App\Service\twigFunctions;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class NotificationsController extends AbstractController
|
||||
{
|
||||
#[Route('/api/notifications/list/{type}', name: 'api_notification_list')]
|
||||
public function api_notification_list(twigFunctions $twigFunctions,Access $access, Jdate $jdate, EntityManagerInterface $entityManager,String $type = 'all'): JsonResponse
|
||||
{
|
||||
if(!$this->getUser())
|
||||
throw $this->createAccessDeniedException('lot loged in');
|
||||
|
||||
$acc = $access->hasRole('join');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$business = $entityManager->getRepository(Business::class)->find($acc['bid']);
|
||||
if(!$business)
|
||||
throw $this->createNotFoundException();
|
||||
if($type == 'all'){
|
||||
$items = $entityManager->getRepository(\App\Entity\Notification::class)->findBy([
|
||||
'bid'=>$business,
|
||||
'user'=>$this->getUser()
|
||||
]);
|
||||
}
|
||||
elseif ($type = 'new'){
|
||||
$items = $entityManager->getRepository(\App\Entity\Notification::class)->findBy([
|
||||
'bid'=>$business,
|
||||
'user'=>$this->getUser(),
|
||||
'viewed' => false
|
||||
]);
|
||||
}
|
||||
|
||||
$temps = [];
|
||||
foreach ($items as $item){
|
||||
$temp = [];
|
||||
$temp['user'] = $item->getUser()->getFullName();
|
||||
$temp['message'] = $item->getMessage();
|
||||
$temp['icon'] = $item->getIcon();
|
||||
$temp['date'] = $twigFunctions->dayToNow($item->getDateSubmit());
|
||||
$temp['url'] = $item->getUrl();
|
||||
$temp['id'] = $item->getId();
|
||||
$temps[] = $temp;
|
||||
}
|
||||
return $this->json($temps);
|
||||
}
|
||||
|
||||
#[Route('/api/notifications/read/{id}', name: 'api_notification_read')]
|
||||
public function api_notification_read(String $id,Access $access, Jdate $jdate, EntityManagerInterface $entityManager,Log $log): JsonResponse
|
||||
{ if(!$this->getUser())
|
||||
throw $this->createAccessDeniedException('lot loged in');
|
||||
|
||||
$acc = $access->hasRole('join');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$business = $entityManager->getRepository(Business::class)->find($acc['bid']);
|
||||
if(!$business)
|
||||
throw $this->createNotFoundException();
|
||||
$item = $entityManager->getRepository(Notification::class)->find($id);
|
||||
if($item){
|
||||
$item->setViewed(true);
|
||||
$entityManager->persist($item);
|
||||
$entityManager->flush();
|
||||
}
|
||||
return $this->json([
|
||||
'result'=>'ok'
|
||||
]);
|
||||
}
|
||||
}
|
113
hesabixCore/src/Controller/PersonsController.php
Normal file
113
hesabixCore/src/Controller/PersonsController.php
Normal file
|
@ -0,0 +1,113 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Business;
|
||||
use App\Entity\Person;
|
||||
use App\Service\Access;
|
||||
use App\Service\Log;
|
||||
use App\Service\Provider;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
class PersonsController extends AbstractController
|
||||
{
|
||||
#[Route('/api/person/info/{code}', name: 'app_persons_info')]
|
||||
public function app_persons_info($code,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('person');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'code'=>$code
|
||||
]);
|
||||
return $this->json($person);
|
||||
}
|
||||
#[Route('/api/person/mod/{code}', name: 'app_persons_mod')]
|
||||
public function app_persons_mod(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,$code = 0): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('person');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(!array_key_exists('nikename',$params))
|
||||
return $this->json(['result'=>-1]);
|
||||
if(count_chars(trim($params['nikename'])) == 0)
|
||||
return $this->json(['result'=>3]);
|
||||
if($code == 0){
|
||||
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
||||
'nikename'=>$params['nikename'],
|
||||
'bid' =>$acc['bid']
|
||||
]);
|
||||
//check exist before
|
||||
if($person)
|
||||
return $this->json(['result'=>2]);
|
||||
$person = new Person();
|
||||
$person->setCode($provider->getAccountingCode($request->headers->get('activeBid'),'person'));
|
||||
}
|
||||
else{
|
||||
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'code'=>$code
|
||||
]);
|
||||
if(!$person)
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
$person->setBid($acc['bid']);
|
||||
$person->setNikename($params['nikename']);
|
||||
if(array_key_exists('name',$params))
|
||||
$person->setName($params['name']);
|
||||
if(array_key_exists('tel',$params))
|
||||
$person->setTel($params['tel']);
|
||||
if(array_key_exists('address',$params))
|
||||
$person->setAddress($params['address']);
|
||||
if(array_key_exists('des',$params))
|
||||
$person->setDes($params['des']);
|
||||
if(array_key_exists('mobile',$params))
|
||||
$person->setMobile($params['mobile']);
|
||||
$entityManager->persist($person);
|
||||
$entityManager->flush();
|
||||
$log->insert('اشخاص','شخص با نام مستعار ' . $params['nikename'] . ' افزوده/ویرایش شد.',$this->getUser(),$request->headers->get('activeBid'));
|
||||
return $this->json(['result' => 1]);
|
||||
}
|
||||
|
||||
#[Route('/api/person/list', name: 'app_persons_list')]
|
||||
public function app_persons_list(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
if(!$access->hasRole('person'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$persons = $entityManager->getRepository(Person::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid')
|
||||
]);
|
||||
return $this->json($persons);
|
||||
}
|
||||
|
||||
#[Route('/api/person/list/print', name: 'app_persons_list_print')]
|
||||
public function app_persons_list_print(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('person');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
$persons = $entityManager->getRepository(Person::class)->findBy([
|
||||
'bid'=>$acc['bid']
|
||||
]);
|
||||
$pid = $provider->createPrint(
|
||||
$acc['bid'],
|
||||
$this->getUser(),
|
||||
$this->renderView('pdf/persons.html.twig',[
|
||||
'page_title'=>'فهرست اشخاص',
|
||||
'bid'=>$acc['bid'],
|
||||
'persons'=>$persons
|
||||
]));
|
||||
return $this->json(['id'=>$pid]);
|
||||
}
|
||||
}
|
179
hesabixCore/src/Controller/PluginController.php
Normal file
179
hesabixCore/src/Controller/PluginController.php
Normal file
|
@ -0,0 +1,179 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Business;
|
||||
use App\Entity\Plugin;
|
||||
use App\Entity\PluginProdect;
|
||||
use App\Service\Access;
|
||||
use App\Service\Jdate;
|
||||
use App\Service\Log;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class PluginController extends AbstractController
|
||||
{
|
||||
#[Route('/api/plugin/get/info/{id}', name: 'api_plugin_get_info')]
|
||||
public function api_plugin_get_info(String $id,Access $access, Jdate $jdate, EntityManagerInterface $entityManager,Log $log): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('join');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$item = $entityManager->getRepository(PluginProdect::class)->findOneBy([
|
||||
'code'=>$id
|
||||
]);
|
||||
return $this->json($item);
|
||||
}
|
||||
|
||||
#[Route('/api/plugin/insert/{id}', name: 'api_plugin_insert')]
|
||||
public function api_plugin_insert(String $id,Access $access,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$acc = $access->hasRole('join');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$pp = $entityManager->getRepository(PluginProdect::class)->find($id);
|
||||
if(!$pp)
|
||||
throw $this->createNotFoundException('plugin not found');
|
||||
$data = array("merchant_id" => "a7804652-1fb9-4b43-911c-0a1046e61be1",
|
||||
"amount" => ($pp->getPrice() * 109)/10,
|
||||
"callback_url" => "https://hesabix.ir/api/plugin/buy/verify",
|
||||
"description" => $pp->getName(),
|
||||
);
|
||||
$jsonData = json_encode($data);
|
||||
$ch = curl_init('https://api.zarinpal.com/pg/v4/payment/request.json');
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'ZarinPal Rest Api v1');
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
'Content-Type: application/json',
|
||||
'Content-Length: ' . strlen($jsonData)
|
||||
));
|
||||
|
||||
$result = curl_exec($ch);
|
||||
$err = curl_error($ch);
|
||||
$result = json_decode($result, true, JSON_PRETTY_PRINT);
|
||||
curl_close($ch);
|
||||
if ($err) {
|
||||
throw $this->createAccessDeniedException($err);
|
||||
} else {
|
||||
if (empty($result['errors'])) {
|
||||
if ($result['data']['code'] == 100) {
|
||||
$plugin = new Plugin();
|
||||
$plugin->setBid($acc['bid']);
|
||||
$plugin->setSubmitter($this->getUser());
|
||||
$plugin->setDateSubmit(time());
|
||||
$plugin->setGatePay('zarinpal');
|
||||
$plugin->setVerifyCode($result['data']['authority']);
|
||||
$plugin->setStatus(0);
|
||||
$plugin->setDes($pp->getName());
|
||||
$plugin->setName($pp->getCode());
|
||||
$plugin->setPrice(($pp->getPrice() * 109)/10);
|
||||
$plugin->setDateExpire(time() + $pp->getTimestamp());
|
||||
$entityManager->persist($plugin);
|
||||
$entityManager->flush();
|
||||
return $this->json([
|
||||
'authority'=> $result['data']["authority"]
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
throw $this->createAccessDeniedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
#[Route('/api/plugin/buy/verify', name: 'api_plugin_buy_verify')]
|
||||
public function api_plugin_buy_verify(\Symfony\Component\HttpFoundation\Request $request,EntityManagerInterface $entityManager,Log $log): Response
|
||||
{
|
||||
$Authority = $request->get('Authority');
|
||||
$status = $request->get('Status');
|
||||
$req = $entityManager->getRepository(Plugin::class)->findOneBy(['verifyCode'=>$Authority]);
|
||||
$data = array("merchant_id" => "a7804652-1fb9-4b43-911c-0a1046e61be1", "authority" => $Authority, "amount" => $req->getPrice());
|
||||
$jsonData = json_encode($data);
|
||||
$ch = curl_init('https://api.zarinpal.com/pg/v4/payment/verify.json');
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'ZarinPal Rest Api v4');
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
||||
'Content-Type: application/json',
|
||||
'Content-Length: ' . strlen($jsonData)
|
||||
));
|
||||
|
||||
$result = curl_exec($ch);
|
||||
$err = curl_error($ch);
|
||||
curl_close($ch);
|
||||
$result = json_decode($result, true);
|
||||
|
||||
//-----------------------------------
|
||||
|
||||
//-----------------------------------
|
||||
if ($err) {
|
||||
return $this->render('buy/fail.html.twig', ['results'=>$result]);
|
||||
} else {
|
||||
if(array_key_exists('code',$result['data'])){
|
||||
if ($result['data']['code'] == 100) {
|
||||
$req->setStatus(100);
|
||||
$req->setRefID($result['data']['ref_id']);
|
||||
$req->setCardPan($result['data']['card_pan']);
|
||||
$entityManager->persist($req);
|
||||
$entityManager->flush();
|
||||
$log->insert(
|
||||
'افزونه ' . $req->getName(),
|
||||
'افزونه جدید خریداری و فعال شد.',
|
||||
$req->getSubmitter(),
|
||||
$req->getBid()
|
||||
);
|
||||
return $this->render('buy/success.html.twig',['req'=>$req]);
|
||||
}
|
||||
}
|
||||
return $this->render('buy/fail.html.twig', ['results'=>$result]);
|
||||
}
|
||||
}
|
||||
|
||||
#[Route('/api/plugin/get/actives', name: 'api_plugin_get_actives')]
|
||||
public function api_plugin_get_actives(Access $access, Jdate $jdate, EntityManagerInterface $entityManager,Log $log): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('join');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$plugins = $entityManager->getRepository(Plugin::class)->findActivePlugins($acc['bid']);
|
||||
$temp = [];
|
||||
foreach ($plugins as $plugin){
|
||||
$plugin->setDateExpire($jdate->jdate('Y/n/d',$plugin->getDateExpire()));
|
||||
$temp[$plugin->getName()] = $plugin;
|
||||
}
|
||||
return $this->json($temp);
|
||||
}
|
||||
|
||||
#[Route('/api/plugin/get/paids', name: 'api_plugin_get_paids')]
|
||||
public function api_plugin_get_paids(Access $access, Jdate $jdate, EntityManagerInterface $entityManager,Log $log): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('join');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$plugins = $entityManager->getRepository(Plugin::class)->findBy([
|
||||
'bid'=>$acc['bid'],
|
||||
]);
|
||||
$temp = [];
|
||||
foreach ($plugins as $plugin){
|
||||
$plugin->setDateExpire($jdate->jdate('Y/n/d',$plugin->getDateExpire()));
|
||||
$plugin->setDateSubmit($jdate->jdate('Y/n/d',$plugin->getDateSubmit()));
|
||||
$plugin->setPrice(number_format($plugin->getPrice()));
|
||||
|
||||
}
|
||||
return $this->json($plugins);
|
||||
}
|
||||
#[Route('/api/plugin/get/all', name: 'api_plugin_get_all')]
|
||||
public function api_plugin_get_all(Access $access, Jdate $jdate, EntityManagerInterface $entityManager,Log $log): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('join');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$plugins = $entityManager->getRepository(PluginProdect::class)->findAll();
|
||||
return $this->json($plugins);
|
||||
}
|
||||
|
||||
}
|
583
hesabixCore/src/Controller/Plugins/PlugNoghreController.php
Normal file
583
hesabixCore/src/Controller/Plugins/PlugNoghreController.php
Normal file
|
@ -0,0 +1,583 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller\Plugins;
|
||||
|
||||
use App\Entity\HesabdariDoc;
|
||||
use App\Entity\HesabdariRow;
|
||||
use App\Entity\HesabdariTable;
|
||||
use App\Entity\Person;
|
||||
use App\Entity\PlugNoghreOrder;
|
||||
use App\Service\Access;
|
||||
use App\Service\Log;
|
||||
use App\Service\Provider;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class PlugNoghreController extends AbstractController
|
||||
{
|
||||
|
||||
#[Route('/api/plugin/noghre/employess/list', name: 'app_plug_noghre_employees')]
|
||||
public function app_plug_noghre_employees(EntityManagerInterface $entityManager,Access $access,Request $request): Response
|
||||
{
|
||||
if(!$access->hasRole('plugNoghreAdmin'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$data = $entityManager->getRepository(Person::class)->findPlugNoghreEmplyess($request->headers->get('activeBid'));
|
||||
return $this->json($data);
|
||||
}
|
||||
#[Route('/api/plugin/noghre/employess/mod/{id}', name: 'app_plug_noghre_employe_mod')]
|
||||
public function app_plug_noghre_employe_mod(Log $log,Request $request,EntityManagerInterface $entityManager,Access $access,String $id): Response
|
||||
{
|
||||
$acc = $access->hasRole('plugNoghreAdmin');
|
||||
if(!$acc) throw $this->createAccessDeniedException();
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(!array_key_exists('hakak',$params) ||!array_key_exists('ghalam',$params) || !array_key_exists('tarash',$params) || !array_key_exists('morsa',$params))
|
||||
throw $this->createAccessDeniedException('params incomplete');
|
||||
$person = $entityManager->getRepository(Person::class)->findOneBy(['code'=>$id]);
|
||||
if(!$person)
|
||||
throw $this->createNotFoundException('person not found');
|
||||
$person->setPlugNoghreMorsa($params['morsa']);
|
||||
$person->setPlugNoghreHakak($params['hakak']);
|
||||
$person->setPlugNoghreTarash($params['tarash']);
|
||||
$person->setPlugNoghreGhalam($params['ghalam']);
|
||||
$person->setEmploye(false);
|
||||
if($params['morsa'] || $params['tarash'] || $params['hakak'])
|
||||
$person->setEmploye(true);
|
||||
$entityManager->persist($person);
|
||||
$entityManager->flush();
|
||||
$data = $entityManager->getRepository(Person::class)->findPlugNoghreEmplyess($request->headers->get('activeBid'));
|
||||
$log->insert(
|
||||
'کارگاه منسوجات نقره',
|
||||
'مشخصات شاغل با نام ' . $person->getNikename() . ' ویرایش / افزوده شد.',
|
||||
$this->getUser(),
|
||||
$acc['bid']);
|
||||
return $this->json($data);
|
||||
}
|
||||
#[Route('/api/plugin/noghre/ghalam/list', name: 'app_plug_noghre_employees_ghalam_list')]
|
||||
public function app_plug_noghre_employees_ghalam_list(EntityManagerInterface $entityManager,Access $access,Request $request): Response
|
||||
{
|
||||
if(!$access->hasRole('plugNoghreAdmin'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$data = $entityManager->getRepository(Person::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid'),
|
||||
'plugNoghreGhalam'=>true
|
||||
]);
|
||||
return $this->json($data);
|
||||
}
|
||||
#[Route('/api/plugin/noghre/hakak/list', name: 'app_plug_noghre_employees_hakak_list')]
|
||||
public function app_plug_noghre_employees_hakak_list(EntityManagerInterface $entityManager,Access $access,Request $request): Response
|
||||
{
|
||||
if(!$access->hasRole('plugNoghreAdmin'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$data = $entityManager->getRepository(Person::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid'),
|
||||
'plugNoghreHakak'=>true
|
||||
]);
|
||||
return $this->json($data);
|
||||
}
|
||||
#[Route('/api/plugin/noghre/morsa/list', name: 'app_plug_noghre_employees_morsa_list')]
|
||||
public function app_plug_noghre_employees_morsa_list(EntityManagerInterface $entityManager,Access $access,Request $request): Response
|
||||
{
|
||||
if(!$access->hasRole('plugNoghreAdmin'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$data = $entityManager->getRepository(Person::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid'),
|
||||
'plugNoghreMorsa'=>true
|
||||
]);
|
||||
return $this->json($data);
|
||||
}
|
||||
#[Route('/api/plugin/noghre/tarash/list', name: 'app_plug_noghre_employees_tarash_list')]
|
||||
public function app_plug_noghre_employees_tarash_list(EntityManagerInterface $entityManager,Access $access,Request $request): Response
|
||||
{
|
||||
if(!$access->hasRole('plugNoghreAdmin'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$data = $entityManager->getRepository(Person::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid'),
|
||||
'plugNoghreTarash'=>true
|
||||
]);
|
||||
return $this->json($data);
|
||||
}
|
||||
|
||||
#[Route('/api/plugin/noghre/remove/order/{id}', name: 'app_plug_noghre_remove_order')]
|
||||
public function app_plug_noghre_remove_order(Log $log,Provider $provider, EntityManagerInterface $entityManager,Access $access,Request $request,String $id): Response
|
||||
{
|
||||
$acc = $access->hasRole('plugNoghreSell');
|
||||
if(!$acc)
|
||||
$acc = $access->hasRole('plugNoghreAdmin');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'code'=>$id,
|
||||
'bid'=>$acc['bid']
|
||||
]);
|
||||
if(!$doc)
|
||||
throw $this->createNotFoundException();
|
||||
if($doc->getPlugin() != 'plugNoghreOrder')
|
||||
throw $this->createAccessDeniedException();
|
||||
$order=$entityManager->getRepository(PlugNoghreOrder::class)->findOneBy(['doc'=>$doc]);
|
||||
//delete pays
|
||||
$pays = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
'plugin'=>'plugNoghrePay',
|
||||
'refData'=>$order->getDoc()->getCode()
|
||||
]);
|
||||
foreach($pays as $pay){
|
||||
$payDoc = $entityManager->getRepository(HesabdariDoc::class)->find($pay->getDoc()->getId());
|
||||
$resPays = $pays = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
'doc'=>$payDoc,
|
||||
]);
|
||||
foreach($resPays as $res){
|
||||
$entityManager->remove($res);
|
||||
$entityManager->flush();
|
||||
}
|
||||
$entityManager->remove($payDoc);
|
||||
$entityManager->flush();
|
||||
}
|
||||
$entityManager->remove($order);
|
||||
$rows=$entityManager->getRepository(HesabdariRow::class)->findBy(['doc'=>$doc]);
|
||||
foreach ($rows as $row){
|
||||
$entityManager->remove($row);
|
||||
$entityManager->flush();
|
||||
}
|
||||
$entityManager->flush();
|
||||
$entityManager->remove($doc);
|
||||
$entityManager->flush();
|
||||
$log->insert(
|
||||
'کارگاه منسوجات نقره',
|
||||
'سفارش مشتری با نام ' . $order->getCustomer()->getNikename() . ' حذف شد. ',
|
||||
$this->getUser(),
|
||||
$acc['bid']);
|
||||
return $this->json([
|
||||
'result'=>'ok'
|
||||
]);
|
||||
|
||||
}
|
||||
#[Route('/api/plugin/noghre/orders/list', name: 'app_plug_noghre_orders_list')]
|
||||
public function app_plug_noghre_orders_list(EntityManagerInterface $entityManager,Access $access,Request $request): Response
|
||||
{
|
||||
$acc = $access->hasRole('plugNoghreSell');
|
||||
if(!$acc)
|
||||
$acc = $access->hasRole('plugNoghreAdmin');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$items = $entityManager->getRepository(PlugNoghreOrder::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid'),
|
||||
]);
|
||||
$res = [];
|
||||
foreach ($items as $item){
|
||||
$temp = [];
|
||||
$temp['id']= $item->getId();
|
||||
$temp['customer']=$item->getCustomer()->getNikename();
|
||||
$temp['status'] = $item->getStatus();
|
||||
$temp['dateDeliver']= $item->getDeliveryDate();
|
||||
$temp['model']=$item->getRingModel();
|
||||
$temp['size']=$item->getRingSize();
|
||||
$temp['negin']=$item->getNegin();
|
||||
$temp['neginFee']=$item->getNeginFee();
|
||||
$temp['hakak']=$item->getHakak()->getNikename();
|
||||
$temp['code']=$item->getDoc()->getCode();
|
||||
$temp['price']=$item->getDoc()->getAmount();
|
||||
$res[] = $temp;
|
||||
}
|
||||
return $this->json($res);
|
||||
}
|
||||
|
||||
#[Route('/api/plugin/noghre/submit/order/{id}', name: 'app_plug_noghre_submit_order')]
|
||||
public function app_plug_noghre_submit_order(Log $log,Provider $provider, EntityManagerInterface $entityManager,Access $access,Request $request,String $id): Response
|
||||
{
|
||||
$acc = $access->hasRole('plugNoghreSell');
|
||||
if(!$acc)
|
||||
$acc = $access->hasRole('plugNoghreAdmin');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(!array_key_exists('hakak',$params) ||
|
||||
!array_key_exists('ghalam',$params) ||
|
||||
!array_key_exists('tarash',$params) ||
|
||||
!array_key_exists('morsa',$params) ||
|
||||
!array_key_exists('morsaPrice',$params) ||
|
||||
!array_key_exists('tarashPrice',$params) ||
|
||||
!array_key_exists('ghalamPrice',$params) ||
|
||||
!array_key_exists('hakakPrice',$params) ||
|
||||
!array_key_exists('modelPrice',$params) ||
|
||||
!array_key_exists('etcPrice',$params) ||
|
||||
!array_key_exists('place',$params) ||
|
||||
!array_key_exists('model',$params) ||
|
||||
!array_key_exists('size',$params) ||
|
||||
!array_key_exists('noghreAmount',$params) ||
|
||||
!array_key_exists('noghreFee',$params) ||
|
||||
!array_key_exists('negin',$params) ||
|
||||
!array_key_exists('neginFee',$params) ||
|
||||
!array_key_exists('dateDeliver',$params) ||
|
||||
!array_key_exists('dateSubmit',$params) ||
|
||||
!array_key_exists('status',$params) ||
|
||||
!array_key_exists('des',$params)
|
||||
)
|
||||
throw $this->createAccessDeniedException('params incomplete');
|
||||
$customer = $entityManager->getRepository(Person::class)->findOneBy(['id'=>$params['customer']['id'], 'bid'=>$acc['bid']]);
|
||||
if(!$customer)
|
||||
throw $this->createAccessDeniedException('params not found');
|
||||
|
||||
$hakak = $entityManager->getRepository(Person::class)->findOneBy(['id'=>$params['hakak']['id'], 'bid'=>$acc['bid']]);
|
||||
if(!$hakak)
|
||||
throw $this->createAccessDeniedException('params not found');
|
||||
|
||||
$morsa = $entityManager->getRepository(Person::class)->findOneBy(['id'=>$params['morsa']['id'], 'bid'=>$acc['bid']]);
|
||||
if(!$morsa)
|
||||
throw $this->createAccessDeniedException('params not found');
|
||||
|
||||
$tarash = $entityManager->getRepository(Person::class)->findOneBy(['id'=>$params['tarash']['id'], 'bid'=>$acc['bid']]);
|
||||
if(!$tarash)
|
||||
throw $this->createAccessDeniedException('params not found');
|
||||
|
||||
$ghalam = $entityManager->getRepository(Person::class)->findOneBy(['id'=>$params['ghalam']['id'], 'bid'=>$acc['bid']]);
|
||||
if(!$ghalam)
|
||||
throw $this->createAccessDeniedException('params not found');
|
||||
$order = new PlugNoghreOrder();
|
||||
$order->setCustomer($entityManager->getRepository(Person::class)->find($params['customer']['id']));
|
||||
$order->setDeliveryDate($params['dateDeliver']);
|
||||
$order->setStatus($params['status']);
|
||||
$order->setPlace($params['place']);
|
||||
$order->setRingModel($params['model']);
|
||||
$order->setRingSize($params['size']);
|
||||
$order->setNoghreAmount($params['noghreAmount']);
|
||||
$order->setNoghreFee($params['noghreFee']);
|
||||
$order->setNegin($params['negin']);
|
||||
$order->setNeginFee($params['neginFee']);
|
||||
$order->setTarash($entityManager->getRepository(Person::class)->find($params['tarash']['id']));
|
||||
$order->setMorsa($entityManager->getRepository(Person::class)->find($params['morsa']['id']));
|
||||
$order->setHakak($entityManager->getRepository(Person::class)->find($params['hakak']['id']));
|
||||
$order->setGhalam($entityManager->getRepository(Person::class)->find($params['ghalam']['id']));
|
||||
$order->setBid($acc['bid']);
|
||||
$order->setDes($params['des']);
|
||||
|
||||
//create hesabdari doc
|
||||
$doc = new HesabdariDoc();
|
||||
$doc->setDateSubmit(time());
|
||||
$doc->setSubmitter($this->getUser());
|
||||
$doc->setDes('سفارش ساخت منسوجات نقره: ' . $params['des']);
|
||||
$doc->setBid($acc['bid']);
|
||||
$doc->setPlugin('plugNoghreOrder');
|
||||
$doc->setMoney($acc['bid']->getMoney());
|
||||
$doc->setDate($params['dateSubmit']);
|
||||
$doc->setYear($acc['year']);
|
||||
$doc->setType('plug_noghre_order');
|
||||
$doc->setAmount($params['etcPrice'] + ($params['noghreAmount']*$params['noghreFee']) + $params['hakakPrice'] + $params['ghalamPrice'] + $params['tarashPrice'] + $params['morsaPrice']);
|
||||
$doc->setCode($provider->getAccountingCode($acc['bid'],'accounting'));
|
||||
$entityManager->persist($doc);
|
||||
$entityManager->flush();
|
||||
$order->setDoc($doc);
|
||||
|
||||
//hesabdari rows
|
||||
//sell noghre
|
||||
$row = new HesabdariRow();
|
||||
$row->setPlugin('plugNoghreOrder');
|
||||
$row->setRefData('noghrePrice');
|
||||
$row->setDoc($doc);
|
||||
$row->setBid($acc['bid']);
|
||||
$row->setYear($acc['year']);
|
||||
$row->setBd(0);
|
||||
$row->setBs($params['noghreFee'] * $params['noghreAmount']);
|
||||
$row->setDes('استفاده از ' . $params['noghreAmount'] . ' گرم نقره با نرخ ' . $params['noghreFee'] . 'در سفارش مشتری');
|
||||
$row->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>58]));
|
||||
$entityManager->persist($row);
|
||||
$entityManager->flush();
|
||||
|
||||
//sell negin
|
||||
if($params['neginFee'] != 0){
|
||||
$row = new HesabdariRow();
|
||||
$row->setPlugin('plugNoghreOrder');
|
||||
$row->setRefData('neginPrice');
|
||||
$row->setDoc($doc);
|
||||
$row->setBid($acc['bid']);
|
||||
$row->setYear($acc['year']);
|
||||
$row->setBd(0);
|
||||
$row->setBs($params['neginFee']);
|
||||
$row->setDes('استفاده از نگین' . $params['negin'] . ' با نرخ ' . $params['neginFee'] . 'در سفارش مشتری');
|
||||
$row->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>58]));
|
||||
$entityManager->persist($row);
|
||||
$entityManager->flush();
|
||||
}
|
||||
//sell tarash row
|
||||
if($params['tarashPrice'] != 0){
|
||||
$row = new HesabdariRow();
|
||||
$row->setPlugin('plugNoghreOrder');
|
||||
$row->setRefData('tarashPrice');
|
||||
$row->setDoc($doc);
|
||||
$row->setBid($acc['bid']);
|
||||
$row->setYear($acc['year']);
|
||||
$row->setBd(0);
|
||||
$row->setBs($params['tarashPrice']);
|
||||
$row->setDes('اجرت تراشکاری ' . $params['tarashPrice'] . ' تراشکار: ' . $params['tarash']['nikename'] );
|
||||
$row->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>58]));
|
||||
$entityManager->persist($row);
|
||||
$entityManager->flush();
|
||||
}
|
||||
//sell model price row
|
||||
if($params['modelPrice'] != 0){
|
||||
$row = new HesabdariRow();
|
||||
$row->setPlugin('plugNoghreOrder');
|
||||
$row->setRefData('modelPrice');
|
||||
$row->setDoc($doc);
|
||||
$row->setBid($acc['bid']);
|
||||
$row->setYear($acc['year']);
|
||||
$row->setBd(0);
|
||||
$row->setBs($params['modelPrice']);
|
||||
$row->setDes('اجرت اجرای مدل منسوجات نقره' );
|
||||
$row->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>58]));
|
||||
$entityManager->persist($row);
|
||||
$entityManager->flush();
|
||||
}
|
||||
//sell hakak row
|
||||
if($params['hakakPrice'] != 0){
|
||||
$row = new HesabdariRow();
|
||||
$row->setPlugin('plugNoghreOrder');
|
||||
$row->setRefData('hakakPrice');
|
||||
$row->setDoc($doc);
|
||||
$row->setBid($acc['bid']);
|
||||
$row->setYear($acc['year']);
|
||||
$row->setBd(0);
|
||||
$row->setBs($params['hakakPrice']);
|
||||
$row->setDes('اجرت حکاکی ' . $params['hakakPrice'] . ' حکاک: ' . $params['hakak']['nikename'] );
|
||||
$row->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>58]));
|
||||
$entityManager->persist($row);
|
||||
$entityManager->flush();
|
||||
}
|
||||
//sell morsa row
|
||||
if($params['morsaPrice'] != 0){
|
||||
$row = new HesabdariRow();
|
||||
$row->setPlugin('plugNoghreOrder');
|
||||
$row->setRefData('morsaPrice');
|
||||
$row->setDoc($doc);
|
||||
$row->setBid($acc['bid']);
|
||||
$row->setYear($acc['year']);
|
||||
$row->setBd(0);
|
||||
$row->setBs($params['morsaPrice']);
|
||||
$row->setDes('اجرت مرصع کاری ' . $params['morsaPrice'] . ' مرصع کار: ' . $params['morsa']['nikename'] );
|
||||
$row->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>58]));
|
||||
$entityManager->persist($row);
|
||||
$entityManager->flush();
|
||||
}
|
||||
//sell ghalam row
|
||||
if($params['ghalamPrice'] != 0){
|
||||
$row = new HesabdariRow();
|
||||
$row->setPlugin('plugNoghreOrder');
|
||||
$row->setRefData('ghalamPrice');
|
||||
$row->setDoc($doc);
|
||||
$row->setBid($acc['bid']);
|
||||
$row->setYear($acc['year']);
|
||||
$row->setBd(0);
|
||||
$row->setBs($params['ghalamPrice']);
|
||||
$row->setDes('اجرت قلم زنی ' . $params['ghalamPrice'] . ' قلم زن: ' . $params['ghalam']['nikename'] );
|
||||
$row->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>58]));
|
||||
$entityManager->persist($row);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
//sell etc price row
|
||||
if($params['etcPrice'] != 0){
|
||||
$row = new HesabdariRow();
|
||||
$row->setPlugin('plugNoghreOrder');
|
||||
$row->setRefData('etcPrice');
|
||||
$row->setDoc($doc);
|
||||
$row->setBid($acc['bid']);
|
||||
$row->setYear($acc['year']);
|
||||
$row->setBd(0);
|
||||
$row->setBs($params['etcPrice']);
|
||||
$row->setDes('سایر هزینهها' );
|
||||
$row->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>58]));
|
||||
$entityManager->persist($row);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
//add person to bedehkari
|
||||
$row = new HesabdariRow();
|
||||
$row->setPlugin('plugNoghreOrder');
|
||||
$row->setRefData('customer');
|
||||
$row->setDoc($doc);
|
||||
$row->setBid($acc['bid']);
|
||||
$row->setYear($acc['year']);
|
||||
$row->setBd($params['etcPrice'] + ($params['noghreAmount']*$params['noghreFee']) + $params['hakakPrice'] + $params['ghalamPrice'] + $params['tarashPrice'] + $params['morsaPrice']);
|
||||
$row->setBs(0);
|
||||
$row->setDes('خرید کالا و خدمات (سفارش منسوجات نقره)' );
|
||||
$row->setRef($entityManager->getRepository(HesabdariTable::class)->findOneBy(['code'=>8]));
|
||||
$row->setPerson($entityManager->getRepository(Person::class)->findOneBy(
|
||||
[
|
||||
'id'=>$params['customer']['id'],
|
||||
'bid'=>$acc['bid']
|
||||
]
|
||||
));
|
||||
$entityManager->persist($row);
|
||||
$entityManager->flush();
|
||||
|
||||
$entityManager->persist($order);
|
||||
$entityManager->flush();
|
||||
|
||||
$log->insert(
|
||||
'کارگاه منسوجات نقره',
|
||||
'سفارش مشتری ' . $order->getCustomer()->getNikename() . ' ویرایش / ایجاد شد.',
|
||||
$this->getUser(),
|
||||
$acc['bid']);
|
||||
|
||||
return $this->json(['result'=>'ok']);
|
||||
}
|
||||
|
||||
#[Route('/api/plugin/noghre/customer/info/{code}', name: 'app_plug_noghre_customer_info')]
|
||||
public function app_plug_noghre_customer_info($code,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('plugNoghreSell');
|
||||
if(!$acc)
|
||||
$acc = $access->hasRole('plugNoghreAdmin');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$person = $entityManager->getRepository(Person::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'code'=>$code
|
||||
]);
|
||||
return $this->json($person);
|
||||
}
|
||||
|
||||
#[Route('/api/plugin/noghre/order/info/{code}', name: 'app_plug_noghre_order_info')]
|
||||
public function app_plug_noghre_order_info($code,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('plugNoghreSell');
|
||||
if(!$acc)
|
||||
$acc = $access->hasRole('plugNoghreAdmin');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$items = $entityManager->getRepository(PlugNoghreOrder::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'id'=>$code
|
||||
]);
|
||||
$info = $provider->Entity2Array($items,1,[]);
|
||||
$hakak = $entityManager->getRepository(HesabdariRow::class)->findOneBy([
|
||||
'doc'=>$items->getDoc(),
|
||||
'plugin'=>'plugNoghreOrder',
|
||||
'refData'=>'hakakPrice'
|
||||
]);
|
||||
$info['hakakPrice'] = $provider->Entity2Array($hakak,1,[]);
|
||||
|
||||
$tarashRow = $entityManager->getRepository(HesabdariRow::class)->findOneBy([
|
||||
'doc'=>$items->getDoc(),
|
||||
'plugin'=>'plugNoghreOrder',
|
||||
'refData'=>'tarashPrice'
|
||||
]);
|
||||
$info['tarashRow'] = $provider->Entity2Array($tarashRow,1,[]);
|
||||
|
||||
$ghalamRow = $entityManager->getRepository(HesabdariRow::class)->findOneBy([
|
||||
'doc'=>$items->getDoc(),
|
||||
'plugin'=>'plugNoghreOrder',
|
||||
'refData'=>'ghalamPrice'
|
||||
]);
|
||||
$info['ghalamRow'] = $provider->Entity2Array($ghalamRow,1,[]);
|
||||
|
||||
$etcPriceRow = $entityManager->getRepository(HesabdariRow::class)->findOneBy([
|
||||
'doc'=>$items->getDoc(),
|
||||
'plugin'=>'plugNoghreOrder',
|
||||
'refData'=>'etcPrice'
|
||||
]);
|
||||
$info['etcPriceRow'] = $provider->Entity2Array($etcPriceRow,1,[]);
|
||||
|
||||
$morsaRow = $entityManager->getRepository(HesabdariRow::class)->findOneBy([
|
||||
'doc'=>$items->getDoc(),
|
||||
'plugin'=>'plugNoghreOrder',
|
||||
'refData'=>'morsaPrice'
|
||||
]);
|
||||
$info['morsaRow'] = $provider->Entity2Array($morsaRow,1,[]);
|
||||
|
||||
$modelPriceRow = $entityManager->getRepository(HesabdariRow::class)->findOneBy([
|
||||
'doc'=>$items->getDoc(),
|
||||
'plugin'=>'plugNoghreOrder',
|
||||
'refData'=>'modelPrice'
|
||||
]);
|
||||
$info['morsaRow'] = $provider->Entity2Array($modelPriceRow,1,[]);
|
||||
|
||||
return $this->json(
|
||||
$info
|
||||
);
|
||||
}
|
||||
|
||||
#[Route('/api/plugin/noghre/order/pays/list/{code}', name: 'app_plug_noghre_order_pays_list')]
|
||||
public function app_plug_noghre_order_pays_list($code,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('plugNoghreSell');
|
||||
if(!$acc)
|
||||
$acc = $access->hasRole('plugNoghreAdmin');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$order = $entityManager->getRepository(PlugNoghreOrder::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'id'=>$code
|
||||
]);
|
||||
|
||||
$rows = $entityManager->getRepository(HesabdariRow::class)->findBy([
|
||||
'plugin'=>'plugNoghrePay',
|
||||
'refData'=>$order->getDoc()->getCode()
|
||||
]);
|
||||
$res = [];
|
||||
foreach ($rows as $item){
|
||||
$temp = [];
|
||||
$temp['id'] = $item->getid();
|
||||
$temp['code'] = $item->getDoc()->getCode();
|
||||
$temp['amount'] = $item->getBd();
|
||||
$temp['date'] = $item->getDoc()->getDate();
|
||||
$temp['des'] = $item->getDes();
|
||||
if($item->getBank()){
|
||||
$temp['type']='حساب بانکی';
|
||||
$temp['ref']=$item->getBank()->getName();
|
||||
}
|
||||
elseif($item->getCashdesk()){
|
||||
$temp['type']='صندوق';
|
||||
$temp['ref']=$item->getCashdesk()->getName();
|
||||
}
|
||||
elseif($item->getSalary()){
|
||||
$temp['type']='تنخواه گردان';
|
||||
$temp['ref']=$item->getSalary()->getName();
|
||||
}
|
||||
$res[] = $temp;
|
||||
}
|
||||
return $this->json($res);
|
||||
}
|
||||
|
||||
#[Route('/api/plugin/noghre/order/pays/remove/{code}', name: 'app_plug_noghre_order_pays_remove')]
|
||||
public function app_plug_noghre_order_pays_remove($code,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
|
||||
$acc = $access->hasRole('plugNoghreSell');
|
||||
if(!$acc)
|
||||
$acc = $access->hasRole('plugNoghreAdmin');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
|
||||
$doc = $entityManager->getRepository(HesabdariDoc::class)->findOneBy([
|
||||
'code'=>$code,
|
||||
'plugin'=>'plugNoghrePay',
|
||||
'bid'=>$acc['bid']
|
||||
]);
|
||||
if(!$doc)
|
||||
throw $this->createNotFoundException();
|
||||
foreach($doc->getHesabdariRows() as $row){
|
||||
$entityManager->remove($row);
|
||||
$entityManager->flush();
|
||||
}
|
||||
|
||||
$entityManager->remove($doc);
|
||||
$entityManager->flush();
|
||||
$log->insert(
|
||||
'کارگاه منسوجات نقره',
|
||||
'سند پرداخت سفارش حذف شد.',
|
||||
$this->getUser(),
|
||||
$acc['bid']);
|
||||
return $this->json(['result'=>1]);
|
||||
}
|
||||
|
||||
}
|
83
hesabixCore/src/Controller/SalaryController.php
Normal file
83
hesabixCore/src/Controller/SalaryController.php
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Salary;
|
||||
use App\Service\Access;
|
||||
use App\Service\Log;
|
||||
use App\Service\Provider;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class SalaryController extends AbstractController
|
||||
{
|
||||
#[Route('/api/salary/list', name: 'app_salary_list')]
|
||||
public function app_salary_list(Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
if(!$access->hasRole('salary'))
|
||||
throw $this->createAccessDeniedException();
|
||||
$data = $entityManager->getRepository(Salary::class)->findBy([
|
||||
'bid'=>$request->headers->get('activeBid')
|
||||
]);
|
||||
return $this->json($data);
|
||||
}
|
||||
|
||||
#[Route('/api/salary/info/{code}', name: 'app_salary_info')]
|
||||
public function app_salary_info($code,Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('salary');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$data = $entityManager->getRepository(Salary::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'code'=>$code
|
||||
]);
|
||||
return $this->json($data);
|
||||
}
|
||||
|
||||
#[Route('/api/salary/mod/{code}', name: 'app_salary_mod')]
|
||||
public function app_salary_mod(Provider $provider,Request $request,Access $access,Log $log,EntityManagerInterface $entityManager,$code = 0): JsonResponse
|
||||
{
|
||||
$acc = $access->hasRole('salary');
|
||||
if(!$acc)
|
||||
throw $this->createAccessDeniedException();
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(!array_key_exists('name',$params))
|
||||
return $this->json(['result'=>-1]);
|
||||
if(count_chars(trim($params['name'])) == 0)
|
||||
return $this->json(['result'=>3]);
|
||||
if($code == 0){
|
||||
$data = $entityManager->getRepository(Salary::class)->findOneBy([
|
||||
'name'=>$params['name'],
|
||||
'bid' =>$acc['bid']
|
||||
]);
|
||||
//check exist before
|
||||
if($data)
|
||||
return $this->json(['result'=>2]);
|
||||
$data = new Salary();
|
||||
$data->setCode($provider->getAccountingCode($request->headers->get('activeBid'),'salary'));
|
||||
}
|
||||
else{
|
||||
$data = $entityManager->getRepository(Salary::class)->findOneBy([
|
||||
'bid'=>$acc['bid'],
|
||||
'code'=>$code
|
||||
]);
|
||||
if(!$data)
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
$data->setBid($acc['bid']);
|
||||
$data->setname($params['name']);
|
||||
$data->setDes($params['des']);
|
||||
$entityManager->persist($data);
|
||||
$entityManager->flush();
|
||||
$log->insert('بانک','تنخواه گردان با نام ' . $params['name'] . ' افزوده/ویرایش شد.',$this->getUser(),$request->headers->get('activeBid'));
|
||||
return $this->json(['result' => 1]);
|
||||
}
|
||||
}
|
114
hesabixCore/src/Controller/SupportController.php
Normal file
114
hesabixCore/src/Controller/SupportController.php
Normal file
|
@ -0,0 +1,114 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Support;
|
||||
use App\Service\Jdate;
|
||||
use App\Service\SMS;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
class SupportController extends AbstractController
|
||||
{
|
||||
#[Route('/api/support/list', name: 'app_support_list')]
|
||||
public function app_support_list(Jdate $jdate,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$items = $entityManager->getRepository(Support::class)->findBy([
|
||||
'submitter'=>$this->getUser(),
|
||||
'main'=>0
|
||||
],
|
||||
[
|
||||
'id'=>'DESC'
|
||||
]);
|
||||
foreach ($items as $item){
|
||||
$item->setDateSubmit($jdate->jdate('Y/n/d H:i',$item->getDateSubmit()));
|
||||
}
|
||||
return $this->json($items);
|
||||
}
|
||||
|
||||
#[Route('/api/support/mod/{id}', name: 'app_support_mod')]
|
||||
public function app_support_mod(SMS $SMS,Request $request, EntityManagerInterface $entityManager,string $id = ''): JsonResponse
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if($id == ''){
|
||||
if(array_key_exists('title',$params) && array_key_exists('body',$params) && array_key_exists('bid',$params)){
|
||||
$item = new Support();
|
||||
$item->setBody($params['body']);
|
||||
$item->setTitle($params['title']);
|
||||
$item->setDateSubmit(time());
|
||||
$item->setSubmitter($this->getUser());
|
||||
$item->setMain(0);
|
||||
$item->setState('در حال پیگیری');
|
||||
$entityManager->persist($item);
|
||||
$entityManager->flush();
|
||||
//send sms to manager
|
||||
$SMS->send([$item->getId()],'162214','09183282405');
|
||||
return $this->json([
|
||||
'error'=> 0,
|
||||
'message'=> 'ok',
|
||||
'url'=>$item->getId()
|
||||
]);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(array_key_exists('body',$params) ){
|
||||
$item = new Support();
|
||||
$upper = $entityManager->getRepository(Support::class)->find($id);
|
||||
if($upper)
|
||||
$item->setMain($upper->getid());
|
||||
$item->setBody($params['body']);
|
||||
$item->setTitle($upper->getTitle());
|
||||
$item->setDateSubmit(time());
|
||||
$item->setSubmitter($this->getUser());
|
||||
$item->setState('در حال پیگیری');
|
||||
$entityManager->persist($item);
|
||||
$entityManager->flush();
|
||||
$upper->setState('در حال پیگیری');
|
||||
$entityManager->persist($upper);
|
||||
$entityManager->flush();
|
||||
//send sms to manager
|
||||
$SMS->send([$item->getId()],'162214','09183282405');
|
||||
return $this->json([
|
||||
'error'=> 0,
|
||||
'message'=> 'ok',
|
||||
'url'=>$item->getId()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->json([
|
||||
'error'=> 999,
|
||||
'message'=> 'تمام موارد لازم را وارد کنید.'
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/api/support/view/{id}', name: 'app_support_view')]
|
||||
public function app_support_view(Jdate $jdate, EntityManagerInterface $entityManager,string $id = ''): JsonResponse
|
||||
{
|
||||
$item = $entityManager->getRepository(Support::class)->find($id);
|
||||
if(!$item) throw $this->createNotFoundException();
|
||||
if($item->getSubmitter() != $this->getUser()) throw $this->createAccessDeniedException();
|
||||
$replays = $entityManager->getRepository(Support::class)->findBy(['main'=>$item->getId()]);
|
||||
foreach ($replays as $replay){
|
||||
$replay->setDateSubmit($jdate->jdate('Y/n/d H:i',$replay->getDateSubmit()));
|
||||
$replay->setTitle($replay->getSubmitter()->getFullname());
|
||||
if($replay->getSubmitter() == $this->getUser())
|
||||
$replay->setState(1);
|
||||
else
|
||||
$replay->setState(0);
|
||||
}
|
||||
$item->setDateSubmit($jdate->jdate('Y/n/d H:i',$item->getDateSubmit()));
|
||||
return $this->json([
|
||||
'item'=> $item,
|
||||
'replays'=> $replays
|
||||
]);
|
||||
}
|
||||
}
|
368
hesabixCore/src/Controller/UserController.php
Normal file
368
hesabixCore/src/Controller/UserController.php
Normal file
|
@ -0,0 +1,368 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
use App\Entity\Business;
|
||||
use App\Entity\EmailHistory;
|
||||
use App\Entity\Permission;
|
||||
use App\Service\Provider;
|
||||
use App\Service\SMS;
|
||||
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
|
||||
use Symfony\Component\Mailer\MailerInterface;
|
||||
use Symfony\Component\Mime\Email;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use App\Entity\UserToken;
|
||||
use Exception;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
|
||||
use Symfony\Component\Security\Http\Attribute\CurrentUser;
|
||||
use App\Entity\User;
|
||||
use App\Security\EmailVerifier;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Mime\Address;
|
||||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||
use SymfonyCasts\Bundle\VerifyEmail\Exception\VerifyEmailExceptionInterface;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher,
|
||||
Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken,
|
||||
Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
|
||||
use function PHPUnit\Framework\throwException;
|
||||
|
||||
class UserController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* function to generate random strings
|
||||
* @param int $length number of characters in the generated string
|
||||
* @return string a new string is created with random characters of the desired length
|
||||
*/
|
||||
private function RandomString(int $length = 32 , $justNumber = false): string
|
||||
{
|
||||
if($justNumber)
|
||||
return substr(str_shuffle(str_repeat($x='0123456789', ceil($length/strlen($x)) )),1,$length);
|
||||
|
||||
return substr(str_shuffle(str_repeat($x='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', ceil($length/strlen($x)) )),1,$length);
|
||||
}
|
||||
|
||||
#[Route('/api/user/login', name: 'api_login')]
|
||||
public function api_login(#[CurrentUser] ?User $user,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if (null === $user) {
|
||||
return $this->json([
|
||||
'message' => 'missing credentials',
|
||||
], Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
|
||||
$tokenString = $this->RandomString(254); // somehow create an API token for $user
|
||||
$token = new UserToken();
|
||||
$token->setUser($user);
|
||||
$token->setToken($tokenString);
|
||||
$entityManager->persist($token);
|
||||
$entityManager->flush();
|
||||
return $this->json([
|
||||
'user' => $user->getUserIdentifier(),
|
||||
'token' => $tokenString,
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/api/user/has/role/{id}', name: 'api_user_has_role')]
|
||||
public function api_user_has_role(#[CurrentUser] ?User $user,EntityManagerInterface $entityManager,$id): Response
|
||||
{
|
||||
if($this->isGranted($id)){
|
||||
return $this->json(
|
||||
['result'=>true]
|
||||
);
|
||||
}
|
||||
return $this->json(
|
||||
['result'=>false]
|
||||
);
|
||||
}
|
||||
#[Route('/api/user/check/login', name: 'api_user_check_login')]
|
||||
public function api_user_check_login(#[CurrentUser] ?User $user,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if (null === $user) {
|
||||
return $this->json(
|
||||
['result'=>false]
|
||||
);
|
||||
}
|
||||
return $this->json(
|
||||
[
|
||||
'result'=>true,
|
||||
'email'=>$user->getEmail(),
|
||||
'active'=>$user->isActive()
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[Route('/api/user/get/permissions', name: 'api_user_get_permissions')]
|
||||
public function api_user_get_permissions(#[CurrentUser] ?User $user,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
if (null === $user) {
|
||||
return $this->json([
|
||||
'message' => 'missing credentials',
|
||||
], Response::HTTP_UNAUTHORIZED);
|
||||
}
|
||||
return $this->json(
|
||||
['is_login'=>true]
|
||||
);
|
||||
}
|
||||
|
||||
#[Route('/api/user/get/users/of/business/{bid}', name: 'api_user_get_of_business')]
|
||||
public function api_user_get_of_business($bid,#[CurrentUser] ?User $user,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$business = $entityManager->getRepository(Business::class)->find($bid);
|
||||
if(!$business)
|
||||
throw $this->createNotFoundException();
|
||||
$perms = $entityManager->getRepository(Permission::class)->findBy(['bid'=>$business]);
|
||||
$out = [];
|
||||
foreach ($perms as $perm){
|
||||
$temp=[];
|
||||
$temp['name'] = $perm->getUser()->getFullName();
|
||||
$temp['email'] = $perm->getUser()->getEmail();
|
||||
$temp['owner'] = $perm->isOwner();
|
||||
$out[] = $temp;
|
||||
}
|
||||
return $this->json($out);
|
||||
}
|
||||
|
||||
#[Route('/api/user/current/info', name: 'api_user_current_info')]
|
||||
public function api_user_current_info(#[CurrentUser] ?User $user,Provider $provider,EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
return $this->json([
|
||||
'id'=> $user->getId(),
|
||||
'email'=>$user->getEmail(),
|
||||
'fullname'=>$user->getFullName(),
|
||||
'businessCount'=>count($user->getBusinesses()),
|
||||
'hash_email'=> $provider->gravatarHash($user->getEmail()),
|
||||
'mobile'=>$user->getMobile()
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/api/user/logout', name: 'api_user_logout')]
|
||||
public function api_user_logout(Security $security,EntityManagerInterface $entityManager,Request $request): Response
|
||||
{
|
||||
// logout the user in on the current firewall
|
||||
$security->logout(false);
|
||||
$apiToken = $request->headers->get('X-AUTH-TOKEN');
|
||||
|
||||
if (null == $apiToken) {
|
||||
// The token header was empty, authentication fails with HTTP Status
|
||||
// Code 401 "Unauthorized"
|
||||
throw new CustomUserMessageAuthenticationException('No API token provided');
|
||||
}
|
||||
$tk = $entityManager->getRepository(UserToken::class)->findByApiToken($apiToken);
|
||||
if (! $tk) {
|
||||
throw new UserNotFoundException();
|
||||
}
|
||||
$entityManager->getRepository(UserToken::class)->remove($tk,true);
|
||||
return $this->json(['result'=>true]);
|
||||
}
|
||||
|
||||
|
||||
#[Route('/api/user/update/info', name: 'api_user_update_info')]
|
||||
public function api_user_update_info(#[CurrentUser] ?User $user,EntityManagerInterface $entityManager,Request $request): Response
|
||||
{
|
||||
$pameters = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$pameters = json_decode($content, true);
|
||||
}
|
||||
$user->setFullName($pameters['fullname']);
|
||||
$entityManager->persist($user);
|
||||
$entityManager->flush();
|
||||
return $this->json(['result'=>true]);
|
||||
}
|
||||
|
||||
#[Route('/api/user/is_superadmin', name: 'api_user_is_super_admin')]
|
||||
public function api_user_is_super_admin(#[CurrentUser] ?User $user,EntityManagerInterface $entityManager,Request $request): Response
|
||||
{
|
||||
$this->denyAccessUnlessGranted('ROLE_ADMIN');
|
||||
return $this->json(['result'=>1]);
|
||||
}
|
||||
|
||||
#[Route('/api/user/change/password', name: 'api_user_change_password')]
|
||||
public function api_user_change_password(#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if($params['pass'] == $params['repass']){
|
||||
$user->setPassword(
|
||||
$userPasswordHasher->hashPassword(
|
||||
$user,
|
||||
$params['pass']
|
||||
)
|
||||
);
|
||||
$entityManager->persist($user);
|
||||
$entityManager->flush();
|
||||
return $this->json(['result'=>true]);
|
||||
}
|
||||
return $this->json(['result'=>false]);
|
||||
}
|
||||
|
||||
#[Route('/api/user/register', name: 'api_user_register')]
|
||||
public function api_user_register(SMS $SMS,MailerInterface $mailer,Request $request, UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager): Response
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(array_key_exists('name',$params) && array_key_exists('email',$params) && array_key_exists('mobile',$params) && array_key_exists('password',$params )){
|
||||
if($entityManager->getRepository(User::class)->findOneBy(['email'=>trim($params['email'])])){
|
||||
return $this->json([
|
||||
'error'=> 1,
|
||||
'message'=> 'این پست الکترونیکی قبلا ثبت شده است.'
|
||||
]);
|
||||
}
|
||||
elseif($entityManager->getRepository(User::class)->findOneBy(['mobile'=>trim($params['mobile'])])){
|
||||
return $this->json([
|
||||
'error'=> 2,
|
||||
'message'=> 'این شماره تلفن قبلا ثبت شده است.'
|
||||
]);
|
||||
}
|
||||
$user = new User();
|
||||
$user->setEmail($params['email']);
|
||||
$user->setRoles(['ROLE_USER']);
|
||||
$user->setFullName($params['name']);
|
||||
$user->setMobile($params['mobile']);
|
||||
$user->setVerifyCodeTime(time() + 300);
|
||||
$user->setDateRegister(time());
|
||||
$user->setPassword(
|
||||
$userPasswordHasher->hashPassword(
|
||||
$user,
|
||||
$params['password']
|
||||
)
|
||||
);
|
||||
$user->setActive(false);
|
||||
$entityManager->persist($user);
|
||||
$entityManager->flush();
|
||||
return $this->json([
|
||||
'error'=> 0,
|
||||
'id'=>$user->getId(),
|
||||
'message'=> 'ok',
|
||||
]);
|
||||
}
|
||||
return $this->json([
|
||||
'error'=> 999,
|
||||
'message'=> 'تمام موارد لازم را وارد کنید.'
|
||||
]);
|
||||
|
||||
return $this->json(['ok']);
|
||||
}
|
||||
|
||||
#[Route('/api/user/active/code/info/{id}', name: 'api_user_active_code_info')]
|
||||
public function api_user_active_code_info(MailerInterface $mailer,SMS $SMS,String $id,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
|
||||
{
|
||||
$send = false;
|
||||
$user = $entityManager->getRepository(User::class)->find($id);
|
||||
if(!$user)
|
||||
throw $this->createNotFoundException('user not exist');
|
||||
if(!$user->getMobile())
|
||||
return $this->json(['id'=>$user->getId(),'active'=>false,'result'=>'mobilenotset']);
|
||||
if($user->isActive())
|
||||
return $this->json(['id'=>$user->getId(),'active'=>true]);
|
||||
$res = [];
|
||||
$res['id'] = $user->getId();
|
||||
$res['email'] = $user->getEmail();
|
||||
$res['time'] = time();
|
||||
$res['active'] = false;
|
||||
if($user->getVerifyCodeTime()){
|
||||
if(time() > $user->getVerifyCodeTime()){
|
||||
$user->setVerifyCodeTime(time() + 300);
|
||||
$user->setVerifyCode($this->RandomString(6,true));
|
||||
$entityManager->persist($user);
|
||||
$entityManager->flush();
|
||||
$send = true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$user->setVerifyCodeTime(time() + 300);
|
||||
$user->setVerifyCode($this->RandomString(6,true));
|
||||
$entityManager->persist($user);
|
||||
$entityManager->flush();
|
||||
$send = true;
|
||||
}
|
||||
$res['cutDown'] = $user->getVerifyCodeTime();
|
||||
|
||||
if($send){
|
||||
//send sms and email
|
||||
$SMS->send([$user->getVerifyCode()],'162246',$user->getMobile());
|
||||
$email = (new Email())
|
||||
->to($user->getEmail())
|
||||
->priority(Email::PRIORITY_HIGH)
|
||||
->subject('تایید ایمیل در حسابیکس')
|
||||
->html(
|
||||
$this->renderView('user/email/confrim-register.html.twig',[
|
||||
'code'=>$user->getVerifyCode()
|
||||
])
|
||||
);
|
||||
|
||||
$mailer->send($email);
|
||||
}
|
||||
return $this->json($res);
|
||||
}
|
||||
|
||||
#[Route('/api/user/active/account/{id}', name: 'api_user_active_account')]
|
||||
public function api_user_active_account(MailerInterface $mailer,SMS $SMS,String $id,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
|
||||
{
|
||||
$send = false;
|
||||
$user = $entityManager->getRepository(User::class)->find($id);
|
||||
if(!$user)
|
||||
throw $this->createNotFoundException('user not exist');
|
||||
if($user->isActive())
|
||||
return $this->json(['result'=>'active before','id'=>$user->getId(),'active'=>true]);
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(!array_key_exists('code',$params))
|
||||
throw $this->createNotFoundException('code not exist');
|
||||
|
||||
if($user->getVerifyCode() == $params['code']){
|
||||
$user->setActive(true);
|
||||
$entityManager->persist($user);
|
||||
$entityManager->flush();
|
||||
return $this->json(['result'=>'ok','id'=>$user->getId(),'active'=>true]);
|
||||
}
|
||||
return $this->json(['result'=>'not correct','id'=>$user->getId(),'active'=>false]);
|
||||
}
|
||||
#[Route('/api/user/forget/password/send-code', name: 'api_user_forget_password_send_code')]
|
||||
public function api_user_forget_password_send_code(#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(! array_key_exists('email',$params))
|
||||
throw $this->createAccessDeniedException('email not send');
|
||||
$user = $entityManager->getRepository(User::class)->findOneBy(['email'=>$params['email']]);
|
||||
if(!$user)
|
||||
throw $this->createNotFoundException('email not exist');
|
||||
$user->setVerifyCode(1234);
|
||||
|
||||
return $this->json(['result'=>false]);
|
||||
}
|
||||
#[Route('/api/user/save/mobile-number', name: 'api_user_save_mobile_number')]
|
||||
public function api_user_save_mobile_number(MailerInterface $mailer,SMS $SMS,#[CurrentUser] ?User $user,UserPasswordHasherInterface $userPasswordHasher, EntityManagerInterface $entityManager,Request $request): Response
|
||||
{
|
||||
$params = [];
|
||||
if ($content = $request->getContent()) {
|
||||
$params = json_decode($content, true);
|
||||
}
|
||||
if(! array_key_exists('mobile',$params))
|
||||
throw $this->createAccessDeniedException('mobile not set');
|
||||
$user = $this->getUser();
|
||||
if(!$user->getMobile()){
|
||||
$user->setMobile($params['mobile']);
|
||||
$entityManager->persist($user);
|
||||
$entityManager->flush();
|
||||
return $this->json(['result'=>'ok']);
|
||||
}
|
||||
return $this->json(['result'=>'exist-before']);
|
||||
}
|
||||
}
|
47
hesabixCore/src/Controller/YearController.php
Normal file
47
hesabixCore/src/Controller/YearController.php
Normal file
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Entity\Business;
|
||||
use App\Entity\Year;
|
||||
use App\Service\Jdate;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class YearController extends AbstractController
|
||||
{
|
||||
#[Route('/api/year/list', name: 'app_year_list')]
|
||||
public function app_year_list(Request $request,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$business = $entityManager->getRepository(Business::class)->find($request->headers->get('activeBid'));
|
||||
if(!$business)
|
||||
throw $this->createNotFoundException();
|
||||
$years = $entityManager->getRepository(Year::class)->findBy([
|
||||
'bid'=>$business
|
||||
]);
|
||||
return $this->json($years);
|
||||
}
|
||||
|
||||
#[Route('/api/year/get', name: 'app_year_get')]
|
||||
public function app_year_get(Jdate $jdate,Request $request,EntityManagerInterface $entityManager): JsonResponse
|
||||
{
|
||||
$business = $entityManager->getRepository(Business::class)->find($request->headers->get('activeBid'));
|
||||
if(!$business)
|
||||
throw $this->createNotFoundException();
|
||||
$year = $entityManager->getRepository(Year::class)->find($request->headers->get('activeYear'));
|
||||
if(!$year)
|
||||
throw $this->createNotFoundException();
|
||||
$yearLoad = $entityManager->getRepository(Year::class)->findOneBy([
|
||||
'id'=> $year->getId(),
|
||||
'bid'=>$business
|
||||
]);
|
||||
$yearLoad->setStart($jdate->jdate('Y/m/d',$yearLoad->getStart()));
|
||||
$yearLoad->setEnd($jdate->jdate('Y/m/d',$yearLoad->getEnd()));
|
||||
$yearLoad->setNow($jdate->jdate('Y/m/d',time()));
|
||||
return $this->json($yearLoad);
|
||||
}
|
||||
|
||||
}
|
51
hesabixCore/src/Entity/APIDocument.php
Normal file
51
hesabixCore/src/Entity/APIDocument.php
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\APIDocumentRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: APIDocumentRepository::class)]
|
||||
class APIDocument
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $title = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $body = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getTitle(): ?string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setTitle(string $title): self
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBody(): ?string
|
||||
{
|
||||
return $this->body;
|
||||
}
|
||||
|
||||
public function setBody(string $body): self
|
||||
{
|
||||
$this->body = $body;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
81
hesabixCore/src/Entity/APIToken.php
Normal file
81
hesabixCore/src/Entity/APIToken.php
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\APITokenRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: APITokenRepository::class)]
|
||||
class APIToken
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
private ?Business $bid = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $token = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $dateExpire = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $submitter = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getBid(): ?Business
|
||||
{
|
||||
return $this->bid;
|
||||
}
|
||||
|
||||
public function setBid(?Business $bid): static
|
||||
{
|
||||
$this->bid = $bid;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getToken(): ?string
|
||||
{
|
||||
return $this->token;
|
||||
}
|
||||
|
||||
public function setToken(string $token): static
|
||||
{
|
||||
$this->token = $token;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateExpire(): ?string
|
||||
{
|
||||
return $this->dateExpire;
|
||||
}
|
||||
|
||||
public function setDateExpire(?string $dateExpire): static
|
||||
{
|
||||
$this->dateExpire = $dateExpire;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSubmitter(): ?User
|
||||
{
|
||||
return $this->submitter;
|
||||
}
|
||||
|
||||
public function setSubmitter(?User $submitter): static
|
||||
{
|
||||
$this->submitter = $submitter;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
229
hesabixCore/src/Entity/BankAccount.php
Normal file
229
hesabixCore/src/Entity/BankAccount.php
Normal file
|
@ -0,0 +1,229 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\BankAccountRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Ignore;
|
||||
|
||||
#[ORM\Entity(repositoryClass: BankAccountRepository::class)]
|
||||
class BankAccount
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'bankAccounts')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
#[Ignore]
|
||||
private ?Business $bid = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $name = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $cardNum = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $shaba = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $accountNum = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $owner = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $shobe = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $posNum = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $des = null;
|
||||
|
||||
#[ORM\Column(length: 25, nullable: true)]
|
||||
private ?string $mobileInternetBank = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $code = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'bank', targetEntity: HesabdariRow::class)]
|
||||
#[Ignore]
|
||||
private Collection $hesabdariRows;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->hesabdariRows = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getBid(): ?Business
|
||||
{
|
||||
return $this->bid;
|
||||
}
|
||||
|
||||
public function setBid(?Business $bid): self
|
||||
{
|
||||
$this->bid = $bid;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(?string $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCardNum(): ?string
|
||||
{
|
||||
return $this->cardNum;
|
||||
}
|
||||
|
||||
public function setCardNum(?string $cardNum): self
|
||||
{
|
||||
$this->cardNum = $cardNum;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getShaba(): ?string
|
||||
{
|
||||
return $this->shaba;
|
||||
}
|
||||
|
||||
public function setShaba(?string $shaba): self
|
||||
{
|
||||
$this->shaba = $shaba;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAccountNum(): ?string
|
||||
{
|
||||
return $this->accountNum;
|
||||
}
|
||||
|
||||
public function setAccountNum(?string $accountNum): self
|
||||
{
|
||||
$this->accountNum = $accountNum;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOwner(): ?string
|
||||
{
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
public function setOwner(?string $owner): self
|
||||
{
|
||||
$this->owner = $owner;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getShobe(): ?string
|
||||
{
|
||||
return $this->shobe;
|
||||
}
|
||||
|
||||
public function setShobe(?string $shobe): self
|
||||
{
|
||||
$this->shobe = $shobe;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPosNum(): ?string
|
||||
{
|
||||
return $this->posNum;
|
||||
}
|
||||
|
||||
public function setPosNum(?string $posNum): self
|
||||
{
|
||||
$this->posNum = $posNum;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDes(): ?string
|
||||
{
|
||||
return $this->des;
|
||||
}
|
||||
|
||||
public function setDes(?string $des): self
|
||||
{
|
||||
$this->des = $des;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMobileInternetBank(): ?string
|
||||
{
|
||||
return $this->mobileInternetBank;
|
||||
}
|
||||
|
||||
public function setMobileInternetBank(?string $mobileInternetBank): self
|
||||
{
|
||||
$this->mobileInternetBank = $mobileInternetBank;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCode(): ?string
|
||||
{
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
public function setCode(string $code): self
|
||||
{
|
||||
$this->code = $code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, HesabdariRow>
|
||||
*/
|
||||
public function getHesabdariRows(): Collection
|
||||
{
|
||||
return $this->hesabdariRows;
|
||||
}
|
||||
|
||||
public function addHesabdariRow(HesabdariRow $hesabdariRow): self
|
||||
{
|
||||
if (!$this->hesabdariRows->contains($hesabdariRow)) {
|
||||
$this->hesabdariRows->add($hesabdariRow);
|
||||
$hesabdariRow->setBank($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeHesabdariRow(HesabdariRow $hesabdariRow): self
|
||||
{
|
||||
if ($this->hesabdariRows->removeElement($hesabdariRow)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($hesabdariRow->getBank() === $this) {
|
||||
$hesabdariRow->setBank(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
98
hesabixCore/src/Entity/BlogComment.php
Normal file
98
hesabixCore/src/Entity/BlogComment.php
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\BlogCommentRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: BlogCommentRepository::class)]
|
||||
class BlogComment
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'blogComments')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $submitter = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $dateSubmit = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $body = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'blogComments')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?BlogPost $post = null;
|
||||
|
||||
#[ORM\Column(type: Types::BOOLEAN, nullable: true)]
|
||||
private ?bool $publish = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getSubmitter(): ?User
|
||||
{
|
||||
return $this->submitter;
|
||||
}
|
||||
|
||||
public function setSubmitter(?User $submitter): self
|
||||
{
|
||||
$this->submitter = $submitter;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateSubmit(): ?string
|
||||
{
|
||||
return $this->dateSubmit;
|
||||
}
|
||||
|
||||
public function setDateSubmit(string $dateSubmit): self
|
||||
{
|
||||
$this->dateSubmit = $dateSubmit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBody(): ?string
|
||||
{
|
||||
return $this->body;
|
||||
}
|
||||
|
||||
public function setBody(string $body): self
|
||||
{
|
||||
$this->body = $body;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPost(): ?BlogPost
|
||||
{
|
||||
return $this->post;
|
||||
}
|
||||
|
||||
public function setPost(?BlogPost $post): self
|
||||
{
|
||||
$this->post = $post;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isPublish(): ?bool
|
||||
{
|
||||
return $this->publish;
|
||||
}
|
||||
|
||||
public function setPublish(bool $publish): self
|
||||
{
|
||||
$this->publish = $publish;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
|
@ -3,6 +3,8 @@
|
|||
namespace App\Entity;
|
||||
|
||||
use App\Repository\BlogPostRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
@ -43,6 +45,14 @@ class BlogPost
|
|||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $intero = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'post', targetEntity: BlogComment::class, orphanRemoval: true)]
|
||||
private Collection $blogComments;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->blogComments = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
|
@ -155,4 +165,34 @@ class BlogPost
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, BlogComment>
|
||||
*/
|
||||
public function getBlogComments(): Collection
|
||||
{
|
||||
return $this->blogComments;
|
||||
}
|
||||
|
||||
public function addBlogComment(BlogComment $blogComment): self
|
||||
{
|
||||
if (!$this->blogComments->contains($blogComment)) {
|
||||
$this->blogComments->add($blogComment);
|
||||
$blogComment->setPost($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeBlogComment(BlogComment $blogComment): self
|
||||
{
|
||||
if ($this->blogComments->removeElement($blogComment)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($blogComment->getPost() === $this) {
|
||||
$blogComment->setPost(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
841
hesabixCore/src/Entity/Business.php
Normal file
841
hesabixCore/src/Entity/Business.php
Normal file
|
@ -0,0 +1,841 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\BusinessRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: BusinessRepository::class)]
|
||||
class Business
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'businesses')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?User $owner = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $name = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $legalName = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $field = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $type = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $shenasemeli = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $codeeghtesadi = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $shomaresabt = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $country = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $ostan = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $shahrestan = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $postalcode = null;
|
||||
|
||||
#[ORM\Column(length: 12, nullable: true)]
|
||||
private ?string $tel = null;
|
||||
|
||||
#[ORM\Column(length: 12, nullable: true)]
|
||||
private ?string $mobile = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $address = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $wesite = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $email = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'businesses')]
|
||||
#[ORM\JoinColumn(nullable: true)]
|
||||
private ?Money $money = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $maliyatafzode = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $dateSubmit = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Log::class)]
|
||||
private Collection $logs;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Permission::class)]
|
||||
private Collection $permissions;
|
||||
|
||||
#[ORM\Column(type: Types::BIGINT, nullable: true)]
|
||||
private ?string $personCode = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Person::class, orphanRemoval: true)]
|
||||
private Collection $people;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Year::class, orphanRemoval: true)]
|
||||
private Collection $years;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: BankAccount::class, orphanRemoval: true)]
|
||||
private Collection $bankAccounts;
|
||||
|
||||
#[ORM\Column(type: Types::BIGINT, nullable: true)]
|
||||
private ?string $bankCode = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: HesabdariDoc::class)]
|
||||
private Collection $hesabdariDocs;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $receiveCode = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $accountingCode = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: HesabdariRow::class, orphanRemoval: true)]
|
||||
private Collection $hesabdariRows;
|
||||
|
||||
#[ORM\Column(type: Types::BIGINT, nullable: true)]
|
||||
private ?string $CommodityCode = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $salaryCode = '1000';
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $cashdeskCode = '1000';
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Salary::class, orphanRemoval: true)]
|
||||
private Collection $salaries;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Cashdesk::class)]
|
||||
private Collection $cashdesks;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Notification::class, orphanRemoval: true)]
|
||||
private Collection $notifications;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: Plugin::class, orphanRemoval: true)]
|
||||
private Collection $plugins;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'bid', targetEntity: PlugNoghreOrder::class, orphanRemoval: true)]
|
||||
private Collection $plugNoghreOrders;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->logs = new ArrayCollection();
|
||||
$this->permissions = new ArrayCollection();
|
||||
$this->people = new ArrayCollection();
|
||||
$this->years = new ArrayCollection();
|
||||
$this->bankAccounts = new ArrayCollection();
|
||||
$this->hesabdariDocs = new ArrayCollection();
|
||||
$this->hesabdariRows = new ArrayCollection();
|
||||
$this->salaries = new ArrayCollection();
|
||||
$this->cashdesks = new ArrayCollection();
|
||||
$this->notifications = new ArrayCollection();
|
||||
$this->plugins = new ArrayCollection();
|
||||
$this->plugNoghreOrders = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getOwner(): ?User
|
||||
{
|
||||
return $this->owner;
|
||||
}
|
||||
|
||||
public function setOwner(?User $owner): self
|
||||
{
|
||||
$this->owner = $owner;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(string $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLegalName(): ?string
|
||||
{
|
||||
return $this->legalName;
|
||||
}
|
||||
|
||||
public function setLegalName(string $legalName): self
|
||||
{
|
||||
$this->legalName = $legalName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getField(): ?string
|
||||
{
|
||||
return $this->field;
|
||||
}
|
||||
|
||||
public function setField(?string $field): self
|
||||
{
|
||||
$this->field = $field;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getType(): ?string
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
public function setType(?string $type): self
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getShenasemeli(): ?string
|
||||
{
|
||||
return $this->shenasemeli;
|
||||
}
|
||||
|
||||
public function setShenasemeli(?string $shenasemeli): self
|
||||
{
|
||||
$this->shenasemeli = $shenasemeli;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCodeeghtesadi(): ?string
|
||||
{
|
||||
return $this->codeeghtesadi;
|
||||
}
|
||||
|
||||
public function setCodeeghtesadi(?string $codeeghtesadi): self
|
||||
{
|
||||
$this->codeeghtesadi = $codeeghtesadi;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getShomaresabt(): ?string
|
||||
{
|
||||
return $this->shomaresabt;
|
||||
}
|
||||
|
||||
public function setShomaresabt(?string $shomaresabt): self
|
||||
{
|
||||
$this->shomaresabt = $shomaresabt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCountry(): ?string
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
public function setCountry(?string $country): self
|
||||
{
|
||||
$this->country = $country;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOstan(): ?string
|
||||
{
|
||||
return $this->ostan;
|
||||
}
|
||||
|
||||
public function setOstan(?string $ostan): self
|
||||
{
|
||||
$this->ostan = $ostan;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getShahrestan(): ?string
|
||||
{
|
||||
return $this->shahrestan;
|
||||
}
|
||||
|
||||
public function setShahrestan(?string $shahrestan): self
|
||||
{
|
||||
$this->shahrestan = $shahrestan;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPostalcode(): ?string
|
||||
{
|
||||
return $this->postalcode;
|
||||
}
|
||||
|
||||
public function setPostalcode(?string $postalcode): self
|
||||
{
|
||||
$this->postalcode = $postalcode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTel(): ?string
|
||||
{
|
||||
return $this->tel;
|
||||
}
|
||||
|
||||
public function setTel(?string $tel): self
|
||||
{
|
||||
$this->tel = $tel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMobile(): ?string
|
||||
{
|
||||
return $this->mobile;
|
||||
}
|
||||
|
||||
public function setMobile(?string $mobile): self
|
||||
{
|
||||
$this->mobile = $mobile;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAddress(): ?string
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
public function setAddress(?string $address): self
|
||||
{
|
||||
$this->address = $address;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWesite(): ?string
|
||||
{
|
||||
return $this->wesite;
|
||||
}
|
||||
|
||||
public function setWesite(?string $wesite): self
|
||||
{
|
||||
$this->wesite = $wesite;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEmail(): ?string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setEmail(?string $email): self
|
||||
{
|
||||
$this->email = $email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMoney(): ?Money
|
||||
{
|
||||
return $this->money;
|
||||
}
|
||||
|
||||
public function setMoney(?Money $money): self
|
||||
{
|
||||
$this->money = $money;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMaliyatafzode(): ?string
|
||||
{
|
||||
return $this->maliyatafzode;
|
||||
}
|
||||
|
||||
public function setMaliyatafzode(string $maliyatafzode): self
|
||||
{
|
||||
$this->maliyatafzode = $maliyatafzode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateSubmit(): ?string
|
||||
{
|
||||
return $this->dateSubmit;
|
||||
}
|
||||
|
||||
public function setDateSubmit(string $dateSubmit): self
|
||||
{
|
||||
$this->dateSubmit = $dateSubmit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Log>
|
||||
*/
|
||||
public function getLogs(): Collection
|
||||
{
|
||||
return $this->logs;
|
||||
}
|
||||
|
||||
public function addLog(Log $log): self
|
||||
{
|
||||
if (!$this->logs->contains($log)) {
|
||||
$this->logs->add($log);
|
||||
$log->setBid($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeLog(Log $log): self
|
||||
{
|
||||
if ($this->logs->removeElement($log)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($log->getBid() === $this) {
|
||||
$log->setBid(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Permission>
|
||||
*/
|
||||
public function getPermissions(): Collection
|
||||
{
|
||||
return $this->permissions;
|
||||
}
|
||||
|
||||
public function addPermission(Permission $permission): self
|
||||
{
|
||||
if (!$this->permissions->contains($permission)) {
|
||||
$this->permissions->add($permission);
|
||||
$permission->setBid($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePermission(Permission $permission): self
|
||||
{
|
||||
if ($this->permissions->removeElement($permission)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($permission->getBid() === $this) {
|
||||
$permission->setBid(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPersonCode(): ?string
|
||||
{
|
||||
return $this->personCode;
|
||||
}
|
||||
|
||||
public function setPersonCode(string $personCode): self
|
||||
{
|
||||
$this->personCode = $personCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Person>
|
||||
*/
|
||||
public function getPeople(): Collection
|
||||
{
|
||||
return $this->people;
|
||||
}
|
||||
|
||||
public function addPerson(Person $person): self
|
||||
{
|
||||
if (!$this->people->contains($person)) {
|
||||
$this->people->add($person);
|
||||
$person->setBid($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePerson(Person $person): self
|
||||
{
|
||||
if ($this->people->removeElement($person)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($person->getBid() === $this) {
|
||||
$person->setBid(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Year>
|
||||
*/
|
||||
public function getYears(): Collection
|
||||
{
|
||||
return $this->years;
|
||||
}
|
||||
|
||||
public function addYear(Year $year): self
|
||||
{
|
||||
if (!$this->years->contains($year)) {
|
||||
$this->years->add($year);
|
||||
$year->setBid($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeYear(Year $year): self
|
||||
{
|
||||
if ($this->years->removeElement($year)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($year->getBid() === $this) {
|
||||
$year->setBid(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, BankAccount>
|
||||
*/
|
||||
public function getBankAccounts(): Collection
|
||||
{
|
||||
return $this->bankAccounts;
|
||||
}
|
||||
|
||||
public function addBankAccount(BankAccount $bankAccount): self
|
||||
{
|
||||
if (!$this->bankAccounts->contains($bankAccount)) {
|
||||
$this->bankAccounts->add($bankAccount);
|
||||
$bankAccount->setBid($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeBankAccount(BankAccount $bankAccount): self
|
||||
{
|
||||
if ($this->bankAccounts->removeElement($bankAccount)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($bankAccount->getBid() === $this) {
|
||||
$bankAccount->setBid(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBankCode(): ?string
|
||||
{
|
||||
return $this->bankCode;
|
||||
}
|
||||
|
||||
public function setBankCode(?string $bankCode): self
|
||||
{
|
||||
$this->bankCode = $bankCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, HesabdariDoc>
|
||||
*/
|
||||
public function getHesabdariDocs(): Collection
|
||||
{
|
||||
return $this->hesabdariDocs;
|
||||
}
|
||||
|
||||
public function addHesabdariDoc(HesabdariDoc $hesabdariDoc): self
|
||||
{
|
||||
if (!$this->hesabdariDocs->contains($hesabdariDoc)) {
|
||||
$this->hesabdariDocs->add($hesabdariDoc);
|
||||
$hesabdariDoc->setBid($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeHesabdariDoc(HesabdariDoc $hesabdariDoc): self
|
||||
{
|
||||
if ($this->hesabdariDocs->removeElement($hesabdariDoc)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($hesabdariDoc->getBid() === $this) {
|
||||
$hesabdariDoc->setBid(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
public function getReceiveCode(): ?string
|
||||
{
|
||||
return $this->receiveCode;
|
||||
}
|
||||
|
||||
public function setReceiveCode(?string $receiveCode): self
|
||||
{
|
||||
$this->receiveCode = $receiveCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAccountingCode(): ?string
|
||||
{
|
||||
return $this->accountingCode;
|
||||
}
|
||||
|
||||
public function setAccountingCode(?string $accountingCode): self
|
||||
{
|
||||
$this->accountingCode = $accountingCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, HesabdariRow>
|
||||
*/
|
||||
public function getHesabdariRows(): Collection
|
||||
{
|
||||
return $this->hesabdariRows;
|
||||
}
|
||||
|
||||
public function addHesabdariRow(HesabdariRow $hesabdariRow): self
|
||||
{
|
||||
if (!$this->hesabdariRows->contains($hesabdariRow)) {
|
||||
$this->hesabdariRows->add($hesabdariRow);
|
||||
$hesabdariRow->setBid($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeHesabdariRow(HesabdariRow $hesabdariRow): self
|
||||
{
|
||||
if ($this->hesabdariRows->removeElement($hesabdariRow)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($hesabdariRow->getBid() === $this) {
|
||||
$hesabdariRow->setBid(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCommodityCode(): ?string
|
||||
{
|
||||
return $this->CommodityCode;
|
||||
}
|
||||
|
||||
public function setCommodityCode(?string $CommodityCode): self
|
||||
{
|
||||
$this->CommodityCode = $CommodityCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSalaryCode(): ?string
|
||||
{
|
||||
return $this->salaryCode;
|
||||
}
|
||||
|
||||
public function setSalaryCode(?string $salaryCode): self
|
||||
{
|
||||
$this->salaryCode = $salaryCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCashdeskCode(): ?string
|
||||
{
|
||||
return $this->cashdeskCode;
|
||||
}
|
||||
|
||||
public function setCashdeskCode(string $cashdeskCode): self
|
||||
{
|
||||
$this->cashdeskCode = $cashdeskCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Salary>
|
||||
*/
|
||||
public function getSalaries(): Collection
|
||||
{
|
||||
return $this->salaries;
|
||||
}
|
||||
|
||||
public function addSalary(Salary $salary): self
|
||||
{
|
||||
if (!$this->salaries->contains($salary)) {
|
||||
$this->salaries->add($salary);
|
||||
$salary->setBid($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeSalary(Salary $salary): self
|
||||
{
|
||||
if ($this->salaries->removeElement($salary)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($salary->getBid() === $this) {
|
||||
$salary->setBid(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Cashdesk>
|
||||
*/
|
||||
public function getCashdesks(): Collection
|
||||
{
|
||||
return $this->cashdesks;
|
||||
}
|
||||
|
||||
public function addCashdesk(Cashdesk $cashdesk): self
|
||||
{
|
||||
if (!$this->cashdesks->contains($cashdesk)) {
|
||||
$this->cashdesks->add($cashdesk);
|
||||
$cashdesk->setBid($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCashdesk(Cashdesk $cashdesk): self
|
||||
{
|
||||
if ($this->cashdesks->removeElement($cashdesk)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($cashdesk->getBid() === $this) {
|
||||
$cashdesk->setBid(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Notification>
|
||||
*/
|
||||
public function getNotifications(): Collection
|
||||
{
|
||||
return $this->notifications;
|
||||
}
|
||||
|
||||
public function addNotification(Notification $notification): static
|
||||
{
|
||||
if (!$this->notifications->contains($notification)) {
|
||||
$this->notifications->add($notification);
|
||||
$notification->setBid($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeNotification(Notification $notification): static
|
||||
{
|
||||
if ($this->notifications->removeElement($notification)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($notification->getBid() === $this) {
|
||||
$notification->setBid(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Plugin>
|
||||
*/
|
||||
public function getPlugins(): Collection
|
||||
{
|
||||
return $this->plugins;
|
||||
}
|
||||
|
||||
public function addPlugin(Plugin $plugin): static
|
||||
{
|
||||
if (!$this->plugins->contains($plugin)) {
|
||||
$this->plugins->add($plugin);
|
||||
$plugin->setBid($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePlugin(Plugin $plugin): static
|
||||
{
|
||||
if ($this->plugins->removeElement($plugin)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($plugin->getBid() === $this) {
|
||||
$plugin->setBid(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, PlugNoghreOrder>
|
||||
*/
|
||||
public function getPlugNoghreOrders(): Collection
|
||||
{
|
||||
return $this->plugNoghreOrders;
|
||||
}
|
||||
|
||||
public function addPlugNoghreOrder(PlugNoghreOrder $plugNoghreOrder): static
|
||||
{
|
||||
if (!$this->plugNoghreOrders->contains($plugNoghreOrder)) {
|
||||
$this->plugNoghreOrders->add($plugNoghreOrder);
|
||||
$plugNoghreOrder->setBid($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePlugNoghreOrder(PlugNoghreOrder $plugNoghreOrder): static
|
||||
{
|
||||
if ($this->plugNoghreOrders->removeElement($plugNoghreOrder)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($plugNoghreOrder->getBid() === $this) {
|
||||
$plugNoghreOrder->setBid(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
124
hesabixCore/src/Entity/Cashdesk.php
Normal file
124
hesabixCore/src/Entity/Cashdesk.php
Normal file
|
@ -0,0 +1,124 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\CashdeskRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Annotation\Ignore;
|
||||
|
||||
#[ORM\Entity(repositoryClass: CashdeskRepository::class)]
|
||||
class Cashdesk
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $name = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $des = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $code = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'cashdesks')]
|
||||
#[Ignore]
|
||||
private ?Business $bid = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'cashdesk', targetEntity: HesabdariRow::class)]
|
||||
#[Ignore]
|
||||
private Collection $hesabdariRows;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->hesabdariRows = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getName(): ?string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(string $name): self
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDes(): ?string
|
||||
{
|
||||
return $this->des;
|
||||
}
|
||||
|
||||
public function setDes(?string $des): self
|
||||
{
|
||||
$this->des = $des;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCode(): ?string
|
||||
{
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
public function setCode(string $code): self
|
||||
{
|
||||
$this->code = $code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBid(): ?Business
|
||||
{
|
||||
return $this->bid;
|
||||
}
|
||||
|
||||
public function setBid(?Business $bid): self
|
||||
{
|
||||
$this->bid = $bid;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, HesabdariRow>
|
||||
*/
|
||||
public function getHesabdariRows(): Collection
|
||||
{
|
||||
return $this->hesabdariRows;
|
||||
}
|
||||
|
||||
public function addHesabdariRow(HesabdariRow $hesabdariRow): self
|
||||
{
|
||||
if (!$this->hesabdariRows->contains($hesabdariRow)) {
|
||||
$this->hesabdariRows->add($hesabdariRow);
|
||||
$hesabdariRow->setCashdesk($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeHesabdariRow(HesabdariRow $hesabdariRow): self
|
||||
{
|
||||
if ($this->hesabdariRows->removeElement($hesabdariRow)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($hesabdariRow->getCashdesk() === $this) {
|
||||
$hesabdariRow->setCashdesk(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
66
hesabixCore/src/Entity/ChangeReport.php
Normal file
66
hesabixCore/src/Entity/ChangeReport.php
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ChangeReportRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ChangeReportRepository::class)]
|
||||
class ChangeReport
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $body = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $dateSubmit = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $version = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getBody(): ?string
|
||||
{
|
||||
return $this->body;
|
||||
}
|
||||
|
||||
public function setBody(string $body): self
|
||||
{
|
||||
$this->body = $body;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateSubmit(): ?string
|
||||
{
|
||||
return $this->dateSubmit;
|
||||
}
|
||||
|
||||
public function setDateSubmit(string $dateSubmit): self
|
||||
{
|
||||
$this->dateSubmit = $dateSubmit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getVersion(): ?string
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
public function setVersion(?string $version): self
|
||||
{
|
||||
$this->version = $version;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue