@extends('layouts.manage')

@section('title', __('manage.sales-report'))

@section('header')
  <a href="{{ route('manage.sales.report') }}" class="{{ Nav::isRoute('manage.sales.report') }}">
    <span class="menu-icon">
      <img src="{{ asset($storage_url.'img/manage-icons/reports.jpg') }}" alt="">
    </span><span class="menu-text">
      @lang('manage.sales-report')
    </span>
  </a>
@endsection

@section('content')
<div class="container-fluid">
	<div class="row">

    {{-- search form --}}
    <form action="{{ route('manage.sales.report') }}" class="form-horizontal form-search" method="get">
      {{ csrf_field() }}

      <div class="col-xs-12">
        @lang('manage.please-select-dates-to-see-reports')
      </div>
      
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 m-b-10">
          <div class="input-group date" data-provide="datepicker">
            <input type="text" 
              class="form-control datepicker" name="from" 
              placeholder="@lang('manage.from')" value="{{ $from or '' }}">
            <div class="input-group-addon">
              <span class="glyphicon glyphicon-th"></span>
            </div>
        </div>
      </div>
      
      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 m-b-10">
        <div class="input-group date" data-provide="datepicker">
        <input type="text" 
          class="form-control datepicker" name="until" 
          placeholder="@lang('manage.until')" value="{{ $until or '' }}">
          <div class="input-group-addon">
            <span class="glyphicon glyphicon-th"></span>
          </div>
        </div>
      </div>

      <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 m-b-10">
        <button type="submit" class="btn btn-default btn-sm btn-block">@lang('manage.check')</button>
      </div>

    </form>
    {{-- /. search form --}}

		
	</div>

  <div class="row">
    <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 m-b-10">
      <fieldset>
        <legend>@lang('manage.nb-item-sold')</legend>
        <h3>{{ $sold or 0 }}</h3>
      </fieldset>
    </div>
      
    <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 m-b-10">
      <fieldset>
        <legend>@lang('manage.income')</legend>
        <h3>{{ $income or 0 }}</h3>
      </fieldset>
    </div>

    <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12 m-b-10">
      <fieldset>
        <legend>@lang('manage.margin')</legend>
        <h3>{{ $margin or 0 }}</h3>
      </fieldset>
    </div>
  </div>
  
  <div class="row">
    <div class="col-lg-12 col-md-12 col-sm-12 xol-xs-12">
      <div class="col-xs-12 m-t-50">
        {!! $chartSold->html() !!}
      </div>
      <div class="col-xs-12 m-t-100">
        {!! $chartIncome->html() !!}
      </div>
      <div class="col-xs-12 m-t-100">
        {!! $chartMargin->html() !!}
      </div>
    </div>
    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 m-t-100">
      <div class="col-xs-12">      
        {!! $chartSales->html() !!}
      </div>
    </div>
  </div>

</div>
@endsection

@section('script')
  @parent
  {!! $chartSales->script() !!}
  {!! $chartSold->script() !!}
  {!! $chartIncome->script() !!}
  {!! $chartMargin->script() !!}
@endsection