This commit is contained in:
saeid
2019-05-08 17:46:30 +04:30
parent f6d7277ddc
commit 940a1b01ab
15 changed files with 823 additions and 378 deletions
+130 -56
View File
@@ -8,6 +8,10 @@ use App\Http\Requests\StoreTestResultRequest;
use App\TestResult; use App\TestResult;
use App\InputValue; use App\InputValue;
use App\Input; use App\Input;
use App\Gallery;
use App\Uploadable;
use Intervention\Image\ImageManagerStatic as Image;
use Illuminate\Support\Facades\Storage;
class TestResultController extends Controller class TestResultController extends Controller
{ {
@@ -53,7 +57,7 @@ class TestResultController extends Controller
$Inputs = Input::with('options','children','children.children')->whereNull('parent_id')->where('test_type_id',$request->test_type_id)->get(); $Inputs = Input::with('options','children','children.children')->whereNull('parent_id')->where('test_type_id',$request->test_type_id)->get();
////////////////////////////////////////////////////////////////////////////////////--2 ///////////////////////////////////////////////////////////////////////////Inputs
foreach ($Inputs as $Input) { foreach ($Inputs as $Input) {
if ($Input['type'] != 'Form') { if ($Input['type'] != 'Form') {
$Value = $TestResultInfo[$Input->name]; $Value = $TestResultInfo[$Input->name];
@@ -61,21 +65,18 @@ class TestResultController extends Controller
if ($Input['type'] == 'Checkbox' || $Input['type'] == 'Select' ) { if ($Input['type'] == 'Checkbox' || $Input['type'] == 'Select' ) {
foreach ($Value as $Option) { foreach ($Value as $Option) {
// dd($Option);
$InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $Input->id, 'option_id' => $Option]); $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $Input->id, 'option_id' => $Option]);
} }
} }
else { else {
$InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $Input->id, 'value' => $Value]); $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $Input->id, 'value' => $Value]);
} }
} }
else { else {
foreach ($Input->children as $InputChild) { foreach ($Input->children as $InputChild) {
$Value = $TestResultInfo[$InputChild->name]; $Value = $TestResultInfo[$InputChild->name];
if ($InputChild['type'] == 'Checkbox' || $InputChild['type'] == 'Select') { if ($InputChild['type'] == 'Checkbox' || $InputChild['type'] == 'Select') {
// dd($InputChild['type']);
foreach ($Value as $Option) { foreach ($Value as $Option) {
$InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $InputChild->id, 'option_id' => $Option]); $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $InputChild->id, 'option_id' => $Option]);
} }
@@ -85,42 +86,27 @@ class TestResultController extends Controller
} }
} }
//-------------------------------------------------------
// $this->CreateChildFormValue2($Input,$TestResultObj,$TestResultInfo);
// foreach ($Input->children as $InputChild) {
//
// if ($InputChild['type'] != 'Form') {
// $Value = $TestResultInfo[$Input->name][$InputChild->name];
// $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id , 'input_id' => $InputChild->id , 'value' => $Value]);
// }
// else {
//
// foreach ($InputChild->children as $InputChild2) {
//
// if ($InputChild2['type'] != 'Form') {
// $Value = $TestResultInfo[$Input->name][$InputChild->name][$InputChild2->name];
// $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id , 'input_id' => $InputChild2->id , 'value' => $Value]);
// }
// else {
//
// }
//
// }
// }
//
// }
//---------------------------------------------------------
} }
} }
// if ($request->hasFile('image')) { ///////////////////////////////////////////////////////////////////////////Inputs
// $image = $request->file('image'); ///////////////////////////////////////////////////////////////////////////Image
// $input['imagename'] = time().$image->getClientOriginalExtension(); if ($request->hasFile('img')) {
// $path = '/Uploads'.'/'.$TestResultObj->id;
// Storage::disk('public')->makeDirectory($TestResultObj->id);
// $image->move($path, $input['imagename']);
// }
$Image = $request->file('img');
$InterventionImage = Image::make($Image);
$Mime = explode('/', $InterventionImage->mime());
$ImageName = time().'.'.$Mime[1];
$Path = 'uploads'.'/TestResults'.'/'.$TestResultObj->id .'/'.$ImageName;
Storage::disk('public')->makeDirectory('TestResults'.'/'.$TestResultObj->id);
$InterventionImage->save(public_path($Path));
$GalleryObj = Gallery::create(['user_id' => auth('api')->user()->id, 'path' => $Path]);
$Uploadable = Uploadable::create(['uploadable_id' => $TestResultObj->id, 'uploadable_type' => 'App\TestResult', 'gallery_id' => $GalleryObj->id, 'image_role' => 'TitleImage']);
}
///////////////////////////////////////////////////////////////////////////Image
}); });
} catch (\Exception $e) { } catch (\Exception $e) {
@@ -130,22 +116,59 @@ class TestResultController extends Controller
} }
public function show(TestResult $TestResult) public function show($id)
{ {
$TestResult = TestResult::with('input_values', 'user')->select('result', 'verified', 'autoclave_id','user_id','id')->findOrFail($id);
$options = [];
foreach ($TestResult->input_values as $key => $value) { foreach ($TestResult->input_values as $key => $value) {
$input = $value->input; $input = $value->input;
if ($input->type == 'Checkbox' || $input->type == 'Select') {
$input_options = InputValue::where('test_result_id', $TestResult->id)->where('input_id', $input->id)->get()->pluck('option_id')->toArray(); if ($input->parent_id != null && $input->parent['type'] == 'Form') {
$TestResult[$input->name] = $input_options; //----------------------------------------------------------------------FormType
if ($input->type == 'Checkbox' || $input->type == 'Select') {
$input_options = InputValue::with('option')->where('test_result_id', $TestResult->id)->where('input_id', $input->id)->get();
$options = [];
foreach ($input_options as $input_option) {
$options[] = $input_option->option->title;
$input_values[$input->name] = $options;
}
$children[$input->parent->name] = $input_values;
$TestResult['children'] = $children;
}
else {
$input_values = [$input->name => $value->value];
$children[$input->parent->name] = $input_values;
$TestResult['children'] = $children;
}
//-----------------------------------------------------------------------FormType
} }
else { else {
$TestResult[$input->name] = $value->value; //-----------------------------------------------------------------------Anothertype
if ($input->type == 'Checkbox' || $input->type == 'Select') {
$input_options = InputValue::with('option')->where('test_result_id', $TestResult->id)->where('input_id', $input->id)->get();
$options = [];
foreach ($input_options as $input_option) {
$options[] = $input_option->option->title;
}
$values[$input->name] = $options;
$TestResult['options'] = $values;
}
else {
$inputs[$input->name] = $value->value;
$TestResult['inputs'] = $inputs;
}
//-----------------------------------------------------------------------Anothertype
} }
} }
if (count($TestResult->TitleImage)) {
$TestResult['imagePath'] = $TestResult->TitleImage[0]->path;
}
return \MessageResponse::data($TestResult); return \MessageResponse::data($TestResult);
} }
//Todo:: pass Inputs
public function edit(TestResult $TestResult) public function edit(TestResult $TestResult)
{ {
foreach ($TestResult->input_values as $key => $value) { foreach ($TestResult->input_values as $key => $value) {
@@ -161,6 +184,14 @@ class TestResultController extends Controller
return \MessageResponse::data($TestResult); return \MessageResponse::data($TestResult);
} }
public static function storage_path($path)
{
if (starts_with($path, 'uploads/')) {
$path = substr($path, 8);
}
return $path;
}
public function update(StoreTestResultRequest $request, TestResult $TestResult) public function update(StoreTestResultRequest $request, TestResult $TestResult)
{ {
$TestResultData = [ $TestResultData = [
@@ -173,51 +204,94 @@ class TestResultController extends Controller
$TestResult->update($TestResultData); $TestResult->update($TestResultData);
$TestResultInfo = $request->all(); $TestResultInfo = $request->all();
$Inputs = Input::with('options','children','children.children')->whereNull('parent_id')->where('test_type_id',$request->test_type_id)->get(); $Inputs = Input::with('options', 'children', 'children.children')->whereNull('parent_id')->where('test_type_id',$request->test_type_id)->get();
foreach ($Inputs as $Input) { foreach ($Inputs as $Input) {
if ($Input['type'] != 'Form') { if ($Input['type'] != 'Form') {
$Value = $TestResultInfo[$Input->name]; $Value = $TestResultInfo[$Input->name];
if ($Input['type'] == 'Checkbox' || $Input['type'] == 'Select' ) { if ($Input['type'] == 'Checkbox' || $Input['type'] == 'Select' ) {
$InputOptions = InputValue::where('test_result_id', $TestResult->id)->where('input_id', $Input->id)->get()->each->delete();
foreach ($Value as $Option) { foreach ($Value as $Option) {
// $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $Input->id, 'option_id' => $Option]); $InputValueObj = InputValue::create(['test_result_id' => $TestResult->id, 'input_id' => $Input->id, 'option_id' => $Option]);
} }
} }
else { else {
$InputValueObj = InputValue::where('test_result_id',$TestResult->id)->where('input_id', $Input['id'])->update(['value' => $Value]); $InputValueObj = InputValue::where('test_result_id', $TestResult->id)->where('input_id', $Input['id'])->update(['value' => $Value]);
} }
} }
else { else {
foreach ($Input->children as $InputChild) { foreach ($Input->children as $InputChild) {
$Value = $TestResultInfo[$InputChild->name]; $Value = $TestResultInfo[$InputChild->name];
if ($InputChild['type'] == 'Checkbox' || $InputChild['type'] == 'Select') { if ($InputChild['type'] == 'Checkbox' || $InputChild['type'] == 'Select') {
$Value = json_encode($Value); $InputOptions = InputValue::where('test_result_id', $TestResult->id)->where('input_id', $InputChild->id)->get()->each->delete();
foreach ($Value as $Option) {
$InputValueObj = InputValue::create(['test_result_id' => $TestResult->id, 'input_id' => $InputChild->id, 'option_id' => $Option]);
}
} }
else { else {
$InputValueObj = InputValue::where('test_result_id',$TestResult->id)->where('input_id', $InputChild['id'])->update(['value' => $Value]); $InputValueObj = InputValue::where('test_result_id', $TestResult->id)->where('input_id', $InputChild['id'])->update(['value' => $Value]);
} }
} }
} }
} }
return \MessageResponse::success(null,trans('messages.update')); //////////////////////////////////////////////////////////////////Image
$image = '';
if (count($TestResult->TitleImage))
$image = $TestResult->TitleImage[0];
if ($request->hasFile('img')) {
$Image = $request->file('img');
$InterventionImage = Image::make($Image);
$Mime = explode('/', $InterventionImage->mime());
$ImageName = time().'.'.$Mime[1];
$Path = 'uploads'.'/TestResults'.'/'.$TestResult->id .'/'.$ImageName;
Storage::disk('public')->makeDirectory('TestResults'.'/'.$TestResult->id);
$InterventionImage->save(public_path($Path));
if ($image !== ''){
Storage::disk('public')->delete(static::storage_path($image->path));
Uploadable::where('gallery_id', $image->id)->where('uploadable_id', $TestResult->id)->where('uploadable_type', get_class($TestResult))->delete();
//--------------------------------------------------------
$GalleryObj = Gallery::where('id', $image->id)->update(['path' => $Path]);
$Uploadable = Uploadable::create(['uploadable_id' => $TestResult->id, 'uploadable_type' => get_class($TestResult), 'gallery_id' => $image->id, 'image_role' => 'TitleImage']);
//--------------------------------------------------------
}
else {
//--------------------------------------------------------
$GalleryObj = Gallery::create(['user_id' => auth('api')->user()->id, 'path' => $Path]);
$Uploadable = Uploadable::create(['uploadable_id' => $TestResult->id, 'uploadable_type' => 'App\TestResult', 'gallery_id' => $GalleryObj->id, 'image_role' => 'TitleImage']);
//--------------------------------------------------------
}
}
//////////////////////////////////////////////////////////////////Image
return \MessageResponse::success(null,trans('messages.update'));
} }
public function destroy(TestResult $TestResult) public function destroy(TestResult $TestResult)
{ {
if (auth('api')->user()->can('delete', $TestResult)) { if (!auth('api')->user()->can('delete', $TestResult)) {
return \MessageResponse::error(trans('messages.failed')); return \MessageResponse::error(trans('messages.access_denied'));
} }
$TestResult->delete(); $TestResult->delete();
return \MessageResponse::success(null, trans('messages.failed')); return \MessageResponse::success(null, trans('messages.success'));
} }
public function verifyTestResult(TestResult $TestResult) public function verifyTestResult(TestResult $TestResult)
{ {
if (auth('api')->user()->can('verifyTestResult', $TestResult)) { if (!auth('api')->user()->can('verifyTestResult', $TestResult)) {
return \MessageResponse::error(trans('messages.failed')); return \MessageResponse::error(trans('messages.access_denied'));
} }
if ($TestResult->verified == 'Verified') { if ($TestResult->verified == 'Verified') {
$TestResult->verified = 'NotVerified'; $TestResult->verified = 'NotVerified';
@@ -225,7 +299,7 @@ class TestResultController extends Controller
$TestResult->verified = 'Verified'; $TestResult->verified = 'Verified';
} }
$TestResult->save(); $TestResult->save();
return \MessageResponse::data($TestResult); return \MessageResponse::success(trans('messages.success'));
} }
} }
+5 -4
View File
@@ -328,6 +328,9 @@ class TestTypeController extends Controller
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////
public function getInputs(Request $request) public function getInputs(Request $request)
{ {
if (auth('api')->user()->can('getInputs')) {
return \MessageResponse::error(trans('messages.failed'));
}
if($request->test_result_id !== '') { if($request->test_result_id !== '') {
$testTypeId = TestResult::find($request->test_result_id); $testTypeId = TestResult::find($request->test_result_id);
} }
@@ -363,11 +366,9 @@ class TestTypeController extends Controller
public function destroy(TestType $TestType) public function destroy(TestType $TestType)
{ {
// dd($TestType); if (!auth('api')->user()->can('delete', $TestType)) {
if (auth('api')->user()->can('delete', $TestType)) { return \MessageResponse::error(trans('messages.access_denied'));
return \MessageResponse::error(trans('messages.failed'));
} }
// dd($TestType);
$TestType->delete(); $TestType->delete();
return \MessageResponse::success(trans('messages.success')); return \MessageResponse::success(trans('messages.success'));
} }
+1 -1
View File
@@ -28,7 +28,7 @@ class TestResultPolicy
}␍ }␍
public function verifyTestResult(User $User, TestResult $TestResult)␍ public function verifyTestResult(User $User, TestResult $TestResult)␍
{␍ {␍
if($User->hasRole('Supervisor'))␍ // if($User->hasRole('Supervisor'))␍
return true;␍ return true;␍
}␍ }␍
}␍ }␍
+5
View File
@@ -26,4 +26,9 @@ class TestTypePolicy
// if($User->hasRole('Admin'))␍ // if($User->hasRole('Admin'))␍
return true;␍ return true;␍
}␍ }␍
public function getInputs(User $User)␍
{␍
// if($User->hasRole('Admin'))␍
return true;␍
}␍
}␍ }␍
+4
View File
@@ -19,4 +19,8 @@ class TestResult extends Model
{ {
return $this->hasMany('App\InputValue'); return $this->hasMany('App\InputValue');
} }
public function TitleImage()
{
return $this->morphToMany('App\Gallery', 'uploadable')->wherePivot('image_role', 'TitleImage');
}
} }
+4 -1
View File
@@ -3,11 +3,14 @@
namespace App; namespace App;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class TestType extends Model class TestType extends Model
{ {
use SoftDeletes;
public $fillable = ['name','unique_code','user_id']; public $fillable = ['name','unique_code','user_id'];
protected $softDelete = true; // protected $softDelete = true;
public function user() public function user()
{ {
+1 -1
View File
@@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Model;
class Uploadable extends Model class Uploadable extends Model
{ {
protected $fillable = ['uploadable_id', 'uploadable_type', 'gallery_id']; protected $fillable = ['uploadable_id', 'uploadable_type', 'gallery_id', 'image_role'];
public $timestamps = false; public $timestamps = false;
public function gallery() public function gallery()
+103 -22
View File
@@ -13,12 +13,17 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/services */ "./resources/js/vue/services/index.js"); /* harmony import */ var _services__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @/services */ "./resources/js/vue/services/index.js");
/* harmony import */ var _config_urls__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/config/urls */ "./resources/js/vue/config/urls.js"); /* harmony import */ var _config_urls__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @/config/urls */ "./resources/js/vue/config/urls.js");
/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vuex */ "./node_modules/vuex/dist/vuex.esm.js");
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
// //
// //
// //
@@ -106,13 +111,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
// //
// //
// //
//
//
//
//
//
//
//
/* harmony default export */ __webpack_exports__["default"] = ({ /* harmony default export */ __webpack_exports__["default"] = ({
@@ -152,7 +151,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
created: function created() { created: function created() {
this.load(); this.load();
}, },
methods: { methods: _objectSpread({}, Object(vuex__WEBPACK_IMPORTED_MODULE_3__["mapMutations"])("modal", ["changeCurrentModal"]), {
load: function () { load: function () {
var _load = _asyncToGenerator( var _load = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
@@ -191,21 +190,59 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
return load; return load;
}(), }(),
remove: function () { show: function () {
var _remove = _asyncToGenerator( var _show = _asyncToGenerator(
/*#__PURE__*/ /*#__PURE__*/
_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(testResultId) { _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee2(testResultId) {
var result, key; var result;
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) { return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee2$(_context2) {
while (1) { while (1) {
switch (_context2.prev = _context2.next) { switch (_context2.prev = _context2.next) {
case 0: case 0:
_context2.next = 2; _context2.next = 2;
return _services__WEBPACK_IMPORTED_MODULE_1__["ApiService"].delete(_config_urls__WEBPACK_IMPORTED_MODULE_2__["urls"].removeTestResult(testResultId)); return _services__WEBPACK_IMPORTED_MODULE_1__["ApiService"].get(_config_urls__WEBPACK_IMPORTED_MODULE_2__["urls"].showTestResult(testResultId));
case 2: case 2:
result = _context2.sent; result = _context2.sent;
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-testresult-show",
properties: {
result: result
}
});
}
case 4:
case "end":
return _context2.stop();
}
}
}, _callee2, this);
}));
function show(_x) {
return _show.apply(this, arguments);
}
return show;
}(),
remove: function () {
var _remove = _asyncToGenerator(
/*#__PURE__*/
_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.mark(function _callee3(testResultId) {
var result, key;
return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default.a.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return _services__WEBPACK_IMPORTED_MODULE_1__["ApiService"].delete(_config_urls__WEBPACK_IMPORTED_MODULE_2__["urls"].removeTestResult(testResultId));
case 2:
result = _context3.sent;
if (result && result.status == 200) { if (result && result.status == 200) {
for (key in this.items) { for (key in this.items) {
if (this.items.hasOwnProperty(key) && this.items[key].id == testResultId) { if (this.items.hasOwnProperty(key) && this.items[key].id == testResultId) {
@@ -216,19 +253,19 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
case 4: case 4:
case "end": case "end":
return _context2.stop(); return _context3.stop();
} }
} }
}, _callee2, this); }, _callee3, this);
})); }));
function remove(_x) { function remove(_x2) {
return _remove.apply(this, arguments); return _remove.apply(this, arguments);
} }
return remove; return remove;
}() }()
}, }),
watch: { watch: {
currentPage: function currentPage(page) { currentPage: function currentPage(page) {
this.load(page); this.load(page);
@@ -333,6 +370,45 @@ var render = function() {
) )
], ],
1 1
),
_vm._v(" "),
_c("v-spacer"),
_vm._v(" "),
_c(
"v-flex",
{
staticClass: "text-xs-right",
attrs: { xs12: "", md2: "", sm2: "" }
},
[
_c(
"router-link",
{ attrs: { to: { name: "SubmitTestResult" } } },
[
_c(
"v-btn",
{
staticClass:
"WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black"
},
[
_c(
"v-icon",
{ staticClass: "black--text mr-2 caption" },
[_vm._v("fas fa-plus")]
),
_vm._v(" "),
_c("span", { staticClass: "black--text" }, [
_vm._v("Add")
])
],
1
)
],
1
)
],
1
) )
], ],
1 1
@@ -418,7 +494,12 @@ var render = function() {
"v-btn", "v-btn",
{ {
staticClass: "mr-2", staticClass: "mr-2",
attrs: { color: "cyan" } attrs: { color: "cyan" },
on: {
click: function($event) {
return _vm.show(item.id)
}
}
}, },
[ [
_c( _c(
@@ -473,8 +554,8 @@ var render = function() {
_c( _c(
"v-btn", "v-btn",
{ {
staticClass: "mr-2", staticClass: "WM-ActionButton",
attrs: { color: "black" }, attrs: { color: "pink" },
on: { on: {
click: function($event) { click: function($event) {
return _vm.remove(item.id) return _vm.remove(item.id)
@@ -486,12 +567,12 @@ var render = function() {
"v-icon", "v-icon",
{ {
staticClass: staticClass:
"white--text mr-1 caption" "white--text mr-2 caption"
}, },
[_vm._v("fas fa-folder")] [_vm._v("fas fa-times")]
), ),
_vm._v(" "), _vm._v(" "),
_c("span", [_vm._v("Archive")]) _c("span", [_vm._v("Remove")])
], ],
1 1
) )
Vendored
+8 -6
View File
@@ -95,6 +95,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
// //
// //
// //
//
//
/* harmony default export */ __webpack_exports__["default"] = ({ /* harmony default export */ __webpack_exports__["default"] = ({
@@ -225,7 +227,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
exports = module.exports = __webpack_require__(/*! ../../../../../node_modules/css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js")(false); exports = module.exports = __webpack_require__(/*! ../../../../../node_modules/css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js")(false);
// Module // Module
exports.push([module.i, "\n.WM-ActionButton[data-v-b1f1b72e] {\r\n padding: 8px 22px;\n}\r\n", ""]); exports.push([module.i, "\n.WM-ActionButton[data-v-b1f1b72e] {\r\n padding: 8px 22px;\n}\r\n", ""]);
@@ -492,8 +494,8 @@ var render = function() {
_c( _c(
"v-btn", "v-btn",
{ {
staticClass: "WM-ActionButton", staticClass: "mr-2",
attrs: { color: "pink" }, attrs: { color: "black" },
on: { on: {
click: function($event) { click: function($event) {
return _vm.remove(item.id) return _vm.remove(item.id)
@@ -504,12 +506,12 @@ var render = function() {
_c( _c(
"v-icon", "v-icon",
{ {
staticClass: "white--text mr-2 caption" staticClass: "white--text mr-1 caption"
}, },
[_vm._v("fas fa-times")] [_vm._v("fas fa-folder")]
), ),
_vm._v(" "), _vm._v(" "),
_c("span", [_vm._v("Remove")]) _c("span", [_vm._v("Archive")])
], ],
1 1
) )
+1 -1
View File
@@ -1,3 +1,3 @@
{ {
"/vue/js/app.js": "/vue/js/app.js?id=753975375c400e12c93b" "/vue/js/app.js": "/vue/js/app.js?id=571c3030afcd24e8d145"
} }
+210
View File
@@ -3445,6 +3445,67 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
/***/ }), /***/ }),
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/vue/components/modal/testresult/Show.vue?vue&type=script&lang=js&":
/*!************************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/vue/components/modal/testresult/Show.vue?vue&type=script&lang=js& ***!
\************************************************************************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vuex */ "./node_modules/vuex/dist/vuex.esm.js");
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
// import { ApiService } from "@/services";
// import { urls } from "@/config/urls";
/* harmony default export */ __webpack_exports__["default"] = ({
data: function data() {
return {
data: {}
};
},
methods: {// ...mapMutations("modal", ["closeModal", "setResultModal"]),
// async changeRole() {
// const result = await ApiService.post(
// urls.changeRoleUser(this.getModalProperties.user.id),
// this.data
// );
// if (result && result.status == 200) {
// this.setResultModal(result.data.data);
// this.closeModal();
// }
// }
},
created: function created() {
this.data = this.getModalProperties.result.data.data;
},
computed: _objectSpread({}, Object(vuex__WEBPACK_IMPORTED_MODULE_0__["mapGetters"])("modal", ["getModalProperties"]))
});
/***/ }),
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/vue/components/modal/user/Role.vue?vue&type=script&lang=js&": /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/vue/components/modal/user/Role.vue?vue&type=script&lang=js&":
/*!******************************************************************************************************************************************************************************!*\ /*!******************************************************************************************************************************************************************************!*\
!*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/vue/components/modal/user/Role.vue?vue&type=script&lang=js& ***! !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/vue/components/modal/user/Role.vue?vue&type=script&lang=js& ***!
@@ -17299,6 +17360,82 @@ render._withStripped = true
/***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/vue/components/modal/testresult/Show.vue?vue&type=template&id=9160f06e&":
/*!****************************************************************************************************************************************************************************************************************************!*\
!*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/vue/components/modal/testresult/Show.vue?vue&type=template&id=9160f06e& ***!
\****************************************************************************************************************************************************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
[
_c(
"v-container",
{ attrs: { fluid: "" } },
[
_c(
"material-card",
{ attrs: { color: "black", title: "Show Test Resualt", text: "" } },
[
_c(
"v-layout",
{
staticClass: "my-3",
attrs: { "align-center": "", wrap: "" }
},
[
_c(
"v-flex",
{ attrs: { xs12: "", md2: "", sm2: "" } },
[
_c("v-text-field", {
staticClass: "pa-2",
attrs: { label: "Name", color: "black" }
})
],
1
)
],
1
),
_vm._v(" "),
_c("v-divider"),
_vm._v(" "),
_c(
"v-layout",
{
staticClass: "my-3",
attrs: { "align-center": "", wrap: "" }
},
[_c("v-flex", { attrs: { md12: "" } })],
1
)
],
1
)
],
1
)
],
1
)
}
var staticRenderFns = []
render._withStripped = true
/***/ }), /***/ }),
/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/vue/components/modal/user/Role.vue?vue&type=template&id=f7c30ab4&": /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/vue/components/modal/user/Role.vue?vue&type=template&id=f7c30ab4&":
@@ -60764,6 +60901,7 @@ var map = {
"./modal/Base.vue": "./resources/js/vue/components/modal/Base.vue", "./modal/Base.vue": "./resources/js/vue/components/modal/Base.vue",
"./modal/auth/ChangePassword.vue": "./resources/js/vue/components/modal/auth/ChangePassword.vue", "./modal/auth/ChangePassword.vue": "./resources/js/vue/components/modal/auth/ChangePassword.vue",
"./modal/auth/VerifyCode.vue": "./resources/js/vue/components/modal/auth/VerifyCode.vue", "./modal/auth/VerifyCode.vue": "./resources/js/vue/components/modal/auth/VerifyCode.vue",
"./modal/testresult/Show.vue": "./resources/js/vue/components/modal/testresult/Show.vue",
"./modal/user/Role.vue": "./resources/js/vue/components/modal/user/Role.vue" "./modal/user/Role.vue": "./resources/js/vue/components/modal/user/Role.vue"
}; };
@@ -62050,6 +62188,75 @@ __webpack_require__.r(__webpack_exports__);
/***/ }),
/***/ "./resources/js/vue/components/modal/testresult/Show.vue":
/*!***************************************************************!*\
!*** ./resources/js/vue/components/modal/testresult/Show.vue ***!
\***************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _Show_vue_vue_type_template_id_9160f06e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Show.vue?vue&type=template&id=9160f06e& */ "./resources/js/vue/components/modal/testresult/Show.vue?vue&type=template&id=9160f06e&");
/* harmony import */ var _Show_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Show.vue?vue&type=script&lang=js& */ "./resources/js/vue/components/modal/testresult/Show.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");
/* normalize component */
var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
_Show_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
_Show_vue_vue_type_template_id_9160f06e___WEBPACK_IMPORTED_MODULE_0__["render"],
_Show_vue_vue_type_template_id_9160f06e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
false,
null,
null,
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "resources/js/vue/components/modal/testresult/Show.vue"
/* harmony default export */ __webpack_exports__["default"] = (component.exports);
/***/ }),
/***/ "./resources/js/vue/components/modal/testresult/Show.vue?vue&type=script&lang=js&":
/*!****************************************************************************************!*\
!*** ./resources/js/vue/components/modal/testresult/Show.vue?vue&type=script&lang=js& ***!
\****************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Show_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../node_modules/babel-loader/lib??ref--4-0!../../../../../../node_modules/vue-loader/lib??vue-loader-options!./Show.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/vue/components/modal/testresult/Show.vue?vue&type=script&lang=js&");
/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Show_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
/***/ }),
/***/ "./resources/js/vue/components/modal/testresult/Show.vue?vue&type=template&id=9160f06e&":
/*!**********************************************************************************************!*\
!*** ./resources/js/vue/components/modal/testresult/Show.vue?vue&type=template&id=9160f06e& ***!
\**********************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Show_vue_vue_type_template_id_9160f06e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../../../node_modules/vue-loader/lib??vue-loader-options!./Show.vue?vue&type=template&id=9160f06e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/vue/components/modal/testresult/Show.vue?vue&type=template&id=9160f06e&");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Show_vue_vue_type_template_id_9160f06e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_Show_vue_vue_type_template_id_9160f06e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
/***/ }), /***/ }),
/***/ "./resources/js/vue/components/modal/user/Role.vue": /***/ "./resources/js/vue/components/modal/user/Role.vue":
@@ -62165,6 +62372,9 @@ var urls = {
updateTestResult: function updateTestResult(id) { updateTestResult: function updateTestResult(id) {
return "/TestResults/".concat(id); return "/TestResults/".concat(id);
}, },
showTestResult: function showTestResult(id) {
return "/TestResults/".concat(id);
},
removeTestResult: function removeTestResult(id) { removeTestResult: function removeTestResult(id) {
return "/TestResults/".concat(id); return "/TestResults/".concat(id);
}, },
@@ -0,0 +1,47 @@
<template>
<div>
<v-container fluid>
<material-card class color="black" title="Show Test Resualt" text>
<v-layout align-center wrap class="my-3">
<v-flex xs12 md2 sm2>
<v-text-field class="pa-2" label="Name" color="black"></v-text-field>
</v-flex>
</v-layout>
<v-divider></v-divider>
<v-layout align-center wrap class="my-3">
<v-flex md12>
</v-flex>
</v-layout>
</material-card>
</v-container>
</div>
</template>
<script>
import { mapGetters, mapMutations } from "vuex";
// import { ApiService } from "@/services";
// import { urls } from "@/config/urls";
export default {
data: () => ({
data: {},
}),
methods: {
// ...mapMutations("modal", ["closeModal", "setResultModal"]),
// async changeRole() {
// const result = await ApiService.post(
// urls.changeRoleUser(this.getModalProperties.user.id),
// this.data
// );
// if (result && result.status == 200) {
// this.setResultModal(result.data.data);
// this.closeModal();
// }
// }
},
created(){
this.data = this.getModalProperties.result.data.data;
},
computed: {
...mapGetters("modal", ["getModalProperties"])
}
};
</script>
+3
View File
@@ -32,6 +32,9 @@ const urls = {
updateTestResult : function(id) { updateTestResult : function(id) {
return `/TestResults/${id}`; return `/TestResults/${id}`;
}, },
showTestResult : function(id) {
return `/TestResults/${id}`;
},
removeTestResult : function(id) { removeTestResult : function(id) {
return `/TestResults/${id}`; return `/TestResults/${id}`;
}, },
+164 -154
View File
@@ -1,167 +1,177 @@
<template> <template>
<div class=""> <div class>
<v-container fluid> <v-container fluid>
<material-card class="" <material-card class color="black" title="All Test Resualt" text>
color="black" <v-layout align-center wrap class="my-3">
title="All Test Resualt" <v-flex xs12 md2 sm2>
text="" <v-text-field class="pa-2" label="Name" color="black"></v-text-field>
> </v-flex>
<v-layout align-center wrap class="my-3"> <v-flex xs12 md2 sm2>
<v-flex xs12 md2 sm2> <v-text-field class="pa-2" label="Date" color="black"></v-text-field>
<v-text-field </v-flex>
class="pa-2" <v-flex xs12 md2 sm2>
label="Name" <v-text-field class="pa-2" label="Hospital" color="black"></v-text-field>
color="black" </v-flex>
> <v-flex class xs12 md2 sm2>
</v-text-field> <v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px">
</v-flex> <v-icon class="white--text mr-2 caption">fas fa-search</v-icon>
<v-flex xs12 md2 sm2> <span class="white--text">Filter</span>
<v-text-field </v-btn>
class="pa-2" </v-flex>
label="Date" <v-spacer></v-spacer>
color="black" <v-flex xs12 md2 sm2 class="text-xs-right">
> <router-link :to="{name: 'SubmitTestResult'}">
</v-text-field> <v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black">
</v-flex> <v-icon class="black--text mr-2 caption">fas fa-plus</v-icon>
<v-flex xs12 md2 sm2> <span class="black--text">Add</span>
<v-text-field </v-btn>
class="pa-2" </router-link>
label="Hospital" </v-flex>
color="black" </v-layout>
> <v-divider></v-divider>
</v-text-field> <v-layout align-center wrap class="my-3">
</v-flex> <v-flex md12>
<v-flex class="" xs12 md2 sm2> <v-data-table :headers="headers" :items="items" hide-actions>
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px"> <template slot="headerCell" slot-scope="{ header }">
<v-icon class="white--text mr-2 caption">fas fa-search</v-icon> <span
<span class="white--text">Filter</span> class="subheading font-weight-light text-white text--darken-3"
</v-btn> v-text="header.text"
</v-flex> />
</v-layout> </template>
<v-divider></v-divider> <template slot="items" slot-scope="{ item }">
<v-layout align-center wrap class="my-3"> <td class="headline font-weight-light">{{ item.autoclave_id }}</td>
<v-flex md12> <td
<v-data-table :headers="headers" :items="items" hide-actions> class="title font-weight-light"
<template slot="headerCell" slot-scope="{ header }"> >{{ item.user.medical_center.name }}</td>
<span <td class="title font-weight-light">{{ item.user.name }}</td>
class="subheading font-weight-light text-white text--darken-3" <td class="title font-weight-light">{{ item.result }}</td>
v-text="header.text" <td class="title font-weight-light">{{ item.created_at }}</td>
/> <td class="text-xs-right">
</template> <v-btn color="cyan" class="mr-2" @click="show(item.id)">
<template slot="items" slot-scope="{ item }"> <v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
<td class="headline font-weight-light">{{ item.autoclave_id }}</td> <span>Show</span>
<td class="title font-weight-light">{{ item.user.medical_center.name }}</td> </v-btn>
<td class="title font-weight-light">{{ item.user.name }}</td> <router-link
<td class="title font-weight-light">{{ item.result }}</td> :to="{name: 'EditTestResult', params: {testResult: item.id}}"
<td class="title font-weight-light">{{ item.created_at }}</td> >
<td class="text-xs-right"> <v-btn color="orange" class="mr-2">
<v-btn color="cyan" class="mr-2" > <v-icon class="white--text mr-1 caption">fas fa-pen</v-icon>
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon> <span>Edit</span>
<span>Show</span> </v-btn>
</v-btn> </router-link>
<router-link :to="{name: 'EditTestResult', params: {testResult: item.id}}"> <v-btn color="pink" class="WM-ActionButton" @click="remove(item.id)" >
<v-btn color="orange" class="mr-2"> <v-icon class="white--text mr-2 caption">fas fa-times</v-icon>
<v-icon class="white--text mr-1 caption">fas fa-pen</v-icon> <span>Remove</span>
<span>Edit</span> </v-btn>
</v-btn> </td>
</router-link> </template>
<v-btn color="black" class="mr-2" @click="remove(item.id)" > </v-data-table>
<v-icon class="white--text mr-1 caption">fas fa-folder</v-icon> </v-flex>
<span>Archive</span> </v-layout>
</v-btn> <v-divider></v-divider>
</td> <div class="text-xs-center" v-if="lastPage > 1">
</template> <v-pagination v-model="currentPage" :length="lastPage" :total-visible="6"></v-pagination>
</v-data-table> </div>
</v-flex> <v-layout row wrap align-center justify-center class="mt-3">
</v-layout> <router-link to="/dashboard">
<v-divider></v-divider> <v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black ml-5">
<div class="text-xs-center" v-if="lastPage > 1"> <v-icon class="black--text mr-2 caption">fas fa-chevron-left</v-icon>
<v-pagination v-model="currentPage" :length="lastPage" :total-visible="6"></v-pagination> <span class="black--text">Back</span>
</div> </v-btn>
<v-layout row wrap align-center justify-center class="mt-3"> </router-link>
<router-link to="/dashboard"> </v-layout>
<v-btn </material-card>
class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black ml-5"> </v-container>
<v-icon class="black--text mr-2 caption">fas fa-chevron-left</v-icon> </div>
<span class="black--text">Back</span>
</v-btn>
</router-link>
</v-layout>
</material-card>
</v-container>
</div>
</template> </template>
<script> <script>
import { ApiService } from "@/services"; import { ApiService } from "@/services";
import { urls } from "@/config/urls"; import { urls } from "@/config/urls";
import { mapMutations } from "vuex";
export default { export default {
data: () => ({ data: () => ({
headers: [ headers: [
{ {
sortable: false, sortable: false,
text: "AutoClaveId", text: "AutoClaveId",
value: "name" value: "name"
}, },
{ {
sortable: false, sortable: false,
text: "Hospital", text: "Hospital",
value: "Hospital" value: "Hospital"
}, },
{ {
sortable: false, sortable: false,
text: "User", text: "User",
value: "Users" value: "Users"
}, },
{ {
sortable: false, sortable: false,
text: "Result", text: "Result",
value: "result" value: "result"
}, },
{ {
sortable: false, sortable: false,
text: "Date", text: "Date",
value: "date" value: "date"
}, },
{ {
sortable: false, sortable: false,
text: "Action", text: "Action",
value: "action", value: "action",
align: "right" align: "right"
} }
], ],
items:[], items: [],
currentPage:1, currentPage: 1,
lastPage:1, lastPage: 1
}), }),
created() { created() {
this.load(); this.load();
},
methods: {
async load(page = 1) {
const result = await ApiService.get(urls.listTestResult(page));
if (result && result.status == 200) {
this.items = result.data.data.data;
this.currentPage = result.data.data.current_page;
this.lastPage = result.data.data.last_page;
}
}, },
async remove(testResultId) { methods: {
const result = await ApiService.delete(urls.removeTestResult(testResultId)); ...mapMutations("modal", ["changeCurrentModal"]),
if (result && result.status == 200) { async load(page = 1) {
for (const key in this.items) { const result = await ApiService.get(urls.listTestResult(page));
if (this.items.hasOwnProperty(key) && this.items[key].id == testResultId) { if (result && result.status == 200) {
this.items.splice(key, 1); this.items = result.data.data.data;
} this.currentPage = result.data.data.current_page;
this.lastPage = result.data.data.last_page;
}
},
async show(testResultId) {
const result = await ApiService.get(
urls.showTestResult(testResultId)
);
if (result && result.status == 200) {
this.changeCurrentModal({
modal: "modal-testresult-show",
properties: { result }
});
}
},
async remove(testResultId) {
const result = await ApiService.delete(
urls.removeTestResult(testResultId)
);
if (result && result.status == 200) {
for (const key in this.items) {
if (
this.items.hasOwnProperty(key) &&
this.items[key].id == testResultId
) {
this.items.splice(key, 1);
}
}
}
} }
}
}, },
}, watch: {
watch: { currentPage(page) {
currentPage(page) { this.load(page);
this.load(page); }
} }
} };
}
</script> </script>
+136 -131
View File
@@ -1,149 +1,154 @@
<template> <template>
<v-container fluid> <v-container fluid>
<material-card class color="black" title="Medical Centers List" text> <material-card class color="black" title="Medical Centers List" text>
<v-layout wrap class="px-5 mb-3"> <v-layout wrap class="px-5 mb-3">
<v-flex xs12 md3 sm3> <v-flex xs12 md3 sm3>
<v-text-field label="Name" color="black"></v-text-field> <v-text-field label="Name" color="black"></v-text-field>
</v-flex> </v-flex>
<v-flex xs12 md2 sm2 class="text-xs-right"> <v-flex xs12 md2 sm2 class="text-xs-right">
<v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px"> <v-btn class="WM-CyanBlueGradient-BG" style="padding:10px 60px">
<v-icon class="white--text mr-2 caption">fas fa-search</v-icon> <v-icon class="white--text mr-2 caption">fas fa-search</v-icon>
<span class="white--text">Filter</span> <span class="white--text">Filter</span>
</v-btn> </v-btn>
</v-flex> </v-flex>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-flex xs12 md2 sm2 class="text-xs-right"> <v-flex xs12 md2 sm2 class="text-xs-right">
<router-link :to="{name: 'AddTestType'}"> <router-link :to="{name: 'AddTestType'}">
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black"> <v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black">
<v-icon class="black--text mr-2 caption">fas fa-plus</v-icon> <v-icon class="black--text mr-2 caption">fas fa-plus</v-icon>
<span class="black--text">Add</span> <span class="black--text">Add</span>
</v-btn> </v-btn>
</router-link> </router-link>
</v-flex> </v-flex>
</v-layout> </v-layout>
<v-layout class="px-4 my-3"> <v-layout class="px-4 my-3">
<v-divider></v-divider> <v-divider></v-divider>
</v-layout> </v-layout>
<v-layout align-center justify-center wrap class="px-5 mt-3"> <v-layout align-center justify-center wrap class="px-5 mt-3">
<v-flex md12> <v-flex md12>
<v-data-table :headers="headers" :items="items" hide-actions> <v-data-table :headers="headers" :items="items" hide-actions>
<template slot="headerCell" slot-scope="{ header }"> <template slot="headerCell" slot-scope="{ header }">
<span <span
class="subheading font-weight-light text-white text--darken-3" class="subheading font-weight-light text-white text--darken-3"
v-text="header.text" v-text="header.text"
/> />
</template> </template>
<template slot="items" slot-scope="{ item }"> <template slot="items" slot-scope="{ item }">
<td class="headline font-weight-light">{{ item.name }}</td> <td class="headline font-weight-light">{{ item.name }}</td>
<td class="title font-weight-light">{{ item.unique_code }}</td> <td class="title font-weight-light">{{ item.unique_code }}</td>
<td class="title font-weight-light">{{ item.user.name }}</td> <td class="title font-weight-light">{{ item.user.name }}</td>
<td class="title font-weight-light">{{ item.created_at }}</td> <td class="title font-weight-light">{{ item.created_at }}</td>
<td class="text-xs-right"> <td class="text-xs-right">
<router-link :to="{name : 'EditTestType', params : {testType : item.id}}"> <router-link
<v-btn color="cyan" class="mr-2 WM-ActionButton"> :to="{name : 'EditTestType', params : {testType : item.id}}"
<v-icon class="white--text mr-2 caption">fas fa-pen</v-icon> >
<span>Edit</span> <v-btn color="cyan" class="mr-2 WM-ActionButton">
</v-btn> <v-icon class="white--text mr-2 caption">fas fa-pen</v-icon>
<span>Edit</span>
</v-btn>
</router-link>
<v-btn color="orange darken-1">
<v-icon class="white--text mr-1 caption">fas fa-barcode</v-icon>
<span>Generate Barcode</span>
</v-btn>
<v-btn color="black" class="mr-2" @click="remove(item.id)">
<v-icon class="white--text mr-1 caption">fas fa-folder</v-icon>
<span>Archive</span>
</v-btn>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-divider></v-divider>
<div class="text-xs-center" v-if="lastPage > 1">
<v-pagination v-model="currentPage" :length="lastPage" :total-visible="6"></v-pagination>
</div>
<v-layout row wrap align-center justify-center class="mt-3">
<router-link to="/dashboard">
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black ml-5">
<v-icon class="black--text mr-2 caption">fas fa-chevron-left</v-icon>
<span class="black--text">Back</span>
</v-btn>
</router-link> </router-link>
<v-btn color="orange darken-1"> </v-layout>
<v-icon class="white--text mr-1 caption">fas fa-barcode</v-icon> </material-card>
<span>Generate Barcode</span> </v-container>
</v-btn>
<v-btn color="pink" @click="remove(item.id)" class="WM-ActionButton">
<v-icon class="white--text mr-2 caption">fas fa-times</v-icon>
<span>Remove</span>
</v-btn>
</td>
</template>
</v-data-table>
</v-flex>
</v-layout>
<v-divider></v-divider>
<div class="text-xs-center" v-if="lastPage > 1">
<v-pagination v-model="currentPage" :length="lastPage" :total-visible="6"></v-pagination>
</div>
<v-layout row wrap align-center justify-center class="mt-3">
<router-link to="/dashboard">
<v-btn class="WM-NoShadow WM-Outline-Btn WM-Border WM-Border-Black ml-5">
<v-icon class="black--text mr-2 caption">fas fa-chevron-left</v-icon>
<span class="black--text">Back</span>
</v-btn>
</router-link>
</v-layout>
</material-card>
</v-container>
</template> </template>
<script> <script>
import { ApiService } from "@/services"; import { ApiService } from "@/services";
import { urls } from "@/config/urls"; import { urls } from "@/config/urls";
export default { export default {
data: () => ({ data: () => ({
headers: [ headers: [
{ {
sortable: false, sortable: false,
text: "TestType Name", text: "TestType Name",
value: "name" value: "name"
}, },
{ {
sortable: false, sortable: false,
text: "TestType UniqueId", text: "TestType UniqueId",
value: "uniqueId" value: "uniqueId"
}, },
{ {
sortable: false, sortable: false,
text: "Register TestType", text: "Register TestType",
value: "users" value: "users"
}, },
{ {
sortable: false, sortable: false,
text: "Date", text: "Date",
value: "date" value: "date"
}, },
{ {
sortable: false, sortable: false,
text: "Action", text: "Action",
value: "action", value: "action",
align: "right" align: "right"
} }
], ],
items: [], items: [],
currentPage: 1, currentPage: 1,
lastPage: 1 lastPage: 1
}), }),
created() { created() {
this.getData(); this.getData();
},
methods: {
async getData(page = 1) {
const result = await ApiService.get(urls.listTestType(page));
if (result && result.status == 200) {
this.items = result.data.data.data;
this.currentPage = result.data.data.current_page;
this.lastPage = result.data.data.last_page;
}
}, },
async remove(id) { methods: {
const result = await ApiService.delete(urls.deleteTestType(id)); async getData(page = 1) {
if (result.status == 200) { const result = await ApiService.get(urls.listTestType(page));
for (const key in this.items) { if (result && result.status == 200) {
if (this.items.hasOwnProperty(key) && this.items[key].id == id) { this.items = result.data.data.data;
this.items.splice(key, 1); this.currentPage = result.data.data.current_page;
} this.lastPage = result.data.data.last_page;
}
},
async remove(id) {
const result = await ApiService.delete(urls.deleteTestType(id));
if (result.status == 200) {
for (const key in this.items) {
if (
this.items.hasOwnProperty(key) &&
this.items[key].id == id
) {
this.items.splice(key, 1);
}
}
}
}
},
watch: {
currentPage(page) {
this.getData(page);
} }
}
} }
},
watch: {
currentPage(page) {
this.getData(page);
}
}
}; };
</script> </script>
<style lang="css" scoped> <style lang="css" scoped>
.WM-ActionButton { .WM-ActionButton {
padding: 8px 22px; padding: 8px 22px;
} }
</style> </style>