Skip to content

Commit

Permalink
Merge pull request #163 from avored/dev
Browse files Browse the repository at this point in the history
merging dev to master
  • Loading branch information
indpurvesh authored Jun 14, 2018
2 parents ffb9269 + 1a1ad04 commit b1808c9
Show file tree
Hide file tree
Showing 38 changed files with 836 additions and 199 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ storage/framework/bootstrap/cache/services.php
/modules/*
/modules/ecommerce
/themes/*
/public/cov/*

# Include Ecommerce Module
!/modules/avored
Expand Down
31 changes: 29 additions & 2 deletions app/Http/Controllers/ProductViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use AvoRed\Framework\Models\Database\Product;
use AvoRed\Framework\Models\Contracts\ProductInterface;
use Illuminate\Http\Request;
use AvoRed\Framework\Models\Contracts\ProductDownloadableUrlInterface;

class ProductViewController extends Controller
{
Expand All @@ -13,9 +15,16 @@ class ProductViewController extends Controller
*/
protected $repository;

public function __construct(ProductInterface $repository)
/**
* Product Downloadable Url Repository
* @var \AvoRed\Framework\Models\Repository\ProductDownloadableUrlRepository
*/
protected $downRep;

public function __construct(ProductInterface $repository , ProductDownloadableUrlInterface $downRep)
{
$this->repository = $repository;
$this->repository = $repository;
$this->downRep = $downRep;
}

public function view($slug)
Expand All @@ -34,4 +43,22 @@ public function view($slug)
->with('title', $title)
->with('description', $description);
}

public function downloadDemoProduct(Request $request) {

$downModel = $this->downRep->findByToken($request->get('product_token'));

$path = storage_path('app/public' . DIRECTORY_SEPARATOR . $downModel->demo_path);
return response()->download($path);

}

public function downloadMainProduct(Request $request) {

$downModel = $this->downRep->findByToken($request->get('product_token'));

$path = storage_path('app/public' . DIRECTORY_SEPARATOR . $downModel->main_path);
return response()->download($path);

}
}
15 changes: 1 addition & 14 deletions modules/avored/ecommerce/.gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@

.idea/workspace.xml
.idea/php.xml
.idea/modules.xml
.idea/ecommerce.iml
.idea/vcs.xml
resources/.DS_Store
resources/views/.DS_Store
resources/views/admin/.DS_Store
src/.DS_Store
src/Models/.DS_Store
src/Http/.DS_Store
.DS_Store
.DS_Store
phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function up()
$table->timestamps();
});

$countryModel = Country::whereCode('nz')->first();
$countryModel = Country::whereCode('NZ')->first();


