Uname:Linux localhost.localdomain 5.14.0-596.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jun 27 16:02:33 UTC 2025 x86_64

403WebShell
403Webshell
Server IP : 14.225.216.240  /  Your IP : 216.73.216.26
Web Server : nginx/1.20.1
System : Linux localhost.localdomain 5.14.0-596.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jun 27 16:02:33 UTC 2025 x86_64
User : taidh ( 1001)
PHP Version : 8.3.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/pts/app/Module/Crm/Controller/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/pts/app/Module/Crm/Controller/AssociationController.php
<?php
// phpcs:ignore
namespace App\Module\Crm\Controller;

use App\PTS\Helpers\Model\Association;
use App\PTS\Helpers\Model\Selector;
use App\PTS\Helpers\Model\CRM;
use stdClass;

/**
 * Activity module
 *
 * @category Class
 * @package  App\Module\Crm\Controller
 * @author   Phung, Truong K <truongkimphung1982@gmail.com>
 * @license  https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License
 * @link     https://pts-digital.com/ PTS Digital Technology Co.,Ltd
 */
class AssociationController extends BaseController
{
    /**
     * Filter products, categories
     *
     * @return mixed $json
     */
    public function productCategories()
    {
        $httpStatus = self::METHOD_NOT_ALLOWED;
        $response = new stdClass;
        if (request()->ajax()) {
            $httpStatus = self::OK;
            $productType = request()->get('product_type', 0);
            $isOther = request()->get('is_other', 0);
            $categories = Selector::getInstance()->getCategoriesByActive($productType);
            $products = Selector::getInstance()->getProductsByActive($productType);
            $response->categories = view(
                self::$fn . 'layouts.elements.associationOption',
                ['datas' => $categories]
            )->render();
            $response->products = view(
                self::$fn . 'layouts.elements.associationOption',
                ['datas' => $products, 'isOther' => $isOther]
            )->render();
            $response->count_product = count($products ?? []);

        }
        return response()->json($response, $httpStatus);
    }

    /**
     * Filter products
     *
     * @return mixed $json
     */
    public function products()
    {
        $httpStatus = self::METHOD_NOT_ALLOWED;
        $response = new stdClass;
        if (request()->ajax()) {
            $httpStatus = self::OK;
            $productType = request()->get('product_type', 0);
            $categoryId = request()->get('category_id', 0);
            $isOther = request()->get('is_other', 0);
            $products = Selector::getInstance()->getProductsByActive($productType, $categoryId);
            $response->products = view(
                self::$fn . 'layouts.elements.associationOption',
                ['datas' => $products, 'isOther' => $isOther]
            )->render();
            $response->count_product = count($products ?? []);
        }
        return response()->json($response, $httpStatus);
    }

    /**
     * Getting product inforimation by code
     *
     * @return mixed $json
     */
    public function productByCode()
    {
        $httpStatus = self::METHOD_NOT_ALLOWED;
        $response = new stdClass;
        if (request()->ajax()) {
            $httpStatus = self::OK;
            $keyword = request()->get('keyword', '');
            $product = Selector::getInstance()->getProductByCode($keyword);
            $response->product = $product;
        }
        return response()->json($response, $httpStatus);
    }

    /**
     * Filter customers
     *
     * @return mixed $json
     */
    public function customers()
    {
        $httpStatus = self::METHOD_NOT_ALLOWED;
        $response = new stdClass;
        if (request()->ajax()) {
            $httpStatus = self::OK;
            $keyword = request()->get('keyword', '');
            $customers = CRM::getInstance()->getCustomersByFind($keyword);
            $response->customers = $customers;
            $response->option_template = view(self::$fn . 'layouts.elements.associationOption')->render();
        }
        return response()->json($response, $httpStatus);
    }

    /**
     * Check quantity item in the inventory
     *
     * @return mixed $json
     */
    public function checkInventoryQty()
    {
        $httpStatus = self::METHOD_NOT_ALLOWED;
        $response = new stdClass;
        if (request()->ajax()) {
            $httpStatus = self::OK;
            $productId = request()->get('product_id', 0);
            $locationId = request()->get('location_id', 0);
            $inventories = Association::getInstance()->checkQty($productId, $locationId);
            if (count($inventories ?? []) > 0) {
                $response->inventories = $inventories;
            }
        }
        return response()->json($response, $httpStatus);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit