mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 00:02:15 +00:00
Edit client detail
This commit is contained in:
@@ -10,6 +10,7 @@ use App\Models\Oasis\Client;
|
||||
use Auth;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class ClientController extends Controller
|
||||
@@ -24,22 +25,6 @@ class ClientController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$query = remove_accents(request()->input('query'));
|
||||
|
||||
$results = Client::search($query)
|
||||
->where('user_id', request()->user()->id)
|
||||
->get();
|
||||
|
||||
return response(
|
||||
new OasisClientCollection($results), 200
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param StoreClientRequest $request
|
||||
* @return Application|ResponseFactory|Response
|
||||
@@ -67,6 +52,40 @@ class ClientController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function show(Client $client)
|
||||
{
|
||||
return response(new OasisClientResource($client), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
* @param Request $request
|
||||
* @return Application|ResponseFactory|Response
|
||||
*/
|
||||
public function update(Client $client, Request $request)
|
||||
{
|
||||
// Store image if exist
|
||||
if ($request->hasFile($request->name)) {
|
||||
|
||||
// Find and update image path
|
||||
$client->update([
|
||||
$request->name => store_avatar($request, $request->name)
|
||||
]);
|
||||
|
||||
return response('Done', 204);
|
||||
}
|
||||
|
||||
$client->update(
|
||||
make_single_input($request)
|
||||
);
|
||||
|
||||
return response('Done', 204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Client $client
|
||||
* @throws \Exception
|
||||
@@ -77,4 +96,20 @@ class ClientController extends Controller
|
||||
|
||||
return response('Done', 204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
$query = remove_accents(request()->input('query'));
|
||||
|
||||
$results = Client::search($query)
|
||||
->where('user_id', request()->user()->id)
|
||||
->get();
|
||||
|
||||
return response(
|
||||
new OasisClientCollection($results), 200
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,14 +23,24 @@ class OasisClientResource extends JsonResource
|
||||
->count();
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'avatar' => $this->avatar,
|
||||
'id' => $this->id,
|
||||
'type' => 'client',
|
||||
'created_at' => format_date($this->created_at, '%d. %B %Y'),
|
||||
|
||||
'totalNet' => format_to_currency($total_net, 'CZK'),
|
||||
'totalInvoices' => $total_invoices,
|
||||
'type' => 'client',
|
||||
'created_at' => format_date($this->created_at, '%d. %B %Y'),
|
||||
|
||||
'avatar' => $this->avatar,
|
||||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'phone_number' => $this->phone_number,
|
||||
'address' => $this->address,
|
||||
'city' => $this->city,
|
||||
'postal_code' => $this->postal_code,
|
||||
'country' => $this->country,
|
||||
'ico' => $this->ico,
|
||||
'dic' => $this->dic,
|
||||
'ic_dph' => $this->ic_dph,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
"/chunks/not-found-shared.js": "/chunks/not-found-shared.js?id=7fc7f9b6f10bdfac770e",
|
||||
"/chunks/oasis/homepage.js": "/chunks/oasis/homepage.js?id=a1885dd8814f9eb63a1c",
|
||||
"/chunks/oasis/invoices.js": "/chunks/oasis/invoices.js?id=996b95c4cd43f0a6bcc1",
|
||||
"/chunks/oasis/invoices/list.js": "/chunks/oasis/invoices/list.js?id=e8efbb60888f89b1dcce",
|
||||
"/chunks/oasis/invoices/list.js": "/chunks/oasis/invoices/list.js?id=b72362eac5928244f6fd",
|
||||
"/chunks/oasis/invoices~chunks/oasis/invoices/list.js": "/chunks/oasis/invoices~chunks/oasis/invoices/list.js?id=045d3dd7ce573cb7ed11",
|
||||
"/chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared.js": "/chunks/oasis/invoices~chunks/oasis/invoices/list~chunks/platform~chunks/shared.js?id=c69c0503d09d1588f14a",
|
||||
"/chunks/oasis/platba.js": "/chunks/oasis/platba.js?id=53d9f2a31b1dd5dad85e",
|
||||
@@ -222,13 +222,13 @@
|
||||
"/chunks/oasis/invoices/list.955894bd2a0bb875dd19.hot-update.js": "/chunks/oasis/invoices/list.955894bd2a0bb875dd19.hot-update.js",
|
||||
"/js/main.56333ed0db26ca1f2dde.hot-update.js": "/js/main.56333ed0db26ca1f2dde.hot-update.js",
|
||||
"/chunks/admin-account.56333ed0db26ca1f2dde.hot-update.js": "/chunks/admin-account.56333ed0db26ca1f2dde.hot-update.js",
|
||||
"/chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chu~5bfd6db3.js": "/chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chu~5bfd6db3.js?id=19b20a4938f0bf4f98d6",
|
||||
"/chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chu~5bfd6db3.js": "/chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chu~5bfd6db3.js?id=21d5ff15e29262580ef1",
|
||||
"/chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/~a5040fe9.js": "/chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/~a5040fe9.js?id=13deb1daf20871fd71da",
|
||||
"/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~212dfde3.js": "/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~212dfde3.js?id=73a7cafebe77c9df5c17",
|
||||
"/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~8cc7d96f.56333ed0db26ca1f2dde.hot-update.js": "/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~8cc7d96f.56333ed0db26ca1f2dde.hot-update.js",
|
||||
"/chunks/app-language~chunks/app-settings~chunks/dashboard~chunks/dashboard-oasis~chunks/invoices~chun~fab98574.js": "/chunks/app-language~chunks/app-settings~chunks/dashboard~chunks/dashboard-oasis~chunks/invoices~chun~fab98574.js?id=f019c9e6df2021c93987",
|
||||
"/chunks/app-setup.56333ed0db26ca1f2dde.hot-update.js": "/chunks/app-setup.56333ed0db26ca1f2dde.hot-update.js",
|
||||
"/chunks/oasis/invoices/create-client.js": "/chunks/oasis/invoices/create-client.js?id=db5be54f7b11b4ad0b3f",
|
||||
"/chunks/oasis/invoices/create-client.js": "/chunks/oasis/invoices/create-client.js?id=f3104be79b261a8ec401",
|
||||
"/chunks/oasis/invoices/profile.56333ed0db26ca1f2dde.hot-update.js": "/chunks/oasis/invoices/profile.56333ed0db26ca1f2dde.hot-update.js",
|
||||
"/chunks/oasis/user-create.56333ed0db26ca1f2dde.hot-update.js": "/chunks/oasis/user-create.56333ed0db26ca1f2dde.hot-update.js",
|
||||
"/chunks/plan-create.56333ed0db26ca1f2dde.hot-update.js": "/chunks/plan-create.56333ed0db26ca1f2dde.hot-update.js",
|
||||
@@ -328,5 +328,94 @@
|
||||
"/chunks/oasis/invoices/create-client.63ac5e8ce5d3cb59961f.hot-update.js": "/chunks/oasis/invoices/create-client.63ac5e8ce5d3cb59961f.hot-update.js",
|
||||
"/chunks/oasis/invoices/create-client.7a66a9e25b9dfa1880e9.hot-update.js": "/chunks/oasis/invoices/create-client.7a66a9e25b9dfa1880e9.hot-update.js",
|
||||
"/js/main.4a0cdb8bb0cf50cabab3.hot-update.js": "/js/main.4a0cdb8bb0cf50cabab3.hot-update.js",
|
||||
"/chunks/oasis/invoices.47850c1ead416753b077.hot-update.js": "/chunks/oasis/invoices.47850c1ead416753b077.hot-update.js"
|
||||
"/chunks/oasis/invoices.47850c1ead416753b077.hot-update.js": "/chunks/oasis/invoices.47850c1ead416753b077.hot-update.js",
|
||||
"/js/main.42ec3a867d00e9f3e666.hot-update.js": "/js/main.42ec3a867d00e9f3e666.hot-update.js",
|
||||
"/chunks/oasis/invoices/create-client.42ec3a867d00e9f3e666.hot-update.js": "/chunks/oasis/invoices/create-client.42ec3a867d00e9f3e666.hot-update.js",
|
||||
"/chunks/oasis/invoices/profile.42ec3a867d00e9f3e666.hot-update.js": "/chunks/oasis/invoices/profile.42ec3a867d00e9f3e666.hot-update.js",
|
||||
"/chunks/plan-delete.42ec3a867d00e9f3e666.hot-update.js": "/chunks/plan-delete.42ec3a867d00e9f3e666.hot-update.js",
|
||||
"/chunks/plan-settings.42ec3a867d00e9f3e666.hot-update.js": "/chunks/plan-settings.42ec3a867d00e9f3e666.hot-update.js",
|
||||
"/chunks/profile.42ec3a867d00e9f3e666.hot-update.js": "/chunks/profile.42ec3a867d00e9f3e666.hot-update.js",
|
||||
"/chunks/settings-password.42ec3a867d00e9f3e666.hot-update.js": "/chunks/settings-password.42ec3a867d00e9f3e666.hot-update.js",
|
||||
"/chunks/user-delete.42ec3a867d00e9f3e666.hot-update.js": "/chunks/user-delete.42ec3a867d00e9f3e666.hot-update.js",
|
||||
"/chunks/user-detail.42ec3a867d00e9f3e666.hot-update.js": "/chunks/user-detail.42ec3a867d00e9f3e666.hot-update.js",
|
||||
"/chunks/user-password.42ec3a867d00e9f3e666.hot-update.js": "/chunks/user-password.42ec3a867d00e9f3e666.hot-update.js",
|
||||
"/chunks/user-storage.42ec3a867d00e9f3e666.hot-update.js": "/chunks/user-storage.42ec3a867d00e9f3e666.hot-update.js",
|
||||
"/js/main.be37bfaf3b71d470f8e6.hot-update.js": "/js/main.be37bfaf3b71d470f8e6.hot-update.js",
|
||||
"/chunks/admin-account.be37bfaf3b71d470f8e6.hot-update.js": "/chunks/admin-account.be37bfaf3b71d470f8e6.hot-update.js",
|
||||
"/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~8cc7d96f.be37bfaf3b71d470f8e6.hot-update.js": "/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~8cc7d96f.be37bfaf3b71d470f8e6.hot-update.js",
|
||||
"/chunks/app-setup.be37bfaf3b71d470f8e6.hot-update.js": "/chunks/app-setup.be37bfaf3b71d470f8e6.hot-update.js",
|
||||
"/chunks/oasis/invoices/create-client.be37bfaf3b71d470f8e6.hot-update.js": "/chunks/oasis/invoices/create-client.be37bfaf3b71d470f8e6.hot-update.js",
|
||||
"/chunks/oasis/user-create.be37bfaf3b71d470f8e6.hot-update.js": "/chunks/oasis/user-create.be37bfaf3b71d470f8e6.hot-update.js",
|
||||
"/chunks/plan-create.be37bfaf3b71d470f8e6.hot-update.js": "/chunks/plan-create.be37bfaf3b71d470f8e6.hot-update.js",
|
||||
"/chunks/user-create.be37bfaf3b71d470f8e6.hot-update.js": "/chunks/user-create.be37bfaf3b71d470f8e6.hot-update.js",
|
||||
"/js/main.2a5b52cd5a8d1d56d0d8.hot-update.js": "/js/main.2a5b52cd5a8d1d56d0d8.hot-update.js",
|
||||
"/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~dea0c278.js": "/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~dea0c278.js?id=a81252d0e451803fdcef",
|
||||
"/chunks/app-language~chunks/app-settings~chunks/dashboard~chunks/dashboard-oasis~chunks/invoices~chun~e9fdda75.js": "/chunks/app-language~chunks/app-settings~chunks/dashboard~chunks/dashboard-oasis~chunks/invoices~chun~e9fdda75.js?id=62ce022b3544cd69a5bd",
|
||||
"/chunks/oasis/invoices/client.js": "/chunks/oasis/invoices/client.js?id=6cfca92e372179ebf697",
|
||||
"/chunks/oasis/invoices/client.c97bd30d932ea2b47e55.hot-update.js": "/chunks/oasis/invoices/client.c97bd30d932ea2b47e55.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.5ee30b20f1f55c124785.hot-update.js": "/chunks/oasis/invoices/client.5ee30b20f1f55c124785.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.773c1b1645b07a8396a3.hot-update.js": "/chunks/oasis/invoices/client.773c1b1645b07a8396a3.hot-update.js",
|
||||
"/chunks/oasis/invoices/list.12289310f563730e2821.hot-update.js": "/chunks/oasis/invoices/list.12289310f563730e2821.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.50c78f9932d0a71a702d.hot-update.js": "/chunks/oasis/invoices/client.50c78f9932d0a71a702d.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.c2d4678fb070b7b63920.hot-update.js": "/chunks/oasis/invoices/client.c2d4678fb070b7b63920.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.8961e18c2c84c5541477.hot-update.js": "/chunks/oasis/invoices/client.8961e18c2c84c5541477.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.08b1431761c7937276e5.hot-update.js": "/chunks/oasis/invoices/client.08b1431761c7937276e5.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.01b3ef7febfd5a282604.hot-update.js": "/chunks/oasis/invoices/client.01b3ef7febfd5a282604.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.c5b88e60ae60b1a161a7.hot-update.js": "/chunks/oasis/invoices/client.c5b88e60ae60b1a161a7.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.a5b77d1a59a7325d2dde.hot-update.js": "/chunks/oasis/invoices/client.a5b77d1a59a7325d2dde.hot-update.js",
|
||||
"/js/main.04443d70effae57affda.hot-update.js": "/js/main.04443d70effae57affda.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.04443d70effae57affda.hot-update.js": "/chunks/oasis/invoices/client.04443d70effae57affda.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.147f936ea12d4b10d152.hot-update.js": "/chunks/oasis/invoices/client.147f936ea12d4b10d152.hot-update.js",
|
||||
"/js/main.25bba30a1f5fedab17ba.hot-update.js": "/js/main.25bba30a1f5fedab17ba.hot-update.js",
|
||||
"/js/main.325efc07b9e6afd90e4a.hot-update.js": "/js/main.325efc07b9e6afd90e4a.hot-update.js",
|
||||
"/chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chu~5bfd6db3.325efc07b9e6afd90e4a.hot-update.js": "/chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chu~5bfd6db3.325efc07b9e6afd90e4a.hot-update.js",
|
||||
"/chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/~b2b17caf.js": "/chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/~b2b17caf.js?id=1494622a41b03970582d",
|
||||
"/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~2e0b85bd.js": "/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~2e0b85bd.js?id=d4fb46f05374a298ac1b",
|
||||
"/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~656c73cf.js": "/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~656c73cf.js?id=b5367092d1c1415c1722",
|
||||
"/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~c329baf3.js": "/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~c329baf3.js?id=917423b1c6ec5a0c7435",
|
||||
"/chunks/oasis/invoices/client-detail.js": "/chunks/oasis/invoices/client-detail.js?id=36e25777f8a5acaecb41",
|
||||
"/chunks/oasis/invoices/create-client.325efc07b9e6afd90e4a.hot-update.js": "/chunks/oasis/invoices/create-client.325efc07b9e6afd90e4a.hot-update.js",
|
||||
"/chunks/oasis/invoices/create-client~chunks/oasis/invoices/profile~chunks/profile~chunks/settings-password.js": "/chunks/oasis/invoices/create-client~chunks/oasis/invoices/profile~chunks/profile~chunks/settings-password.js?id=7fcd6de960c52c5d0c5c",
|
||||
"/chunks/oasis/invoices/list.325efc07b9e6afd90e4a.hot-update.js": "/chunks/oasis/invoices/list.325efc07b9e6afd90e4a.hot-update.js",
|
||||
"/chunks/oasis/invoices/profile.325efc07b9e6afd90e4a.hot-update.js": "/chunks/oasis/invoices/profile.325efc07b9e6afd90e4a.hot-update.js",
|
||||
"/chunks/plan-delete.325efc07b9e6afd90e4a.hot-update.js": "/chunks/plan-delete.325efc07b9e6afd90e4a.hot-update.js",
|
||||
"/chunks/plan-settings.325efc07b9e6afd90e4a.hot-update.js": "/chunks/plan-settings.325efc07b9e6afd90e4a.hot-update.js",
|
||||
"/chunks/profile.325efc07b9e6afd90e4a.hot-update.js": "/chunks/profile.325efc07b9e6afd90e4a.hot-update.js",
|
||||
"/chunks/settings-password.325efc07b9e6afd90e4a.hot-update.js": "/chunks/settings-password.325efc07b9e6afd90e4a.hot-update.js",
|
||||
"/chunks/user-delete.325efc07b9e6afd90e4a.hot-update.js": "/chunks/user-delete.325efc07b9e6afd90e4a.hot-update.js",
|
||||
"/chunks/user-detail.325efc07b9e6afd90e4a.hot-update.js": "/chunks/user-detail.325efc07b9e6afd90e4a.hot-update.js",
|
||||
"/chunks/user-password.325efc07b9e6afd90e4a.hot-update.js": "/chunks/user-password.325efc07b9e6afd90e4a.hot-update.js",
|
||||
"/chunks/user-storage.325efc07b9e6afd90e4a.hot-update.js": "/chunks/user-storage.325efc07b9e6afd90e4a.hot-update.js",
|
||||
"/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~031a0bf8.js": "/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~031a0bf8.js?id=e5355666d39ae3c90ece",
|
||||
"/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~6b50d93b.js": "/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~6b50d93b.js?id=bcb779faea92dfb55517",
|
||||
"/js/main.be209cf85c1264188ee0.hot-update.js": "/js/main.be209cf85c1264188ee0.hot-update.js",
|
||||
"/chunks/admin-account.be209cf85c1264188ee0.hot-update.js": "/chunks/admin-account.be209cf85c1264188ee0.hot-update.js",
|
||||
"/chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chu~30c3eb1b.js": "/chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chu~30c3eb1b.js?id=45447ae3309aeb11f4ec",
|
||||
"/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~2e0b85bd.be209cf85c1264188ee0.hot-update.js": "/chunks/app-appearance~chunks/app-billings~chunks/app-email~chunks/app-index~chunks/app-others~chunks~2e0b85bd.be209cf85c1264188ee0.hot-update.js",
|
||||
"/chunks/app-setup.be209cf85c1264188ee0.hot-update.js": "/chunks/app-setup.be209cf85c1264188ee0.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.be209cf85c1264188ee0.hot-update.js": "/chunks/oasis/invoices/client-detail.be209cf85c1264188ee0.hot-update.js",
|
||||
"/chunks/oasis/user-create.be209cf85c1264188ee0.hot-update.js": "/chunks/oasis/user-create.be209cf85c1264188ee0.hot-update.js",
|
||||
"/chunks/plan-create.be209cf85c1264188ee0.hot-update.js": "/chunks/plan-create.be209cf85c1264188ee0.hot-update.js",
|
||||
"/chunks/user-create.be209cf85c1264188ee0.hot-update.js": "/chunks/user-create.be209cf85c1264188ee0.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.9938a91f3128e06175c1.hot-update.js": "/chunks/oasis/invoices/client-detail.9938a91f3128e06175c1.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.26f741eb3a8c353a7e2a.hot-update.js": "/chunks/oasis/invoices/client.26f741eb3a8c353a7e2a.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.26f741eb3a8c353a7e2a.hot-update.js": "/chunks/oasis/invoices/client-detail.26f741eb3a8c353a7e2a.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.0309cd635ee28233ace0.hot-update.js": "/chunks/oasis/invoices/client-detail.0309cd635ee28233ace0.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.a793a30b9f53c5f6ed21.hot-update.js": "/chunks/oasis/invoices/client-detail.a793a30b9f53c5f6ed21.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.a4fc3abd93908c3376bb.hot-update.js": "/chunks/oasis/invoices/client-detail.a4fc3abd93908c3376bb.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.694994f6fa43ef8990b7.hot-update.js": "/chunks/oasis/invoices/client-detail.694994f6fa43ef8990b7.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.0fa67a122fc811dd5d42.hot-update.js": "/chunks/oasis/invoices/client.0fa67a122fc811dd5d42.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.f1274a489902409aa6a5.hot-update.js": "/chunks/oasis/invoices/client.f1274a489902409aa6a5.hot-update.js",
|
||||
"/chunks/oasis/invoices/client.f8c5884e302304fddbfa.hot-update.js": "/chunks/oasis/invoices/client.f8c5884e302304fddbfa.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.0465958d4fcfc308f14c.hot-update.js": "/chunks/oasis/invoices/client-detail.0465958d4fcfc308f14c.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.d7d83382f41c3e1cbcef.hot-update.js": "/chunks/oasis/invoices/client-detail.d7d83382f41c3e1cbcef.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.07ed98aa8bf48d3461c1.hot-update.js": "/chunks/oasis/invoices/client-detail.07ed98aa8bf48d3461c1.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.e0a1776be9d98d442c69.hot-update.js": "/chunks/oasis/invoices/client-detail.e0a1776be9d98d442c69.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.b25ebcdb10139a5337fb.hot-update.js": "/chunks/oasis/invoices/client-detail.b25ebcdb10139a5337fb.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.e89cc81da438391a9a1b.hot-update.js": "/chunks/oasis/invoices/client-detail.e89cc81da438391a9a1b.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.074bfe84e4cefd964bac.hot-update.js": "/chunks/oasis/invoices/client-detail.074bfe84e4cefd964bac.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.c350c71f1522f9270a28.hot-update.js": "/chunks/oasis/invoices/client-detail.c350c71f1522f9270a28.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.c2e95634b2714e59ac83.hot-update.js": "/chunks/oasis/invoices/client-detail.c2e95634b2714e59ac83.hot-update.js",
|
||||
"/chunks/oasis/invoices/client-detail.3590afdbba0a7343190f.hot-update.js": "/chunks/oasis/invoices/client-detail.3590afdbba0a7343190f.hot-update.js",
|
||||
"/chunks/oasis/invoices/list.76adce30ace314ca7046.hot-update.js": "/chunks/oasis/invoices/list.76adce30ace314ca7046.hot-update.js"
|
||||
}
|
||||
|
||||
162
resources/js/Oasis/Invoices/Clients/Client.vue
Normal file
162
resources/js/Oasis/Invoices/Clients/Client.vue
Normal file
@@ -0,0 +1,162 @@
|
||||
<template>
|
||||
<div id="single-page">
|
||||
<div id="page-content" v-if="! isLoading">
|
||||
<MobileHeader :title="$router.currentRoute.meta.title" />
|
||||
<PageHeader :can-back="true" :title="$router.currentRoute.meta.title" />
|
||||
<div class="content-page">
|
||||
|
||||
<!--Client thumbnail-->
|
||||
<div class="user-thumbnail">
|
||||
<div class="avatar">
|
||||
<img :src="client.avatar" :alt="client.name">
|
||||
</div>
|
||||
<div class="info">
|
||||
<b class="name">{{ client.name }}</b>
|
||||
<span class="email">{{ client.email }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--Page Tab links-->
|
||||
<div class="menu-list-wrapper horizontal">
|
||||
<router-link replace :to="{name: 'ClientDetail'}" class="menu-list-item link border-bottom-theme">
|
||||
<div class="icon text-theme">
|
||||
<user-icon size="17" />
|
||||
</div>
|
||||
<div class="label text-theme">
|
||||
{{ $t('admin_page_user.tabs.detail') }}
|
||||
</div>
|
||||
</router-link>
|
||||
|
||||
<router-link replace :to="{name: 'UserInvoices'}" class="menu-list-item link border-bottom-theme">
|
||||
<div class="icon text-theme">
|
||||
<file-text-icon size="17" />
|
||||
</div>
|
||||
<div class="label text-theme">
|
||||
{{ $t('admin_page_user.tabs.invoices') }}
|
||||
</div>
|
||||
</router-link>
|
||||
|
||||
<router-link replace :to="{name: 'UserDelete'}" class="menu-list-item link border-bottom-theme">
|
||||
<div class="icon text-theme">
|
||||
<trash2-icon size="17" />
|
||||
</div>
|
||||
<div class="label text-theme">
|
||||
Delete Client
|
||||
</div>
|
||||
</router-link>
|
||||
</div>
|
||||
|
||||
<!--Router Content-->
|
||||
<router-view :client="client" @reload-user="fetchUser" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="loader" v-if="isLoading">
|
||||
<Spinner />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {UserIcon, Trash2Icon, FileTextIcon} from 'vue-feather-icons'
|
||||
import MobileHeader from '@/components/Mobile/MobileHeader'
|
||||
import SectionTitle from '@/components/Others/SectionTitle'
|
||||
import PageHeader from '@/components/Others/PageHeader'
|
||||
import Spinner from '@/components/FilesView/Spinner'
|
||||
import axios from 'axios'
|
||||
|
||||
export default {
|
||||
name: 'Client',
|
||||
components: {
|
||||
SectionTitle,
|
||||
FileTextIcon,
|
||||
MobileHeader,
|
||||
PageHeader,
|
||||
Trash2Icon,
|
||||
UserIcon,
|
||||
Spinner,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: true,
|
||||
client: undefined,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchUser() {
|
||||
axios.get(`/api/oasis/clients/${this.$route.params.id}`)
|
||||
.then(response => {
|
||||
this.client = response.data
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.fetchUser()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@assets/vuefilemanager/_variables';
|
||||
@import '@assets/vuefilemanager/_mixins';
|
||||
|
||||
.user-thumbnail {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
padding-bottom: 10px;
|
||||
padding-top: 15px;
|
||||
|
||||
.avatar {
|
||||
margin-right: 20px;
|
||||
position: relative;
|
||||
|
||||
img {
|
||||
line-height: 0;
|
||||
width: 62px;
|
||||
height: 62px;
|
||||
border-radius: 12px;
|
||||
z-index: 1;
|
||||
position: relative;
|
||||
|
||||
&.blurred {
|
||||
@include blurred-image;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
|
||||
.name {
|
||||
display: block;
|
||||
@include font-size(17);
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.email {
|
||||
color: $text-muted;
|
||||
@include font-size(14);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 960px) {
|
||||
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.user-thumbnail {
|
||||
|
||||
.info {
|
||||
|
||||
.email {
|
||||
color: $dark_mode_text_secondary;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
152
resources/js/Oasis/Invoices/Clients/Tabs/ClientDetail.vue
Normal file
152
resources/js/Oasis/Invoices/Clients/Tabs/ClientDetail.vue
Normal file
@@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<PageTab class="form-fixed-width">
|
||||
<PageTabGroup class="form block-form">
|
||||
<FormLabel>Company & Logo</FormLabel>
|
||||
<div class="block-wrapper">
|
||||
<label>Logo (optional):</label>
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="avatar" v-slot="{ errors }">
|
||||
<ImageInput @input="$updateImage(`/oasis/clients/${client.id}`, 'avatar', client.avatar)" v-model="client.avatar" :image="client.avatar" :error="errors[0]" />
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
<div class="block-wrapper">
|
||||
<label>Company name:</label>
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="name" rules="required" v-slot="{ errors }">
|
||||
<input @input="$updateText(`/oasis/clients/${client.id}`, 'name', client.name)" v-model="client.name" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
</PageTabGroup>
|
||||
<PageTabGroup class="form block-form">
|
||||
<FormLabel>Company Details</FormLabel>
|
||||
<div class="block-wrapper">
|
||||
<label>ICO:</label>
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="ico" rules="required" v-slot="{ errors }">
|
||||
<input @input="$updateText(`/oasis/clients/${client.id}`, 'ico', client.ico)" v-model="client.ico" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
<div class="block-wrapper">
|
||||
<label>DIC (optional):</label>
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="dic" v-slot="{ errors }">
|
||||
<input @input="$updateText(`/oasis/clients/${client.id}`, 'dic', client.dic)" v-model="client.dic" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
<div class="block-wrapper">
|
||||
<label>IC DPH (optional):</label>
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="ic_dph" v-slot="{ errors }">
|
||||
<input @input="$updateText(`/oasis/clients/${client.id}`, 'ic_dph', client.ic_dph)" v-model="client.ic_dph" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
</PageTabGroup>
|
||||
<PageTabGroup class="form block-form">
|
||||
<FormLabel>Company Address</FormLabel>
|
||||
<div class="block-wrapper">
|
||||
<label>Address:</label>
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="address" rules="required" v-slot="{ errors }">
|
||||
<input @input="$updateText(`/oasis/clients/${client.id}`, 'address', client.address)" v-model="client.address" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
<div class="block-wrapper">
|
||||
<label>City:</label>
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="city" rules="required" v-slot="{ errors }">
|
||||
<input @input="$updateText(`/oasis/clients/${client.id}`, 'city', client.city)" v-model="client.city" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
<div class="block-wrapper">
|
||||
<label>Postal Code:</label>
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="postal_code" rules="required" v-slot="{ errors }">
|
||||
<input @input="$updateText(`/oasis/clients/${client.id}`, 'postal_code', client.postal_code)" v-model="client.postal_code" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
<div class="block-wrapper">
|
||||
<label>Country:</label>
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="country" rules="required" v-slot="{ errors }">
|
||||
<SelectInput @input="$updateText(`/oasis/clients/${client.id}`, 'country', client.country)" v-model="client.country" :default="client.country" :options="countries" placeholder="" :isError="errors[0]" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
</PageTabGroup>
|
||||
<PageTabGroup class="form block-form">
|
||||
<FormLabel>Contact Informations</FormLabel>
|
||||
<div class="block-wrapper">
|
||||
<label>Phone (optional):</label>
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="phone_number" v-slot="{ errors }">
|
||||
<input @input="$updateText(`/oasis/clients/${client.id}`, 'phone_number', client.phone_number)" v-model="client.phone_number" placeholder="" type="text" :class="{'is-error': errors[0]}" class="focus-border-theme" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
<div class="block-wrapper">
|
||||
<label>Email (optional):</label>
|
||||
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="email" v-slot="{ errors }">
|
||||
<input @input="$updateText(`/oasis/clients/${client.id}`, 'email', client.email)" v-model="client.email" placeholder="" type="email" :class="{'is-error': errors[0]}" class="focus-border-theme" />
|
||||
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
|
||||
</ValidationProvider>
|
||||
</div>
|
||||
</PageTabGroup>
|
||||
</PageTab>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ImageInput from '@/components/Others/Forms/ImageInput'
|
||||
import InfoBox from '@/components/Others/Forms/InfoBox'
|
||||
import PageTabGroup from '@/components/Others/Layout/PageTabGroup'
|
||||
import PageTab from '@/components/Others/Layout/PageTab'
|
||||
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
|
||||
import StorageItemDetail from '@/components/Others/StorageItemDetail'
|
||||
import SelectInput from '@/components/Others/Forms/SelectInput'
|
||||
import FormLabel from '@/components/Others/Forms/FormLabel'
|
||||
import ButtonBase from '@/components/FilesView/ButtonBase'
|
||||
import SetupBox from '@/components/Others/Forms/SetupBox'
|
||||
import {required} from 'vee-validate/dist/rules'
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: 'UserDetail',
|
||||
props: [
|
||||
'client'
|
||||
],
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'countries'
|
||||
]),
|
||||
},
|
||||
components: {
|
||||
ImageInput,
|
||||
PageTabGroup,
|
||||
PageTab,
|
||||
InfoBox,
|
||||
FormLabel,
|
||||
ValidationProvider,
|
||||
ValidationObserver,
|
||||
StorageItemDetail,
|
||||
SelectInput,
|
||||
ButtonBase,
|
||||
SetupBox,
|
||||
required,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLoading: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@assets/vuefilemanager/_variables';
|
||||
@import '@assets/vuefilemanager/_mixins';
|
||||
@import '@assets/vuefilemanager/_forms';
|
||||
|
||||
.block-form {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="file-wrapper" @mouseup.stop="clickedItem" @dblclick="showInvoice">
|
||||
<div class="file-wrapper" @mouseup.stop="clickedItem" @dblclick="showClient">
|
||||
<div class="file-item" :class="{'is-clicked': isClicked , 'no-clicked': !isClicked && $isMobile()}">
|
||||
|
||||
<!-- MultiSelecting for the mobile version -->
|
||||
@@ -135,8 +135,8 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
showInvoice() {
|
||||
events.$emit('file-preview:show')
|
||||
showClient() {
|
||||
this.$router.push({name: 'ClientDetail', params: {id: this.item.id}})
|
||||
},
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<OptionGroup class="menu-option-group">
|
||||
<Option @click.native="" title="Edit Invoice" icon="rename" />
|
||||
<Option @click.native="" title="Send Invoice" icon="send" />
|
||||
<Option @click.native="" title="Go to Company" icon="user" />
|
||||
<Option @click.native="goToCompany" title="Go to Company" icon="user" />
|
||||
<Option @click.native="deleteItem" :title="$t('context_menu.delete')" icon="trash" />
|
||||
</OptionGroup>
|
||||
|
||||
@@ -74,6 +74,9 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goToCompany() {
|
||||
this.$router.push({name: 'ClientDetail', params: {id: this.item.id}})
|
||||
},
|
||||
downloadItem() {
|
||||
if (this.clipboard.length > 1)
|
||||
this.$store.dispatch('downloadFiles')
|
||||
|
||||
24
resources/js/router.js
vendored
24
resources/js/router.js
vendored
@@ -106,11 +106,33 @@ const routesOasis = [
|
||||
name: 'CreateClient',
|
||||
path: '/invoice/create-client',
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "chunks/oasis/invoices/create-client" */ './Oasis/Invoices/CreateClient'),
|
||||
import(/* webpackChunkName: "chunks/oasis/invoices/create-client" */ './Oasis/Invoices/Clients/CreateClient'),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
title: 'Create Client'
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'Client',
|
||||
path: '/invoice/client/:id',
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "chunks/oasis/invoices/client" */ './Oasis/Invoices/Clients/Client'),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
title: 'Client'
|
||||
},
|
||||
children: [
|
||||
{
|
||||
name: 'ClientDetail',
|
||||
path: '/invoice/client/:id/detail',
|
||||
component: () =>
|
||||
import(/* webpackChunkName: "chunks/oasis/invoices/client-detail" */ './Oasis/Invoices/Clients/Tabs/ClientDetail'),
|
||||
meta: {
|
||||
requiresAuth: true,
|
||||
title: 'Client Detail'
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -42,8 +42,11 @@ Route::group(['middleware' => 'api', 'prefix' => '/api/oasis'], function () {
|
||||
Route::get('/', [ClientController::class, 'index']);
|
||||
Route::get('/search', [ClientController::class, 'search']);
|
||||
|
||||
Route::post('/', [ClientController::class, 'store']);
|
||||
Route::get('/{client}', [ClientController::class, 'show']);
|
||||
Route::patch('/{client}', [ClientController::class, 'update']);
|
||||
Route::delete('/{client}', [ClientController::class, 'destroy']);
|
||||
|
||||
Route::post('/', [ClientController::class, 'store']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Tests\Feature\Oasis;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use App\Models\Oasis\Client;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
@@ -31,7 +30,7 @@ class OasisClientTest extends TestCase
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function user_create_new_client_with_avatar()
|
||||
public function it_create_new_client_with_avatar()
|
||||
{
|
||||
Storage::fake('local');
|
||||
|
||||
@@ -44,20 +43,20 @@ class OasisClientTest extends TestCase
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->postJson('/api/oasis/clients', [
|
||||
'avatar' => $avatar,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
'avatar' => $avatar,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
|
||||
'email' => 'howdy@hi5ve.digital',
|
||||
'phone_number' => '+421 950 123 456',
|
||||
|
||||
'address' => 'Does 12',
|
||||
'city' => 'Bratislava',
|
||||
'postal_code' => '076 54',
|
||||
'country' => 'SK',
|
||||
'address' => 'Does 12',
|
||||
'city' => 'Bratislava',
|
||||
'postal_code' => '076 54',
|
||||
'country' => 'SK',
|
||||
|
||||
'ico' => '11111111',
|
||||
'dic' => '11111111',
|
||||
'ic_dph' => 'SK11111111',
|
||||
'ico' => '11111111',
|
||||
'dic' => '11111111',
|
||||
'ic_dph' => 'SK11111111',
|
||||
])->assertStatus(201);
|
||||
|
||||
$this->assertDatabaseHas('clients', [
|
||||
@@ -75,7 +74,7 @@ class OasisClientTest extends TestCase
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function user_create_new_client_without_avatar_and_contact_info()
|
||||
public function it_create_new_client_without_avatar_and_contact_info()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
@@ -105,7 +104,62 @@ class OasisClientTest extends TestCase
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function user_delete_client()
|
||||
public function it_update_client_info()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$client = Client::factory(Client::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$this->patchJson("/api/oasis/clients/$client->id", [
|
||||
'name' => 'name',
|
||||
'value' => 'VueFileManager Inc.',
|
||||
])->assertStatus(204);
|
||||
|
||||
$this->assertDatabaseHas('clients', [
|
||||
'user_id' => $user->id,
|
||||
'name' => 'VueFileManager Inc.',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_update_client_avatar()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$client = Client::factory(Client::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$avatar = UploadedFile::fake()
|
||||
->image('fake-image.jpg');
|
||||
|
||||
$this->patchJson("/api/oasis/clients/$client->id", [
|
||||
'name' => 'avatar',
|
||||
'avatar' => $avatar,
|
||||
])->assertStatus(204);
|
||||
|
||||
$this->assertDatabaseMissing('clients', [
|
||||
'user_id' => $user->id,
|
||||
'avatar' => null,
|
||||
]);
|
||||
|
||||
Storage::disk('local')->assertExists(
|
||||
Client::first()->getRawOriginal('avatar')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_delete_client()
|
||||
{
|
||||
Storage::fake('local');
|
||||
|
||||
@@ -139,7 +193,7 @@ class OasisClientTest extends TestCase
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_get_all_clients()
|
||||
public function it_get_single_client()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
@@ -151,12 +205,32 @@ class OasisClientTest extends TestCase
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
|
||||
$this->getJson('/api/oasis/clients')
|
||||
$this->getJson("/api/oasis/clients/$client->id")
|
||||
->assertJsonFragment([
|
||||
'id' => $client->id,
|
||||
])->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_get_all_clients()
|
||||
{
|
||||
$user = User::factory(User::class)
|
||||
->create(['role' => 'user']);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
Client::factory(Client::class)
|
||||
->count(2)
|
||||
->create([
|
||||
'user_id' => $user->id,
|
||||
]);
|
||||
|
||||
$this->getJson('/api/oasis/clients')
|
||||
->assertStatus(200);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user