Compare commits

..

No commits in common. 'd944d317a42deee09032b9c5696a16de5eac8d34' and '6c45d9a8e7b89a97369bc8efb3286c59b7ab45d0' have entirely different histories.

@ -73,13 +73,8 @@ CURRENCY_SYMBOL="$"
CURRENCY_FACTOR=1
CURRENCY_CODE=USD
SMS_SING=true
SMS_DRIVER=Kavenegar
SMS_TOKEN=
SMS_USER=
SMS_PASSWORD=
SMS_URL="https://api.kavenegar.com/v1/TOKEN/verify/lookup.json"
SMS_NUMBER=
SIGN_SMS=true
SIGN_DRIVER=Kavenegar
ZARINPAL_MERCHANT=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
ZIBAL_MERCHANT=zibal

@ -9,7 +9,6 @@ use App\Models\Part;
use App\Models\Menu;
use App\Models\Product;
use Illuminate\Support\Facades\Route;
use GuzzleHttp\Client;
/**
@ -888,7 +887,7 @@ function getCategorySubCatsBySetting($key, $limit = 10, $order = 'id', $dir = "D
{
$c = Category::where('id', getSetting($key) ?? 1)->first();
if ($c == null) {
return [];
return [];
}
return $c->children()->orderBy($order, $dir)->limit($limit)->get();
}
@ -1205,69 +1204,3 @@ function fixUrlLang($url)
}
return $url;
}
/**
* Send SMS
* @param $text
* @param $number
* @param $args
* @return bool
* @throws \GuzzleHttp\Exception\GuzzleException
*/
function sendingSMS($text, $number, $args)
{
if (config('app.sms.url') == '' || config('app.sms.url') == null) {
return false;
}
if (config('app.sms.driver') == 'Kavenegar') {
$url = str_replace('TOKEN', config('app.sms.token'), config('app.sms.url')) . '?' . http_build_query($args);
$response = Http::get($url);
$r = json_decode($response->body(), true);
if ($r['return']['status'] != 200) {
\Illuminate\Support\Facades\Log::error($r);
return false;
}
return true;
}
$url = config('app.sms.url');
foreach ($args as $k => $arg) {
$text = str_replace('%' . $k, $arg, $text);
}
$fields = [
'user' => config('app.sms.url'),
'password' => config('app.sms.password'),
'to' => $number,
'from' => config('app.sms.number'),
'text' => $text,
'isflash' => 'false',
];
// Create a new Guzzle client
$client = new Client();
try {
// Send a POST request
$response = $client->post($url, [
'form_params' => $fields,
'headers' => [
'Content-Type' => 'application/x-www-form-urlencoded',
'Cache-Control' => 'no-cache',
],
]);
// Get the response body as a string
$result = $response->getBody()->getContents();
} catch (\Exception $e) {
// Handle exception
// You can log the error or return an error response here
Log::error($e->getMessage());
return false;
}
return true;
}

@ -52,22 +52,6 @@ class InvoiceController extends XController
public function save($invoice, $request)
{
if($invoice->tracking_code != $request->get('tracking_code') && strlen(trim($request->tracking_code)) == 24){
if (config('app.sms.driver') == 'Kavenegar'){
$args = [
'receptor' => $invoice->customer->mobile,
'template' => trim(getSetting('sent')),
'token' => trim($request->tracking_code)
];
}else{
$args = [
'code' => trim($request->tracking_code),
];
}
sendingSMS(getSetting('sent'),$invoice->customer->mobile,$args);
}
$invoice->transport_id = $request->input('transport_id', null);
$invoice->address_id = $request->input('address_id', null);
$invoice->tracking_code = $request->tracking_code;

@ -520,20 +520,6 @@ class ClientController extends Controller
$customer = Customer::where('mobile', $request->input('tel'));
$code = rand(11111, 99999);
if (config('app.sms.driver') == 'Kavenegar'){
$args = [
'receptor' => $request->input('tel'),
'template' => trim(getSetting('sign')),
'token' => $code
];
}else{
$args = [
'code' => $code,
];
}
sendingSMS(getSetting('sign'),$request->input('tel'),$args);
Log::info('auth code: ' . $code);
if ($customer->count() == 0) {
$customer = new Customer();
@ -619,9 +605,6 @@ class ClientController extends Controller
break;
}
}
if (count( explode('@', $r)) == 1){
return abort(404);
}
$method = explode('@', $r)[1];
$segments = $request->segments();
$routes = explode('/', $n);

@ -68,7 +68,7 @@ class CustomerController extends Controller
$customer = auth('customer')->user();
$customer->name = $request->name;
$customer->email = $request->email;
// $customer->mobile = $request->mobile;
$customer->mobile = $request->mobile;
if ($request->has('password') && trim($request->input('password')) != '') {
$customer->password = bcrypt($request->password);
}

@ -115,20 +115,6 @@ class Invoice extends Model
/** @var \App\Models\Invoice $this */
$this->status = "PAID";
$this->save();
if (config('app.sms.driver') == 'Kavenegar'){
$args = [
'receptor' => $this->customer->mobile,
'template' => trim(getSetting('order')),
'token10' => $this->customer->name,
'token' => $this->hash,
'token2' => number_format($this->total_price)
];
}else{
$args = array_merge($this->toArray(),$this->customer->toArray());
}
sendingSMS(getSetting('order'),$this->customer->mobile,$args);
try {
event(new InvoiceSucceed($this, $payment));
}catch (\Throwable $exception){

@ -159,14 +159,9 @@ return [
|
*/
'sms' => [
'sign' => env('SMS_SING',false),
'driver' => env('SMS_DRIVER','direct'),
'username' => env('SMS_USERNAME',''),
'password' => env('SMS_PASSWORD',''),
'number' => env('SMS_NUMBER',''),
'url' => env('SMS_URL',''),
'token' => env('SMS_TOKEN',''),
'sign' => [
'sms' => env('SIGN_SMS',false),
'driver' => env('SIGN_DRIVER',''),
],
/*
|--------------------------------------------------------------------------

@ -95,26 +95,6 @@ class SettingSeeder extends Seeder
],
],
'SMS' => [
[
'title' => __("Sign-in authentication"),
'key' => 'sign',
'type' => 'LONGTEXT',
'value' => 'sign',
],
[
'title' => __("Order confirmation"),
'key' => 'order',
'type' => 'LONGTEXT',
'value' => 'order',
],
[
'title' => __("Sent message"),
'key' => 'sent',
'type' => 'LONGTEXT',
'value' => 'sent',
],
],
'SEO' => [
[
'title' => __("Common keyword"),
@ -220,11 +200,11 @@ class SettingSeeder extends Seeder
$setting->title = $set['title'];
$setting->section = $section;
$setting->key = $set['key'];
$setting->value = $set['value'] ?? null;
$setting->type = $set['type'] ?? 'TEXT';
$setting->ltr = $set['ltr'] ?? false;
$setting->value = $set['value']??null;
$setting->type = $set['type']??'TEXT';
$setting->ltr = $set['ltr']??false;
$setting->is_basic = true;
$setting->size = $set['size'] ?? 12;;
$setting->size = $set['size']??12;;
$setting->save();
}
}

@ -8,56 +8,44 @@ function isValidMobile(p) {
document.addEventListener('DOMContentLoaded', function () {
document.querySelector('#send-auth-code')?.addEventListener('click', async function () {
try {
let url = this.getAttribute('data-route');
let tel = document.querySelector('#tel').value;
if (tel.length < 11 || !isValidMobile(tel)) {
window.$toast.error('Invalid mobile');
return;
}
let resp = await axios.get(url + '?tel=' + tel);
if (resp.data.OK) {
window.$toast.success(resp.data.message);
document.querySelector('#tel').setAttribute('readonly', '');
document.querySelector('.not-send').style.display = 'block';
document.querySelector('.sent').style.display = 'none';
} else {
window.$toast.error(resp.data.message);
}
} catch (e) {
window.$toast.error(e.message);
let url = this.getAttribute('data-route');
let tel = document.querySelector('#tel').value;
if (tel.length < 11 || !isValidMobile(tel)){
window.$toast.error('Invalid mobile');
return;
}
let resp = await axios.get(url+'?tel='+tel);
if (resp.data.OK){
window.$toast.success(resp.data.message);
document.querySelector('#tel').setAttribute('readonly','');
document.querySelector('.not-send').style.display = 'block';
document.querySelector('.sent').style.display = 'none';
}else{
window.$toast.error(resp.data.message);
}
});
document.querySelector('#send-auth-check')?.addEventListener('click', async function () {
try {
let url = this.getAttribute('data-route');
let tel = document.querySelector('#tel').value;
let code = document.querySelector('#auth').value;
if (tel.length < 11 || !isValidMobile(tel)) {
window.$toast.error('Invalid mobile');
return;
}
if (code.length != 5) {
window.$toast.error('Invalid code');
return;
}
let resp = await axios.get(url + '?tel=' + tel + '&code=' + code);
if (resp.data.OK) {
window.$toast.success(resp.data.message);
setTimeout(() => {
window.location.href = this.getAttribute('data-profile');
}, 5000);
} else {
window.$toast.error(resp.data.message);
}
} catch (e) {
window.$toast.error(e.message);
let url = this.getAttribute('data-route');
let tel = document.querySelector('#tel').value;
let code = document.querySelector('#auth').value;
if (tel.length < 11 || !isValidMobile(tel)){
window.$toast.error('Invalid mobile');
return;
}
if (code.length != 5 ){
window.$toast.error('Invalid code');
return;
}
let resp = await axios.get(url+'?tel='+tel+'&code='+code);
if (resp.data.OK){
window.$toast.success(resp.data.message);
setTimeout( () => {
window.location.href = this.getAttribute('data-profile');
},5000);
}else{
window.$toast.error(resp.data.message);
}
});
});

@ -272,7 +272,7 @@
<label for="mobile">
{{__('Mobile')}}
</label>
<input name="mobile" type="text" @if(config('app.sms.sign')) readonly
<input name="mobile" type="text" @if(config('app.sign.sms')) readonly
@endif class="form-control @error('mobile') is-invalid @enderror"
placeholder="{{__('Mobile')}}"
value="{{old('mobile',auth('customer')->user()->mobile??null)}}"

@ -1,51 +0,0 @@
<section class='SimpleFooter'>
<div class="content">
<div class="{{gfx()['container']}}">
<div class="row">
<div class="col-md-4">
<h3>
{{getSetting($data->area->name.'_'.$data->part.'_title1')}}
</h3>
@foreach( getGroupPostsBySetting($data->area->name.'_'.$data->part.'_group1',5) as $post )
<li>
<a href="{{$post->webUrl()}}">
{{Str::limit($post->title,40)}}
</a>
</li>
@endforeach
</div>
<div class="col-md-4">
<h3>
{{getSetting($data->area->name.'_'.$data->part.'_title2')}}
</h3>
<ul>
@foreach( getGroupPostsBySetting($data->area->name.'_'.$data->part.'_group2',5) as $post )
<li>
<a href="{{$post->webUrl()}}">
{{Str::limit($post->title,40)}}
</a>
</li>
@endforeach
</ul>
</div>
<div class="col-md-4">
{!! getSetting($data->area->name.'_'.$data->part.'_last') !!}
</div>
</div>
</div>
<div class="p2 text-center">
<ul class="social text-center">
@foreach(getSettingsGroup('social_')??[] as $k => $social)
<li class="d-inline-block mx-2">
<a href="{{$social}}">
<i class="ri-{{$k}}-line"></i>
</a>
</li>
@endforeach
</ul>
</div>
<p class="text-center">
{{getSetting('copyright')}}
</p>
</div>
</section>

@ -1,10 +0,0 @@
{
"name": "SimpleFooter",
"version": "1.0",
"author": "xStack",
"email": "xshop@xstack.ir",
"license": "GPL-3.0-or-later",
"url": "https:\/\/xstack.ir",
"author_url": "https:\/\/4xmen.ir",
"packages": []
}

@ -1,91 +0,0 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Group;
use App\Models\Part;
use App\Models\Setting;
class SimpleFooter
{
public static function onAdd(Part $part = null)
{
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_title1';
$setting->value = 'FAQ';
$setting->size = 6;
$setting->type = 'TEXT';
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
$setting->title = $part->area->name . ' ' . $part->part. ' title 1';
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_group1';
$setting->value = Group::first()->id;
$setting->size = 6;
$setting->type = 'GROUP';
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
$setting->title = $part->area->name . ' ' . $part->part. ' group1';
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_title2';
$setting->value = 'FAQ';
$setting->size = 6;
$setting->type = 'TEXT';
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
$setting->title = $part->area->name . ' ' . $part->part. ' title 2';
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_group2';
$setting->value = Group::first()->id;
$setting->size = 6;
$setting->type = 'GROUP';
// $setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
$setting->title = $part->area->name . ' ' . $part->part. ' group2';
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_last';
$setting->value = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus aliquid consequuntur culpa cupiditate dignissimos dolor doloremque error facilis ipsum iure officia quam qui, tempora! Fuga harum impedit iusto magnam veniam.';
$setting->size = 12;
$setting->title = $part->area->name . ' ' . $part->part. ' last content';
$setting->type = 'EDITOR';
$setting->save();
// $setting = new Setting();
// $setting->section = 'theme';
// $setting->key = $part->area->name . '_' . $part->part.'_bg';
// $setting->value = '#111111';
// $setting->type = 'COLOR';
// $setting->data = json_encode(['name' => 'simple-footer-bg']);
// $setting->size = 3;
// $setting->title = $part->area->name . ' ' . $part->part .' background';
// $setting->save();
}
public static function onRemove(Part $part = null)
{
Setting::where('key',$part->area->name . '_' . $part->part.'_title1')->first()?->delete();
Setting::where('key',$part->area->name . '_' . $part->part.'_group1')->first()?->delete();
Setting::where('key',$part->area->name . '_' . $part->part.'_title2')->first()?->delete();
Setting::where('key',$part->area->name . '_' . $part->part.'_group2')->first()?->delete();
Setting::where('key',$part->area->name . '_' . $part->part.'_last')->first()?->delete();
// Setting::where('key',$part->area->name . '_' . $part->part.'_bg')->first()?->delete();
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -1,41 +0,0 @@
.SimpleFooter {
overflow: hidden;
padding-top: 7rem;
background: #282c34;
color: white;
.footer {
.social{
list-style: none;
i{
font-size: 35px;
}
}
color: var(--xshop-diff);
a,a:visited{
color: var(--xshop-diff);
}
z-index: 1;
--footer-background: var(--xshop-primary);
display: grid;
position: relative;
grid-area: footer;
min-height: 12rem;
.content {
padding: 6rem 1rem 2rem;
background: var(--xshop-primary);
z-index: 2;
}
}
h3{
font-size: 27px;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

@ -1,6 +1,6 @@
<section id='LoginBigBg' class="content"
style="background-image: url('{{asset('upload/images/'.$data->area->name.'.'.$data->part.'.jpg')}}')">
<form @if(!config('app.sms.sign')) action="{{route('client.sign-in-do')}}" @endif id="login-form" method="post">
<form @if(!config('app.sign.sms')) action="{{route('client.sign-in-do')}}" @endif id="login-form" method="post">
@csrf
<h3>
{{$subtitle}}
@ -9,7 +9,7 @@
@include('components.err')
</div>
<div id="login-content">
@if(!config('app.sms.sign'))
@if(!config('app.sign.sms'))
<label>
{{__("Email")}}
</label>

@ -2,7 +2,7 @@
>
<div id="login-container"
style="background-image: url('{{asset('upload/images/'.$data->area->name.'.'.$data->part.'.jpg')}}')">
<form @if(!config('app.sms.sign')) action="{{route('client.sign-in-do')}}" @endif id="login-form" method="post">
<form @if(!config('app.sign.sms')) action="{{route('client.sign-in-do')}}" @endif id="login-form" method="post">
@csrf
<h3>
{{$subtitle}}
@ -11,7 +11,7 @@
@include('components.err')
</div>
<div id="login-content">
@if(!config('app.sms.sign'))
@if(!config('app.sign.sms'))
<label>
{{__("Email")}}
</label>

@ -1,10 +1,10 @@
import {tns} from "tiny-slider/src/tiny-slider";
var parallaxSlider;
var parallaxSlider ;
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('#ParallaxSliderTns')?.forEach(function (el) {
if (el.classList.contains('.tns-slider')) {
if (el.classList.contains('.tns-slider')){
console.log('ignore');
return 'ignore';
}
@ -56,18 +56,13 @@ document.addEventListener('DOMContentLoaded', () => {
});
}
try {
// Apply parallax on scroll and resize
window.addEventListener('scroll', applyParallax);
window.addEventListener('resize', applyParallax);
// Apply parallax on scroll and resize
window.addEventListener('scroll', applyParallax);
window.addEventListener('resize', applyParallax);
// Initial application
applyParallax();
// Initial application
applyParallax();
// Reapply parallax when tiny-slider changes slides
parallaxSlider.events.on('transitionEnd', applyParallax);
} catch {
}
// Reapply parallax when tiny-slider changes slides
parallaxSlider.events.on('transitionEnd', applyParallax);
});

Loading…
Cancel
Save