���Root Mod By V1rus_Alfa
User / IP
:
216.73.216.158
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
repositories
/
cutunix-shot
/
app
/
Livewire
/
Site
/
Pages
/
CutunixShot
/
AiProcess
/
Viewing: Index.php
<?php namespace App\Livewire\Site\Pages\CutunixShot\AiProcess; use App\Events\OrderPlacedByUser; use Illuminate\Support\Facades\DB; use Carbon\Carbon; use App\Models\Image; use App\Models\Order; use Livewire\Component; use App\Models\OrderSlice; use App\Models\OrderGroup; use Masmerise\Toaster\Toastable; use function App\Helpers\toEnDigit; use Illuminate\Filesystem\Filesystem; use App\Helpers\HelperClass\GeneralUse; class Index extends Component { use Toastable; public $image; public $slice = []; public $orderGroup; protected $listeners = ['refreshTable' => '$refresh', 'setDescription' => 'setFunDescription']; public function mount($image_id) { $this->image = Image::where('id', $image_id)->with('group', 'group.order')->first(); $this->orderGroup = $this->image->group; if (!$this->image) { return redirect()->to('/' . app()->getLocale() . '/mdf-shot')->with(['error-response' => 'خطای شناسایی تصویر ، لطفا مجددا تلاش نمایید']); } if ($this->image->msg) { foreach ((array)json_decode($this->image->msg)->items as $row) { array_push($this->slice, [ 'height' => isset($row[0]) ? $row[0] : '', 'length_one' => isset($row[1]) ? (($row[1] == 'n' || $row[1] == 'N') ? '1' : (($row[1] == 'f' || $row[1] == 'F') ? '2' : (($row[1] == 's' || $row[1] == 'S') ? '3' : '0'))) : '0', 'length_two' => isset($row[2]) ? (($row[2] == 'n' || $row[2] == 'N') ? '1' : (($row[2] == 'f' || $row[2] == 'F') ? '2' : (($row[2] == 's' || $row[2] == 'S') ? '3' : '0'))) : '0', 'width' => isset($row[3]) ? $row[3] : '', 'width_one' => isset($row[4]) ? (($row[4] == 'n' || $row[4] == 'N') ? '1' : (($row[4] == 'f' || $row[4] == 'F') ? '2' : (($row[4] == 's' || $row[4] == 'S') ? '3' : '0'))) : '0', 'width_two' => isset($row[5]) ? (($row[5] == 'n' || $row[5] == 'N') ? '1' : (($row[5] == 'f' || $row[5] == 'F') ? '2' : (($row[5] == 's' || $row[5] == 'S') ? '3' : '0'))) : '0', 'count' => isset($row[6]) ? $row[6] : '', 'rotate_status' => 1, 'description' => "", 'order_id' => $this->image->group?->order?->id, 'order_group_id' => $this->image->group_id, 'user_id' => auth()->user()->id, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]); } } } public function removeSliceRow($num = null) { array_splice($this->slice, $num, 1); $this->dispatch('refreshTable'); } public function validate_data() { $generalTrimCutsHeight = 1; $generalTrimCutsWidth = 1; $error = null; $panel_width = $this->image->group?->panel_width; $panel_height = $this->image->group?->panel_height; $rotate_status = $this->image->group?->rotate_status; foreach ($this->slice as $key => $row) { $width = $row['width']; $height = $row['height']; $count = $row['count']; if (!$width) { $error = 'true'; $this->error(($key + 1) . ' : ' . trans('container.ai_5')); return $error; } if ($width > ($this->orderGroup->panel_width - ($generalTrimCutsHeight * 2))) { $error = 'true'; $this->error(($key + 1) . ' : ' . "اندازه بزرگتر از ورق دورگیری شده دارد؛ غیر قابل پردازش"); return $error; } if (!$height) { $error = 'true'; $this->error(($key + 1) . ' : ' . trans('container.ai_6')); return $error; } if ($height > ($this->orderGroup->panel_height - ($generalTrimCutsWidth * 2))) { $error = 'true'; $this->error(($key + 1) . ' : ' . "اندازه بزرگتر از ورق دورگیری شده دارد؛ غیر قابل پردازش"); return $error; } if (!$count || $count < 1) { $error = 'true'; $this->error(($key + 1) . ' : ' . trans('container.ai_9')); return $error; } if ($rotate_status == 1 || $rotate_status == 1) { if ($panel_height < toEnDigit($width) && $panel_width < toEnDigit($width)) { $error = 'true'; $this->error(($key + 1) . ' : ' . trans('container.ai_11')); return $error; } if ($panel_height < toEnDigit($height) && $panel_width < toEnDigit($height)) { $error = 'true'; $this->error(($key + 1) . ' : ' . trans('container.ai_12')); return $error; } } else { if ($panel_width < toEnDigit($width)) { $error = 'true'; $this->error(($key + 1) . ' : ' . trans('container.ai_11')); return $error; } if ($panel_height < toEnDigit($height)) { $error = 'true'; $this->error(($key + 1) . ' : ' . trans('container.ai_12')); return $error; } } } return $error; } public function handelRequest($type, Filesystem $filesystem) { $validate = $this->validate_data(); if ($validate) { return $validate; } $slice_count = 0; foreach ($this->slice as $key => $row) { $count = $row['count']; $slice_count = (int)$slice_count + (int)$count; } //insert-data DB::beginTransaction(); if ($slice_count > 0) { try { OrderSlice::insert($this->slice); OrderGroup::where('id', $this->image->group->id)->update([ 'slice_count' => DB::raw('slice_count + ' . (int)$slice_count), 'cut_master' => 'waiting', 'opticut' => 'waiting', 'win_cam' => 'waiting', 'opti_percent' => '0', ]); $order = Order::where('id', $this->image->group->order_id)->first(); $order->update([ 'status' => 'pending' ]); GeneralUse::export_form($this->image->group->id, $filesystem); DB::commit(); if ($order->slices()->count()) event(new OrderPlacedByUser($order)); } catch (\Throwable $th) { DB::rollBack(); throw $th; } } else { return redirect()->to('/' . app()->getLocale() . '/shot/' . $this->image->group->id . '?type=add'); } if ($type == 'complete_and_redirect') { return redirect()->to('/' . app()->getLocale() . '/shot/' . $this->image->group->id . '?type=add'); } elseif ($type == 'complete') { return redirect()->to('/' . app()->getLocale() . '/analyze-process/' . $this->image->group->order->id); } elseif ($type == 'add_sheet') { return redirect()->to('/' . app()->getLocale() . '/create?order_id=' . $this->image->group->order->id); } } public function handleIncrementing() { array_push($this->slice, [ 'height' => '', 'width' => '', 'count' => '1', 'length_one' => 0, 'length_two' => 0, 'width_one' => 0, 'width_two' => 0, 'rotate_status' => 1, 'description' => "", 'order_id' => $this->image->group->order->id, 'order_group_id' => $this->image->group->id, 'user_id' => auth()->user()->id, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now(), ]); } public function setFunDescription($data) { $this->slice[$data['i']]['description'] = $data['des']; } public function render() { return view('livewire.site.pages.cutunix-shot.ai-process.index') ->layout('components.layouts.site.app', ['page_name' => 'panel', 'previousRoute' => route('mdf-shot.shot.index', ['locale' => app()->getLocale()])]); } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa