Commit 8fedd502 authored by Khumoyunmirzo Sodiqov's avatar Khumoyunmirzo Sodiqov

10/12/2019//22:31

parent da0b8fac
<?php
namespace App\Http\Controllers;
use App\Models\Address;
use App\Models\Client;
use App\Models\Orders;
use App\Models\OrderService;
use App\Models\Product;
use App\Models\Service;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class OrderController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application Clients page.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index(Request $request)
{
$status_id = ($request->get('status_id')) ? $request->get('status_id') : 0;
if ($status_id == 0) {
$orders = Orders::select([
'id',
'client_id',
'flight_id',
'barcode',
'operator_id',
'name',
'from_address',
'boxes',
'debet',
'credit',
'added',
'edited',
'total',
'amount',
'weight',
'summa',
'sign',
'track_number',
'is_site',
'site_name',
'site_track_number',
'is_payment_uzb',
'to_address_id',
'payment_is_to_office',
'client_type',
'delivery_info',
'status_id',
'label_url',
'comment',
DB::raw('(SELECT title FROM flights WHERE id=orders.flight_id) as flights'),
DB::raw('(SELECT name FROM users WHERE id=orders.operator_id) as operator'),
DB::raw('(SELECT concat(name, \' \', surname) FROM clients WHERE id=orders.client_id) as client'),
DB::raw('(SELECT title FROM status WHERE id=orders.status_id) as statuses'),
DB::raw('(SELECT color_class FROM status WHERE id=orders.status_id) as status_class'),
DB::raw('(SELECT concat(firstname,\' \',secondname,\' \',fathername) FROM address_info WHERE id=orders.to_address_id) as recipient'),
DB::raw('(SELECT concat(country,\' \',city,\' \',street,\' \',house,\' \',apartment,\' \',zip) FROM address_info WHERE id=orders.to_address_id) as recipient_address'),
])->get();
} else {
$orders = Orders::select([
'id',
'client_id',
'flight_id',
'barcode',
'operator_id',
'name',
'from_address',
'boxes',
'debet',
'credit',
'added',
'edited',
'total',
'amount',
'weight',
'summa',
'sign',
'track_number',
'is_site',
'site_name',
'site_track_number',
'is_payment_uzb',
'to_address_id',
'payment_is_to_office',
'client_type',
'delivery_info',
'status_id',
'label_url',
'comment',
DB::raw('(SELECT title FROM flights WHERE id=orders.flight_id) as flights'),
DB::raw('(SELECT name FROM users WHERE id=orders.operator_id) as operator'),
DB::raw('(SELECT concat(name, \' \', surname) FROM clients WHERE id=orders.client_id) as client'),
DB::raw('(SELECT title FROM status WHERE id=orders.status_id) as statuses'),
DB::raw('(SELECT color_class FROM status WHERE id=orders.status_id) as status_class'),
DB::raw('(SELECT concat(firstname,\' \',secondname,\' \',fathername) FROM address_info WHERE id=orders.to_address_id) as recipient'),
DB::raw('(SELECT concat(country,\' \',city,\' \',street,\' \',house,\' \',apartment,\' \',zip) FROM address_info WHERE id=orders.to_address_id) as recipient_address'),
])->where('status_id', '=', $status_id)->get();
}
$statuses = DB::select('SELECT s.id, s.sort, s.title, s.color_class, (SELECT count(*) FROM orders where status_id=s.id) as count FROM status s');
$count = DB::select('SELECT COUNT(*) as count FROM orders');
// dd($orders);
return view('pages.parcels.allpackages', ['orders' => $orders, 'count' => $count[0]->count, 'status_id' => $status_id, 'statuses' => $statuses]);
}
// function create(){
// return view('pages.parcels.order_create');
// }
//
// private function countPackages() : array
// {
// $itemsCounter = [
// 'allPackages' => Package::where('user_id', Auth::id())->count(),
// 'onPending' => Package::where('status', Package::STATUS_PENDING)->where('user_id', Auth::id())->count(),
// 'inStore' => Package::where('status', Package::STATUS_INSTORE)->where('user_id', Auth::id())->count(),
// 'onPacking' => Package::where('status', Package::STATUS_ONPACKING)->where('user_id', Auth::id())->count(),
// 'sent' => Package::where('status', Package::STATUS_SENT)->where('user_id', Auth::id())->count(),
// 'delivered' => Package::where('status', Package::STATUS_DELIVERED)->where('user_id', Auth::id())->count(),
// ];
//
// return $itemsCounter;
// }
/**
* Show the application Client create page.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function create($id)
{
$client = Client::find($id);
$senderAddresses = Address::select([
'id',
'country',
'city', 'street', 'house', 'apartment', 'zip', 'passport', 'type'
])->where('type', '=', 0)->get();
$recAddresses = Address::select([
'id',
'country',
'city', 'street', 'house', 'apartment', 'zip', 'passport', 'type'
])->where('type', '=', 1)->get();
$services = Service::select([
'id', 'name_ru', 'price', 'status'
])->where('status', '=', 1)->get();
return view('pages.parcels.order_create', ['client' => $client, 'senderAddresses' => $senderAddresses, 'recAddresses' => $recAddresses, 'services' => $services]);
}
public function store(Request $request)
{
$user = Auth::user();
// $data = $request->json()->get('data');
$orderServices = $request->get('services_id');
$orderProducts = $request->get('products');
$price = 0;
$weight = 0;
$amount = 0;
$serSum = 0;
if ($orderProducts != null) {
foreach ($orderProducts as $item) {
$price += $item[3];
$weight += $item[2];
$amount += $item[1];
}
}
if ($orderServices != null) {
foreach ($orderServices as $item) {
$ser = Service::find($item);
$serSum += $ser->price;
}
}
$order = Orders::create([
'client_id' => $request->get('client_id'),
'name' => $request->get('name'),
'flight_id' => 0,
'added' => Carbon::now(),
'amount' => $amount,
'summa' => ($weight * 8) + $serSum,
'weight' => $weight,
'total' => $price,
'track_number' => $this->generateUniqNumber(12),
'is_site' => 0,
'is_payment_uzb' => 0,
'to_address_id' => $request->get('to_address_id'),
'payment_is_to_office' => 0,
'delivery_info' => $request->get('delivery_info'),
'comment' => $request->get('comment'),
'client_type' => 'Mobile',
'status_id' => 19,
]);
if ($orderServices != null) {
foreach ($orderServices as $item) {
OrderService::create([
'orders_id' => $order->id,
'services_id' => $item
]);
}
}
if ($orderProducts != null) {
foreach ($orderProducts as $item) {
Product::create([
'title' => $item[0],
'weight' => $item[2],
'price' => $item[3],
'amount' => $item[1],
'order_id' => $order->id,
]);
}
}
return redirect(route('clients'));
}
}
......@@ -10,8 +10,10 @@ namespace App\Http\Controllers\Postman;
use App\Http\Controllers\Controller;
use App\Models\Activity;
use App\Models\Orders;
use App\Models\Package;
use App\Models\PackageItems;
use App\Models\Product;
use PDF;
class DeclarationController extends Controller
......@@ -35,18 +37,17 @@ class DeclarationController extends Controller
*/
public function generatePDF($package_id)
{
$package = Package::find($package_id);
$package_items = PackageItems::where('package_id', $package->id)->get();
$package = Orders::find($package_id);
$package_items = Product::where('order_id', $package->id)->get();
$declaration = [];
foreach ($package_items as $item) {
$itemClass = new \stdClass();
$itemClass->package_id = $package->id;
$itemClass->name = $item->item_name;
$itemClass->name = $item->title;
$itemClass->amount = $item->amount;
$itemClass->price = $item->price;
$itemClass->weight = $item->weight;
$itemClass->date = $item->date;
$declaration[] = $itemClass;
}
......@@ -56,9 +57,9 @@ class DeclarationController extends Controller
'package' => $package,
'declaration' => $declaration,
]);
$filename = md5(time()) . date('Ymdhis') . '.pdf';
Activity::appendLog("Сгенерирована декларация в PDF формате.", Activity::NOTICE);
return $pdf->download('declaration.pdf');
return $pdf->download($filename);
}
/**
......@@ -88,4 +89,4 @@ class DeclarationController extends Controller
return json_encode($declaration_data);
}
}
\ No newline at end of file
}
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class City extends Authenticatable
{
use Notifiable;
protected $table = 'city';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'country_id', 'parent', 'emoji', 'title_ru', 'title_uz', 'sort', 'status',
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Client extends Authenticatable
{
use Notifiable;
protected $table = 'clients';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'surname', 'birthday', 'sex', 'passport', 'passport_issue', 'passport_by', 'country_id',
'city_id', 'street', 'house', 'apartment', 'phone', 'mobile', 'email', 'add_operator_id', 'edit_operator_id',
'added', 'edited', 'orders', 'last_order', 'allowed', 'status', 'uni_code', 'lang_id', 'password', 'remember_token',
'scan_id', 'client_type'
];
// protected $hidden = [
// 'password', 'remember_token',
// ];
protected $casts = [
'added' => 'datetime',
'edited' => 'datetime',
'last_order' => 'datetime',
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class ClientAuthCodes extends Authenticatable
{
use Notifiable;
protected $table = 'client_auth_codes';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'client_id', 'code', 'life_time'
];
protected $casts = [
'life_time' => 'datetime'
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Country extends Authenticatable
{
use Notifiable;
protected $table = 'country';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'parent', 'emoji', 'title_ru', 'title_uz', 'sort', 'status',
];
public $timestamps = false;
}
<?php
/**
* Created by PhpStorm.
* User: Skalden
* Date: 7/21/2018
* Time: 1:31 PM
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Images extends Model {
class Images extends Authenticatable
{
use Notifiable;
protected $table = 'images';
public $timestamps = false;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'path', 'name', 'upload_name', 'size', 'date'
];
public function url()
{
return '/'.$this->path.'/'.$this->name;
return '/' . $this->path . '/' . $this->name;
}
}
\ No newline at end of file
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Notification extends Authenticatable
{
use Notifiable;
protected $table = 'notifications';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'client_id', 'message_ru', 'message_uz', 'message_en', 'created_at',
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class OrderService extends Authenticatable
{
use Notifiable;
protected $table = 'order_services';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'orders_id', 'services_id'
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Orders extends Authenticatable
{
use Notifiable;
protected $table = 'orders';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'client_id',
'flight_id',
'barcode',
'operator_id',
'name',
'from_address',
'boxes',
'debet',
'credit',
'added',
'edited',
'total',
'amount',
'weight',
'sign',
'summa',
'track_number',
'is_site',
'site_name',
'site_track_number',
'is_payment_uzb',
'to_address_id',
'payment_is_to_office',
'client_type',
'delivery_info',
'label_url',
'status_id'
];
public $timestamps = false;
protected $casts = [
'added' => 'datetime',
'edited' => 'datetime'
];
}
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Product extends Authenticatable
{
use Notifiable;
protected $table = 'products';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'operator_id', 'title', 'amount', 'weight', 'price', 'order_id', 'sproduct_id',
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Service extends Authenticatable
{
use Notifiable;
protected $table = 'services';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name_uz', 'name_ru', 'name_en', 'price', 'status', 'description_uz', 'description_ru', 'description_en',
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Status extends Authenticatable
{
use Notifiable;
protected $table = 'status';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'title', 'sort', 'color_class',
];
public $timestamps = false;
}
<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Tracking extends Authenticatable
{
use Notifiable;
protected $table = 'tracking';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'order_id', 'operator_id', 'status_id', 'updated'
];
public $timestamps = false;
}
......@@ -9,7 +9,9 @@
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="{{ asset('css/font-awesome.min.css') }}">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<style>
body {
background-color: #fbfbfb !important;
......@@ -93,17 +95,17 @@
<div class="col-12">
<div class="trackbl">
<a style="cursor: pointer; margin-bottom: 6px; display: block;" id="track_btn">Отследить посылку</a>
<a href="#" style="cursor: pointer; margin-bottom: 6px; display: block;">Отследить посылку</a>
<p style="color: #070b16; margin: 0 0 4px;">Ваш номер пользователя: <span
style="font-family: 'ProximaNova-Semibold'">4528</span></p>
style="font-family: 'ProximaNova-Semibold'"><b>{{ Auth::user()->uni_code }}</b></span></p>
</div>
</div>
</div>
</div>
<div class="container" style="height: 670px;">
<div class="container" style="min-height: 670px;">
<div class="row">
<div class="col-12">
@if( Session::has( 'success' ))
......@@ -144,9 +146,7 @@
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"
integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ"
crossorigin="anonymous"></script>
......
@extends('layouts.user_new')
@section('custom_script')
@include('pages.packages.declaration_script', ['jsonStructure' => $jsonStructure])
@endsection
@section('content')
<div class="row">
<div class="col-12">
......@@ -10,9 +7,53 @@
</h4>
</div>
</div>
{{-- {{dd($package->status_class)}}--}}
<section class="section section-inset-1">
<div class="container">
@include('pages.parcels.package_menu', ['countPackages' => $countPackages, 'active' => 'all'])
<div class="row">
<div class="col-12">
<nav>
<div class="nav nav-tabs" id="nav-tab" role="tablist">
<a class="nav-item nav-link {{ ($status_id == 0)?'active':''}}"
href="{{ route('package') }}"> Все посылки
<span class="badge badge-pill badge-primary">{{ $count }}</span>
</a>
@foreach($statuses as $item)
<a class="nav-item nav-link {{ ($status_id == $item->id)?'active':''}}"
href="{{ route('package', ['status_id' => $item->id ]) }}"> {{ $item->title }}
<span class="badge badge-pill badge-primary">{{ $item->count }}</span>
</a>
@endforeach
{{-- <a class="nav-item nav-link {{ $active == \App\Models\Package::STATUS_PENDING ? 'active' : '' }}" href="{{ route('packagePending') }}"> Ожидаются--}}
{{-- @if($countPackages['onPending'] !== 0)--}}
{{-- <span class="badge badge-pill badge-{{ \App\Models\Package::$statuses_colors[\App\Models\Package::STATUS_PENDING] }}">{{ $countPackages['onPending'] }}</span>--}}
{{-- @endif--}}
{{-- </a>--}}
{{-- <a class="nav-item nav-link {{ $active == \App\Models\Package::STATUS_INSTORE ? 'active' : '' }}" href="{{ route('packageInwarehouse') }}">На складе--}}
{{-- @if($countPackages['inStore'] !== 0)--}}
{{-- <span class="badge badge-pill badge-{{ \App\Models\Package::$statuses_colors[\App\Models\Package::STATUS_INSTORE] }}">{{ $countPackages['inStore'] }}</span>--}}
{{-- @endif--}}
{{-- </a>--}}
{{-- <a class="nav-item nav-link {{ $active == \App\Models\Package::STATUS_ONPACKING ? 'active' : '' }}" href="{{ route('packagePacking') }}">На упаковке--}}
{{-- @if($countPackages['onPacking'] !== 0)--}}
{{-- <span class="badge badge-pill badge-{{ \App\Models\Package::$statuses_colors[\App\Models\Package::STATUS_ONPACKING] }}">{{ $countPackages['onPacking'] }}</span>--}}
{{-- @endif--}}
{{-- </a>--}}
{{-- <a class="nav-item nav-link {{ $active == \App\Models\Package::STATUS_SENT ? 'active' : '' }}" href="{{ route('packageSent') }}">Отправленные--}}
{{-- @if($countPackages['sent'] !== 0)--}}
{{-- <span class="badge badge-pill badge-{{ \App\Models\Package::$statuses_colors[\App\Models\Package::STATUS_SENT] }}">{{ $countPackages['sent'] }}</span>--}}
{{-- @endif--}}
{{-- </a>--}}
{{-- <a class="nav-item nav-link {{ $active == \App\Models\Package::STATUS_DELIVERED ? 'active' : '' }}" href="{{ route('packageDelivered') }}" >Доставленные--}}
{{-- @if($countPackages['delivered'] !== 0)--}}
{{-- <span class="badge badge-pill badge-{{ \App\Models\Package::$statuses_colors[\App\Models\Package::STATUS_DELIVERED] }}">{{ $countPackages['delivered'] }}</span>--}}
{{-- @endif--}}
{{-- </a>--}}
</div>
</nav>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
......@@ -29,18 +70,20 @@
</tr>
</thead>
<tbody>
@foreach($packages as $package)
@foreach($orders as $package)
<tr>
<td class="text-center">{{ $package->package_number() }}</td>
<td class="text-center"><span class="badge shadow badge-{{ \App\Models\Package::$statuses_colors[$package->status] }}">{{ \App\Models\Package::$statuses_descr[$package->status] }}</span></td>
<td><a href="https://www.packagetrackr.com/track/{{ $package->track_number }}" class="text-info"> {{ $package->track_number }} </a></td>
<td class="text-center">{{ $package->id }}</td>
<td class="text-center"><span
class="badge shadow badge-{{ $package->status_class }}">{{ $package->statuses }}</span>
</td>
<td class="text-center">{{ $package->track_number }}</td>
<td class="d-flex justify-content-between align-items-center">
<span class="badge badge-primary badge-pill">{{ $package->total_items() }}</span>
<a href="#" onclick="showModal({{ $package->id }})">Декларация</a>
<span class="badge badge-primary badge-pill">{{ $package->amount }}</span>
<a href="/declaration/{{ $package->id }}" target="_blank">Декларация</a>
</td>
<td class="text-center">${{ $package->items_cost() }}</td>
<td class="text-center">{{ $package->items_weight() }} кг</td>
<td class="text-center">{{ $package->delivery_cost }}</td>
<td class="text-center">${{ $package->price }}</td>
<td class="text-center">{{ $package->weight }} кг</td>
<td class="text-center">{{ $package->summa }}</td>
</tr>
@endforeach
</tbody>
......@@ -49,7 +92,7 @@
</div>
<!-- RD Mailform-->
<a href="/packages/addr" class="btn btn-success shadow" >Добавить посылку</a>
<a href="packages/create/{{ Auth::user()->id }}" class="btn btn-success shadow">Добавить посылку</a>
</div>
</div>
<div class="row mt-5">
......@@ -60,5 +103,5 @@
</div>
</section>
@include('pages.parcels.declaration_modal')
{{-- @include('pages.parcels.declaration_modal')--}}
@endsection
@extends('layouts.user_new')
@section('content')
<style>
/*#msform fieldset {*/
/* background: transparent;*/
/* border: 0 none;*/
/* padding: 20px 30px;*/
/* box-sizing: border-box;*/
/* width: 80%;*/
/* margin: 0 10%;*/
/* !*stacking fieldsets above each other*!*/
/* position: absolute;*/
/*}*/
/*Hide all except first fieldset*/
#msform fieldset:not(:first-of-type) {
display: none;
}
/*progressbar*/
#progressbar {
counter-reset: step;
padding: 20px 30px;
height: 100px;
}
#progressbar li {
list-style-type: none;
width: 33.33%;
float: left;
position: relative;
text-align: center;
}
#progressbar li:before {
content: counter(step);
counter-increment: step;
width: 30px;
height: 30px;
line-height: 20px;
display: block;
color: #ffffff;
background: #7d7d7d;
border-radius: 15px;
margin: 0 auto 5px auto;
}
/*progressbar connectors*/
#progressbar li:after {
content: '';
width: 90%;
height: 2px;
background: #7d7d7d;
position: absolute;
left: -45%;
top: 10px;
z-index: 1; /*put it behind the numbers*/
}
#progressbar li:first-child:after {
/*connector not needed before the first step*/
content: none;
}
/*marking active/completed steps green*/
/*The number of the step and the connector before it = green*/
#progressbar li.active:before, #progressbar li.active:after {
background: #27AE60;
color: #7d7d7d;
left: -45%;
}
</style>
<!-- multistep form -->
{{-- <form id="msform">--}}
{{-- <!-- progressbar -->--}}
{{-- <ul id="progressbar">--}}
{{-- <li class="active">Account Setup</li>--}}
{{-- <li>Social Profiles</li>--}}
{{-- <li>Personal Details</li>--}}
{{-- </ul>--}}
{{-- <!-- fieldsets -->--}}
{{-- <fieldset>--}}
{{-- <h2 class="fs-title">Create your account</h2>--}}
{{-- <h3 class="fs-subtitle">This is step 1</h3>--}}
{{-- <input type="text" name="email" placeholder="Email"/>--}}
{{-- <input type="password" name="pass" placeholder="Password"/>--}}
{{-- <input type="password" name="cpass" placeholder="Confirm Password"/>--}}
{{-- <input type="button" name="next" class="next action-button" value="Next"/>--}}
{{-- </fieldset>--}}
{{-- <fieldset>--}}
{{-- <h2 class="fs-title">Social Profiles</h2>--}}
{{-- <h3 class="fs-subtitle">Your presence on the social network</h3>--}}
{{-- <input type="text" name="twitter" placeholder="Twitter"/>--}}
{{-- <input type="text" name="facebook" placeholder="Facebook"/>--}}
{{-- <input type="text" name="gplus" placeholder="Google Plus"/>--}}
{{-- <input type="button" name="previous" class="previous action-button" value="Previous"/>--}}
{{-- <input type="button" name="next" class="next action-button" value="Next"/>--}}
{{-- </fieldset>--}}
{{-- <fieldset>--}}
{{-- <h2 class="fs-title">Personal Details</h2>--}}
{{-- <h3 class="fs-subtitle">We will never sell it</h3>--}}
{{-- <input type="text" name="fname" placeholder="First Name"/>--}}
{{-- <input type="text" name="lname" placeholder="Last Name"/>--}}
{{-- <input type="text" name="phone" placeholder="Phone"/>--}}
{{-- <textarea name="address" placeholder="Address"></textarea>--}}
{{-- <input type="button" name="previous" class="previous action-button" value="Previous"/>--}}
{{-- <input type="submit" name="submit" class="submit action-button" value="Submit"/>--}}
{{-- </fieldset>--}}
{{-- </form>--}}
<section class="section section-inset-1">
<div class="container">
<div class="row">
<div class="col-12">
<h4 class="mb-5">
<span class="text-top-title">Регистрация новой входящей посылки</span>
</h4>
</div>
</div>
<ul id="progressbar" class="needs-validation border border-1 bg-white">
<li class="active">СБОР ПОСЫЛКИ</li>
<li>АДРЕСА</li>
<li>ПОДТВЕРЖДЕНИЕ</li>
</ul>
<hr>
<form id="msform" action="#" method="POST"
class="needs-validation border border-1 bg-white p-5" novalidate>
{{ csrf_field() }}
<fieldset>
<div class="mb-3">
<label for="package_name">Название посылки <span style="color: #a01a1f">*</span></label>
<input type="text" class="form-control" name="name" id="package_name">
<div class="invalid-feedback">
Пожалуйста введите название посылки
</div>
</div>
<div class="mb-3">
<label for="comment">Комментарий к посылке <span style="color: #a01a1f">*</span></label>
<input type="text" class="form-control" name="comment" id="comment">
</div>
<div class="mb-3">
<label for="">Декларация посылки <span style="color: #a01a1f">*</span></label>
</div>
<table class="table table-hover text-left table-light " id="table_package">
<thead class="thead-light">
<tr class="d-flex">
<th class="col-1 text-center">№</th>
<th class="col-3">Название товара</th>
<th class="col-2">Количество (шт)</th>
<th class="col-2">Цена ($)</th>
<th class="col-2">Вес (кг)</th>
<th class="col-1">Стоим...</th>
<th class="col-1"></th>
</tr>
</thead>
<tbody>
<tr class="d-flex">
<td class="text-center col-1 counter_number">1</td>
<td class="col-3">
<input type="text" name="product[0][0]" class="form-control form-control-sm" required/>
</td>
<td class="col-2">
<div class="input-group input-group-sm">
<input type="number" name="product[1][1]" class="form-control form-control-sm count"
id=""
value="1" required>
<div class="invalid-feedback">
Укажите количество единиц товара
</div>
</div>
</td>
<td class="col-2">
<div class="input-group input-group-sm">
<input type="number" name="product[2][0]" class="form-control form-control-sm cost"
id=""
placeholder="Username" value="2" required>
<div class="invalid-feedback">
Укажите стоимость за единицу товара
</div>
</div>
</td>
<td class="col-2">
<div class="input-group input-group-sm">
<input type="number" step="0.1" name="product[3][0]"
class="form-control form-control-sm"
id="username" placeholder="Username" value="0.3" required>
<div class="invalid-feedback">
Your username is required.
</div>
</div>
</td>
<td class="text-center col-1">
<span class="cost_per_stuff">$2</span>
</td>
<td class="col-1 text-center">
<a href="#" class="btn btn-sm btn-outline-danger btn-round button-delete">X</a>
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-6">
<a href="#" class="btn btn-sm btn-primary btn-shadow" id="add_new_packet"><strong>+ Добавить
посылку</strong></a>
</div>
<div class="col-6 text-right">
Итоговая сумма в декларации: <strong><span class="text-success"
id="total_price">$2</span></strong>
</div>
</div>
<br/><br/>
<input type="button" name="next" class="next action-button btn btn-success btn-lg btn-block mt-4"
value="Next"/>
</fieldset>
<fieldset>
<h1>Адрес отправителя в США</h1>
<div class="mb-3">
<label for="">На этой странице вам необходимо указать ваш адрес в США. Этот адрес будет
использоваться в качестве адреса отправителя</label>
</div>
<hr>
<div class="mb-3">
{{-- <div class="mb-3">--}}
{{-- <label for="comment">Комментарий к посылке <span style="color: #a01a1f">*</span></label>--}}
{{-- <input type="text" class="form-control" name="comment" id="comment">--}}
{{-- </div>--}}
{{-- <label>Куда <span style="color: #EB0000">*</span></label>--}}
<select name="to_address_id" class="form-control">
@foreach($senderAddresses as $item)
<option
value="{{ $item->id }}">{{ $item->country.', '.$item->city.', '.$item->street.', '.$item->house.', '.$item->apartment.', '.$item->zip.' | '.$item->passport }}</option>
@endforeach
</select>
</div>
<br>
<hr>
<h1>Адрес получателя в Узбекистане</h1>
<div class="mb-3">
<label for="">Вы можете выбрать адрес получателя из сохранившехся адресов, либо добавить новый
адрес :</label>
</div>
<hr>
<div class="mb-3">
{{-- <div class="mb-3">--}}
{{-- <label for="comment">Комментарий к посылке <span style="color: #a01a1f">*</span></label>--}}
{{-- <input type="text" class="form-control" name="comment" id="comment">--}}
{{-- </div>--}}
{{-- <label>Куда <span style="color: #EB0000">*</span></label>--}}
<select name="to_address_id" class="form-control">
@foreach($recAddresses as $item)
<option
value="{{ $item->id }}">{{ $item->country.', '.$item->city.', '.$item->street.', '.$item->house.', '.$item->apartment.', '.$item->zip.' | '.$item->passport }}</option>
@endforeach
</select>
</div>
<br/><br/>
<div class="col-12" style="display: inline-flex">
<div class="col-6">
<input type="button" name="previous"
class="previous action-button btn btn-success btn-lg btn-block mt-4"
value="Предыдущий"/>
</div>
<div class="col-6">
<input type="button" name="next"
class="next action-button btn btn-success btn-lg btn-block mt-4"
value="Следующий"/>
</div>
</div>
</fieldset>
<fieldset>
<div class="col-6">
<input type="button" name="previous"
class="previous action-button btn btn-success btn-lg btn-block mt-4"
value="Предыдущий"/>
</div>
<div class="col-6">
<input type="button" name="next"
class="next action-button btn btn-success btn-lg btn-block mt-4"
value="Следующий"/>
</div>
<button class="btn btn-success btn-lg btn-block mt-4" type="submit">Зарегистрировать</button>
</fieldset>
</form>
</div>
</section>
<script>
// "use strict";
//jQuery time
var current_fs, next_fs, previous_fs; //fieldsets
var left, opacity, scale; //fieldset properties which we will animate
var animating; //flag to prevent quick multi-click glitches
$(".next").click(function () {
if (animating) return false;
animating = true;
current_fs = $(this).parent();
next_fs = $(this).parent().next();
//activate next step on progressbar using the index of next_fs
$("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active");
//show the next fieldset
next_fs.show();
current_fs.hide();
animating = false;
//hide the current fieldset with style
// current_fs.animate({opacity: 0}, {
// step: function (now, mx) {
// //as the opacity of current_fs reduces to 0 - stored in "now"
// //1. scale current_fs down to 80%
// scale = 1 - (1 - now) * 0.2;
// //2. bring next_fs from the right(50%)
// left = (now * 50) + "%";
// //3. increase opacity of next_fs to 1 as it moves in
// opacity = 1 - now;
// current_fs.css({
// 'transform': 'scale(' + scale + ')',
// 'position': 'absolute'
// });
// next_fs.css({'left': left, 'opacity': opacity});
// },
// duration: 800,
// complete: function () {
// current_fs.hide();
// animating = false;
// },
// //this comes from the custom easing plugin
// easing: 'easeInOutBack'
// });
});
$(".previous").click(function () {
if (animating) return false;
animating = true;
current_fs = $(this).parent();
previous_fs = $(this).parent().prev();
//de-activate current step on progressbar
$("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active");
//show the previous fieldset
previous_fs.show();
//hide the current fieldset with style
current_fs.hide();
animating = false;
// current_fs.animate({opacity: 0}, {
// step: function (now, mx) {
// //as the opacity of current_fs reduces to 0 - stored in "now"
// //1. scale previous_fs from 80% to 100%
// scale = 0.8 + (1 - now) * 0.2;
// //2. take current_fs to the right(50%) - from 0%
// left = ((1 - now) * 50) + "%";
// //3. increase opacity of previous_fs to 1 as it moves in
// opacity = 1 - now;
// current_fs.css({'left': left});
// previous_fs.css({'transform': 'scale(' + scale + ')', 'opacity': opacity});
// },
// duration: 800,
// complete: function () {
// current_fs.hide();
// animating = false;
// },
// //this comes from the custom easing plugin
// easing: 'easeInOutBack'
// });
});
// $(".submit").click(function () {
// return false;
// })
</script>
@endsection
@section('custom_script')
<script>
var counter = 1;
function count_total_cost() {
var total_sum = 0;
$('#table_package').find('tbody > tr').each(function (i, el) {
var cost = $(this).find('.cost_per_stuff').text().slice(1);
total_sum += parseInt(cost);
});
$('#total_price').text('$' + total_sum);
}
function recount_order() {
counter = 1;
$('.counter_number').each(function () {
$(this).html(counter);
counter += 1;
});
}
$('#table_package').on('keyup, focusout', '.count, .cost', function () {
$(this).parent().parent().parent().find('.cost_per_stuff').text('$' +
$(this).parent().parent().parent().find('.count').val() * $(this).parent().parent().parent().find('.cost').val()
);
count_total_cost();
});
$('#table_package').on('click', '.button-delete', function (e) {
e.preventDefault();
$(this).parent().parent().remove();
count_total_cost();
recount_order();
});
$('#add_new_packet').click(function (e) {
e.preventDefault();
counter += 1;
$('#table_package > tbody:last-child').append('<tr class="d-flex">\n' +
' <td class="text-center col-1 counter_number">' + counter + '</td>\n' +
' <td class="col-3">\n' +
' <input type="text" name="product[' + counter + '][0]" class="form-control form-control-sm" required />\n' +
' </td>\n' +
' <td class="col-2">\n' +
' <div class="input-group input-group-sm">\n' +
' <input type="number" name="product[' + counter + '][1]" class="form-control form-control-sm count" id="" value="1" required>\n' +
' <div class="invalid-feedback" >\n' +
' Укажите количество единиц товара\n' +
' </div>\n' +
' </div>\n' +
' </td>\n' +
' <td class="col-2">\n' +
' <div class="input-group input-group-sm">\n' +
' <input type="number" name="product[' + counter + '][2]" class="form-control form-control-sm cost" id="" placeholder="Username" value="2" required>\n' +
' <div class="invalid-feedback" >\n' +
' Укажите стоимость за единицу товара\n' +
' </div>\n' +
' </div>\n' +
' </td>\n' +
' <td class="col-2">\n' +
' <div class="input-group input-group-sm">\n' +
' <input type="number" step="0.1" name="product[' + counter + '][3]" class="form-control form-control-sm" id="username" placeholder="Username" value="0.3" required>\n' +
' <div class="invalid-feedback" >\n' +
' Your username is required.\n' +
' </div>\n' +
' </div>\n' +
' </td>\n' +
' <td class="text-center col-1">\n' +
' <span class="cost_per_stuff">$2</span>\n' +
' </td>\n' +
' <td class="col-1 text-center">\n' +
' <a href="#" class="btn btn-sm btn-outline-danger btn-round button-delete">X</a>\n' +
' </td>\n' +
' </tr>');
count_total_cost();
recount_order();
});
</script>
@endsection
......@@ -58,28 +58,30 @@ Route::get('/questions', function () {
Route::post('/feedback/add', 'FeedbackController@addGuest');
Route::get('/packages/pay', 'PackagesController@pay');
Route::get('/packages/addr', 'PackagesController@addr');
Route::get('/packages', 'PackagesController@pending_packages')->name('package');
//
//Route::get('/packages/pay', 'PackagesController@pay');
//Route::get('/packages/addr', 'PackagesController@addr');
Route::get('/packages', 'OrderController@index')->name('package');
Route::get('/packages/create/{id}', 'OrderController@create')->name('package.create');
Route::get('/declaration/{package_id}', 'Postman\DeclarationController@generatePDF')->where(['package_id' => '[0-9]+']);
Route::get('/profile/address', 'ProfileController@address')->name('address');
Route::get('/profile/addaddress', 'ProfileController@addaddress')->name('address.add');
Route::post('/profile/storeaddress', 'ProfileController@storeaddress')->name('address.store');
Route::delete('/profile/{id}', 'ProfileController@deleteaddress')->name('address.destroy');
Route::get('/profile', 'ProfileController@profile');
Route::post('/profile/save', 'ProfileController@save')->name('profile.save');
Route::get('/packages/list', 'PackagesController@pending_packages');
Route::get('/packages/pending', 'PackagesController@pending_packages')->name('packagePending');
Route::get('/packages/warehouse', 'PackagesController@inwarehouse_packages')->name('packageInwarehouse');
Route::post('/packages/warehouse', 'PackagesController@inwarehouse_packages');
Route::get('/packages/packing', 'PackagesController@onpacking_packages')->name('packagePacking');
Route::get('/packages/register', 'PackagesController@register');
Route::post('/packages/register', 'PackagesController@register');
Route::get('/packages/sent', 'PackagesController@sent_packages')->name('packageSent');
Route::get('/packages/all', 'PackagesController@all_packages')->name('packageAll');
Route::get('/package/{id}/delivered', 'PackagesController@make_delivered')->where(['id' => '[0-9]+'])->name('makeDelivered');
Route::get('packages/delivered', 'PackagesController@delivered_packages')->name('packageDelivered');
//
//Route::get('/packages/list', 'PackagesController@pending_packages');
//Route::get('/packages/pending', 'PackagesController@pending_packages')->name('packagePending');
//Route::get('/packages/warehouse', 'PackagesController@inwarehouse_packages')->name('packageInwarehouse');
//Route::post('/packages/warehouse', 'PackagesController@inwarehouse_packages');
//Route::get('/packages/packing', 'PackagesController@onpacking_packages')->name('packagePacking');
//Route::get('/packages/register', 'PackagesController@register');
//Route::post('/packages/register', 'PackagesController@register');
//Route::get('/packages/sent', 'PackagesController@sent_packages')->name('packageSent');
//Route::get('/packages/all', 'PackagesController@all_packages')->name('packageAll');
//Route::get('/package/{id}/delivered', 'PackagesController@make_delivered')->where(['id' => '[0-9]+'])->name('makeDelivered');
//Route::get('packages/delivered', 'PackagesController@delivered_packages')->name('packageDelivered');
Route::get('/profile/info', 'ProfileController@info')->middleware('auth');
Route::post('/profile/address/add', 'ProfileController@address_add')->middleware('auth');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment