-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9219939
commit 6b81f1f
Showing
5 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
resources/js/components/Fieldtypes/CouponCodeFieldtype.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
<text-fieldtype | ||
:meta="meta" | ||
:config="{ | ||
classes: 'uppercase font-mono', | ||
focus: 'code', | ||
autoselect: true, | ||
input_type: 'text', | ||
}" | ||
:value="value" | ||
@input="updateDebounced" | ||
@keydown.native.space.prevent | ||
/> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'CouponCodeFieldtype', | ||
mixins: [Fieldtype], | ||
props: ['meta'], | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace DoubleThreeDigital\SimpleCommerce\Fieldtypes; | ||
|
||
use Illuminate\Support\Str; | ||
use Statamic\Fieldtypes\Text; | ||
|
||
class CouponCodeFieldtype extends Text | ||
{ | ||
protected $selectable = false; | ||
|
||
protected $component = 'coupon-code'; | ||
|
||
public function process($data) | ||
{ | ||
return Str::of($data)->upper()->__toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters