Skip to content

Commit 84fa729

Browse files
author
Luiz Neto
committed
calendario cliente
1 parent c3fd323 commit 84fa729

File tree

11 files changed

+161
-19
lines changed

11 files changed

+161
-19
lines changed

app/Conversations/AtendimentoConversation.php

+1-10
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,13 @@
99

1010
class AtendimentoConversation extends Conversation
1111
{
12-
use GeraPergunta;
13-
protected $service;
14-
protected $horarioService;
1512
public $user;
16-
public $data;
17-
public $hora;
18-
public function __construct(PsicologoService $service, $user)
13+
public function __construct($user)
1914
{
2015
$this->user = $user;
21-
$this->service = $service;
22-
23-
2416

2517
}
2618

27-
2819
public function run()
2920
{
3021

app/Conversations/Boasvindas.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ public function pegaResposta($valido = null){
3333
if($this->campo == null){
3434
$this->ask('Para completar o seu cadastro precisammos que informe um Email',function(Answer $resposta){
3535
$validator = Validator::make(['email' => $resposta->getText()], [
36-
'email' => 'required|unique:clientes,email|unique:psicologos,email|email',
37-
36+
'email' => 'required|unique:clientes,email|email',
3837
]);
3938

4039
if($validator->fails()){
@@ -46,14 +45,15 @@ public function pegaResposta($valido = null){
4645
$user = $this->getBot()->getUser();
4746
$cliente = Cliente::create([
4847
'nome' => $this->respostas[0]['resposta'],
49-
'email' => $this->email,
48+
'email' => $email,
5049
'telefone' => $user->getId(),
5150
'whatsapp' => true,
5251
'motivo' => $resposta->getText(),
52+
'password' => $user->getId().'#'.$email
5353
]);
5454
GeraAtendimento::dispatch($this->respostas,$cliente->id);
5555
$this->say('Suas informações foram cadastradas com sucesso!');
56-
return $this->bot->startConversation(new AtendimentoConversation($cliente));
56+
$this->bot->startConversation(new AtendimentoConversation($cliente));
5757
});
5858

5959
});

app/Conversations/ExampleConversation.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function askEmail()
4444
{
4545
$this->ask('Qual seu email pra te identificar nos nossos arquivos?', function(Answer $answer) {
4646
$validator = Validator::make(['email' => $answer->getText()], [
47-
'email' => 'required|email',
47+
'email' => 'required|email|exists:clientes,email',
4848
]);
4949

5050
if($validator->fails()){
@@ -81,7 +81,7 @@ public function mostrarOpcoes(){
8181

8282
switch(intval($opcao)){
8383
case 1:
84-
$this->bot->startConversation(new AtendimentoConversation(resolve('App\Services\Psicologo\PsicologoService'),$this->user));
84+
$this->bot->startConversation(new AtendimentoConversation($this->user));
8585

8686
break;
8787
case 2:

app/Http/Controllers/PacienteController.php

+5
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,9 @@ public function index($code)
2222
}
2323
return response('Link Inválido', 403);
2424
}
25+
26+
public function chat()
27+
{
28+
return view('chat');
29+
}
2530
}

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"ext-bcmath": "*",
1515
"ext-json": "*",
1616
"botman/botman": "2.0.x-dev",
17+
"botman/driver-google-assistant": "dev-master",
1718
"botman/driver-telegram": "^1.6",
1819
"botman/driver-web": "~1.0",
1920
"botman/studio-addons": "dev-master",

composer.lock

+64-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/views/chat.blade.php

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
@extends('layouts.app')
2+
@section('title','Assitente')
3+
@include('partials.botman')
4+
@php
5+
$month = now()->monthName;
6+
$days = \Carbon\CarbonPeriod::create(now()->firstOfMonth(),now()->lastOfMonth());
7+
$weekDays = ['Dom','Seg','Ter','Qua','Qui','Sex','Sab'];
8+
@endphp
9+
@section('content')
10+
<div class="antialiased sans-serif ">
11+
<div class="mx-auto container px-4">
12+
<div class="min-h-screen bg-gray-100 py-6 flex flex-col justify-center sm:py-12">
13+
<div x-data="{day : null}" class="flex flex-wrap sm:max-w-xl divide-x-2 sm:mx-auto">
14+
<div class="z-20 relative bg-white sm:rounded-l p-2 shadow">
15+
<div class="grid grid-cols-7 grid-rows-7 gap-6">
16+
<div class="col-span-7 flex justify-between">
17+
<div><svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path></svg></div>
18+
<div>{{$month}}</div>
19+
<div><svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg></div>
20+
</div>
21+
<div class="col-span-7 flex justify-between">
22+
@foreach ($weekDays as $weekDay)
23+
<div>{{$weekDay}}</div>
24+
@endforeach
25+
</div>
26+
@foreach($days as $index => $day)
27+
<div x-on:click="day = {{$index}}" class="{{$day->isToday() ? 'text-blue-500' : '' }} px-1 hover:bg-gray-500 rounded-full text-center">{{$day->day}}</div>
28+
@endforeach
29+
</div>
30+
</div>
31+
<div x-show="day"
32+
x-transition:enter="transform transition ease-in-out duration-500 sm:duration-700"
33+
x-transition:enter-start="-translate-x-full"
34+
x-transition:enter-end="translate-x-0"
35+
x-transition:leave="transform transition ease-in-out duration-500 sm:duration-700"
36+
x-transition:leave-start="translate-x-0"
37+
x-transition:leave-end="-translate-x-full"
38+
class="z-10 relative px-4 py-10 bg-white sm:rounded-r sm:p-20">
39+
</div>
40+
</div>
41+
</div>
42+
</div>
43+
</div>
44+
@push('body-script')
45+
<script type="text/javascript">
46+
function calendar(){
47+
return {
48+
date : new Date(),
49+
50+
}
51+
}
52+
</script>
53+
@endpush
54+
@endsection
55+

resources/views/layouts/app.blade.php

+15
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@
1818
}
1919
</style>
2020
@laravelPWA
21+
@if(env('APP_DEBUG') == true)
22+
23+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/assets/css/chat.min.css">
24+
25+
26+
<script>
27+
var botmanWidget = {
28+
chatServer: '/api/botman',
29+
aboutText : 'Papo!'
30+
};
31+
</script>
32+
<script defer src='https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/js/widget.js'></script>
33+
34+
@endif
2135
</head>
2236
<body >
2337
<main class="flex bg-theme">
@@ -40,6 +54,7 @@
4054
@auth('psicologo')
4155
@include('layouts.notifications',['notifications' => true])
4256
@endauth
57+
4358
</main>
4459
@livewireScripts
4560

resources/views/livewire/cliente/views/agendar-horario/index.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
</div>
2323
@else
2424
@if($slot == null)
25-
<div class="fixed top-0 w-full p-2 bg-primary rounded-b">
25+
<div x-data="{}" class="fixed top-0 w-full p-2 bg-primary rounded-b">
2626
<label for="data" class="text-lg text-primary p-2 leading-5 mt-4">Selecione uma data</label>
27-
<input wire:model.lazy="data" wire:change="buscarData" type="date" id="data" class="w-full mt-2 rounded shadow focus:outline-none text-primary px-4 py-3 bg-white " min="{{now()->addDay()->format('Y-m-d')}}">
27+
<input data-date-inline-picker="true" wire:model.lazy="data" wire:change="buscarData" type="date" id="data" class="w-full mt-2 rounded shadow focus:outline-none text-primary px-4 py-3 bg-white " min="{{now()->addDay()->format('Y-m-d')}}">
2828
</div>
2929
@endif
3030
<div class="py-2 px-4">
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@push('styles')
2+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/assets/css/chat.min.css">
3+
@endpush
4+
@push('head-script')
5+
<script>
6+
var botmanWidget = {
7+
chatServer: '/api/botman'
8+
};
9+
</script>
10+
<script defer src='https://cdn.jsdelivr.net/npm/botman-web-widget@0/build/js/widget.js'></script>
11+
@endpush

routes/web.php

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
Route::get('/',function(){
2121
return redirect('/login');
2222
});
23+
Route::get('/assistente',[PacienteController::class,'chat']);
2324
Auth::routes(['register'=> false]);
2425
Route::livewire('/pre-cadastro','auth.pre-cadastro')
2526
->name('pre-cadastro')

0 commit comments

Comments
 (0)