<?php
/* Smarty version 5.4.2, created on 2024-12-15 17:09:33
  from 'file:../default/products_and_services.tpl' */

/* @var \Smarty\Template $_smarty_tpl */
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
  'version' => '5.4.2',
  'unifunc' => 'content_675f539dd8f1f0_56940800',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '6a86a8336ae59fe61bb99e31dcb5a3d253b7bd14' => 
    array (
      0 => '../default/products_and_services.tpl',
      1 => 1734300393,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
))) {
function content_675f539dd8f1f0_56940800 (\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = '/Users/razib/Herd/suite/ui/theme/default';
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
?>


<?php 
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1975485644675f539dd79359_21757480', "content");
?>



<?php 
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_77089290675f539dd88fb2_42543356', "script");
?>

<?php $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, ((string)$_smarty_tpl->getValue('layouts_admin')), $_smarty_current_dir);
}
/* {block "head"} */
class Block_831776557675f539dd79a73_17423426 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = '/Users/razib/Herd/suite/ui/theme/default';
?>


    <?php
}
}
/* {/block "head"} */
/* {block "content"} */
class Block_1975485644675f539dd79359_21757480 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = '/Users/razib/Herd/suite/ui/theme/default';
?>


    <?php 
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_831776557675f539dd79a73_17423426', "head", $this->tplIndex);
?>



    <div class="row">

        <div class="col-md-12">

            <div class="panel">

                <div class="panel-hdr">
                    <h2><?php if ($_smarty_tpl->getValue('action') == 'products') {?> <?php echo $_smarty_tpl->getValue('_L')['Products'];?>
 <?php } else { ?> <?php echo $_smarty_tpl->getValue('_L')['Services'];?>
 <?php }?></h2>

                    <div class="panel-toolbar">

                        <div class="btn-group">
                            <a href="<?php echo $_smarty_tpl->getValue('_url');?>
ps/p-new" class="btn btn-primary"><i class="fal fa-plus"></i> <?php echo $_smarty_tpl->getValue('_L')['Add Product'];?>
</a>
                            <a href="<?php echo $_smarty_tpl->getValue('_url');?>
ps/s-new" class="btn btn-success"><i class="fal fa-plus"></i> <?php echo $_smarty_tpl->getValue('_L')['Add Service'];?>
</a>
                        </div>

                    </div>
                </div>

                <div class="panel-container show">

                    <div class="panel-content">
                        <div class="table-responsive">
                            <table class="table table-striped w-100" id="clx_datatable">
                                <thead style="background:#f0f2ff" >
                                <tr>
                                    <th class="bold"><?php echo $_smarty_tpl->getValue('_L')['Item Number'];?>
</th>
                                    <th class="bold"><?php echo $_smarty_tpl->getValue('_L')['Image'];?>
</th>
                                    <th class="bold"><?php echo $_smarty_tpl->getValue('_L')['Name'];?>
</th>
                                    <th class="bold"><?php echo $_smarty_tpl->getValue('_L')['Sales Price'];?>
</th>
                                    <th class="bold"><?php echo $_smarty_tpl->getValue('_L')['Cost Price'];?>
</th>
                                    <th class="bold"><?php echo $_smarty_tpl->getSmarty()->getModifierCallback('__')('Show in catalog');?>
</th>
                                    <th class="text-center bold"><?php echo $_smarty_tpl->getValue('_L')['Manage'];?>
