Compare commits
No commits in common. "86d2c0e9f6acca567f08974d502088e573cb0226" and "89c9a852041419bdeeb7fce89064aed59efbf845" have entirely different histories.
86d2c0e9f6
...
89c9a85204
16 changed files with 12 additions and 3326 deletions
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
|
@ -1,8 +0,0 @@
|
||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
2925
.idea/commandlinetools/Laravel_28_2_22_11_47.xml
generated
2925
.idea/commandlinetools/Laravel_28_2_22_11_47.xml
generated
File diff suppressed because it is too large
Load diff
|
@ -1,47 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
|
|
||||||
xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
|
||||||
<xs:element name="framework" type="frameworkType"/>
|
|
||||||
<xs:complexType name="commandType">
|
|
||||||
<xs:all>
|
|
||||||
<xs:element type="xs:string" name="name" minOccurs="1" maxOccurs="1"/>
|
|
||||||
<xs:element type="xs:string" name="params" minOccurs="0" maxOccurs="1"/>
|
|
||||||
<xs:element type="xs:string" name="help" minOccurs="0" maxOccurs="1"/>
|
|
||||||
<xs:element type="optionsBeforeType" name="optionsBefore" minOccurs="0" maxOccurs="1"/>
|
|
||||||
</xs:all>
|
|
||||||
</xs:complexType>
|
|
||||||
<xs:complexType name="frameworkType">
|
|
||||||
<xs:sequence>
|
|
||||||
<xs:element type="xs:string" name="extraData" minOccurs="0" maxOccurs="1"/>
|
|
||||||
<xs:element type="commandType" name="command" maxOccurs="unbounded" minOccurs="0"/>
|
|
||||||
<xs:element type="xs:string" name="help" minOccurs="0" maxOccurs="1"/>
|
|
||||||
</xs:sequence>
|
|
||||||
<xs:attribute type="xs:string" name="name" use="required"/>
|
|
||||||
<xs:attribute type="xs:string" name="invoke" use="required"/>
|
|
||||||
<xs:attribute type="xs:string" name="alias" use="required"/>
|
|
||||||
<xs:attribute type="xs:boolean" name="enabled" use="required"/>
|
|
||||||
<xs:attribute type="xs:integer" name="version" use="required"/>
|
|
||||||
<xs:attribute type="xs:string" name="frameworkId" use="optional"/>
|
|
||||||
</xs:complexType>
|
|
||||||
<xs:complexType name="optionsBeforeType">
|
|
||||||
<xs:sequence>
|
|
||||||
<xs:element type="optionType" name="option" maxOccurs="unbounded" minOccurs="0"/>
|
|
||||||
</xs:sequence>
|
|
||||||
</xs:complexType>
|
|
||||||
<xs:complexType name="optionType">
|
|
||||||
<xs:sequence>
|
|
||||||
<xs:element type="xs:string" name="help" minOccurs="0" maxOccurs="1"/>
|
|
||||||
</xs:sequence>
|
|
||||||
<xs:attribute type="xs:string" name="name" use="required"/>
|
|
||||||
<xs:attribute type="xs:string" name="shortcut" use="optional"/>
|
|
||||||
<xs:attribute name="pattern" use="optional">
|
|
||||||
<xs:simpleType>
|
|
||||||
<xs:restriction base="xs:string">
|
|
||||||
<xs:enumeration value="space"/>
|
|
||||||
<xs:enumeration value="equals"/>
|
|
||||||
<xs:enumeration value="unknown"/>
|
|
||||||
</xs:restriction>
|
|
||||||
</xs:simpleType>
|
|
||||||
</xs:attribute>
|
|
||||||
</xs:complexType>
|
|
||||||
</xs:schema>
|
|
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/pedi2.iml" filepath="$PROJECT_DIR$/.idea/pedi2.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
85
.idea/pedi2.iml
generated
85
.idea/pedi2.iml
generated
|
@ -1,85 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/app" isTestSource="false" packagePrefix="App\" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
|
||||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="Tests\" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/event-dispatcher" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php81" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/log" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/routing" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/simple-cache" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/event-dispatcher" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/css-selector" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-ctype" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/event-dispatcher-contracts" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-intl-grapheme" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/console" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/egulias/email-validator" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/process" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php72" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-intl-normalizer" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php73" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/http-kernel" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/finder" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/translation" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/asm89/stack-cors" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-mbstring" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/translation-contracts" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/http-foundation" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/brick/math" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/swiftmailer/swiftmailer" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/league/flysystem" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/opis/closure" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/league/csv" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/league/mime-type-detection" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/ramsey/collection" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/ramsey/uuid" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/inflector" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/lexer" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/voku/portable-ascii" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/facade/ignition-contracts" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/facade/flare-client-php" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/facade/ignition" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/fideloper/proxy" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/tinker" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/framework" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/ui" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/sanctum" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/fruitcake/laravel-cors" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/vlucas/phpdotenv" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpoption/phpoption" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psy/psysh" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nunomaduro/collision" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nesbot/carbon" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/ralouphie/getallheaders" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/tijsverkoyen/css-to-inline-styles" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/league/commonmark" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/guzzle" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/filp/whoops" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/psr7" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/var-dumper" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/promises" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/error-handler" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/deprecation-contracts" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/string" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/service-contracts" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/fakerphp/faker" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/container" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/mime" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-client" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-iconv" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-factory" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-intl-idn" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/dragonmantank/cron-expression" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-message" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php80" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
83
.idea/php.xml
generated
83
.idea/php.xml
generated
|
@ -1,83 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="PhpIncludePathManager">
|
|
||||||
<include_path>
|
|
||||||
<path value="$PROJECT_DIR$/vendor/psr/event-dispatcher" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php81" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/psr/log" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/routing" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/psr/simple-cache" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/css-selector" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/event-dispatcher-contracts" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-grapheme" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/console" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/egulias/email-validator" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/process" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php72" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-normalizer" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php73" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/http-kernel" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/finder" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/translation" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/asm89/stack-cors" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/translation-contracts" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/http-foundation" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/brick/math" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/swiftmailer/swiftmailer" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/league/flysystem" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/opis/closure" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/league/csv" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/league/mime-type-detection" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/ramsey/collection" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/ramsey/uuid" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/doctrine/inflector" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/doctrine/lexer" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/composer" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/voku/portable-ascii" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/facade/ignition-contracts" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/facade/flare-client-php" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/facade/ignition" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/fideloper/proxy" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/laravel/tinker" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/laravel/framework" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/laravel/ui" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/laravel/sanctum" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/fruitcake/laravel-cors" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/vlucas/phpdotenv" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/phpoption/phpoption" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/psy/psysh" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/nunomaduro/collision" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/nesbot/carbon" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/ralouphie/getallheaders" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/nikic/php-parser" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/tijsverkoyen/css-to-inline-styles" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/league/commonmark" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/guzzlehttp/guzzle" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/filp/whoops" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/guzzlehttp/psr7" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/var-dumper" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/guzzlehttp/promises" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/error-handler" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/deprecation-contracts" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/monolog/monolog" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/string" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/service-contracts" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/fakerphp/faker" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/psr/container" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/mime" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/psr/http-client" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-iconv" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/psr/http-factory" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-idn" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/dragonmantank/cron-expression" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/psr/http-message" />
|
|
||||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php80" />
|
|
||||||
</include_path>
|
|
||||||
</component>
|
|
||||||
<component name="PhpProjectSharedConfiguration" php_language_level="7.2">
|
|
||||||
<option name="suggestChangeDefaultLanguageLevel" value="false" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Http\Controllers\Api;
|
namespace App\Http\Controllers\Api;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Producto;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Filtros\FiltroDeSubpedido;
|
use App\Filtros\FiltroDeSubpedido;
|
||||||
use App\Subpedido;
|
use App\Subpedido;
|
||||||
|
@ -66,21 +65,4 @@ class SubpedidoController extends Controller
|
||||||
{
|
{
|
||||||
return new SubpedidoResource($subpedido);
|
return new SubpedidoResource($subpedido);
|
||||||
}
|
}
|
||||||
|
|
||||||
// recibe request, saca producto y cantidad, valida, y pasa a syncProducto en Subpedido
|
|
||||||
public function syncProductos(Subpedido $subpedido) {
|
|
||||||
$valid = request()->validate([
|
|
||||||
'cantidad' => 'required|min:0',
|
|
||||||
'producto_id' => [
|
|
||||||
'required',
|
|
||||||
Rule::in(Producto::all()->pluck('id')),
|
|
||||||
]
|
|
||||||
]);
|
|
||||||
|
|
||||||
$producto = Producto::find($valid['producto_id']);
|
|
||||||
|
|
||||||
$subpedido->syncProducto($producto, $valid['cantidad']);
|
|
||||||
return $subpedido;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
|
||||||
|
|
||||||
class ChismosaController extends Controller
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Create a new controller instance.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->middleware(['auth','subpedido']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function show()
|
|
||||||
{
|
|
||||||
return view('chismosa');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -81,6 +81,7 @@ class Subpedido extends Model
|
||||||
'total' => $cantidad * $producto->precio
|
'total' => $cantidad * $producto->precio
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//si la cantidad es 0, se elimina el producto del subpedido
|
//si la cantidad es 0, se elimina el producto del subpedido
|
||||||
$this->productos()->detach($producto->id);
|
$this->productos()->detach($producto->id);
|
||||||
|
|
10
public/js/app.js
vendored
10
public/js/app.js
vendored
|
@ -8,7 +8,7 @@ Vue.component('nav-bar', {
|
||||||
<img src="/assets/logoMPS.png" height="28">
|
<img src="/assets/logoMPS.png" height="28">
|
||||||
</a>
|
</a>
|
||||||
<p style="margin:0 auto" class="navbar-item"><slot name="subpedido"></slot></p>
|
<p style="margin:0 auto" class="navbar-item"><slot name="subpedido"></slot></p>
|
||||||
<a class="navbar-item" href="/chismosa">
|
<a class="navbar-item" href="#">
|
||||||
<img style="padding:0 0.3em;" src="/assets/chismosa.png" height="28">
|
<img style="padding:0 0.3em;" src="/assets/chismosa.png" height="28">
|
||||||
<p style="margin:0 auto; color:white">$ <span v-text="subpedido == null ? 0 : subpedido.total"></span></p>
|
<p style="margin:0 auto; color:white">$ <span v-text="subpedido == null ? 0 : subpedido.total"></span></p>
|
||||||
</a>
|
</a>
|
||||||
|
@ -54,15 +54,9 @@ Vue.component('nav-bar', {
|
||||||
this.actualizarSubpedido()
|
this.actualizarSubpedido()
|
||||||
});
|
});
|
||||||
//Emitir un evento subpedido-actualizado al agregar o eliminar un producto del subpedido para que el total de la chismosa se muestre correctamente
|
//Emitir un evento subpedido-actualizado al agregar o eliminar un producto del subpedido para que el total de la chismosa se muestre correctamente
|
||||||
Event.$on('sync-subpedido', (cantidad, id) => {
|
Event.$on('subpedido-actualizado', () => {
|
||||||
axios.post("/api/subpedidos/"+this.subpedido.id+"/sync", {
|
|
||||||
cantidad: cantidad,
|
|
||||||
producto_id: id
|
|
||||||
}).then(() => {
|
|
||||||
alert('subpedido actualizado');
|
|
||||||
this.actualizarSubpedido();
|
this.actualizarSubpedido();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
82
public/js/chismosa.js
vendored
82
public/js/chismosa.js
vendored
|
@ -1,82 +0,0 @@
|
||||||
Vue.component('chismosa', {
|
|
||||||
template: `
|
|
||||||
<div class="container">
|
|
||||||
<table class="table is-fullwidth">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th><abbr title="Producto">Prod</abbr></th>
|
|
||||||
<th><abbr title="Cantidad">Cant</abbr></th>
|
|
||||||
<th><abbr title="Precio Total">$</abbr></th>
|
|
||||||
<th>Editar</th>
|
|
||||||
<th><abbr title="Eliminar">X</abbr></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tfoot>
|
|
||||||
<tr>
|
|
||||||
<th><abbr title="Bonos de Transporte">BTR</abbr></th>
|
|
||||||
<th>{{ this.subpedido.bonos_de_transporte }}</th>
|
|
||||||
<th>{{ this.subpedido.subtotal_bonos_de_transporte }}</th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th>Total total</th>
|
|
||||||
<th></th>
|
|
||||||
<th>{{ this.subpedido.total }}</th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
</tfoot>
|
|
||||||
<tbody>
|
|
||||||
<producto-row v-for="producto in this.subpedido.productos" :producto="producto" :key="producto.id"></producto-row>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
`,
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
subpedido: {
|
|
||||||
productos:[]
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
/* TODO: tener el camino que se había hecho antes de abrir la chismosa para volver atrás */
|
|
||||||
miga: function() {
|
|
||||||
return {
|
|
||||||
nombre: "Chismosa de " + this.subpedido.nombre,
|
|
||||||
href: "/chismosa"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
beforeCreate() {
|
|
||||||
axios.get("/subpedidos/obtener_sesion").then(response => {
|
|
||||||
this.subpedido = response.data.subpedido;
|
|
||||||
this.fetchSubpedido();
|
|
||||||
Event.$emit("migas-agregar",this.miga);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fetchSubpedido() {
|
|
||||||
axios.get("/api/subpedidos/" + this.subpedido.id)
|
|
||||||
.then(response => {
|
|
||||||
this.subpedido = response.data.data;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Vue.component('producto-row', {
|
|
||||||
template: `
|
|
||||||
<tr>
|
|
||||||
<th>{{ this.producto.nombre }}</th>
|
|
||||||
<td>{{ this.producto.pivot.cantidad }}</td>
|
|
||||||
<td>{{ this.producto.pivot.total }}</td>
|
|
||||||
<td>ACÁ VA BOTON PA EDITAR</td>
|
|
||||||
<td>ACÁ VA BOTON PA BORRAR</td>
|
|
||||||
</tr>
|
|
||||||
`,
|
|
||||||
props: {
|
|
||||||
producto: Object
|
|
||||||
}
|
|
||||||
})
|
|
13
public/js/productos.js
vendored
13
public/js/productos.js
vendored
|
@ -144,7 +144,7 @@ Vue.component('producto-container', {
|
||||||
</button>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<input id="cantidad" class="input" type="number" v-model.number="cant" style="text-align: center">
|
<input id="cantidad" class="input" type="number" :value=cant style="text-align: center">
|
||||||
</p>
|
</p>
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<button class="button" @click="cant++">
|
<button class="button" @click="cant++">
|
||||||
|
@ -158,8 +158,7 @@ Vue.component('producto-container', {
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<footer class="modal-card-foot">
|
<footer class="modal-card-foot">
|
||||||
<!-- Habría que ver si cambiar el botón cuando al cantidad es 0 -->
|
<button class="button is-success" @click="agregarProducto">Agregar a la chismosa</button>
|
||||||
<button class="button is-success" :disabled="cant <= 0" @click="agregarProducto">Agregar a la chismosa</button>
|
|
||||||
<button class="button" @click.capture="cerrar">Cancelar</button>
|
<button class="button" @click.capture="cerrar">Cancelar</button>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
@ -181,17 +180,11 @@ Vue.component('producto-container', {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
cerrar() {
|
cerrar() {
|
||||||
this.cant = 0;
|
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
Event.$emit("migas-pop");
|
Event.$emit("migas-pop");
|
||||||
},
|
},
|
||||||
agregarProducto() {
|
agregarProducto() {
|
||||||
if (this.cant < 0) alert("No se puede agregar cantidades negativas")
|
Event.$emit("producto-add");
|
||||||
else if (!Number.isInteger(this.cant)) alert("Las cantidades deben ser números enteros")
|
|
||||||
else {
|
|
||||||
Event.$emit("sync-subpedido", this.cant, this.producto.id);
|
|
||||||
this.cerrar();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
@extends('layouts.app')
|
|
||||||
|
|
||||||
@section('stylesheets')
|
|
||||||
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
@section('content')
|
|
||||||
<chismosa></chismosa>
|
|
||||||
@endsection
|
|
||||||
|
|
||||||
@section('scripts')
|
|
||||||
<script src="{{ asset('js/chismosa.js') }}"></script>
|
|
||||||
@endsection
|
|
|
@ -32,7 +32,6 @@ Route::middleware('api')->group(function () {
|
||||||
Route::get('/','Api\SubpedidoController@index');
|
Route::get('/','Api\SubpedidoController@index');
|
||||||
Route::get('{subpedido}','Api\SubpedidoController@show');
|
Route::get('{subpedido}','Api\SubpedidoController@show');
|
||||||
Route::post('/','Api\SubpedidoController@store');
|
Route::post('/','Api\SubpedidoController@store');
|
||||||
Route::post('/{subpedido}/sync', 'Api\SubpedidoController@syncProductos');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//@TO DO -> esta ruta debe estar en middleware de auth y/o subpedido
|
//@TO DO -> esta ruta debe estar en middleware de auth y/o subpedido
|
||||||
|
|
|
@ -19,8 +19,6 @@ Auth::routes(['register' => false]);
|
||||||
|
|
||||||
Route::get('/productos', 'ProductoController@index')->name('productos.index');
|
Route::get('/productos', 'ProductoController@index')->name('productos.index');
|
||||||
|
|
||||||
Route::get('/chismosa', 'ChismosaController@show')->name('chismosa.show');
|
|
||||||
|
|
||||||
Route::middleware('auth')->group( function() {
|
Route::middleware('auth')->group( function() {
|
||||||
|
|
||||||
Route::name('subpedidos.')->prefix("subpedidos")->group( function() {
|
Route::name('subpedidos.')->prefix("subpedidos")->group( function() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue