Skip to content

Commit

Permalink
oops I forgot to commit for a week type commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian committed Oct 7, 2024
1 parent 63d6d9d commit 39e04a0
Show file tree
Hide file tree
Showing 21 changed files with 887 additions and 56 deletions.
37 changes: 37 additions & 0 deletions deletetemplate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
require_once __DIR__."/vendor/autoload.php";
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";

header("Content-Type: application/json");

foreach ($_SESSION['user']['extension'] as $ext) {
if ($ext['extension_uuid'] == $_GET['extension_uuid']) {
$extension = $ext;
break;
}
}


if (!$extension) {
http_response_code(400);
echo json_encode(array("error" => "invalid or unauthorized extension"));
die();
}
$database = new database;

$sql = "DELETE from webtexting_message_templates WHERE domain_uuid = :domain_uuid AND email_template_uuid = :template_uuid;";
$parameters['domain_uuid'] = $domain_uuid;
$parameters['template_uuid'] = $_GET['template_uuid'];
$deleted = $database->select($sql, $parameters, 'all');
if($deleted){
message::add("template deleted.");
} else {
message::add("error deleting template.", 'negative');
}
echo(json_encode($templates));
return json_encode($templates);
// unset($parameters);
// //do an edit template
// //$domain_uuid;
67 changes: 67 additions & 0 deletions frontend/components/EmailForwardMenu/EmailForwardMenu.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<script lang="ts">
import {emitter} from '../../lib/global';
export default{
name:"ForwardingPlaceholder",
props:{
selectedConvo: Boolean,
},
data(){
return{
emailForwardFormInputs:{
phoneNumber:'',
emailAddress:''
}
}
},
methods: {
submitEmailForwardingRegisterRequest(){
event.preventDefault();
const params = {
email_address: this.$data.emailForwardFormInputs.emailAddress.trim(),
own_number: this.$data.emailForwardFormInputs.phoneNumber.trim()
}
emitter.emit("register-email-forwarding",params);
}
},
}
</script>
<template>
<div id="NO_MESSAGES" >
<p v-if="!selectedConvo" class="center"> Forward new text messages to your Email</p>
<div class="template-form ">
<div class="mt-form-row">
<div class="category-template-uuid">Your phone number</div>
<div class="area-for-text"> <textarea v-model="emailForwardFormInputs.phoneNumber"></textarea></div>

</div>
<div class="mt-form-row">
<div class="category-desc">Email Address to forward messages to.</div>
<div class="area-for-text"> <textarea v-model="emailForwardFormInputs.emailAddress"></textarea></div>

</div>
<button class="submit" @click="submitEmailForwardingRegisterRequest">Submit</button>
</div>
</div>
</template>
<style scoped>
#NO_MESSAGES {
grid-column-start: 2;
grid-column-end: 2;
display: grid;
grid-template-columns: auto;
grid-template-rows: auto;
}
.center{
grid-column-start: 1;
grid-row-start: 1;
align-self: center;
justify-self: center;
}
@media screen and (width <=700px) {
#NO_MESSAGES{
display:none;
}
}
</style>
5 changes: 2 additions & 3 deletions frontend/components/MenuList/MenuList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ export default {
<h6 class="m-auto">Settings</h6>
</div>
</div>
<MenuPreview name="templates" link='templates.php' descriptions="Manage Message Templates"
></MenuPreview>

<MenuPreview name="Templates" link='templates.php' descriptions="Manage Message Templates" ></MenuPreview>
<MenuPreview name="Email Forwarding" link='email_forwarding.php' descriptions="Manage Email Forwarding"></MenuPreview>
<div class="threadlist-table">
<div class="preview_list_container">

Expand Down
13 changes: 1 addition & 12 deletions frontend/components/MenuPreview/MenuPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,9 @@ export default {
<div class="menu-preview-container" >
<span class='menu-name' >{{
this.name }}</span>
<span class='timestamp'
:data-timestamp="this.timestamp"></span>

<span class='menu-last-message' >{{
this.description }}</span>
<div class="new-messages">
<span class="new-message-alert-dot bgc-AN-orange" v-if="newMessages>0">{{this.newMessages}}</span>
</div>
</div>


Expand Down Expand Up @@ -108,13 +103,7 @@ export default {
color: white;
}
.text-center {
margin: 0;
position: relative;
top: 50%;
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.activeMenu {
color: white;
Expand Down
4 changes: 2 additions & 2 deletions frontend/components/PaginatorButton/PaginatorButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default{
props:{
},
data(){
return {oldestMessage: state.oldestMessage,
return {
morePreviewsAvailable: true}
},
methods:{
Expand All @@ -32,7 +32,7 @@ export default{
<template>
<div class="paginator_container" >

<a id='MORE-PREVIEWS' class="paginator" role="button" v-if="this.morePreviewsAvailable" @click="paginatorClickFunction" :data-oldest-message="oldestMessage">
<a id='MORE-PREVIEWS' class="paginator" role="button" v-if="this.morePreviewsAvailable" @click="paginatorClickFunction" >
<span class="paginator-link">Load More</span>
</a>

Expand Down
1 change: 1 addition & 0 deletions frontend/components/SendBox/SendBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ export default {
<button class="btn btn-send"
:disabled="(pendingAttachments.length == 0 && enteredText.length == 0 ) || !state.connected"
v-on:click="send"><span class="fas fa-paper-plane fa-fw"></span></button>
<button class="btn btn-send"><span class="fas">T</span></button>
</div>
<div class="char-counter-box">
<div class="char-counter-display">{{ enteredText.length }} / 160</div>
Expand Down
113 changes: 113 additions & 0 deletions frontend/components/TemplatePreview/TemplatePreview.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<script lang='ts'>
//lets add a delete button and an edit button
import {emitter} from '../../lib/global';
export type TemplatePreviewInterface = {
link:{
type:String,
optional: true
},
template_uuid:{
type: String,
optional: true
},
body:{
type: String
},
category:{
type: String
},
subcategory:{
type: String
},
language:{
type: String
},
subject:{
type: String,
},
templateType:{
type: String
},
enabled:{
type: String
},
description: {
type: String
},
}
export default {
name:'TemplatePreview',
props:{
link:{
type:String,
optional: true
},
template_uuid:{
type: String,
optional: true
},
body:{
type: String
},
category:{
type: String
},
subcategory:{
type: String
},
language:{
type: String
},
subject:{
type: String,
},
templateType:{
type: String
},
enabled:{
type: String
},
description: {
type: String
},
},
methods:{
menuLinkClickHandler(){
console.log(this.description)
emitter.emit("template-change",this.props)
},
deleteTemplateRequest(){
emitter.emit("delete-template-request",{template_uuid: this.template_uuid})
}
},
mounted(){
console.log(this.link);
},
//mounted click event emitter
}
</script>
<template>
<tr>
<th scope='col' >{{this.category }}</th>
<th scope='col' >
{{this.description }}
</th>
<th scope="col">
<router-link :to="this.link" class="template-preview-link" v-bind="this.props" @click="menuLinkClickHandler">
Edit Template
</router-link>
</th>
<td scope="col" class="align-middle text-center" >
<div class="btn-danger p-2 rounded align-middle text-center" @click="deleteTemplateRequest">
<span>Delete</span>
</div>
</td>
</tr>

</template>

<style scoped>
</style>
Loading

0 comments on commit 39e04a0

Please sign in to comment.