@extends('layouts.app', ['title' => __tr('Edit Template')]) @section('content') @include('users.partials.header', [ 'title' => __tr('Edit Template'), 'description' => '', 'class' => 'col-lg-7' ])
@php $templateComponents = $whatsAppTemplateData['components']; $templateButtons = Arr::first($templateComponents, function ($value, $key) { return $value['type'] == 'BUTTONS'; }); @endphp
index + 1 }}' : { buttonType : '{{ $templateComponentButton['type'] }}', buttonIndex : {{ $loop->index + 1 }} }, @endforeach @endif }, }, addWhatsAppButtonOption : function(buttonType) { {{-- let uniqueBtnId = _.uniqueId(); --}} let uniqueBtnId = _.size(this.customButtons.data) + 1; this.customButtons.data[uniqueBtnId] = { buttonType : buttonType, buttonIndex : uniqueBtnId }; this.buttonModels[uniqueBtnId] = { 'text_value': '', 'example_value': '', }; this.customButtons.totalButtonsUsed++; if((buttonType == 'URL_BUTTON') || (buttonType == 'DYNAMIC_URL_BUTTON')) { this.customButtons.buttonUsesByTypes['URL_BUTTON']++; } else if((buttonType == 'COPY_CODE')) { this.customButtons.buttonUsesByTypes['COPY_CODE']++; } else if((buttonType == 'VOICE_CALL')) { this.customButtons.buttonUsesByTypes['VOICE_CALL']++; } else if((buttonType == 'PHONE_NUMBER')) { this.customButtons.buttonUsesByTypes['PHONE_NUMBER']++; } }, deleteWhatsAppButtonOption : function(buttonIndex) { let buttonType = this.customButtons.data[buttonIndex]['buttonType']; if((buttonType == 'URL_BUTTON') || (buttonType == 'DYNAMIC_URL_BUTTON')) { this.customButtons.buttonUsesByTypes['URL_BUTTON']--; } else if((buttonType == 'COPY_CODE')) { this.customButtons.buttonUsesByTypes['COPY_CODE']-- ; } else if((buttonType == 'VOICE_CALL')) { this.customButtons.buttonUsesByTypes['VOICE_CALL']-- ; } else if((buttonType == 'PHONE_NUMBER')) { this.customButtons.buttonUsesByTypes['PHONE_NUMBER']-- ; } delete this.customButtons.data[buttonIndex]; delete this.buttonModels[buttonIndex]; this.customButtons.totalButtonsUsed--; }, addNewCard : function() { this.carouselTemplateContainer.push({ headerType: '', bodyText: '', bodyTextVariables: [], cardButtons: { totalAllowedButtons:2, totalButtonsUsed:0, buttonUsesByTypes:{ QUICK_REPLY:0, QUICK_REPLY_LIMIT:1, URL:0, URL_BUTTON_LIMIT:1, PHONE_NUMBER:0, PHONE_NUMBER_LIMIT:1 }, totalUrlButtonUsed:0, data:[], } }); this.totalUsedCards++; }, deleteCard: function(index) { this.carouselTemplateContainer.splice(index, 1); this.totalUsedCards--; }, loadPlugin: function() { window.lwPluginsInit(); }, addNewVariable: function(targetId, templateType) { addNewPlaceholder(targetId, templateType); this.$nextTick(() => { this.$refs.lwCardBodyTextarea.dispatchEvent(new Event('input')); }); }, addCardButtonOptions: function(index, buttonType) { var btnData = {}; let uniqueId = _.uniqueId(); if (buttonType == 'QUICK_REPLY') { btnData = { buttonType : buttonType, buttonText: '', buttonIndex : Number(uniqueId) }; } if (buttonType == 'PHONE_NUMBER') { btnData = { buttonType : buttonType, buttonText: '', phoneNumber: '', buttonIndex : Number(uniqueId) }; } if (buttonType == 'URL') { btnData = { buttonType : buttonType, buttonText: '', url: '', example: '', buttonIndex : Number(uniqueId) }; } this.carouselTemplateContainer[index]['cardButtons']['data'].push(btnData); _.forEach(this.carouselTemplateContainer, function(item, key) { if (key >= 1) { item.cardButtons.data.push(btnData); } }); this.totalButtonsUsed++; if (_.has(this.carouselTemplateContainer[index]['cardButtons']['buttonUsesByTypes'], buttonType)) { this.carouselTemplateContainer[index]['cardButtons']['buttonUsesByTypes'][buttonType]++; this.carouselTemplateContainer[index]['cardButtons']['totalButtonsUsed']++; } }, deleteCardButtonOption: function(index, buttonIndex, buttonType) { this.carouselTemplateContainer[index]['cardButtons']['data'].splice(buttonIndex, 1); _.forEach(this.carouselTemplateContainer, function(item, key) { if (key >= 1) { item.cardButtons.data.splice(buttonIndex, 1); } }); this.carouselTemplateContainer[index]['cardButtons']['buttonUsesByTypes'][buttonType]--; this.carouselTemplateContainer[index]['cardButtons']['totalButtonsUsed']--; } }">
{{ __tr('Template Info') }}
{{ __tr('Name') }}
{{ $whatsAppTemplateData['name'] }}
{{ __tr('Language') }}
{{ $whatsAppTemplateData['language'] }}
{{ __tr('Category') }}
{{ $whatsAppTemplateData['category'] }}
{{ __tr('Status') }}
@if ($whatsAppTemplateData['status'] == 'APPROVED') @elseif ($whatsAppTemplateData['status'] == 'REJECTED') @elseif ($whatsAppTemplateData['status'] == 'PENDING') @endif {{ $whatsAppTemplateData['status'] }}
{{-- OTP and flow templates --}} @if ((($whatsAppTemplateData['sub_category'] ?? null) == 'FORM') or (($whatsAppTemplateData['category'] ?? null) == 'AUTHENTICATION'))
{{ __tr('You need to edit this template on Meta') }}
{{ __tr('Edit this Template on Meta') }}
@else
{{ __tr('Body') }} {{ __tr('Enter the text for your message in the language you\'ve selected.') }}
{{ __tr('Cards') }}