Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

Commit

Permalink
Show number attribute (#9)
Browse files Browse the repository at this point in the history
* Show number attribute

* Apply fixes from StyleCI (#10)
  • Loading branch information
alecritson authored and shaunrainer committed Dec 12, 2018
1 parent b02fb83 commit 8a666a5
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 10 deletions.
1 change: 1 addition & 0 deletions resources/assets/js/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var includes = [
'checkbox' : 'Checkbox',
'date-picker': 'DatePicker',
'input' : 'Input',
'number' : 'Number',
'radio' : 'Radio',
'select' : 'Select',
'taggable' : 'Taggable',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@
:required="attribute.required">
</candy-input>

<candy-number v-if="attribute.type == 'number'"
:handle="'default-'+ attribute.id"
:value="get(attribute.handle, 'default')"
@input="set(attribute.handle, $event, 'default')"
:required="attribute.required">
</candy-number>

<candy-date-picker
v-if="attribute.type == 'date'"
:value="get(attribute.handle, 'default')"
Expand Down
40 changes: 40 additions & 0 deletions resources/assets/js/components/elements/forms/inputs/Number.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<div>
<input type="number"
:value="value"
@input="updateValue($event.target.value)"
class="form-control"
:required="required"
:placeholder="placeholder"
:disabled="disabled">
</div>
</template>

<script>
export default {
props: {
value: {
type: String
},
translate: {
type: String,
default: null
},
required: {
type: Boolean
},
placeholder: {
type: String
},
disabled: {
type: Boolean,
default: false
}
},
methods: {
updateValue: function (value) {
this.$emit('input', value);
}
}
}
</script>
2 changes: 1 addition & 1 deletion resources/build/js/hub.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/Http/Controllers/Auth/ResetPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace GetCandy\Hub\Http\Controllers\Auth;

use Illuminate\Http\Request;
use GetCandy\Hub\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;

class ResetPasswordController extends Controller
{
Expand Down Expand Up @@ -43,8 +43,9 @@ public function __construct()
*
* If no token is present, display the link request form.
*
* @param \Illuminate\Http\Request $request
* @param string|null $token
* @param \Illuminate\Http\Request $request
* @param string|null $token
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function showResetForm(Request $request, $token = null)
Expand Down
9 changes: 3 additions & 6 deletions src/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public function getIndex()
$lastWeeksSales = $this->getSalesLastWeek();
$thisWeeksSales = $this->getSalesThisWeek();


$lastMonthSales = $this->ordersForDateRange(
Carbon::now()->startOfMonth()->subMonth(),
Carbon::now()->endOfMonth()->subMonth()
Expand Down Expand Up @@ -98,7 +97,7 @@ protected function salesData()
$prevStart = Carbon::now()->startOfWeek()->subWeeks($i + 1);
$prevEnd = Carbon::now()->endOfWeek()->subWeeks($i + 1);

$label = $start->format('dS') . ' to ' . $end->format('dS') . ' ' . $end->format('F Y');
$label = $start->format('dS').' to '.$end->format('dS').' '.$end->format('F Y');

$total = $this->ordersForDateRange(
$start,
Expand All @@ -115,9 +114,9 @@ protected function salesData()
)->first()->grand_total;

$data[$label] = [
'total' => $total,
'total' => $total,
'previous' => $previous,
'diff' => $total - $previous
'diff' => $total - $previous,
];
}

Expand Down Expand Up @@ -152,7 +151,6 @@ public function getOrderMonthsGraph()
$data[] = $total;
}


$dataset = [
'label' => 'Order Totals',
'backgroundColor' => '#E7028C',
Expand Down Expand Up @@ -249,7 +247,6 @@ protected function ordersLastWeek()

protected function getSalesThisWeek()
{

return $this->ordersThisWeek()->select(
\DB::RAW('SUM(((sub_total + tax_total - discount_total / conversion) / 100)) as grand_total')
)->first()->grand_total;
Expand Down

0 comments on commit 8a666a5

Please sign in to comment.