osb/resources/theme/frontend/metronic/order.blade.php

311 lines
11 KiB
PHP
Raw Normal View History

2018-08-09 14:10:51 +00:00
@extends('layouts.app')
@section('htmlheader_title')
{{ trans('message.home') }}
@endsection
@section('main-content')
<div class="col-md-12">
<h1>Order Service</h1>
<div class="order-page" id="order-page">
<div class="row">
<div class="col-md-3">
<ul class="tabbable faq-tabbable">
<li class="active">
<a href="#order_1" data-toggle="tab" aria-expanded="true">Order Service</a>
</li>
</ul>
</div>
<div class="col-md-9">
<div class="tab-content" style="padding:0; background: #fff;">
<div class="tab-pane active" id="order_1">
<div class="panel-group" id="accordion1">
<form role="form" method="POST" enctype="multipart/form-data">
{{ csrf_field() }}
<div id="accordion">
<!-- Reseller Choose Client -->
2018-08-20 12:15:28 +00:00
@if (Auth::user() AND Auth::user()->isReseller())
2018-08-09 14:10:51 +00:00
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
2018-08-20 12:15:28 +00:00
Account
2018-08-09 14:10:51 +00:00
</h4>
</div>
<div class="panel-collapse">
<div class="panel-body">
2018-08-20 12:15:28 +00:00
<div class="col-md-12 margin-bottom-20">
2018-08-09 14:10:51 +00:00
2018-08-20 12:15:28 +00:00
<div class="col-md-6">
2018-08-09 14:10:51 +00:00
<ul class="nav nav-tabs">
2018-08-11 05:09:41 +00:00
<li class="active">
2018-08-20 12:15:28 +00:00
<a href="#account_exist" data-toggle="tab">Existing Account</a>
</li>
<li>
<a href="#client_new" data-toggle="tab">New Client</a>
2018-08-09 14:10:51 +00:00
</li>
</ul>
<div class="tab-content">
2018-08-20 12:15:28 +00:00
<div class="tab-pane row fade in active" id="account_exist">
<div class="control-group form-group col-sm-12 {{ $errors->has('account_id') ? 'has-error' : '' }}">
<label for="order_email">Client Account</label>
<select class="form-control" id="account_id" name="account_id">
<option value="">&nbsp;</option>
@foreach ($user->all_accounts()->sortBy('company') as $o)
<option value="{{ $o->id }}" @if($o->id == old('account_id')) selected @endif>{{ $o->company }}</option>
@endforeach
</select>
<span class="help-block">{{ $errors->first('account_id') }}</span>
</div>
</div>
<div class="tab-pane row fade" id="client_new">
2018-08-11 05:09:41 +00:00
<div class="control-group form-group col-sm-12 {{ $errors->has('order_email_manual') ? 'has-error' : '' }}">
<label for="order_email_manual">New Client Email</label>
<input type="email" class="form-control" id="order_email_manual" name="order_email_manual" placeholder="New Client Email" value="{{ old('order_email_manual') }}">
<span class="help-block">{{ $errors->first('order_email_manual') }}</span>
2018-08-09 14:10:51 +00:00
</div>
</div>
2018-08-20 12:15:28 +00:00
</div>
</div>
</div>
2018-08-09 14:10:51 +00:00
2018-08-20 12:15:28 +00:00
<div class="row">
<div class="col-sm-2"><button class="btn btn-block btn-primary">Previous</button></div>
<div class="col-sm-2"><button class="btn btn-block btn-primary next">Next</button></div>
</div>
</div>
</div>
</div>
<!-- Non-Authed User -->
@elseif (Auth::user())
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
Account
</h4>
</div>
<div class="panel-collapse">
<div class="panel-body">
<div class="col-md-12 margin-bottom-20">
<div class="col-md-6">
<ul class="nav nav-tabs">
<li class="active">
<a href="#account_exist" data-toggle="tab">Existing Account</a>
</li>
<li>
<a href="#account_new" data-toggle="tab">New Account</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane row fade in active" id="account_exist">
<div class="control-group form-group col-sm-12 {{ $errors->has('account_id') ? 'has-error' : '' }}">
<label for="order_email">Existing Account</label>
<select class="form-control" id="account_id" name="account_id">
2018-08-09 14:10:51 +00:00
<option value="">&nbsp;</option>
2018-08-20 12:15:28 +00:00
@foreach ($user->accounts->sortBy('company') as $o)
<option value="{{ $o->id }}" @if($o->id == old('account_id')) selected @endif>{{ $o->company }}</option>
2018-08-09 14:10:51 +00:00
@endforeach
</select>
2018-08-20 12:15:28 +00:00
<span class="help-block">{{ $errors->first('account_id') }}</span>
2018-08-09 14:10:51 +00:00
</div>
</div>
2018-08-20 12:15:28 +00:00
<div class="tab-pane row fade" id="account_new">
<div class="control-group form-group col-sm-12 {{ $errors->has('account_name') ? 'has-error' : '' }}">
<label for="account_name">Account Name</label>
<input type="text" class="form-control" id="account_name" name="account_name" placeholder="New Account Name" value="{{ old('order_email_manual') }}" disabled>
<span class="help-block">{{ $errors->first('account_name') }}</span>
</div>
</div>
2018-08-09 14:10:51 +00:00
</div>
</div>
</div>
<div class="row">
<div class="col-sm-2"><button class="btn btn-block btn-primary">Previous</button></div>
<div class="col-sm-2"><button class="btn btn-block btn-primary next">Next</button></div>
</div>
</div>
</div>
</div>
2018-08-20 12:15:28 +00:00
<!-- Non-Authed User -->
2018-08-11 05:09:41 +00:00
@else
2018-08-20 12:15:28 +00:00
@php
//dd($errors);
@endphp
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
Account
</h4>
</div>
<div class="panel-collapse">
<div class="panel-body">
<div class="col-md-12">
<div class="row col-md-6">
<div class="control-group form-group col-sm-12 {{ $errors->has('order_email_manual') ? 'has-error' : '' }}">
<label for="order_email_manual">Email Address</label>
<input type="email" class="form-control" id="order_email_manual" name="order_email_manual" placeholder="Email Address" value="{{ old('order_email_manual') }}">
<span class="help-block">{{ $errors->first('order_email_manual') }}</span>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-2"><button class="btn btn-block btn-primary">Previous</button></div>
<div class="col-sm-2"><button class="btn btn-block btn-primary next">Next</button></div>
</div>
</div>
</div>
</div>
2018-08-09 14:10:51 +00:00
@endif
<!-- Product -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">Product</h4>
</div>
<div class="panel-collapse margin-bottom-20">
<div class="panel-body">
<div class="col-md-12">
2018-08-11 05:09:41 +00:00
<div class="control-group form-group col-sm-12 {{ $errors->has('product_options') ? 'has-error' : '' }}">
<span class="help-block">{{ $errors->first('product_options') }}</span>
</div>
2018-08-09 14:10:51 +00:00
<div class="control-group form-group col-sm-6 {{ $errors->has('product_id') ? 'has-error' : '' }}">
<label for="order_email">Product</label>
2018-08-11 05:09:41 +00:00
<select class="form-control" id="product_id" name="product_id">
2018-08-09 14:10:51 +00:00
<option value="">&nbsp;</option>
2018-08-11 05:09:41 +00:00
@php
$po = $selected = NULL;
@endphp
2018-08-09 14:10:51 +00:00
@foreach (\App\Models\Product::active()->get()->sortBy('name') as $o)
2018-08-11 05:09:41 +00:00
@php
if ($o->id == old('product_id'))
{
$selected = 'selected';
$po = $o;
} else {
$selected = NULL;
}
@endphp
<option value="{{ $o->id }}" {{ $selected }}>{{ $o->name }}</option>
2018-08-09 14:10:51 +00:00
@endforeach
</select>
<span class="help-block">{{ $errors->first('product_id') }}</span>
</div>
2018-08-11 05:09:41 +00:00
<div class="col-sm-6" id="product_info">
@if (old('product_id'))
@include('widgets.product_description',['o'=>$po])
@endif
</div>
2018-08-09 14:10:51 +00:00
</div>
2018-08-11 05:09:41 +00:00
<div class="col-md-12" id="product_order">
@if (old('product_id'))
@include('widgets.product_order',['o'=>$po])
@endif
2018-08-09 14:10:51 +00:00
</div>
<div class="row">
2018-08-11 05:09:41 +00:00
<div class="col-sm-2"><button class="btn btn-block btn-primary">Previous</button></div>
<div class="col-sm-2 pull-right"><input type="submit" class="btn btn-block btn-primary" value="Submit Order"></div>
2018-08-09 14:10:51 +00:00
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="tab-pane" id="tab-2">
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@section('page-scripts')
@js('/js/jqBootstrapValidation.js','jq-validation','jquery')
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$(function () { $("input,select,textarea").not("[type=submit]").jqBootstrapValidation(); } );
$(document).ready(function () {
$('#accordion').accordion({
header: "> div > div",
collapsible: false,
heightStyle: 'content',
disabled: true
});
$('#accordion button').click(function (e) {
e.preventDefault();
e.stopPropagation();
var delta = ($(this).is('.next') ? 2 : -2);
$('#accordion').accordion('option', 'active', ($('#accordion').accordion('option', 'active') + delta));
});
$("select[name=product_id]").change(function() {
// If we select a blank, then dont continue
if (this.value == 0)
return false;
// Send the request and update sub category dropdown
$.ajax({
type: "GET",
dataType: "html",
cache: true,
url: '{{ url('product_info') }}'+'/'+$(this).val(),
timeout: 3000,
error: function(x) {
alert("Failed to submit");
},
success: function(data) {
$("div[id=product_info]").empty().append(data);
}
});
$.ajax({
type: "GET",
2018-08-11 05:09:41 +00:00
// data: "old=",
2018-08-09 14:10:51 +00:00
dataType: "html",
cache: true,
url: '{{ url('product_order') }}'+'/'+$(this).val(),
timeout: 3000,
error: function(x) {
alert("Failed to submit");
},
success: function(data) {
$("div[id=product_order]").empty().append(data);
}
});
});
});
</script>
<style>
span.help-block > ul {
color: #9d0000;
padding-left: 5px;
list-style-type: none;
}
</style>
2018-08-11 05:09:41 +00:00
@append