</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php
$_from = $_smarty_tpl->getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('items'), 'item');
$foreach0DoElse = true;
foreach ($_from ?? [] as $_smarty_tpl->getVariable('item')->value) {
$foreach0DoElse = false;
?>
                                    <tr>
                                        <td>
                                            <?php echo $_smarty_tpl->getValue('item')->item_number;?>

                                        </td>
                                        <td>
                                            <?php if ($_smarty_tpl->getValue('item')->image) {?>
                                                <img alt="<?php echo $_smarty_tpl->getValue('item')->name;?>
" class="img-fluid" src="<?php echo APP_URL;?>
/storage/items/thumb<?php echo $_smarty_tpl->getValue('item')->image;?>
">
                                                <?php } else { ?>
                                                <img alt="<?php echo $_smarty_tpl->getValue('item')->name;?>
" class="img-fluid" src="<?php echo APP_URL;?>
/ui/lib/img/item_placeholder.png">
                                            <?php }?>
                                        </td>
                                        <td>
                                            <?php echo $_smarty_tpl->getValue('item')->name;?>

                                        </td>
                                        <td>
                                            <?php echo $_smarty_tpl->getSmarty()->getModifierCallback('formatCurrency')($_smarty_tpl->getValue('item')->sales_price,$_smarty_tpl->getValue('config')['home_currency'],$_smarty_tpl->getValue('format_currency_override'));?>

                                        </td>
                                        <td>

                                            <?php echo $_smarty_tpl->getSmarty()->getModifierCallback('formatCurrency')($_smarty_tpl->getValue('item')->cost_price,$_smarty_tpl->getValue('config')['home_currency'],$_smarty_tpl->getValue('format_currency_override'));?>


                                        </td>
                                        <td>
                                            <label class="switch s-icons s-outline s-outline-primary">
                                                <input type="checkbox" class="show_in_catalog" data-id="<?php echo $_smarty_tpl->getValue('item')->id;?>
" name="show_in_catalog" <?php if ($_smarty_tpl->getValue('item')->show_in_catalog) {?>checked<?php }?> value="1">
                                                <span class="slider round"></span>
                                            </label>
                                        </td>
                                        <td>

                                            <div class="btn-group float-end">

                                                <?php if ($_smarty_tpl->getValue('can_edit')) {?>
                                                    <a href="javascript:;" id="edit_item_<?php echo $_smarty_tpl->getValue('item')->id;?>
" class="btn edit_item btn-primary btn-icon waves-effect waves-themed has-tooltip" data-title="<?php echo $_smarty_tpl->getValue('_L')['Edit'];?>
" data-placement="top"><i class="fal fa-pencil"></i> </a>
                                                <?php }?>

                                                <?php if ($_smarty_tpl->getValue('action') == 'products') {?>
                                                    <a target="_blank" href="<?php echo $_smarty_tpl->getValue('_url');?>
inventory/barcode/<?php echo $_smarty_tpl->getValue('item')->id;?>
" class="btn btn-dark btn-icon waves-effect waves-themed has-tooltip" data-title="<?php echo $_smarty_tpl->getValue('_L')['Barcode'];?>
" data-placement="top"><i class="fal fa-barcode"></i> </a>
                                                <?php }?>

                                                <?php if ($_smarty_tpl->getValue('can_delete')) {?>

                                                    <a href="javascript:;" onclick="confirmThenGoToUrl(event,'delete/ps/<?php echo $_smarty_tpl->getValue('item')->id;?>
')"  class="btn btn-danger btn-icon waves-effect waves-themed has-tooltip" data-title="<?php echo $_smarty_tpl->getValue('_L')['Delete'];?>
" data-placement="top"><i class="fal fa-trash-alt"></i> </a>

                                                <?php }?>

                                            </div>

                                        </td>
                                    </tr>
                                <?php
}
$_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>

                                </tbody>

                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

<?php
}
}
/* {/block "content"} */
/* {block "script"} */
class Block_77089290675f539dd88fb2_42543356 extends \Smarty\Runtime\Block
{
public function callBlock(\Smarty\Template $_smarty_tpl) {
$_smarty_current_dir = '/Users/razib/Herd/suite/ui/theme/default';
?>


    <?php echo '<script'; ?>
>

        $(function () {
            var $modal = $('#cloudonex_body');
            $('#clx_datatable').dataTable(
                {
                    responsive: true,
                    "language": {
                        "emptyTable": "<?php echo $_smarty_tpl->getValue('_L')['No items to display'];?>
",
                        "info":      "<?php echo $_smarty_tpl->getValue('_L')['Showing _START_ to _END_ of _TOTAL_ entries'];?>
",
                        "infoEmpty":      "<?php echo $_smarty_tpl->getValue('_L')['Showing 0 to 0 of 0 entries'];?>
",
                        buttons: {
                            pageLength: '<?php echo $_smarty_tpl->getValue('_L')['Show all'];?>
'
                        },
                        searchPlaceholder: "<?php echo $_smarty_tpl->getSmarty()->getModifierCallback('__')('Search');?>
"
                    },
                }
            );

            $modal.on('click', '.edit_item', function(e){
                e.preventDefault();
                var vid = this.id;
                var id = vid.replace("edit_item_", "");
                id = id.replace("t", "");


                $.fancybox.open({
                    src  :  base_url + 'ps/edit-form/' + id,
                    type : 'ajax',
                    opts : {
                        afterShow : function( instance, current ) {
                            $('.amount').autoNumeric('init', {

                                aSign: '<?php echo $_smarty_tpl->getValue('config')['currency_code'];?>
',
                                dGroup: '<?php echo $_smarty_tpl->getValue('config')['thousand_separator_placement'];?>
',
                                aPad: '<?php echo $_smarty_tpl->getValue('config')['currency_decimal_digits'];?>
',
                                pSign: '<?php echo $_smarty_tpl->getValue('config')['currency_symbol_position'];?>
',
                                aDec: '<?php echo $_smarty_tpl->getValue('config')['dec_point'];?>
',
                                aSep: '<?php echo $_smarty_tpl->getValue('config')['thousands_sep'];?>
',
                                vMax: '9999999999999999.00',
                                vMin: '-9999999999999999.00',

                                <?php if ((null !== ($_smarty_tpl->getValue('config')['decimal_places_products_and_services'] ?? null))) {?>
                                mDec: '<?php echo $_smarty_tpl->getValue('config')['decimal_places_products_and_services'];?>
',
                                <?php }?>

                            });

                            $('#description').redactor(
                                {
                                    minHeight: 200 // pixels
                                }
                            );

                            //  new Clipboard('.ib_btn_copy');

                            var $file_link = $("#file_link");
                            var ib_submit = $("#update");

                            var ib_file = new Dropzone("#upload_container",
                                {
                                    url: base_url + "ps/upload/",
                                    maxFiles: 1
                                }
                            );


                            ib_file.on("sending", function() {

                                ib_submit.prop('disabled', true);

                            });

                            ib_file.on("success", function(file,response) {

                                ib_submit.prop('disabled', false);

                                upload_resp = response;

                                if(upload_resp.success == 'Yes'){

                                    toastr.success(upload_resp.msg);
                                    // $file_link.val(upload_resp.file);
                                    $('#file_link_image').val(upload_resp.file);


                                }
                                else{
                                    toastr.error(upload_resp.msg);
                                }


                            });

                        },
                        touch: false,
                        autoFocus: false,
                        keyboard: false,
                    },
                });
            });

            $modal.on('click', '#update', function(event){
                event.preventDefault();
                $.post(base_url + 'ps/edit-post/', $('#edit_form').serialize(), function(data){
                    if ($.isNumeric(data)) {

                        location.reload();
                    }
                    else {

                        toastr.error(data);

                    }

                });

            });

            $modal.on('click', '.show_in_catalog', function(){

                var id = $(this).data('id');
                var show_in_catalog = $(this).is(':checked') ? 1 : 0;

                $.post(base_url + 'ps/show-in-catalog/', { id: id, show_in_catalog: show_in_catalog }, function(data){

                });

            });



        });

    <?php echo '</script'; ?>
>
<?php
}
}
/* {/block "script"} */
}