Configuration::create([
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<template>
<div class="form-group">
<label :id=fieldName>{{ label }}</label>
<input :type="fieldType"
<input :type=fieldType
:id=fieldName
:name=fieldName
:autofocus=autofocus
:disabled=disabled
@input="onChange"
v-model="value"
:class=computedClass />
Expand All @@ -16,12 +18,15 @@
<script>
export default {
props: {
fieldType: { type:String, default: 'text'},
label: { type:String, required: true},
fieldName: { type:String, required: true},
fieldClass: { type:String, default: 'form-control'},
fieldValue: { type:String, default: ''},
errorText : { type:String, default: ''},
fieldType: { type:String, default: 'text'},
label: { type:String, required: true},
fieldName: { type:String, required: true},
fieldClass: { type:String, default: 'form-control'},
fieldValue: { type:String, default: ''},
errorText : { type:String, default: ''},
autofocus : { type:Boolean, default: false},
disabled : { type:Boolean, default: false},
},
computed: {
computedClass: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
v-model="selectedValue"
>

<option v-for="option in options" :key="option.id" :value="option.id">
<option v-for="option in options" :key="option.id" :value="option.id">
{{ option.name }}

</option>

</select>
<div v-show=dataDisplayError class="invalid-feedback">
<div v-if=dataDisplayError class="invalid-feedback">
{{ errorText }}
</div>
</div>
Expand All @@ -41,19 +41,18 @@
},
options: function() {
return JSON.parse(this.fieldOptions);
}
},
dataDisplayError : function() {
if(this.errorText == ""){
return false;
}
return true;
},
},
data: function () {
return {
dataDisplayError : function() {
if(this.errorText == ""){
return false;
}
return true;
},
selectedValue: function() {
return this.fieldValue;
}
selectedValue: this.fieldValue
}
},
methods:{
Expand All @@ -67,7 +66,6 @@
this.selectValue = event.target.value;
},
isSelected: function(option) {
return (option.id == this.fieldValue);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,71 @@


@include('avored-ecommerce::forms.text',['name' => 'first_name','label' => __('avored-ecommerce::user.first-name')])
@include('avored-ecommerce::forms.text',['name' => 'last_name','label' => __('avored-ecommerce::user.last-name')])

<avored-form-input
field-name="first_name"
label="First Name"
field-value="{!! $model->first_name ?? "" !!}"
error-text="{!! $errors->first('first_name') !!}"
v-on:change="changeModelValue"
autofocus="autofocus"
>
</avored-form-input>


<avored-form-input
field-name="last_name"
label="Last Name"
field-value="{!! $model->last_name ?? "" !!}"
error-text="{!! $errors->first('last_name') !!}"
v-on:change="changeModelValue"
>
</avored-form-input>


@include('avored-ecommerce::forms.file',['name' => 'image','label' => __('avored-ecommerce::user.file')])

<avored-form-input
field-name="email"
field-type="email"
label="Email"
field-value="{!! $model->email ?? "" !!}"
error-text="{!! $errors->first('email') !!}"
v-bind:disabled="disabled"
v-on:change="changeModelValue"
>
</avored-form-input>


@if(isset($model) && $model->email != "")
<?php $attributes = ['disabled' => true,'class' => 'form-control','id' => 'email'];?>
@else
<?php $attributes = ['class' => 'form-control','id' => 'email']; ?>
@endif

@include('avored-ecommerce::forms.text',['name' => 'email','label' => __('avored-ecommerce::user.email'),'attributes' => $attributes])
@if(!isset($model))

@if(isset($model) && $model->email != "")
<avored-form-input
field-name="password"
field-type="password"
label="Password"
error-text="{!! $errors->first('password') !!}"
v-on:change="changeModelValue"
>
</avored-form-input>

@include('avored-ecommerce::forms.password',['name' => 'password','label' => __('avored-ecommerce::user.password')])
@include('avored-ecommerce::forms.password',['name' => 'password_confirmation','label' => __('avored-ecommerce::user.confirm-password')])
<avored-form-input
field-name="password_confirmation"
field-type="password"
label="Confirm Password"
error-text="{!! $errors->first('password_confirmation') !!}"
v-on:change="changeModelValue"
>
</avored-form-input>

@endif


@include('avored-ecommerce::forms.select',['name' => 'role_id','label' => __('avored-ecommerce::user.user-role'),'options' => $roles])
<avored-form-select
field-name="role_id"
label="Role"
error-text="{!! $errors->first('role_id') !!}"
field-options='{!! $roles !!}'
field-value="{!! $model->role_id ?? "" !!}"
v-on:change="changeModelValue"
>
</avored-form-select>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

@section('content')

<div class="row">
<div id="admin-admin-user-page" class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
Expand Down Expand Up @@ -30,4 +30,29 @@

</div>
</div>
@endsection
@endsection


@push('scripts')

<script>
var app = new Vue({
el: '#admin-admin-user-page',
data : {
model: {},
autofocus:true,
disabled: false
},
methods: {
changeModelValue: function(val,fieldName) {
this.model[fieldName] = val;
}
}
});
</script>


@endpush
27 changes: 25 additions & 2 deletions modules/avored/ecommerce/resources/views/admin-user/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

@section('content')

<div class="row">
<div id=admin-admin-user-page class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
Expand Down Expand Up @@ -31,4 +31,27 @@
</div>
</div>
</div>
@endsection
@endsection

@push('scripts')

<script>
var app = new Vue({
el: '#admin-admin-user-page',
data : {
model: {},
autofocus:true,
disabled: true
},
methods: {
changeModelValue: function(val,fieldName) {
this.model[fieldName] = val;
}
}
});
</script>


@endpush
5 changes: 3 additions & 2 deletions modules/avored/ecommerce/resources/views/auth/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@
<avored-form-input
field-name="email"
label="{{ __('avored-ecommerce::lang.admin-email-label') }}"

error-text="{!! $errors->first('email') !!}"
v-on:change="changeModelValue"
autofocus="autofocus"
>
</avored-form-input>

Expand Down Expand Up @@ -84,7 +84,8 @@
el: '#login-page',
data : {
email: '',
password: ''
password: '',
autofocus:true
},
computed: {
isLoginDisbled: function() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
field-value="{!! $model->name ?? "" !!}"
error-text="{!! $errors->first('name') !!}"
v-on:change="changeModelValue"
autofocus="autofocus"
>
</avored-form-input>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
el: '#admin-category-create-page',
data : {
category: {},
autofocus:true
},
methods: {
changeModelValue: function(val,fieldName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
el: '#admin-category-edit-page',
data : {
category: {!! $model !!},
autofocus: true
},
methods: {
changeModelValue: function(val,fieldName) {
Expand Down
Loading

0 comments on commit b1808c9

Please sign in to comment.